/* Vivid handheld-console palette and pixel edges. */
:root {
  --paper: #fff3cf;
  --ink: #252046;
  --line: #9f8db8;
  --orange: #ff573b;
  --lilac: #bc8dff;
  --screen: #b6f06b;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
}
body {
  background-color: var(--paper);
  background-image: url("game-doodles.svg"),
    linear-gradient(#2520460a 1px, transparent 1px),
    linear-gradient(90deg, #2520460a 1px, transparent 1px);
  background-size: 620px 480px, 24px 24px, 24px 24px;
}
@media (max-width: 550px) {
  body { background-size: 460px auto, 24px 24px, 24px 24px; }
}
header { border-bottom: 2px solid var(--ink); }
#brand { font-family: var(--mono); letter-spacing: -.09em; }
#brand span { animation: none; color: #e04a66; }
.top-note, .eyebrow { background: #c6abff; color: #35205c; transform: none; box-shadow: none; font-family: var(--mono); }
.hero .eyebrow { background: #ffa4d2; }
button, .account-link { border-radius: 2px; box-shadow: 3px 3px 0 #252046; background: #fff9e8; }
button:hover { background: #ffe360; box-shadow: 4px 4px 0 var(--ink); }
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.small, .game-pin, #count { background: #c6abff; border-radius: 2px; }
.dark, .dark:hover { background: #5b33a3; color: #fff9e8; }
.dark:hover { background: #6b3ec0; }
.hero { padding: 56px 0 46px; gap: clamp(22px, calc(6vw / var(--site-zoom, 1)), 78px); }
.hero h1 { font-family: var(--mono); letter-spacing: -.09em; text-shadow: 3px 3px 0 #dec7ff; }
.hero h1 em { color: #cf2f58; text-shadow: none; transform: none; }
.hero p { color: #514669; }
.games { gap: 16px; }
.games .game-card .game {
  min-height: 220px;
  isolation: isolate;
  background: var(--cartridge, #ff99cc);
  border: 2px solid var(--ink);
  border-radius: 2px;
  box-shadow: 4px 4px 0 var(--ink);
}
.games .game-card .game::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--tile-art) right -12px bottom -5px / min(92%, 260px) auto no-repeat;
  opacity: .52;
  mask-image: linear-gradient(90deg, transparent, #000 64%);
  pointer-events: none;
}
.games .game-card .game:hover { transform: translateY(-2px); filter: saturate(1.12); }
#games .game-card:nth-child(8n+2) { --cartridge: #ffd94e; }
#games .game-card:nth-child(8n+3) { --cartridge: #a8eb69; }
#games .game-card:nth-child(8n+4) { --cartridge: #ff9b6f; }
#games .game-card:nth-child(8n+5) { --cartridge: #c0a2ff; }
#games .game-card:nth-child(8n+6) { --cartridge: #70e0d4; }
#games .game-card:nth-child(8n+7) { --cartridge: #ff9daa; }
#games .game-card:nth-child(8n+8) { --cartridge: #99d7ff; }
.games .game-card .game .icon {
  background: #fff6d9;
  border-radius: 2px;
  border: 2px solid var(--ink);
  transform: none;
  box-shadow: 3px 3px 0 #252046;
  margin-bottom: 14px;
}
.games .game .arrow { background: #fff5cf; border-radius: 2px; }
.game-pin[aria-pressed="true"], .favourite-section .section-head .favourite-star { background: #f8d633; }
.favourite-section { background: #ffe991; border-radius: 2px; }
.favourite-section .games .game-card .game { background: #fff3a9; }
.how > span:nth-child(n) { background: #c6abff; }
.stage-card, dialog { background: #fff9e8; border-radius: 2px; }
.stage-card h2 { color: #5c31a7; }
.stage-card .chip, .stage-card .prompt, .board-offer, .room-wait { background: #ffe991; border-radius: 2px; }
.timer { color: #bd2559; text-shadow: none; font-family: var(--mono); }
.actions button:nth-child(n), .player-grid button, .score, .room-player-list > span { background: #c6abff; }
.actions button.dark { background: #5b33a3; }
input, textarea, select, .board-controls { background: #fffdf4; border-radius: 2px; }
.island-map { background: #a4d7fa; border-radius: 2px; }
.property-space { background: color-mix(in srgb, var(--space) 45%, #fff3cf); border-radius: 2px; }
.property-centre { background: #f8d633; border-radius: 2px; }
.board-cell:nth-child(n) { background: #c4b0f4; }
.board-cell:nth-child(4n+2) { background: #ffb59e; }
.board-cell:nth-child(4n+3) { background: #b6ed86; }
.board-cell.goal { background: #ff87ba; }
#toast { background: #5b33a3; box-shadow: 3px 3px 0 #f8d633; }
dialog:has(.profile-form:not([hidden])) { width: min(calc(92vw / var(--site-zoom, 1)), 650px); }
.profile-form fieldset { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); gap: 18px; margin-bottom: 16px; }
.profile-preview { display: flex; flex-direction: column; align-items: start; gap: 8px; }
.profile-avatar {
  width: min(100%, 160px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 #5b33a3;
  background: #c4e9ff;
}
.profile-avatar svg, .profile-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-preview button { padding: 6px 8px; }
.photo-upload { display: grid; gap: 3px; }
.photo-upload input { max-width: 100%; font-size: 12px; }
.profile-form input[type="checkbox"] { width: auto; }
.profile-details > label, .profile-parts label { display: block; text-align: left; }
.profile-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 9px; }
.profile-details input, .profile-parts select { width: 100%; }
#profileStatus { min-height: 1.5em; }
@media (max-width: 550px) {
  .hero { padding: 24px 0 30px; }
  .games .game-card .game { min-height: 205px; }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-preview { align-items: start; }
  .profile-avatar { width: 112px; }
}
.profile-shop { margin-top: 18px; padding: 12px; border: 2px solid var(--ink); background: #e6d6ff; }
.profile-shop h3 { margin: 0 0 6px; }
.skin-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.skin-list button { min-width: 0; font-size: 12px; padding: 6px; border-left: 8px solid var(--skin); }
.playing-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 7px 0; }
.playing-card { display: inline-grid; align-content: center; justify-items: center; gap: 3px; min-width: 44px; padding: 5px; aspect-ratio: .73; border: 2px solid var(--ink); background: #fffaf0; box-shadow: 2px 2px 0 var(--ink); font: 800 17px var(--mono); }
.playing-card.card-red { color: #b9284e; }
.playing-card[aria-pressed="true"] { background: #b6f06b; transform: translateY(-5px); }

.card-table {
  display: grid;
  gap: 10px;
  margin: 18px auto;
}
.table-felt {
  min-height: 124px;
  display: grid;
  place-content: center;
  padding: 12px;
  border: 7px solid #805445;
  border-radius: 48px;
  background:
    radial-gradient(circle, #dbf2bd29 0.6px, transparent 1px) 0 0 / 4px 4px,
    repeating-linear-gradient(135deg, #093e2a20 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 48% 36%, #268857, #12503e 86%);
  color: #fff3cf;
  box-shadow: 0 0 0 2px #402538, 2px 4px 0 2px #402538,
    inset 0 0 0 2px #164c39, inset 0 0 0 4px #79bb883b;
}
.table-felt h3, .table-felt p { margin: 2px 0; color: #fff3cf; }
.table-felt .playing-card { color: var(--ink); }
.table-felt .card-red { color: #b9284e; }
.table-card-slot {
  width: 44px;
  aspect-ratio: .73;
  border: 2px dashed #9bc7a3;
  border-radius: 2px;
}
.table-seats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.table-seat {
  display: grid;
  min-width: 0;
  max-width: 135px;
  padding: 4px 8px;
  border: 2px solid #402538;
  background: #fff3cf;
  font-size: 12px;
  line-height: 1.35;
}
.table-seat b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-seat-active { background: #f8d633; }
.card-hand-tray {
  padding: 8px;
  border: 2px solid var(--ink);
  background: #fff3cf;
}
.card-hand-tray h3 { margin: 4px 0; }
.hand-guide { margin-top: 8px; text-align: left; }
.hand-guide summary { cursor: pointer; font-weight: 800; }
.hand-guide select { width: 100%; }
.hand-types { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px 0; }
.hand-types span { padding: 2px 6px; background: #e6d6ff; border: 1px solid var(--ink); }
.selection-status { min-height: 1.4em; margin: 6px 0; }
@media (max-width: 550px) {
  .table-felt { min-height: 94px; padding: 6px; border-radius: 26px; }
  .table-felt .playing-cards { gap: 4px; }
  .table-felt .playing-card, .table-card-slot { min-width: 0; width: clamp(24px, calc(8vw / var(--site-zoom, 1)), 44px); padding: 3px; }
}

#headerMenu {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
#headerMenu button {
  min-height: 48px;
  padding: 10px 15px;
  font-size: 16px;
}
#homeProfile:not([hidden]) {
  display: grid;
  gap: 10px;
  width: min(100% - 8px, 430px);
  justify-self: center;
  padding: 12px;
  background: #bc8dff;
  border: 3px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  text-align: left;
}
.home-profile-label { font: 800 12px var(--mono); letter-spacing: .12em; }
#homeProfileImage {
  display: block;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  background: var(--screen);
}
#homeProfileImage svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#homeProfileName { font-size: 18px; overflow-wrap: anywhere; }
.game-category + .game-category { margin-top: 28px; }
.game-category > h3 {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 10px;
  background: #c6abff;
  border-left: 4px solid var(--ink);
  font: 800 16px var(--mono);
}
@media (max-width: 650px) {
  #headerMenu { flex: 1 0 100%; padding-bottom: 4px; }
  #headerMenu button { flex: 1 1 auto; }
}

.game-view-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 20px;
}
.game-view-picker button {
  min-height: 44px;
  padding: 8px 14px;
}
.game-view-picker button[aria-pressed="true"] { background: #c6abff; }
#allGames[hidden] { display: none; }

.thirteen-history { margin: 0 auto 16px; max-width: 680px; text-align: left; }
.thirteen-history h3 { margin: 0 0 6px; font-size: 16px; }
.thirteen-history ol {
  max-height: 136px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border: 2px solid var(--ink);
  background: #fff5dc;
}
.thirteen-history li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 6px 9px;
  overflow-wrap: anywhere;
}
.thirteen-history li + li { border-top: 1px solid var(--line); }
.history-cards { display: flex; flex-wrap: wrap; gap: 4px; }
.history-card {
  padding: 2px 5px;
  border: 1px solid var(--ink);
  background: #fffaf0;
  font: 800 14px var(--mono);
}
.history-card.card-red { color: #b9284e; }

.thirteen-table {
  width: 100%;
  max-width: 860px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3.6fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  align-items: center;
  gap: 7px;
}
.thirteen-table .table-felt {
  grid-area: 2 / 2;
  min-width: 0;
  min-height: 154px;
  padding: 10px 4px;
  border-radius: 50%;
  text-align: center;
  overflow-wrap: anywhere;
}
.thirteen-table .table-felt > * { min-width: 0; }
.thirteen-table .table-felt h3 { font-size: 15px; }
.thirteen-table .table-seat { width: 100%; justify-self: center; text-align: center; }
.thirteen-table [data-seat="top"] { grid-area: 1 / 2; }
.thirteen-table [data-seat="left"] { grid-area: 2 / 1; }
.thirteen-table [data-seat="right"] { grid-area: 2 / 3; }
.thirteen-table [data-seat="bottom"] { grid-area: 3 / 2; }
.thirteen-table .table-felt .playing-cards { gap: 3px; }
.thirteen-table .table-felt .playing-card { width: clamp(22px, calc(7vw / var(--site-zoom, 1)), 42px); min-width: 0; }
@media (max-width: 550px) {
  .thirteen-table { gap: 5px; }
  .thirteen-table .table-felt { min-height: 126px; border-width: 5px; }
  .thirteen-table .table-seat { padding: 4px 2px; font-size: 11px; }
  .thirteen-table .table-felt .playing-card { padding: 2px; font-size: 13px; }
}
@media (prefers-reduced-motion: no-preference) {
  .thirteen-play-enter { animation: thirteen-card-slide 240ms ease-out both; }
  #roomMain .card-hand-tray .playing-card[data-pick-card] { transition: transform 150ms ease-out; }
  @keyframes thirteen-card-slide {
    from { opacity: 0; transform: translateY(9px) scale(.94); }
    to { opacity: 1; transform: none; }
  }
}

@media (min-width: 1050px) {
  #home { width: calc(100% - 80px); max-width: 1360px; }
  #home .hero { max-width: 1200px; margin-inline: auto; }
  #play .stage-card, #roomMain .stage-card {
    width: calc(100% - 40px);
    max-width: 1320px;
    padding: 40px;
  }
  #play, #roomMain { width: calc(100% - 56px); max-width: 1440px; }
  .thirteen-table { max-width: 1100px; }
  .thirteen-table .table-felt { min-height: 235px; border-width: 10px; }
  .thirteen-table .table-seat { max-width: 160px; font-size: 14px; }
  .thirteen-table .table-felt .playing-card { width: 52px; font-size: 20px; }
  .thirteen-table ~ .card-hand-tray .playing-card { min-width: 56px; font-size: 20px; }
}

.seat-avatar {
  display: block;
  justify-self: center;
  width: min(100%, 42px);
  margin-bottom: 5px;
  border: 2px solid var(--ink);
  border-radius: 7px 7px 3px 3px;
  overflow: hidden;
  background: #c6abff;
  box-shadow: 0 3px 0 #402538;
}
.seat-avatar svg { display: block; width: 100%; height: auto; }
.thirteen-table .table-felt .last-play-label { margin-top: 5px; font-size: 11px; }
@media (max-width: 550px) {
  .seat-avatar { width: min(100%, 32px); }
}
@media (min-width: 1050px) {
  .thirteen-table .seat-avatar { width: 48px; }
}

.table-seat {
  border-radius: 9px 9px 5px 5px;
  box-shadow: 0 2px 0 #402538;
}
.table-seat-active { outline: 2px solid #ef9638; outline-offset: 1px; }

.game-controls-bar {
  display: none;
  position: sticky;
  top: 8px;
  z-index: 3;
  width: min(calc(100% - 36px), 1320px);
  margin: 8px auto;
  justify-content: flex-end;
  pointer-events: none;
}
/* Background settings apply only while a game is open. */
body[data-game-scene][data-game-background="illustrated"] {
  background-color: #f5eddb;
  background-image: var(--game-art),
    linear-gradient(#49355b0c 1px, transparent 1px),
    linear-gradient(90deg, #49355b0c 1px, transparent 1px);
  background-size: 360px 248px, 24px 24px, 24px 24px;
}
body[data-game-scene][data-game-background="illustrated"] :is(#play, #roomMain) .stage-card:not(.card-game-stage) {
  background: linear-gradient(#fff9e8bb, #fff9e8bb), var(--game-art) #fff9e8;
  background-size: auto, 360px 248px;
}
body[data-game-scene][data-game-background="arcade"] {
  background-color: #e7d7ff;
  background-image: linear-gradient(#623bb426 1px, transparent 1px),
    linear-gradient(90deg, #623bb426 1px, transparent 1px);
  background-size: 28px 28px;
}
body[data-game-scene][data-game-background="felt"] {
  background-color: #d2e6cd;
  background-image: radial-gradient(circle, #527a5833 .6px, transparent 1px);
  background-size: 4px 4px;
}
body[data-game-scene][data-game-background="plain"] { background: var(--paper); }
.game-background-picker {
  display: none;
  align-items: center;
  gap: 6px;
  margin: 0 auto 0 0;
  padding: 3px 7px;
  background: #fff9e8;
  border: 2px solid var(--ink);
  font-size: 12px;
  font-weight: 800;
  pointer-events: auto;
}
.game-background-picker select {
  width: auto;
  margin: 0;
  padding: 4px;
  font-size: 12px;
}
body[data-game-scene] .game-controls-bar { display: flex; gap: 8px; align-items: flex-start; }
body[data-game-scene] .game-background-picker { display: flex; }
@media (max-width: 420px) {
  .game-background-picker { flex-direction: column; align-items: flex-start; gap: 0; }
}

.thirteen-workspace { display: grid; align-items: start; gap: 12px; }
.thirteen-history {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px;
  border: 2px solid var(--ink);
  background: #fff9e8;
  box-shadow: 3px 3px 0 var(--ink);
}
.thirteen-history p { margin: 0; font-size: 13px; }
.thirteen-history ol { max-height: 114px; }
@media (min-width: 900px) {
  .thirteen-workspace { grid-template-columns: clamp(185px, calc(16vw / var(--site-zoom, 1)), 255px) minmax(0, 1fr); gap: 18px; }
  #roomMain .thirteen-workspace .stage-card { width: 100%; max-width: none; margin-inline: 0; }
  .thirteen-history { position: sticky; top: 64px; }
  .thirteen-history ol { max-height: min(calc(58vh / var(--site-zoom, 1)), 540px); }
}
@media (min-width: 1050px) {
  #play, #roomMain { width: calc(100% - 36px); max-width: 1720px; }
  #play .stage-card, #roomMain .stage-card { width: 100%; max-width: 1600px; min-height: 420px; }
  .game-controls-bar { width: min(calc(100% - 36px), 1720px); }
  #roomMain .thirteen-workspace .stage-card { padding-inline: 24px; }
  .thirteen-table { max-width: 1260px; }
  .thirteen-table .table-felt { min-height: clamp(235px, calc(24vh / var(--site-zoom, 1)), 320px); }
}

.favourite-section { padding: clamp(10px, calc(1.5vw / var(--site-zoom, 1)), 16px); }
.favourite-section .section-head { margin-bottom: 10px; }
.favourite-section .section-head h2 { font-size: clamp(17px, calc(2.2vw / var(--site-zoom, 1)), 22px); }
#favouriteGames { grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); gap: 10px; }
#favouriteGames .game-card .game { min-height: 88px; padding: 8px 9px; }
#favouriteGames .game-card .game .icon { width: 26px; height: 26px; margin-bottom: 15px; font-size: 15px; }
#favouriteGames .game h3 { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
#favouriteGames .game p, #favouriteGames .game small, #favouriteGames .game .arrow { display: none; }
#favouriteGames .game-pin { top: 5px; right: 5px; }

#favouriteGames .game-card .game::before {
  background-size: min(100%, 150px) auto;
  background-position: right -10px bottom -8px;
  opacity: .38;
}

/* The homepage uses the available screen height. Game lists page in place. */
body:has(#home:not([hidden])) {
  display: flex;
  flex-direction: column;
  height: calc(100dvh / var(--site-zoom, 1));
}
body:has(#home:not([hidden])) > header {
  flex: none;
  min-height: 0;
  padding-block: 9px;
  gap: 8px;
}
body:has(#home:not([hidden])) > footer { display: none; }
#home:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: min(calc(100% - 32px), 1360px);
  min-height: 0;
  margin: 0 auto;
  padding: 9px 0 12px;
  gap: 10px;
}
#home .hero {
  width: 100%;
  flex: none;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0 0 5px;
  gap: 12px;
}
#home .hero h1 { margin: 3px 0; font-size: clamp(29px, calc(5.4vw / var(--site-zoom, 1)), 72px); }
#home .hero p { margin: 2px 0; font-size: 14px; line-height: 1.3; }
#home .hero .dark { min-height: 40px; margin: 6px 0 0; padding: 5px 10px; font-size: 13px; }
#homeProfile:not([hidden]) {
  width: clamp(106px, calc(24vw / var(--site-zoom, 1)), 288px);
  grid-template-columns: auto minmax(0, 1fr);
  align-content: center;
  align-items: center;
  gap: 5px 8px;
  padding: 7px;
}
#homeProfileImage { grid-column: 1; grid-row: 1 / 3; width: clamp(60px, calc(10vw / var(--site-zoom, 1)), 142px); }
#homeProfileName { font-size: clamp(12px, calc(1.6vw / var(--site-zoom, 1)), 18px); line-height: 1.2; }
#homeProfile .home-profile-label { font-size: 10px; }

#home .favourite-section { flex: none; margin: 0; padding: 5px 7px 8px; }
#home .section-head { gap: 8px; margin: 0; }
#home .section-head h2 { margin: 0; font-size: clamp(16px, calc(2vw / var(--site-zoom, 1)), 23px); }
#homeHelpOpen { min-height: 38px; padding: 3px 8px; font-size: 12px; }
#homeHelp .how { margin: 12px 0 0; }

#regularGamesSection:not([hidden]) {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
}
#home .library-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
#home .game-view-picker { gap: 6px; margin: 0; }
#home .game-view-picker button, #home .library-pager button {
  min-height: 40px;
  padding: 3px 8px;
  font-size: 13px;
}
#gameCategoryPicker { width: auto; max-width: 100%; min-height: 40px; margin: 0; padding: 4px; font-size: 13px; }
#home .library-pager:not([hidden]) { display: flex; align-items: center; gap: 6px; }
#gamePager { margin-left: auto; }
#home .library-pager button { min-width: 40px; font-size: 18px; line-height: 1; }
#home .library-pager button:disabled { opacity: .46; box-shadow: none; }
#home .library-pager span { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#home #games { min-height: 0; container-type: size; }
#home #games .games { grid-auto-rows: min(var(--tile-height), 100cqh); }
#home .games {
  --tile-min: 188px;
  --tile-height: 110px;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--tile-min), 100%), 1fr));
  grid-auto-rows: var(--tile-height);
  gap: 8px;
}
#home #favouriteGames { --tile-min: 158px; --tile-height: 57px; }
#home .game-category { margin: 0; }
#home .game-category > h3 { display: none; }
#home .games .game-card .game {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
  align-content: center;
  align-items: center;
  min-height: 0;
  padding: 5px 48px 5px 7px;
}
#home .games .game-card .game .icon {
  width: 24px;
  height: 24px;
  margin: 0;
  font-size: 15px;
}
#home .games .game h3 { margin: 0; font-size: 14px; line-height: 1.15; overflow-wrap: anywhere; }
#home .games .game :is(p, small, .arrow) { display: none; }
#home .games .game-pin { top: 50%; right: 4px; margin-top: -22px; }
#home .games .game::before { background-size: min(95%, 156px) auto; }
@media (max-width: 680px) {
  body:has(#home:not([hidden])) .top-note { display: none; }
  body:has(#home:not([hidden])) #headerMenu {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 6px;
    padding: 0 0 4px;
  }
  body:has(#home:not([hidden])) #headerMenu button {
    min-height: 42px;
    padding: 4px;
    font-size: 12px;
  }
  #home .games { --tile-min: 139px; --tile-height: 98px; }
  #home #favouriteGames { --tile-min: 136px; }
  #home .hero p, #home .console-top, #home .console-bottom, #home .console-screen > span { display: none; }
  #homeProfile:not([hidden]) { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  #homeProfileImage { grid-row: auto; }
  #home .hero p, #homeProfile .home-profile-label { display: none; }
  #home .games .game-card .game { grid-template-columns: minmax(0, 1fr); }
  #home .games .game-card .game .icon { display: none; }
}
@media (max-height: 620px) {
  #home:not([hidden]) { gap: 7px; padding-top: 7px; }
  #home .hero h1 { font-size: clamp(27px, calc(5vw / var(--site-zoom, 1)), 48px); }
  #home .hero p, #home .hero .eyebrow { display: none; }
  #homeProfile:not([hidden]) { width: min(calc(24vw / var(--site-zoom, 1)), 172px); gap: 3px; }
  #homeProfileImage { width: 48px; }
  #home .games { --tile-height: 72px; }
  #home #favouriteGames { --tile-height: 50px; }
}

@media (max-width: 420px) {
  body:has(#home:not([hidden])) > header { padding-block: 5px; gap: 4px; }
  body:has(#home:not([hidden])) #brand { font-size: 28px; }
  body:has(#home:not([hidden])) #headerMenu button { line-height: 1.15; }
  #home .library-controls, #home .game-view-picker, #home .library-pager:not([hidden]) { gap: 4px; }
  #home .game-view-picker button { padding-inline: 5px; font-size: 12px; }
  #home .library-pager button { min-width: 36px; }
  #home #favouriteGames { --tile-min: 125px; }
  #homeProfile:not([hidden]) { width: 104px; }
  #homeProfileName { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-height: 480px) and (min-width: 560px) {
  body:has(#home:not([hidden])) > header { flex-wrap: nowrap; padding-block: 5px; }
  body:has(#home:not([hidden])) #brand { font-size: 26px; }
  body:has(#home:not([hidden])) .top-note { display: none; }
  body:has(#home:not([hidden])) #headerMenu { flex: 0 1 auto; display: flex; padding: 0; }
  body:has(#home:not([hidden])) #headerMenu button { min-height: 40px; padding: 3px 8px; font-size: 12px; }
  #home:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.8fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: start;
    column-gap: 12px;
  }
  #home .hero { grid-area: 1 / 1; grid-template-columns: 1fr; margin: 0; gap: 6px; }
  #home .hero h1 { font-size: clamp(20px, calc(3.1vw / var(--site-zoom, 1)), 28px); line-height: 1.1; white-space: nowrap; }
  #homeProfile:not([hidden]) { width: 100%; }
  #home .favourite-section { grid-area: 2 / 1; }
  #regularGamesSection:not([hidden]) { grid-area: 1 / 2 / -1; align-self: stretch; }
  #home .favourite-section .section-head { flex-wrap: wrap; gap: 4px; }
  #home .favourite-section .section-head h2 { font-size: 14px; }
}

/* Homepage palette. */
body:has(#home:not([hidden])) {
  background: radial-gradient(circle, var(--home-grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--home-surface);
  color: var(--ui-text);
}
body:has(#home:not([hidden])) dialog { color: var(--ink); }
body:has(#home:not([hidden])) > header { border-color: var(--ui-border); }
body:has(#home:not([hidden])) #brand { color: var(--ui-text); }
body:has(#home:not([hidden])) .top-note {
  border: 0;
  background: none;
  color: var(--ui-muted);
  letter-spacing: .08em;
}
body:has(#home:not([hidden])) #headerMenu button,
#home :is(#homeHelpOpen, #gameCategoryPicker), #home .game-view-picker button, #home .library-pager button {
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-panel);
  color: var(--ui-text);
  box-shadow: none;
}
body:has(#home:not([hidden])) #headerMenu button:hover,
#home :is(#homeHelpOpen, .game-view-picker button, .library-pager button):hover { background: var(--ui-hover); }
#home .game-view-picker button[aria-pressed="true"] { background: var(--ui-active); border-color: var(--ui-outline); }
body:has(#home:not([hidden])) #count { color: #211734; background: #d1bcff; border: none; border-radius: 6px; }
#home .hero { position: relative; }
#home .hero h1 { color: var(--ui-text); text-shadow: none; font-family: inherit; font-weight: 800; letter-spacing: -.045em; line-height: 1.13; }
#home .hero h1 em { color: var(--hero-accent); font-style: normal; }
#home .hero p { color: var(--ui-muted); }
#home .hero .eyebrow { color: var(--ui-kicker); background: transparent; padding: 0; }
#home .hero .dark {
  border: 1px solid #d94a78;
  border-radius: 10px;
  background: #ff8bb0;
  color: #361727;
  box-shadow: none;
}
#homeProfile:not([hidden]) {
  border: 1px solid var(--ui-outline);
  border-radius: 13px;
  background: var(--ui-panel);
  color: var(--ui-text);
  box-shadow: none;
}
#homeProfileImage { border: 1px solid #a389d6; border-radius: 8px; overflow: hidden; }
#home .favourite-section {
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: var(--ui-inset);
  box-shadow: none;
}
#home .favourite-star { color: #281b37; background: #f9d77e; border: 0; border-radius: 6px; }
#home .games .game-card .game {
  border: 1px solid #fff6;
  border-radius: 11px;
  background: var(--cartridge, #ff99cc);
  color: #20172b;
  box-shadow: 0 2px 0 #261c3826;
}
#home .games .game-card .game .icon { border: 0; border-radius: 7px; background: #fff8; box-shadow: none; }
#home .games .game-pin { border: 0; border-radius: 9px; background: #ffffff80; color: #22182f; box-shadow: none; }
#home .games .game-pin[aria-pressed="true"] { background: #f6d675; }
@media (min-width: 850px) and (min-height: 660px) {
  #home .hero { gap: 18px; padding-inline: clamp(12px, calc(4vw / var(--site-zoom, 1)), 54px); }
  #home .hero h1 { font-size: clamp(40px, calc(5.1vw / var(--site-zoom, 1)), 68px); letter-spacing: -3px; }
  #homeProfile:not([hidden]) { width: clamp(135px, calc(16vw / var(--site-zoom, 1)), 226px); }
  #homeProfileImage { width: clamp(52px, calc(5.8vw / var(--site-zoom, 1)), 84px); }
}
/* Illustrated game tiles */
#home #games .game-card .game {
  grid-template-columns: minmax(0, 35%) minmax(0, 1fr);
  gap: 5px;
  padding: 7px 8px 7px 4px;
  overflow: hidden;
  border: 1px solid #34214133;
  border-radius: 16px;
}
#home #games .game-card .game::before {
  background-size: min(86%, 185px) auto;
  background-position: right -8px bottom -19px;
  opacity: .22;
}
#home #games .game-card .game::after {
  content: "";
  grid-area: 1 / 1 / span 2;
  width: 100%;
  height: min(82px, calc(var(--tile-height) - 15px));
  background: var(--tile-emblem) center / 175% auto no-repeat;
  filter: saturate(1.6) contrast(1.15);
  pointer-events: none;
}
#home #games .game-card .game .icon { display: none; }
#home #games .game h3 {
  grid-column: 2;
  align-self: end;
  font-size: clamp(13px, calc(1.35vw / var(--site-zoom, 1)), 18px);
  font-weight: 850;
  letter-spacing: -.025em;
  text-wrap: balance;
}
#home #games .game-pin {
  top: 3px;
  left: 3px;
  right: auto;
  margin: 0;
  border-radius: 9px;
  background: #ffffff8c;
  color: #30203f;
}
#home #games .game-pin[aria-pressed="true"] { background: #f6d675; color: #30203f; }
#home #favouriteGames .game { background: #ffe17f; }
#home #favouriteGames .game .icon { color: #291c3b; }
#home #favouriteGames .game-pin[aria-pressed="true"] { color: #251733; }

@media (min-width: 1120px) and (min-height: 820px) {
  #home .hero { gap: 7px; }
  #home .hero p { font-size: 16px; }
  #home .hero .dark { min-height: 43px; padding-inline: 16px; }
  #home #games .games { --tile-min: 206px; --tile-height: 136px; }
  #home #games .game-card .game::after { height: min(107px, calc(var(--tile-height) - 18px)); }
  #home #games .game small {
    display: block;
    grid-column: 2;
    align-self: start;
    width: fit-content;
    max-width: 100%;
    margin: 0;
    padding: 3px 5px;
    border-radius: 5px;
    background: #ffffff6e;
    color: #30203f;
    font-size: 10px;
    line-height: 1.2;
  }
}
@media (max-width: 1100px) {
  body:has(#home:not([hidden])) .top-note { display: none; }
}
@media (max-width: 680px) and (min-height: 621px) {
  #home .hero h1 { font-size: clamp(33px, calc(9vw / var(--site-zoom, 1)), 48px); }
}
@media (max-width: 420px) {
  #home .hero h1 { font-size: clamp(27px, calc(8vw / var(--site-zoom, 1)), 34px); }
}
@media (max-height: 620px) {
  #home #games .game-pin { min-width: 40px; min-height: 40px; }
}

/* Card tables use a dark felt and violet rim, with the public cards in focus. */
body:is([data-game-scene="thirteen"], [data-game-scene="poker"])[data-game-background="illustrated"] {
  background-color: var(--table-backdrop);
  background-image: var(--game-art), var(--table-surround);
  background-size: 360px 248px, auto;
}
#roomMain .card-game-stage {
  --card-text: var(--ui-text);
  color: var(--card-text);
  background: var(--table-surface);
  border: 1px solid var(--ui-border);
  border-radius: 23px;
  box-shadow: 0 15px 36px #28143c50;
}
#roomMain .card-game-stage :is(h2, h3, p, summary, label) { color: var(--card-text); }
#roomMain .card-game-stage h2 { margin: 5px 0 10px; font-size: clamp(24px, calc(4vw / var(--site-zoom, 1)), 39px); }
#roomMain .card-game-stage .chip { border: 1px solid var(--ui-outline); border-radius: 100px; background: var(--ui-inset); color: var(--ui-text); box-shadow: none; transform: none; }
#roomMain .card-game-stage .table-felt {
  border: 4px solid var(--ui-outline);
  border-radius: 50%;
  background:
    radial-gradient(circle, #e1c3f022 .55px, transparent .9px) 0 0 / 4px 4px,
    var(--table-felt);
  box-shadow: 0 -5px 26px #9d64f571, inset 0 0 0 2px #b897fb37;
}
#roomMain .card-game-stage .table-seat {
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--ui-border);
  border-radius: 13px;
  background: var(--ui-panel);
  color: var(--ui-text);
  box-shadow: none;
}
#roomMain .card-game-stage .table-seat-active { background: var(--ui-active); outline: 2px solid var(--ui-outline); }
.card-game-stage .seat-avatar {
  width: clamp(31px, calc(5vw / var(--site-zoom, 1)), 61px);
  border-radius: 50%;
  border: 2px solid #ccaeff;
  box-shadow: 0 0 12px #b175ff60;
}
.card-game-stage .card-hand-tray {
  border: 1px solid var(--ui-border);
  border-radius: 18px;
  background: var(--ui-inset);
}
#roomMain .card-game-stage .playing-card {
  border: 1px solid #e0d7f0;
  border-radius: 9px;
  background: linear-gradient(160deg, #fff, #ebe4f5);
  color: #1b1628;
  box-shadow: 2px 5px 11px #06040b73;
}
#roomMain .card-game-stage .playing-card.card-red { color: #a91f48; }
#roomMain .card-game-stage .playing-card[aria-pressed="true"] { background: #e2ccff; outline: 2px solid #bd8fff; }
.card-game-stage .table-card-slot { border-color: #9e87bf75; border-radius: 8px; }
.card-game-stage .table-pot { display: grid; gap: 1px; font-size: 12px; }
.card-game-stage .table-pot strong { font-size: clamp(25px, calc(4.8vw / var(--site-zoom, 1)), 54px); line-height: 1; }
.card-game-stage .hand-types span { background: var(--ui-hover); border-color: var(--ui-border); }
#roomMain .card-game-stage .room-wait { background: var(--ui-hover); border-radius: 10px; }
#roomMain .card-game-stage .prompt { background: var(--ui-active); color: var(--ui-text); border-color: var(--ui-outline); box-shadow: none; }
#roomMain .card-game-stage .actions button {
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-panel);
  color: var(--ui-text);
  box-shadow: none;
}
#roomMain .card-game-stage .actions :is([data-room-action="thirteenPlay"], [data-room-action="pokerCall"]) {
  background: #cfb2ff;
  color: #1c1331;
}
#roomMain .card-game-stage .actions [data-room-action="pokerRaise"] { color: var(--ui-positive); }
#roomMain .card-game-stage .actions [data-room-action="pokerFold"] { color: var(--ui-negative); }
.card-game-stage .actions button:hover { filter: brightness(1.2); }
.thirteen-workspace .thirteen-history { border-color: var(--ui-border); border-radius: 13px; background: var(--ui-inset); color: var(--ui-text); box-shadow: none; }
.thirteen-workspace .thirteen-history ol { background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: 7px; }
.thirteen-workspace .thirteen-history li + li { border-color: #8b73a559; }
.thirteen-workspace .history-card { color: #20172e; border-radius: 5px; }
.thirteen-workspace .history-card.card-red { color: #a91f48; }
@media (min-width: 1050px) {
  .card-game-poker .table-felt { min-height: 205px; }
  .card-game-poker .card-hand-tray .playing-card { min-width: 64px; font-size: 23px; }
}

.classic-hero-side { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.classic-hero-art { display: block; flex: none; width: clamp(140px, calc(23vw / var(--site-zoom, 1)), 312px); height: auto; }
.classic-hero-art text { fill: #28203b; font-family: inherit; }
@media (max-width: 680px) {
  .classic-hero-side { flex-direction: column; gap: 1px; }
  .classic-hero-art { width: clamp(80px, calc(26vw / var(--site-zoom, 1)), 130px); }
  #home .classic-hero-side #homeProfile:not([hidden]) {
    width: min(110px, 100%);
    min-height: 36px;
    grid-template-columns: 24px minmax(0, 1fr);
    padding: 4px;
  }
  #home .classic-hero-side #homeProfileImage { width: 24px; }
  #home .classic-hero-side #homeProfileName { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}
@media (max-height: 620px) {
  .classic-hero-art { width: clamp(78px, calc(14vw / var(--site-zoom, 1)), 115px); }
}
@media (max-height: 480px) and (min-width: 560px) {
  .classic-hero-side { flex-direction: row; justify-content: flex-start; gap: 4px; }
  .classic-hero-art { width: 64px; }
  #home .classic-hero-side #homeProfile:not([hidden]) { width: min(110px, calc(100% - 68px)); }
  #home .classic-hero-side #homeProfileImage { width: 24px; }
  #home .classic-hero-side .home-profile-label { display: none; }
}

#sidebarOpen {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-panel);
  color: var(--ui-text);
  box-shadow: none;
  font-size: 22px;
}
#sidebarOpen:hover { background: var(--ui-hover); }
#siteSidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(320px, calc(calc(100vw / var(--site-zoom, 1)) - 32px));
  height: calc(100dvh / var(--site-zoom, 1));
  max-height: calc(100dvh / var(--site-zoom, 1));
  margin: 0;
  padding: 20px;
  border-radius: 0 16px 16px 0;
  overflow-y: auto;
}
#siteSidebar nav { display: grid; gap: 8px; margin-top: 14px; }
#siteSidebar nav button { text-align: left; min-height: 44px; }
#leaderboard { max-height: min(680px, calc(calc(100dvh / var(--site-zoom, 1)) - 32px)); overflow-y: auto; }
#leaderboardList { margin: 10px 0 18px; padding-inline-start: 26px; }
#leaderboardList li { padding: 7px 5px; border-bottom: 1px solid var(--ui-border); }
#leaderboardList li span { overflow-wrap: anywhere; }
#leaderboardList li strong { float: inline-end; margin-inline-start: 8px; }
.leaderboard-opt-in { display: block; margin: 12px 0; text-align: left; }
.leaderboard-opt-in input { margin: 0 4px 0 0; }
