/* kwata.css — what the kwata changes about the arcade, and nothing else.
 *
 * The arcade came from ../ocheckers whole: the stages, the synthesised
 * soundtrack, the coach, the judge, the replays, both games and both board
 * sizes. All of it is drawn or generated in the browser, downloads nothing
 * and works offline, which is exactly right for a phone on a data bundle.
 *
 * Two things differ here.
 *
 * **Online play runs on signed events, not a room.** ocheckers paired
 * players through a Go server that owned the game; we do not run one. Here a
 * challenge and every move are events on our relay, and both boards replay
 * them through the same engine (docs/GAMES.md §2, §6). What that cannot carry
 * stays hidden: there are no ranks, because a rating needs somebody trusted
 * to keep the table. (Engine-against-engine "Watch" was hidden alongside the
 * online controls from the start and is left as it was.)
 *
 * **The line about money.** A board is not a table: nobody wagers here and
 * we take nothing from a game (GAMES §3). The arcade had no reason to say
 * so; on our domain it does. */

[data-gmode="watch"],
#leaderboardBtn,
#ranksOverlay {
  display: none !important;
}

/* The online card: the lobby of open challenges, and the QR drawn in place. */
.lobby-head { margin: 16px 0 6px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; opacity: .7 }
.ranks.lobby { max-height: 260px; overflow-y: auto }
.ranks.lobby li { grid-template-columns: auto 1fr auto }
.ranks.lobby .empty { padding: 14px 8px }
#roomCard .joinrow input { text-transform: none; letter-spacing: 0; font: 600 .8rem ui-monospace, monospace; text-align: left }
.inviteqr svg { display: block; width: 100%; height: 100% }
#roomLive .controls.two + .controls.two { margin-top: 8px }

.kwata-note {
  margin: 10px auto 18px;
  max-width: 34rem;
  padding: 10px 12px;
  border: 1px solid currentColor;
  border-radius: 8px;
  opacity: .85;
  font-size: .9rem;
  line-height: 1.45;
  text-align: center;
}
.kwata-note b { font-weight: 700 }
.kwata-note a { color: inherit }

/* ── The way home ───────────────────────────────────────────────────────
 * ocheckers was its own site, so its header had nowhere to go back to. Here
 * the arcade is one room of the machine (docs/ONE-PLATFORM.md §2), and the
 * four places in the site's own top bar are not on this page — it is the
 * arcade's own chrome, deliberately, so this is the single door out.
 */
.kwata-home {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 14px;
  padding: 6px 12px 6px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: #c97d1d;
  text-decoration: none;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .04em;
  opacity: .82;
  white-space: nowrap;
  transition: opacity .15s ease, transform .15s ease;
}
.kwata-home:hover { opacity: 1 }
.kwata-home:active { transform: scale(.97) }
@media (max-width: 560px) {
  .kwata-home span { display: none }
  .kwata-home { margin-right: 8px; padding: 6px }
}

/* ── Inside the machine's frame ─────────────────────────────────────────
 * The server puts the site's menu bar straight after <body> (docs/DESKTOP.md
 * §2) and says how tall it is in --shell-top. The bar is in the flow, so the
 * arcade's own header already sits beneath it; what does not are the things
 * pinned to the window — the overlays, the drawer, the immersive board — and
 * each of those starts below the bar instead of under it. Served on its own,
 * --shell-top is unset and every offset below is zero.
 */
.boot, .replay, .stagesel, .promo, .stage-reveal, .stage-name, .scrim {
  top: var(--shell-top, 0px);
}
body.immersive .app { height: calc(100dvh - var(--shell-top, 0px)) }
body.immersive .panel { top: var(--shell-top, 0px) }
body.immersive .board-col { width: min(100%, calc(100dvh - var(--shell-top, 0px) - 190px)) }
@media (max-height: 620px) {
  body.immersive .board-col { width: min(100%, calc(100dvh - var(--shell-top, 0px) - 120px)) }
}

/* The menu bar has a way home in it, so the arcade's own door steps aside.
 * Without :has() both stay, which is untidy and nothing worse. */
html[data-shell] .kwata-home,
body[data-shell] .kwata-home,
body:has(#shell, [data-shell]) .kwata-home { display: none }

/* The site's dock sits at the foot of the window; the music dock rises above it. */
body:has(#shell, [data-shell]) .musicdock {
  bottom: calc(var(--dock-h, 0px) + max(14px, env(safe-area-inset-bottom)));
}

/* ── Arcade hours (docs/ARCADE.md) ──────────────────────────────────────
 * The one thing the kwata sells in here is time on the machine, so it is
 * dressed as a cabinet: a coin slot, a marquee, an amber clock, CONTINUE?.
 * Warm and dark whatever the stage, because a cabinet is a lit box in a dim
 * room. Everything moves by transform and opacity, and nothing moves for
 * ever (docs/DESKTOP.md §3): the pill's clock is text, not an animation.
 */
.coin-ico { width: 1.15em; height: 1.15em; vertical-align: -.22em }

.coin-pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding-inline: 10px 13px;
  color: var(--gold-bright); border-color: color-mix(in srgb, var(--gold) 55%, transparent);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.coin-pill .cp-face { display: inline-grid; place-items: center }
.coin-pill .cp-face .ico { width: 1.2em; height: 1.2em }
.coin-pill.on {
  background: linear-gradient(180deg, #2a1d0c, #17100a); color: #ffcf6e;
  border-color: #a9700f; box-shadow: inset 0 0 0 1px rgba(255, 207, 110, .12), 0 0 14px rgba(242, 190, 90, .18);
}
.coin-pill.on .cp-text { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; letter-spacing: .02em }
.coin-pill.low { color: #ff9a6b; border-color: #ad4526 }
.coin-pill.bump { animation: coinbump .6s cubic-bezier(.2, 1.4, .4, 1) }
@keyframes coinbump { 0% { transform: scale(1) } 30% { transform: scale(1.18) } 100% { transform: scale(1) } }
.cp-plus {
  position: absolute; left: 50%; top: -4px; pointer-events: none;
  font: 800 .78rem system-ui; color: #ffcf6e; text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
  animation: coinplus 1.3s ease-out forwards;
}
@keyframes coinplus { 0% { opacity: 0; transform: translate(-50%, 6px) } 20% { opacity: 1 } 100% { opacity: 0; transform: translate(-50%, -26px) } }
@media (max-width: 560px) {
  .coin-pill { padding-inline: 8px 10px; font-size: .8rem }
  .coin-pill:not(.on) .cp-text { display: none }
  .coin-pill:not(.on) { padding-inline: 8px }
}

/* The level chip that needs time wears the coin, and says so quietly. */
.segmented button.locked { color: color-mix(in srgb, var(--ink-mut) 80%, transparent); white-space: nowrap }
.segmented button.locked .coin-ico { color: var(--gold); width: 1em; height: 1em; margin-right: 1px }

/* ── The Gauntlet card: a marquee in the new-game panel ── */
.gauntlet {
  display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 12px;
  padding: 13px 14px 12px; text-align: left; cursor: pointer;
  border: 1px solid #6b4a1c; border-radius: 12px; color: #f3e6cc;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(242, 190, 90, .16), transparent 55%),
    linear-gradient(160deg, #2b1d0d, #140e08 70%);
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, .12), 0 6px 18px rgba(20, 12, 4, .28);
  transition: transform .15s ease, box-shadow .15s ease;
}
.gauntlet:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 220, 150, .16), 0 10px 24px rgba(20, 12, 4, .34) }
.gauntlet:active { transform: scale(.985) }
.gt-top { display: flex; align-items: center; justify-content: space-between; gap: 10px }
.gt-top b {
  white-space: nowrap;
  font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 1.12rem; letter-spacing: .01em;
  color: #ffcf6e; text-shadow: 0 0 12px rgba(242, 190, 90, .35);
}
.gt-go {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font: 800 .68rem system-ui; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap;
  padding: 5px 9px; border-radius: 999px; background: #f2be5a; color: #1a1206;
}
.gauntlet.locked .gt-go { background: transparent; color: #ffcf6e; box-shadow: inset 0 0 0 1px rgba(255, 207, 110, .55) }
.gauntlet.running .gt-go { background: #68c58c; color: #0d1a10 }
.gt-pips { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px }
.gt-pips i {
  height: 7px; border-radius: 2px; background: rgba(255, 220, 150, .16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.gt-pips i.won { background: var(--pip, #f2be5a); box-shadow: 0 0 6px color-mix(in srgb, var(--pip, #f2be5a) 60%, transparent) }
.gt-pips i.now { background: #fff3d6; transform: scaleY(1.5) }
.gt-best { font-size: .78rem; color: #cdb993; font-variant-numeric: tabular-nums }

/* The bout under way, beside the turn. */
.bout-hud {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
  font-size: .82rem; font-weight: 650; color: var(--ink-mut);
}
.bout-hud b {
  font: 800 .7rem system-ui; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; background: #1d140a; color: #ffcf6e; border: 1px solid #6b4a1c;
}

/* The bout card: the stage reveal, with the bout number over the name. */
.sr-bout {
  display: inline-block; margin-bottom: 10px; opacity: 0; transform: translateY(10px);
  padding: 7px 10px 7px 18px; border-radius: 999px; border: 1px solid #7a5420;
  background: rgba(18, 12, 6, .82); box-shadow: 0 0 24px rgba(242, 190, 90, .25);
  font: 800 clamp(.85rem, 2.4vw, 1.1rem) system-ui; letter-spacing: .45em; text-transform: uppercase;
  color: #ffcf6e;
  transition: opacity 400ms ease 60ms, transform 520ms cubic-bezier(.2, 1, .3, 1) 60ms;
}
.sr-bout small { font-size: .7em; letter-spacing: .3em; opacity: .7 }
.stage-reveal.in .sr-bout { opacity: 1; transform: none }

/* ── The cabinet screens over the board: CONTINUE?, TIME'S UP, GAME OVER ── */
.arcade-overlay {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 14px;
  border-radius: 12px; background: rgba(12, 8, 4, .72); animation: fadein .2s ease;
}
.arcade-card {
  width: min(340px, 100%); text-align: center; padding: 22px 20px 20px; border-radius: 18px;
  color: #f3e6cc; border: 1px solid #7a5420;
  background: radial-gradient(120% 90% at 50% 0%, #3a2710, #120c06 72%);
  box-shadow: 0 0 0 4px rgba(20, 12, 4, .6), 0 0 40px rgba(242, 190, 90, .22), 0 24px 60px rgba(0, 0, 0, .6);
  animation: pop .32s ease;
}
.ac-bout { margin: 0; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: #cdb993 }
.ac-title {
  margin: 6px 0 2px; font: 900 clamp(2rem, 9vw, 2.6rem) system-ui; letter-spacing: .06em;
  color: #ffcf6e; text-shadow: 0 0 18px rgba(242, 190, 90, .55), 0 3px 0 #6b3e0a;
}
.arcade-card.continue .ac-title, .arcade-card.over .ac-title { color: #ffb08a; text-shadow: 0 0 18px rgba(224, 122, 84, .55), 0 3px 0 #5a1f0c }
.ac-count {
  font: 900 4.6rem/1 ui-monospace, "SF Mono", Menlo, monospace; color: #fff3d6; margin: 4px 0 6px;
  text-shadow: 0 0 24px rgba(255, 207, 110, .6); font-variant-numeric: tabular-nums;
}
.ac-count.tick { animation: counttick .45s cubic-bezier(.2, 1.5, .4, 1) }
@keyframes counttick { 0% { transform: scale(1.35); opacity: .4 } 100% { transform: scale(1); opacity: 1 } }
.ac-sub { margin: 4px 0 16px; font-size: .9rem; color: #d8c7a4; line-height: 1.4 }
.ac-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap }
.ac-actions .btn { min-width: 118px; display: inline-flex; align-items: center; justify-content: center; gap: 6px }
.ac-actions .btn:not(.primary) { background: transparent; color: #f3e6cc; border-color: #6b4a1c }
.arcade-card .btn.primary { background: #f2be5a; border-color: #f2be5a; color: #1a1206 }

/* ── The coin slot ── */
.coin-sheet { max-width: 440px; background: #140e08; color: #f3e6cc; border-color: #6b4a1c; overflow-y: auto }
.coin-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px;
  /* a row of bulbs along the top and the bottom edge, as a marquee has */
  background:
    radial-gradient(circle, rgba(255, 207, 110, .7) 1.3px, transparent 2px) 7px 3px / 14px 8px repeat-x,
    radial-gradient(circle, rgba(255, 207, 110, .7) 1.3px, transparent 2px) 0 calc(100% - 3px) / 14px 8px repeat-x,
    linear-gradient(180deg, #3a2710, #1d140a);
  padding-block: 18px;
  border-bottom: 1px solid #6b4a1c;
}
.coin-marquee b {
  display: block; font: 900 1.7rem/1 system-ui; letter-spacing: .28em; color: #ffcf6e;
  text-shadow: 0 0 16px rgba(242, 190, 90, .6), 0 2px 0 #6b3e0a;
}
.coin-marquee i { display: block; margin-top: 4px; font-style: normal; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: #cdb993 }
.coin-top .btn.ghost { color: #f3e6cc; border-color: #6b4a1c; background: rgba(0, 0, 0, .25) }
.coin-clock {
  margin: 16px 16px 4px; padding: 12px 14px; border-radius: 12px; text-align: center;
  background: #0a0704; box-shadow: inset 0 2px 10px rgba(0, 0, 0, .8), inset 0 0 0 1px #3a2710;
}
.coin-clock b {
  display: block; font: 800 2.4rem/1.05 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .04em;
  color: #4a3a22; font-variant-numeric: tabular-nums;
}
.coin-clock.on b { color: #ffcf6e; text-shadow: 0 0 18px rgba(242, 190, 90, .55) }
.coin-clock i { display: block; margin-top: 4px; font-style: normal; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: #8d7b5c }
.coin-why { margin: 10px 18px 0; font-size: .92rem; color: #ffcf6e; text-align: center; line-height: 1.4 }
.coin-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 12px }
.coin-buys { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.coin-buy {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px 14px;
  border-radius: 14px; border: 1px solid #a9700f; cursor: pointer; color: #1a1206;
  background: linear-gradient(180deg, #ffd27a, #e3a63a 60%, #b97d1a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -3px 0 rgba(90, 50, 5, .35), 0 6px 16px rgba(0, 0, 0, .4);
  transition: transform .12s ease, box-shadow .12s ease;
}
.coin-buy:hover { transform: translateY(-1px) }
.coin-buy:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 2px 6px rgba(0, 0, 0, .4) }
.coin-buy .coin-ico { width: 2rem; height: 2rem; stroke-width: 1.8 }
.coin-buy span { display: flex; flex-direction: column; align-items: center; gap: 2px }
.coin-buy b { font: 800 1.05rem system-ui }
.coin-buy i { font-style: normal; font-weight: 650; font-size: .86rem; opacity: .8; font-variant-numeric: tabular-nums }
.cs-dim { margin: 0; font-size: .82rem; color: #a8977a; text-align: center; line-height: 1.45 }
.cs-msg { margin: 4px 0; font-size: 1rem; text-align: center; line-height: 1.45 }
.cs-msg.err { color: #ff9a6b }
.cs-msg.ok { color: #ffcf6e; font-weight: 700; font-size: 1.15rem }
.cs-what { margin: 0; text-align: center; font-weight: 700; color: #ffcf6e }
.cs-note {
  margin: 4px 0 0; padding: 10px 12px; border-radius: 10px; font-size: .8rem; line-height: 1.5;
  color: #cdb993; background: rgba(255, 255, 255, .03); border: 1px solid #3a2710;
}
.cs-note b { color: #f3e6cc }
.coin-qr { display: block; width: min(240px, 70vw); margin: 0 auto; padding: 12px; border-radius: 12px; background: #fff }
.coin-qr svg { display: block; width: 100%; height: auto }
.coin-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap }
.coin-row .btn:not(.primary) { background: transparent; color: #f3e6cc; border-color: #6b4a1c }
.coin-row .btn.primary { background: #f2be5a; border-color: #f2be5a; color: #1a1206; text-decoration: none }
.coin-wait { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 0; color: #ffcf6e; font-weight: 650 }

/* The coin going in: it drops, the slot swallows it. */
.coin-drop { position: relative; height: 96px; display: grid; place-items: end center }
.cd-slot { width: 78px; height: 12px; border-radius: 6px; background: #000; box-shadow: 0 0 0 3px #6b4a1c, 0 0 18px rgba(242, 190, 90, .45); position: relative; z-index: 1 }
.cd-slot::after {
  content: ""; position: absolute; inset: -10px -18px; border-radius: 16px; opacity: 0;
  box-shadow: 0 0 34px 8px rgba(255, 207, 110, .75); animation: slotglow 1.2s ease-out .85s forwards;
}
@keyframes slotglow { 0% { opacity: 0 } 25% { opacity: 1 } 100% { opacity: .35 } }
.cs-added {
  margin: -4px 0 0; text-align: center; font: 900 2rem/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: #ffcf6e; text-shadow: 0 0 18px rgba(242, 190, 90, .6); opacity: 0; animation: addedin .5s cubic-bezier(.2, 1.4, .4, 1) .9s forwards;
}
@keyframes addedin { from { opacity: 0; transform: scale(.6) } to { opacity: 1; transform: none } }
.cd-coin {
  position: absolute; left: 50%; bottom: 4px; width: 58px; height: 58px; margin-left: -29px;
  color: #6b3e0a; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #fff1c4, #f2be5a 45%, #b97d1a);
  box-shadow: inset 0 -3px 0 rgba(90, 50, 5, .35), 0 4px 14px rgba(0, 0, 0, .5);
  animation: coindrop 1s cubic-bezier(.5, 0, .75, 0) forwards;
}
.cd-coin .coin-ico { width: 36px; height: 36px; stroke-width: 2.4 }
@keyframes coindrop {
  0% { transform: translateY(-70px) rotateY(0); opacity: 0 }
  15% { opacity: 1 }
  70% { transform: translateY(-4px) rotateY(540deg); opacity: 1 }
  100% { transform: translateY(40px) rotateY(720deg) scaleX(.2); opacity: 0 }
}

@media (prefers-reduced-motion: reduce) {
  .coin-pill.bump, .cp-plus, .ac-count.tick, .cd-coin, .arcade-card, .arcade-overlay, .cd-slot::after, .cs-added { animation: none }
  .cd-coin { opacity: 0 }
  .cs-added { opacity: 1 }
}

/* The way back to the hall, and the way on from a finished game. */
.all-games { display: block; font-size: .78rem; color: var(--ink-mut); text-decoration: none; margin-bottom: 2px }
.result-actions a.btn { text-align: center; text-decoration: none }

/* Equal squares whatever stands on them. The board set its columns and left its
   rows to their content, so a row of chess pieces stood taller than an empty one
   and every move resized the rows. minmax(0,…): a glyph cannot stretch a track. */
.board { grid-template-columns: repeat(var(--dim,8), minmax(0,1fr)); grid-template-rows: repeat(var(--dim,8), minmax(0,1fr)) }
.sq { min-width: 0; min-height: 0 }
