:root {
  --bg: #f4f7f3;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #fff;
  --surface-2: #edf2ec;
  --ink: #17241f;
  --muted: #65716c;
  --line: rgba(21, 55, 43, .12);
  --brand: #176b51;
  --brand-2: #23a474;
  --accent: #e9b949;
  --danger: #c94d57;
  --shadow: 0 24px 70px rgba(25, 58, 45, .11);
  --radius: 24px;
  --serif: "Noto Serif SC", "Songti SC", SimSun, serif;
  --sans: Inter, "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

html[data-theme="dark"] {
  --bg: #0e1714;
  --surface: rgba(23, 35, 31, .9);
  --surface-solid: #17231f;
  --surface-2: #202f2a;
  --ink: #e6efe9;
  --muted: #9aaba3;
  --line: rgba(221, 243, 231, .12);
  --brand: #72d4ad;
  --brand-2: #3eb98a;
  --accent: #e6bd65;
  --danger: #f07880;
  --shadow: 0 30px 90px rgba(0, 0, 0, .35);
}

html[data-theme="paper"] {
  --bg: #eee4cf;
  --surface: rgba(255, 249, 232, .88);
  --surface-solid: #fff8e7;
  --surface-2: #eee1c3;
  --ink: #3b3225;
  --muted: #776b58;
  --line: rgba(84, 61, 31, .17);
  --brand: #79602d;
  --brand-2: #a47d37;
  --accent: #aa5d33;
  --danger: #a44040;
  --shadow: 0 25px 70px rgba(75, 52, 24, .14);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); color: var(--ink); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; font-family: var(--sans); background: var(--bg); overflow-x: hidden; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.access-dialog::backdrop { background: rgba(7, 18, 14, .72); backdrop-filter: blur(8px); }
.access-dialog form { min-width: min(430px, calc(100vw - 48px)); }
.access-dialog label { display: grid; gap: 8px; color: var(--muted); font-weight: 700; }
.access-dialog input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-solid); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.ambient { position: fixed; z-index: 0; border-radius: 999px; filter: blur(3px); pointer-events: none; opacity: .7; }
.ambient-one { width: 460px; height: 460px; right: -160px; top: 80px; background: radial-gradient(circle, rgba(51, 181, 133, .17), transparent 68%); }
.ambient-two { width: 500px; height: 500px; left: -240px; bottom: -160px; background: radial-gradient(circle, rgba(232, 184, 73, .14), transparent 68%); }

.topbar { position: sticky; top: 0; z-index: 30; min-height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 12px max(28px, calc((100vw - 1480px) / 2)); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: white; font: 700 22px var(--serif); background: linear-gradient(145deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 24px rgba(22, 107, 81, .22); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .01em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.library-switch, .type-tabs, .quick-days { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.seg, .type-tab, .quick-days button { border: 0; border-radius: 10px; padding: 9px 14px; color: var(--muted); background: transparent; transition: .18s ease; }
.seg:hover, .type-tab:hover, .quick-days button:hover { color: var(--ink); }
.seg.active, .type-tab.active, .quick-days button.active { color: var(--brand); background: var(--surface-solid); box-shadow: 0 3px 12px rgba(20, 55, 42, .08); }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.due-button, .quiet-button, .primary-button, .icon-button, .text-button { border: 0; border-radius: 12px; transition: transform .16s ease, background .16s ease; }
.due-button { padding: 10px 13px; color: #6b4810; background: #ffe7ad; }
.due-button b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 4px; padding: 0 6px; border-radius: 10px; color: #fff; background: #d78921; }
.quiet-button { padding: 10px 14px; border: 1px solid var(--line); background: var(--surface); }
.primary-button { padding: 11px 17px; color: white; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 9px 24px rgba(27, 126, 92, .18); }
.due-button:hover, .quiet-button:hover, .primary-button:hover, .icon-button:hover { transform: translateY(-1px); }
.theme-picker select { width: 82px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }

.shell { position: relative; z-index: 1; width: min(1480px, calc(100% - 48px)); margin: 0 auto 80px; }
.view-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding-top: 22px; }
.view-button { padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: var(--surface); box-shadow: 0 8px 24px rgba(25, 58, 45, .06); }
.view-button.active { color: white; border-color: transparent; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.view-button b { display: inline-grid; min-width: 24px; margin-left: 5px; padding: 2px 7px; border-radius: 999px; color: inherit; background: color-mix(in srgb, currentColor 14%, transparent); }
.hero-panel { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; padding: 60px 16px 36px; }
.eyebrow { margin: 0 0 14px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .2em; }
.hero-panel h1 { margin: 0; font: 500 clamp(34px, 4vw, 62px)/1.12 var(--serif); letter-spacing: -.035em; }
.hero-panel h1 em { color: var(--brand); font-style: normal; }
.hero-metric { min-width: 180px; padding: 20px 24px; border-left: 1px solid var(--line); }
.hero-metric span, .hero-metric small { display: block; color: var(--muted); font-size: 12px; }
.hero-metric strong { display: block; margin: 2px 0; font: 600 44px var(--serif); }

.control-deck, .queue-panel, .study-panel { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 18px 50px rgba(25, 58, 45, .09); }
.control-deck { padding: 20px; border-radius: var(--radius); }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.search-box { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-solid); }
.search-box > span { color: var(--brand); font-size: 25px; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; }
kbd { padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface-2); font-size: 10px; }
.type-tabs { width: max-content; margin-top: 14px; }
.period-cabin { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.period-title, .period-controls, .section-heading, .rating-bar, .edit-dialog header, .edit-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.period-title > div { display: flex; align-items: center; gap: 9px; }
.period-title small { color: var(--muted); }
.text-button { padding: 5px; color: var(--brand); background: transparent; }
.period-controls { justify-content: flex-start; flex-wrap: wrap; margin-top: 14px; }
.compact-input, .date-input { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.compact-input input { width: 58px; }
.period-controls input { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-solid); }
.or { color: var(--muted); font-size: 12px; }
.battle-stats { display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; margin-top: 13px; }
.stat-chip { padding: 7px 10px; border-radius: 10px; color: var(--muted); background: var(--surface-solid); font-size: 12px; }
.stat-chip strong { color: var(--ink); }

.workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.queue-panel, .study-panel { border-radius: var(--radius); }
.queue-panel { position: sticky; top: 90px; max-height: calc(100vh - 112px); padding: 18px 12px; overflow: hidden; }
.section-heading { padding: 2px 8px 14px; }
.section-heading > div { display: flex; align-items: center; gap: 8px; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand-2) 14%, transparent); }
.record-list { max-height: calc(100vh - 180px); padding: 0 4px 8px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.record-item { width: 100%; margin-bottom: 7px; padding: 13px; border: 1px solid transparent; border-radius: 15px; text-align: left; background: transparent; }
.record-item:hover { background: var(--surface-2); }
.record-item.active { border-color: color-mix(in srgb, var(--brand) 32%, transparent); background: color-mix(in srgb, var(--brand) 9%, var(--surface-solid)); }
.record-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
.record-badges { display: inline-flex; align-items: center; gap: 5px; }
.anki-pill { font-style: normal; font-size: 10px; opacity: .85; }
.record-item h3 { margin: 7px 0 6px; font-size: 14px; line-height: 1.5; }
.record-item p { margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.list-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 8px 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.list-pager span { text-align: center; line-height: 1.4; }
.list-pager strong { color: var(--ink); }
.list-pager button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface-solid); font-size: 11px; white-space: nowrap; }
.list-pager button:disabled { opacity: .38; cursor: not-allowed; }
.list-empty { padding: 10px 8px; }
.mastery-pill { width: 9px; height: 9px; border-radius: 50%; }
.mastery-0 { background: #de5d65; }.mastery-1 { background: #e5b443; }.mastery-2 { background: #40a978; }
.study-panel { min-height: 620px; overflow: hidden; }
.empty-state { min-height: 620px; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-state > span { color: var(--brand); font: 400 64px var(--serif); }
.empty-state h2 { margin: 8px 0; font: 500 27px var(--serif); }
.empty-state p { margin: 0; color: var(--muted); }
.study-card { min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 24px; border-bottom: 1px solid var(--line); }
.card-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.meta-chip { padding: 5px 8px; border-radius: 8px; color: var(--muted); background: var(--surface-2); font-size: 11px; }
.card-tools { display: flex; align-items: center; gap: 7px; }
.timer { min-width: 64px; color: var(--brand); font: 700 13px ui-monospace, monospace; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; color: var(--muted); background: var(--surface-2); }
.annotate-button { width: auto; padding: 0 11px; font-size: 12px; white-space: nowrap; }
.icon-button.active { color: #fff; background: linear-gradient(135deg, #c94d57, #9f2f3a); box-shadow: 0 6px 16px rgba(159, 47, 58, .24); }
.slow-badge { padding: 5px 8px; border-radius: 8px; color: #8a4b05; background: #fef0c7; font-size: 10px; font-weight: 700; white-space: nowrap; }
.slow-button { padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: var(--surface-solid); }
.slow-button.active { color: #8a4b05; border-color: #e3a833; background: #fef0c7; }
.icon-button.danger:hover { color: var(--danger); }
.question-zone { padding: clamp(26px, 5vw, 58px); }
.zone-label { display: block; margin-bottom: 10px; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.question-zone h2 { margin: 0 0 26px; font: 500 clamp(25px, 3vw, 39px)/1.28 var(--serif); letter-spacing: -.02em; }
.prose { min-width: 0; font-size: 16px; line-height: 1.85; overflow-wrap: anywhere; }
.prose.compact { color: var(--muted); font-size: 13px; }
.prose p { margin: .65em 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: .95em 0 .45em; color: var(--ink); font-family: var(--serif); line-height: 1.35; }
.prose h1 { font-size: 1.55em; }
.prose h2 { font-size: 1.38em; }
.prose h3 { font-size: 1.2em; }
.prose h4 { font-size: 1.06em; }
.prose ul, .prose ol { margin: .7em 0; padding-left: 1.5em; }
.prose li { margin: .25em 0; }
.prose blockquote { margin: .9em 0; padding: .55em 1em; border-left: 4px solid var(--brand-2); background: var(--surface-2); color: var(--muted); }
.prose pre { padding: 16px; overflow: auto; border-radius: 12px; background: #101815; color: #e5eee9; }
.prose pre code { background: transparent; color: inherit; padding: 0; }
.prose code { font-family: ui-monospace, Consolas, monospace; }
.prose .md-inline-code { padding: 2px 5px; border-radius: 4px; color: #b42318; background: #f3f4f6; font-size: .9em; }
.prose mark, mark { padding: 1px 3px; color: inherit; background: #ffdf72; border-radius: 3px; }
.prose mark.md-highlight { padding: 2px 4px; background: #fef08a; font-weight: 600; }
.prose .md-table-wrap { max-width: 100%; margin: 1em 0; overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: .93em; }
.prose th, .prose td { padding: 8px 10px; border: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 700; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; }
.prose pre.mermaid { background: var(--surface-solid); color: var(--ink); text-align: center; }
.fallback-label { display: inline-block; margin-right: 8px; padding: 2px 8px; border-radius: 999px; color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); font-size: 10px; font-weight: 700; }
.image-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 18px; }
.image-strip img { max-width: 100%; border: 1px solid var(--line); border-radius: 14px; }
.answer-zone { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 50%, transparent); transition: opacity .2s ease; }
.answer-zone.concealed { display: none; }
.answer-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, .7fr); gap: 32px; padding: clamp(24px, 4vw, 48px); }
.answer-grid aside { padding-left: 25px; border-left: 1px solid var(--line); }
.answer-grid aside > p { margin: 0 0 26px; font: 500 18px/1.6 var(--serif); }
.reveal-button { width: calc(100% - 48px); margin: 0 24px 22px; padding: 13px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: transparent; }
.rating-bar { padding: 18px 24px; border-top: 1px solid var(--line); }
.anki-action-bar { display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, var(--accent)); }
.anki-action-bar .primary-button { min-width: 230px; }
.anki-preview { padding: 0 24px 20px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, var(--accent)); }
.anki-preview details { padding: 12px 0 0; }
.anki-preview summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.anki-preview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 14px; }
.anki-preview-grid > div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-solid); }
.quiet-button.danger { color: #a3343e; border-color: color-mix(in srgb, #a3343e 45%, var(--line)); }
.anki-spinner { display: inline-block; animation: anki-spin .8s linear infinite; }
@keyframes anki-spin { to { transform: rotate(360deg); } }
.rating-bar > div:first-child span, .rating-bar > div:first-child small { display: block; }
.rating-bar > div:first-child span { font-weight: 700; }
.rating-bar > div:first-child small { margin-top: 3px; color: var(--muted); }
.rating-buttons { display: flex; gap: 8px; }
.rating { min-width: 112px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-solid); }
.rating span, .rating small { display: block; }
.rating small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.rating.red:hover { border-color: #d85a63; }.rating.yellow:hover { border-color: #d9a52d; }.rating.green:hover { border-color: #2c9f6c; }
.timeline-section { padding: 24px; border-top: 1px solid var(--line); }
.insight-form { padding: 14px; border-radius: 14px; background: var(--surface-2); }
.insight-form textarea { width: 100%; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-solid); }
.insight-form > div { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.timeline { position: relative; margin: 12px 0 0 8px; padding-left: 23px; border-left: 1px solid var(--line); }
.timeline-item { position: relative; padding: 0 0 18px; }
.timeline-item::before { content: ""; position: absolute; left: -28px; top: 5px; width: 9px; height: 9px; border: 3px solid var(--surface-solid); border-radius: 50%; background: var(--brand-2); box-shadow: 0 0 0 1px var(--line); }
.timeline-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.timeline-item time { color: var(--muted); font-size: 10px; }
.timeline-delete { padding: 3px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--surface-solid); font-size: 10px; line-height: 1.3; white-space: nowrap; }
.timeline-delete:hover, .timeline-delete:focus-visible { color: #fff; border-color: var(--danger); background: var(--danger); }
.timeline-item p { margin: 5px 0 0; line-height: 1.65; }
.timeline-empty { color: var(--muted); font-size: 13px; }

.edit-dialog { width: min(780px, calc(100% - 32px)); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: var(--surface-solid); box-shadow: var(--shadow); }
.edit-dialog::backdrop { background: rgba(7, 16, 12, .58); backdrop-filter: blur(5px); }
.edit-dialog form { padding: 24px; }
.edit-dialog h2 { margin: 3px 0 0; font: 500 23px var(--serif); }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-height: 65vh; margin: 20px 0; overflow-y: auto; }
.edit-grid label { color: var(--muted); font-size: 12px; }
.edit-grid .wide { grid-column: 1 / -1; }
.edit-grid input, .edit-grid textarea { width: 100%; margin-top: 6px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface-2); resize: vertical; }
.edit-dialog footer { justify-content: flex-end; }
.message-dialog { width: min(520px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: var(--surface-solid); box-shadow: var(--shadow); }
.message-dialog::backdrop { background: rgba(7, 16, 12, .58); backdrop-filter: blur(5px); }
.message-dialog h2 { margin: 0 0 12px; font: 500 23px var(--serif); }
.message-dialog .message-body { line-height: 1.75; }
.message-dialog footer { display: flex; justify-content: flex-end; margin-top: 20px; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; border-radius: 12px; color: white; background: #173d30; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.study-card { position: relative; isolation: isolate; }
.card-header { position: relative; z-index: 60; }
.annotator-toolbar { position: sticky; z-index: 9999; top: 0; display: flex; align-items: center; gap: 6px; padding: 9px 12px; overflow-x: auto; background: var(--surface-solid); border-bottom: 1px solid var(--line); }
.annotator-toolbar button, .annotator-toolbar select, .annotator-toolbar input { flex: 0 0 auto; }
.annotator-toolbar button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); cursor: pointer; }
.annotator-toolbar button.active, .annotator-toolbar .annotator-save { color: white; border-color: var(--accent); background: var(--accent); }
.annotator-toolbar .annotator-close, .annotator-toolbar .annotator-clear-exit { color: #fff; border-color: #b91c1c; background: #dc2626; font-weight: 700; }
.annotator-toolbar .annotator-clear-exit { background: #991b1b; }
.annotator-toolbar .annotator-close { margin-left: 2px; }
.annotator-toolbar .annotator-close:hover, .annotator-toolbar .annotator-clear-exit:hover { background: #7f1d1d; }
.annotator-divider { width: 1px; height: 24px; background: var(--line); }
.annotation-canvas { position: absolute; z-index: 50; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; cursor: default; touch-action: none; user-select: none; -webkit-user-select: none; }
.study-card.annotating .annotation-canvas { pointer-events: auto; cursor: crosshair; }
.text-annotation { position: relative; z-index: 9; }
.annotation-highlight { background: color-mix(in srgb, #f6d65f 62%, transparent); }
.annotation-wave { text-decoration: underline wavy #ef4444 2px; text-underline-offset: 3px; }
.annotation-strike { text-decoration: line-through #ef4444 2px; }

.paper-split { display: grid; grid-template-columns: minmax(260px, .9fr) minmax(0, 1.1fr); border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.paper-split > aside, .paper-split > div { padding: 24px; min-height: 180px; }
.paper-split > aside { max-height: 460px; overflow-y: auto; border-right: 1px solid var(--line); }
.paper-split section { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.interview-cabin { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 20px 30px; padding: 20px; border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line)); border-radius: 16px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.interview-cabin > div { display: grid; gap: 4px; }
.interview-cabin strong { font: 700 34px/1 var(--serif); color: var(--accent); font-variant-numeric: tabular-nums; }
.interview-cabin audio { max-width: 280px; }

.feature-dialog { width: min(760px, calc(100% - 32px)); max-height: 88vh; padding: 0; overflow: hidden; color: var(--text); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.feature-dialog::backdrop { background: rgb(8 20 16 / .55); backdrop-filter: blur(4px); }
.feature-dialog > header { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.feature-dialog > header span { color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.feature-dialog h2 { margin: 3px 0 0; }
.wide-dialog { width: min(980px, calc(100% - 32px)); }
.feature-body { padding: 24px 26px; max-height: 70vh; overflow-y: auto; }
.inline-form, .exam-builder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.inline-form input, .dialog-search, .exam-builder input, .exam-builder select, .return-sheet input, .return-sheet select { width: 100%; padding: 11px 12px; color: var(--text); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.dialog-search { margin: 18px 0 10px; }
.lexicon-list { display: grid; gap: 10px; }
.lexicon-list article { display: grid; grid-template-columns: 90px 1fr 1fr auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.lexicon-list article span { color: var(--muted); font-size: 12px; }.lexicon-list article p { margin: 0; }.lexicon-list article strong { color: var(--accent); }.lexicon-list article small { color: var(--muted); }
.exam-builder label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.exam-builder > button, .exam-result { grid-column: 1 / -1; }
.exam-result { padding-top: 12px; }
.export-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.export-grid a { padding: 12px; color: var(--accent); text-align: center; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; }
.exam-history { display: grid; gap: 10px; }
.history-card { display: grid; grid-template-columns: 80px 1fr auto; align-items: center; gap: 14px; padding: 16px; color: var(--text); text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.history-card span { color: var(--accent); }.history-card small { color: var(--muted); }
.return-sheet { display: grid; gap: 10px; }
.return-sheet > article { display: grid; grid-template-columns: minmax(170px, .8fr) 140px minmax(220px, 1.2fr); align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.return-sheet > article div { display: grid; }.return-sheet > article small { color: var(--muted); }

@media (max-width: 1050px) {
  .topbar { grid-template-columns: 1fr auto; }.library-switch { grid-row: 2; grid-column: 1 / -1; justify-self: center; }
  .workspace { grid-template-columns: 280px minmax(0, 1fr); }.answer-grid { grid-template-columns: 1fr; }.answer-grid aside { padding: 22px 0 0; border: 0; border-top: 1px solid var(--line); }
  .rating-bar { align-items: flex-start; flex-direction: column; }.rating-buttons { width: 100%; }.rating { flex: 1; min-width: 0; }
}

@media (max-width: 760px) {
  .topbar { position: relative; grid-template-columns: 1fr; padding: 12px 18px; }.top-actions, .library-switch { grid-row: auto; grid-column: auto; justify-self: stretch; }.top-actions { flex-wrap: wrap; }.library-switch > button { flex: 1; }
  .shell { width: min(100% - 24px, 1480px); }.view-switch { grid-template-columns: 1fr; }.hero-panel { align-items: flex-start; flex-direction: column; padding: 38px 4px 24px; }.hero-metric { padding-left: 0; border: 0; }
  .search-row, .workspace { grid-template-columns: 1fr; }.type-tabs { width: 100%; overflow-x: auto; }.type-tab { white-space: nowrap; }.period-controls { align-items: stretch; flex-direction: column; }.quick-days { overflow-x: auto; }.quick-days button { flex: 1; white-space: nowrap; }
  .queue-panel { position: static; max-height: 310px; }.record-list { max-height: 240px; }.question-zone { padding: 28px 22px; }.card-header { align-items: flex-start; flex-direction: column; }.rating-buttons { flex-direction: column; }.rating { width: 100%; }.edit-grid { grid-template-columns: 1fr; }.edit-grid label { grid-column: 1; }.anki-preview-grid { grid-template-columns: 1fr; }
  .paper-split, .inline-form, .exam-builder, .return-sheet > article { grid-template-columns: 1fr; }.paper-split > aside { border-right: 0; border-bottom: 1px solid var(--line); }.interview-cabin { align-items: stretch; flex-direction: column; }.lexicon-list article, .history-card { grid-template-columns: 1fr; }.export-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .topbar, .control-deck, .queue-panel, .card-tools, .reveal-button, .rating-bar, .insight-form, .timeline-delete, .anki-action-bar, .anki-preview { display: none !important; }
  .shell, .workspace { width: 100%; margin: 0; display: block; }.study-panel { border: 0; box-shadow: none; }.answer-zone.concealed { display: block; }
  .study-card, .question-zone, .answer-zone, .timeline-item { break-inside: avoid; }
}
