/* SectorZero Cards. The SectorZero look: near-black panels, hairline borders, Inter, a rose accent
   used sparingly; the study screen is quiet and centred so the card is the only thing that matters. */
:root {
  --bg: #0b0c10; --bg2: #101218; --card: #111318; --soft: #181b22; --fg: #eceef2; --mut: #8d94a1;
  --line: #22252e; --line2: #2e323d; --acc: #f43f5e; --acc2: #ec4899; --acc-soft: rgba(244, 63, 94, 0.12); --acc-ink: #fda4af;
  --good: #4ade80; --bad: #fb7185; --warn: #fbbf24; --blue: #60a5fa; --c-new: #60a5fa; --c-learn: #f59e0b; --c-due: #4ade80;
  --r: 16px; --rs: 10px; --nav: 62px; --sz-ink: #eceef2; color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root:not([data-theme='dark']) { --bg: #f6f7f9; --bg2: #eef0f3; --card: #fff; --soft: #f2f3f6; --fg: #0f1115; --mut: #5f6672; --line: #e4e6eb; --line2: #d4d8df; --acc: #e11d48; --acc2: #db2777; --acc-soft: rgba(225, 29, 72, 0.08); --acc-ink: #be123c; --good: #15803d; --bad: #dc2626; --warn: #b45309; --c-new: #2563eb; --c-learn: #c2410c; --c-due: #15803d; --sz-ink: #0f1115; color-scheme: light; } }
:root[data-theme='light'] { --bg: #f6f7f9; --bg2: #eef0f3; --card: #fff; --soft: #f2f3f6; --fg: #0f1115; --mut: #5f6672; --line: #e4e6eb; --line2: #d4d8df; --acc: #e11d48; --acc2: #db2777; --acc-soft: rgba(225, 29, 72, 0.08); --acc-ink: #be123c; --good: #15803d; --bad: #dc2626; --warn: #b45309; --c-new: #2563eb; --c-learn: #c2410c; --c-due: #15803d; --sz-ink: #0f1115; color-scheme: light; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg) !important; color: var(--fg); font: 400 15px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; font-feature-settings: 'cv11', 'ss01'; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 24px; }
h2 { font-size: 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
h3 { font-size: 13px; color: var(--mut); margin: 4px 0 10px; }
p { margin: 0 0 8px; }
a { color: var(--acc-ink); }
code, kbd, .mono { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; }
code { font-size: 0.88em; background: var(--soft); padding: 1px 5px; border-radius: 5px; }
kbd { font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line2); background: var(--soft); color: var(--mut); font-weight: 500; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 0 12px; height: 42px; border: 1px solid var(--line2); border-radius: var(--rs); background: var(--bg); outline: none; transition: border-color 0.12s; }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input[type='checkbox'], input[type='range'] { width: auto; height: auto; accent-color: var(--acc); }
input[type='range'] { width: 100%; padding: 0; border: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--acc); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.ico { flex: none; display: block; }
.muted { color: var(--mut); }
.small { font-size: 13px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.center { text-align: center; margin: 16px auto; }
.grow { flex: 1; }
.pad { padding: 16px; }
.row-gap { display: flex; align-items: center; gap: 8px; }
.row-gap.wrap { flex-wrap: wrap; margin: 8px 0 12px; }
.splash { min-height: 100vh; display: grid; place-items: center; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 15px; border: 1px solid var(--line2); border-radius: var(--rs); background: var(--soft); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--fg); white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
.btn:hover { border-color: var(--mut); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(90deg, var(--acc), var(--acc2)); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.primary kbd { background: rgba(255, 255, 255, 0.18); border-color: transparent; color: #fff; }
.btn.small { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.xl { height: 50px; font-size: 15px; padding: 0 22px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--bad); background: transparent; }
.btn.danger:not(.ghost):not(:disabled) { background: var(--bad); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.link { background: none; border: 0; color: var(--acc-ink); cursor: pointer; padding: 4px 0; font-size: 13px; font-weight: 500; }
.icon { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--soft); cursor: pointer; display: inline-grid; place-items: center; flex: none; color: var(--fg); text-decoration: none; }
.icon.ghost { border-color: transparent; background: transparent; color: var(--mut); }
.icon.ghost:hover { background: var(--soft); color: var(--fg); }
.icon:disabled { opacity: 0.3; cursor: default; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; }
.pill .ico { color: #fb923c; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--soft); color: var(--mut); }
.tag.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* layout */
.app { min-height: 100vh; }
main { max-width: 860px; margin: 0 auto; padding: 0 16px calc(var(--nav) + 28px + env(safe-area-inset-bottom)); }
.app.full main { max-width: none; padding: 0 0 var(--nav); }
.page { padding-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.page.wide { max-width: 1240px; }
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ph p { margin: 2px 0 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.fld { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.fld > span { font-weight: 500; font-size: 13px; color: var(--mut); }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.actions.sticky { position: sticky; bottom: calc(var(--nav) + 10px); background: var(--bg); padding: 10px 0; }
.empty { text-align: center; padding: 28px 12px; }
.empty b { display: block; font-size: 15px; margin-bottom: 4px; }
.empty p { color: var(--mut); max-width: 360px; margin: 0 auto 12px; font-size: 14px; }

/* nav */
.nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--nav) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(16px); border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-around; }
.nav a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--mut); font-size: 11px; padding: 6px 4px; border-radius: 10px; min-width: 56px; }
.nav a b { font-weight: 500; }
.nav a.on { color: var(--fg); }
.nav a.on .ico { color: var(--acc); }
.nav a.add .ico { background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; border-radius: 9px; padding: 3px; width: 30px; height: 30px; }
.nav a em { position: absolute; top: 2px; left: calc(50% + 6px); font-style: normal; font-size: 10px; font-weight: 700; background: var(--acc); color: #fff; border-radius: 99px; padding: 0 5px; min-width: 18px; text-align: center; }
.brand, .side-only { display: none !important; }
.m-settings { position: fixed; top: 12px; right: 12px; z-index: 15; }
@media (min-width: 960px) {
  .nav { top: 0; right: auto; width: 224px; height: 100vh; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; padding: 18px 12px; border-top: 0; border-right: 1px solid var(--line); background: var(--bg); }
  .nav a { flex-direction: row; gap: 12px; font-size: 14px; padding: 9px 12px; }
  .nav a:hover { background: var(--soft); color: var(--fg); }
  .nav a.on { background: var(--soft); }
  .nav a.add .ico { width: 22px; height: 22px; padding: 2px; border-radius: 6px; }
  .nav a em { position: static; margin-left: auto; }
  .brand { display: flex !important; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--fg) !important; padding: 2px 12px 18px !important; }
  .brand span { color: var(--mut); font-weight: 500; }
  .side-only { display: flex !important; }
  .sync { margin-top: auto; align-items: center; font-size: 12px !important; }
  .sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
  .sync.ok i { background: var(--good); }
  .sync.bad i { background: var(--bad); }
  main { margin-left: 224px; margin-right: 0; max-width: none; padding: 0 32px 48px; }
  main > .page { max-width: 860px; margin: 0 auto; }
  main > .page.wide { max-width: 1240px; }
  .app.full main { padding: 0; }
  .m-settings { display: none; }
}

/* decks */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px; border-radius: var(--r); border: 1px solid var(--line); background: radial-gradient(700px 220px at 0 0, var(--acc-soft), transparent 70%), var(--card); }
.big { font-size: 40px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.big small { font-size: 16px; color: var(--mut); font-weight: 500; letter-spacing: 0; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mut); margin-top: 6px; }
.cnt { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 44px; text-align: right; font-size: 14px; }
.legend .cnt { min-width: 0; margin-left: 6px; }
.cnt.new { color: var(--c-new); } .cnt.learn { color: var(--c-learn); } .cnt.due { color: var(--c-due); }
.decks { padding: 6px; }
.deck { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px calc(6px + var(--depth, 0) * 20px); border-radius: 10px; min-height: 46px; }
.deck:not(.head):hover { background: var(--soft); }
.deck.head { min-height: 32px; font-size: 12px; color: var(--mut); border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 4px; }
.deck.head .cnt { font-weight: 500; font-size: 12px; }
.deck.done .cnt { color: var(--line2); }
.deck-name { flex: 1; min-width: 0; text-align: left; background: none; border: 0; cursor: pointer; font-size: 15px; font-weight: 500; padding: 8px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck.head .deck-name { cursor: default; font-size: 12px; font-weight: 500; }
.caret { width: 24px; height: 24px; border: 0; background: none; color: var(--mut); cursor: pointer; display: grid; place-items: center; border-radius: 6px; transition: transform 0.15s; }
.caret.shut { transform: rotate(-90deg); }
.caret-sp { width: 24px; flex: none; }
.icon-sp { width: 36px; flex: none; }
.start { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 600px) { .start { grid-template-columns: 1fr; } }
.start-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); cursor: pointer; transition: border-color 0.12s; }
.start-card:hover { border-color: var(--acc); }
.start-card .ico { color: var(--acc); margin-bottom: 4px; }
.start-card b { font-size: 16px; }
.start-card span { font-size: 13px; color: var(--mut); }
.menu-list { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; }
.menu-list button { display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; font-size: 14px; }
.menu-list button:hover { background: var(--soft); }
.menu-list .ico { color: var(--mut); }
.danger-box { border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); border-radius: 12px; padding: 12px; margin-top: 12px; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 540px; max-height: 92vh; background: var(--card); border: 1px solid var(--line); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; animation: up 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.35); padding-bottom: env(safe-area-inset-bottom); }
.sheet.wide { max-width: 820px; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 4px; font-size: 16px; }
.sheet-b { overflow-y: auto; padding: 4px 16px 16px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; } }

/* controls */
.seg { display: inline-flex; background: var(--soft); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { height: 32px; border: 0; background: none; border-radius: 8px; font-weight: 500; font-size: 13px; cursor: pointer; color: var(--mut); padding: 0 12px; }
.seg button[aria-pressed='true'] { background: var(--card); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.seg.sm button { height: 26px; font-size: 12px; padding: 0 10px; }
.switch { display: flex; align-items: center; gap: 12px; margin: 10px 0; cursor: pointer; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 38px; height: 22px; border-radius: 99px; background: var(--line2); position: relative; flex: none; transition: 0.18s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: 0.18s; }
.switch input:checked + span { background: var(--acc); }
.switch input:checked + span::after { left: 19px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line2); background: var(--soft); font-size: 12px; font-weight: 500; cursor: pointer; }
.chip.on { background: var(--acc-soft); border-color: var(--acc); color: var(--acc-ink); }
.bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin: 10px 0; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc2)); transition: width 0.2s; }
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--fg); color: var(--bg); padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); animation: up 0.2s; }
.toast.bad { background: var(--bad); color: #fff; }
.toast button { background: none; border: 0; color: var(--acc); font-weight: 600; cursor: pointer; }
@media (min-width: 960px) { .toasts { bottom: 24px; left: calc(50% + 112px); } }

/* study */
.study { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.study-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.study-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.study-title b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remain { display: flex; gap: 2px; }
.remain .cnt { min-width: 34px; text-align: center; padding: 2px 6px; border-radius: 6px; }
.remain .cnt.cur { background: var(--soft); text-decoration: underline; text-underline-offset: 4px; }
.study-tools { display: flex; gap: 4px; }
.study-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 7vh 20px 24px; position: relative; overflow-y: auto; cursor: default; }
.card-host { width: 100%; max-width: 760px; }
.flag-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.leech { position: absolute; top: 14px; }
.study-foot { position: sticky; bottom: 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.show { width: min(420px, 100%); }
.rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(620px, 100%); }
.rate { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 8px; border-radius: 12px; border: 1px solid var(--line2); background: var(--soft); cursor: pointer; transition: transform 0.06s, border-color 0.12s; }
.rate:active { transform: translateY(1px); }
.rate em { font-style: normal; font-size: 12px; color: var(--mut); font-variant-numeric: tabular-nums; }
.rate b { font-size: 15px; font-weight: 600; }
.rate kbd { margin-top: 2px; }
.rate.r1 b { color: #f87171; } .rate.r2 b { color: #fbbf24; } .rate.r3 b { color: #4ade80; } .rate.r4 b { color: #60a5fa; }
.rate.r1:hover { border-color: #f87171; } .rate.r2:hover { border-color: #fbbf24; } .rate.r3:hover { border-color: #4ade80; } .rate.r4:hover { border-color: #60a5fa; }
.study-meta { min-height: 18px; }
.finish { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 16px; text-align: center; }
.finish-ring { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--good) 30%, var(--line)); }
.finish-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(520px, 100%); }
.finish-stats div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; display: flex; flex-direction: column; }
.finish-stats b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.finish-stats span { font-size: 12px; color: var(--mut); }
.finish-more { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0; }
.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
@media (max-width: 600px) { .info-grid, .finish-stats { grid-template-columns: repeat(2, 1fr); } }
.info-grid div { background: var(--soft); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.info-grid span { font-size: 12px; color: var(--mut); }
.info-grid b { font-weight: 600; font-variant-numeric: tabular-nums; }
.flag-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line2); background: var(--soft); color: var(--f); cursor: pointer; display: grid; place-items: center; }
.flag-btn.on { background: color-mix(in srgb, var(--f) 22%, transparent); border-color: var(--f); }
.rt { font-weight: 600; } .rt.r1 { color: #f87171; } .rt.r2 { color: #fbbf24; } .rt.r3 { color: #4ade80; } .rt.r4 { color: #60a5fa; }

/* editor */
.edit-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .edit-grid { grid-template-columns: 1fr; } }
.toolbar { display: flex; gap: 2px; flex-wrap: wrap; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); margin: 6px 0 10px; }
.toolbar label.icon { display: inline-grid; place-items: center; cursor: pointer; }
.field { margin-bottom: 10px; }
.field-h { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--mut); margin-bottom: 4px; }
.field-h b { font-weight: 500; }
.pin { border: 0; background: none; cursor: pointer; opacity: 0.25; font-size: 12px; filter: grayscale(1); }
.pin.on { opacity: 1; filter: none; }
.field-in { min-height: 46px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: var(--rs); background: var(--bg); outline: none; line-height: 1.5; overflow-wrap: anywhere; }
.field-in:focus { border-color: var(--acc); }
.field-in img { max-width: 100%; max-height: 220px; border-radius: 6px; }
.preview { position: sticky; top: 16px; }
.preview .row-gap { justify-content: space-between; margin-bottom: 8px; }
.preview-card { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); padding: 28px 20px; min-height: 200px; }
.warnline { color: var(--warn); font-size: 13px; margin: 6px 0 0; }

/* notes */
.notes { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.doc-list { border-right: 1px solid var(--line); padding: 20px 10px; overflow-y: auto; max-height: 100vh; position: sticky; top: 0; }
.doc-list .ph { padding: 0 6px 12px; align-items: center; }
.doc-item { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: var(--mut); font-size: 14px; }
.doc-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.doc-item em { font-style: normal; font-size: 11px; font-variant-numeric: tabular-nums; }
.doc-item:hover, .doc-item.on { background: var(--soft); }
.doc-item.on span { font-weight: 600; }
.doc-empty { display: grid; place-items: center; }
.doc { display: flex; flex-direction: column; min-width: 0; }
.doc-top { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc-top select { width: auto; height: 32px; font-size: 13px; }
.doc-title { flex: 1; min-width: 160px; border: 0; background: none; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; padding: 0; height: 40px; }
.mobile-only { display: none; }
.syntax { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg2); font-size: 13px; }
.syntax div { display: flex; flex-direction: column; }
.syntax span { color: var(--mut); font-size: 12px; }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; flex: 1; min-height: 0; }
.doc-body { border: 0; border-radius: 0; background: transparent; padding: 22px 28px 120px; font-size: 15.5px; line-height: 26px; min-height: calc(100vh - 140px); resize: none; tab-size: 2; font-family: Inter, system-ui, sans-serif; }
.doc-body:focus { border: 0; }
.doc-cards { border-left: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 70px); position: sticky; top: 0; overflow-y: auto; }
.doc-cards > .row-gap { justify-content: space-between; }
.doc-card-list { display: flex; flex-direction: column; gap: 6px; }
.doc-card { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.doc-card:hover { border-color: var(--line2); }
.doc-card .ctx { font-size: 11px; color: var(--mut); }
.doc-card b { font-weight: 500; font-size: 14px; }
.doc-card span { font-size: 13px; color: var(--mut); }
.doc-card em { font-style: normal; font-size: 11px; color: var(--acc-ink); }
@media (max-width: 1100px) { .doc-grid { grid-template-columns: 1fr; } .doc-cards { border-left: 0; border-top: 1px solid var(--line); max-height: none; position: static; } .doc-body { min-height: 50vh; } }
@media (max-width: 760px) {
  .notes { grid-template-columns: 1fr; }
  .doc-list { border-right: 0; max-height: none; position: static; }
  .doc-list.has-doc { display: none; }
  .mobile-only { display: inline-grid; }
  .doc-body { padding: 16px; }
}

/* browse */
.searchbar { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 12px; background: var(--card); }
.searchbar .ico { color: var(--mut); }
.searchbar input { border: 0; background: none; padding: 0; height: 44px; }
.bulk { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px; border-radius: 12px; background: var(--acc-soft); border: 1px solid color-mix(in srgb, var(--acc) 35%, var(--line)); }
.bulk b { margin-right: 6px; font-size: 13px; }
.browse-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.browse-grid.with-side { grid-template-columns: minmax(0, 1fr) 380px; }
@media (max-width: 1100px) { .browse-grid.with-side { grid-template-columns: 1fr; } .side { order: -1; } }
.tbl-wrap { padding: 0; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--mut); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--card); }
.tbl th.sorted { color: var(--fg); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--soft); }
.tbl tr.focus { background: var(--acc-soft) !important; }
.tbl tr.susp td { color: var(--mut); background: color-mix(in srgb, var(--warn) 6%, transparent); }
.tbl tr.buried td { color: var(--mut); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .q { max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.tbl .dk { color: var(--mut); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tbl .ck { width: 30px; }
.tbl.small td, .tbl.small th { padding: 6px 8px; white-space: normal; cursor: default; position: static; }
.fdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--f); margin-right: 8px; }
.rpill { font-weight: 600; } .rpill.lo { color: var(--bad); } .rpill.mid { color: var(--warn); } .rpill.hi { color: var(--good); }
.side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 10px; }

/* stats */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile span { font-size: 12px; color: var(--mut); font-weight: 500; }
.tile b { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tile b small { font-size: 14px; color: var(--mut); font-weight: 500; }
.tile em { font-style: normal; font-size: 12px; color: var(--mut); }
.bars { display: flex; align-items: flex-end; gap: 2px; padding-bottom: 18px; position: relative; }
.bars .bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; background: none; margin: 0; overflow: visible; border-radius: 0; }
.bars .bar > i { display: block; width: 100%; max-width: 26px; border-radius: 3px 3px 1px 1px; }
.stack-col { width: 100%; max-width: 26px; display: flex; flex-direction: column-reverse; border-radius: 3px 3px 1px 1px; overflow: hidden; }
.stack-col i { display: block; }
.bars .bar > span { position: absolute; bottom: -18px; font-size: 10px; color: var(--mut); white-space: nowrap; }
.key { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--mut); margin: 12px 0 0; }
.key i { width: 9px; height: 9px; border-radius: 2px; margin-left: 10px; }
.key i:first-child { margin-left: 0; }
.heat { display: grid; grid-template-columns: repeat(53, 1fr); grid-template-rows: repeat(7, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--soft); }
.heat i.on { background: color-mix(in srgb, var(--good) calc(var(--a) * 100%), var(--soft)); }
.statebar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--soft); }
.statebar.slim { height: 10px; flex: 1; }
.btnrow { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 13px; }
.btnrow span { width: 64px; color: var(--mut); }
.btnrow em { font-style: normal; width: 74px; text-align: right; font-variant-numeric: tabular-nums; }
.mini-sel { width: auto; height: 30px; font-size: 12px; }

/* import, settings */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 44px 20px; border: 1.5px dashed var(--line2); border-radius: var(--r); background: var(--card); cursor: pointer; text-align: center; transition: border-color 0.12s, background 0.12s; }
.drop .ico { color: var(--acc); }
.drop span { font-size: 13px; color: var(--mut); }
.drop.over { border-color: var(--acc); background: var(--acc-soft); }
.drop.busy { cursor: progress; }
.prog { width: min(420px, 100%); }
.ok-box { border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.ok-box h2 { justify-content: flex-start; color: var(--good); }
.paste { min-height: 120px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }

/* sign in */
.login { min-height: 100vh; display: flex; flex-direction: column; background: radial-gradient(1200px 500px at 50% -200px, rgba(244, 63, 94, 0.13), transparent), var(--bg); }
.login-top { display: flex; align-items: center; gap: 10px; padding: 22px 24px; font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.login-top b { color: var(--mut); font-weight: 500; }
.login-card { max-width: 480px; width: 100%; margin: 3vh auto 40px; padding: 0 16px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 34px; line-height: 1.12; letter-spacing: -0.035em; }
.lead { color: var(--mut); }
.perks { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.perks li { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.perks .ico { color: var(--acc); margin-top: 2px; }
.perks b { display: block; font-size: 13px; font-weight: 600; }
.perks span { font-size: 12px; color: var(--mut); }
@media (max-width: 420px) { .perks { grid-template-columns: 1fr; } }
.err { padding: 10px 12px; border-radius: 10px; background: rgba(248, 113, 113, 0.12); color: #fca5a5; font-size: 14px; }
/* memory & retention */
.memory { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.mem-head { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.mem-head > div:first-child { display: flex; flex-direction: column; min-width: 110px; }
.mem-label { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.mem-label.bad, .mtag.bad { color: var(--bad); } .mem-label.warn, .mtag.warn { color: var(--warn); } .mem-label.good, .mtag.good { color: var(--good); } .mem-label.blue, .mtag.blue { color: var(--blue); } .mem-label.mut, .mtag.mut { color: var(--mut); }
.mem-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.mem-bar i { display: block; height: 100%; border-radius: 99px; }
.mem-bar i.bad { background: var(--bad); } .mem-bar i.warn { background: var(--warn); } .mem-bar i.good { background: var(--good); } .mem-bar i.blue { background: linear-gradient(90deg, var(--good), var(--blue)); } .mem-bar i.mut { background: var(--line2); }
.info-grid em { font-style: normal; font-size: 11px; color: var(--mut); }
.curve { width: 100%; height: auto; display: block; }
.curve .grid { stroke: var(--line); stroke-width: 1; }
.curve .target { stroke: var(--acc); stroke-width: 1.5; stroke-dasharray: 5 4; }
.curve .due { stroke: var(--mut); stroke-width: 1; stroke-dasharray: 3 3; }
.curve .fill { fill: color-mix(in srgb, var(--blue) 12%, transparent); }
.curve .line { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; }
.curve .now { fill: var(--fg); stroke: var(--bg); stroke-width: 3; }
.curve .ax { fill: var(--mut); font-size: 11px; font-family: Inter, sans-serif; }
.curve .tg { fill: var(--acc-ink); }
.curve .nowt { fill: var(--fg); font-weight: 600; }
.timeline { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding-bottom: 16px; }
.tl { flex: 1; max-width: 22px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.tl i { display: block; width: 100%; border-radius: 3px 3px 1px 1px; }
.tl span { position: absolute; bottom: -16px; left: 0; font-size: 10px; color: var(--mut); white-space: nowrap; }
.tip { padding: 10px 12px; border-radius: 10px; background: var(--soft); border-left: 3px solid var(--mut); font-size: 13px; margin: 8px 0 0; }
.tip.good { border-left-color: var(--good); } .tip.warn { border-left-color: var(--warn); }
.last-fb { font-size: 12px; color: var(--mut); margin-bottom: 18px; animation: fade 0.3s; }
.leech-coach { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 560px; width: 100%; padding: 12px 14px; margin-bottom: 20px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line)); background: color-mix(in srgb, var(--warn) 7%, var(--card)); font-size: 13px; }
.leech-coach span { color: var(--mut); }
.cnt.rc { min-width: 58px; font-size: 13px; color: var(--mut); }
.cnt.rc.lo { color: var(--bad); } .cnt.rc.mid { color: var(--warn); } .cnt.rc.hi { color: var(--good); }
.goal { padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); }
.goal .row-gap { justify-content: space-between; }
.goal .bar { margin: 8px 0 0; }
.weak-box { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); background: var(--card); }
.weak-box .ico { color: var(--warn); }
.weak-box div { flex: 1; display: flex; flex-direction: column; font-size: 14px; }
.weak-box span { color: var(--mut); font-size: 13px; }
.mtag { font-weight: 600; }
.side .info-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .cnt.rc { display: none; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
