:root {
  color-scheme: light;
  --paper: #f3eee4;
  --paper-warm: #eee6d7;
  --paper-light: #fbf7ef;
  --paper-page: #fffaf1;
  --ink: #29312c;
  --ink-soft: #4c554f;
  --muted: #7d827a;
  --muted-dark: #686f68;
  --terracotta: #a86650;
  --terracotta-deep: #88503e;
  --terracotta-pale: #ead8cd;
  --sage: #748678;
  --sage-deep: #526458;
  --sage-pale: #dce3d7;
  --gold: #b19769;
  --gold-pale: #e7dcc4;
  --line: rgba(63, 72, 63, 0.16);
  --line-strong: rgba(63, 72, 63, 0.27);
  --panel: rgba(249, 245, 236, 0.88);
  --panel-solid: #f8f3e9;
  --window-chrome: #f8f3e9;
  --shadow: 0 18px 50px rgba(68, 58, 43, 0.08), 0 2px 8px rgba(68, 58, 43, 0.04);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", SimSun, Georgia, serif;
  --sans: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  --reader-size: 17px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(to bottom, var(--window-chrome) 0, var(--window-chrome) 76px, rgba(248, 243, 233, 0) 190px),
    radial-gradient(circle at 52% 6%, rgba(255, 253, 247, 0.92), transparent 34%),
    radial-gradient(circle at 7% 90%, rgba(221, 213, 191, 0.3), transparent 30%),
    linear-gradient(135deg, #f6f1e7 0%, #f0eadd 48%, #f4eee3 100%);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

button,
a,
input,
textarea,
select {
  outline-color: var(--terracotta);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  box-shadow: 0 0 0 3px rgba(168, 102, 80, 0.18);
}

svg {
  display: block;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.page-atmosphere {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  color: #7d7767;
}

.page-atmosphere::before,
.page-atmosphere::after {
  position: absolute;
  content: "";
  background-repeat: repeat;
}

.page-atmosphere::before {
  inset: 0;
  opacity: 0.25;
  background-image:
    linear-gradient(90deg, rgba(90, 91, 72, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(90, 91, 72, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 92%);
}

.page-atmosphere::after {
  top: 78px;
  left: 4px;
  right: 4px;
  height: 9px;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='9' viewBox='0 0 96 9'%3E%3Cpath fill='none' stroke='%23596155' stroke-width='1' d='M0 8h9V1h12v7h9v-4H12v-1h14V2h11v6h9V1h12v7h9v-4H52V3h14v1h11v5h9V1h12v7h9v-4H77v-1h14V2h5'/%3E%3C/svg%3E");
}

.temple-lines {
  position: absolute;
  top: 18px;
  right: -3vw;
  width: min(1180px, 84vw);
  height: 86vh;
  opacity: 0.115;
  color: var(--ink-soft);
}

.golden-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.075;
  color: var(--gold);
}

.paper-grain {
  position: absolute;
  inset: 0;
  opacity: 0.24;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, transparent 0, transparent 2px, rgba(105, 92, 68, 0.025) 3px, transparent 4px),
    repeating-linear-gradient(93deg, transparent 0, transparent 41px, rgba(121, 105, 77, 0.018) 42px, transparent 44px);
  mix-blend-mode: multiply;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1880px, 100%);
  height: 100vh;
  margin: 0 auto;
}

.app-header {
  position: relative;
  z-index: 60;
  flex: 0 0 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
}

.header-start {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-seal {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(250, 246, 237, 0.66);
  color: var(--terracotta-deep);
}

.brand-seal svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.reading-time {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.reading-time-caption {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.09em;
}

.reading-time strong {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.account-chip {
  display: inline-flex;
  height: 32px;
  padding: 3px 10px 3px 4px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(80, 85, 73, 0.13);
  border-radius: 999px;
  color: var(--muted-dark);
  background: rgba(250, 246, 237, 0.52);
  font-size: 9px;
  cursor: pointer;
}

.account-chip:hover {
  border-color: var(--line-strong);
  color: var(--terracotta-deep);
}

.account-avatar {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-light);
  background: var(--sage-deep);
  font-family: var(--serif);
  font-size: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 12px;
}

.icon-button,
.ghost-icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.icon-button:hover,
.ghost-icon-button:hover {
  border-color: var(--line);
  color: var(--terracotta-deep);
  background: rgba(255, 251, 244, 0.7);
}

.icon-button svg,
.ghost-icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(230px, 0.58fr) minmax(0, 2.72fr);
  gap: 14px;
  min-height: 0;
  padding: 0 20px 20px;
}

.panel {
  position: relative;
  min-width: 0;
  border: 1px solid rgba(73, 80, 70, 0.14);
  border-radius: 18px;
  background:
    linear-gradient(150deg, rgba(255, 252, 247, 0.28), transparent 36%),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(13px) saturate(0.92);
  -webkit-backdrop-filter: blur(13px) saturate(0.92);
}

.panel::after {
  position: absolute;
  z-index: -1;
  inset: 5px;
  border: 1px solid rgba(104, 99, 81, 0.065);
  border-radius: 13px;
  content: "";
  pointer-events: none;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.panel-heading h1,
.panel-heading h2 {
  margin: 3px 0 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.library-title-button {
  display: block;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
  cursor: zoom-in;
}

.library-title-button:hover .library-title-text {
  color: var(--terracotta-deep);
}

.library-title-text {
  display: block;
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.08em;
  transition: color 160ms ease;
}

.library-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-heading h2 {
  font-size: 18px;
}

.eyebrow {
  display: block;
  color: var(--terracotta);
  font-family: var(--serif);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.23em;
  line-height: 1.2;
}

.panel-index {
  padding-top: 4px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.15em;
}

.market-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px 18px 16px;
}

.market-heading {
  padding: 0 3px;
}

.panel-intro {
  margin: 10px 3px 17px;
  color: var(--muted-dark);
  font-size: 11px;
  line-height: 1.75;
}

.import-card {
  position: relative;
  display: flex;
  min-height: 183px;
  padding: 18px 12px 15px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(111, 98, 71, 0.26);
  border-radius: 12px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 252, 244, 0.78), rgba(242, 232, 214, 0.58)),
    repeating-linear-gradient(0deg, transparent 0, transparent 21px, rgba(102, 93, 72, 0.025) 22px);
  cursor: pointer;
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.import-card::before,
.import-card::after {
  position: absolute;
  width: 54px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line-strong), transparent);
  content: "";
}

.import-card::before {
  top: 14px;
}

.import-card::after {
  bottom: 14px;
}

.import-card:hover {
  border-color: rgba(141, 86, 65, 0.58);
  box-shadow: 0 11px 25px rgba(92, 74, 49, 0.08);
  transform: translateY(-1px);
}

.import-emblem {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 11px;
  place-items: center;
  border: 1px solid rgba(132, 78, 61, 0.38);
  border-radius: 50%;
  color: var(--terracotta-deep);
  background: rgba(252, 247, 237, 0.74);
}

.import-emblem svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.import-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.import-hint {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.import-action {
  margin-top: 13px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--terracotta);
  color: var(--terracotta-deep);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.drop-veil {
  position: absolute;
  z-index: 10;
  inset: 9px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--terracotta);
  border-radius: 14px;
  opacity: 0;
  color: var(--terracotta-deep);
  background: rgba(247, 239, 225, 0.96);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.1em;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.market-panel.dragging .drop-veil {
  opacity: 1;
}

.section-rule {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 17px 3px 12px;
}

.section-rule span {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.section-rule i {
  width: 5px;
  height: 5px;
  border: 1px solid var(--gold);
  transform: rotate(45deg);
}

.market-recent {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mini-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3px 9px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.mini-heading span:last-child {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0;
}

.recent-list {
  min-height: 72px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.recent-book {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 3px;
  border-bottom: 1px solid rgba(74, 80, 70, 0.08);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.recent-book:hover .recent-title {
  color: var(--terracotta-deep);
}

.recent-cover {
  display: grid;
  width: 25px;
  height: 33px;
  place-items: center;
  border-radius: 2px 4px 4px 2px;
  color: var(--paper-light);
  background: var(--cover, var(--sage));
  font-family: var(--serif);
  font-size: 9px;
  box-shadow: inset 2px 0 rgba(255, 255, 255, 0.14);
}

.recent-copy {
  min-width: 0;
}

.recent-title {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 150ms ease;
}

.recent-meta {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-arrow {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 12px;
}

.recent-empty {
  padding: 17px 3px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 10px;
  line-height: 1.7;
}

.market-note {
  display: flex;
  gap: 9px;
  margin-top: 12px;
  padding: 11px 10px;
  border: 1px solid rgba(106, 113, 100, 0.11);
  border-radius: 9px;
  color: var(--muted-dark);
  background: rgba(237, 231, 218, 0.42);
}

.market-note > svg {
  width: 16px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--sage-deep);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.3;
}

.market-note strong {
  display: block;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.market-note p {
  margin: 3px 0 0;
  font-size: 9px;
  line-height: 1.6;
}

.library-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 20px 15px;
  overflow: hidden;
}

.library-backdrop {
  position: fixed;
  z-index: 45;
  inset: 0;
  opacity: 0;
  background: rgba(54, 53, 45, 0.18);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 320ms ease;
}

.library-backdrop.visible {
  opacity: 1;
}

.library-panel.library-expanded {
  position: fixed;
  z-index: 55;
  top: 70px;
  right: clamp(10px, 2.4vw, 36px);
  bottom: 10px;
  left: clamp(10px, 2.4vw, 36px);
  width: auto;
  height: auto;
  max-width: none;
  margin: 0;
  box-shadow: 0 32px 100px rgba(45, 40, 30, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  will-change: transform;
}

.library-panel.library-expanded .library-title-button {
  cursor: zoom-out;
}

.library-panel.library-expanded .shelf-toolbar,
.library-panel.library-expanded .book-shelf {
  display: none;
}

.library-panel.library-expanded .reading-room {
  margin-top: 8px;
  padding-top: 10px;
}

.library-panel.library-expanded .reader-content {
  grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.72fr);
  gap: 16px;
}

.library-panel.library-expanded .annotation-rail {
  padding-left: 16px;
}

.library-panel.library-expanded .book-shelf {
  flex-basis: 150px;
}

.library-panel.library-expanded .page-paper {
  padding-right: clamp(35px, 7vw, 96px);
  padding-left: clamp(35px, 7vw, 96px);
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: clamp(160px, 18vw, 230px);
  padding: 7px 10px;
  border: 1px solid rgba(70, 79, 68, 0.15);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.55);
}

.search-box svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted-dark);
  stroke-linecap: round;
  stroke-width: 1.5;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 11px;
}

.search-box input:focus {
  outline: none;
}

.search-box:focus-within {
  border-color: rgba(168, 102, 80, 0.5);
  box-shadow: 0 0 0 3px rgba(168, 102, 80, 0.09);
}

.shelf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 2px 9px;
}

.shelf-filters {
  display: flex;
  gap: 6px;
}

.filter-chip,
.mode-chip {
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted-dark);
  background: transparent;
  font-size: 9px;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.filter-chip:hover,
.mode-chip:hover {
  color: var(--terracotta-deep);
}

.filter-chip.active,
.mode-chip.active {
  border-color: rgba(126, 104, 75, 0.19);
  color: var(--ink);
  background: rgba(231, 221, 202, 0.5);
}

.shelf-count {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.book-shelf {
  position: relative;
  flex: 0 0 142px;
  display: grid;
  grid-auto-columns: minmax(151px, 1fr);
  grid-auto-flow: column;
  gap: 9px;
  min-width: 0;
  padding: 0 1px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.book-shelf::after {
  position: absolute;
  right: 1px;
  bottom: 10px;
  left: 1px;
  height: 2px;
  background: linear-gradient(to right, transparent, rgba(94, 82, 61, 0.2) 4%, rgba(94, 82, 61, 0.2) 96%, transparent);
  box-shadow: 0 5px 7px -5px rgba(86, 73, 52, 0.55);
  content: "";
  pointer-events: none;
}

.book-item {
  position: relative;
  display: flex;
  min-width: 0;
  padding: 10px 10px 11px 13px;
  flex-direction: column;
  border: 1px solid rgba(83, 84, 69, 0.12);
  border-radius: 9px;
  text-align: left;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.25), transparent 48%),
    rgba(249, 245, 236, 0.63);
  cursor: pointer;
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.book-item::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--cover, var(--sage));
  content: "";
  opacity: 0.78;
}

.book-item:hover {
  border-color: rgba(94, 91, 72, 0.27);
  background-color: rgba(252, 248, 239, 0.88);
  transform: translateY(-2px);
}

.book-item.selected {
  border-color: rgba(148, 93, 71, 0.45);
  background:
    linear-gradient(115deg, rgba(255, 251, 243, 0.83), rgba(239, 229, 211, 0.58));
}

.book-item.selected::after {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--terracotta);
  content: "";
}

.book-category {
  overflow: hidden;
  padding-right: 12px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-title {
  display: -webkit-box;
  margin-top: 9px;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.book-author {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-dark);
  font-family: var(--serif);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-reading-time {
  margin-top: 7px;
  color: var(--terracotta-deep);
  font-family: var(--serif);
  font-size: 8px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.book-progress {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 8px;
  color: var(--muted);
  font-size: 8px;
}

.book-progress-track {
  flex: 1;
  height: 2px;
  background: rgba(74, 79, 69, 0.12);
}

.book-progress-track i {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  background: var(--cover, var(--sage));
}

.shelf-empty {
  display: flex;
  grid-column: 1 / -1;
  min-height: 120px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 11px;
}

.shelf-empty span {
  margin-bottom: 7px;
  color: var(--gold);
  font-size: 24px;
}

.reading-room {
  flex: 1;
  display: flex;
  min-height: 0;
  margin-top: 2px;
  padding-top: 12px;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.reader-topbar {
  flex: 0 0 48px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 1px 2px 0;
}

.reader-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.reading-status {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(168, 102, 80, 0.25);
  border-radius: 3px;
  color: var(--terracotta-deep);
  font-family: var(--serif);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.identity-divider {
  width: 1px;
  height: 25px;
  background: var(--line);
}

.reader-title-wrap {
  min-width: 0;
}

.reader-title-wrap h2 {
  margin: 0;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-title-wrap p {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
}

.tool-button {
  position: relative;
  display: inline-grid;
  min-width: 29px;
  height: 29px;
  padding: 0 6px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted-dark);
  background: transparent;
  font-family: var(--serif);
  font-size: 10px;
  cursor: pointer;
}

.tool-button:hover,
.tool-button.active {
  border-color: var(--line);
  color: var(--terracotta-deep);
  background: rgba(255, 252, 246, 0.68);
}

.tool-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.tool-button.active svg {
  fill: rgba(168, 102, 80, 0.12);
}

.pdf-zoom-button {
  display: none;
  font-size: 14px;
  line-height: 1;
}

.app-shell.reading-focus .pdf-zoom-button:not([hidden]) {
  display: inline-grid;
}

.pdf-zoom-button:disabled {
  opacity: 0.3;
  cursor: default;
}

[data-tooltip]::after {
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 6px);
  left: 50%;
  width: max-content;
  max-width: 130px;
  padding: 5px 7px;
  border-radius: 4px;
  opacity: 0;
  color: var(--paper-light);
  background: var(--ink);
  content: attr(data-tooltip);
  font-family: var(--sans);
  font-size: 9px;
  pointer-events: none;
  transform: translate(-50%, 2px);
  transition: opacity 140ms ease, transform 140ms ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.reader-content {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.72fr);
  gap: 14px;
  min-height: 0;
}

.reading-stage {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.note-form.note-popover {
  position: absolute;
  z-index: 35;
  right: 18px;
  bottom: 116px;
  width: min(390px, calc(100% - 36px));
  margin: 0;
  padding: 12px;
  border-color: rgba(118, 83, 64, 0.24);
  background: rgba(255, 250, 241, 0.98);
  box-shadow: 0 16px 44px rgba(54, 46, 34, 0.22);
}

.note-popover-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.note-close-button {
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.note-close-button:hover {
  color: var(--terracotta-deep);
  background: var(--terracotta-pale);
}

.note-close-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.page-paper {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 29px clamp(24px, 5vw, 54px) 28px;
  border: 1px solid rgba(80, 75, 60, 0.11);
  border-radius: 3px 9px 9px 3px;
  background:
    linear-gradient(90deg, rgba(120, 104, 76, 0.04), transparent 8%, transparent 94%, rgba(120, 104, 76, 0.035)),
    var(--paper-page);
  box-shadow: 2px 4px 13px rgba(83, 72, 52, 0.06), inset 8px 0 16px -16px rgba(70, 59, 40, 0.4);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.empty-reader {
  display: flex;
  height: 100%;
  min-height: 240px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-ornament {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  place-items: center;
  border: 1px solid rgba(155, 132, 94, 0.33);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 24px;
}

.empty-ornament svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
}

.empty-reader h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.empty-reader p {
  max-width: 310px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}

.reading-page {
  max-width: 650px;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: var(--reader-size);
  line-height: 1.95;
}

.reading-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.reading-page h3 {
  margin: 0 0 17px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.reading-page p {
  margin: 0 0 1em;
  color: #343a35;
  text-align: justify;
}

.reading-page p:first-of-type::first-letter {
  float: left;
  margin: 0.06em 0.08em 0 0;
  color: var(--terracotta-deep);
  font-size: 2.75em;
  line-height: 0.82;
}

.reading-page blockquote {
  margin: 1.4em 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--gold);
  color: var(--ink-soft);
  font-style: italic;
}

.reading-page .page-number {
  margin-top: 25px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.reading-page.text-document {
  white-space: pre-wrap;
  word-break: break-word;
}

.pdf-reader {
  width: 100%;
  height: 100%;
  min-height: 380px;
  border: 0;
  border-radius: 3px;
  background: #f7f4ec;
}

.page-paper.pdf-mode {
  padding: 0;
  overflow: hidden;
}

.pdf-reader-wrap {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
}

.pdf-reader-wrap .pdf-reader {
  flex: 1;
  min-height: 0;
}

.pdf-reader-view {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.pdf-reader-view .pdf-toolbar {
  flex: 0 0 auto;
  background: rgba(248, 243, 233, 0.97);
}

.pdf-reader-scroll {
  position: relative;
  display: flex;
  min-height: 0;
  padding: 20px 16px 30px;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  overflow: auto;
  background:
    radial-gradient(circle at 30% 10%, rgba(255, 255, 255, 0.4), transparent 36%),
    #e9e2d5;
  scrollbar-width: thin;
  scrollbar-color: rgba(92, 85, 70, 0.35) transparent;
}

.pdf-reader-scroll.is-zoomed {
  align-items: safe center;
}

.pdf-reader-scroll.is-zoomed .pdf-page {
  max-width: none;
}

.pdf-page {
  position: relative;
  flex: 0 0 auto;
  max-width: 100%;
  padding: 0;
  background: #fffaf3;
  box-shadow: 0 10px 28px rgba(57, 50, 37, 0.15);
  transition: outline-color 180ms ease;
  outline: 2px solid transparent;
  outline-offset: 3px;
}

.pdf-page.is-current {
  outline-color: rgba(168, 102, 80, 0.22);
}

.pdf-page.flash {
  outline-color: rgba(168, 102, 80, 0.74);
}

.pdf-page-surface {
  position: relative;
  overflow: hidden;
  background: #fff;
}

.pdf-page-surface canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pdf-text-layer {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  line-height: 1;
  opacity: 1;
  transform-origin: 0 0;
}

.pdf-text-layer span,
.pdf-text-layer br {
  position: absolute;
  color: transparent;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;
}

.pdf-text-layer span::selection {
  color: transparent;
  background: rgba(206, 144, 84, 0.36);
}

.pdf-page-highlights {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
}

.pdf-page-drawings {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.pdf-page-drawings polyline {
  fill: none;
  stroke: rgba(169, 102, 66, 0.72);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: stroke;
}

.pdf-highlight {
  position: absolute;
  border-radius: 2px;
  opacity: 0.34;
  background: var(--highlight-color, #d7aa62);
  box-shadow: 0 0 0 1px rgba(164, 104, 73, 0.08);
  mix-blend-mode: multiply;
}

.pdf-text-annotation {
  position: absolute;
  z-index: 4;
  display: block;
  width: 32%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #8b4e3c;
  background: transparent;
  box-shadow: none;
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: auto;
  cursor: text;
}
.pdf-text-annotation:hover,
.pdf-text-annotation:focus-visible {
  outline: 1px dotted rgba(139, 78, 60, 0.45);
  outline-offset: 3px;
}
.pdf-text-annotation.draft {
  cursor: grab;
  touch-action: none;
  outline: 1px dashed rgba(139, 78, 60, 0.45);
  outline-offset: 3px;
}
.pdf-text-annotation.draft:active { cursor: grabbing; }

.pdf-reader-scroll[data-tool="note"] .pdf-page-surface,
.pdf-reader-scroll[data-tool="pen"] .pdf-page-surface,
.pdf-reader-scroll[data-tool="eraser"] .pdf-page-surface {
  cursor: crosshair;
}

.pdf-reader-scroll[data-tool="pen"],
.pdf-reader-scroll[data-tool="eraser"] {
  overscroll-behavior: contain;
  touch-action: none;
}

.pdf-reader-scroll[data-tool="pen"] .pdf-page-surface,
.pdf-reader-scroll[data-tool="eraser"] .pdf-page-surface {
  user-select: none;
}

.pdf-reader-scroll[data-tool="eraser"] .pdf-page-surface {
  cursor: cell;
}

.pdf-reader-scroll[data-tool="pen"] .pdf-page-surface {
  cursor: crosshair;
}

.pdf-reader-scroll[data-tool="note"] .pdf-text-layer,
.pdf-reader-scroll[data-tool="pen"] .pdf-text-layer,
.pdf-reader-scroll[data-tool="eraser"] .pdf-text-layer {
  pointer-events: none;
}

.pdf-page-tools {
  display: none;
  align-items: center;
  gap: 4px;
}

.library-panel.library-expanded .pdf-page-tools,
.app-shell.reading-focus .pdf-page-tools {
  display: flex;
}

.pdf-tool-divider {
  width: 1px;
  height: 16px;
  margin: 0 3px;
  background: var(--line);
}

.pdf-color-swatches {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pdf-color-swatch {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid rgba(255, 252, 245, 0.9);
  border-radius: 50%;
  background: var(--swatch-color);
  box-shadow: 0 0 0 1px rgba(82, 76, 62, 0.2);
  cursor: pointer;
}

.pdf-color-swatch.active {
  box-shadow: 0 0 0 2px var(--ink-soft);
}

.pdf-tool-button {
  display: inline-flex;
  height: 27px;
  padding: 0 10px;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted-dark);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.pdf-tool-button:hover {
  color: var(--terracotta-deep);
  background: rgba(239, 229, 213, 0.52);
}

.pdf-tool-button.active {
  border-color: rgba(148, 91, 68, 0.3);
  color: var(--terracotta-deep);
  background: rgba(237, 220, 201, 0.66);
}

.pdf-page-number {
  position: absolute;
  right: 10px;
  bottom: -18px;
  color: var(--muted-dark);
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.pdf-page-loading {
  display: grid;
  min-height: 300px;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 252, 246, 0.75);
  font-family: var(--serif);
  font-size: 10px;
}

.pdf-selection-action {
  position: absolute;
  z-index: 20;
  display: flex;
  padding: 4px;
  gap: 2px;
  border: 1px solid rgba(83, 77, 63, 0.18);
  border-radius: 7px;
  background: rgba(251, 246, 236, 0.98);
  box-shadow: 0 7px 20px rgba(61, 51, 35, 0.16);
}

.pdf-selection-action button {
  padding: 6px 9px;
  border-radius: 4px;
  color: var(--terracotta-deep);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.pdf-selection-action button:hover {
  background: rgba(232, 216, 196, 0.68);
}

.pdf-empty-state {
  display: flex;
  min-height: 320px;
  padding: 28px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.pdf-empty-state strong {
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
}

.pdf-empty-state p {
  max-width: 360px;
  margin: 0;
  font-size: 10px;
  line-height: 1.7;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-dark);
  font-size: 9px;
}

.pdf-open-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--terracotta-deep);
  text-decoration: none;
}

.pdf-open-link svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.page-footer {
  flex: 0 0 37px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 5px 2px 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.library-panel.library-expanded .page-footer,
.app-shell.reading-focus .page-footer {
  position: absolute;
  z-index: 24;
  bottom: 72px;
  left: 50%;
  width: max-content;
  height: auto;
  padding: 0;
  transform: translateX(-50%);
  pointer-events: none;
}

.library-panel.library-expanded .page-footer .page-label,
.app-shell.reading-focus .page-footer .page-label {
  display: none;
}

.library-panel.library-expanded .page-actions,
.app-shell.reading-focus .page-actions {
  padding: 5px;
  border: 1px solid rgba(95, 87, 70, 0.17);
  border-radius: 999px;
  background: rgba(251, 247, 239, 0.96);
  box-shadow: 0 8px 26px rgba(49, 41, 29, 0.16);
  pointer-events: auto;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-button {
  display: inline-flex;
  width: 26px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted-dark);
  background: transparent;
  cursor: pointer;
}

.page-button:hover:not(:disabled) {
  border-color: var(--line);
  color: var(--terracotta-deep);
  background: rgba(255, 252, 246, 0.64);
}

.page-button:disabled {
  opacity: 0.32;
  cursor: default;
}

.page-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.annotation-rail {
  display: flex;
  min-height: 0;
  padding: 4px 2px 0 12px;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.annotation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.annotation-heading h3 {
  margin: 3px 0 0;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.notes-total {
  display: grid;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted-dark);
  font-family: var(--serif);
  font-size: 9px;
}

.add-note-button {
  display: flex;
  width: 100%;
  margin-top: 11px;
  padding: 8px 9px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid rgba(136, 85, 65, 0.32);
  border-radius: 6px;
  color: var(--terracotta-deep);
  background: rgba(249, 239, 226, 0.55);
  font-size: 9px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.add-note-button:hover {
  background: rgba(245, 232, 215, 0.86);
}

.add-note-button svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.note-form {
  margin-top: 9px;
  padding: 9px;
  border: 1px solid rgba(111, 101, 78, 0.17);
  border-radius: 7px;
  background: rgba(255, 252, 246, 0.7);
}

.note-form-meta {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 6px;
}

.note-form-meta label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted-dark);
  font-size: 8px;
}

.note-form-meta input,
.note-form-meta select {
  width: 100%;
  height: 27px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
  font-family: var(--sans);
  font-size: 9px;
}

.selection-quote {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 13px;
  gap: 5px;
  margin-top: 7px;
  padding: 6px;
  border-left: 2px solid var(--gold);
  color: var(--muted-dark);
  background: rgba(230, 219, 198, 0.45);
  font-family: var(--serif);
  font-size: 8px;
  line-height: 1.5;
}

.selection-quote svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.selection-quote button {
  display: grid;
  width: 13px;
  height: 13px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.selection-quote button svg {
  width: 10px;
  height: 10px;
  stroke: currentColor;
}

.note-text-label {
  display: block;
  margin: 7px 0 3px;
  color: var(--muted-dark);
  font-size: 8px;
}

.note-form textarea {
  width: 100%;
  resize: vertical;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  line-height: 1.55;
}

.note-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 7px;
}

.text-button,
.primary-button {
  padding: 7px 11px;
  border-radius: 5px;
  font-size: 9px;
  letter-spacing: 0.07em;
  cursor: pointer;
}

.text-button {
  color: var(--muted-dark);
  background: transparent;
}

.text-button:hover {
  color: var(--terracotta-deep);
}

.primary-button {
  border: 1px solid var(--terracotta-deep);
  color: var(--paper-light);
  background: var(--terracotta-deep);
}

.primary-button:hover {
  background: #784535;
}

.notes-list {
  min-height: 0;
  margin-top: 10px;
  flex: 1;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.notes-empty {
  padding: 20px 8px;
  color: var(--muted);
  text-align: center;
}

.notes-empty span {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 18px;
}

.notes-empty p {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: 9px;
  line-height: 1.6;
}

.note-card {
  position: relative;
  padding: 8px 5px 9px 8px;
  border-bottom: 1px solid rgba(78, 84, 73, 0.1);
  border-left: 2px solid var(--note-color, var(--sage));
}

.note-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 8px;
}

.note-kind {
  color: var(--note-color, var(--sage-deep));
  font-family: var(--serif);
  letter-spacing: 0.08em;
}

.note-locate {
  padding: 0;
  color: var(--note-color, var(--sage-deep));
  background: transparent;
  font-family: var(--serif);
  font-size: 8px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.note-locate:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.note-delete {
  display: grid;
  width: 18px;
  height: 18px;
  padding: 0;
  place-items: center;
  opacity: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: opacity 150ms ease, color 150ms ease;
}

.note-card:hover .note-delete,
.note-delete:focus-visible {
  opacity: 1;
}

.note-delete:hover {
  color: var(--terracotta-deep);
}

.note-delete svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.note-quote {
  margin: 6px 0 0;
  padding-left: 6px;
  border-left: 1px solid var(--gold);
  color: var(--muted-dark);
  font-family: var(--serif);
  font-size: 8px;
  line-height: 1.55;
}

.note-body {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 10px;
  line-height: 1.63;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-body-muted {
  color: var(--muted);
  font-style: italic;
}

.pdf-annotation-hint {
  color: var(--muted-dark);
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.ai-reading-rail {
  display: flex;
  min-height: 0;
  padding: 4px 0 0 15px;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.ai-reading-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-reading-head-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ai-reading-heading h3 {
  margin: 3px 0 0;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.ai-reading-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.ai-reading-status::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
}

.ai-reading-status.ready {
  color: var(--sage-deep);
}

.ai-reading-status.ready::before {
  background: var(--sage);
}

.ai-reading-status.reading::before {
  background: var(--terracotta);
  animation: thinking 1s ease-in-out infinite;
}

.ai-clear-button {
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.ai-clear-button:hover {
  border-color: var(--line);
  color: var(--terracotta-deep);
  background: rgba(239, 226, 211, 0.58);
}

.ai-clear-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.ai-personas {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ai-persona-button {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted-dark);
  background: transparent;
  font-family: var(--serif);
  font-size: 8px;
  cursor: pointer;
}

.ai-persona-button:hover {
  color: var(--terracotta-deep);
}

.ai-persona-button.active {
  border-color: rgba(139, 99, 73, 0.24);
  color: var(--ink);
  background: rgba(234, 220, 201, 0.54);
}

.ai-persona-single {
  cursor: default;
  pointer-events: none;
}

.ai-book-context {
  margin-top: 9px;
  padding: 8px 9px;
  border: 1px solid rgba(105, 104, 84, 0.13);
  border-radius: 6px;
  color: var(--muted-dark);
  background: rgba(238, 230, 215, 0.38);
  font-family: var(--serif);
  font-size: 9px;
  line-height: 1.6;
}

.ai-reading-stage {
  min-height: 0;
  margin-top: 10px;
  flex: 1;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.ai-reading-empty {
  display: flex;
  min-height: 260px;
  padding: 24px 14px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ai-reading-mark {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  place-items: center;
  border: 1px solid rgba(122, 86, 65, 0.24);
  border-radius: 50%;
  color: var(--terracotta);
  font-family: var(--serif);
  font-size: 20px;
}

.ai-reading-empty h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
}

.ai-reading-empty p {
  max-width: 255px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.75;
}

.ai-message {
  display: flex;
  margin-bottom: 11px;
  gap: 7px;
}

.ai-message.user {
  flex-direction: row-reverse;
}

.ai-message-mark {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted-dark);
  background: rgba(252, 248, 240, 0.82);
  font-family: var(--serif);
  font-size: 8px;
}

.ai-message.user .ai-message-mark {
  border-color: rgba(168, 102, 80, 0.28);
  color: var(--terracotta-deep);
}

.ai-message-body {
  min-width: 0;
  max-width: calc(100% - 30px);
}

.ai-message-name {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.ai-message.user .ai-message-name {
  text-align: right;
}

.ai-message-bubble {
  padding: 9px 10px;
  border: 1px solid rgba(76, 83, 72, 0.11);
  border-radius: 3px 9px 9px 9px;
  color: var(--ink-soft);
  background: rgba(255, 252, 246, 0.78);
  font-family: var(--serif);
  font-size: 10px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-message.user .ai-message-bubble {
  border-color: rgba(168, 102, 80, 0.12);
  border-radius: 9px 3px 9px 9px;
  background: rgba(236, 219, 204, 0.54);
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 7px 0;
}

.ai-suggestions button {
  padding: 5px 7px;
  border: 1px solid rgba(108, 99, 80, 0.14);
  border-radius: 999px;
  color: var(--muted-dark);
  background: rgba(250, 245, 236, 0.54);
  font-size: 8px;
  cursor: pointer;
}

.ai-suggestions button:hover {
  border-color: rgba(168, 102, 80, 0.35);
  color: var(--terracotta-deep);
}

.ai-suggestions:empty {
  display: none;
}

.ai-reading-composer {
  flex: 0 0 auto;
  padding: 7px 8px 6px;
  border: 1px solid rgba(88, 90, 74, 0.2);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.78);
}

.ai-reading-composer textarea {
  display: block;
  width: 100%;
  min-height: 34px;
  max-height: 92px;
  padding: 0;
  resize: none;
  border: 0;
  background: transparent;
  font-size: 10px;
  line-height: 1.55;
}

.ai-reading-composer textarea:focus {
  outline: none;
}

.ai-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
}

.ai-composer-footer span {
  color: var(--muted);
  font-size: 7px;
}

.right-rail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

.desk-panel {
  padding: 17px 17px 14px;
}

.today-date {
  padding-top: 3px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.desk-book {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 12px;
}

.desk-cover {
  position: relative;
  display: grid;
  width: 45px;
  height: 62px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 2px 5px 5px 2px;
  color: rgba(255, 252, 245, 0.9);
  background: var(--cover, var(--sage));
  font-family: var(--serif);
  font-size: 18px;
  box-shadow: inset 4px 0 rgba(255, 255, 255, 0.12), 2px 4px 8px rgba(73, 61, 42, 0.14);
}

.desk-copy {
  min-width: 0;
  flex: 1;
}

.desk-copy strong {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desk-copy span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desk-progress {
  margin-top: 9px;
}

.desk-progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 8px;
}

.desk-progress-track {
  height: 2px;
  margin-top: 4px;
  background: var(--line);
}

.desk-progress-track i {
  display: block;
  height: 100%;
  background: var(--cover, var(--sage));
}

.desk-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.desk-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border-right: 1px solid var(--line);
}

.desk-stats div:last-child {
  border-right: 0;
}

.desk-stats strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
}

.desk-stats span {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.recent-note {
  margin-top: 10px;
}

.recent-note-label {
  color: var(--terracotta);
  font-family: var(--serif);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.recent-note-text {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted-dark);
  font-family: var(--serif);
  font-size: 9px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.theater-panel {
  display: flex;
  min-height: 0;
  padding: 9px 14px 13px;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(227, 216, 197, 0.65), rgba(249, 245, 236, 0.9) 45px),
    var(--panel);
}

.theater-awning {
  flex: 0 0 7px;
  margin: -9px -14px 8px;
  opacity: 0.8;
  background:
    repeating-linear-gradient(90deg, rgba(148, 89, 68, 0.6) 0, rgba(148, 89, 68, 0.6) 9px, rgba(240, 229, 209, 0.2) 9px, rgba(240, 229, 209, 0.2) 18px);
  mask-image: radial-gradient(ellipse at 50% 100%, #000 60%, transparent 61%);
}

.theater-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 0;
}

.theater-context {
  display: flex;
  padding: 9px 2px 7px;
  flex-direction: column;
  gap: 4px;
}

.ai-status {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 5px;
  color: var(--terracotta-deep);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.ai-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(168, 102, 80, 0.1);
}

.ai-status.connected i {
  background: var(--sage);
  box-shadow: 0 0 0 3px rgba(116, 134, 120, 0.13);
}

.context-topic {
  overflow: hidden;
  color: var(--muted-dark);
  font-family: var(--serif);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debate-modes {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 0 0 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mode-chip {
  flex: 0 0 auto;
  padding: 4px 7px;
  font-size: 8px;
}

.theater-stage {
  flex: 1;
  min-height: 90px;
  padding: 3px 2px 9px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.theater-empty {
  display: flex;
  min-height: 150px;
  padding: 3px 12px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.theater-mask {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 9px;
  place-items: center;
  border: 1px solid rgba(122, 86, 65, 0.24);
  border-radius: 50% 50% 44% 44%;
  color: var(--terracotta);
  font-family: var(--serif);
  font-size: 19px;
}

.theater-empty h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.theater-empty p {
  max-width: 245px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
}

.debate-message {
  display: flex;
  gap: 7px;
  margin-bottom: 11px;
}

.debate-message.user {
  flex-direction: row-reverse;
}

.message-mark {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted-dark);
  background: rgba(252, 248, 240, 0.8);
  font-family: var(--serif);
  font-size: 9px;
}

.debate-message.user .message-mark {
  border-color: rgba(168, 102, 80, 0.25);
  color: var(--terracotta-deep);
}

.message-content {
  max-width: calc(100% - 30px);
}

.message-name {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.debate-message.user .message-name {
  text-align: right;
}

.message-bubble {
  padding: 8px 10px;
  border: 1px solid rgba(76, 83, 72, 0.11);
  border-radius: 3px 9px 9px 9px;
  color: var(--ink-soft);
  background: rgba(255, 252, 246, 0.72);
  font-family: var(--serif);
  font-size: 10px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.debate-message.user .message-bubble {
  border-color: rgba(168, 102, 80, 0.12);
  border-radius: 9px 3px 9px 9px;
  background: rgba(236, 219, 204, 0.52);
}

.message-bubble.loading {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 29px;
}

.message-bubble.loading i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--terracotta);
  animation: thinking 1s ease-in-out infinite;
}

.message-bubble.loading i:nth-child(2) {
  animation-delay: 120ms;
}

.message-bubble.loading i:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes thinking {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.theater-composer {
  flex: 0 0 auto;
  padding: 7px 8px 6px;
  border: 1px solid rgba(88, 90, 74, 0.2);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.76);
}

.theater-composer textarea {
  display: block;
  width: 100%;
  min-height: 35px;
  max-height: 88px;
  padding: 0;
  resize: none;
  border: 0;
  background: transparent;
  font-size: 10px;
  line-height: 1.55;
}

.theater-composer textarea:focus {
  outline: none;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
}

.composer-footer span {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.02em;
}

.send-button {
  display: grid;
  width: 27px;
  height: 27px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-light);
  background: var(--terracotta-deep);
  cursor: pointer;
}

.send-button:hover {
  background: #764331;
}

.send-button:disabled {
  opacity: 0.42;
  cursor: default;
}

.send-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.account-gate {
  position: fixed;
  z-index: 140;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(243, 237, 226, 0.97), rgba(236, 228, 213, 0.98));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.account-gate-card {
  position: relative;
  width: min(430px, 100%);
  padding: 32px;
  border: 1px solid rgba(84, 82, 69, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(150deg, rgba(255, 253, 247, 0.8), transparent 45%),
    var(--panel-solid);
  box-shadow: 0 30px 90px rgba(53, 45, 33, 0.18);
}

.account-gate-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.account-gate-close:hover {
  color: var(--terracotta-deep);
  background: var(--terracotta-pale);
}

.account-gate-close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.account-gate-mark {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--terracotta-deep);
}

.account-gate-mark svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.account-gate-card h2 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.account-gate-intro {
  margin: 10px 0 18px;
  color: var(--muted-dark);
  font-size: 10px;
  line-height: 1.7;
}

.account-form {
  display: flex;
  flex-direction: column;
}

.account-submit {
  align-self: flex-end;
  margin-top: 18px;
  padding: 9px 16px;
}

.account-switch-mode {
  align-self: center;
  margin-top: 14px;
  padding: 5px;
  color: var(--terracotta-deep);
  background: transparent;
  font-size: 9px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(48, 48, 41, 0.28);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.settings-dialog {
  width: min(500px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  padding: 24px 26px;
  border: 1px solid rgba(85, 81, 67, 0.24);
  border-radius: 17px;
  background:
    linear-gradient(145deg, rgba(255, 252, 247, 0.75), transparent 45%),
    var(--panel-solid);
  box-shadow: 0 28px 90px rgba(43, 38, 28, 0.23);
  overflow: auto;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.dialog-heading h2 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.dialog-intro {
  margin: 13px 0 19px;
  padding: 10px 11px;
  border-left: 2px solid var(--gold);
  color: var(--muted-dark);
  background: rgba(233, 222, 201, 0.35);
  font-size: 10px;
  line-height: 1.7;
}

.field-label {
  display: block;
  margin: 12px 0 5px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.field-input {
  width: 100%;
  height: 39px;
  padding: 0 11px;
  border: 1px solid rgba(78, 83, 72, 0.19);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.68);
  font-size: 11px;
}

.field-input:focus {
  border-color: rgba(168, 102, 80, 0.58);
}

.secret-input-wrap {
  position: relative;
}

.secret-input-wrap .field-input {
  padding-right: 55px;
}

.reveal-secret {
  position: absolute;
  top: 50%;
  right: 7px;
  padding: 5px 7px;
  color: var(--terracotta-deep);
  background: transparent;
  font-size: 9px;
  transform: translateY(-50%);
  cursor: pointer;
}

.form-help {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.65;
}

.provider-note {
  margin: 8px 0 0;
  padding: 8px 9px;
  border-left: 2px solid var(--sage);
  color: var(--sage-deep);
  background: rgba(222, 231, 219, 0.42);
  font-size: 9px;
  line-height: 1.6;
}

.form-help code {
  color: var(--ink-soft);
  font-size: 8px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.dialog-actions .primary-button {
  padding: 9px 17px;
}

.toast-region {
  position: fixed;
  z-index: 120;
  right: 24px;
  bottom: 24px;
  display: flex;
  max-width: min(340px, calc(100vw - 32px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 11px 14px;
  border: 1px solid rgba(77, 81, 68, 0.2);
  border-radius: 8px;
  color: var(--ink-soft);
  background: rgba(252, 248, 240, 0.97);
  box-shadow: 0 12px 35px rgba(59, 51, 38, 0.15);
  font-size: 10px;
  line-height: 1.55;
  animation: toast-in 200ms ease both;
}

.toast.error {
  border-color: rgba(160, 71, 54, 0.31);
  color: #813f31;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-shell.reading-focus .workspace {
  grid-template-columns: minmax(0, 1fr);
  height: 100vh;
  padding: 0;
}

.app-shell.reading-focus .market-panel,
.app-shell.reading-focus .right-rail,
.app-shell.reading-focus .shelf-toolbar,
.app-shell.reading-focus .book-shelf {
  display: none;
}

.app-shell.reading-focus .library-panel {
  width: 100%;
  max-width: none;
  height: 100vh;
  padding: 10px 14px 8px;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.app-shell.reading-focus .app-header {
  display: none;
}

.app-shell.reading-focus .library-header {
  display: none;
}

.app-shell.reading-focus .reading-room {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.app-shell.reading-focus .reader-content {
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.72fr);
  gap: 12px;
}

.app-shell.reading-focus .page-paper {
  padding-right: clamp(10px, 2vw, 24px);
  padding-left: clamp(10px, 2vw, 24px);
}

@media (max-width: 1270px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .workspace {
    grid-template-columns: minmax(215px, 0.66fr) minmax(530px, 2fr);
    grid-template-rows: minmax(760px, calc(100vh - 97px));
  }

  .market-panel,
  .library-panel {
    min-height: 0;
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: minmax(260px, 0.85fr) minmax(0, 2.1fr);
    grid-template-rows: 1fr;
  }

  .theater-panel {
    min-height: 410px;
  }
}

@media (max-width: 900px) {
  .app-header {
    padding: 0 17px;
  }

  .workspace {
    display: flex;
    padding: 0 13px 15px;
    flex-direction: column;
    gap: 12px;
  }

  .market-panel {
    min-height: 420px;
  }

  .library-panel {
    min-height: 820px;
  }

  .library-panel.library-expanded {
    top: 68px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    min-height: 0;
  }

  .app-shell.reading-focus .library-panel {
    height: 100vh;
    min-height: 0;
  }

  .right-rail {
    display: flex;
    flex-direction: column;
  }

  .desk-panel {
    min-height: 280px;
  }

  .theater-panel {
    min-height: 570px;
  }
}

@media (max-width: 660px) {
  .app-header {
    flex-basis: 66px;
  }

  .brand-seal {
    width: 36px;
    height: 36px;
  }

  .reading-time {
    gap: 5px;
    padding-left: 9px;
  }

  .reading-time-caption {
    font-size: 8px;
  }

  .reading-time strong {
    font-size: 11px;
  }

  .library-panel {
    min-height: 1040px;
    padding: 17px 12px 12px;
  }

  .app-shell.reading-focus .library-panel {
    height: 100vh;
    min-height: 0;
    padding: 8px;
  }

  .app-shell.reading-focus .reader-content {
    display: flex;
    overflow: auto;
  }

  .app-shell.reading-focus .reading-stage {
    flex: 0 0 72vh;
  }

  .library-panel.library-expanded {
    overflow: auto;
  }

  .library-panel.library-expanded .reader-content {
    display: flex;
  }

  .library-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .search-box {
    width: 100%;
  }

  .shelf-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .shelf-filters {
    flex-wrap: wrap;
  }

  .book-shelf {
    flex-basis: 136px;
    grid-auto-columns: 159px;
  }

  .reader-topbar {
    height: auto;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 9px;
  }

  .reader-tools {
    align-self: flex-end;
  }

  .reader-content {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .reading-stage {
    flex: 0 0 455px;
  }

  .page-paper {
    padding: 27px 21px 25px;
  }

  .annotation-rail {
    min-height: 320px;
    margin-top: 12px;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .ai-reading-rail {
    min-height: 390px;
    margin-top: 12px;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .notes-list {
    max-height: 260px;
  }

  .reading-focus .library-panel {
    min-height: 870px;
  }

  .settings-dialog {
    padding: 21px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
