:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-alt: #f0eee8;
  --surface-hover: #f9f8f5;
  --border: rgba(20, 23, 26, 0.09);
  --border-strong: rgba(20, 23, 26, 0.18);
  --text: #16181d;
  --muted: #66707c;
  --accent: #3b5bfd;
  --accent-soft: rgba(59, 91, 253, 0.1);
  --ok: #15803d;
  --ok-bg: #ecfdf3;
  --ok-border: rgba(21, 128, 61, 0.25);
  --hl-bg: #fef08a;
  --hl-text: #16181d;
  --warn: #d97706;
  --warn-bg: rgba(217, 119, 6, 0.1);
  --shadow: 0 2px 10px rgba(17, 24, 39, 0.04), 0 1px 2px rgba(17, 24, 39, 0.03);
  --shadow-lg: 0 12px 36px rgba(17, 24, 39, 0.12);
  --radius: 18px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Literata', Georgia, Cambria, "Times New Roman", serif;
}

body.dark {
  --bg: #111215;
  --surface: #191b20;
  --surface-alt: #22252c;
  --surface-hover: #20232a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f3f5;
  --muted: #98a2b3;
  --accent: #6c8cff;
  --accent-soft: rgba(108, 140, 255, 0.15);
  --ok: #4ade80;
  --ok-bg: rgba(74, 222, 128, 0.12);
  --ok-border: rgba(74, 222, 128, 0.3);
  --hl-bg: rgba(250, 204, 21, 0.25);
  --hl-text: #fef08a;
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: 58px;
  background: rgba(246, 245, 241, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
body.dark .topbar { background: rgba(17, 18, 21, 0.86); }

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; }
.brand-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: transparent; border: none; color: var(--text);
  padding: 4px 6px; border-radius: 10px; cursor: pointer; font-weight: 650;
}
.brand-btn:hover { background: var(--surface-alt); }
.brand-mark {
  background: var(--text); color: var(--bg);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 4px 8px; border-radius: 8px;
}
.brand-title { font-size: 0.98rem; white-space: nowrap; }

.mode-tabs {
  display: flex; gap: 3px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 4px; border-radius: 12px; box-shadow: var(--shadow);
}
.tab-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 13px; border-radius: 8px; font-size: 0.86rem; font-weight: 550;
  cursor: pointer; transition: all 0.14s; white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--text); color: var(--bg); }

.progress-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 11px; font-size: 0.8rem; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.progress-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.95rem; text-decoration: none; transition: transform 0.12s, background 0.12s;
}
.icon-btn:hover { background: var(--surface-alt); }
.icon-btn:active { transform: scale(0.95); }

/* Main Container */
.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 88px;
}

/* Home / Topics View */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px;
}
.hero-card h1 { margin: 0 0 6px; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.hero-card p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 18px 16px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform 0.14s, border-color 0.14s;
}
.topic-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.topic-card:active { transform: scale(0.99); }
.topic-top { display: flex; justify-content: space-between; align-items: center; }
.topic-num {
  font-size: 0.78rem; font-weight: 700;
  padding: 4px 10px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
}
.topic-cnt { font-size: 0.8rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.topic-title { font-size: 1.02rem; font-weight: 650; line-height: 1.3; }
.topic-hint { font-size: 0.84rem; color: var(--muted); line-height: 1.4; flex: 1; }
.topic-bar { height: 5px; background: var(--surface-alt); border-radius: 99px; overflow: hidden; }
.topic-bar-fill { height: 100%; background: var(--ok); border-radius: 99px; transition: width 0.25s; }

/* Buttons & Inputs */
.btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 11px; padding: 8px 14px; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: all 0.12s; white-space: nowrap;
}
.btn:hover { background: var(--surface-alt); border-color: var(--border-strong); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ok-active { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.btn.sm { padding: 6px 11px; font-size: 0.82rem; border-radius: 9px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-alt); color: var(--text); }

.input, .select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 11px; padding: 8px 12px; font-size: 0.9rem; outline: none;
}
.input:focus, .select:focus { border-color: var(--accent); }

.seg {
  display: inline-flex; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 10px; padding: 3px;
}
.seg button {
  border: none; background: transparent; color: var(--muted);
  padding: 5px 11px; border-radius: 7px; font-size: 0.83rem; font-weight: 600; cursor: pointer;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Session Subbar */
.session-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 16px;
}
.session-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.session-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topic-select { font-weight: 600; max-width: 280px; }
.search-wrap { position: relative; flex: 1; max-width: 280px; min-width: 170px; }
.search-wrap input { width: 100%; padding-left: 12px; }

/* Split View (Desktop) */
.split-view { display: grid; grid-template-columns: minmax(320px, 0.95fr) minmax(380px, 1.05fr); gap: 18px; align-items: start; }
.reading-pane {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
  position: sticky; top: 74px; max-height: calc(100vh - 96px); overflow-y: auto;
}
.reading-pane-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border);
  font-size: 0.82rem; font-weight: 650; color: var(--muted);
}
.reading-tip { font-size: 0.78rem; color: var(--muted); margin-bottom: 12px; }

.reading-prose {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.78;
  color: var(--text);
}
.reading-prose p { margin: 0 0 12px; }
.sent-span {
  border-radius: 5px;
  padding: 1px 2px;
  cursor: pointer;
  transition: background 0.14s;
}
.sent-span:hover { background: var(--surface-alt); }
.sent-span.hl { background: var(--hl-bg); color: var(--hl-text); }

/* Focus Card & Task Card */
.focus-wrap { max-width: 780px; margin: 0 auto; }
.split-view .focus-wrap { max-width: none; margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px 26px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card.solved { border-color: var(--ok-border); }

.card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.num-pill {
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: 8px;
}
.counter-pill { font-size: 0.82rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-tools { display: flex; align-items: center; gap: 6px; }

.star-btn.starred { color: var(--warn); background: var(--warn-bg); border-color: rgba(217, 119, 6, 0.3); }

/* Prompt Typography */
.prompt { font-size: 1.01rem; line-height: 1.66; }
.prompt p { margin: 0 0 10px; }
.prompt p:last-child { margin-bottom: 0; }

/* Task 7 framed text */
.prompt table.fipi-table[border="1"] {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 16px; margin: 14px 0 4px; overflow: hidden;
}
.prompt table.fipi-table[border="1"] td {
  border: none; padding: 18px 20px;
  font-family: var(--font-serif); font-size: 1.03rem; line-height: 1.85;
}
.prompt sup {
  display: inline-block;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-sans); font-size: 0.72em; font-weight: 700;
  padding: 0 5px; border-radius: 6px; margin: 0 2px; line-height: 1.4;
  vertical-align: super;
}

/* Options (Tap Cards) */
.options { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 13px;
  background: var(--surface-alt); border: 1.5px solid transparent;
  border-radius: 14px; padding: 13px 15px; cursor: pointer;
  transition: all 0.12s; user-select: none;
}
.opt:hover { border-color: var(--border-strong); }
.opt:active { transform: scale(0.995); }
.opt.checked {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.opt input { display: none; }
.opt-num {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: var(--muted);
}
.opt.checked .opt-num {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.opt-body { flex: 1; font-size: 0.97rem; line-height: 1.55; padding-top: 2px; }
.opt-body p { margin: 0; }

/* Task 4 Tap Matching */
.match-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 12px; margin: 14px 0; }
.match-col { background: var(--surface-alt); border-radius: 16px; padding: 14px 16px; }
.match-col h4 {
  margin: 0 0 10px; font-size: 0.74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.match-row { display: flex; gap: 9px; margin-bottom: 10px; font-size: 0.93rem; line-height: 1.5; }
.match-row:last-child { margin-bottom: 0; }
.match-row p { margin: 0; }
.match-key { font-weight: 700; color: var(--accent); min-width: 18px; }

.match-tap-area {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.match-tap-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.match-tap-lbl {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem;
}
.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }
.num-chip {
  min-width: 40px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--text);
  font-weight: 650; font-size: 0.92rem; cursor: pointer; transition: all 0.12s;
}
.num-chip:hover { border-color: var(--border-strong); }
.num-chip.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Short Answer */
.short-answer { margin-top: 18px; display: flex; gap: 8px; align-items: center; }
.ans-input-wrap { position: relative; flex: 1; max-width: 420px; }
.ans-field {
  width: 100%;
  background: var(--surface-alt); color: var(--text); border: 1.5px solid transparent;
  border-radius: 14px; padding: 12px 40px 12px 15px; font-size: 1rem; font-weight: 500;
  outline: none; transition: border-color 0.12s, background 0.12s;
}
.ans-field:focus { border-color: var(--accent); background: var(--surface); }
.ans-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: var(--border); color: var(--muted); cursor: pointer; font-size: 0.8rem;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Custom Audio Player (Task 1) */
.audio-card {
  margin-top: 16px; background: var(--surface-alt);
  border-radius: 16px; padding: 14px 16px;
}
.audio-row { display: flex; align-items: center; gap: 12px; }
.play-circle {
  width: 44px; height: 44px; border-radius: 50%; border: none; flex-shrink: 0;
  background: var(--accent); color: #fff; font-size: 1rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.audio-track-wrap { flex: 1; min-width: 0; }
.audio-meta { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.audio-range { width: 100%; accent-color: var(--accent); cursor: pointer; margin: 0; }
.speed-pills { display: flex; gap: 4px; margin-top: 10px; }
.speed-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 8px; padding: 4px 10px; font-size: 0.78rem; font-weight: 650; cursor: pointer;
}
.speed-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Essay (Task 13 & Draft) */
.essay-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 12px; }
.essay-tab {
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--text);
  border-radius: 11px; padding: 8px 16px; font-size: 0.9rem; font-weight: 650; cursor: pointer;
}
.essay-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.essay-topic-box {
  background: var(--surface-alt); border-radius: 16px;
  padding: 16px 18px; margin-bottom: 12px; font-size: 0.98rem; line-height: 1.65;
}
.essay-topic-box p { margin: 0 0 6px; }
.essay-criteria { font-size: 0.83rem; color: var(--muted); margin-top: 8px; }

.draft-area { margin-top: 14px; }
.draft-area textarea {
  width: 100%; min-height: 130px; resize: vertical;
  background: var(--surface-alt); color: var(--text); border: 1.5px solid transparent;
  border-radius: 14px; padding: 13px 15px; font-size: 0.96rem; line-height: 1.65; outline: none;
}
.draft-area textarea:focus { border-color: var(--accent); background: var(--surface); }
.word-counter { margin-top: 6px; font-size: 0.8rem; color: var(--muted); display: flex; justify-content: space-between; }
.word-counter .ok-words { color: var(--ok); font-weight: 700; }

/* Subtle FIPI meta drawer inside card */
.meta-drawer {
  margin-top: 14px; padding: 10px 12px; background: var(--surface-alt);
  border-radius: 10px; font-size: 0.8rem; color: var(--muted);
}

/* Desktop Focus Footer & Mobile Floating Thumb Bar */
.focus-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 14px;
}
.thumb-bar { display: none; }

/* Mobile Text Trigger inside Card */
.mobile-text-btn { display: none; margin-bottom: 14px; width: 100%; }

/* Bottom Nav (Mobile Only) */
.bottom-nav { display: none; }

/* Mobile Reading Sheet */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.48); z-index: 60;
}
.reading-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 65;
  max-height: 82vh; background: var(--surface);
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.sheet-handle-bar { display: flex; justify-content: center; padding: 10px 0 4px; }
.sheet-handle { width: 40px; height: 4px; border-radius: 99px; background: var(--border-strong); }
.sheet-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 6px 18px 12px; border-bottom: 1px solid var(--border);
}
.sheet-head b { display: block; font-size: 1rem; }
.sheet-sub { display: block; font-size: 0.78rem; color: var(--muted); }
.sheet-body { padding: 16px 18px 28px; overflow-y: auto; }

/* Stats & Variant */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.stat-val { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-sub { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.chart-card h3 { margin: 0 0 14px; font-size: 1rem; font-weight: 650; }
.bar-row { display: grid; grid-template-columns: 215px 1fr 80px; gap: 12px; align-items: center; margin-bottom: 10px; font-size: 0.87rem; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.bar-label:hover { color: var(--accent); }
.bar-track { height: 10px; background: var(--surface-alt); border-radius: 99px; overflow: hidden; }
.bar-total { height: 100%; background: var(--accent-soft); border-radius: 99px; position: relative; }
.bar-done { height: 100%; background: var(--ok); border-radius: 99px; position: absolute; left: 0; top: 0; }
.bar-nums { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.82rem; }

.variant-section-title {
  margin: 22px 0 10px; font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}

/* Modal & Toast */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  max-width: 560px; width: 100%; padding: 22px 24px; box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-body { font-size: 0.93rem; line-height: 1.6; }
.modal-body ul { padding-left: 18px; }
.modal-body li { margin-bottom: 8px; }

.toast {
  position: fixed; bottom: 82px; left: 50%; transform: translateX(-50%); z-index: 80;
  background: var(--text); color: var(--bg);
  padding: 9px 16px; border-radius: 999px; font-size: 0.86rem; font-weight: 600;
  box-shadow: var(--shadow-lg);
}

.loading-box { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 55vh; gap: 12px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* Responsive Mobile (Bus / School Break Mode) */
@media (max-width: 920px) {
  .split-view { grid-template-columns: 1fr; }
  .reading-pane { display: none; }
  .mobile-text-btn { display: inline-flex; }
  .match-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { padding: 0 12px; height: 54px; }
  .desktop-tabs { display: none; }
  .brand-title { font-size: 0.92rem; }
  .shell { padding: 14px 12px 132px; }
  .hero-card { padding: 18px; border-radius: 18px; }
  .hero-card h1 { font-size: 1.28rem; }
  .card { padding: 18px 16px; border-radius: 18px; }
  .focus-footer { display: none; }

  .thumb-bar {
    position: fixed; left: 10px; right: 10px; bottom: 66px; z-index: 45;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 7px 8px; box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
  }
  .thumb-bar .btn { height: 40px; padding: 0 12px; border-radius: 11px; }
  .thumb-bar .thumb-done { flex: 1; }

  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    height: 58px; padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
    display: grid; grid-template-columns: repeat(5, 1fr);
  }
  .bnav-btn {
    border: none; background: transparent; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 0.7rem; font-weight: 600; cursor: pointer;
  }
  .bnav-ico { font-size: 1.08rem; line-height: 1; }
  .bnav-btn.active { color: var(--accent); }

  .bar-row { grid-template-columns: 135px 1fr 68px; }
}

@media print {
  .topbar, .bottom-nav, .thumb-bar, .session-bar, .focus-footer, .card-tools, .mobile-text-btn, .audio-card, .draft-area, .essay-tabs { display: none !important; }
  body { background: #fff; color: #000; }
  .shell { padding: 0; max-width: 100%; }
  .split-view { display: block; }
  .reading-pane { display: block !important; position: static; max-height: none; border: 1px solid #ccc; margin-bottom: 14px; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
