/* CouchArcade type: Bungee (arcade marquee lettering) for display, Rubik for everything else.
   Games that still ask for "Fredoka" get Rubik too, so the whole app shares one text face. */
@font-face { font-family: "Bungee"; src: url(../fonts/bungee-latin.woff2) format("woff2"); font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bungee"; src: url(../fonts/bungee-latin-ext.woff2) format("woff2"); font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Rubik"; src: url(../fonts/rubik-latin.woff2) format("woff2"); font-weight: 300 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Rubik"; src: url(../fonts/rubik-latin-ext.woff2) format("woff2"); font-weight: 300 900; font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fredoka"; src: url(../fonts/rubik-latin.woff2) format("woff2"); font-weight: 300 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fredoka"; src: url(../fonts/rubik-latin-ext.woff2) format("woff2"); font-weight: 300 900; font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* "Sunset Cabinet": the logo's midnight, marigold and burnt orange at full strength, plus cherry */
  --bg: #0d1650;
  --bg2: #142070;
  --panel: #1a2a86;
  --panel2: #24379d;
  --line: rgba(255, 243, 214, .16);
  --text: #fff3d6;
  --muted: #b9c1ec;
  --accent: #ffb703;
  --accent2: #fb6107;
  --cherry: #e3242b;
  --ink: #0b1033;
  --good: #4cb944;
  --bad: #e3242b;
  --radius: 20px;
  --f-display: "Bungee", "Arial Black", Impact, sans-serif;
  --f-body: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --stripe: linear-gradient(var(--accent) 0 33.3%, var(--accent2) 33.3% 66.6%, var(--cherry) 66.6%);
  --wood:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, .14) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(255, 210, 160, .06) 0 1px, transparent 1px 23px),
    linear-gradient(180deg, #4a2c17, #3b2414);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-weight: 450;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  background:
    radial-gradient(900px 380px at 50% -140px, rgba(251, 97, 7, .30) 0%, rgba(255, 183, 3, .10) 45%, transparent 75%),
    radial-gradient(1000px 700px at 50% 120%, #17238a 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input { -webkit-user-select: text; user-select: text; }

#app { min-height: 100%; }

.boot { height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 5px solid rgba(255, 255, 255, .15); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-top)) 16px calc(20px + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.topbar .title { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 21px; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { color: var(--muted); font-size: 13px; font-weight: 500; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: var(--panel); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  font-size: 20px;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }

.logo { display: flex; align-items: center; gap: 10px; }
.logo img { width: 40px; height: 40px; }
.logo b { font-size: 22px; font-weight: 700; }
.logo b span { color: var(--accent); }

.section-title { margin: 6px 2px 0; font-family: var(--f-display); font-weight: 400; font-size: 15px; color: var(--accent); letter-spacing: 1px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 14px;
  background: var(--accent); color: var(--ink); font-weight: 800; font-size: 18px;
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink); /* hard arcade-button shadow; pressing pushes the button down into it */
  margin-bottom: 5px;
  transition: transform .07s, box-shadow .07s, filter .15s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.btn.secondary { background: var(--panel2); color: var(--text); }
.btn.hot { background: var(--accent2); color: var(--text); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); min-height: 44px; margin-bottom: 0; }
.btn.ghost:active { transform: none; }
.btn.small { min-height: 40px; font-size: 15px; padding: 0 14px; border-radius: 11px; border-width: 2.5px; box-shadow: 0 3px 0 var(--ink); margin-bottom: 3px; }
.btn.small:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.block { width: 100%; }
.btn[disabled] { filter: grayscale(.8) brightness(.7); pointer-events: none; }

.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- profile screen ---------- */

.hero { text-align: center; padding: 28px 0 6px; }
.hero img { width: 88px; height: 88px; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); }
.hero h2 { margin: 12px 0 6px; font-family: var(--f-display); font-weight: 400; font-size: 30px; line-height: 1.05; text-wrap: balance; }
.hero p { margin: 0; color: var(--muted); }

.field {
  width: 100%; min-height: 58px; padding: 0 18px; border-radius: 16px;
  background: rgba(5, 9, 40, .55); border: 2.5px solid var(--ink);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, .35);
  font-size: 22px; font-weight: 600; outline: none; text-align: center;
}
.field:focus { border-color: var(--accent); }
textarea.field.area {
  min-height: 150px; padding: 12px 14px; font-size: 17px; font-weight: 500; line-height: 1.35;
  text-align: left; resize: vertical; -webkit-user-select: text; user-select: text;
}
.custom-note { color: var(--muted); font-size: 12px; line-height: 1.3; flex: 1; }

.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.swatch {
  aspect-ratio: 1; border-radius: 50%; background: var(--c);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25);
  transition: transform .15s;
  position: relative;
}
.swatch.on { transform: scale(1.12); box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px #fff; }
.swatch.taken { opacity: .3; }

.card {
  background: var(--panel); border-radius: var(--radius); padding: 16px;
  border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink);
}

/* ---------- avatars & player chips ---------- */

.avatar {
  --s: 34px;
  width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .45), transparent 45%), var(--c);
  display: grid; place-items: center;
  font-weight: 700; font-size: calc(var(--s) * .48); color: rgba(0, 0, 0, .55);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2);
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 5px 12px 5px 5px; border-radius: 999px;
  background: var(--panel); border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink);
  font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: opacity .2s, transform .2s, box-shadow .2s;
}
.chip .wins { color: var(--accent); font-size: 13px; }
.chip .tag { font-size: 11px; color: var(--muted); font-weight: 500; }
.chip.off { opacity: .45; }
.chip.me { background: var(--panel2); }
.chip.turn { box-shadow: 0 0 0 3px var(--c), 0 0 18px var(--c); transform: translateY(-1px); }
.chip.out { opacity: .35; text-decoration: line-through; }
.chip.add { padding: 5px 14px; background: transparent; border: 2px dashed var(--line); color: var(--muted); }

/* ---------- invite ---------- */

.invite { display: flex; gap: 14px; align-items: center; }
.qr {
  flex: none; width: 132px; height: 132px; padding: 8px; border-radius: 14px; background: #fff;
}
.qr svg { width: 100%; height: 100%; display: block; }
.invite .info { min-width: 0; flex: 1; }
.invite .info h3 { margin: 0 0 4px; font-size: 19px; }
.invite .info p { margin: 0 0 8px; color: var(--muted); font-size: 14px; line-height: 1.3; }
.invite .url { font-size: 16px; font-weight: 700; color: var(--accent); word-break: break-all; margin-bottom: 8px; }

/* ---------- game menu ---------- */

.games { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .games { grid-template-columns: repeat(3, 1fr); } }

/* ---------- sheets & overlays ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 6, 25, .6);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--bg2); border-radius: 26px 26px 0 0;
  border: 3px solid var(--ink); border-bottom: 0;
  background-image: linear-gradient(var(--bg2), var(--bg2)), var(--stripe);
  background-size: 100% 100%, 100% 8px; background-repeat: no-repeat; background-origin: padding-box, border-box;
  padding: 18px 18px calc(18px + var(--safe-bottom));
  animation: rise .25s cubic-bezier(.2, .9, .3, 1.2);
  display: flex; flex-direction: column; gap: 14px;
}
.sheet h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 24px; line-height: 1.1; }
.sheet .how { color: var(--muted); line-height: 1.4; margin: 0; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: -6px auto 0; }
@keyframes rise { from { transform: translateY(40%); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.setting { display: flex; flex-direction: column; gap: 6px; }
.setting label { font-size: 14px; color: var(--muted); font-weight: 600; }
.seg { display: flex; background: rgba(5, 9, 40, .55); border-radius: 14px; padding: 4px; gap: 4px; border: 2px solid var(--ink); }
.seg button { flex: 1; min-height: 42px; border-radius: 11px; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--ink); font-weight: 700; box-shadow: 0 2px 0 var(--ink); }

.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .btn { justify-content: flex-start; }

.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 24px;
  background: rgba(8, 6, 25, .72);
  animation: fade .25s ease;
}
.overlay .box { text-align: center; max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.overlay h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 32px; line-height: 1.08; text-wrap: balance; }
/* results: a wood-panelled scoreboard */
.overlay.result .box { background: var(--wood); border: 4px solid var(--ink); border-radius: 26px; padding: 22px 18px 18px; box-shadow: 0 8px 0 var(--ink), 0 30px 60px rgba(0, 0, 0, .5); position: relative; overflow: hidden; }
.overlay.result .box::before { content: ""; position: absolute; inset: 0 0 auto; height: 10px; background: var(--stripe); }
.overlay.result .standings .line { background: rgba(10, 6, 2, .45); border: 2px solid rgba(0, 0, 0, .35); }
.overlay p { margin: 0; color: var(--muted); }

.result .avatar { --s: 96px; animation: bounce-in .6s cubic-bezier(.2, 1.4, .4, 1); }
.result .crown { font-size: 44px; margin-bottom: -18px; animation: bounce-in .6s .1s both cubic-bezier(.2, 1.4, .4, 1); }
.standings { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.standings .line { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 14px; padding: 6px 12px 6px 6px; }
.standings .line .name { flex: 1; text-align: left; font-weight: 600; }
.standings .line .val { color: var(--accent); font-weight: 700; }
@keyframes bounce-in { from { transform: scale(0); } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); z-index: 90;
  transform: translateX(-50%);
  background: #0c0a22; color: #fff; padding: 12px 18px; border-radius: 14px;
  font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  animation: rise .25s ease; max-width: calc(100% - 32px); text-align: center;
}

.banner {
  text-align: center; font-family: var(--f-display); font-weight: 400; font-size: 19px; padding: 10px 14px; border-radius: 16px;
  background: rgba(5, 9, 40, .5); border: 2.5px solid var(--ink); transition: background .25s, color .25s;
}
.banner.mine { background: var(--c); color: var(--ink); box-shadow: 0 4px 0 var(--ink), 0 0 26px var(--c); animation: nudge 1.8s ease-in-out infinite; }
.banner small { font-family: var(--f-body); }
.banner small { display: block; font-weight: 500; font-size: 13px; opacity: .8; }
@keyframes nudge { 50% { transform: scale(1.02); } }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; }

.offline-pill {
  position: fixed; top: calc(10px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 80;
  background: var(--bad); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}

.hint { color: var(--muted); text-align: center; font-size: 14px; margin: 0; }
.game-area { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; }

/* ---------- start screen ---------- */

.home { gap: 0; padding-top: calc(8px + var(--safe-top)); padding-bottom: calc(12px + var(--safe-bottom)); }
.home-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; width: 100%; max-width: 440px; margin: 0 auto; }
.home .hero { padding: 0; }
.home .hero img { width: 104px; height: 104px; }
.home .hero h2 { font-size: 36px; letter-spacing: .5px; margin: 10px 0 0; }
.home .hero p { max-width: 290px; margin: 0 auto; font-size: 16px; line-height: 1.4; text-wrap: balance; }
.home-host { display: flex; flex-direction: column; gap: 12px; }
.home-card { gap: 12px; padding: 16px 16px 14px; }
.home-card h3 { margin: 0; font-size: 18px; }
.home-card .hint { text-align: left; font-size: 13px; }
.btn.big { min-height: 64px; font-size: 21px; border-radius: 18px; }
.home .code-in { font-size: 24px; letter-spacing: 8px; }
.home .code-in::placeholder { letter-spacing: 6px; color: rgba(255, 255, 255, .25); }
.home-footer { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.home-footer p { margin: 0; opacity: .85; }
.home-links { display: flex; gap: 10px; align-items: center; opacity: .9; }
.linkish { background: none; border: 0; padding: 6px 2px; color: var(--muted); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish:active { color: var(--text); }
@media (max-height: 700px) {
  .home-main { gap: 14px; }
  .home .hero h2 { font-size: 30px; margin-top: 6px; }
  .stripe-band.short { margin: 8px auto 10px; }
  .home-card { gap: 10px; padding: 14px; }
  .home-footer { padding-top: 16px; }
}
.room-pill {
  align-self: center; display: inline-flex; gap: 8px; align-items: center;
  padding: 6px 14px; border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 14px;
}
.room-pill b { color: var(--accent); letter-spacing: 3px; font-size: 16px; }
.profile-card { gap: 14px; padding: 18px; }
.profile-card .section-title { margin: 2px 2px -4px; font-size: 13px; }

/* Solo testing: which seat the host is playing */
.testbar { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.testbar:empty { display: none; }
.testbar .lbl { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.testbar .chip { flex: none; padding: 3px 10px 3px 3px; font-size: 14px; }
.testbar .chip.add { padding: 4px 10px; }
.testbar .chip.add.on { border-style: solid; color: var(--text); }

/* Online rooms */
.room-code { font-size: 30px; font-weight: 700; letter-spacing: 6px; color: var(--accent); line-height: 1.1; }
.invite .room-code + .url { font-size: 13px; color: var(--muted); font-weight: 500; }
.code-in { text-transform: uppercase; letter-spacing: 4px; font-weight: 700; text-align: center; }

/* Tables in play */
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip[disabled] { opacity: .4; }
.table-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; border-radius: 18px;
  background: var(--panel); box-shadow: inset 4px 0 0 0 transparent;
}
.table-row .tr-ic { width: 46px; height: 46px; flex: none; border-radius: 12px; background: var(--g); padding: 3px; }
.table-row .tr-ic svg { width: 100%; height: 100%; display: block; }
.table-row .grow { min-width: 0; }
.table-row b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-row b small { color: var(--muted); font-weight: 500; font-size: 13px; }
.tr-who { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tr-who .avatar { margin-right: -4px; box-shadow: 0 0 0 2px var(--panel); }
.tr-who small { margin-left: 10px; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn.small { width: 36px; height: 36px; min-width: 36px; font-size: 15px; color: var(--muted); }

/* Tournaments */
.tour-card { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; background: linear-gradient(135deg, #d9622b, #1d2b5b); }
.tour-card .tc-ic { font-size: 34px; }
.tour-card b { display: block; font-size: 17px; }
.tour-card small { color: var(--muted); }
.tour-card .tc-go { color: var(--accent); font-weight: 700; white-space: nowrap; }
.tg-games { display: flex; flex-wrap: wrap; gap: 6px; }
.tg-game { padding: 7px 12px; border-radius: 12px; background: var(--panel2); font-weight: 600; font-size: 14px; opacity: .75; }
.tg-game.on { background: var(--g); opacity: 1; box-shadow: 0 0 0 3px #fff; }
.hint-left { color: var(--muted); font-size: 13px; }
.bk { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.bk-champ { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 10px; border-radius: 20px; background: linear-gradient(160deg, rgba(246, 181, 50, .25), rgba(246, 181, 50, .05)); }
.bk-champ .crown { font-size: 36px; margin-bottom: -10px; }
.bk-champ b { font-size: 20px; }
.bk-sec { display: flex; flex-direction: column; gap: 6px; }
.bk-cols { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; align-items: stretch; }
.bk-col { flex: none; width: 160px; display: flex; flex-direction: column; gap: 6px; }
.bk-col-body { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 10px; }
.bk-col h4, .bk-round h4 { margin: 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.bk-m { display: flex; flex-direction: column; gap: 2px; padding: 6px; border-radius: 12px; background: var(--panel); text-align: left; width: 100%; }
.bk-m.mine { box-shadow: 0 0 0 2px var(--accent); }
.bk-m.live { box-shadow: 0 0 0 2px var(--good), 0 0 14px rgba(90, 212, 90, .35); cursor: pointer; }
.bk-p { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; min-height: 26px; }
.bk-p .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-p.won { color: var(--accent); }
.bk-p.lost { opacity: .45; }
.bk-p.me .n { text-decoration: underline; text-decoration-color: var(--accent); }
.bk-p.tbd, .bk-p.bye { color: var(--muted); font-weight: 500; padding-left: 4px; }
.bk-p .w { color: var(--good); }
.bk-s { font-size: 11.5px; color: var(--muted); }
.bk-m.live .bk-s { color: var(--good); font-weight: 700; }
.bk-table { display: flex; flex-direction: column; gap: 4px; }
.bk-row { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; border-radius: 12px; background: var(--panel); }
.bk-row.me { box-shadow: inset 0 0 0 2px var(--accent); }
.bk-row .rk { width: 18px; text-align: center; color: var(--muted); font-weight: 700; }
.bk-row .n { flex: 1; font-weight: 600; }
.bk-row b { color: var(--accent); }
.bk-round { display: flex; flex-direction: column; gap: 6px; }
.bk-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }

/* ---------- lobby: the room "den" and the game shelf ---------- */
.stripe-band { height: 10px; margin: -4px -16px 0; background: var(--stripe); }
.topbar .sub { display: flex; align-items: center; gap: 8px; }
.room-tag { font-family: var(--f-display); font-size: 13px; letter-spacing: 2px; color: var(--ink); background: var(--accent); border-radius: 6px; padding: 1px 7px 0; }
/* woodgrain, used sparingly: the den around the players and invite, and the results scoreboard */
.den {
  display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 22px;
  background: var(--wood); border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink);
}
.den .chip { background: rgba(10, 6, 2, .45); border-color: rgba(0, 0, 0, .55); }
.den .chip.me { background: rgba(255, 243, 214, .14); }
.den .chip.add { background: transparent; border: 2px dashed rgba(255, 243, 214, .35); box-shadow: none; }
.den .card { background: rgba(10, 6, 2, .5); border-color: rgba(0, 0, 0, .55); box-shadow: none; }

.picker { display: flex; flex-direction: column; gap: 14px; }
.picker-tools {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; flex-direction: column; gap: 8px;
  margin: 0 -16px; padding: 8px 16px 6px; background: linear-gradient(var(--bg) 82%, transparent);
}
.field.search { min-height: 46px; font-size: 17px; text-align: left; padding: 0 16px 0 42px; border-radius: 14px;
  background: rgba(5, 9, 40, .6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5' fill='none' stroke='%23b9c1ec' stroke-width='2.5'/%3E%3Cpath d='M15.5 15.5l5 5' stroke='%23b9c1ec' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 14px center / 18px; }
.filters .chip { padding: 6px 13px; font-size: 14px; }
.filters .chip.on { background: var(--accent); color: var(--ink); }
.shelf { display: flex; flex-direction: column; gap: 18px; }
.game-section, .now-playing { display: flex; flex-direction: column; gap: 10px; }
.gs-head { display: flex; align-items: baseline; gap: 8px; padding: 0 2px; }
.gs-head h3 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 17px; color: var(--accent); letter-spacing: .5px; }
.gs-head small { color: var(--muted); font-size: 13px; font-weight: 600; }
.empty-shelf { padding: 24px 0; }

/* phone-style app icons, 4 across */
.icon-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 10px; }
@media (min-width: 560px) { .icon-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.ic {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 23%; overflow: hidden;
  border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); background: var(--panel); position: relative;
}
.ic svg { width: 100%; height: 100%; display: block; }
.ic.big { width: 88px; flex: none; }
.app { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; text-align: center; -webkit-touch-callout: none; }
.app .ic { max-width: 72px; transition: transform .1s; }
.app:active .ic, .app.pressing .ic { transform: translateY(3px) scale(.96); box-shadow: 0 1px 0 var(--ink); }
.app.pressing .ic { transition: transform .45s ease-in; transform: scale(.9); }
.app .lbl { font-size: 12.5px; font-weight: 600; line-height: 1.15; color: var(--text); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app .need { font-size: 11px; color: var(--muted); margin-top: -5px; }
.app.tight .ic { filter: saturate(.55) brightness(.8); }
.app.voted .ic { box-shadow: 0 0 0 3px var(--accent), 0 4px 0 var(--ink); }
.app .votes { position: absolute; top: -6px; right: 2px; display: flex; }
.app .votes .avatar { margin-left: -7px; box-shadow: 0 0 0 2px var(--bg); }
.app .fav { position: absolute; top: -5px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--ink); font-size: 12px; display: grid; place-items: center; border: 2px solid var(--ink); }

/* now playing: live tables as story-style bubbles */
.bubbles { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.bubbles::-webkit-scrollbar { display: none; }
.bubble { flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; -webkit-touch-callout: none; }
.bubble .ring { width: 70px; height: 70px; border-radius: 50%; padding: 4px; background: conic-gradient(var(--accent), var(--accent2), var(--cherry), var(--accent)); display: grid; place-items: center; }
.bubble.live .ring { animation: ring-spin 3s linear infinite; }
.bubble.over .ring { background: var(--panel2); }
.bubble .ring .ic { width: 100%; border-radius: 50%; box-shadow: none; animation: inherit; animation-direction: reverse; }
.bubble.mine .ring { box-shadow: 0 0 0 3px var(--text); }
.bubble .lbl { font-size: 12px; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble small { font-size: 11px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes ring-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bubble.live .ring, .bubble .ring .ic { animation: none; } }

/* the game page (tap an icon) */
.game-head { display: flex; gap: 14px; align-items: center; }
.gh-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.gh-text h2 { margin: 0; }
.gh-text p { margin: 0; color: var(--muted); }
.gh-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.gh-tags span { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--panel); border: 2px solid var(--ink); }
.rules summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.rules .how { margin-top: 8px; }
.icon-menu-head { display: flex; gap: 14px; align-items: center; }
.icon-menu-head .ic.big { width: 72px; }
.icon-menu-head h2 { margin: 0; }
.fb-link { align-self: center; font-size: 15px; }
select.field { text-align: left; font-size: 17px; appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: rgba(5, 9, 40, .55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23b9c1ec' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center / 14px; color: var(--text); }
select.field option { background: var(--bg2); }

.stripe-band.short { width: 120px; height: 8px; margin: 10px auto 12px; border-radius: 3px; }

/* results: "Host your own game night" note for guests */
.host-own { margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(10, 6, 2, .45); border: 2px dashed rgba(255, 183, 3, .55); display: flex; gap: 12px; align-items: center; text-align: left; }
.host-own p { margin: 0; flex: 1; font-size: 14px; line-height: 1.35; color: var(--text); }
.host-own b { font-family: var(--f-display); font-weight: 400; color: var(--accent); font-size: 15px; letter-spacing: .3px; }
.host-own .btn { flex: none; padding: 10px 12px; font-size: 14px; }

/* ---------- start screen: attract-mode hero (js/hero.js) ----------
   A detailed couch on a sunset disc that idles like a cabinet's attract mode: the joystick rocks, the two buttons
   take turns pressing in and lighting up, sparkles twinkle, and a glint runs along the stripe. Transform and
   opacity only; still under prefers-reduced-motion. */
.hero-art { width: min(78%, 330px, calc(34svh * 1.42)); aspect-ratio: 512 / 360; margin: 0 auto -2px; contain: layout paint; }
.hero-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hero-art.pop svg { animation: ha-pop .5s cubic-bezier(.25, 1.5, .5, 1) both; transform-origin: 50% 85%; }
@keyframes ha-pop { from { transform: scale(.82); opacity: 0; } 60% { opacity: 1; } }
.hero-art svg * { transform-box: view-box; transform-origin: 0 0; }

/* joystick: an idle player nudging it now and then */
.ha-stick { animation: ha-stick 5.2s ease-in-out infinite; }
@keyframes ha-stick {
  0%, 8% { transform: rotate(0); }
  16% { transform: rotate(-9deg); }
  26% { transform: rotate(7deg); }
  34%, 52% { transform: rotate(0); }
  62% { transform: rotate(10deg); }
  70% { transform: rotate(-4deg); }
  78%, 100% { transform: rotate(0); }
}

/* buttons: blaze, then marigold, press in and light up */
.ha-plunger, .ha-lit, .ha-halo { animation: 3.2s ease-out infinite; }
.ha-plunger { animation-name: ha-press; }
.ha-lit { animation-name: ha-lit; opacity: 0; }
.ha-halo { animation-name: ha-halo; opacity: 0; }
.ha-p2, .ha-l2, .ha-h2 { animation-delay: 1.6s; }
@keyframes ha-press { 0%, 14%, 100% { transform: translateY(0); } 3%, 9% { transform: translateY(7px); } }
@keyframes ha-lit { 0%, 30%, 100% { opacity: 0; } 3%, 10% { opacity: .9; } }
@keyframes ha-halo { 0%, 36%, 100% { opacity: 0; } 4%, 12% { opacity: .75; } }

/* sparkles: each on its own beat */
.ha-spark { animation: ha-twinkle 3s ease-in-out infinite; }
.ha-s2 { animation-duration: 3.6s; animation-delay: -1.2s; }
.ha-s3 { animation-duration: 2.8s; animation-delay: -2s; }
.ha-s4 { animation-duration: 3.4s; animation-delay: -.6s; }
.ha-s5 { animation-duration: 4s; animation-delay: -2.8s; }
@keyframes ha-twinkle { 0%, 100% { transform: scale(.35) rotate(0); opacity: .35; } 50% { transform: scale(1) rotate(45deg); opacity: 1; } }

/* a glint running along the sunset stripe */
.hero-stripe { position: relative; overflow: hidden; }
.hero-stripe::after {
  content: ""; position: absolute; top: -4px; bottom: -4px; left: 0; width: 16px;
  background: var(--text); opacity: .75; transform: translateX(-30px) skewX(-25deg);
  animation: ha-glint 4.5s ease-in-out 1s infinite;
}
@keyframes ha-glint { 0% { transform: translateX(-30px) skewX(-25deg); } 30%, 100% { transform: translateX(140px) skewX(-25deg); } }

.hero-paused .hero-art *, .hero-paused .hero-stripe::after { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .hero-art svg, .hero-art svg *, .hero-stripe::after { animation: none !important; }
  .hero-stripe::after { display: none; }
}
