:root {
  --bg: #eef0f3;
  --paper: #ffffff;
  --ink: #1b1f2a;
  --muted: #6b7280;
  --line: #e6e8ec;
  --navy: #16181d;
  --navy-2: #2c2f37;
  --red: #e5383b;
  --red-bg: #fdecec;
  --amber: #f2a516;
  --amber-bg: #fff5df;
  --green: #1f9d55;
  --green-bg: #e7f6ec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 6px 20px rgba(20, 30, 50, .06);
  font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.shell { max-width: 980px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 20px 60px; }
.brand { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--navy); color: #fff; display: grid; place-items: center; font: 22px Georgia, serif; }
.brand h1 { font-size: 22px; }
.brand .sub { color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 6px; background: #ebe7dd; padding: 4px; border-radius: 12px; margin-bottom: 18px; overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 10px 14px; border-radius: 9px; font-weight: 600; color: #4b5563; white-space: nowrap; }
.tabs button.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.card .hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 8px; }

.seg { display: inline-flex; background: #f0ede5; border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 9px 16px; border-radius: 8px; font-weight: 600; color: #4b5563; }
.seg button.on { background: var(--navy); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fbfaf7; padding: 9px 13px; border-radius: 999px; font-size: 15px; text-align: left; }
.chip.on { border-color: var(--navy); background: #e9eef6; color: var(--navy); font-weight: 600; }
.chip small { color: var(--muted); font-weight: 500; margin-left: 4px; }

.btn { border: 1px solid var(--line); background: var(--paper); padding: 11px 18px; border-radius: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:active { background: var(--navy-2); }
.btn.big { padding: 14px 26px; font-size: 17px; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 200px; }
.field input, .field select { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fbfaf7; }

.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf7; }
.item .main { flex: 1; min-width: 0; }
.item .t { font-size: 15px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.mid { background: var(--amber-bg); color: #a46a00; }
.pill.none { background: #eef0f3; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fbfaf7; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .bar { height: 6px; background: #ece8de; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--green); }

/* ---------- practice ---------- */
.practice { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { font-size: 12.5px; color: var(--muted); }
.icon-btn { border: 1px solid var(--line); background: var(--paper); border-radius: 10px; height: 40px; min-width: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px; }

.work { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px 140px; }
.sheet-wrap { max-width: 1100px; margin: 0 auto; }
.question { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; font-size: 18px; line-height: 1.55; box-shadow: var(--shadow); -webkit-user-select: text; user-select: text; }
.question .qhead { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.question img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); margin-top: 8px; display: block; }
.question .toggle-text { font-size: 13px; color: var(--navy); border: 0; background: none; padding: 6px 0 0; font-weight: 600; }
.md p { margin: 0 0 .6em; }
.md p:last-child { margin-bottom: 0; }
.md table { border-collapse: collapse; margin: .5em 0; font-size: .92em; }
.md td, .md th { border: 1px solid var(--line); padding: 4px 10px; }
.md .katex-display { margin: .5em 0; overflow-x: auto; overflow-y: hidden; }

.pad { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pad canvas { position: absolute; left: 0; top: 0; display: block; }
.pad .ink { touch-action: none; }
.pad .ink-overlay { pointer-events: none; }
.pad-hint { position: absolute; left: 0; right: 0; top: 30px; text-align: center; color: #b4b9c4; font-size: 17px; pointer-events: none; }

.toolbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 6px; align-items: center; background: rgba(255, 255, 255, .97); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(20, 30, 50, .16); border-radius: 18px; padding: 7px; z-index: 5; max-width: calc(100vw - 24px); }
.toolbar .tb { border: 0; background: transparent; height: 46px; min-width: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #374151; padding: 0 8px; }
.toolbar .tb svg { width: 22px; height: 22px; }
.toolbar .tb.on { background: #e9eef6; color: var(--navy); }
.toolbar .sep { width: 1px; height: 28px; background: var(--line); margin: 0 2px; }
.toolbar .mark { background: var(--navy); color: #fff; border: 0; height: 46px; border-radius: 12px; padding: 0 22px; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; gap: 8px; }
.toolbar .mark:disabled { opacity: .55; }

/* results sheet */
.results { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; background: var(--paper); border-top-left-radius: 20px; border-top-right-radius: 20px; box-shadow: 0 -10px 40px rgba(20, 30, 50, .18); max-height: 62vh; display: flex; flex-direction: column; transform: translateY(105%); transition: transform .28s ease; }
.results.open { transform: none; }
.results.min { transform: translateY(calc(100% - 78px)); }
.results .grab { width: 44px; height: 5px; background: #d9d5cb; border-radius: 3px; margin: 8px auto 0; }
.results .rhead { display: flex; align-items: center; gap: 12px; padding: 10px 18px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.results .verdict { font-size: 20px; font-weight: 800; }
.results .verdict.ok { color: var(--green); }
.results .verdict.bad { color: var(--red); }
.results .verdict.mid { color: #b07800; }
.results .score { font-size: 15px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: #f0ede5; }
.results .rbody { overflow-y: auto; padding: 14px 18px calc(20px + env(safe-area-inset-bottom)); -webkit-user-select: text; user-select: text; }
.results .summary { font-size: 16px; line-height: 1.5; margin: 0 0 12px; }
.issue { border-left: 4px solid var(--red); background: var(--red-bg); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.issue.ft { border-color: var(--amber); background: var(--amber-bg); }
.issue.unclear { border-color: #9aa3b2; background: #f1f3f6; }
.issue .ln { font-weight: 800; font-size: 13px; color: var(--red); }
.issue.ft .ln { color: #a46a00; }
.issue.unclear .ln { color: var(--muted); }
.issue .c { margin-top: 3px; font-size: 15.5px; line-height: 1.45; }
.issue .fix { margin-top: 6px; font-size: 15px; }
.allgood { display: flex; gap: 12px; align-items: center; background: var(--green-bg); border-radius: 12px; padding: 14px; color: #166a3c; font-weight: 600; margin-bottom: 12px; }
.allgood .big { font-size: 34px; }
details.more { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
details.more summary { font-weight: 700; cursor: pointer; }
details.more .md { margin-top: 10px; font-size: 16px; line-height: 1.55; }
.readlines { font-size: 15px; }
.readlines div { padding: 4px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; }
.readlines b { color: var(--muted); width: 30px; flex: none; }
.rbtns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* overlays */
.loading { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(246, 244, 239, .72); backdrop-filter: blur(2px); }
.loading .box { background: var(--paper); border-radius: 16px; padding: 22px 28px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; font-weight: 600; max-width: 90vw; }
.spin { width: 22px; height: 22px; border: 3px solid #dfe5ef; border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); background: #1b1f2a; color: #fff; padding: 11px 16px; border-radius: 12px; z-index: 30; font-size: 15px; max-width: 90vw; box-shadow: var(--shadow); }
.zoom { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .85); display: grid; place-items: center; padding: 20px; }
.zoom img { max-width: 100%; max-height: 100%; background: #fff; border-radius: 8px; }

/* import */
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.pages .pg { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.pages .pg img { width: 100%; display: block; }
.pages .pg .st { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, .92); }
.review .rq { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fbfaf7; }
.review .rq.off { opacity: .45; }
.review .rq img { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; margin-top: 8px; }
.review .rq .md { font-size: 16px; line-height: 1.5; margin-top: 8px; }
.review .rq select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; max-width: 100%; }

.lock { max-width: 420px; margin: 18vh auto 0; padding: 0 20px; text-align: center; }
.lock input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: 18px; text-align: center; margin: 16px 0; }

@media (max-width: 640px) {
  .shell { padding-left: 16px; padding-right: 16px; }
  .question { font-size: 16.5px; padding: 14px; }
  .toolbar .tb { min-width: 40px; height: 42px; padding: 0 4px; }
  .toolbar .tb span { display: none; }
  .toolbar .mark { padding: 0 14px; height: 42px; }
  .work { padding: 10px 8px 130px; }
}
.practice.sheet-open .toolbar { display: none; }
.practice.has-results .toolbar { bottom: calc(92px + env(safe-area-inset-bottom)); }

/* small result bar + details drawer */
.pbody { flex: 1; display: flex; min-height: 0; position: relative; }
.pbody .work { flex: 1; min-width: 0; }
.rbar { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 30px rgba(20, 30, 50, .16); padding: 8px 8px 8px 16px; max-width: calc(100vw - 24px); }
.rbar .verdict { font-size: 17px; font-weight: 800; white-space: nowrap; }
.rbar .verdict.ok { color: var(--green); } .rbar .verdict.bad { color: var(--red); } .rbar .verdict.mid { color: #b07800; }
.rbar .score { font-size: 14px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #f0ede5; white-space: nowrap; }
.rbar .btn { padding: 9px 14px; }
.practice.has-results .toolbar { bottom: calc(86px + env(safe-area-inset-bottom)); }
.practice.sheet-open .toolbar, .practice.sheet-open .rbar { display: none; }
@media (min-width: 900px) {
  .results { top: 0; bottom: 0; left: auto; right: 0; width: 420px; max-height: none; border-radius: 20px 0 0 20px; transform: translateX(105%); }
  .results.open { transform: none; }
  .results .grab { display: none; }
  .results .rhead { padding-top: max(16px, env(safe-area-inset-top)); }
  .practice.sheet-open .toolbar, .practice.sheet-open .rbar { display: flex; }
  .practice.sheet-open .rbar { left: calc(50% - 210px); }
  .practice.sheet-open .toolbar { left: calc(50% - 210px); }
}
@media (max-width: 640px) { .rbar .tapnote { display: none; } .rbar { gap: 6px; padding-left: 12px; } }

/* tap a ✗ badge → speech bubble beside that line */
.hit { position: absolute; z-index: 4; width: 48px; height: 48px; border: 0; padding: 0; background: transparent; border-radius: 50%; }
.tapnote { font-size: 13px; color: var(--muted); margin-top: 2px; }
.note { position: absolute; z-index: 5; background: #fff; border: 2px solid var(--red); border-radius: 14px; box-shadow: 0 10px 28px rgba(20, 30, 50, .2); font-size: 15.5px; line-height: 1.45; -webkit-user-select: text; user-select: text; display: none; }
.note.show { display: block; animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.note::before { content: ''; position: absolute; left: -9px; top: 12px; width: 14px; height: 14px; background: #fff; border-left: 2px solid var(--red); border-bottom: 2px solid var(--red); transform: rotate(45deg); }
.note.below::before { left: var(--ax, 20px); top: -9px; transform: rotate(135deg); }
.note .nh { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; font-size: 13.5px; padding: 9px 8px 0 13px; color: var(--red); }
.note .nx { border: 0; background: #f1f1f1; color: var(--muted); width: 28px; height: 28px; border-radius: 50%; font-size: 13px; flex: none; }
.note .nb { padding: 4px 13px 11px; }
.note .nf { margin-top: 6px; }
.note .md p { margin: 0; }
.note.ft, .note.ft::before { border-color: var(--amber); }
.note.ft .nh { color: #a46a00; }
.note.unc, .note.unc::before { border-color: #9aa3b2; }
.note.unc .nh { color: var(--muted); }

/* ================= StudyPad: landing ================= */
body.is-landing { background: #fff; }
.landing { max-width: 1180px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 28px 40px; color: #111; }
.lnav { display: flex; align-items: center; gap: 40px; padding: 18px 0; }
.lbrand { font-weight: 700; font-size: 20px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.lbrand img { width: 40px; height: 40px; }
.lnav nav { display: flex; gap: 30px; font-size: 14.5px; }
.lnav nav a { cursor: pointer; color: #222; text-decoration: none; padding-bottom: 5px; border-bottom: 2px solid transparent; }
.lnav nav a.on { border-color: #222; }
.lhero { display: grid; grid-template-columns: 1fr 1.05fr; align-items: center; gap: 40px; min-height: calc(100vh - 230px); padding: 20px 0 30px; }
.lcopy h1 { font-weight: 400; font-size: clamp(34px, 4vw, 52px); max-width: 520px; line-height: 1.22; letter-spacing: -.01em; margin-bottom: 22px; }
.lcopy p { color: #7a7d85; font-size: 16.5px; line-height: 1.8; max-width: 440px; margin: 0 0 34px; }
.gbtn { min-height: 44px; }
.lnote { color: #7a7d85; font-size: 14px; margin-top: 10px; }
.lart { color: #111; }
.lart svg { width: 100%; height: auto; max-height: 520px; display: block; }
.pill-btn { background: #111; color: #fff; border: 0; border-radius: 999px; padding: 13px 34px; font-weight: 500; font-size: 15px; font-family: inherit; }
.pill-btn.big { width: 100%; padding: 15px; font-size: 16px; margin-top: 8px; }
.link-btn { background: none; border: 0; color: #7a7d85; font-size: 14px; margin-top: 12px; width: 100%; }
.lhow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; border-top: 1px solid #eee; padding: 44px 0 30px; }
.lhow b { font-weight: 300; font-size: 14px; color: #9a9da5; }
.lhow h3 { font-weight: 500; font-size: 19px; margin: 8px 0; }
.lhow p { color: #7a7d85; font-size: 15px; line-height: 1.7; margin: 0; }
.lfoot a { color: inherit; } .lfoot { color: #9a9da5; font-size: 13.5px; padding: 20px 0; border-top: 1px solid #eee; }
@media (max-width: 820px) {
  .lhero { grid-template-columns: 1fr; min-height: 0; gap: 10px; }
  .lart { order: -1; max-width: 420px; }
  .lnav { gap: 20px; } .lnav nav { gap: 16px; font-size: 13.5px; }
  .lhow { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 520px) { .lnav nav { display: none; } .landing { padding-left: 16px; padding-right: 16px; } }

/* onboarding */
.onb { max-width: 460px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 16px 40px; }
.onb .lbrand { margin-bottom: 9vh; }
.onb-card h2 { font-weight: 500; font-size: 26px; line-height: 1.3; }
.onb-card .hint { color: #7a7d85; margin: 8px 0 26px; }
.onb-card .field { margin-bottom: 16px; min-width: 0; }
.onb-card .field span { font-size: 13px; font-weight: 500; color: #555; }
.onb-card .field input { border: 1px solid #dcdfe4; border-radius: 12px; padding: 13px 14px; background: #fff; font-size: 16px; font-family: inherit; }
.onb-card .field input:focus { outline: 2px solid #111; outline-offset: -1px; }

/* ================= StudyPad: app shell ================= */
body.is-app { background: var(--bg); }
.appshell { display: flex; gap: 16px; padding: max(16px, env(safe-area-inset-top)) 16px 16px; min-height: 100vh; min-height: 100dvh; }
.sidebar { position: sticky; top: max(16px, env(safe-area-inset-top)); height: calc(100dvh - 32px); width: 76px; flex: none; background: #0f1115; border-radius: 38px; display: flex; flex-direction: column; align-items: center; padding: 26px 0 18px; gap: 10px; }
.sb-logo { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 22px; background: #fff; border-radius: 16px; }
.sb-logo img { width: 40px; height: 40px; }
.sb-btn { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; color: #b9bdc6; background: transparent; border: 0; text-decoration: none; }
.sb-btn svg { width: 22px; height: 22px; }
.sb-btn.on { background: #23262d; color: #fff; }
.sb-space { flex: 1; }
.sb-avatar { width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-weight: 600; overflow: hidden; margin-top: 8px; }
.sb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.panel { flex: 1; min-width: 0; background: #fff; border-radius: 28px; padding: 34px 36px 60px; box-shadow: 0 1px 2px rgba(20, 30, 50, .04); }
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.kicker { font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: #8a8e97; text-decoration: none; display: inline-block; margin-bottom: 6px; }
.kicker.back { letter-spacing: .02em; text-transform: none; font-size: 14px; color: #6b6f78; }
.ph h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 600; letter-spacing: -.02em; }
.ph .muted { color: #a3a7af; font-weight: 400; }
.ph .hint { color: #7a7d85; margin: 8px 0 0; }

.covers { display: flex; flex-wrap: wrap; gap: 28px; }
.cover-card { width: 300px; max-width: 100%; text-decoration: none; color: inherit; }
.cover { position: relative; aspect-ratio: 300 / 375; border-radius: 22px; overflow: hidden; box-shadow: 0 10px 30px rgba(15, 17, 21, .18); transition: transform .2s; }
.cover-card:hover .cover, .cover-card:active .cover { transform: translateY(-3px); }
.cover-E { background: radial-gradient(120% 90% at 20% 10%, #2c5f8a 0%, #13263d 55%, #0b1422 100%); }
.cover-A { background: radial-gradient(120% 90% at 80% 10%, #8a1f2b 0%, #3a0d14 55%, #14070a 100%); }
.cover-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover-text { position: absolute; left: 22px; right: 22px; bottom: 22px; color: #fff; display: flex; flex-direction: column; gap: 2px; }
.cover-text small { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; opacity: .75; }
.cover-text b { font-size: 46px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.cover-text span { font-size: 13px; opacity: .8; }
.cover-title { font-weight: 600; font-size: 19px; margin-top: 14px; }
.cover-sub { color: #8a8e97; font-size: 14px; margin-top: 2px; }
.cover-soon { background: #f4f5f7; border: 2px dashed #dcdfe4; box-shadow: none; display: grid; place-items: center; text-align: center; color: #9a9da5; font-size: 15px; line-height: 1.6; }
.cover-card.soon { pointer-events: none; }

.sec { font-size: 15px; font-weight: 600; color: #6b6f78; margin: 30px 0 14px; letter-spacing: .02em; }
.sec:first-of-type { margin-top: 0; }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.topic { text-align: left; background: #f7f8fa; border: 1px solid #eceef1; border-radius: 18px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 140px; font-family: inherit; transition: background .15s, transform .15s; }
.topic:hover { background: #f0f2f5; }
.topic:active { transform: scale(.985); }
.tcode { align-self: flex-start; background: #111; color: #fff; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; letter-spacing: .04em; }
.tname { font-size: 16px; font-weight: 500; line-height: 1.35; flex: 1; }
.tprog { display: flex; align-items: center; gap: 10px; }
.tprog i { flex: 1; height: 5px; border-radius: 3px; background: linear-gradient(90deg, #1f9d55 var(--w), #e3e6ea var(--w)); }
.tprog em { font-style: normal; font-size: 12.5px; color: #8a8e97; white-space: nowrap; }

.modal { position: fixed; inset: 0; z-index: 30; background: rgba(15, 17, 21, .45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.mbox { background: #fff; border-radius: 24px; padding: 24px; width: 100%; max-width: 520px; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.mhead { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.mhead h2 { font-size: 21px; font-weight: 600; line-height: 1.3; }
.mbox .hint { color: #7a7d85; margin: 14px 0 12px; }
.diffs { display: flex; flex-direction: column; gap: 10px; }
.diff { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 12px; text-align: left; border: 1.5px solid #e6e8ec; background: #fff; border-radius: 16px; padding: 14px 16px; font-family: inherit; }
.diff .dots { grid-row: span 2; align-self: center; letter-spacing: 2px; font-size: 13px; color: #111; }
.diff b { font-weight: 600; font-size: 16px; }
.diff span:last-child { color: #7a7d85; font-size: 14px; }
.diff:hover, .diff.on { border-color: #111; }

.panel .list .item { width: 100%; text-align: left; font-family: inherit; background: #f7f8fa; border-color: #eceef1; }
.panel .mk { font-size: 14px; white-space: nowrap; }

@media (max-width: 700px) {
  .appshell { padding: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .sidebar { position: fixed; z-index: 10; top: auto; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); height: 62px; width: auto; flex-direction: row; justify-content: space-around; padding: 0 14px; border-radius: 31px; }
  .sb-logo, .sb-space { display: none; }
  .sb-avatar { width: 36px; height: 36px; margin: 0; }
  .panel { border-radius: 0; padding: max(22px, env(safe-area-inset-top)) 16px 30px; min-height: 100dvh; }
  .covers { gap: 18px; }
  .cover-card { width: calc(50% - 9px); }
  .cover-text b { font-size: 30px; }
  .topics { grid-template-columns: 1fr; }
  .topic { min-height: 0; }
}
