:root {
  --bg: #0a0e16; --card: #131a26; --card2: #1b2433; --line: #2c3a50;
  --text: #f0e6d2; --muted: #9aa6b8; --gold: #c89b3c; --gold2: #f0d38a;
  --good: #3fbf7f; --bad: #e0504d;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); overscroll-behavior-y: contain; }
main { max-width: 600px; margin: 0 auto; padding: 16px 16px 40px; }
h1 { font-size: 28px; line-height: 1.15; margin: 6px 0 4px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 14px; }
.btn { appearance: none; border: 2px solid var(--line); background: var(--card2); color: var(--text);
  border-radius: 14px; padding: 12px 16px; font: 600 18px system-ui, sans-serif; min-height: 54px; cursor: pointer; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #10141c; }
.btn.big { width: 100%; min-height: 64px; font-size: 21px; }
.btn.ghost { background: transparent; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-height: 48px; }
.topbar .title { flex: 1; font-weight: 700; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { min-height: 44px; min-width: 44px; padding: 6px 12px; font-size: 20px; }
.patch { display: inline-block; border: 1px solid var(--line); color: var(--gold2); border-radius: 99px;
  font-size: 13px; padding: 2px 10px; letter-spacing: .04em; }

/* home */
.tile { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; background: var(--card);
  border: 2px solid var(--line); border-radius: 18px; padding: 16px; margin: 12px 0; color: var(--text); font: inherit; cursor: pointer; }
.tile:active { border-color: var(--gold); }
.tile img { width: 56px; height: 56px; border-radius: 12px; flex: none; background: var(--card2); }
.tile .t { font-size: 22px; font-weight: 700; }
.tile .m { color: var(--muted); font-size: 15px; }
.tile .due { color: var(--gold2); font-weight: 700; }
.statline { margin-top: 18px; }

/* deck */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.chip { border: 1.5px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px;
  padding: 8px 13px; font: 500 15px system-ui, sans-serif; cursor: pointer; min-height: 40px; }
.chip.on { background: var(--gold); border-color: var(--gold); color: #10141c; font-weight: 700; }
.chip .n { opacity: .7; font-size: 12px; margin-left: 4px; }

/* card */
.progress { color: var(--muted); font-size: 15px; white-space: nowrap; }
.fc { background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 20px 18px; min-height: 52vh;
  display: flex; flex-direction: column; cursor: pointer; user-select: none; }
.fc .head { display: flex; gap: 14px; align-items: center; }
.fc .head img { width: 64px; height: 64px; border-radius: 12px; flex: none; background: var(--card2); border: 1px solid var(--line); }
.fc .ctitle { font-size: 22px; font-weight: 700; line-height: 1.2; }
.fc .csub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.fc .group { color: var(--gold2); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.fc .hint { margin: auto 0 0; padding-top: 24px; text-align: center; color: var(--muted); }
.fc.flipped { border-color: var(--gold); }
.field { margin-top: 16px; }
.field .l { color: var(--gold2); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.field .x { font-size: 18px; margin-top: 3px; }
.answer { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.answer .btn { min-height: 68px; font-size: 20px; }
.btn.no { background: #3a1716; border-color: var(--bad); color: #ffd6d4; }
.btn.yes { background: #123423; border-color: var(--good); color: #d3ffe6; }
.empty { text-align: center; padding: 40px 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--card2);
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 15px; z-index: 9; }
