/*
 * theme.css — Quest Coin design system. Bold-geometric poster: flat colour
 * blocks, thick black ink outlines, hard offset "stamp" shadows, zero
 * corners. Opens light; a dark ink board is the alternate mode.
 */

:root {
  --canvas: #fff4de;
  --surface: #fffaf0;
  --surface-2: #ffe6ae;
  --border: #14110f;
  --border-strong: #14110f;
  --ink: #14110f;
  --muted: #69635a;
  --accent: #ff5a36;
  --accent-hover: #e6491f;
  --accent-ink: #14110f;
  --accent-text: #285ec9;
  --accent-strong: #a83b24;
  --accent-soft: #ffe0d1;
  --accent-border: #a83b24;
  --success: #1f8a4c;
  --success-ink: #fffaf0;
  --success-soft: #d9f0e0;
  --success-strong: #146536;
  --warning: #d98c00;
  --warning-ink: #14110f;
  --warning-soft: #ffedc7;
  --warning-strong: #935f00;
  --danger: #d1263b;
  --danger-ink: #fffaf0;
  --danger-soft: #fbdadd;
  --danger-strong: #9c1626;
  --chart-1: #ff5a36;
  --chart-2: #285ec9;
  --chart-3: #ffb703;
  --chart-4: #1f8a4c;
  --chart-5: #a83b24;
  --chart-6: #6b4e9c;

  --font-display: "Baloo 2", ui-rounded, system-ui, sans-serif;
  --font-body: "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Nunito Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-weight: 800;
  --display-tracking: -0.01em;
  --eyebrow-tracking: 0.08em;

  --radius-btn: 0px;
  --radius-card: 0px;
  --radius-input: 0px;
  --border-w: 3px;
  --border-strong-w: 4px;
  --shadow-card: 6px 6px 0 0 var(--ink);
  --shadow-raised: 9px 9px 0 0 var(--ink);
  --shadow-btn: 4px 4px 0 0 var(--ink);
  --card-pad: 1.5rem;
  --caps: uppercase;
  --caps-tracking: 0.02em;
  --btn-weight: 800;
  --measure: 62ch;
}

html[data-theme="dark"] {
  --canvas: #1a1410;
  --surface: #241b14;
  --surface-2: #322418;
  --border: #fff4de;
  --border-strong: #fff4de;
  --ink: #fff4de;
  --muted: #cabba3;
  --accent: #ff6a42;
  --accent-hover: #ff8259;
  --accent-ink: #1a1410;
  --accent-text: #8fb0ff;
  --accent-strong: #ff9d78;
  --accent-soft: #402417;
  --accent-border: #ff9d78;
  --success: #35b571;
  --success-ink: #0d1f14;
  --success-soft: #17301f;
  --success-strong: #7fdca6;
  --warning: #f0a726;
  --warning-ink: #1a1410;
  --warning-soft: #3a2c10;
  --warning-strong: #f4c363;
  --danger: #ff5468;
  --danger-ink: #1a1410;
  --danger-soft: #3a161c;
  --danger-strong: #ff97a3;
  --chart-1: #ff6a42;
  --chart-2: #8fb0ff;
  --chart-3: #ffce54;
  --chart-4: #35b571;
  --chart-5: #ff9d78;
  --chart-6: #a993e0;
}

/*
 * app.css — Quest Coin's own screen furniture: the tab bar, the quest
 * cards, the streak tiles, the reward vault band and the point stepper.
 * Tokens only; the palette and the shape values live in theme.css.
 */

/* ---- Nav: bottom tabs on a phone, a slim top strip from md up ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.25rem;
  background: var(--surface);
  border-top: var(--border-strong-w) solid var(--ink);
  padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
}
.tabbar-brand { display: none; }
.tabbar-tabs { display: flex; flex: 1; align-items: center; justify-content: space-around; gap: 0.25rem; }
.tabbar-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
}
.tabbar-tab:hover { color: var(--ink); text-decoration: none; }
.tabbar-tab.is-active { color: var(--accent-strong); }
.tabbar-tab .icon { width: 1.25rem; height: 1.25rem; }
.tabbar-toggle { position: fixed; top: 0.75rem; right: 0.75rem; z-index: 31; background: var(--surface); border: var(--border-w) solid var(--ink); }

@media (min-width: 768px) {
  .tabbar {
    position: sticky;
    top: 0;
    bottom: auto;
    justify-content: flex-start;
    gap: 2rem;
    padding: 0.85rem 2rem;
    border-top: 0;
    border-bottom: var(--border-strong-w) solid var(--ink);
  }
  .tabbar-brand { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; color: var(--ink); }
  .tabbar-brand:hover { text-decoration: none; }
  .tabbar-tabs { flex: 0 0 auto; justify-content: flex-start; gap: 1.75rem; margin-left: 1rem; }
  .tabbar-tab { flex-direction: row; font-size: 0.8125rem; padding: 0; }
  .tabbar-toggle { position: static; margin-left: auto; border: none; }
}

body { padding-bottom: 4.75rem; }
@media (min-width: 768px) { body { padding-bottom: 0; } }

/* ---- Quest cards --------------------------------------------------------- */
.quest-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: var(--border-strong-w) solid var(--ink);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
}
.quest-card-points { font-family: var(--font-display); font-weight: 800; font-size: 1.75rem; color: var(--accent-strong); line-height: 1; }
.quest-card-name { margin-top: 0.5rem; font-weight: 800; font-size: 1.0625rem; line-height: 1.25; }
.quest-card.is-done { background: var(--accent-soft); }
.quest-card-done {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--accent-strong);
}
.quest-card-bonus { border-style: dashed; }
.quest-card-stamp {
  position: absolute;
  top: -0.75rem;
  right: 1rem;
  transform: rotate(4deg);
  background: var(--accent-strong);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border: var(--border-w) solid var(--ink);
}

/* ---- Streak strip --------------------------------------------------------- */
.day-tile {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--surface);
  border: var(--border-strong-w) solid var(--ink);
  font-weight: 800;
}
.day-tile-label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.day-tile-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--border); }
.day-tile.is-complete { background: var(--accent); color: var(--accent-ink); }
.day-tile.is-complete .day-tile-label { color: var(--accent-ink); opacity: 0.85; }
.day-tile.is-today:not(.is-complete) { border-style: dashed; }
.day-tile-future { background: transparent; border-style: dashed; border-color: var(--border-strong); }
.day-tile-callout {
  font-size: 0.5625rem;
  text-align: center;
  line-height: 1.15;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.day-tile-next { color: var(--muted); }

/* ---- Rules ledger ---------------------------------------------------------- */
.rules-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: var(--border-w) solid var(--border);
}
.rules-row:last-child { border-bottom: 0; }
.rules-num { font-family: var(--font-mono); font-weight: 700; color: var(--muted); font-size: 0.875rem; width: 1.75rem; flex-shrink: 0; }
.rules-name { flex: 1; font-weight: 700; }
.rules-tag {
  margin-left: 0.5rem;
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  padding: 0.05rem 0.4rem;
  vertical-align: middle;
}
.rules-points { font-family: var(--font-display); font-weight: 800; color: var(--accent-strong); flex-shrink: 0; }
.rules-row-bonus { background: var(--surface-2); }

/* ---- Reward vault ----------------------------------------------------------- */
.vault-band { background: var(--ink); }
html[data-theme="dark"] .vault-band { background: var(--surface-2); }
/* The band's own text stays readable in both modes: cream-on-black in
   light mode (a true dark band), ink-on-brown once the whole page is
   already dark. Kept as a class, not a utility, because it has to flip
   independently of the page-level --ink/--canvas swap. */
.vault-band-text { color: var(--canvas); }
html[data-theme="dark"] .vault-band-text { color: var(--ink); }
.vault-band-text-muted { color: var(--canvas); opacity: 0.75; }
html[data-theme="dark"] .vault-band-text-muted { color: var(--ink); opacity: 0.65; }
.vault-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: var(--border-strong-w) solid var(--ink);
  min-height: 9rem;
}
.vault-tile-top { display: flex; align-items: center; justify-content: space-between; }
/* The tile's own flat colour cycles through the chart palette and cannot
   guarantee contrast for text sitting directly on it, so the cost and the
   name sit on a small ink-on-surface plate instead — always readable,
   whatever the tile colour or the mode. */
.vault-tile-cost {
  display: inline-block;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--ink);
  padding: 0.1rem 0.5rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8125rem;
}
.vault-tile-name {
  display: inline-block;
  margin-top: 0.5rem;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--ink);
  padding: 0.25rem 0.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.25;
}
.vault-tile-sm { grid-column: span 1; }
.vault-tile-md { grid-column: span 1; min-height: 10.5rem; }
.vault-tile-lg { grid-column: span 2; min-height: 11rem; }
@media (min-width: 640px) { .vault-tile-lg { grid-column: span 1; } }
.vault-tile-xl { grid-column: span 2; min-height: 14rem; }
@media (min-width: 640px) { .vault-tile-xl { grid-column: span 4; } }
.vault-tile-xl .vault-tile-name { font-size: 1.5rem; }
.coin-trail { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.75rem; }
.coin-filled { color: var(--accent-strong); }
.coin-empty { color: color-mix(in srgb, var(--ink) 30%, transparent); }

/* ---- Parent zone: quiet on purpose, no coral or stamps ---------------------- */
.stepper { display: flex; align-items: stretch; gap: 0.5rem; }
.stepper-input { text-align: center; flex: 1 1 auto; }

/* ---- Count-up motion --------------------------------------------------------
   The only thing on this page that moves. Numbers rest at their real value
   in markup (never opacity:0) and app.js animates the digits up to it. */
[data-count-to] { font-variant-numeric: tabular-nums; }
