/* Aata (ಆಟ): brain games for Raji, on a tablet.
   Layout: a calm home of large tiles (today's three first, then four groups); each game fills the
   screen under one big top bar. One light world on purpose: warm cream paper, deep teal for actions,
   marigold only for celebration. Baloo Tamma 2 covers Kannada and Latin in one friendly face.
   Senior-friendly: text 20px and up, touch targets 56px and up, no red "wrong" states, no timers. */

:root {
  --bg: #fbf6ee;          /* warm cream */
  --paper: #ffffff;
  --paper-2: #f6efe3;
  --ink: #23201c;
  --ink-2: #57504a;
  --ink-3: #8a8178;
  --line: #e7dccb;
  --line-2: #d6c8b2;
  --teal: #2c6e72;        /* actions */
  --teal-ink: #ffffff;
  --teal-soft: #e0eeee;
  --marigold: #e39b2d;    /* celebration only */
  --marigold-soft: #fcefd9;
  --good: #2e7a4e;
  --good-soft: #e2f1e7;
  --hint: #9a6408;        /* gentle "check this" colour, never red */
  --hint-soft: #fbefd7;
  --font: "Baloo Tamma 2", "Noto Sans Kannada", "Tunga", system-ui, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --tap: 56px;
  --shadow: 0 1px 2px rgba(35, 32, 28, .06), 0 10px 26px -14px rgba(35, 32, 28, .28);
  color-scheme: light;
}
html { font-size: 20px; -webkit-text-size-adjust: 100%; }
html[data-size="l"] { font-size: 23px; }
html[data-size="xl"] { font-size: 26px; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ── shell ─────────────────────────────────────────────────────────── */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem max(16px, env(safe-area-inset-right, 0px)) .6rem max(16px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 21; }
.topbar .title { flex: 1; min-width: 0; font-weight: 700; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { flex: 1; padding: 1.1rem max(16px, env(safe-area-inset-right, 0px)) 2.4rem max(16px, env(safe-area-inset-left, 0px)); max-width: 1100px; width: 100%; margin: 0 auto; }

/* ── buttons ───────────────────────────────────────────────────────── */
.btn {
  min-height: var(--tap); padding: 0 1.1rem; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 2px solid var(--line-2); background: var(--paper); color: var(--ink);
  font-weight: 600; font-size: 1rem; cursor: pointer; touch-action: manipulation;
  transition: transform .08s, background .12s, border-color .12s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); }
.btn.soft { background: var(--teal-soft); border-color: transparent; color: var(--teal); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.big { min-height: 64px; font-size: 1.15rem; padding: 0 1.4rem; }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn svg { width: 1.3em; height: 1.3em; flex: none; }
.icon-btn { width: var(--tap); padding: 0; }

.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--paper-2); border: 1px solid var(--line); }
.seg button { min-height: 48px; min-width: 48px; padding: 0 .9rem; border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }

/* ── home ──────────────────────────────────────────────────────────── */
.hello { margin: .4rem 0 1.2rem; }
.hello h1 { margin: 0; font-size: 2rem; line-height: 1.15; font-weight: 700; }
.hello p { margin: .2rem 0 0; color: var(--ink-2); font-size: 1.05rem; }
.section-title { margin: 1.6rem 0 .7rem; font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.section-title small { font-weight: 500; color: var(--ink-3); font-size: .85rem; }

.today { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .4rem;
  min-height: 150px; padding: 1rem 1.1rem; text-align: left;
  background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; touch-action: manipulation;
  transition: transform .1s, border-color .12s;
}
.tile:active { transform: scale(.98); }
.tile .ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); }
.tile .ico svg { width: 36px; height: 36px; }
.tile .name { font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.tile .blurb { color: var(--ink-2); font-size: .9rem; line-height: 1.35; }
.tile.today-tile { border-color: var(--teal); }
.tile .done {
  position: absolute; top: .7rem; right: .7rem; display: inline-flex; align-items: center; gap: .3rem;
  padding: .15rem .6rem; border-radius: 999px; background: var(--good-soft); color: var(--good); font-size: .8rem; font-weight: 600;
}
.cat-numbers .ico { color: #2c6e72; background: #e0eeee; }
.cat-words .ico { color: #7a4a8c; background: #f1e6f4; }
.cat-memory .ico { color: #a35a12; background: #fcebd6; }
.cat-classics .ico { color: #3e6a2e; background: #e6f0df; }

.settings { display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; align-items: center; margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--ink-2); }
.settings label { display: flex; align-items: center; gap: .6rem; font-weight: 600; }

/* ── game frame ────────────────────────────────────────────────────── */
.game { display: flex; flex-direction: column; gap: 1rem; }
.game-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.game-bar .spacer { flex: 1; }
.board-wrap { display: flex; justify-content: center; }
.note { color: var(--ink-2); font-size: .95rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .75rem; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); font-size: .85rem; font-weight: 600; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.hint { background: var(--hint-soft); color: var(--hint); }

/* ── sheets (help, celebrate, confirm) ─────────────────────────────── */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(35, 32, 28, .38); display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; }
.sheet {
  width: min(560px, 100%); max-height: 88vh; overflow: auto;
  background: var(--paper); border-radius: 22px; padding: 1.4rem 1.4rem 1.2rem; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4);
}
.sheet h2 { margin: 0 0 .5rem; font-size: 1.5rem; line-height: 1.2; }
.sheet p, .sheet li { color: var(--ink-2); font-size: 1.05rem; }
.sheet .actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: flex-end; margin-top: 1.2rem; }
.celebrate { text-align: center; }
.celebrate .burst { width: 96px; height: 96px; margin: .2rem auto .6rem; border-radius: 50%; display: grid; place-items: center; background: var(--marigold-soft); color: var(--marigold); }
.celebrate .burst svg { width: 56px; height: 56px; }
.celebrate .actions { justify-content: center; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { 0% { transform: scale(.6) } 70% { transform: scale(1.08) } 100% { transform: scale(1) } }
.celebrate .burst { animation: pop .35s ease-out; }

@media (max-width: 760px) {
  .today { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 130px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
