:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-muted: #f8f5ee;
  --ink: #1e2a39;
  --muted: #756d63;
  --line: rgba(93, 73, 48, 0.13);
  --accent: #2f6f73;
  --accent-soft: #e8f3f1;
  --green: #188565;
  --paper: #fffaf4;
  --wood: #8a5f3f;
  --shadow: 0 22px 60px rgba(94, 65, 37, 0.13);
  --radius: 8px;
  --book-shadow: 0 18px 34px rgba(76, 52, 28, 0.16);
  --lifted-paper: 0 18px 36px rgba(76, 52, 28, 0.12), 0 2px 8px rgba(76, 52, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 8%, rgba(228, 184, 111, 0.16), transparent 30%),
    radial-gradient(circle at 88% 0%, rgba(47, 125, 92, 0.08), transparent 28%),
    linear-gradient(180deg, #fbf8f1 0%, #f4efe6 100%);
  font-family: -apple-system, "SF Pro Text", "PingFang SC", "Noto Sans SC", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr) 248px;
  grid-template-rows: 72px minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar topbar"
    "sidebar reader panel";
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 0%, rgba(226, 174, 94, 0.1), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(47, 125, 92, 0.07), transparent 28%),
    linear-gradient(180deg, #fbf8f1 0%, #f2ecdf 100%);
}

.app-shell.tools-closed {
  grid-template-columns: 196px minmax(0, 1fr) 0;
}

.app-shell.tools-closed .learning-panel {
  display: none;
}

.app-shell.tools-open {
  grid-template-columns: 196px minmax(0, 1fr) 248px;
}

.app-shell.knowledge-mode {
  grid-template-columns: 196px minmax(0, 1fr) 0;
}

.app-shell.knowledge-mode .learning-panel {
  display: none;
}

.app-shell.knowledge-mode .panel-toggle {
  display: none;
}

.app-shell.knowledge-mode .unit-tabs {
  opacity: 0.28;
  pointer-events: none;
}

.app-shell.knowledge-mode .top-actions {
  display: none;
}

.app-shell.knowledge-mode .textbook-nav {
  display: none;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 251, 242, 0.96), rgba(244, 238, 226, 0.98)),
    radial-gradient(circle at 20% 4%, rgba(218, 168, 94, 0.24), transparent 32%),
    radial-gradient(circle at 86% 16%, rgba(47, 111, 115, 0.14), transparent 30%),
    #f6f1e8;
}

.auth-shell {
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
}

.auth-brand {
  justify-content: center;
}

.auth-card {
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid rgba(128, 99, 64, 0.16);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(255, 249, 239, 0.94)),
    var(--paper);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 4px 0 8px;
  font-size: clamp(30px, 9vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

.auth-card p {
  margin: 0;
  color: #5d564e;
  font-size: 14px;
  line-height: 1.6;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.auth-field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(75, 62, 45, 0.18);
  border-radius: 14px;
  outline: 0;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: 4px;
}

.auth-field input:focus {
  border-color: rgba(47, 111, 115, 0.42);
  box-shadow: 0 0 0 4px rgba(47, 111, 115, 0.1);
}

.auth-submit {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  background: #17313a;
  color: #fff;
  font-weight: 900;
}

.auth-error {
  color: #a33a2d !important;
  font-size: 13px !important;
  font-weight: 850;
}

.auth-note {
  color: var(--muted) !important;
  font-size: 12px !important;
}

.shelf-screen {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 30px;
  background:
    linear-gradient(90deg, rgba(111, 83, 47, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, rgba(111, 83, 47, 0.02) 1px, transparent 1px),
    radial-gradient(circle at 18% 0%, rgba(226, 174, 94, 0.2), transparent 35%),
    radial-gradient(circle at 88% 10%, rgba(47, 125, 92, 0.1), transparent 30%),
    linear-gradient(180deg, rgba(255, 252, 244, 0.96), rgba(244, 238, 226, 0.98)),
    #faf8f4;
  background-size: 44px 44px, 44px 44px, auto, auto, auto, auto;
}

.today-shell {
  width: min(1180px, 100%);
  display: grid;
  gap: 18px;
}

.today-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.today-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(76, 52, 28, 0.12);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.72);
  color: #5f5448;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(76, 52, 28, 0.06);
}

button.today-badge {
  appearance: none;
}

.lock-action {
  background: rgba(255, 250, 241, 0.9);
}

.lock-action:hover {
  border-color: rgba(47, 125, 92, 0.28);
  background: #fff;
}

.shelf-card {
  display: grid;
  gap: 30px;
  padding: 32px;
  border: 1px solid rgba(128, 99, 64, 0.12);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 249, 238, 0.92)),
    var(--paper);
  box-shadow: 0 26px 70px rgba(94, 65, 37, 0.12);
  position: relative;
  overflow: hidden;
}

.shelf-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 24px 24px, rgba(138, 95, 63, 0.055) 1px, transparent 1.3px),
    linear-gradient(90deg, rgba(138, 95, 63, 0.025) 1px, transparent 1px);
  background-size: 28px 28px, 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent 55%);
}

.shelf-card > * {
  position: relative;
}

.shelf-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 260px) auto;
  align-items: center;
  gap: 22px;
  min-height: 170px;
}

.shelf-copy {
  display: grid;
  gap: 10px;
}

.shelf-count {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #4d473f;
  border: 1px solid rgba(128, 99, 64, 0.13);
  font-size: 14px;
  font-weight: 850;
  box-shadow: 0 10px 22px rgba(76, 52, 28, 0.08);
}

.today-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.shelf-card h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.05;
  letter-spacing: 0;
}

.shelf-card p {
  margin: 0;
  color: #635a4f;
  font-size: 17px;
  line-height: 1.6;
}

.shelf-hero-art {
  position: relative;
  min-height: 154px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(250, 240, 222, 0.4));
  overflow: hidden;
}

.shelf-hero-art::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 26px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(138, 95, 63, 0.28), rgba(138, 95, 63, 0.08));
}

.art-sun,
.art-book,
.art-pencil,
.art-note {
  position: absolute;
  display: block;
}

.art-sun {
  width: 42px;
  height: 42px;
  top: 20px;
  right: 26px;
  border-radius: 50%;
  background: #f3c66d;
  box-shadow: 0 0 0 12px rgba(243, 198, 109, 0.16);
}

.art-book {
  bottom: 34px;
  width: 62px;
  height: 86px;
  border-radius: 7px 10px 10px 7px;
  box-shadow: 0 12px 22px rgba(76, 52, 28, 0.16);
}

.art-book::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 9px;
  border-radius: 7px 0 0 7px;
  background: rgba(0, 0, 0, 0.14);
}

.art-book-a {
  left: 40px;
  background: #c2410c;
  transform: rotate(-5deg);
}

.art-book-b {
  left: 98px;
  bottom: 32px;
  height: 98px;
  background: #2563eb;
  transform: rotate(4deg);
}

.art-pencil {
  right: 58px;
  bottom: 38px;
  width: 16px;
  height: 96px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #f2c95e 0 72%, #f5e2b9 72% 84%, #343434 84%);
  transform: rotate(24deg);
  box-shadow: 0 12px 18px rgba(76, 52, 28, 0.12);
}

.art-note {
  left: 138px;
  top: 30px;
  width: 60px;
  height: 48px;
  border-radius: 10px;
  background: #fff4bf;
  box-shadow: 0 10px 18px rgba(76, 52, 28, 0.1);
  transform: rotate(-3deg);
}

.shelf-grade {
  display: grid;
  gap: 12px;
}

.shelf-grade-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.shelf-grade-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.shelf-grade-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.compact-books {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-zone,
.volume-zone,
.selected-volume,
.shelf-audio-player {
  display: grid;
  gap: 13px;
}

.quick-zone {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.36);
  border: 1px solid rgba(128, 99, 64, 0.08);
}

.quick-action-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 14px;
}

.quick-action {
  position: relative;
  min-height: 96px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-areas:
    "icon title"
    "icon meta";
  align-content: center;
  gap: 5px 12px;
  padding: 17px 16px 16px;
  border: 1px solid rgba(153, 118, 71, 0.13);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 252, 240, 0.96), rgba(255, 246, 223, 0.92));
  color: var(--ink);
  text-align: left;
  box-shadow: 0 12px 26px rgba(76, 52, 28, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.quick-action::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 22px;
  width: 52px;
  height: 16px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 2px 8px rgba(76, 52, 28, 0.08);
  transform: rotate(-2deg);
}

.quick-action:hover,
.volume-card:hover,
.cover-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--lifted-paper);
}

.quick-action span {
  grid-area: icon;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1e2a39;
  color: #fff;
  font-weight: 850;
}

.quick-action.audio-action span {
  background: #2f6f73;
}

.quick-action strong {
  grid-area: title;
  align-self: end;
  font-size: 16px;
  line-height: 1.25;
}

.quick-action em {
  grid-area: meta;
  color: #74695c;
  font-size: 13px;
  font-style: normal;
}

.shelf-audio-player {
  padding: 20px;
  border: 1px solid rgba(47, 111, 115, 0.2);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(232, 243, 241, 0.96), rgba(255, 250, 241, 0.96)),
    #f4fbf8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 14px 34px rgba(47, 111, 115, 0.08);
}

.shelf-audio-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.shelf-audio-head h2 {
  margin: 2px 0 4px;
  font-size: 22px;
}

.shelf-audio-head button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(18, 107, 89, 0.18);
  border-radius: 999px;
  background: #fff;
  color: #126b59;
  font-weight: 850;
}

.shelf-audio-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.volume-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 0 0 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.volume-grid::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(154, 108, 64, 0.26), rgba(115, 78, 43, 0.14));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46), 0 14px 24px rgba(76, 52, 28, 0.08);
}

.volume-card {
  position: relative;
  z-index: 1;
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 13px 14px 16px;
  border: 1px solid rgba(128, 99, 64, 0.1);
  border-radius: 16px 16px 10px 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 20px rgba(76, 52, 28, 0.06);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.volume-card.active {
  border-color: rgba(47, 125, 92, 0.2);
  background:
    linear-gradient(180deg, #ffffff, #eef7f1);
  box-shadow: 0 16px 26px rgba(76, 52, 28, 0.1);
}

.volume-card.active::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: -8px;
  height: 8px;
  border-radius: 0 0 999px 999px;
  background: #2f7d5c;
}

.volume-card strong {
  font-size: 16px;
  line-height: 1.2;
}

.volume-card span,
.volume-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.3;
}

.book-card {
  min-width: 0;
  display: grid;
  gap: 11px;
  padding: 10px 10px 12px;
  border: 1px solid rgba(128, 99, 64, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 24px rgba(76, 52, 28, 0.055);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.book-card.available {
  border-color: rgba(93, 73, 48, 0.08);
  background: rgba(255, 255, 255, 0.68);
}

.book-card.pending {
  opacity: 0.68;
}

.book-icon {
  grid-area: icon;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 18px;
  font-weight: 850;
}

.book-card strong {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 850;
}

.book-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.cover-card {
  grid-template-rows: auto minmax(0, 1fr);
}

.book-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 0.72;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--subject-color) 18%, #fff), #f8fafc);
  box-shadow:
    0 18px 28px rgba(76, 52, 28, 0.16),
    0 2px 4px rgba(76, 52, 28, 0.08);
}

.book-cover::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 12px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none;
}

.book-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 34%);
  z-index: 1;
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover > span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--subject-color);
  color: #fff;
  font-size: 22px;
  font-weight: 850;
}

.book-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.subject-dot {
  width: fit-content;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--subject-color) 11%, #fff);
  color: var(--subject-color);
  font-size: 11px;
  font-weight: 850;
}

.book-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.book-tools span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(244, 239, 230, 0.7);
  color: #6a5c4b;
  font-size: 11px;
  font-weight: 760;
}

.audio-playlist {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.audio-track {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(47, 111, 115, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  text-align: left;
}

.audio-track.active {
  color: var(--accent);
  background: rgba(232, 243, 241, 0.9);
  border-color: rgba(47, 111, 115, 0.28);
}

.audio-track strong {
  font-size: 12px;
  line-height: 1.25;
}

.audio-track span {
  color: var(--muted);
  font-size: 12px;
}

.today-meta,
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.today-meta span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.continue-button {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 850;
}

.quick-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.topbar {
  grid-area: topbar;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  background: rgba(255, 250, 241, 0.82);
  border-bottom: 1px solid rgba(128, 99, 64, 0.12);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 22px rgba(76, 52, 28, 0.045);
  z-index: 5;
}

.error-banner {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(720px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid rgba(185, 72, 45, 0.28);
  border-radius: var(--radius);
  background: #fff3ee;
  color: #92351d;
  box-shadow: 0 12px 28px rgba(35, 55, 88, 0.14);
  font-size: 13px;
  font-weight: 760;
}

.error-banner.hidden {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  border-radius: 13px;
  background: #1e2a39;
}

.shelf-screen .brand-mark,
.auth-screen .brand-mark {
  background:
    linear-gradient(135deg, #2f7d5c, #1e2a39);
  box-shadow: 0 8px 18px rgba(30, 42, 57, 0.14);
}

.brand-mark {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 850;
}

.brand-title {
  font-size: 17px;
  font-weight: 850;
  line-height: 1.2;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.unit-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  min-width: 0;
  scrollbar-width: none;
}

.unit-tabs::-webkit-scrollbar {
  display: none;
}

.unit-tab {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(128, 99, 64, 0.11);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  font-weight: 760;
}

.unit-tab.active {
  color: var(--accent);
  background: #eef7f1;
  border-color: rgba(47, 125, 92, 0.22);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button,
.zoom-controls button {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(128, 99, 64, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
}

.page-form {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(128, 99, 64, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  white-space: nowrap;
}

.page-form label {
  font-size: 12px;
  font-weight: 760;
}

.page-form input {
  width: 58px;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-weight: 800;
  background: transparent;
}

.sidebar {
  grid-area: sidebar;
  min-width: 0;
  overflow: auto;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.82), rgba(248, 241, 229, 0.86));
  border-right: 1px solid rgba(128, 99, 64, 0.12);
}

.sidebar-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 850;
}

.soft-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.unit-list {
  display: grid;
  gap: 8px;
}

.unit-card {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border: 1px solid rgba(128, 99, 64, 0.11);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  text-align: left;
}

.unit-card.active {
  border-color: rgba(47, 125, 92, 0.24);
  background: #eef7f1;
}

.unit-card strong {
  font-size: 13px;
  line-height: 1.25;
}

.unit-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.learning-nav {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.learning-nav-item {
  position: relative;
  min-height: 40px;
  padding: 0 12px 0 14px;
  border: 1px solid rgba(128, 99, 64, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.learning-nav-item.active {
  color: var(--accent);
  background:
    linear-gradient(180deg, #ffffff, #eef7f1);
  border-color: rgba(47, 125, 92, 0.22);
  box-shadow: 0 10px 18px rgba(76, 52, 28, 0.06);
}

.learning-nav-item.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 5px;
  border-radius: 999px;
  background: #2f7d5c;
}

.compact-heading {
  margin-top: 4px;
  margin-bottom: 10px;
}

.reader-pane {
  grid-area: reader;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.5), transparent 42%);
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 2px 2px 0;
}

.current-unit {
  font-size: 18px;
  font-weight: 880;
  line-height: 1.25;
}

.current-question {
  margin-top: 3px;
  color: #70685f;
  font-size: 13px;
  line-height: 1.35;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-switch {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(128, 99, 64, 0.09);
}

.mode-switch button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.mode-switch button.active {
  border-color: rgba(47, 125, 92, 0.2);
  background: #eef7f1;
  color: var(--accent);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(128, 99, 64, 0.09);
}

.zoom-controls span {
  min-width: 52px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.pdf-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 22px;
  border: 1px solid rgba(128, 99, 64, 0.12);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 8%, rgba(255, 255, 255, 0.62), transparent 32%),
    linear-gradient(90deg, rgba(111, 83, 47, 0.018) 1px, transparent 1px),
    linear-gradient(180deg, rgba(111, 83, 47, 0.015) 1px, transparent 1px),
    #f1eadf;
  background-size: auto, 34px 34px, 34px 34px, auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.knowledge-workspace {
  display: block;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: clamp(14px, 3vw, 34px);
  border: 1px solid rgba(128, 99, 64, 0.12);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 8%, rgba(255, 255, 255, 0.72), transparent 32%),
    linear-gradient(180deg, #fbf7ee, #f1eadf);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.knowledge-mode-layout {
  width: min(100%, 1100px);
  min-height: 420px;
  display: grid;
  grid-template-columns: minmax(178px, 220px) minmax(0, 840px);
  gap: 18px;
  align-items: start;
  justify-content: center;
  margin: 0 auto;
}

.knowledge-rail {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(128, 99, 64, 0.12);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.84);
  box-shadow: 0 16px 32px rgba(76, 52, 28, 0.07);
}

.knowledge-rail-head {
  display: grid;
  gap: 3px;
  padding: 2px 2px 8px;
  border-bottom: 1px solid rgba(128, 99, 64, 0.1);
}

.knowledge-rail-head span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
}

.knowledge-rail-head strong {
  color: var(--ink);
  font-size: 16px;
}

.knowledge-rail-list {
  display: grid;
  gap: 9px;
}

.knowledge-layout {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.22fr);
  gap: 18px;
}

.knowledge-browser,
.knowledge-detail {
  min-width: 0;
  border: 1px solid rgba(128, 99, 64, 0.12);
  border-radius: 20px;
  background: rgba(255, 253, 247, 0.86);
  box-shadow: 0 18px 38px rgba(76, 52, 28, 0.08);
}

.knowledge-browser {
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.knowledge-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.knowledge-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.2;
}

.knowledge-head span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef7f1;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.knowledge-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.knowledge-card-tile {
  min-width: 0;
  min-height: 128px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(128, 99, 64, 0.12);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 252, 240, 0.96), rgba(255, 246, 223, 0.88));
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 22px rgba(76, 52, 28, 0.06);
}

.knowledge-card-tile.active {
  border-color: rgba(47, 125, 92, 0.28);
  background: linear-gradient(180deg, #ffffff, #eef7f1);
  box-shadow: 0 16px 28px rgba(76, 52, 28, 0.1);
}

.knowledge-card-tile span,
.knowledge-card-tile em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.knowledge-card-tile strong {
  font-size: 16px;
  line-height: 1.25;
}

.knowledge-detail {
  width: min(100%, 840px);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px);
}

.knowledge-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(128, 99, 64, 0.12);
}

.knowledge-detail-head span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.knowledge-detail-head h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.15;
}

.knowledge-complete-toggle {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid rgba(128, 99, 64, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(76, 52, 28, 0.06);
}

.knowledge-complete-toggle.done {
  border-color: rgba(47, 125, 92, 0.24);
  background: #eaf6ef;
  color: var(--accent);
}

.knowledge-tabs {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  margin: 18px 0;
  padding-bottom: 4px;
}

.knowledge-tab {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid rgba(128, 99, 64, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.knowledge-tab.active {
  border-color: rgba(47, 125, 92, 0.26);
  background: var(--accent);
  color: #fffdf7;
  box-shadow: 0 10px 20px rgba(47, 125, 92, 0.16);
}

.knowledge-tab.muted:not(.active) {
  opacity: 0.56;
}

.knowledge-section-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.knowledge-section {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(128, 99, 64, 0.11);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
}

.knowledge-section.muted-section {
  opacity: 0.68;
}

.knowledge-section-label {
  width: fit-content;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef7f1;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.knowledge-section-body {
  display: grid;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}

.knowledge-section-body h3,
.knowledge-section-body h4 {
  margin: 0;
  font-size: 17px;
}

.knowledge-section-body p {
  margin: 0;
}

.knowledge-section-body ul {
  margin: 0;
  padding-left: 20px;
}

.knowledge-section-body pre {
  overflow-x: auto;
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: #1e2a39;
  color: #fffaf1;
  font-size: 14px;
  line-height: 1.6;
}

.knowledge-image {
  margin: 4px 0;
  padding: 12px;
  border: 1px solid rgba(128, 99, 64, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.knowledge-image img {
  display: block;
  width: min(100%, 720px);
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
}

.knowledge-study-card {
  display: grid;
  gap: 14px;
  min-height: 360px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(128, 99, 64, 0.11);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 248, 235, 0.92));
  box-shadow:
    0 20px 42px rgba(76, 52, 28, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.knowledge-study-card[data-section-key="formula"] {
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.08), transparent 34%),
    linear-gradient(180deg, #fffdf7, #f3f7ff);
}

.knowledge-study-card[data-section-key="formula"] .knowledge-section-body pre,
.knowledge-study-card[data-section-key="equation"] .knowledge-section-body pre {
  background: #f6f9ff;
  color: #183153;
  border: 1px solid rgba(37, 99, 235, 0.13);
  font-size: 16px;
  font-weight: 800;
}

.knowledge-study-card[data-section-key="common_mistakes"] {
  background:
    radial-gradient(circle at 100% 0%, rgba(194, 65, 12, 0.08), transparent 34%),
    linear-gradient(180deg, #fffdf7, #fff4ec);
}

.knowledge-study-card[data-section-key="common_mistakes"] .knowledge-section-label {
  background: #fff0e6;
  color: #c2410c;
}

.knowledge-study-card[data-section-key="quick_check"] {
  background:
    radial-gradient(circle at 100% 0%, rgba(47, 125, 92, 0.1), transparent 34%),
    linear-gradient(180deg, #fffdf7, #eef7f1);
}

.knowledge-study-card[data-section-key="quick_check"] .knowledge-section-label {
  background: #e5f4ec;
  color: var(--accent);
}

.knowledge-study-card .note-label {
  width: fit-content;
  display: inline-flex;
  margin-top: 2px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(47, 125, 92, 0.1);
  color: var(--accent);
  font-size: 12px;
}

.knowledge-directory-card.done {
  background: linear-gradient(180deg, #ffffff, #eef7f1);
  border-color: rgba(47, 125, 92, 0.22);
}

.knowledge-refresh-button {
  width: fit-content;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(47, 125, 92, 0.24);
  border-radius: 999px;
  background: var(--accent);
  color: #fffdf7;
  font-weight: 850;
}

#pdfCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  border-radius: 4px;
  box-shadow:
    0 26px 54px rgba(76, 52, 28, 0.18),
    0 4px 10px rgba(76, 52, 28, 0.1);
}

.loading-state {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  box-shadow: 0 10px 24px rgba(35, 55, 88, 0.1);
}

.loading-state.hidden {
  display: none;
}

.learning-panel {
  grid-area: panel;
  min-width: 0;
  overflow: auto;
  padding: 18px;
  background: rgba(255, 250, 241, 0.86);
  border-left: 1px solid rgba(128, 99, 64, 0.12);
}

.panel-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(35, 55, 88, 0.06);
}

.panel-section + .panel-section {
  margin-top: 14px;
}

.panel-kicker {
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.panel-section h2,
.panel-section h3 {
  margin: 8px 0 7px;
  font-size: 18px;
  line-height: 1.25;
}

.panel-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.overlay-card {
  padding: 0;
  overflow: hidden;
}

.overlay-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 0 16px 12px;
}

.overlay-head h3 {
  margin: 7px 0 0;
}

.overlay-head span,
.tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.overlay-card .panel-kicker {
  padding: 16px 16px 0;
}

.overlay-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--line);
}

.overlay-tabs button {
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-align: center;
}

.overlay-tabs button.active {
  border-color: rgba(33, 103, 210, 0.25);
  background: var(--accent-soft);
  color: var(--accent);
}

.overlay-body {
  display: grid;
  gap: 12px;
  max-height: min(54vh, 520px);
  overflow: auto;
  padding: 14px 16px 16px;
}

.search-field {
  position: sticky;
  top: -14px;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  background: var(--surface);
}

.search-field input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: var(--surface-muted);
  color: var(--ink);
}

.search-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.vocab-list {
  display: grid;
  gap: 8px;
}

.vocab-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.vocab-row div {
  display: grid;
  gap: 3px;
}

.vocab-row strong {
  font-size: 14px;
  line-height: 1.2;
}

.vocab-row span,
.task-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.vocab-row p {
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

.grammar-card,
.review-card,
.task-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.grammar-card h4,
.review-card h4 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.compare-grid {
  display: grid;
  gap: 10px;
}

.compare-grid section,
.rule-box {
  display: grid;
  gap: 6px;
  padding: 11px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid rgba(28, 42, 64, 0.08);
}

.compare-grid strong,
.rule-box strong,
.task-card strong {
  font-size: 13px;
}

.compare-grid em {
  color: var(--accent);
  font-size: 13px;
  font-style: normal;
  font-weight: 780;
}

.rule-box span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.practice-list,
.task-list {
  display: grid;
  gap: 9px;
}

.practice-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.practice-item summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  padding: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  list-style: none;
}

.practice-item summary::-webkit-details-marker {
  display: none;
}

.practice-item summary span {
  color: var(--accent);
  font-weight: 850;
}

.practice-item p {
  padding: 0 12px 12px 42px;
  color: var(--green);
  font-weight: 780;
}

.review-card {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.progress-ring {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 56%, transparent 58%),
    conic-gradient(var(--accent) 0deg, rgba(33, 103, 210, 0.16) 0deg);
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
}

.task-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.empty-state {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px dashed rgba(28, 42, 64, 0.2);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.empty-state span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

audio {
  width: 100%;
  margin-top: 14px;
  accent-color: var(--accent);
}

.audio-error {
  margin-top: 10px;
  color: #92351d;
  font-size: 12px;
  font-weight: 760;
}

.audio-error.hidden {
  display: none;
}

.compact {
  display: grid;
  gap: 12px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.stat-row strong {
  color: var(--ink);
}

.panel-toggle {
  display: none;
}

@media (max-width: 1180px) {
  .book-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .shelf-intro {
    grid-template-columns: minmax(0, 1fr) 220px;
  }

  .shelf-count {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .volume-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shelf-audio-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 72px auto minmax(0, 1fr) 260px;
    grid-template-areas:
      "topbar"
      "sidebar"
      "reader"
      "panel";
  }

  .app-shell.tools-closed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 72px auto minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "sidebar"
      "reader";
  }

  .app-shell.tools-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.knowledge-mode {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .sidebar {
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
  }

  .sidebar-heading {
    display: none;
  }

  .unit-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .unit-card {
    min-width: 220px;
  }

  .learning-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.45fr) minmax(220px, 0.7fr);
    gap: 12px;
    overflow: auto;
  }

  .knowledge-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .knowledge-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overlay-body {
    max-height: 220px;
  }

  .panel-section + .panel-section {
    margin-top: 0;
  }
}

@media (max-width: 760px) {
  .shelf-screen {
    align-items: stretch;
    padding: 14px;
  }

  .today-shell {
    align-content: start;
  }

  .shelf-card {
    padding: 16px;
    gap: 20px;
    border-radius: 16px;
  }

  .today-header,
  .shelf-audio-head {
    align-items: start;
    grid-template-columns: minmax(0, 1fr);
  }

  .shelf-intro {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    gap: 14px;
  }

  .shelf-hero-art {
    min-height: 118px;
    order: 2;
  }

  .shelf-count {
    width: fit-content;
    order: 3;
  }

  .shelf-card p {
    font-size: 15px;
  }

  .quick-zone {
    padding: 13px;
    border-radius: 16px;
  }

  .quick-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .quick-action.audio-action {
    grid-column: 1 / -1;
  }

  .volume-grid {
    display: flex;
    gap: 9px;
    overflow-x: auto;
    padding-bottom: 20px;
    scroll-snap-type: x proximity;
  }

  .volume-card {
    flex: 0 0 152px;
    min-height: 76px;
    border-radius: 14px;
    scroll-snap-align: start;
  }

  .book-grid,
  .compact-books {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .shelf-audio-list {
    grid-template-columns: minmax(0, 1fr);
    max-height: 40vh;
    overflow: auto;
  }

  .book-card {
    padding: 8px;
    border-radius: 14px;
  }

  .book-cover {
    border-radius: 9px;
  }

  .book-card strong {
    font-size: 15px;
  }

  .book-tools span {
    font-size: 10px;
  }

  .quick-action {
    min-height: 78px;
    padding: 12px;
    border-radius: 14px;
  }

  .quick-action span {
    width: 36px;
    height: 36px;
  }

  .quick-action strong {
    font-size: 14px;
  }

  .app-shell {
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "sidebar"
      "reader";
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .brand {
    justify-content: space-between;
  }

  .brand-subtitle {
    white-space: normal;
  }

  .unit-tabs {
    order: 3;
  }

  .top-actions {
    justify-content: stretch;
  }

  .page-form {
    flex: 1;
    justify-content: center;
  }

  .sidebar {
    padding: 8px 10px;
  }

  .unit-card {
    min-width: 184px;
    padding: 11px;
  }

  .reader-pane {
    padding: 10px;
  }

  .reader-toolbar {
    align-items: flex-start;
    gap: 10px;
  }

  .current-unit {
    font-size: 16px;
  }

  .toolbar-controls {
    align-items: flex-end;
    flex-direction: column;
    gap: 7px;
  }

  .mode-switch {
    max-width: 188px;
    overflow-x: auto;
  }

  .mode-switch button {
    padding: 0 9px;
  }

  .zoom-controls {
    gap: 5px;
    padding: 4px;
  }

  .zoom-controls button {
    width: 34px;
    height: 34px;
  }

  .pdf-stage {
    padding: 10px;
  }

  .knowledge-workspace {
    padding: 10px;
    border-radius: 14px;
  }

  .knowledge-mode-layout {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .knowledge-rail {
    padding: 10px;
    border-radius: 14px;
  }

  .knowledge-rail-list {
    display: flex;
    gap: 9px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .knowledge-rail-list .knowledge-directory-card {
    flex: 0 0 178px;
  }

  .knowledge-detail {
    border-radius: 16px;
  }

  .knowledge-detail {
    padding: 14px;
  }

  .knowledge-detail-head h2 {
    font-size: 24px;
  }

  .knowledge-detail-head {
    display: grid;
  }

  .knowledge-complete-toggle {
    width: fit-content;
  }

  .knowledge-section {
    padding: 13px;
  }

  .sidebar {
    display: none;
  }

  .reader-pane {
    padding-bottom: 224px;
  }

  .learning-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 78vh;
    display: block;
    padding: 212px 14px 14px;
    border-top: 1px solid var(--line);
    background: #fbfcfe;
    box-shadow: 0 -20px 44px rgba(35, 55, 88, 0.16);
    transform: translateY(calc(100% - 206px));
    transition: transform 180ms ease;
    z-index: 8;
  }

  .learning-panel .audio-card {
    position: absolute;
    top: 12px;
    left: 14px;
    right: 14px;
    padding: 12px 14px;
  }

  .learning-panel .audio-card h2 {
    margin: 5px 0 4px;
    font-size: 15px;
  }

  .learning-panel .audio-card p {
    display: none;
  }

  .learning-panel .audio-card audio {
    margin-top: 8px;
  }

  .overlay-body {
    max-height: 48vh;
  }

  .learning-panel.open {
    transform: translateY(0);
  }

  .panel-toggle {
    display: block;
    position: fixed;
    right: 14px;
    bottom: 218px;
    z-index: 9;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--radius);
    background: var(--ink);
    color: #fff;
    font-weight: 850;
    box-shadow: 0 12px 28px rgba(35, 55, 88, 0.22);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
