@import url("design/tokens.css");
* { box-sizing: border-box; }
html { background: var(--ink); background-attachment: fixed; }
body { background-color: transparent; }
html, body { margin: 0; color: var(--text); font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: default; }
#app { max-width: 440px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); min-height: 100dvh; display: flex; flex-direction: column; }
.screen { animation: fade var(--med) ease-out; flex: 1; display: flex; flex-direction: column; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1, h2, .display { font-family: var(--display); letter-spacing: 0.04em; font-weight: 400; margin: 0; line-height: 1; }
h1 { font-size: 40px; } h2 { font-size: 26px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .accent { color: var(--accent); } .gold { color: var(--gold); }
.row { display: flex; align-items: center; gap: 12px; } .between { justify-content: space-between; } .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; clip-path: var(--skew); }
.panel.primary { background: linear-gradient(160deg, var(--panel-2), var(--panel)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent), 0 12px 40px -20px var(--accent); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 0 20px; border-radius: var(--radius); font-family: var(--display); font-size: 24px; letter-spacing: 0.06em; background: var(--panel-2); border: 1px solid var(--line); transition: transform var(--fast), background var(--fast), border-color var(--fast); clip-path: var(--skew); }
.btn:active { transform: scale(0.98); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 44px; font-size: 18px; padding: 0 14px; }
.btn.locked { opacity: 0.5; }
.btn:focus-visible, .choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* bars */
.bar { height: 10px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 600ms cubic-bezier(.2,.8,.2,1); }
.bar.gold > i { background: var(--gold); }
.mastery { display: grid; grid-template-columns: 96px 1fr 88px; align-items: center; gap: 10px; font-family: var(--display); font-size: 18px; letter-spacing: 0.05em; }
.mastery .name { text-align: right; color: var(--muted); font-size: 15px; }

/* rank badge */
.rank { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 20px; letter-spacing: 0.08em; }
.rank b { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 2px solid var(--rank-color, var(--muted)); color: var(--rank-color, var(--muted)); font-size: 22px; clip-path: var(--skew); }
.flame { font-family: var(--display); font-size: 22px; letter-spacing: 0.05em; }

/* PIN */
.pin { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin button { min-height: 64px; font-family: var(--display); font-size: 30px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.dots { display: flex; gap: 12px; justify-content: center; margin: 12px 0 20px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
.dots i.on { background: var(--accent); border-color: var(--accent); }

/* session */
.progress { display: flex; gap: 3px; height: 6px; margin-bottom: 14px; }
.progress i { flex: 1; background: var(--line); border-radius: 2px; }
.progress i.done { background: var(--accent); } .progress i.wrong { background: var(--danger); } .progress i.cur { background: var(--text); }
.combo { font-family: var(--display); font-size: 20px; color: var(--gold); letter-spacing: 0.06em; min-width: 60px; text-align: right; }
.combo.hot { text-shadow: 0 0 12px var(--gold); }
.card { min-height: 220px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 10px; padding: 24px 16px; }
.bigword { font-family: var(--display); font-size: 56px; letter-spacing: 0.03em; word-break: break-word; line-height: 1; }
.stem { font-family: var(--display); font-size: 36px; letter-spacing: 0.04em; line-height: 1.05; text-align: center; margin: 8px 0 14px; }
.stem.long { font-size: 26px; }
.stem.prose { font-family: var(--body); font-size: 20px; letter-spacing: 0; line-height: 1.45; font-weight: 600; text-align: left; }
.tag { display: inline-block; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); padding: 3px 8px; border-radius: 3px; }
.tag.new { color: var(--accent); border-color: var(--accent); }
.def { font-size: 18px; line-height: 1.45; }
.sentence { color: var(--muted); font-style: italic; line-height: 1.45; }
.ratings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.ratings button { min-height: 60px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); font-family: var(--display); font-size: 20px; letter-spacing: 0.06em; display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; }
.ratings small { font-family: var(--body); font-size: 11px; color: var(--muted); letter-spacing: 0; }
.ratings .again { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); } .ratings .easy { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 10px 14px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 17px; line-height: 1.3; transition: border-color var(--fast), background var(--fast), transform var(--fast); }
.choice b { font-family: var(--display); font-size: 22px; color: var(--muted); width: 22px; }
.choice:not(:disabled):active { transform: scale(0.99); }
.choice.right { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.choice.right b { color: var(--accent); }
.choice.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, var(--panel)); animation: shake 300ms; }
.choice.dim { opacity: 0.45; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.hint { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 15px; line-height: 1.4; color: var(--muted); animation: rise var(--med) ease-out; }
.hint b { color: var(--accent-2); }
.hintbtn { align-self: center; }
.explain { font-size: 16px; line-height: 1.45; }
.unreviewed { color: var(--gold); margin-left: 6px; font-size: 20px; line-height: 0; vertical-align: middle; }
.feedback { margin-top: 12px; animation: rise var(--med) ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.verdict { font-family: var(--display); font-size: 30px; letter-spacing: 0.08em; }
.verdict.ok { color: var(--accent); } .verdict.no { color: var(--danger); }
.slash { position: fixed; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 40%, color-mix(in srgb, var(--accent) 35%, transparent) 50%, transparent 60%); transform: translateX(-100%); }
.slash.go { animation: slash 380ms ease-out; }
@keyframes slash { to { transform: translateX(100%); } }
.xp-pop { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); font-family: var(--display); font-size: 34px; color: var(--gold); pointer-events: none; animation: pop 700ms ease-out forwards; text-shadow: 0 0 14px var(--gold); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 30% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } to { opacity: 0; transform: translate(-50%, -30px) scale(1); } }

/* results */
.bignum { font-family: var(--display); font-size: 72px; line-height: 1; }
.stat { text-align: center; } .stat .display { font-size: 34px; } .stat .muted { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.remember li { padding: 10px 0; border-top: 1px solid var(--line); }
.remember li b { font-family: var(--display); font-size: 22px; letter-spacing: 0.04em; margin-right: 8px; }
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--ink) 85%, transparent); z-index: 10; animation: flash 500ms; text-align: center; padding: 24px; }
@keyframes flash { 0% { background: var(--accent); } 100% { background: color-mix(in srgb, var(--ink) 85%, transparent); } }
.overlay h1 { font-size: 64px; }

/* history */
.calendar { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.calendar i { aspect-ratio: 1; border-radius: 2px; background: var(--line); } .calendar i.on { background: var(--accent); } .calendar i.today { outline: 1px solid var(--text); }
.list li { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.seg { display: flex; gap: 6px; } .seg button { flex: 1; min-height: 48px; border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--display); font-size: 18px; letter-spacing: .06em; }
.seg button.on { border-color: var(--accent); color: var(--accent); }
.swatches { display: flex; gap: 10px; } .swatches button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; } .swatches button.on { border-color: var(--text); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: var(--radius); font-size: 14px; z-index: 20; }
.spacer { flex: 1; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--line); font-size: 18px; }
