:root {
  --bg: #f6f5f1;
  --panel: #fffdf8;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #ddd8cd;
  --soft: #ece7dc;
  --teal: #2c7a78;
  --teal-dark: #195b59;
  --blue: #2f5f98;
  --amber: #a16207;
  --red: #a43e3e;
  --mark-plain: #2f8f62;
  --mark-spacetime: #276fbf;
  --mark-character: #c4583a;
  --mark-emotion: #b38212;
  --mark-image: #7463a8;
  --mark-rose: #b84d6a;
  --mark-violet: #6f56a5;
  --mark-cyan: #277f95;
  --mark-lime: #5d7f28;
  --mark-slate: #5d6675;
  --shadow: 0 12px 30px rgba(36, 31, 22, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Songti SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

@media (min-width: 1081px) {
  .app-shell {
    height: 100vh;
    overflow: hidden;
  }
}

.topbar {
  min-height: 72px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 750;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.tab,
.command {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 7px;
  padding: 6px 12px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.tab.is-active,
.command.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.command.danger {
  color: var(--red);
}

.command:hover,
.tab:hover {
  border-color: var(--teal);
}

.command:disabled,
.tab:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

.workspace.manager-open {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(320px, 420px);
}

.workspace.space-open {
  display: block;
  overflow: auto;
}

.library-panel,
.manager-panel {
  min-height: 0;
  overflow: auto;
  background: var(--panel);
}

.library-panel {
  border-right: 1px solid var(--line);
}

.filters {
  padding: 14px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fbf8f1;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

textarea {
  min-height: 320px;
  resize: vertical;
  line-height: 1.65;
  font-family: "Menlo", "PingFang SC", monospace;
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(44, 122, 120, 0.14);
}

.filter-grid,
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.article-list {
  display: grid;
  gap: 0;
}

.article-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 13px 14px;
  display: grid;
  gap: 8px;
}

.article-item:hover,
.article-item.is-selected {
  background: #f0eee6;
}

.article-item.is-selected {
  box-shadow: inset 3px 0 0 var(--teal);
}

.article-item strong {
  font-size: 15px;
}

.article-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.chip.teal {
  color: var(--teal-dark);
  background: #e6f2ef;
  border-color: #b8d7d1;
}

.chip.amber {
  color: var(--amber);
  background: #fff7df;
  border-color: #eedca7;
}

.reader-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #fcfaf5;
}

.empty-state {
  height: 100%;
  min-height: 360px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.reader-content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 42px 80px;
}

.is-hidden {
  display: none !important;
}

.reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.reader-head h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 760;
}

.reader-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.reader-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 220px;
  padding: 7px 10px;
  border-radius: 7px;
  background: #e8f1ef;
  color: var(--teal-dark);
  font-size: 12px;
  line-height: 1.4;
}

.immersive-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 18px 0 0;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(252, 250, 245, 0.94);
  backdrop-filter: blur(14px);
}

.font-control {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) 48px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.font-control span,
.font-control output,
.annotation-count,
.analysis-status {
  color: var(--muted);
  font-size: 13px;
}

.analysis-command:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.font-control input {
  padding: 0;
  accent-color: var(--teal);
}

.reading-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 24px;
  align-items: start;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 22px;
}

.meta-item {
  padding: 10px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.meta-item code {
  word-break: break-all;
  white-space: normal;
}

.emotion-panel {
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  overflow: hidden;
}

.emotion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbf8f1;
}

.emotion-head h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.emotion-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.emotion-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.emotion-content {
  display: grid;
  gap: 14px;
  padding: 14px 16px 16px;
}

.emotion-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fcfaf5;
  line-height: 1.65;
}

.emotion-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.emotion-empty p {
  margin: 0;
}

.emotion-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.emotion-metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfaf5;
}

.emotion-metric span,
.emotion-metric em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.emotion-metric strong {
  display: block;
  margin: 3px 0;
  font-size: 22px;
  line-height: 1.1;
  color: var(--teal-dark);
}

.emotion-trend {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--amber);
  background: #fff7df;
  color: #674405;
  line-height: 1.62;
  font-size: 14px;
}

.emotion-visual {
  overflow-x: auto;
  padding: 8px 0 0;
}

.emotion-chart {
  width: 100%;
  min-width: 620px;
  display: block;
}

.emotion-grid-line line {
  stroke: #ebe4d6;
  stroke-width: 1;
}

.emotion-grid-line text,
.emotion-axis-label,
.emotion-callout {
  fill: var(--muted);
  font-size: 12px;
}

.emotion-axis-label.end {
  text-anchor: end;
}

.emotion-axis {
  stroke: #cfc6b7;
  stroke-width: 1.2;
}

.emotion-line-shadow,
.emotion-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.emotion-line-shadow {
  stroke: rgba(44, 122, 120, 0.14);
  stroke-width: 8;
}

.emotion-line {
  stroke: var(--teal);
  stroke-width: 3;
}

.emotion-dot {
  stroke: #fffdf8;
  stroke-width: 1.5;
  transition: r 120ms ease, stroke-width 120ms ease, filter 120ms ease;
  pointer-events: none;
}

.emotion-hit {
  fill: transparent;
  stroke: transparent;
  cursor: help;
  pointer-events: all;
}

.emotion-point:focus {
  outline: none;
}

.emotion-point:hover .emotion-dot,
.emotion-point:focus .emotion-dot {
  r: 5.2px;
  stroke-width: 2.2;
  filter: drop-shadow(0 2px 4px rgba(36, 31, 22, 0.24));
}

.emotion-dot.tone-warm {
  fill: #c78d21;
}

.emotion-dot.tone-intense {
  fill: #a43e3e;
}

.emotion-dot.tone-cool {
  fill: #2f5f98;
}

.emotion-dot.tone-reflective {
  fill: #7463a8;
}

.emotion-dot.tone-plain {
  fill: var(--teal);
}

.emotion-callout {
  font-weight: 700;
  fill: #8b5d09;
}

.emotion-callout.valley {
  fill: #7b3a3a;
}

.emotion-tooltip {
  position: fixed;
  z-index: 30;
  width: min(420px, calc(100vw - 24px));
  padding: 12px 13px 13px;
  border: 1px solid #cfc6b7;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 18px 44px rgba(36, 31, 22, 0.18);
  color: var(--ink);
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.emotion-tooltip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.emotion-tooltip-head strong {
  font-size: 14px;
}

.emotion-tooltip-head span {
  flex: 0 0 auto;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
}

.emotion-tooltip-text,
.emotion-tooltip-reason {
  margin: 9px 0 0;
  line-height: 1.62;
}

.emotion-tooltip-text {
  font-size: 14px;
}

.emotion-tooltip-reason {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
}

.category-delete-dialog {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 41, 51, 0.34);
}

.category-delete-dialog-card {
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid rgba(126, 46, 46, 0.28);
  border-radius: 12px;
  background: #fffdf8;
  box-shadow: 0 20px 56px rgba(36, 31, 22, 0.25);
}

.category-delete-dialog-card h2,
.category-delete-dialog-card p {
  margin: 0;
}

.category-delete-dialog-card h2 {
  color: var(--ink);
  font-size: 19px;
}

.category-delete-dialog-card p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.category-delete-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.emotion-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.emotion-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
}

.emotion-table th,
.emotion-table td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.emotion-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eee9de;
  color: #4b5563;
}

.emotion-table td:first-child,
.emotion-table td:nth-child(2) {
  white-space: nowrap;
}

.tone-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #ffffff;
  white-space: nowrap;
}

.tone-chip.tone-warm {
  color: #7a4e06;
  background: #fff7df;
  border-color: #eedca7;
}

.tone-chip.tone-intense {
  color: #7b2f2f;
  background: #f8e7e1;
  border-color: #e4bbb0;
}

.tone-chip.tone-cool {
  color: #274d7a;
  background: #e8f0f8;
  border-color: #b9cde3;
}

.tone-chip.tone-reflective {
  color: #4f4381;
  background: #eeeaf7;
  border-color: #d5cdec;
}

.tone-chip.tone-plain {
  color: var(--teal-dark);
  background: #e6f2ef;
  border-color: #b8d7d1;
}

.markdown-body {
  line-height: 1.82;
  font-size: var(--reader-font-size, 17px);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  line-height: 1.35;
  margin: 1.4em 0 0.55em;
}

.markdown-body h1 {
  font-size: calc(var(--reader-font-size, 17px) + 11px);
}

.markdown-body h2 {
  font-size: calc(var(--reader-font-size, 17px) + 6px);
}

.markdown-body h3 {
  font-size: calc(var(--reader-font-size, 17px) + 2px);
}

.markdown-body p {
  margin: 0.85em 0;
}

.markdown-body blockquote {
  margin: 1em 0;
  padding: 10px 14px;
  border-left: 4px solid var(--teal);
  background: #edf4f1;
  color: #244541;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 14px;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--line);
  padding: 7px 8px;
  vertical-align: top;
}

.markdown-body th {
  background: #eee9de;
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eee9de;
  font-size: 0.9em;
}

.markdown-body .paper-library-link {
  display: inline-flex;
  align-items: center;
  margin: 0.1rem 0;
  padding: 0.28rem 0.6rem;
  border: 1px solid #5c7d70;
  border-radius: 0.45rem;
  color: #fff;
  background: #3e6558;
  font-size: 0.9em;
  text-decoration: none;
}

.markdown-body .paper-library-link:hover {
  background: #294d41;
}

.annotation-mark {
  border-radius: 3px;
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.annotation-mark.annotation-teal {
  background: rgba(44, 122, 120, 0.14);
  text-decoration-color: rgba(44, 122, 120, 0.78);
}

.annotation-mark.annotation-amber {
  background: rgba(161, 98, 7, 0.16);
  text-decoration-color: rgba(161, 98, 7, 0.8);
}

.annotation-mark.annotation-blue {
  background: rgba(47, 95, 152, 0.14);
  text-decoration-color: rgba(47, 95, 152, 0.78);
}

.annotation-mark.annotation-plain {
  background: rgba(47, 143, 98, 0.14);
  text-decoration-color: var(--mark-plain);
}

.annotation-mark.annotation-spacetime {
  background: rgba(39, 111, 191, 0.14);
  text-decoration-color: var(--mark-spacetime);
}

.annotation-mark.annotation-character {
  background: rgba(196, 88, 58, 0.14);
  text-decoration-color: var(--mark-character);
}

.annotation-mark.annotation-emotion {
  background: rgba(179, 130, 18, 0.16);
  text-decoration-color: var(--mark-emotion);
}

.annotation-mark.annotation-image {
  background: rgba(116, 99, 168, 0.14);
  text-decoration-color: var(--mark-image);
}

.annotation-mark.annotation-rose {
  background: rgba(184, 77, 106, 0.14);
  text-decoration-color: var(--mark-rose);
}

.annotation-mark.annotation-violet {
  background: rgba(111, 86, 165, 0.14);
  text-decoration-color: var(--mark-violet);
}

.annotation-mark.annotation-cyan {
  background: rgba(39, 127, 149, 0.14);
  text-decoration-color: var(--mark-cyan);
}

.annotation-mark.annotation-lime {
  background: rgba(93, 127, 40, 0.14);
  text-decoration-color: var(--mark-lime);
}

.annotation-mark.annotation-slate {
  background: rgba(93, 102, 117, 0.14);
  text-decoration-color: var(--mark-slate);
}

.annotation-mark.is-active {
  box-shadow: 0 0 0 3px rgba(161, 98, 7, 0.18);
}

.annotation-mark.is-drop-target,
.annotation-card.is-drop-target {
  box-shadow: 0 0 0 3px rgba(44, 122, 120, 0.18);
}

.reader-right-rail {
  display: grid;
  gap: 10px;
  align-content: start;
  align-self: start;
  position: sticky;
  top: 18px;
  z-index: 3;
  max-height: calc(100vh - 108px);
  overflow: auto;
  padding: 0 2px 2px 0;
}

.label-box,
.annotation-editor,
.annotation-rail {
  display: grid;
  gap: 10px;
  align-content: start;
}

.label-box,
.annotation-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 12px;
}

.label-box {
  position: static;
  max-height: none;
  overflow: visible;
  box-shadow: 0 10px 24px rgba(36, 31, 22, 0.08);
}

.rail-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.rail-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.rail-section-head span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-box-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.category-manager-toggle {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.label-box.is-category-managing {
  border-color: rgba(44, 122, 120, 0.42);
}

.category-list {
  display: grid;
  gap: 7px;
}

.category-chip {
  min-height: 38px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 7px 8px;
  text-align: left;
}

.category-chip strong,
.category-chip small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-chip strong {
  font-size: 13px;
}

.category-chip small {
  color: var(--muted);
  font-size: 11px;
}

.category-manager-item {
  min-height: 48px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 7px 8px;
}

.category-manager-item .category-dot {
  grid-row: auto;
}

.category-manager-item strong,
.category-manager-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-manager-item strong {
  font-size: 13px;
}

.category-manager-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.category-manager-item.is-active {
  box-shadow: 0 0 0 3px rgba(44, 122, 120, 0.14);
}

.category-edit-action {
  min-width: 52px;
  min-height: 32px;
  border: 1px solid rgba(44, 122, 120, 0.38);
  border-radius: 6px;
  background: #f2faf7;
  color: #1c625a;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.category-edit-action:hover,
.category-edit-action:focus-visible {
  background: #e3f2ed;
  border-color: #2c7a78;
}

.category-empty {
  margin: 0;
  padding: 11px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.category-form,
.annotation-editor-form,
.category-editor-form {
  display: grid;
  gap: 8px;
}

.category-form {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.category-editor {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(44, 122, 120, 0.26);
  border-radius: 7px;
  background: #f8fcfa;
}

.category-editor-head h4,
.category-editor-head p {
  margin: 0;
}

.category-editor-head h4 {
  font-size: 14px;
}

.category-editor-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.category-editor textarea {
  min-height: 68px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.5;
}

.category-color-field {
  min-height: 36px;
  border-color: rgba(44, 122, 120, 0.38);
  background: #ffffff;
}

.category-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.annotation-editor textarea {
  min-height: 74px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.55;
}

.annotation-editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.annotation-empty,
.annotation-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.annotation-empty {
  padding: 13px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.annotation-card {
  padding: 11px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.annotation-card.is-active {
  border-color: #dfc171;
  box-shadow: 0 0 0 3px rgba(161, 98, 7, 0.12);
}

.annotation-card-plain {
  border-left: 4px solid var(--mark-plain);
}

.annotation-card-spacetime {
  border-left: 4px solid var(--mark-spacetime);
}

.annotation-card-character {
  border-left: 4px solid var(--mark-character);
}

.annotation-card-emotion {
  border-left: 4px solid var(--mark-emotion);
}

.annotation-card-image {
  border-left: 4px solid var(--mark-image);
}

.annotation-card-teal {
  border-left: 4px solid var(--teal);
}

.annotation-card-amber {
  border-left: 4px solid var(--amber);
}

.annotation-card-blue {
  border-left: 4px solid var(--blue);
}

.annotation-card-rose {
  border-left: 4px solid var(--mark-rose);
}

.annotation-card-violet {
  border-left: 4px solid var(--mark-violet);
}

.annotation-card-cyan {
  border-left: 4px solid var(--mark-cyan);
}

.annotation-card-lime {
  border-left: 4px solid var(--mark-lime);
}

.annotation-card-slate {
  border-left: 4px solid var(--mark-slate);
}

.annotation-jump {
  width: 100%;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
}

.annotation-jump span {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #e6f2ef;
  color: var(--teal-dark);
  font-size: 12px;
}

.annotation-jump em {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.annotation-jump strong {
  display: block;
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
}

.annotation-card p {
  margin: 8px 0 0 32px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.annotation-card .annotation-note {
  color: var(--ink);
  background: #f6f1e7;
  border-radius: 6px;
  padding: 6px 8px;
}

.annotation-delete {
  margin: 8px 0 0 32px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--red);
  font-size: 12px;
}

.selection-toolbar {
  position: fixed;
  z-index: 20;
  width: min(720px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: stretch;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 12px 28px rgba(36, 31, 22, 0.14);
  backdrop-filter: blur(10px);
}

.selection-category-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 7px;
}

.selection-title {
  align-self: center;
  padding: 0 5px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.category-choice {
  min-height: 54px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 7px;
  row-gap: 2px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.category-choice:hover {
  transform: translateY(-1px);
  background: #fbf8f1;
}

.category-dot {
  width: 10px;
  height: 28px;
  grid-row: 1 / span 2;
  border-radius: 999px;
}

.category-choice strong {
  font-size: 13px;
  line-height: 1.2;
}

.category-choice small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.category-plain {
  border-color: rgba(47, 143, 98, 0.34);
}

.category-plain .category-dot {
  background: var(--mark-plain);
}

.category-spacetime {
  border-color: rgba(39, 111, 191, 0.34);
}

.category-spacetime .category-dot {
  background: var(--mark-spacetime);
}

.category-character {
  border-color: rgba(196, 88, 58, 0.34);
}

.category-character .category-dot {
  background: var(--mark-character);
}

.category-emotion {
  border-color: rgba(179, 130, 18, 0.36);
}

.category-emotion .category-dot {
  background: var(--mark-emotion);
}

.category-image {
  border-color: rgba(116, 99, 168, 0.34);
}

.category-image .category-dot {
  background: var(--mark-image);
}

.category-teal {
  border-color: rgba(44, 122, 120, 0.34);
}

.category-teal .category-dot {
  background: var(--teal);
}

.category-amber {
  border-color: rgba(161, 98, 7, 0.36);
}

.category-amber .category-dot {
  background: var(--amber);
}

.category-blue {
  border-color: rgba(47, 95, 152, 0.34);
}

.category-blue .category-dot {
  background: var(--blue);
}

.category-rose {
  border-color: rgba(184, 77, 106, 0.34);
}

.category-rose .category-dot {
  background: var(--mark-rose);
}

.category-violet {
  border-color: rgba(111, 86, 165, 0.34);
}

.category-violet .category-dot {
  background: var(--mark-violet);
}

.category-cyan {
  border-color: rgba(39, 127, 149, 0.34);
}

.category-cyan .category-dot {
  background: var(--mark-cyan);
}

.category-lime {
  border-color: rgba(93, 127, 40, 0.34);
}

.category-lime .category-dot {
  background: var(--mark-lime);
}

.category-slate {
  border-color: rgba(93, 102, 117, 0.34);
}

.category-slate .category-dot {
  background: var(--mark-slate);
}

.analysis-drawer {
  position: fixed;
  z-index: 21;
  top: 92px;
  right: 22px;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 116px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 18px 44px rgba(36, 31, 22, 0.18);
}

.analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.analysis-head strong {
  font-size: 15px;
}

.analysis-head button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink);
  line-height: 1;
}

.analysis-result {
  padding: 14px 16px 18px;
  overflow: auto;
  line-height: 1.72;
  font-size: 15px;
}

.analysis-result h3 {
  margin: 1em 0 0.45em;
  font-size: 17px;
}

.analysis-result p {
  margin: 0.7em 0;
}

.analysis-placeholder,
.analysis-error {
  color: var(--muted);
}

.analysis-error {
  color: var(--red);
}

body.immersive-mode {
  background: #fbf9f2;
}

body.immersive-mode .topbar,
body.immersive-mode .library-panel,
body.immersive-mode .manager-panel {
  display: none;
}

body.immersive-mode .app-shell,
body.immersive-mode .workspace {
  display: block;
  min-height: 100vh;
}

body.immersive-mode .reader-panel {
  height: 100vh;
  background: #fbf9f2;
}

body.immersive-mode .reader-content {
  max-width: 1320px;
  padding: 22px 38px 90px;
}

body.immersive-mode .reader-head {
  max-width: 980px;
  margin: 0 auto;
  border-bottom-color: #e7dfcf;
}

body.immersive-mode .meta-grid {
  display: none;
}

body.immersive-mode .immersive-bar {
  max-width: 1180px;
  margin: 0 auto 26px;
}

body.immersive-mode .reading-layout {
  max-width: 1180px;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
}

body.immersive-mode .markdown-body {
  max-width: 780px;
  line-height: 1.92;
}

body.immersive-mode .reader-right-rail {
  top: 72px;
  max-height: calc(100vh - 96px);
}

.manager-panel {
  border-left: 1px solid var(--line);
  transition: width 180ms ease, transform 180ms ease;
}

.manager-panel.is-collapsed {
  display: none;
}

.semantic-space-panel {
  min-height: 0;
  overflow: auto;
  background:
    radial-gradient(circle at 58% 17%, rgba(95, 181, 173, 0.13), transparent 27rem),
    linear-gradient(140deg, #f8f7f2 0%, #edf1ec 100%);
}

.semantic-space-shell {
  width: min(1420px, 100%);
  min-height: 100%;
  margin: 0 auto;
  padding: 28px clamp(18px, 3vw, 44px) 42px;
}

.semantic-space-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 22px;
  max-width: 1180px;
}

.semantic-space-head h2,
.collision-room h2 {
  margin: 3px 0 0;
  color: #1d3030;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(23px, 3vw, 38px);
  line-height: 1.24;
  font-weight: 650;
}

.semantic-space-head > p {
  max-width: 210px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: right;
}

.space-eyebrow {
  margin: 0;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.semantic-space-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(246px, 300px);
  align-items: stretch;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
}

.semantic-sphere {
  position: relative;
  height: clamp(440px, calc(100vh - 260px), 730px);
  overflow: hidden;
  border: 1px solid rgba(37, 87, 82, 0.2);
  border-radius: 50%;
  isolation: isolate;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.9) 0 1.5%, transparent 12%),
    radial-gradient(circle at 47% 43%, rgba(207, 239, 232, 0.88) 0 23%, rgba(133, 195, 185, 0.35) 39%, rgba(61, 113, 106, 0.2) 64%, rgba(18, 54, 53, 0.86) 100%);
  box-shadow: inset -30px -35px 74px rgba(13, 49, 48, 0.42), inset 20px 22px 48px rgba(255, 255, 255, 0.31), 0 24px 54px rgba(34, 54, 48, 0.18);
}

.semantic-sphere::before,
.semantic-sphere::after {
  position: absolute;
  inset: 8%;
  z-index: 0;
  border: 1px solid rgba(221, 250, 242, 0.16);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.semantic-sphere::after {
  inset: 19% 6%;
  transform: rotate(-18deg);
}

.semantic-sphere-haze {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(rgba(244, 255, 250, 0.86) 0.7px, transparent 0.9px);
  background-size: 21px 21px;
  opacity: 0.43;
  mask-image: radial-gradient(circle, #000 42%, transparent 74%);
  pointer-events: none;
}

.semantic-fields,
.semantic-seeds,
.semantic-nodes,
.seed-lines {
  position: absolute;
  inset: 0;
}

.semantic-fields { z-index: 1; pointer-events: none; }
.semantic-seeds { z-index: 2; pointer-events: none; }
.seed-lines { z-index: 3; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.semantic-nodes { z-index: 4; pointer-events: none; }

.semantic-field {
  position: absolute;
  z-index: 1;
  width: var(--field-size);
  height: var(--field-size);
  padding: 0.45rem;
  border: 1px dashed rgba(229, 247, 238, 0.55);
  border-radius: 50%;
  color: #f9fffa;
  background: radial-gradient(circle, rgba(98, 190, 174, 0.22), rgba(70, 130, 119, 0.05) 64%, transparent 68%);
  box-shadow: 0 0 0 0.6rem rgba(154, 221, 206, 0.05), 0 0 2.8rem rgba(106, 203, 186, 0.2);
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: auto;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.semantic-field strong,
.semantic-field small {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 9rem;
  margin: 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(5, 39, 36, 0.74);
}

.semantic-field strong { margin-top: 34%; font-size: 12px; }
.semantic-field small { margin-top: 3px; font-size: 10px; opacity: 0.8; }
.semantic-field.is-draft { opacity: 0.8; }
.semantic-field.is-official { border-style: solid; background: radial-gradient(circle, rgba(101, 209, 189, 0.45), rgba(66, 139, 125, 0.15) 65%, transparent 69%); }
.semantic-field:hover { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 0 0 0.8rem rgba(184, 238, 224, 0.1), 0 0 4rem rgba(137, 232, 212, 0.42); }

.semantic-field-rings,
.semantic-field-rings::before,
.semantic-field-rings::after {
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(224, 255, 245, 0.21);
  border-radius: 50%;
  content: "";
}

.semantic-field-rings::before { inset: -14%; }
.semantic-field-rings::after { inset: 27%; }

.space-node {
  position: absolute;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 88px;
  min-height: 53px;
  padding: 2px 0;
  border: 0;
  color: #f4fffb;
  background: transparent;
  transform: translate(-50%, -50%) scale(var(--depth));
  transition: filter 160ms ease;
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

.space-node:hover,
.space-node:focus-visible { filter: brightness(1.24) drop-shadow(0 0 12px rgba(196, 255, 244, 0.85)); outline: none; }

.space-node-core {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(222, 255, 245, 0.9);
  border-radius: 50%;
  background: #5fd0c0;
  box-shadow: 0 0 0 5px rgba(101, 224, 203, 0.13), 0 0 19px rgba(123, 241, 221, 0.78);
  cursor: crosshair;
  pointer-events: auto;
}

.space-node-label {
  max-width: 100%;
  overflow: hidden;
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-shadow: 0 1px 5px rgba(4, 37, 35, 0.94);
  white-space: nowrap;
}

.space-node small { max-width: 100%; overflow: hidden; color: rgba(235, 255, 249, 0.73); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.space-node:not(.is-prominent) .space-node-label,
.space-node:not(.is-prominent) small {
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.space-node:not(.is-prominent):hover .space-node-label,
.space-node:not(.is-prominent):hover small,
.space-node:not(.is-prominent):focus-visible .space-node-label,
.space-node:not(.is-prominent):focus-visible small {
  opacity: 1;
  transform: translateY(0);
}

.seed-line-pending {
  stroke: #8af1dc;
  stroke-width: 0.52;
  stroke-linecap: round;
  stroke-dasharray: 1.4 0.9;
  filter: drop-shadow(0 0 4px rgba(115, 246, 220, 0.88));
}

.seed-glow {
  position: absolute;
  z-index: 2;
  width: 4.5rem;
  height: 4.5rem;
  padding: 0;
  border: 1px solid rgba(239, 246, 244, 0.64);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 252, 250, 0.8), rgba(199, 211, 209, 0.22) 40%, rgba(174, 190, 187, 0.06) 67%, transparent 72%);
  box-shadow: 0 0 0 0.7rem rgba(212, 224, 221, 0.08), 0 0 38px rgba(235, 241, 240, 0.28);
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
}

.seed-glow:hover,
.seed-glow:focus-visible { box-shadow: 0 0 0 0.85rem rgba(235, 244, 242, 0.17), 0 0 45px rgba(235, 241, 240, 0.52); outline: 2px solid rgba(247, 255, 252, 0.78); outline-offset: 3px; }

.seed-glow.is-born { animation: seed-field-born 980ms cubic-bezier(.18, .78, .22, 1) both; }

.space-node.is-drawn-together { animation: node-drawn-together 850ms cubic-bezier(.21, .77, .24, 1); }

@keyframes seed-field-born {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.12); }
  56% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes node-drawn-together {
  0%, 100% { transform: translate(-50%, -50%) scale(var(--depth)); }
  50% { transform: translate(calc(-50% + var(--pull-x)), calc(-50% + var(--pull-y))) scale(calc(var(--depth) * 1.3)); filter: brightness(1.45); }
}

.collision-seed-inspector {
  align-self: center;
  padding: 20px;
  border: 1px solid rgba(95, 124, 119, 0.25);
  border-radius: 16px;
  background: rgba(255, 254, 249, 0.9);
  box-shadow: 0 18px 42px rgba(42, 57, 51, 0.13);
}

.collision-seed-inspector h3 { margin: 5px 0 2px; color: #233b39; font-family: "Songti SC", "STSong", serif; font-size: 25px; }
.seed-status { margin: 0; color: var(--muted); font-size: 13px; }
.seed-article-pair { display: flex; align-items: center; gap: 7px; margin: 18px 0; color: #2a5e58; font-size: 13px; font-weight: 700; }
.seed-article-pair span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seed-article-pair i { color: #8b9a97; font-style: normal; }
.seed-name-label { margin: 0 0 10px; }
.seed-name-label input { min-height: 38px; }
.seed-message { min-height: 19px; margin: 0 0 8px; color: var(--teal-dark); font-size: 12px; line-height: 1.45; }
.seed-actions { display: flex; gap: 8px; margin-top: 8px; }
.seed-actions .command { flex: 1; padding-inline: 7px; font-size: 12px; }

.semantic-space-caption {
  max-width: 1180px;
  margin: 16px auto 0;
  color: #687a76;
  font-size: 12px;
  line-height: 1.6;
}

.semantic-space-error { margin: 40px; color: var(--red); }

.collision-room-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(18, 40, 38, 0.55);
  backdrop-filter: blur(8px);
}

.collision-room {
  width: min(980px, 100%);
  max-height: min(800px, calc(100vh - 56px));
  overflow: auto;
  padding: clamp(24px, 5vw, 54px);
  border: 1px solid rgba(155, 197, 186, 0.52);
  border-radius: 22px;
  background: #fffdf7;
  box-shadow: 0 28px 90px rgba(4, 29, 27, 0.4);
}

.collision-room-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.collision-room-top span { color: var(--teal-dark); font-size: 12px; font-weight: 700; }
.collision-question { max-width: 760px; margin: 14px 0 25px; color: #48615e; font-family: "Songti SC", "STSong", serif; font-size: clamp(18px, 2.25vw, 27px); line-height: 1.55; }
.collision-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.collision-compare button { display: grid; gap: 8px; min-height: 157px; padding: 18px; border: 1px solid #d7e4df; border-radius: 13px; color: #244440; background: linear-gradient(155deg, #f3faf6, #fffdfa); text-align: left; }
.collision-compare button:hover { border-color: #74a69e; box-shadow: 0 10px 22px rgba(55, 116, 105, 0.12); }
.collision-compare small { color: #5f8880; font-size: 11px; letter-spacing: .08em; }
.collision-compare strong { font-family: "Songti SC", "STSong", serif; font-size: 22px; }
.collision-compare span { color: var(--muted); font-size: 13px; }
.collision-compare em { margin-top: auto; color: var(--teal); font-size: 12px; font-style: normal; font-weight: 700; }
.collision-evidence { margin-top: 26px; padding-top: 21px; border-top: 1px solid #e5e3d9; }
.collision-evidence h3 { margin: 0 0 8px; color: #294b47; font-size: 15px; }
.collision-evidence ul { margin: 0; padding-left: 18px; color: #536560; line-height: 1.7; }
.collision-room-note { margin: 22px 0 0; color: #76837f; font-size: 12px; line-height: 1.6; }

.editor-form {
  padding: 16px;
  display: grid;
  gap: 11px;
}

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

.form-head h2 {
  margin: 0;
  font-size: 18px;
}

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

.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--blue);
  font-size: 12px;
}

@media (max-width: 1080px) {
  .workspace,
  .workspace.manager-open {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .workspace.space-open { display: block; }

  .semantic-sphere { height: min(78vw, 680px); }

  .manager-panel {
    position: fixed;
    inset: 72px 0 0 auto;
    width: min(92vw, 420px);
    box-shadow: var(--shadow);
    z-index: 4;
  }

  body.immersive-mode .reading-layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

  body.immersive-mode .markdown-body {
    max-width: 820px;
    margin: 0 auto;
  }

  .reader-right-rail,
  body.immersive-mode .reader-right-rail,
  body.immersive-mode .annotation-rail {
    position: static;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    max-height: none;
    overflow: visible;
    padding: 0;
  }

  .label-box,
  body.immersive-mode .label-box {
    position: static;
    max-height: none;
    overflow: visible;
    box-shadow: none;
  }

  .emotion-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .selection-title {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .semantic-space-shell { padding: 20px 14px 32px; }

  .semantic-space-head,
  .semantic-space-layout { display: block; }

  .semantic-space-head > p { max-width: none; margin-top: 10px; text-align: left; }

  .semantic-sphere { height: 82vw; }

  .collision-seed-inspector { margin-top: 14px; }

  .collision-room-layer { padding: 12px; }

  .collision-room { max-height: calc(100vh - 24px); border-radius: 16px; }

  .library-panel {
    max-height: 48vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .reader-content {
    padding: 24px 18px 64px;
  }

  .reader-head,
  .emotion-head,
  .reader-actions,
  .form-head {
    flex-direction: column;
  }

  .reader-actions {
    align-items: stretch;
    width: 100%;
  }

  .emotion-actions {
    width: 100%;
    justify-content: stretch;
  }

  .emotion-actions .command {
    flex: 1 1 140px;
  }

  .emotion-metrics {
    grid-template-columns: 1fr;
  }

  .emotion-chart {
    min-width: 540px;
  }

  .immersive-bar {
    align-items: stretch;
  }

  .font-control {
    grid-template-columns: 1fr;
  }

  .analysis-drawer {
    top: 16px;
    right: 16px;
  }

  .selection-toolbar {
    grid-template-columns: 1fr;
  }

  .meta-grid,
  .filter-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .label-box-head-actions {
    flex-wrap: wrap;
  }

  .category-editor-actions .command {
    flex: 1 1 96px;
  }

  .markdown-body {
    font-size: var(--reader-font-size, 16px);
  }

  body.immersive-mode .reader-content {
    padding: 16px 16px 72px;
  }

  body.immersive-mode .reader-head {
    margin-bottom: 12px;
  }
}
/* Student reading space */
.student-account {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(29, 113, 96, .2);
  border-radius: 999px;
  color: #1d7160;
  background: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-weight: 700;
}

.reading-completion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 32px 0 8px;
  padding: 18px 20px;
  border: 1px solid rgba(29, 113, 96, .18);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(239, 249, 244, .95), rgba(255, 249, 235, .95));
}

.reading-completion p { margin: 0; color: #64736d; font-size: 14px; }
.reading-completion.is-read { border-color: rgba(29, 113, 96, .38); background: #edf8f0; }

.student-auth-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(35, 58, 48, .32);
  backdrop-filter: blur(12px);
}

.student-auth-card {
  width: min(460px, 100%);
  padding: 36px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px;
  background: #fffdf7;
  box-shadow: 0 26px 80px rgba(35, 58, 48, .22);
}

.auth-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 50%;
  color: #fffdf7;
  background: #1d7160;
  font-size: 26px;
  font-family: serif;
}

.auth-eyebrow { margin: 0 0 10px; color: #1d7160; font-size: 11px; letter-spacing: .18em; }
.student-auth-card h2 { margin: 0 0 10px; color: #1d322c; font-size: 28px; }
.student-auth-card > p:not(.auth-eyebrow):not(.form-message) { margin: 0 0 26px; color: #718078; line-height: 1.7; }
.student-auth-card label { display: block; margin-bottom: 8px; color: #40514a; font-size: 13px; font-weight: 700; }
.student-auth-card input { width: 100%; box-sizing: border-box; padding: 13px 14px; border: 1px solid #d8e0da; border-radius: 12px; background: #fff; font: inherit; }
.student-auth-card .auth-submit { width: 100%; margin-top: 16px; padding: 13px 16px; border: 0; border-radius: 12px; color: #fff; background: #1d816d; font: inherit; font-weight: 700; cursor: pointer; }
.student-auth-card .auth-submit span { float: right; font-size: 20px; line-height: 16px; }

@media (max-width: 720px) {
  .reading-completion { align-items: stretch; flex-direction: column; }
  .student-auth-card { padding: 28px 22px; }
}
