/* Pong Classic — mobile-first styles.
 * System theme via prefers-color-scheme (no JS toggle), plus
 * color-scheme so form controls follow the OS theme too.
 * Banner reserve: anchored adaptive banners are up to 90dp tall on
 * phones (Michelle 2026-11-12) — body padding-bottom reserves it and
 * fixed overlays (toast, sheet) carry their own --banner-h offset.
 * The whole game view fits above the banner with no scrolling:
 * topbar + HUD + canvas + controls = 100dvh minus the banner reserve.
 */
:root {
  color-scheme: light dark;
  --banner-h: 0px;
  --bg: #e9eef4;
  --surface: #ffffff;
  --surface-2: #dfe7f0;
  --ink: #101820;
  --ink-2: #46525e;
  --ink-3: #76828e;
  --line: #c9d3dd;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-soft: #dbeafe;
  --danger: #b3261e;
  --warn: #8a5a00;
  --good: #1d4ed8;
  --radius: 16px;
  --canvas-bg: #0b1220;
  --stroke: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #05070d;
    --surface: #121826;
    --surface-2: #1b2334;
    --ink: #eef2f8;
    --ink-2: #b9c4d4;
    --ink-3: #7e8ba0;
    --line: #2a3448;
    --accent: #7db4ff;
    --accent-ink: #06101f;
    --accent-soft: #16263f;
    --danger: #ff8a80;
    --warn: #ffcf7d;
    --good: #7db4ff;
    --canvas-bg: #05070d;
    --stroke: #ffffff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--banner-h);
  overflow: hidden;
}
body, button, input { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
button { touch-action: manipulation; }
button, a { -webkit-touch-callout: none; user-select: none; }

.app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px;
}

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; padding-top: 6px; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); display: block; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-word { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.brand-word span { color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.about-button {
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; cursor: pointer;
}
.icon-button {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 20px;
}

/* ---- HUD ---- */
.hud {
  display: flex; align-items: center; gap: 14px;
  min-height: 34px; flex-shrink: 0;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-3);
}
.hud-item strong { color: var(--ink); font-size: 15px; letter-spacing: 0; }
.hud-mode { margin-left: auto; font-size: 11px; letter-spacing: 0.04em; text-align: right; }

/* ---- stage / canvas ---- */
.stage {
  flex: 1; min-height: 0;
  border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; background: var(--canvas-bg);
}
#game { display: block; width: 100%; height: 100%; touch-action: none; }

/* ---- controls: thumb-sized, clear of the 90px banner zone.
 * One row, three buttons, no wrapping (Chess vc3 lesson):
 * compact text + nowrap, heights proven in the harness. */
.controls {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0 6px;
  min-height: 66px;
  touch-action: none;
}
.ctl-btn {
  flex: 1 1 0; min-width: 0; height: 52px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none; white-space: nowrap; overflow: hidden;
  padding: 0 8px;
}
.ctl-btn:active { background: var(--accent-soft); border-color: var(--accent); }
#settingsBtn { flex: 0 0 52px; font-size: 22px; }

/* ---- buttons ---- */
.button {
  min-height: 52px; border-radius: 12px; border: 1px solid transparent;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 16px; cursor: pointer; padding: 0 16px;
  width: 100%; margin-top: 10px; white-space: nowrap;
}
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }

/* ---- segmented pickers (menu + settings) ---- */
.seg-label { margin: 14px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-3); text-transform: uppercase; }
.seg { display: flex; gap: 8px; }
.seg-btn {
  flex: 1 1 0; min-width: 0; min-height: 48px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap;
}
.seg-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---- sheets ---- */
.sheet {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-center { align-items: center; }
.sheet-card {
  background: var(--surface); color: var(--ink);
  border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + var(--banner-h));
  width: 100%; max-width: 560px; max-height: 82dvh; overflow-y: auto;
}
.sheet-center .sheet-card { border-radius: 20px; margin: 16px; padding-bottom: 20px; text-align: center; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.sheet-card h1 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.menu-sub { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.menu-best { margin: 10px 0 0; font-weight: 700; color: var(--accent); }
.menu-help { margin: 14px 0 0; font-size: 13px; color: var(--ink-2); }
.about-body { font-size: 14px; color: var(--ink-2); }
.about-meta { font-size: 12px; color: var(--ink-3); margin: 14px 0 0; }
.footer-link {
  background: none; border: 0; padding: 10px 4px; cursor: pointer;
  color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: 0;
}

/* ---- toast: pointer-events none so it never eats taps (BlockDrop
 * T26); anchored ABOVE the controls + banner, never overlapping
 * them (Solitaire correction). */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--banner-h) + 82px);
  z-index: 50; pointer-events: none;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  max-width: calc(100vw - 32px); text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
