/* Ember — design system. Warm paper by day, charcoal by night. */

:root {
  --font-body: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs: 16px;

  --bg: #f6f1ea;
  --bg-2: #fffdf9;
  --bg-3: #ede6dc;
  --bg-4: #e4dccf;
  --text: #1d1a17;
  --text-2: #5b554d;
  --text-3: #8c857b;
  --line: #e3dbcf;
  --line-2: #cfc5b6;
  --ok: #2f8f5b;
  --ok-bg: #e2f3e8;
  --warn: #c98a12;
  --warn-bg: #fbefd2;
  --bad: #cf4444;
  --bad-bg: #fbe3e3;
  --info: #2b6fb5;
  --info-bg: #dfeaf7;
  --shadow-1: 0 1px 2px rgba(40, 30, 15, .06), 0 1px 1px rgba(40, 30, 15, .04);
  --shadow-2: 0 6px 20px -6px rgba(40, 30, 15, .18), 0 2px 6px -2px rgba(40, 30, 15, .08);
  --shadow-3: 0 24px 60px -20px rgba(40, 30, 15, .35);
  --radius: 14px;
  --radius-s: 9px;
  --radius-l: 22px;
  --sidebar: 244px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 180ms;
  --accent-h: 20; --accent-s: 88%; --accent-l: 48%;
}
:root[data-accent="moss"]  { --accent-h: 150; --accent-s: 42%; --accent-l: 38%; }
:root[data-accent="sea"]   { --accent-h: 208; --accent-s: 62%; --accent-l: 44%; }
:root[data-accent="plum"]  { --accent-h: 272; --accent-s: 45%; --accent-l: 50%; }
:root[data-accent="rose"]  { --accent-h: 340; --accent-s: 62%; --accent-l: 50%; }
:root[data-accent="ink"]   { --accent-h: 220; --accent-s: 18%; --accent-l: 32%; }
:root {
  --accent: hsl(var(--accent-h) var(--accent-s) var(--accent-l));
  --accent-2: hsl(var(--accent-h) var(--accent-s) calc(var(--accent-l) - 8%));
  --accent-soft: hsl(var(--accent-h) var(--accent-s) 94%);
  --accent-soft-2: hsl(var(--accent-h) var(--accent-s) 88%);
  --accent-text: hsl(var(--accent-h) var(--accent-s) 32%);
  --on-accent: #fff;
}
:root[data-theme="dark"] {
  --bg: #15130f;
  --bg-2: #1e1b16;
  --bg-3: #27231d;
  --bg-4: #332e26;
  --text: #f2ede5;
  --text-2: #b8b0a4;
  --text-3: #7f776c;
  --line: #2e2922;
  --line-2: #3f382f;
  --ok: #4fb87a;
  --ok-bg: #1b3326;
  --warn: #e0a83a;
  --warn-bg: #3a2e14;
  --bad: #e5605f;
  --bad-bg: #3d1e1e;
  --info: #5f9ee0;
  --info-bg: #1b2c40;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 8px 24px -8px rgba(0,0,0,.6);
  --shadow-3: 0 30px 70px -20px rgba(0,0,0,.8);
  --accent: hsl(var(--accent-h) var(--accent-s) calc(var(--accent-l) + 10%));
  --accent-2: hsl(var(--accent-h) var(--accent-s) calc(var(--accent-l) + 2%));
  --accent-soft: hsl(var(--accent-h) 30% 16%);
  --accent-soft-2: hsl(var(--accent-h) 35% 22%);
  --accent-text: hsl(var(--accent-h) 80% 72%);
}
:root[data-font="hyperlegible"] { --font-body: "Atkinson Hyperlegible", var(--font-body); --font-display: "Atkinson Hyperlegible", sans-serif; }
:root[data-font="lexend"] { --font-body: "Lexend", var(--font-body); --font-display: "Lexend", sans-serif; }
:root[data-motion="reduced"] * { animation-duration: 1ms !important; transition-duration: 1ms !important; }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) * { animation-duration: 1ms !important; transition-duration: 1ms !important; } }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); line-height: 1.5; font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 2.1rem; font-variation-settings: "opsz" 72, "SOFT" 30; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, .mono { font-family: var(--font-mono); font-size: .9em; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: var(--accent-soft-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 18px 14px; display: flex; flex-direction: column; gap: 6px;
  border-right: 1px solid var(--line); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .flame { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: linear-gradient(140deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: var(--shadow-1); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; transition: background var(--dur) var(--ease), color var(--dur); }
.nav a:hover { background: var(--bg-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav a .ico { width: 20px; text-align: center; font-size: 1.05rem; opacity: .9; }
.nav a .count { margin-left: auto; font-size: .75rem; padding: 1px 7px; border-radius: 99px; background: var(--accent); color: #fff; font-weight: 600; }
.sidebar .spacer { flex: 1; }
.sidebar .me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.sidebar .me:hover { background: var(--bg-3); }
.sidebar .me .av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-3); font-size: 1.2rem; }
.sidebar .me .nm { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.sidebar .me .sub { font-size: .75rem; color: var(--text-3); }
.sidebar .streak-pill { display: flex; align-items: center; gap: 8px; margin: 4px 4px 8px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(140deg, var(--accent-soft), var(--bg-2)); border: 1px solid var(--line); }
.sidebar .streak-pill b { font-family: var(--font-display); font-size: 1.3rem; }
.sidebar .streak-pill small { color: var(--text-2); font-size: .74rem; line-height: 1.15; }

main.content { padding: 28px 36px 80px; max-width: 1180px; width: 100%; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.topbar .search-btn { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text-3); cursor: text; text-align: left; box-shadow: var(--shadow-1); }
.topbar .search-btn:hover { border-color: var(--line-2); }
.topbar .search-btn .kbd-hint { margin-left: auto; }
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  main.content { padding: 18px 16px 90px; }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--bg-2); border-top: 1px solid var(--line); padding: 6px 4px env(safe-area-inset-bottom); }
  .mobile-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: .68rem; color: var(--text-3); border-radius: 8px; }
  .mobile-nav a .ico { font-size: 1.25rem; }
  .mobile-nav a.active { color: var(--accent-text); }
  h1 { font-size: 1.7rem; }
}

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid transparent; background: var(--bg-3); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform var(--dur) var(--ease), background var(--dur), box-shadow var(--dur), border-color var(--dur); line-height: 1.2; text-decoration: none;
}
.btn:hover { background: var(--bg-4); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 0 var(--accent-2), var(--shadow-1); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.ghost:hover { background: var(--bg-3); }
.btn.quiet { background: transparent; color: var(--text-2); }
.btn.quiet:hover { background: var(--bg-3); color: var(--text); }
.btn.soft { background: var(--accent-soft); color: var(--accent-text); }
.btn.soft:hover { background: var(--accent-soft-2); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.ok { background: var(--ok-bg); color: var(--ok); }
.btn.sm { padding: 6px 11px; font-size: .86rem; border-radius: 8px; }
.btn.lg { padding: 13px 22px; font-size: 1.05rem; border-radius: 12px; }
.btn.icon { padding: 8px; width: 36px; height: 36px; border-radius: 9px; }
.btn.icon.sm { width: 30px; height: 30px; padding: 4px; }
.btn.block { width: 100%; }
.btn .kbd { margin-left: 4px; opacity: .7; }

.input, textarea.input, select.input {
  width: 100%; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  transition: border-color var(--dur), box-shadow var(--dur); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.err { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span, .field-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; letter-spacing: .01em; }
.field .help { font-size: .78rem; color: var(--text-3); margin-top: 5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 760px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; } .grid.cols-3.tight, .grid.cols-4.tight { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-1); }
.card.pad-s { padding: 12px 14px; }
.card.hover { transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur); cursor: pointer; }
.card.hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.card.flat { box-shadow: none; }
.card.accent { background: linear-gradient(135deg, var(--accent-soft), var(--bg-2)); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: .86rem; }
.tiny { font-size: .76rem; }
.bold { font-weight: 600; }
.display { font-family: var(--font-display); }
.num { font-family: var(--font-display); font-weight: 600; font-size: 1.9rem; line-height: 1; letter-spacing: -.02em; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: var(--bg-3); font-size: .78rem; font-weight: 600; color: var(--text-2); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.btn-chip { cursor: pointer; border: 1px solid transparent; }
.chip.btn-chip:hover { border-color: var(--line-2); }
.chip.btn-chip.on { background: var(--accent); color: #fff; }
.kbd { display: inline-block; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--bg-2); font-family: var(--font-mono); font-size: .72rem; color: var(--text-2); line-height: 1.5; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.progress { height: 8px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 400ms var(--ease); }
.progress.ok > i { background: var(--ok); }
.progress.seg { display: flex; gap: 2px; }
.progress.seg > i { transition: width 400ms var(--ease); border-radius: 0; }
.progress.seg > i.mastered { background: var(--ok); }
.progress.seg > i.familiar { background: var(--warn); }
.progress.seg > i.learning { background: var(--bad); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.segmented { display: inline-flex; background: var(--bg-3); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: .86rem; color: var(--text-2); cursor: pointer; }
.segmented button.active { background: var(--bg-2); color: var(--text); box-shadow: var(--shadow-1); }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle .sw { width: 38px; height: 22px; border-radius: 99px; background: var(--bg-4); position: relative; transition: background var(--dur); }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform var(--dur) var(--ease); }
.toggle input:checked + .sw { background: var(--accent); }
.toggle input:checked + .sw::after { transform: translateX(16px); }
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .big { font-size: 2.6rem; margin-bottom: 8px; }
.empty h3 { color: var(--text); }
.skeleton { background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 50%, var(--bg-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; min-height: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--info-bg); color: var(--info); font-size: .9rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.tbl th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.menu { position: absolute; z-index: 40; min-width: 200px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; animation: pop var(--dur) var(--ease); }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text); font-weight: 500; }
.menu button:hover, .menu a:hover { background: var(--bg-3); text-decoration: none; }
.menu button.danger { color: var(--bad); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.rise { animation: rise 320ms var(--ease) both; }
.emoji-btn { width: 56px; height: 56px; font-size: 1.8rem; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-grid button { font-size: 1.3rem; padding: 6px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.emoji-grid button:hover { background: var(--bg-3); }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-2) inset; }

/* ---------- modal / toast / palette ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20, 15, 10, .45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fadein 150ms; }
.modal { width: 100%; max-width: 520px; background: var(--bg-2); border-radius: var(--radius-l); box-shadow: var(--shadow-3); padding: 24px 26px; animation: rise 220ms var(--ease); max-height: 92vh; overflow: auto; border: 1px solid var(--line); }
.modal.wide { max-width: 760px; }
.modal h2 { margin-bottom: 6px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-2); font-weight: 500; animation: rise 220ms var(--ease); max-width: 90vw; }
.toast button { border: 0; background: rgba(255,255,255,.14); color: inherit; padding: 5px 10px; border-radius: 7px; font-weight: 600; cursor: pointer; }
:root[data-theme="dark"] .toast { background: var(--bg-4); color: var(--text); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
.palette { width: 100%; max-width: 580px; background: var(--bg-2); border-radius: 16px; box-shadow: var(--shadow-3); overflow: hidden; align-self: start; margin-top: 10vh; border: 1px solid var(--line); animation: rise 180ms var(--ease); }
.palette input { width: 100%; border: 0; padding: 16px 18px; font-size: 1.05rem; background: transparent; outline: none; border-bottom: 1px solid var(--line); }
.palette .list { max-height: 50vh; overflow: auto; padding: 6px; }
.palette .group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 8px 12px 4px; }
.palette .item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.palette .item.sel { background: var(--accent-soft); }
.palette .item .ico { width: 24px; text-align: center; }
.palette .item .lbl { flex: 1; }
.palette .item .hint { font-size: .76rem; color: var(--text-3); }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; font-size: .9rem; }
.shortcuts div { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.shortcuts h4 { grid-column: 1 / -1; margin: 12px 0 4px; font-family: var(--font-body); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }

/* ---------- set cards ---------- */
.set-card { display: flex; flex-direction: column; gap: 8px; min-height: 140px; position: relative; }
.set-card .emo { font-size: 1.6rem; line-height: 1; }
.set-card .ttl { font-weight: 600; font-size: 1.02rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.set-card .meta { font-size: .78rem; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.set-card .owner { display: flex; align-items: center; gap: 6px; }
.set-card .progress { margin-top: 4px; }
.set-card .badge-due { position: absolute; top: 12px; right: 12px; }

/* ---------- hero (landing) ---------- */
.landing { max-width: 1100px; margin: 0 auto; padding: 24px; }
.landing .nav-l { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 40px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; padding: 30px 0 60px; }
.hero h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.02; font-variation-settings: "opsz" 144, "SOFT" 50; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p.lead { font-size: 1.15rem; color: var(--text-2); max-width: 520px; }
.hero-demo { position: relative; perspective: 1400px; }
.hero-demo .flashcard { height: 280px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 30px 0; }
.feature-grid .card h3 { margin-top: 8px; }
.feature-grid .card .ico { font-size: 1.6rem; }
.landing .fine { text-align: center; color: var(--text-3); padding: 40px 0 10px; font-size: .86rem; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; } .feature-grid { grid-template-columns: 1fr; } }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; padding-bottom: 20px; }

/* ---------- flashcard ---------- */
.flashcard { position: relative; width: 100%; height: 360px; perspective: 1400px; cursor: pointer; user-select: none; }
.flashcard .face { position: absolute; inset: 0; display: grid; place-items: center; padding: 28px 36px; text-align: center; border-radius: var(--radius-l); background: var(--bg-2); border: 1px solid var(--line); box-shadow: var(--shadow-2); backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 480ms var(--ease); font-size: clamp(1.1rem, 2.4vw, 1.7rem); line-height: 1.35; overflow: auto; }
.flashcard .face.back { transform: rotateY(180deg); background: var(--bg-2); }
.flashcard.flipped .face.front { transform: rotateY(180deg); }
.flashcard.flipped .face.back { transform: rotateY(360deg); }
.flashcard .face .lbl { position: absolute; top: 14px; left: 18px; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); font-weight: 600; }
.flashcard .face .tools { position: absolute; top: 10px; right: 12px; display: flex; gap: 4px; }
.flashcard .face .hint { position: absolute; bottom: 14px; left: 0; right: 0; font-size: .8rem; color: var(--text-3); }
.flashcard .face .txt { max-height: 100%; white-space: pre-wrap; }
.flashcard .face .txt.long { font-size: 1rem; text-align: left; }
.flashcard.know { animation: swipe-right 380ms var(--ease) both; }
.flashcard.learning { animation: swipe-left 380ms var(--ease) both; }
.flashcard.enter { animation: rise 260ms var(--ease) both; }
@keyframes swipe-right { to { transform: translateX(120%) rotate(8deg); opacity: 0; } }
@keyframes swipe-left { to { transform: translateX(-120%) rotate(-8deg); opacity: 0; } }
.study-wrap { max-width: 820px; margin: 0 auto; }
.study-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.study-top .ttl { flex: 1; min-width: 0; }
.study-top .ttl b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.study-top .ttl small { color: var(--text-3); }
.study-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 20px; }
.study-nav .counter { font-family: var(--font-display); font-size: 1.15rem; min-width: 80px; text-align: center; }
.sort-btns { display: flex; justify-content: center; gap: 12px; margin-top: 16px; }
.sort-btns .btn { min-width: 140px; }
.tally { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: 600; }
.tally .l { color: var(--warn); } .tally .k { color: var(--ok); }
.cloze-blank { display: inline-block; min-width: 3ch; padding: 0 6px; border-bottom: 2px solid var(--accent); color: var(--accent-text); font-weight: 600; }
.cloze-reveal { color: var(--accent-text); font-weight: 600; border-bottom: 2px solid var(--accent); }

/* ---------- learn / write / test ---------- */
.question { animation: rise 260ms var(--ease) both; }
.question .prompt { font-size: clamp(1.15rem, 2.2vw, 1.5rem); line-height: 1.4; margin: 6px 0 20px; white-space: pre-wrap; }
.question .qlabel { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); font-weight: 600; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices button { text-align: left; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; display: flex; gap: 12px; align-items: flex-start; transition: border-color var(--dur), background var(--dur), transform var(--dur); font-weight: 500; line-height: 1.35; white-space: pre-wrap; }
.choices button:hover { border-color: var(--accent); background: var(--accent-soft); }
.choices button .n { flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--bg-3); display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--text-2); }
.choices button.right { border-color: var(--ok); background: var(--ok-bg); }
.choices button.wrong { border-color: var(--bad); background: var(--bad-bg); animation: shake 300ms; }
.choices button.dim { opacity: .45; }
.choices button:disabled { cursor: default; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@media (max-width: 600px) { .choices { grid-template-columns: 1fr; } }
.answer-box { display: flex; gap: 8px; }
.answer-box .input { font-size: 1.05rem; padding: 12px 14px; }
.feedback { padding: 14px 16px; border-radius: 12px; margin-top: 14px; animation: rise 220ms var(--ease); }
.feedback.ok { background: var(--ok-bg); color: var(--ok); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }
.feedback .ans { color: var(--text); font-weight: 600; font-size: 1.05rem; margin-top: 4px; white-space: pre-wrap; }
.feedback .diff del { color: var(--bad); background: var(--bad-bg); text-decoration: line-through; }
.feedback .diff ins { color: var(--ok); background: var(--ok-bg); text-decoration: none; }
.round-bar { display: flex; gap: 4px; margin-bottom: 18px; }
.round-bar i { flex: 1; height: 6px; border-radius: 99px; background: var(--bg-3); }
.round-bar i.ok { background: var(--ok); } .round-bar i.bad { background: var(--bad); } .round-bar i.cur { background: var(--accent); }
.streak-badge { position: fixed; right: 24px; bottom: 90px; z-index: 20; padding: 8px 14px; border-radius: 99px; background: var(--accent); color: #fff; font-weight: 700; box-shadow: var(--shadow-2); animation: pop 220ms var(--ease); }
.result-hero { text-align: center; padding: 20px 0 10px; }
.result-hero .num { font-size: 4rem; }
.ring { width: 140px; height: 140px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--bg-3) 0); position: relative; }
.ring::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--bg-2); }
.ring b { position: relative; font-family: var(--font-display); font-size: 1.9rem; }
.term-list { display: flex; flex-direction: column; gap: 8px; }
.term-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 14px; padding: 12px 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; align-items: center; }
.term-row .f { font-weight: 600; white-space: pre-wrap; } .term-row .b { color: var(--text-2); white-space: pre-wrap; }
.term-row .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bg-4); }
.term-row .dot.m { background: var(--ok); } .term-row .dot.f { background: var(--warn); } .term-row .dot.l { background: var(--bad); }
@media (max-width: 600px) { .term-row { grid-template-columns: 1fr; gap: 4px; } }
.test-q { padding: 20px 22px; margin-bottom: 14px; }
.test-q .qn { font-size: .74rem; color: var(--text-3); font-weight: 600; margin-bottom: 6px; }
.tf-btns { display: flex; gap: 10px; }
.tf-btns button { flex: 1; padding: 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; font-weight: 600; }
.tf-btns button.on { border-color: var(--accent); background: var(--accent-soft); }
.tf-btns button.right { border-color: var(--ok); background: var(--ok-bg); }
.tf-btns button.wrong { border-color: var(--bad); background: var(--bad-bg); }
.match-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-pairs select { width: 100%; }

/* ---------- match game ---------- */
.match-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.match-tile { min-height: 110px; padding: 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; display: grid; place-items: center; text-align: center; font-weight: 500; font-size: .95rem; transition: transform var(--dur) var(--ease), background var(--dur), border-color var(--dur), opacity 300ms; line-height: 1.3; white-space: pre-wrap; overflow: hidden; }
.match-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.match-tile.sel { background: var(--accent-soft); border-color: var(--accent); transform: scale(.97); }
.match-tile.gone { opacity: 0; transform: scale(.6); pointer-events: none; }
.match-tile.wrong { animation: shake 300ms; border-color: var(--bad); background: var(--bad-bg); }
.match-tile.ok { border-color: var(--ok); background: var(--ok-bg); }
@media (max-width: 700px) { .match-grid { grid-template-columns: repeat(3, 1fr); } .match-tile { min-height: 90px; font-size: .85rem; } }
.timer-big { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.leaderboard li { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--line); }

/* ---------- review (SRS) ---------- */
.rate-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.rate-btns button { padding: 12px 8px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform var(--dur), background var(--dur); }
.rate-btns button:hover { transform: translateY(-2px); }
.rate-btns button b { font-weight: 700; }
.rate-btns button small { color: var(--text-3); font-family: var(--font-mono); font-size: .72rem; }
.rate-btns button.again:hover { background: var(--bad-bg); border-color: var(--bad); }
.rate-btns button.hard:hover { background: var(--warn-bg); border-color: var(--warn); }
.rate-btns button.good:hover { background: var(--ok-bg); border-color: var(--ok); }
.rate-btns button.easy:hover { background: var(--info-bg); border-color: var(--info); }
.review-counts { display: flex; gap: 12px; font-size: .82rem; font-weight: 600; }
.review-counts .n { color: var(--info); } .review-counts .l { color: var(--bad); } .review-counts .r { color: var(--ok); }

/* ---------- editor ---------- */
.editor-card { display: grid; grid-template-columns: 34px 1fr 1fr 40px; gap: 12px; align-items: start; padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; transition: box-shadow var(--dur), border-color var(--dur); }
.editor-card:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.editor-card.dragging { opacity: .5; }
.editor-card.drop-over { border-top: 2px solid var(--accent); }
.editor-card .idx { color: var(--text-3); font-weight: 600; font-size: .85rem; padding-top: 10px; cursor: grab; user-select: none; }
.editor-card textarea { min-height: 44px; border: 0; border-bottom: 2px solid var(--line); border-radius: 0; padding: 8px 2px; resize: none; background: transparent; overflow: hidden; line-height: 1.4; }
.editor-card textarea:focus { box-shadow: none; border-bottom-color: var(--accent); }
.editor-card .sub { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-top: 3px; }
.editor-card .rm { padding-top: 4px; }
@media (max-width: 640px) { .editor-card { grid-template-columns: 28px 1fr 32px; } .editor-card .col2 { grid-column: 2; } }
.editor-head { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 0 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.import-preview { max-height: 260px; overflow: auto; }

/* ---------- notes ---------- */
.notes-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; min-height: 70vh; }
.notes-list { display: flex; flex-direction: column; gap: 6px; }
.note-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.note-item:hover { background: var(--bg-3); }
.note-item.active { background: var(--accent-soft); border-color: var(--accent-soft-2); }
.note-item b { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item small { color: var(--text-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-editor textarea { width: 100%; min-height: 60vh; border: 0; background: transparent; resize: vertical; font-size: 1.02rem; line-height: 1.65; padding: 6px 0; outline: none; font-family: var(--font-body); }
.note-editor .title { width: 100%; border: 0; background: transparent; font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; padding: 4px 0; outline: none; }
.note-preview { line-height: 1.65; }
.note-preview h1, .note-preview h2, .note-preview h3 { margin-top: 1.2em; }
.note-preview .term { font-weight: 600; color: var(--accent-text); }
.note-preview .hide { background: var(--accent-soft); border-radius: 4px; padding: 0 4px; }
.note-preview blockquote { border-left: 3px solid var(--accent); margin: 0; padding: 4px 14px; color: var(--text-2); }
.note-preview code { background: var(--bg-3); padding: 1px 5px; border-radius: 4px; }
.note-preview pre { background: var(--bg-3); padding: 12px; border-radius: 10px; overflow: auto; }
.note-preview ul, .note-preview ol { padding-left: 1.4em; }
.note-preview mark { background: var(--warn-bg); }
@media (max-width: 800px) { .notes-layout { grid-template-columns: 1fr; } .notes-list { flex-direction: row; overflow-x: auto; } .note-item { min-width: 180px; } }

/* ---------- planner ---------- */
.exam-card { display: flex; gap: 16px; align-items: center; }
.exam-card .days { text-align: center; min-width: 74px; padding: 8px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.exam-card .days b { display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1; }
.exam-card .days small { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.exam-card.soon .days { background: var(--bad-bg); color: var(--bad); }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); }
.task input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.task.done .t { text-decoration: line-through; color: var(--text-3); }
.task .t { flex: 1; }
.task .due { font-size: .78rem; color: var(--text-3); }
.task .due.over { color: var(--bad); font-weight: 600; }
.plan-day { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.plan-day .d { font-weight: 600; font-size: .9rem; }
.plan-day .d small { display: block; color: var(--text-3); font-weight: 500; }
.plan-day.today .d { color: var(--accent-text); }

/* ---------- focus ---------- */
.focus-wrap { max-width: 640px; margin: 0 auto; text-align: center; }
.focus-ring { width: 300px; height: 300px; margin: 10px auto 20px; border-radius: 50%; display: grid; place-items: center; position: relative; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--bg-3) 0); transition: background 1s linear; }
.focus-ring::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--bg-2); box-shadow: var(--shadow-1) inset; }
.focus-ring .time { position: relative; font-family: var(--font-mono); font-size: 4rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.focus-ring .mode { position: relative; font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-3); font-weight: 600; }
.focus-wrap.break .focus-ring { background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--bg-3) 0); }
.focus-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.focus-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-4); }
.focus-dots i.on { background: var(--accent); }
.sound-row { display: grid; grid-template-columns: 90px 1fr 60px; align-items: center; gap: 10px; text-align: left; }
input[type=range] { accent-color: var(--accent); width: 100%; }

/* ---------- stats ---------- */
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; overflow-x: auto; padding-bottom: 6px; }
.heatmap i { width: 12px; height: 12px; border-radius: 3px; background: var(--bg-3); }
.heatmap i.l1 { background: hsl(var(--accent-h) var(--accent-s) 82%); }
.heatmap i.l2 { background: hsl(var(--accent-h) var(--accent-s) 66%); }
.heatmap i.l3 { background: hsl(var(--accent-h) var(--accent-s) 52%); }
.heatmap i.l4 { background: hsl(var(--accent-h) var(--accent-s) 38%); }
:root[data-theme="dark"] .heatmap i.l1 { background: hsl(var(--accent-h) 40% 28%); }
:root[data-theme="dark"] .heatmap i.l2 { background: hsl(var(--accent-h) 55% 40%); }
:root[data-theme="dark"] .heatmap i.l3 { background: hsl(var(--accent-h) 70% 52%); }
:root[data-theme="dark"] .heatmap i.l4 { background: hsl(var(--accent-h) 85% 64%); }
.heatmap i.frozen { background: var(--info); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.bars i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; transition: height 400ms var(--ease); }
.bars i.dim { background: var(--bg-4); }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-tiles .card { padding: 14px 16px; }
.stat-tiles .lbl { font-size: .76rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 700px) { .stat-tiles { grid-template-columns: 1fr 1fr; } }

/* ---------- confetti ---------- */
canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

/* ---------- print ---------- */
@media print {
  .sidebar, .mobile-nav, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  main.content { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .print-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
  .print-card { height: 3in; border: 1px dashed #999; padding: .3in; display: flex; flex-direction: column; justify-content: center; page-break-inside: avoid; }
  .print-card .f { font-weight: 700; font-size: 14pt; }
  .print-card .b { margin-top: 6pt; }
}
.print-cards { display: none; }
