/* Host side of the shared game UI: the :root token contract the legacy surfaces of
   @oshizi/platform-game-ui read, AppleGame's page background and font stack, the game-specific
   BubbleBreaker board (a renderer surface, outside the shared chrome), and a few app regions. */
:root {
  --maxw: 760px;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-input: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --brand: #7c3aed;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --purple: #7c3aed;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.06);
  --font-inter: Inter, system-ui, sans-serif;
  color-scheme: light;
}
html.dark {
  --surface: #1f2937;
  --border: #374151;
  --border-input: #4b5563;
  --text: #f9fafb;
  --muted: #9ca3af;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Pretendard Variable', Pretendard, var(--font-inter), -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #fef8ee 0%, #ffffff 60%);
  -webkit-font-smoothing: antialiased;
}
html.dark body { background: #111827; }
/* the shared stylesheet's ghost, result and HUD buttons build on the host's button base: without one they render as
   the browser's 2 px outset default. Surfaces that want another shape (.bb-cell, .tool-pill, .btn, the top bar tiles)
   set their own border, padding and radius */
button { font: inherit; border: 0; border-radius: 10px; padding: 11px 16px; cursor: pointer; }
/* the landing inputs: 16 px keeps iOS Safari from zooming on focus; the padding makes them a finger tall */
.game-ui-landing input { font-size: 16px; padding: 10px 12px; border: 1px solid var(--border-input); border-radius: 10px; }
.page { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 16px 16px 40px; }
.page-wide { max-width: 1040px; }
.brand-mark { font-weight: 800; letter-spacing: -0.02em; fill: currentColor; }

/* lobby extras */
.room-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 4px; }
.tool-pill { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 10px 14px; font-size: 13px; cursor: pointer; }
.tool-pill[disabled] { cursor: default; opacity: 0.6; }
/* a passive label beside the pills (time limit, player count, waiting for the host): not a button */
.tool-tag { color: var(--muted); font-size: 13px; padding: 10px 4px; }
.results-note { margin-top: 10px; }
.tool-note { color: var(--muted); font-size: 12.5px; text-align: center; margin: 6px 0 0; }

/* play */
.hud-time-low { color: #dc2626; font-weight: 700; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.side-hint { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.me-row td:first-child::after { content: ' (me)'; color: var(--muted); }

/* BubbleBreaker board: circles on a soft slab (the rewrite's renderer surface) */
.bb-board { display: grid; gap: 2px; background: #eef2f6; padding: 6px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05); width: max-content; margin: 0 auto; }
html.dark .bb-board { background: #0f172a; }
.bb-cell { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px #0002; cursor: pointer; transition: transform 80ms; }
.bb-cell[data-poppable="1"]:hover { transform: scale(1.12); box-shadow: inset 0 0 0 2px #0004; }
.bb-cell[disabled] { cursor: default; box-shadow: none; }
.bb-cell.bb-empty { background: transparent !important; box-shadow: none; cursor: default; }
/* a phone: the widest cell that keeps the 10-column board inside the viewport (page and board padding, gaps), 30 px at most */
@media (max-width: 480px) { .bb-cell { --cell: min(30px, calc((100vw - 66px) / 10)); width: var(--cell); height: var(--cell); } }

/* overlays */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(17, 24, 39, 0.55); z-index: 50; padding: 16px; }
.overlay-card { background: var(--surface); color: var(--text); border-radius: 16px; padding: 22px 24px; max-width: 360px; width: 100%; text-align: center; box-shadow: var(--shadow-card); }
.overlay-card h2 { margin: 0 0 8px; font-size: 20px; }
.overlay-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.overlay-actions { display: flex; gap: 8px; justify-content: center; }
.btn { border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 600; cursor: pointer; background: var(--blue); color: #fff; }
.btn:hover { background: var(--blue-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.countdown { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 40; pointer-events: none; background: rgba(255, 255, 255, 0.75); }
html.dark .countdown { background: rgba(17, 24, 39, 0.75); }
.countdown-digit { font-size: 96px; font-weight: 800; color: #7c3aed; text-shadow: 0 4px 24px rgba(124, 58, 237, 0.35); animation: pulse 1s infinite; }
.countdown-hint { color: var(--muted); font-size: 16px; }
.results-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.medal-1 { color: #ca8a04; font-weight: 800; }
.medal-2 { color: #6b7280; font-weight: 800; }
.medal-3 { color: #b45309; font-weight: 800; }

/* chooser */
.chooser-title { text-align: center; margin: 24px 0 4px; font-size: 26px; }
.chooser-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 18px; }
.chooser-card { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 22px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-card); text-decoration: none; color: var(--text); }
.chooser-card:hover { border-color: var(--blue); }

/* ColorTiles board: the production canvas (660 x 451 stage), scaled to the column */
.board-wide { width: 100%; max-width: 660px; margin: 0 auto; }
.ct-canvas { display: block; width: 100%; height: auto; user-select: none; touch-action: none; border-radius: 10px; box-shadow: var(--shadow-card); }
@media (min-width: 900px) { .page-wide .game-ui-stage { grid-template-columns: minmax(0, 680px) minmax(220px, 1fr); } }

/* AppleGame alignment (measured tokens: test/browser/reference/applegame/SPEC.md sections 2-7).
   Same page gradient, text palette, radii and shadows; emerald primary action in the lobby and
   results; the HUD and the board sit on AppleGame's green slabs. Dark mode keeps the host's own
   dark tokens (the reference was captured in light mode only). */
:root { --text: #1f2937; --label: #374151; --secondary: #4b5563; --muted: #6b7280; --faint: #9ca3af; --border: #e5e7eb; --primary: #10b981; --primary-hover: #059669; --slab: #def6d0; --hairline: rgba(22, 101, 52, 0.2);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05); --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --glow: 0 10px 15px -3px rgba(16, 185, 129, 0.25), 0 4px 6px -4px rgba(16, 185, 129, 0.25); }
body { color: #171717; background: #ffffff linear-gradient(to right bottom, #fffbeb, #fff7ed, #fff1f2); min-height: 100dvh; }
html.dark body { background: #111827; }
h1, h2, h3, .game-ui-lobby-title { color: var(--text); }
body .game-ui-landing, body .game-ui-lobby, body .game-ui-result, body .game-ui-scores { border-radius: 16px; box-shadow: var(--shadow-sm); }
/* the results card has the lobby card's surface (the package gives it a radius and a shadow only) */
body .game-ui-result { background: var(--surface); border: 1px solid var(--border); padding: 18px 20px; }
body .game-ui-lobby-code { background: #f9fafb; border: 1px solid var(--border); border-radius: 12px; color: var(--text); letter-spacing: 0.8px; }
/* the package stylesheet is appended to <head> after this file, so these overrides carry one extra level of specificity */
.game-ui-lobby { --blue: var(--primary); --blue-hover: var(--primary-hover); --shadow: var(--glow); }
body .btn { background: var(--primary); color: #ffffff; border: 0; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow-md); }
body .btn:hover { background: var(--primary-hover); }
body .btn-ghost { background: #f3f4f6; color: var(--secondary); box-shadow: none; }
.game-ui-landing-cta { border-radius: 12px; box-shadow: var(--shadow-md); font-weight: 600; }
body .game-ui-gamebar { background: var(--slab); border: 0; border-radius: 12px; box-shadow: var(--shadow-md), 0 0 0 1px var(--hairline); color: var(--text); padding: 10px 16px; }
body .game-ui-gamebar-btn { border-radius: 8px; }
.bb-board, .ct-canvas { background: var(--slab); border-radius: 12px; box-shadow: var(--shadow-lg), 0 0 0 1px var(--hairline); }
.bb-board { padding: 8px; }
.tool-pill { border-radius: 12px; color: var(--secondary); }
.tool-note, .side-hint, .game-ui-lobby-hint, .game-ui-lobby-muted { color: var(--muted); }
html.dark { --text: #f9fafb; --label: #e5e7eb; --secondary: #d1d5db; --muted: #9ca3af; --border: #374151; --slab: #14532d; --hairline: rgba(134, 239, 172, 0.25); }
html.dark body { color: #f9fafb; }
html.dark body .game-ui-lobby-code { background: #111827; }
html.dark body .btn-ghost { background: #374151; color: #e5e7eb; }

/* the account chip and the beta tag (web/src/app.tsx AccountArea) */
.account-area { display: inline-flex; align-items: center; gap: 8px; }
.beta-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; border: 1px solid currentColor; color: var(--muted); }
.chooser-account { display: flex; justify-content: flex-end; }
