/* Shared look for games.pao.best: Silent Blues paper, navy ink, periwinkle accent. */

:root {
  /* "Silent Blues": F3F5F9 page, E4EEF9 wells, D5E8F6 highlight, CFD9FB soft selection, 96AAE9 accent */
  --paper: #f3f5f9;
  --sheet: #ffffff;
  --sunk: #e4eef9;
  --hl: #d5e8f6;
  --game-soft: #cfd9fb;
  --accent: #96aae9;
  --accent-ink: #1b2547;   /* text on the accent */
  --game: #5b73d4;         /* accent deepened for text, digits and selection on light ground */
  --ink: #1b2547;
  --muted: #5d6a8c;
  --line: #d3ddef;
  --line-strong: #8d9dca;
  --good: #2f9e6e;
  --bad: #d7263d;
  --shadow: 0 1px 0 rgba(27, 37, 71, .05), 0 8px 24px -12px rgba(27, 37, 71, .28);
  --display: "Bagel Fat One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111729; --sheet: #1a2240; --sunk: #222c4e; --hl: #25305a; --game-soft: #2e3a6c;
    --accent: #96aae9; --accent-ink: #111729; --game: #aebdf2; --ink: #e8eefb; --muted: #98a4c6;
    --line: #2b3659; --line-strong: #56648f; --good: #5fd0a0; --bad: #ff6b7d;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111729; --sheet: #1a2240; --sunk: #222c4e; --hl: #25305a; --game-soft: #2e3a6c;
  --accent: #96aae9; --accent-ink: #111729; --game: #aebdf2; --ink: #e8eefb; --muted: #98a4c6;
  --line: #2b3659; --line-strong: #56648f; --good: #5fd0a0; --bad: #ff6b7d;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* manipulation keeps scrolling and pinch zoom but drops double-tap zoom, which fast taps on a grid trigger */
html, body { height: 100%; touch-action: manipulation; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 500 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--game); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }

/* Top bar used by every game */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; gap: 8px;
  min-height: 52px;
  padding-block: 6px;
  padding-left: max(10px, env(safe-area-inset-left, 0px));
  padding-right: max(10px, env(safe-area-inset-right, 0px));
  background: var(--paper);
}
.topbar .title { flex: 1; min-width: 0; text-align: center; line-height: 1.15; }
.topbar .title b { display: block; font: 400 1.15rem/1.1 var(--display); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title small { color: var(--muted); font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; flex: none;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--ink);
  text-decoration: none;
}
.icon-btn:active { background: var(--sunk); }
.icon-btn svg { width: 24px; height: 24px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--sheet); color: var(--ink);
  font-weight: 700; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Bottom sheet dialog */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 12, 30, .45);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: fade .18s ease-out;
}
.sheet-panel {
  width: min(520px, 100%);
  max-height: 88%; overflow: auto;
  background: var(--sheet);
  border-radius: 22px 22px 0 0;
  padding-block: 22px 26px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  box-shadow: var(--shadow);
  animation: rise .24s cubic-bezier(.2, .9, .3, 1.1);
}
@media (min-width: 560px) {
  .sheet-backdrop { align-items: center; }
  .sheet-panel { border-radius: 22px; }
}
.sheet-panel h2 { font: 400 1.6rem/1.1 var(--display); margin-bottom: 10px; }
.sheet-panel p { margin: 0 0 12px; color: var(--muted); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1 1 140px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-weight: 700; font-size: .92rem;
  animation: rise .2s ease-out;
}

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { translate: 0 24px; opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
