/* Tokens match the iOS app (Dotchi/DesignSystem/Theme.swift). Score colours never change with
   the theme, and chips always use dark ink: white on lime or sand is unreadable. */
:root {
  --canvas: #F7F6F3; --surface: #FFFFFF; --surface2: #EFEDE8; --line: #E4E1DA;
  --ink: #14120F; --ink2: #5E5A53;
  --accent: #5B3DF5; --accent-text: #5B3DF5; --accent-soft: #ECE8FF;
  --great: #13BB77; --good: #C2E64E; --meh: #D8CABF; --bad: #FC4F22; --chip-ink: #14120F;
  --radius: 20px; --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", -apple-system, "Hiragino Maru Gothic ProN", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0C0B10; --surface: #17151F; --surface2: #211F2B; --line: #2A2833;
    --ink: #F6F4EF; --ink2: #A9A4AE;
    --accent: #7253FF; --accent-text: #A99BFF; --accent-soft: #25214A;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.6rem; line-height: 1.3; margin: 0 0 12px; }
h2 { font-size: 0.9rem; color: var(--ink2); margin: 24px 0 8px; font-weight: 700; }
.page { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }

/* Bottom tab bar */
.tabbar { position: fixed; inset: auto 0 0 0; display: flex; justify-content: space-around; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; min-height: 44px; font-size: 0.7rem; color: var(--ink2); }
.tabbar a[aria-current] { color: var(--accent-text); }
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }

/* Building blocks */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.list { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; }
.list > * + * { border-top: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta, .hint { font-size: 0.8rem; color: var(--ink2); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.credit { font-size: 0.7rem; color: var(--ink2); text-align: center; margin: 16px 0 0; }
.credit a { text-decoration: underline; }
.empty { text-align: center; padding: 48px 16px; color: var(--ink2); }
.empty h1 { color: var(--ink); }

.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; height: 32px; padding: 0 10px; border-radius: 10px; font: 800 1rem/1 var(--font-num); font-variant-numeric: tabular-nums; color: var(--chip-ink); box-shadow: inset 0 0 0 1px rgb(20 18 15 / 0.14); flex-shrink: 0; }
.chip.big { min-width: 140px; height: 110px; border-radius: 34px; font-size: 3.4rem; }
.s-great { background: var(--great); } .s-good { background: var(--good); } .s-meh { background: var(--meh); } .s-bad { background: var(--bad); }

.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 800; flex-shrink: 0; }
.avatar.big { width: 72px; height: 72px; font-size: 1.8rem; }
.kanji { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); font-weight: 900; font-size: 1.2rem; flex-shrink: 0; }

.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: 700 1rem var(--font); cursor: pointer; }
.btn-secondary { background: transparent; color: var(--accent-text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn-line { background: #06C755; }
.btn[disabled] { opacity: 0.4; }
.btn-text { background: none; border: 0; color: var(--accent-text); font: 600 0.95rem var(--font); min-height: 44px; cursor: pointer; }

input, select, textarea { width: 100%; min-height: 48px; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 1rem var(--font); }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; }
label.check { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; }
label.check input { width: 22px; min-height: 22px; accent-color: var(--accent); }
.errors { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); border-radius: var(--radius-sm); padding: 12px 16px 12px 32px; margin: 0 0 12px; font-size: 0.9rem; }

.hero { padding-top: 12vh; display: flex; flex-direction: column; gap: 16px; }
.wordmark { font: 900 2.8rem/1 var(--font-num); color: var(--accent-text); margin: 0; }
.big-number { font: 900 4rem/1 var(--font-num); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: no-preference) {
  .pop { animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
  @keyframes pop { from { transform: scale(0.6); opacity: 0; } }
}
