/* Arcade — clean, minimal design system */

:root {
  --bg: #f5f3ee;
  --surface: #fffdf8;
  --surface-2: #ece9e1;
  --line: #ddd8cc;
  --ink: #24211c;
  --ink-soft: #6b665c;
  --ink-faint: #a39d90;
  --accent: #2f6f6a;
  --accent-soft: #d7e5e3;
  --danger: #b4553f;
  --gold: #c99a3c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --tap: manipulation;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16150f;
    --surface: #201e17;
    --surface-2: #2a2820;
    --line: #38352b;
    --ink: #ece8dd;
    --ink-soft: #a8a294;
    --ink-faint: #736e62;
    --accent: #6fb3ac;
    --accent-soft: #24352f;
    --danger: #d47a63;
    --gold: #d9b45f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 6px;
  min-height: 52px;
}
.topbar .title {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: .2px;
  flex: 1;
  text-align: center;
}
.iconbtn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  width: 40px; height: 40px;
  border-radius: 999px;
  font-size: 20px;
  display: grid; place-items: center;
  cursor: pointer;
}
.iconbtn:active { background: var(--surface-2); }
.iconbtn.hidden { visibility: hidden; }

/* ---- Home / menu ---- */
.home { padding: 8px 18px 32px; }
.home .wordmark {
  text-align: center;
  margin: 24px 0 6px;
}
.home .wordmark h1 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: .5px;
  margin: 0;
}
.home .wordmark p {
  margin: 6px 0 0;
  color: var(--ink-faint);
  font-size: 13px;
  letter-spacing: .3px;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 26px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .08s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 140px;
}
.tile:active { transform: scale(.975); }
.tile .glyph {
  height: 60px;
  display: grid;
  place-items: center;
}
.tile .glyph svg { width: 56px; height: 56px; }
.tile .label { font-weight: 600; font-size: 16px; }
.tile .sub { color: var(--ink-faint); font-size: 12px; margin-top: -8px; }
.tile.wide { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; }
.tile.wide .glyph { height: 40px; }
.tile.wide .glyph svg { width: 36px; height: 36px; }
.tile.soon { opacity: .5; }
.tile .best {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: .3px;
}

/* ---- Screen (game container) ---- */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 4px 16px 20px;
  min-height: 0;
}
.screen.center { justify-content: center; align-items: center; }

.hud {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 22px;
  padding: 4px 0 14px;
}
.stat { text-align: center; }
.stat .k { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .8px; }
.stat .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
}
.btn:active { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btnrow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }

/* ---- Overlay (win / game over) ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,18,12,.55);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.card {
  background: var(--surface);
  border-radius: 22px;
  padding: 30px 26px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 6px; font-size: 24px; }
.card p { margin: 0 0 20px; color: var(--ink-soft); font-size: 15px; }

.hidden { display: none !important; }

/* Reusable board cells drawn by games use inline styles + these helpers */
.fadein { animation: fade .25s ease; }
