/* Rock 'n' Rook — game.css
   Bright, chunky, rounded: the UI sits over a sunny 3D park, so panels are
   dark and slightly translucent to stay readable against grass, sky and
   white marble alike, and every hit target is finger-sized. */

:root {
  --ink: #0d1220;
  --panel: rgba(16, 22, 38, 0.86);
  --panel-solid: #101626;
  --line: rgba(255, 255, 255, 0.14);
  --text: #f4f7ff;
  --muted: #9fb0cc;
  --gold: #ffc53d;
  --gold-deep: #e8a200;
  --green: #3ddc84;
  --red: #ff5f56;
  --blue: #4b9fff;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(6, 10, 22, 0.45);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: #7ec8f2;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* ── buttons ───────────────────────────────────────────────────────── */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font: 600 15px/1 var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #ffd66b, var(--gold-deep));
  box-shadow: 0 4px 0 #b47e00, var(--shadow);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b47e00; }
.btn.big { padding: 16px 34px; font-size: 17px; width: 100%; }
.btn.small { padding: 9px 14px; font-size: 13px; box-shadow: 0 3px 0 #b47e00; }
.btn.ghost {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn.ghost:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--line); }
.btn.primary { background: linear-gradient(180deg, #6fb8ff, #2b7fe0); color: #fff; box-shadow: 0 3px 0 #1c5ba6; }
.btn.danger { background: linear-gradient(180deg, #ff8b84, #e2463c); color: #fff; box-shadow: 0 3px 0 #a92b23; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

/* ── join screen ───────────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 255, 255, .35), transparent 60%),
    linear-gradient(180deg, #8fd3f4 0%, #b8e6c1 55%, #7cc47f 100%);
  z-index: 40;
  overflow-y: auto;
}

.join-card {
  width: min(460px, 100%);
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.logo {
  margin: 0;
  font-size: clamp(34px, 9vw, 46px);
  font-weight: 800;
  letter-spacing: -.02em;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .25);
}
.logo span { color: var(--gold); }
.tag { margin: 8px 0 22px; color: var(--muted); font-size: 15px; line-height: 1.5; }

.field { display: block; text-align: left; margin-bottom: 18px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input,
#chatInput {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .28);
  color: var(--text);
  font: 500 15px var(--font);
}
.field input:focus, #chatInput:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.looklab {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}
#preview {
  width: 132px;
  height: 172px;
  border-radius: 14px;
  background: linear-gradient(180deg, #2a334d 0%, #1b2338 100%);
  border: 1px solid var(--line);
}
.swatches { display: grid; gap: 10px; }
.swatch-row { text-align: left; }
.swatch-row b {
  display: block;
  font: 600 11px var(--font);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3);
}
.chips button[aria-pressed="true"] { border-color: #fff; transform: scale(1.12); }

.fineprint { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }

/* ── HUD ───────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
#hud > * { pointer-events: auto; }

.topbar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand {
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.brand span { color: var(--gold); }
.conn {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn.online .dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.conn.offline .dot { background: var(--red); }
.conn.online span { color: var(--text); }

/* ── board panel ───────────────────────────────────────────────────── */
.panel {
  position: absolute;
  top: 62px;
  right: 12px;
  width: min(300px, calc(100vw - 24px));
  max-height: calc(100vh - 150px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.who.turn .nm { color: var(--gold); }
.chip {
  width: 15px; height: 15px;
  border-radius: 4px;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .45);
}
.chip.white { background: #f2eddf; }
.chip.black { background: #2b2f3c; }
.nm {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clock {
  font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .35);
  color: var(--text);
}
.clock.running { background: var(--gold); color: var(--ink); }
.clock.low { background: var(--red); color: #fff; }

.panel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.panel-row .lbl { font-size: 12px; color: var(--muted); }
.segmented { display: flex; flex-wrap: wrap; gap: 5px; }
.segmented button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 9px;
  font: 600 12px var(--font);
  cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--gold); color: var(--ink); border-color: transparent; }

.state { margin: 0; padding: 11px 14px; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.state strong { color: var(--text); }

.moves {
  flex: 1;
  min-height: 46px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 14px 10px;
  list-style: none;
  display: grid;
  grid-template-columns: 26px 1fr 1fr;
  gap: 2px 6px;
  align-content: start;
  font: 500 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.moves .no { color: var(--muted); }
.moves .mv { padding: 0 4px; border-radius: 5px; }
.moves .mv.last { background: rgba(255, 197, 61, .2); color: var(--gold); }

.panel-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); }
.watchers { padding: 0 14px 12px; font-size: 12px; color: var(--muted); }

/* ── prompt, chat, emotes ──────────────────────────────────────────── */
.prompt {
  position: absolute;
  left: 50%;
  bottom: 148px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 7px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  white-space: nowrap;
  box-shadow: var(--shadow);
}
/* Real buttons rather than key hints — a phone has no E key. 44px tall is
   the smallest target a thumb hits reliably. */
.prompt-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font: 600 14px var(--font);
  cursor: pointer;
}
.prompt-btn:hover { background: rgba(255, 255, 255, 0.16); }
.prompt-btn:active { transform: translateY(1px); }
.prompt kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--gold);
  color: var(--ink);
  font: 700 12px var(--font);
  text-align: center;
}
/* On a touch device the keycap is noise, so the label stands alone. */
@media (pointer: coarse) {
  .prompt kbd { display: none; }
  .prompt-btn { padding: 0 22px; font-size: 15px; }
}

.social {
  position: absolute;
  left: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(360px, calc(100vw - 24px));
}
.chatlog {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  max-height: 148px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chatlog li {
  align-self: flex-start;
  max-width: 100%;
  padding: 6px 11px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}
.chatlog li b { color: var(--gold); margin-right: 5px; }
.chatlog li.sys { background: rgba(0, 0, 0, .4); color: var(--muted); font-style: italic; }

.social-row { display: flex; gap: 8px; align-items: center; }
#chatInput { flex: 1; padding: 10px 13px; }
.emotes { display: flex; gap: 4px; }
.emote {
  width: 38px; height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.emote:active { transform: translateY(2px); }

/* ── touch stick ───────────────────────────────────────────────────── */
.stick {
  position: absolute;
  right: 26px;
  bottom: 110px;
  width: 116px; height: 116px;
  border-radius: 50%;
  background: rgba(10, 16, 30, .4);
  border: 1px solid var(--line);
  touch-action: none;
}
.stick i {
  position: absolute;
  left: 50%; top: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
}

/* ── modals + toast ────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 10, 20, .6);
  backdrop-filter: blur(3px);
  z-index: 50;
  padding: 20px;
}
.modal-card {
  width: min(400px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  text-align: center;
}
.modal-card h2 { margin: 0 0 16px; font-size: 19px; }
.promo-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.promo-row button {
  display: grid;
  gap: 4px;
  padding: 13px 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .07);
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
}
.promo-row button span { font-size: 11px; color: var(--muted); }
.promo-row button:hover { background: rgba(255, 197, 61, .2); }

.keys {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  text-align: left;
  margin: 0 0 20px;
  font-size: 13.5px;
}
.keys dt { color: var(--gold); font-weight: 600; white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  top: 74px;
  transform: translateX(-50%);
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 60;
  max-width: calc(100vw - 32px);
  text-align: center;
}

/* ── phone ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .panel {
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 46vh;
  }
  .social { width: calc(100vw - 24px); bottom: auto; top: 58px; }
  .chatlog { max-height: 92px; }
  .prompt { bottom: auto; top: 50%; }
  .stick { bottom: 50vh; right: 18px; }
}

/* At a board on a phone the board needs the screen: a compact panel tucks
   under the top bar, the move list and chat log step aside until you stand
   (chat still appears as bubbles in the world), and the joystick goes —
   you cannot walk while seated anyway. Measured before this: your own back
   rank was 100% unreachable, under the panel or off the edge. */
@media (max-width: 720px) {
  body.at-board .stick { display: none; }
  body.at-board .panel { top: 58px; bottom: auto; max-height: 36vh; }
  body.at-board .moves { display: none; }
  body.at-board .social { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); }
  body.at-board .chatlog { display: none; }
}

@media (max-width: 400px) {
  .looklab { grid-template-columns: 1fr; justify-items: center; }
  .join-card { padding: 22px 18px; }
}

/* ── in-game pill + folded panel ───────────────────────────────────── */
/* Mid-game, the one thing you need is whose move it is and how long you
   have. That lives top-centre where the eyes already are; the panel folds
   to its buttons and opens again on "Moves". */
.pill {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  font: 600 14px/1.2 var(--font);
  white-space: nowrap;
  box-shadow: var(--shadow);
  color: var(--text);
}
.pill.mine { background: linear-gradient(180deg, #ffd66b, var(--gold-deep)); color: var(--ink); border-color: transparent; }
.pill.over { background: rgba(0, 0, 0, .7); }

.panel.playing:not(.expanded) .panel-head,
.panel.playing:not(.expanded) .moves,
.panel.playing:not(.expanded) .watchers { display: none; }
.panel.playing:not(.expanded) { width: auto; }
.panel.playing:not(.expanded) .panel-actions { border-top: 0; }

@media (max-width: 720px) {
  .pill { font-size: 13px; padding: 8px 14px; max-width: calc(100vw - 200px); overflow: hidden; text-overflow: ellipsis; }
}

/* Phone, at a board: the pill needs the top bar to itself. The wordmark
   and the connection label give way (the dot stays), and the folded panel
   loses its state line — the pill already says whose move it is. */
.panel.playing:not(.expanded) .state { display: none; }
@media (max-width: 720px) {
  body.at-board .brand { display: none; }
  body.at-board #connText { display: none; }
  body.at-board .conn { padding: 7px 9px; }
  .pill { left: 12px; transform: none; max-width: calc(100vw - 118px); }
  body.at-board .panel.playing:not(.expanded) { left: auto; right: 12px; width: auto; max-width: calc(100vw - 24px); }
  body.at-board .panel.playing:not(.expanded) .panel-actions { padding: 8px 10px; gap: 5px; }
  body.at-board .panel.playing:not(.expanded) .btn.small { padding: 8px 11px; font-size: 12.5px; }
}

/* ── getting a game: quick play, challenges, invites ───────────────── */
#quickBtn { margin-left: auto; }
#quickBtn.waiting {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .6; } }
.conn { margin-left: 0; }
body.at-board #quickBtn { display: none; }

.card {
  position: absolute;
  left: 50%;
  bottom: 148px;
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 24px));
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}
.card p { margin: 0 0 12px; font-size: 15px; }
.card b { color: var(--gold); }
.card-row { display: flex; gap: 8px; justify-content: center; }

.invites {
  position: absolute;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(280px, calc(100vw - 24px));
}
.invite {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--gold);
  box-shadow: var(--shadow);
  animation: slidein .25s ease-out;
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
.invite-who { font-size: 14px; margin-bottom: 9px; }
.invite-who b { color: var(--gold); }
.invite-row { display: flex; gap: 6px; }
.invite-row .btn.primary { flex: 1; }

.pill.away { background: rgba(255, 95, 86, .85); color: #fff; border-color: transparent; }

@media (max-width: 720px) {
  #quickBtn { padding: 8px 12px; font-size: 13px; }
  .invites { right: 12px; left: 12px; bottom: 74px; width: auto; }
  .card { bottom: auto; top: 50%; transform: translate(-50%, -50%); }
}

/* ── coins, shop, ranks, daily reward ───────────────────────────────── */
#coinsBtn { font-variant-numeric: tabular-nums; white-space: nowrap; }
.shop-card { width: min(560px, 100%); text-align: left; max-height: 86vh; overflow-y: auto; }
.shop-card h2 { display: flex; justify-content: space-between; align-items: center; }
.shop-balance { font-size: 15px; color: var(--gold); }
.shop-hint { margin: 0 0 14px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.shop-card h3 { margin: 12px 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.skin {
  display: grid; gap: 7px; justify-items: center;
  padding: 10px 8px; border-radius: 12px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
}
.skin-name { font-size: 12.5px; font-weight: 600; }
.swatch { display: grid; width: 56px; height: 40px; border-radius: 8px; overflow: hidden; }
.swatch.pieces { grid-template-columns: 1fr 1fr; gap: 6px; background: transparent; width: 60px; }
.swatch.pieces i { border-radius: 50%; width: 26px; height: 26px; margin: 7px auto; box-shadow: inset 0 -3px 0 rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.4); }
.swatch.board { grid-template-columns: 1fr 1fr; border: 3px solid transparent; }
.swatch.board i { display: block; }
.skin .btn.small { padding: 7px 10px; font-size: 12px; width: 100%; }
.skin .btn.cant { opacity: .55; }
.shop-card .card-row { margin-top: 16px; justify-content: flex-end; }

.ranks { list-style: none; margin: 0 0 16px; padding: 0; text-align: left; }
.ranks li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.ranks li:nth-child(odd) { background: rgba(255, 255, 255, .05); }
.ranks li.you { outline: 1px solid var(--gold); }
.rk-rating { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.rk-games { color: var(--muted); font-size: 12.5px; }

.reward-card .reward-coin { font-size: 52px; line-height: 1; margin-bottom: 10px; }
.reward-card p { margin: 0 0 8px; font-size: 16px; }
.reward-card p b { color: var(--gold); }
.reward-card .fineprint { margin-bottom: 16px; }

@media (max-width: 720px) {
  #ranksBtn { display: none; }
  #connText { display: none; }
  .conn { padding: 7px 9px; }
  #coinsBtn { padding: 8px 10px; font-size: 13px; }
  body.at-board #coinsBtn { display: none; }
}

/* ── legibility pass ─────────────────────────────────────────────────
   Bigger type everywhere it is read at a glance, secondary text lifted well
   clear of the panel, panels more opaque so the park never bleeds through
   the words, and a warmer gold. Kept as one block so the whole tone of the
   UI can be re-tuned from here. */
:root {
  --panel: rgba(12, 17, 30, 0.94);
  --panel-solid: #0f1526;
  --line: rgba(255, 255, 255, 0.18);
  --text: #ffffff;
  --muted: #cbd5e6;
  --gold: #ffcf4d;
  --gold-deep: #f0a800;
}
html, body { font-size: 15px; }
.btn { font-size: 15.5px; }
.btn.small { font-size: 14.5px; padding: 10px 15px; }
.tag { font-size: 16.5px; color: var(--muted); }
.field span { font-size: 14px; }
.field input, #chatInput { font-size: 16px; }
.swatch-row b { font-size: 12px; }
.fineprint { font-size: 13.5px; }
.brand { font-size: 19px; }
.conn { font-size: 14px; }
.pill { font-size: 17px; font-weight: 700; padding: 11px 20px; letter-spacing: .01em; }
.pill.away { font-size: 16px; }
.who { padding: 6px 0; }
.nm { font-size: 16px; }
.clock { font-size: 19px; padding: 5px 10px; }
.segmented button { font-size: 13.5px; padding: 6px 11px; }
.panel-row .lbl { font-size: 13.5px; }
.state { font-size: 15.5px; color: var(--muted); }
.state strong { color: #fff; }
.moves { font-size: 14.5px; }
.watchers { font-size: 13.5px; }
.prompt-btn { font-size: 15.5px; }
.chatlog li { font-size: 15px; padding: 8px 13px; line-height: 1.4; }
.chatlog li.sys { color: var(--muted); }
.emote { font-size: 20px; width: 42px; height: 42px; }
.card p { font-size: 16.5px; }
.invite-who { font-size: 15.5px; }
.toast { font-size: 16px; padding: 12px 20px; }
.modal-card h2 { font-size: 21px; }
.keys { font-size: 15px; }
.shop-hint { font-size: 14px; }
.skin-name { font-size: 13.5px; }
.ranks li { font-size: 15px; }
.reward-card p { font-size: 17.5px; }
@media (max-width: 720px) {
  .pill { font-size: 15px; padding: 9px 15px; }
  .chatlog li { font-size: 14.5px; }
}

/* ── palette: Roblox-blue ─────────────────────────────────────────────
   Chosen 16 Sep 2026. Cobalt panels, white text, yellow accent. Comes after
   the legibility block so it wins; to try another palette, add a block
   below this one rather than editing scattered rules. */
:root {
  --panel: rgba(22, 70, 214, 0.95);
  --panel-solid: #1a4bd0;
  --line: rgba(255, 255, 255, 0.30);
  --text: #ffffff;
  --muted: #dbe6ff;
  --gold: #ffd83d;
  --gold-deep: #ffb800;
  --blue: #ffffff;
  --shadow: 0 10px 30px rgba(8, 24, 80, 0.45);
}
html, body { background: #79c6f4; }
.btn { box-shadow: 0 4px 0 #b88300, var(--shadow); }
.btn:active { box-shadow: 0 1px 0 #b88300; }
.btn.small { box-shadow: 0 3px 0 #b88300; }
/* primary was blue-on-dark; on cobalt it becomes white-on-cobalt */
.btn.primary { background: #ffffff; color: #1a4bd0; box-shadow: 0 3px 0 #b9c9f2; }
.btn.primary:active { box-shadow: 0 1px 0 #b9c9f2; }
.btn.ghost { background: rgba(255, 255, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); }
.btn.ghost:active { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); }
.field input, #chatInput { background: rgba(0, 20, 90, 0.35); border-color: rgba(255, 255, 255, 0.35); }
.field input::placeholder, #chatInput::placeholder { color: rgba(255, 255, 255, 0.65); }
.conn .dot { background: rgba(255, 255, 255, 0.5); }
.conn.online .dot { background: #3dffa0; box-shadow: 0 0 10px #3dffa0; }
.clock { background: rgba(0, 20, 90, 0.45); }
.clock.running { background: var(--gold); color: var(--ink); }
.segmented button { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.segmented button[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.moves .mv.last { background: rgba(255, 216, 61, 0.28); color: var(--gold); }
.chatlog li.sys { background: rgba(0, 20, 90, 0.55); }
.prompt-btn { background: rgba(255, 255, 255, 0.14); }
.prompt-btn:hover { background: rgba(255, 255, 255, 0.24); }
.pill.over { background: rgba(0, 20, 90, 0.85); }
#quickBtn.waiting { background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); }
.invite { border-color: var(--gold); }
.skin { background: rgba(255, 255, 255, 0.10); }
.ranks li:nth-child(odd) { background: rgba(255, 255, 255, 0.10); }
.promo-row button { background: rgba(255, 255, 255, 0.12); }
.promo-row button:hover { background: rgba(255, 216, 61, 0.30); }
.screen { background: radial-gradient(1200px 600px at 50% -10%, rgba(255, 255, 255, .35), transparent 60%), linear-gradient(180deg, #8fd3f4 0%, #b8e6c1 55%, #7cc47f 100%); }
#preview { background: linear-gradient(180deg, #2d63e8 0%, #1a45c2 100%); }
.toast { background: var(--panel-solid); }
/* A price you can't yet pay reads as an outline, not a muddy dimmed button. */
.skin .btn.cant { opacity: 1; background: rgba(255, 255, 255, 0.10); color: var(--muted); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }

/* ── emote reaction badge ────────────────────────────────────────────── */
.reaction {
  position: absolute;
  left: 50%;
  top: 54px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  border: 2px solid var(--gold);
  box-shadow: var(--shadow);
  font: 700 16px var(--font);
  white-space: nowrap;
}
.reaction-emoji { font-size: 30px; line-height: 1; }
.reaction.pop { animation: reactpop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes reactpop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }
@media (max-width: 720px) { .reaction { top: 50px; font-size: 14px; } .reaction-emoji { font-size: 26px; } }

/* ── seated view pad ─────────────────────────────────────────────────── */
.viewpad {
  position: absolute;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
}
body.at-board .viewpad { display: flex; }
.viewpad-row { display: flex; gap: 4px; }
.viewpad button {
  width: 40px; height: 40px;
  border: 0; border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font: 700 16px var(--font);
  cursor: pointer;
}
.viewpad button:active { background: var(--gold); color: var(--ink); }
.viewpad [data-view="reset"] { font-size: 19px; }
.viewpad-row.zoom { margin-top: 4px; }
.viewpad-row.zoom button { width: 62px; height: 34px; font-size: 20px; }
@media (max-width: 720px) {
  .viewpad { right: 10px; bottom: 72px; padding: 6px; }
  .viewpad button { width: 36px; height: 36px; }
  .viewpad-row.zoom button { width: 56px; height: 30px; }
  body.at-board .invites { bottom: 72px; right: 150px; }
}

/* ── players board + series line ─────────────────────────────────────── */
.scoreboard {
  position: absolute;
  top: 62px;
  right: 12px;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
body.at-board .scoreboard { display: none; }   /* the board panel lives here at a table */
.sb-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sb-head b { font-size: 16px; }
.sb-count { flex: 1; font-size: 13.5px; color: var(--muted); }
.sb-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.sb-list li {
  display: grid;
  grid-template-columns: 1fr 52px 58px 72px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14.5px;
}
.sb-list li.free { cursor: pointer; }
.sb-list li.free:hover { background: rgba(255, 255, 255, 0.12); }
.sb-list li.you { background: rgba(255, 216, 61, 0.16); outline: 1px solid var(--gold); }
.sb-list li.busy .sb-status { color: var(--gold); }
.sb-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-rating { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-rec { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.sb-status { text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sb-hint { margin: 0; padding: 8px 12px 10px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.series { margin-top: 6px; font-size: 13.5px; color: var(--gold); font-weight: 700; }
@media (max-width: 720px) {
  #ranksBtn { display: inline-flex; }          /* it opens the board now, so phones get it back */
  .scoreboard { top: 58px; left: 12px; right: 12px; width: auto; max-height: 60vh; }
  .sb-list li { grid-template-columns: 1fr 48px 52px 66px; font-size: 13.5px; }
}

/* ── Backstage room: page and join-card backgrounds go dark to match ─── */
html, body { background: #07091a; }
.screen {
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(122, 60, 255, .45), transparent 60%),
    radial-gradient(700px 400px at 20% 100%, rgba(217, 70, 239, .18), transparent 60%),
    linear-gradient(180deg, #120c2c 0%, #0a0d1f 100%);
}
.chatlog li, .prompt, .card, .invite, .toast, .conn { border-color: rgba(255, 255, 255, 0.32); }

/* ── chat window (left) + free-standing emote bar ─────────────────────── */
.chatwin {
  position: absolute;
  left: 12px;
  top: 62px;
  width: min(340px, calc(100vw - 24px));
  max-height: 46vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.chat-head b { font-size: 16px; }
.chatwin .chatlog {
  flex: 1;
  min-height: 90px;
  max-height: none;
  margin: 0;
  padding: 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.chatwin .chatlog li { align-self: stretch; max-width: none; background: rgba(255, 255, 255, 0.10); border: 0; }
.chatwin .chatlog li.sys { background: rgba(0, 20, 90, 0.45); color: var(--muted); font-style: italic; }
.chatwin .chatlog li.join { background: transparent; color: var(--muted); font-size: 13.5px; padding: 2px 11px; }
.chatwin .chatlog li.emoteline { background: rgba(255, 216, 61, 0.14); }
.chat-foot { padding: 8px; border-top: 1px solid var(--line); }
.chat-foot #chatInput { width: 100%; }
.chatbtn { position: relative; }
.badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--red); color: #fff;
  font: 700 12px/20px var(--font); text-align: center;
}
.emotes {
  position: absolute;
  left: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
}
@media (max-width: 720px) {
  .chatwin { top: 58px; left: 12px; right: 12px; width: auto; max-height: 42vh; }
  body.at-board .chatwin { max-height: 30vh; }
  .emotes { left: 10px; bottom: 74px; }
}

/* Scoresheet (16 Sep 2026): folded away by default behind a "Scoresheet"
   button in the panel, with its own close button. These rules win over the
   mid-game fold and the phone at-board rule that hide the move list. */
.sheet { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 2px 14px; }
.sheet-head b { font-size: 14px; letter-spacing: .02em; }
.sheet-x { padding: 4px 9px; line-height: 1; }
.panel .sheet:not(.hidden) .moves { display: grid; max-height: 240px; }
body.at-board .panel.sheet-open { max-height: 52vh; }
body.at-board .panel .sheet:not(.hidden) .moves { display: grid; max-height: 22vh; }
.panel.playing.sheet-open { width: min(300px, calc(100vw - 24px)); }

/* ── Phone declutter (16 Sep 2026) ─────────────────────────────────────
   Ryan: "view is mostly obstructed on mobile, buttons don't work, should be
   able to minimize everything". Measured at 375×812 before this: the top bar
   was 434px wide in a 351px row (sound and help off-screen), and at a board
   the turn pill sat on top of the leaderboard and sound buttons. */
.hudkeys { display: none; }
@media (max-width: 720px), (max-height: 500px), (pointer: coarse) {
  .hudkeys {
    position: absolute; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
    display: flex; gap: 6px; align-items: center; z-index: 5;
  }
  .hudkeys .btn.small { min-height: 40px; padding: 8px 12px; font-size: 13px; }
  #padBtn { display: none; width: 44px; padding: 8px 0; font-size: 18px; }
}
@media (max-width: 720px), (max-height: 500px) {
  /* (the second query is a phone on its side, or any very short window) */
  body.at-board .stick, body.at-board #coinsBtn { display: none; }
  /* top bar fits: wordmark and connection label give way everywhere */
  .topbar { gap: 5px; }
  .brand, #connText { display: none; }
  .conn { padding: 7px 9px; }
  .topbar > .btn.small.ghost { padding-left: 9px; padding-right: 9px; }
  #coinsBtn { padding-left: 10px; padding-right: 10px; }
  #quickBtn { margin-left: auto; }

  /* in the park the stick sits low right, above the HUD keys */
  .stick { bottom: 70px; right: 14px; }

  /* at a board: buttons right, pill on its own row under them, panel below */
  body.at-board #chatBtn { margin-left: auto; }
  body.at-board .pill { top: 46px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 24px); }
  body.at-board .reaction { top: 96px; }
  body.at-board .panel { top: 108px; }
  /* an open scoresheet stays compact: the pill already carries names and
     clocks, so the panel head, state line and watchers step aside, the
     sheet leads, and the list shows about three rows (it scrolls) */
  body.at-board .panel.sheet-open .panel-head,
  body.at-board .panel.sheet-open .state,
  body.at-board .panel.sheet-open .watchers { display: none; }
  body.at-board .panel.sheet-open .sheet { order: -1; border-top: 0; }
  body.at-board .panel.sheet-open .panel-actions { border-top: 1px solid var(--line); }
  body.at-board .panel .sheet:not(.hidden) .moves { max-height: 70px; padding-bottom: 6px; }
  body.at-board .panel .sheet-head { padding-top: 6px; }

  /* the camera pad is folded away until asked for */
  body.at-board #padBtn { display: inline-flex; align-items: center; justify-content: center; }
  body.at-board .viewpad { display: none; }
  body.at-board.pad-open .viewpad { display: flex; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 52px); right: 12px; }
  body.at-board.pad-open #padBtn { background: var(--gold); color: var(--ink); }
  body.at-board .invites { bottom: 64px; right: 12px; }
}

/* Hide UI: everything goes except the turn pill, the HUD keys and anything
   waiting on an answer (invites, challenge card, prompt, modals, toasts). */
body.ui-min .topbar > :not(#turnPill):not(#reaction),
body.ui-min .panel,
body.ui-min .social,
body.ui-min .emotes,
body.ui-min .chatlog,
body.ui-min .viewpad,
body.ui-min .stick,
body.ui-min .scoreboard,
body.ui-min .chatwin,
body.ui-min #padBtn { display: none !important; }
body.ui-min.at-board .pill { top: 0; }
body.ui-min #uiBtn { background: var(--gold); color: var(--ink); }
/* Landscape phone at a board: the sides of the screen are the free space,
   so the pill goes back up into the top row and the panel stands as a narrow
   column down the right, clear of the board. */
@media (max-height: 500px) and (min-width: 721px) {
  body.at-board .pill { top: 0; }
  body.at-board .reaction { top: 50px; }
  body.at-board .panel,
  body.at-board .panel.playing:not(.expanded) {
    top: 58px; right: 12px; left: auto; bottom: auto;
    width: 150px; max-width: 150px; max-height: calc(100vh - 124px);
  }
  body.at-board .panel.sheet-open { width: 180px; max-width: 180px; }
  body.at-board .panel .panel-actions { flex-direction: column; align-items: stretch; }
  body.at-board .panel .panel-actions .btn.small { text-align: center; }
  body.at-board .panel .sheet:not(.hidden) .moves { max-height: 90px; grid-template-columns: 22px 1fr 1fr; padding-left: 10px; padding-right: 10px; }
  body.at-board.pad-open .viewpad { right: auto; left: 12px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 54px); }
}
/* Seated or watching you cannot walk, on any screen: a tablet (touch, but
   wider than 720px) used to keep the joystick on top of the camera pad. */
body.at-board .stick { display: none !important; }

/* ---- eResonate account + back link ------------------------------------ */
.memberline { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: rgba(75,159,255,0.14); border: 1px solid rgba(75,159,255,0.45); color: #eaf2ff; font-size: 15px; font-weight: 600; line-height: 1.35; }
.homelink { color: #dbe6ff; text-decoration: none; font-weight: 700; font-size: 15px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,0.10); margin-right: 4px; white-space: nowrap; }
.homelink:hover { background: rgba(255,255,255,0.2); }
body.at-board .homelink { display: none; }

/* The "‹ Games" link (eResonate host) cost the phone top bar 32px it did not
   have: help and sound went off-screen again. On phones it is the chevron
   alone, and the pill steps clear of it at a board. */
@media (max-width: 720px) {
  .homelink .hl-text { display: none; }
  .homelink { padding-left: 11px; padding-right: 11px; }
}
