@font-face {
  font-family: "LXGW WenKai Local";
  src: url("/static/fonts/LXGWWenKai-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-color: #f0edea;
  --paper-color: #f0edea;
  --panel-color: #f0edea;
  --text-color: #2c2c2c;
  --muted-color: #77716c;
  --line-color: #d8d3ce;
  --accent-color: #c44b2b;
  --accent-soft: rgba(196, 75, 43, 0.08);
  --mark-color: rgba(196, 75, 43, 0.15);
  --selection-color: rgba(196, 75, 43, 0.2);
  --shadow: 0 10px 24px rgba(85, 72, 60, 0.04);
  --rail-dark: #f0edea;
  --rail-dark-2: rgba(255, 252, 247, 0.32);
  --rail-dark-3: rgba(255, 252, 247, 0.52);
  --rail-gold: #d7b675;
  --rail-gold-soft: rgba(215, 182, 117, 0.12);
  --rail-text: #5a4d42;
  --rail-muted: #9b9187;
  --rail-radius: 8px;
  --rail-width: 58px;
  --chat-width: 66vw;
  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --reading-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: var(--ui-font);
  line-height: 1.75;
  overflow: hidden;
}

body.idea-inspecting,
body.idea-inspecting * {
  cursor: crosshair !important;
}

::selection {
  background: var(--selection-color);
}

::highlight(listening-follow-word) {
  background: rgba(214, 131, 95, 0.28);
  color: #2c2c2c;
}

.shell {
  position: fixed;
  inset: 6px;
  width: auto;
  height: auto;
  margin: 0;
}

.view-mode-switch {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: translateX(-50%);
}

.view-mode-btn {
  min-width: 34px;
  height: 24px;
  padding: 0 1px 3px;
  border: 1px solid transparent;
  border-radius: 0;
  border-bottom-color: transparent;
  background: transparent;
  color: var(--muted-color);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
}

.view-mode-btn.active {
  border-bottom-color: #b88d73;
  background: transparent;
  color: #5a4536;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(58px, var(--rail-width)) 1px minmax(520px, 1fr) 1px minmax(320px, var(--chat-width));
  gap: 0;
  height: 100%;
  padding-top: 40px;
}

.workspace-layout[data-view-mode="read"] {
  grid-template-columns: minmax(520px, 1fr);
}

.workspace-layout[data-view-mode="read"] .rail,
.workspace-layout[data-view-mode="read"] #resizeLeft,
.workspace-layout[data-view-mode="read"] #resizeRight,
.workspace-layout[data-view-mode="read"] .chat-panel {
  display: none;
}

.workspace-layout[data-view-mode="input"] {
  grid-template-columns: minmax(58px, var(--rail-width)) 1px minmax(340px, 1fr) 1px minmax(420px, var(--chat-width));
}

.rail,
.center-stack,
.chat-panel {
  min-height: 0;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--rail-text);
}

.rail-head {
  min-height: 38px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.rail-title-block {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.rail-title {
  font-family: Georgia, "Songti SC", serif;
  font-size: 1.08rem;
  line-height: 1.12;
  font-weight: 900;
  color: var(--rail-text);
}

.rail-subtitle {
  color: var(--rail-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.rail-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rail-new-focus {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(189, 175, 160, 0.28);
  border-radius: var(--rail-radius);
  background: rgba(255, 252, 247, 0.26);
  color: rgba(91, 78, 67, 0.82);
  font-size: 0.88rem;
  font-weight: 900;
}

.rail-new-focus:hover {
  border-color: rgba(189, 175, 160, 0.42);
  background: rgba(255, 252, 247, 0.44);
}

.rail-toggle-button {
  min-width: 24px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--rail-muted);
  font-size: 1rem;
  opacity: 0.72;
}

.rail-toggle-button:hover {
  background: rgba(215, 182, 117, 0.1);
  color: var(--rail-text);
  opacity: 1;
}

.rail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rail-label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rail-muted);
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.focus-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rail-item {
  width: 100%;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 1px solid #ddd8d2;
  border-radius: 12px;
  background: #f8f5f1;
  text-align: left;
}

.rail-item:hover {
  background: #f2ede7;
}

.rail-item.active {
  border-color: rgba(196, 75, 43, 0.22);
  background: rgba(196, 75, 43, 0.08);
}

.rail-item-title {
  font-size: 0.92rem;
  line-height: 1.4;
}

.rail-item-meta {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted-color);
}

.focus-card-shell {
  position: relative;
  width: 100%;
}

.focus-card {
  width: 100%;
  min-height: 52px;
  padding: 9px 56px 9px 10px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(188, 176, 163, 0.22);
  border-radius: var(--rail-radius);
  background: rgba(255, 252, 247, 0.18);
  text-align: left;
  box-shadow: none;
}

.focus-card:hover,
.focus-card-shell:hover .focus-card {
  border-color: rgba(188, 176, 163, 0.34);
  background: rgba(255, 252, 247, 0.36);
}

.focus-card.active,
.focus-card-shell.active .focus-card {
  border-color: rgba(196, 75, 43, 0.16);
  background: rgba(196, 75, 43, 0.045);
}

.focus-title {
  min-width: 0;
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.28;
  color: var(--rail-text);
}

.focus-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 20px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--rail-muted);
  font-size: 0.78rem;
  opacity: 0.72;
}

.focus-menu-button {
  position: absolute;
  top: 8px;
  right: 30px;
  width: 20px;
  min-width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--rail-muted);
  font-size: 0.74rem;
  line-height: 1;
  opacity: 0.72;
}

.focus-menu-button:hover,
.focus-menu-button[aria-expanded="true"] {
  background: rgba(215, 182, 117, 0.1);
  color: var(--rail-text);
  opacity: 1;
}

.focus-menu {
  position: absolute;
  top: 31px;
  right: 8px;
  z-index: 18;
  width: 118px;
  padding: 5px;
  border: 1px solid #ded3c7;
  border-radius: 10px;
  background: #fbf7f1;
  box-shadow: 0 8px 20px rgba(85, 72, 60, 0.08);
}

.focus-menu[hidden] {
  display: none !important;
}

.focus-menu button {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #675a50;
  font-size: 0.75rem;
  text-align: left;
}

.focus-menu button:hover {
  background: #f0e8df;
}

.focus-delete:hover {
  background: rgba(215, 182, 117, 0.1);
  color: var(--rail-text);
  opacity: 1;
}

.workspace-layout.rail-compact .rail {
  align-items: center;
  gap: 10px;
  padding: 12px 6px;
  border-radius: 0;
}

.workspace-layout.rail-compact .rail-head,
.workspace-layout.rail-compact .rail-section,
.workspace-layout.rail-compact .focus-list {
  width: 100%;
  align-items: center;
}

.workspace-layout.rail-compact .rail-title-block,
.workspace-layout.rail-compact .rail-label,
.workspace-layout.rail-compact .focus-title,
.workspace-layout.rail-compact .focus-context {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.workspace-layout.rail-compact .rail-head {
  justify-content: center;
  min-height: 24px;
}

.workspace-layout.rail-compact .rail-head-actions {
  flex-direction: column;
}

.workspace-layout.rail-compact .rail-new-focus {
  width: 36px;
  min-height: 34px;
  padding: 0;
  font-size: 0;
}

.workspace-layout.rail-compact .rail-new-focus::before {
  content: "+";
  font-size: 1rem;
  line-height: 1;
}

.workspace-layout.rail-compact .focus-card-shell {
  width: 36px;
}

.workspace-layout.rail-compact .focus-card {
  min-height: 36px;
  padding: 0;
  justify-content: center;
}

.workspace-layout.rail-compact .focus-card::before {
  content: attr(data-short);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--rail-text);
}

.workspace-layout.rail-compact .focus-delete {
  top: -5px;
  right: -5px;
  width: 14px;
  min-width: 14px;
  height: 14px;
  font-size: 0.6rem;
  background: rgba(255, 252, 247, 0.48);
  border-color: rgba(188, 176, 163, 0.2);
}

.workspace-layout.rail-compact .focus-menu-button {
  top: -5px;
  right: 12px;
  width: 14px;
  min-width: 14px;
  height: 14px;
  font-size: 0.56rem;
  background: rgba(255, 252, 247, 0.48);
}

.workspace-layout.rail-compact .focus-menu {
  top: 18px;
  right: -3px;
}

.resize-handle {
  position: relative;
  min-height: 0;
  cursor: col-resize;
  opacity: 1;
  background: #ded7cf;
}

.resize-handle::before {
  content: none;
  position: absolute;
  inset: 0;
  margin: auto;
  width: 2px;
  height: 100%;
  border-radius: 999px;
  background: rgba(216, 211, 206, 0.95);
}

.resize-handle:hover::before,
.resize-handle.dragging::before {
  background: transparent;
}

.center-stack {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}

.panel {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--paper-color);
  box-shadow: none;
}

.reading-panel,
.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.reading-panel {
  position: relative;
  overflow: hidden;
}

.notes-panel {
  display: none;
}

.titlebar {
  min-height: 46px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: #f0edea;
  border-bottom: 1px solid #ded7cf;
}

.titlebar #readingFlowToggleBtn,
.titlebar #organizeToggleBtn,
.titlebar label[for="markdownFile"] {
  display: none !important;
}

.titlebar-chat {
  display: none;
}

.panel-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 18px;
  border-bottom: 1px solid #e4dfd9;
  background: transparent;
}

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

.panel-meta {
  font-size: 0.92rem;
  color: var(--muted-color);
}

.creator-dock {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 20;
  width: auto;
}

.creator-pill {
  position: relative;
  z-index: 1;
  min-width: 40px;
  min-height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(188, 176, 163, 0.26);
  border-radius: 9px;
  background: rgba(255, 252, 247, 0.18);
  color: rgba(98, 86, 76, 0.82);
  box-shadow: none;
  backdrop-filter: none;
}

.creator-pill:hover {
  border-color: rgba(188, 176, 163, 0.38);
  background: rgba(255, 252, 247, 0.34);
}

.creator-pill[aria-expanded="true"] {
  border-color: rgba(196, 75, 43, 0.14);
  background: rgba(196, 75, 43, 0.045);
  color: rgba(81, 71, 63, 0.9);
}

.creator-pill-name {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0;
}

.idea-popover {
  position: absolute;
  left: 0;
  bottom: 32px;
  width: min(304px, calc(100vw - 20px));
  padding: 0;
  border: 1px solid rgba(188, 176, 163, 0.3);
  border-radius: 12px;
  background: rgba(243, 239, 233, 0.98);
  color: var(--text-color);
  box-shadow: 0 10px 22px rgba(85, 72, 60, 0.055);
  backdrop-filter: none;
  transform-origin: bottom left;
}

.idea-popover[hidden] {
  display: none !important;
}

.idea-status {
  font-size: 0.76rem;
  color: var(--muted-color);
}

.idea-compose-card,
.idea-target-card,
.idea-toolbar,
.idea-feedback-head,
.idea-list {
  margin-left: 12px;
  margin-right: 12px;
}

.idea-compose-card {
  margin-top: 12px;
}

.idea-input-row {
  display: block;
}

.idea-input-row textarea,
.idea-compose-card textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid rgba(188, 176, 163, 0.32);
  border-radius: 10px;
  background: rgba(255, 252, 247, 0.58);
  color: var(--text-color);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.62;
  box-shadow: none;
}

.idea-input-row textarea::placeholder,
.idea-compose-card textarea::placeholder {
  color: #a49b92;
}

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

.idea-feedback-head {
  margin-top: 14px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted-color);
  letter-spacing: 0.03em;
}

.idea-target-card {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(188, 176, 163, 0.3);
  border-radius: 10px;
  background: rgba(255, 252, 247, 0.34);
  box-shadow: none;
}

.idea-target-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.idea-target-label {
  font-size: 0.72rem;
  color: var(--muted-color);
}

.idea-inline-close {
  min-width: 14px;
  width: 14px;
  height: 14px;
  padding: 0;
  color: var(--muted-color);
  font-size: 0.78rem;
  line-height: 1;
}

.idea-target-text {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-color);
  word-break: break-word;
}

.idea-toolbar {
  margin-top: 8px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 2px;
}

.idea-tool-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0;
  color: #776c61;
  font-size: 0.78rem;
}

.idea-tool-link:hover {
  color: var(--accent-color);
}

.idea-tool-icon {
  font-size: 0.78rem;
}

.idea-submit-btn {
  min-height: 28px;
  padding: 0 0 0 8px;
  border: 0;
  background: transparent;
  color: var(--accent-color);
  font-size: 0.8rem;
  gap: 6px;
}

.idea-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 14px;
  max-height: 244px;
  overflow: auto;
}

.idea-item {
  position: relative;
  padding: 10px 11px 12px;
  border: 1px solid #d8cfc4;
  border-radius: 11px;
  background: #f9f3eb;
  box-shadow: none;
}

.idea-item-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding-right: 32px;
}

.idea-item-head-copy {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.idea-item-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 0.68rem;
  color: var(--muted-color);
}

.idea-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 17px;
  padding: 0 6px;
  border: 1px solid #d8cfc4;
  border-radius: 999px;
  background: #f4eee6;
  color: #766a5f;
  font-size: 0.62rem;
  font-weight: 600;
  white-space: nowrap;
}

.idea-stage-dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #b7aa9c;
}

.idea-stage-developing .idea-stage-dot {
  background: #d08a45;
}

.idea-stage-testing .idea-stage-dot {
  background: #6f9c8d;
}

.idea-stage-launched .idea-stage-dot {
  background: #65a86b;
}

.idea-stage-rejected .idea-stage-dot {
  background: #b76f5f;
}

.idea-item-text {
  margin: 0;
  font-size: 0.81rem;
  line-height: 1.58;
  white-space: pre-wrap;
  color: var(--text-color);
}

.idea-rejection-reason {
  margin: 7px 0 0;
  padding: 7px 9px;
  border: 1px solid #decfc2;
  border-radius: 9px;
  background: #f4eee6;
  color: #7b6255;
  font-size: 0.73rem;
  line-height: 1.5;
}

.idea-delete,
.idea-delete.icon-button {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 14px;
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 999px;
  background: transparent !important;
  border-color: transparent !important;
  color: var(--muted-color);
  font-size: 0.6rem;
  line-height: 1;
  opacity: 0.42;
  border: 0 !important;
  box-shadow: none !important;
}

.idea-delete:hover {
  background: rgba(196, 75, 43, 0.08);
  color: var(--accent-color);
  opacity: 0.9;
}

.idea-feedback-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.idea-feedback-item {
  padding: 8px 10px;
  border: 1px solid #d8cfc4;
  border-radius: 10px;
  background: #f4eee6;
}

.idea-item-target {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #d8cfc4;
  border-radius: 10px;
  background: #f4eee6;
}

.idea-target-block + .idea-target-block {
  margin-top: 8px;
}

.idea-item-target-label {
  margin: 0 0 4px;
  font-size: 0.7rem;
  color: var(--muted-color);
}

.idea-item-target-text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-color);
  word-break: break-word;
}

.idea-target-image {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid #d8cfc4;
  border-radius: 9px;
  background: #fbf7f1;
  cursor: zoom-in;
}

.idea-screenshot-preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(58, 49, 42, 0.34);
}

.idea-screenshot-preview[hidden] {
  display: none !important;
}

.idea-screenshot-preview-image {
  max-width: min(920px, 92vw);
  max-height: 86vh;
  border: 1px solid #d8cfc4;
  border-radius: 16px;
  background: #f4eee6;
  box-shadow: 0 22px 64px rgba(58, 49, 42, 0.22);
}

.idea-screenshot-preview-close {
  position: fixed;
  top: 20px;
  right: 22px;
  width: 28px;
  height: 28px;
  border: 1px solid #d8cfc4;
  border-radius: 999px;
  background: #f4eee6;
  color: #62564c;
  font-size: 0.86rem;
}

.idea-feedback-toggle,
.idea-feedback-toggle.icon-button {
  position: absolute;
  top: 8px;
  right: 26px;
  min-width: 14px;
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 999px;
  border-color: transparent !important;
  background: transparent !important;
  color: var(--muted-color);
  font-size: 0.52rem;
  line-height: 1;
  opacity: 0.42;
  border: 0 !important;
  box-shadow: none !important;
}

.idea-feedback-toggle:hover {
  color: var(--accent-color);
  border-color: transparent;
  opacity: 0.9;
}

.idea-feedback-compose[hidden] {
  display: none !important;
}

.idea-feedback-input {
  width: 100%;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #d8cfc4;
  border-radius: 10px;
  background: #fbf7f1;
  color: var(--text-color);
  font: inherit;
}

.idea-feedback-send {
  margin-top: 8px;
  min-height: 28px;
  padding: 0 11px;
  border-color: #d8cfc4;
  background: #eee5db;
  color: var(--text-color);
}

.idea-inspect-overlay[hidden] {
  display: none !important;
}

.idea-inspect-overlay {
  position: fixed;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}

.idea-inspect-box {
  position: fixed;
  border: 2px solid rgba(249, 152, 60, 0.96);
  border-radius: 12px;
  background: rgba(249, 152, 60, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 196, 112, 0.22);
  pointer-events: none;
}

.reading-meta-bar {
  border-bottom: 0;
}

.book-progress-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: min(180px, 24vw);
  padding: 0 6px 0 0;
}

.book-progress-inline-copy {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.book-progress-inline-title {
  min-width: 34px;
  text-align: right;
  font-size: 0.72rem;
  font-weight: 700;
  color: #6a5648;
  white-space: nowrap;
}

.book-progress-inline-meta {
  display: none;
}

.book-progress-inline-track {
  flex: 1 1 120px;
  min-width: 96px;
  max-width: 164px;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(201, 157, 125, 0.18);
}

.book-progress-inline-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d6835f 0%, #e8aa76 100%);
  transition: width 180ms ease;
}

#markdownFile {
  display: none;
}

button,
.icon-button,
.composer-button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-color);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

button:active,
.icon-button:active,
.composer-button:active {
  transform: scale(0.98);
}

.icon-button,
.composer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 10px;
  border-color: #ddd8d2;
  background: #f5f2ee;
}

.chrome-button {
  border-color: #ddd8d2;
  background: #f5f2ee;
}

.reading-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #ddd8d2;
  border-radius: 999px;
  background: #f5f2ee;
  color: var(--muted-color);
  font-size: 0.82rem;
  cursor: pointer;
}

.reading-chip:hover {
  background: #ede8e2;
  border-color: #cfc8c1;
}

.reading-chip.is-playing,
.reading-chip.is-preparing {
  border-color: rgba(199, 103, 70, 0.26);
  background: #f4dfd4;
  color: #8b3d29;
}

.reading-chip.is-paused {
  border-color: #d8cfc4;
  background: #fbf7f1;
  color: #6f584a;
}

.reading-chip.active {
  border-color: #cfc4b8;
  background: #ebe4dc;
  color: #5a4536;
}

.reading-chip:disabled {
  opacity: 0.66;
  cursor: progress;
}

.icon-button:hover,
.composer-button:hover {
  background: #ede8e2;
  border-color: #cfc8c1;
}

.send-button {
  min-width: 40px;
  height: 38px;
  border-radius: 12px;
  border-color: rgba(196, 75, 43, 0.25);
  background: rgba(196, 75, 43, 0.08);
  color: var(--accent-color);
  font-size: 1rem;
}

.send-button:hover {
  background: rgba(196, 75, 43, 0.14);
}

.reading-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 14px 14px;
  overflow: hidden;
}

.reading-pane {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(164, 155, 146, 0.35) transparent;
  border: 0;
  border-radius: 12px;
  background: var(--bg-color);
}

.reading-resume-mark {
  display: none !important;
  position: fixed;
  z-index: 9;
  width: 10px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(196, 75, 43, 0.48);
  box-shadow: 0 0 0 2px rgba(244, 237, 229, 0.86), 0 5px 12px rgba(86, 60, 45, 0.14);
  opacity: 0.78;
}

.reading-resume-mark:hover {
  opacity: 1;
  transform: scaleX(1.12);
}

.reading-page-controls {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(380px, calc(100% - 64px));
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: translateX(-50%);
  backdrop-filter: none;
}

.reading-page-btn {
  min-height: 28px;
  padding: 0 4px;
  border-radius: 999px;
  color: #8a796b;
  font-size: 0.74rem;
  font-weight: 700;
  background: transparent;
}

.reading-page-btn:hover {
  background: transparent;
  color: #5f4f43;
}

.reading-page-jump {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 28px;
  padding: 0 7px 0 4px;
  border: 1px solid rgba(190, 157, 132, 0.16);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.52);
}

.reading-page-input {
  width: 44px;
  height: 24px;
  padding: 0 5px;
  border: 0;
  border-radius: 999px;
  outline: none;
  background: transparent;
  color: #58483d;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}

.reading-page-input:focus {
  background: transparent;
  box-shadow: none;
}

.reading-page-indicator {
  min-width: 36px;
  text-align: left;
  color: #9b8877;
  font-size: 0.7rem;
  font-weight: 700;
}

.reading-mode-toast {
  position: sticky;
  top: 12px;
  z-index: 7;
  width: fit-content;
  max-width: min(360px, calc(100% - 32px));
  margin: 12px auto 0;
  padding: 7px 12px;
  border: 1px solid rgba(196, 75, 43, 0.16);
  border-radius: 999px;
  background: rgba(247, 241, 232, 0.96);
  color: #7c6d60;
  font-size: 0.76rem;
  line-height: 1.4;
  box-shadow: 0 6px 16px rgba(85, 72, 60, 0.08);
  pointer-events: none;
}

.reading-explain-card {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 8;
  width: min(448px, calc(100% - 36px));
  margin: 0;
  padding: 15px 17px 16px;
  border: 1px solid rgba(196, 75, 43, 0.13);
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.97);
  box-shadow: 0 14px 36px rgba(82, 68, 55, 0.13);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

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

.reading-explain-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
}

.reading-explain-copy {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  flex: 1 1 auto;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.reading-explain-title-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
}

.reading-explain-word {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 1rem;
  font-weight: 700;
  color: #5b4a3d;
}

.reading-explain-meta {
  font-size: 0.78rem;
  color: #8b7d71;
}

.reading-explain-body {
  margin-top: 14px;
  font-size: 0.86rem;
  line-height: 1.64;
  color: #5f5349;
  white-space: normal;
}

.reading-explain-body.plain-text {
  white-space: pre-wrap;
}

.reading-lookup-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #7c6d60;
}

.reading-loading-label {
  letter-spacing: 0.01em;
}

.reading-loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.reading-loading-dots span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(196, 75, 43, 0.72);
  animation: readingDotPulse 0.9s ease-in-out infinite;
}

.reading-loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.reading-loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes readingDotPulse {
  0%, 80%, 100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-1px);
  }
}

.reading-lookup-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reading-lookup-card-stable {
  min-height: 280px;
}

.reading-lookup-card-streaming {
  gap: 8px;
}

.reading-lookup-stream-label {
  color: #9a7662;
  font-size: 0.74rem;
  font-weight: 700;
}

.reading-lookup-line {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-height: 22px;
}

.reading-lookup-label {
  flex: 0 0 auto;
  color: #8b7d71;
  font-size: 0.76rem;
}

.reading-lookup-sense {
  min-height: 78px;
  padding-top: 0;
  border-top: 1px solid rgba(196, 75, 43, 0.08);
  transition: opacity 160ms ease;
}

.reading-lookup-sense-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-top: 10px;
}

.reading-lookup-pos {
  flex: 0 0 auto;
  min-width: 20px;
  color: #8b7d71;
  font-size: 0.76rem;
}

.reading-lookup-meaning {
  color: #4f4339;
  font-weight: 600;
}

.reading-lookup-example {
  min-height: 46px;
  margin-top: 8px;
  padding: 10px 12px 10px 30px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.58);
  color: #76695d;
  font-size: 0.8rem;
}

.reading-lookup-example p {
  margin: 0;
}

.reading-lookup-example-en {
  color: #5f5349;
}

.reading-lookup-example-zh {
  margin-top: 3px !important;
  color: #8a6b5c;
}

.reading-lookup-phrase {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(196, 75, 43, 0.07);
  color: #6d5548;
  font-size: 0.8rem;
}

.reading-lookup-phrase strong {
  font-weight: 650;
  color: #4f4339;
}

.reading-lookup-context {
  min-height: 74px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(196, 75, 43, 0.08);
}

.reading-lookup-context.muted {
  color: #9b8d80;
}

.reading-lookup-context span {
  display: block;
  margin-bottom: 6px;
  color: #9a7662;
  font-size: 0.74rem;
  font-weight: 700;
}

.reading-lookup-context p {
  margin: 0;
  color: #55483e;
}

.reading-translation-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reading-translation-main,
.reading-translation-structure {
  padding: 12px 14px;
  border: 1px solid rgba(196, 75, 43, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
}

.reading-translation-main span,
.reading-translation-section-title {
  display: block;
  margin-bottom: 6px;
  color: #9a7662;
  font-size: 0.74rem;
  font-weight: 700;
}

.reading-translation-main p,
.reading-translation-note,
.reading-translation-phrases p {
  margin: 0;
  color: #55483e;
}

.reading-translation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.reading-translation-grid div {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(196, 75, 43, 0.06);
}

.reading-translation-grid em {
  display: block;
  color: #9b8d80;
  font-style: normal;
  font-size: 0.68rem;
}

.reading-translation-grid strong {
  color: #4f4339;
  font-size: 0.78rem;
}

.reading-translation-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.reading-translation-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(196, 75, 43, 0.08);
  color: #6d5548;
  font-size: 0.72rem;
}

.reading-translation-phrases {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.reading-translation-phrases strong {
  color: #4f4339;
}

.reading-translation-note {
  margin-top: 10px;
  color: #76695d;
  font-size: 0.78rem;
}

.reading-lookup-skeleton {
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(196, 75, 43, 0.06), rgba(196, 75, 43, 0.12), rgba(196, 75, 43, 0.06));
  background-size: 220% 100%;
  animation: readingSkeletonFlow 1.15s ease-in-out infinite;
}

.reading-lookup-skeleton.short {
  width: 62%;
  height: 16px;
}

@keyframes readingSkeletonFlow {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.reading-explain-inline-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: #8b7d71;
  font: inherit;
  font-size: 0.64rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reading-explain-inline-icon.is-playing {
  color: #b86348;
}

.reading-explain-inline-icon:disabled {
  opacity: 0.62;
}

.reading-explain-save {
  flex: 0 0 auto;
  min-width: 54px;
  height: 31px;
  padding: 0 13px;
  border: 1px solid rgba(196, 75, 43, 0.16);
  border-radius: 999px;
  background: rgba(196, 75, 43, 0.08);
  color: #825b47;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
}

.reading-explain-save[disabled] {
  opacity: 0.64;
}

.reading-explain-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: #8b7d71;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reading-explain-icon.danger {
  color: #a35d52;
}

.organize-overlay {
  position: absolute;
  top: 92px;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(240, 237, 234, 0.72);
  backdrop-filter: blur(5px);
  z-index: 6;
  pointer-events: auto;
}

.organize-overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.organize-card {
  width: min(420px, calc(100% - 32px));
  padding: 18px 18px 16px;
  border: 1px solid #ddd8d2;
  border-radius: 16px;
  background: rgba(248, 245, 241, 0.95);
  box-shadow: 0 16px 34px rgba(85, 72, 60, 0.1);
}

.organize-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.organize-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.organize-progress-text {
  font-size: 0.82rem;
  color: var(--muted-color);
}

.organize-progress-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(196, 75, 43, 0.1);
}

.organize-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(196, 75, 43, 0.52), rgba(196, 75, 43, 0.92));
  transition: width 180ms ease;
  position: relative;
  overflow: hidden;
}

.organize-progress-bar.is-starting {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.14) 0 10px,
      rgba(255, 255, 255, 0.02) 10px 20px
    ),
    linear-gradient(90deg, rgba(196, 75, 43, 0.42), rgba(196, 75, 43, 0.84));
  transition: width 260ms ease;
  background-size: 28px 28px, 100% 100%;
  animation: organizeProgressStripes 0.9s linear infinite;
}

.organize-progress-bar.is-starting::after {
  content: none;
}

@keyframes organizeProgressStripes {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 28px 0, 0 0;
  }
}

.organize-phase-text {
  margin: 12px 0 0;
  font-size: 0.84rem;
  color: var(--muted-color);
}

.organize-chunk-eta {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: #8b7d71;
}

.organize-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.organize-action-btn {
  min-height: 30px;
  padding: 0 10px;
}

.toc-shell {
  position: absolute;
  top: 96px;
  bottom: 24px;
  left: 14px;
  width: 0;
  z-index: 4;
}

.toc-hotspot {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(196, 75, 43, 0.04), rgba(196, 75, 43, 0.12), rgba(196, 75, 43, 0.04));
  opacity: 0.22;
  transition: opacity 140ms ease, transform 140ms ease;
}

.toc-panel {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 220px;
  max-height: min(65vh, 560px);
  overflow: auto;
  padding: 12px;
  border: 1px solid #ddd8d2;
  border-radius: 14px;
  background: rgba(244, 240, 235, 0.96);
  box-shadow: 0 12px 28px rgba(85, 72, 60, 0.1);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-8px);
  transition: opacity 140ms ease, transform 140ms ease;
  backdrop-filter: blur(10px);
}

.reading-panel:hover .toc-hotspot,
.toc-shell:hover .toc-hotspot {
  opacity: 0.78;
}

.toc-shell:hover .toc-panel,
.toc-panel:hover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.toc-panel-head {
  margin-bottom: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-color);
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-item {
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  color: var(--muted-color);
  line-height: 1.45;
}

.toc-item:hover {
  background: rgba(196, 75, 43, 0.08);
  color: var(--text-color);
}

.toc-item.active {
  background: rgba(196, 75, 43, 0.12);
  color: var(--accent-color);
}

.toc-item.level-2 {
  padding-left: 16px;
}

.toc-item.level-3,
.toc-item.level-4,
.toc-item.level-5,
.toc-item.level-6 {
  padding-left: 24px;
}

.reading-empty {
  padding: 30px;
  color: var(--muted-color);
}

.reading-content {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 30px 30px 92px;
  overflow: visible;
  color: var(--text-color);
  font-size: 1.16rem;
  font-family: var(--reading-font);
  font-weight: 400;
  letter-spacing: 0;
}

.workspace-layout[data-view-mode="read"] .reading-content {
  max-width: 1040px;
  font-size: 1.22rem;
}

.workspace-layout[data-view-mode="input"] .reading-content {
  max-width: 900px;
}

.reading-content p {
  margin: 0.8em 0;
  line-height: 1.9;
  text-align: justify;
}

.reading-pane[data-flow-mode="paged"] {
  scroll-behavior: auto;
  scroll-snap-type: none;
}

.reading-pane[data-flow-mode="paged"] .reading-content {
  max-width: 860px;
  padding-top: 34px;
  padding-bottom: 76px;
}

.reading-pane[data-flow-mode="paged"] .reading-content > p,
.reading-pane[data-flow-mode="paged"] .reading-content > blockquote,
.reading-pane[data-flow-mode="paged"] .reading-content > ul,
.reading-pane[data-flow-mode="paged"] .reading-content > ol,
.reading-pane[data-flow-mode="paged"] .reading-content > h1,
.reading-pane[data-flow-mode="paged"] .reading-content > h2,
.reading-pane[data-flow-mode="paged"] .reading-content > h3 {
  scroll-snap-align: none;
}

.reading-locate-flash {
  border-radius: 12px;
  background: rgba(214, 131, 95, 0.12);
  box-shadow: 0 0 0 8px rgba(214, 131, 95, 0.08);
  transition: background 220ms ease, box-shadow 220ms ease;
}

.reading-resume-target {
  border-radius: 12px;
  background: rgba(215, 182, 117, 0.12);
  box-shadow: 0 0 0 10px rgba(215, 182, 117, 0.055);
  transition: background 260ms ease, box-shadow 260ms ease;
}

.reading-content h1,
.reading-content h2,
.reading-content h3,
.reading-content h4,
.reading-content h5,
.reading-content h6 {
  position: relative;
  color: #1a1a1a;
  font-weight: 700;
  line-height: 1.4;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
}

.reading-content h1 {
  font-size: 1.8em;
  padding-bottom: 0.3em;
}

.reading-content h2 {
  font-size: 1.5em;
  padding-bottom: 0.2em;
}

.reading-content h3 {
  font-size: 1.25em;
}

.reading-content h4 {
  font-size: 1.1em;
}

.reading-content h5 {
  font-size: 1em;
}

.reading-content h6 {
  font-size: 0.95em;
  color: #555;
}

.reading-content > h1:first-child,
.reading-content > h2:first-child,
.reading-content > h3:first-child {
  margin-top: 0;
}

.reading-content strong {
  color: var(--accent-color);
  font-weight: 700;
}

.reading-content em {
  font-style: italic;
  color: #444;
}

.reading-content hr {
  border: 0;
  border-top: 1px solid var(--line-color);
  margin: 2.5em 0;
  height: 0;
}

.reading-content ul,
.reading-content ol {
  padding-left: 1.8em;
  margin: 0.8em 0;
}

.reading-content li {
  margin: 0.35em 0;
  line-height: 1.8;
}

.reading-content blockquote {
  margin: 1.5em 0;
  padding: 15px 20px 15px 25px;
  border-left: 4px solid var(--accent-color);
  background: #eae6e1;
  color: #444;
}

.reading-content blockquote p {
  margin: 0.5em 0;
}

.reading-content code {
  font-family: "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  margin: 0 2px;
  background: #e8e4df;
  border-radius: 3px;
  color: var(--accent-color);
}

.reading-content mark {
  background: var(--mark-color);
  color: var(--text-color);
  padding: 1px 4px;
  border-radius: 2px;
}

.saved-word-inline {
  position: relative;
  display: inline;
  margin: 0 2px;
  cursor: pointer;
}

.saved-word-highlight {
  display: inline;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(242, 208, 98, 0.38);
  box-shadow: inset 0 -1px 0 rgba(190, 146, 18, 0.18);
}

.saved-word-trigger {
  display: none !important;
  position: absolute;
  top: -0.48em;
  right: -0.82em;
  width: 6px;
  height: 6px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(196, 75, 43, 0.62);
  color: transparent;
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.saved-word-popover {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  z-index: 4;
  width: min(448px, calc(100vw - 72px));
  max-width: 448px;
  padding: 15px 17px 16px;
  border: 1px solid #ddd1c4;
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.98);
  color: #5f5349;
  font-size: 0.86rem;
  line-height: 1.64;
  white-space: normal;
  box-shadow: 0 14px 36px rgba(82, 68, 55, 0.13);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.saved-word-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.saved-word-popover-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.saved-word-popover-word {
  font-size: 1rem;
  font-weight: 700;
  color: #5b4a3d;
}

.saved-word-popover-meta {
  color: #8b7d71;
  font-size: 0.78rem;
}

.saved-word-popover-body {
  white-space: normal;
}

.saved-word-upgrading {
  margin-top: 8px;
  color: #9a7662;
  font-size: 0.74rem;
  font-weight: 700;
}

.saved-word-popover-action {
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: #8b7d71;
  font: inherit;
  font-size: 0.68rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.saved-word-popover-action.close {
  color: #9b6f5c;
  font-size: 0.82rem;
}

.saved-word-popover-tools {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex: 0 0 auto;
}

.saved-word-unmark-action {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid rgba(198, 158, 132, 0.22);
  border-radius: 50%;
  background: #fbf7f1;
  color: #9b6f5c;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.saved-word-unmark-action:hover,
.saved-word-popover-action.close:hover {
  color: #7a4638;
}

.saved-word-danger-row {
  display: none;
  justify-content: flex-end;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(221, 209, 196, 0.64);
}

.saved-word-inline.show-danger .saved-word-danger-row {
  display: flex;
}

.saved-word-delete-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: #9b6f5c;
  font-size: 0.72rem;
  font-weight: 700;
}

.saved-word-delete-action:hover {
  color: #7a4638;
}

.saved-word-inline.open .saved-word-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.saved-passage-inline {
  position: relative;
  display: inline;
}

.saved-passage-highlight {
  display: inline;
  border-bottom: 1px solid rgba(196, 75, 43, 0.34);
  background: rgba(242, 222, 193, 0.34);
}

.saved-passage-trigger {
  display: none;
  position: absolute;
  top: -0.42em;
  right: -0.72em;
  width: 5px;
  height: 5px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(156, 103, 72, 0.5);
  color: transparent;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
}

.saved-passage-popover {
  position: absolute;
  left: 50%;
  top: calc(100% + 9px);
  z-index: 4;
  width: min(360px, calc(100vw - 72px));
  padding: 11px 13px;
  border: 1px solid #ddd1c4;
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.98);
  color: #5f5349;
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: normal;
  box-shadow: 0 12px 28px rgba(82, 68, 55, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-3px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.saved-passage-popover-title {
  display: block;
  margin-bottom: 5px;
  color: #9a7662;
  font-size: 0.72rem;
  font-weight: 700;
}

.saved-passage-popover-text {
  display: block;
}

.saved-passage-inline.open .saved-passage-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.inline-word-gloss-inline {
  position: relative;
  display: inline;
}

.inline-word-gloss-text {
  display: inline;
  border-bottom: 1px solid rgba(196, 75, 43, 0.2);
}

.inline-word-gloss-trigger {
  position: absolute;
  top: -0.68em;
  right: -0.62em;
  width: 14px;
  height: 14px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(196, 75, 43, 0.12);
  color: #c44b2b;
  font-size: 0.78rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(85, 72, 60, 0.08);
}

.inline-word-gloss-trigger.pending {
  background: rgba(196, 75, 43, 0.16);
}

.inline-word-gloss-popover {
  position: absolute;
  left: 50%;
  top: calc(100% + 12px);
  z-index: 4;
  min-width: 124px;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid #ddd1c4;
  border-radius: 10px;
  background: rgba(247, 241, 232, 0.98);
  color: #8a7867;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: normal;
  box-shadow: 0 10px 18px rgba(85, 72, 60, 0.08);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.inline-word-gloss-inline:hover .inline-word-gloss-popover,
.inline-word-gloss-inline:focus-within .inline-word-gloss-popover {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.inline-word-gloss-popover.pending {
  color: #9b8e81;
}

.system-special-inline {
  display: inline;
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(196, 75, 43, 0.12);
  box-shadow: inset 0 -1px 0 rgba(196, 75, 43, 0.18);
  color: #8f3f2e;
}

.selection-tray {
  display: none !important;
}

.annotation-panel {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 78px;
  max-height: 188px;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid #ddd8d2;
  border-radius: 12px;
  background: rgba(244, 241, 237, 0.96);
  box-shadow: 0 10px 24px rgba(85, 72, 60, 0.08);
  z-index: 3;
  backdrop-filter: blur(8px);
}

.annotation-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.annotation-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent-color);
}

.annotation-meta {
  font-size: 0.75rem;
  color: var(--muted-color);
}

.annotation-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.annotation-group-title {
  margin: 0 0 4px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-color);
}

.annotation-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
}

.annotation-item p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
}

.annotation-item + .annotation-item {
  margin-top: 6px;
}

.annotation-empty {
  margin: 0;
  font-size: 0.83rem;
  color: var(--muted-color);
}

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

.tray-label {
  margin: 0 0 2px;
  color: var(--muted-color);
  font-size: 0.84rem;
  line-height: 1.4;
}

.tray-text {
  margin: 0;
  line-height: 1.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.tray-actions .icon-button[disabled] {
  cursor: default;
  opacity: 0.72;
  background: rgba(227, 182, 64, 0.16);
  color: #7b6415;
  border-color: rgba(189, 139, 0, 0.16);
}

.chat-panel {
  border-color: rgba(221, 216, 210, 0.46);
  background: var(--bg-color);
  font-family: var(--ui-font);
}

.chat-panel .titlebar {
  min-height: 48px;
  border-bottom-color: rgba(228, 223, 217, 0.46);
}

.titlebar-chat {
  display: none;
}

.skill-active-label {
  display: none;
  max-width: 150px;
  overflow: hidden;
  color: rgba(110, 100, 91, 0.64);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-active-label.loaded {
  color: rgba(76, 112, 78, 0.78);
}

.skill-active-label.unloaded {
  color: rgba(150, 118, 92, 0.7);
}

.chat-menu-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

.chat-menu-button {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(196, 181, 166, 0.34);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.32);
  color: rgba(92, 77, 65, 0.62);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 1;
}

.chat-menu-button:hover,
.chat-menu-button[aria-expanded="true"] {
  border-color: rgba(188, 141, 115, 0.38);
  background: rgba(255, 248, 240, 0.72);
  color: #6a4c3c;
}

.skill-menu-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(320px, 72vw);
  padding: 14px;
  border: 1px solid rgba(211, 197, 183, 0.58);
  border-radius: 18px;
  background: rgba(248, 244, 238, 0.96);
  box-shadow: 0 18px 44px rgba(94, 78, 63, 0.12);
  backdrop-filter: blur(14px);
}

.skill-menu-head {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
}

.skill-menu-head span,
.skill-picker-label {
  color: rgba(126, 111, 96, 0.78);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.skill-menu-head strong {
  color: #4e4037;
  font-size: 0.92rem;
  line-height: 1.35;
}

.skill-picker {
  width: 100%;
  height: 36px;
  margin-top: 6px;
  padding: 0 10px;
  border: 1px solid rgba(204, 188, 172, 0.58);
  border-radius: 12px;
  background: rgba(255, 252, 247, 0.72);
  color: #53463d;
  font: inherit;
  font-size: 0.8rem;
  outline: none;
}

.skill-picker:focus {
  border-color: rgba(196, 75, 43, 0.34);
  box-shadow: 0 0 0 3px rgba(196, 75, 43, 0.08);
}

.skill-runtime-info {
  margin: 10px 0 0;
  color: rgba(126, 111, 96, 0.82);
  font-size: 0.73rem;
  line-height: 1.45;
}

.analysis-strip {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid #e4dfd9;
  background: #f3efea;
}

.analysis-card {
  padding: 12px 14px;
  border: 1px solid #ddd8d2;
  border-radius: 12px;
  background: rgba(244, 240, 235, 0.85);
}

.analysis-label {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-color);
}

.analysis-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--accent-color);
}

.analysis-copy {
  margin: 6px 0 0;
  color: var(--muted-color);
  font-size: 0.86rem;
  line-height: 1.55;
}

.focus-mode {
  color: var(--accent-color);
  font-size: 0.92rem;
}

.focus-hint {
  color: var(--muted-color);
  font-size: 0.84rem;
  line-height: 1.5;
}

.chat-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(164, 155, 146, 0.28) transparent;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reading-pane::-webkit-scrollbar,
.chat-log::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.reading-pane::-webkit-scrollbar-thumb,
.chat-log::-webkit-scrollbar-thumb {
  background: rgba(164, 155, 146, 0.34);
  border-radius: 999px;
}

.reading-pane::-webkit-scrollbar-thumb:hover,
.chat-log::-webkit-scrollbar-thumb:hover {
  background: rgba(144, 134, 124, 0.48);
}

.bubble {
  position: relative;
  max-width: 94%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #ddd8d2;
  line-height: 1.75;
}

.bubble:has(.listening-card) {
  overflow: visible;
  z-index: 3;
}

.bubble.user {
  align-self: flex-end;
  background: #f5f2ee;
}

.bubble.assistant {
  align-self: flex-start;
  background: #f3efea;
}

.bubble.assistant.streaming {
  background: #f3efea;
  border-style: dashed;
  border-color: rgba(196, 75, 43, 0.2);
}

.listening-chip {
  border-color: rgba(196, 75, 43, 0.16);
  min-height: 24px;
  padding: 0 8px;
  border-radius: 9px;
  font-size: 0.72rem;
  line-height: 1;
  white-space: nowrap;
}

.listening-chip.is-preparing {
  position: relative;
  overflow: hidden;
}

.listening-chip.is-preparing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 252, 246, 0.58), transparent);
  transform: translateX(-115%);
  animation: listening-chip-wait 1.15s ease-in-out infinite;
}

@keyframes listening-chip-wait {
  to {
    transform: translateX(115%);
  }
}

.listening-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: auto;
}

.listening-card-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.listening-card-actions {
  display: none;
}

.listening-card-actions {
  opacity: 0.92;
}

.listening-card-main label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #846e60;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.listening-card-main select {
  min-height: 26px;
  max-width: 148px;
  padding: 0 24px 0 9px;
  border: 1px solid rgba(143, 106, 82, 0.14);
  border-radius: 8px;
  background: #fbf7f1;
  color: #6f584a;
  font: inherit;
  font-size: 0.76rem;
  outline: none;
}

.listening-card-action {
  min-height: 26px;
  border: 1px solid rgba(198, 158, 132, 0.24);
  background: #f8efe8;
  color: #8b4a35;
  border-radius: 10px;
  padding: 3px 10px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.listening-card-action.primary {
  border-color: rgba(198, 104, 70, 0.22);
  background: #f7e8df;
  color: #8b3d29;
  min-width: 82px;
}

.listening-card-action.subtle {
  color: #9a8374;
}

.listening-card-action.is-active,
.listening-card-action.is-paused,
.listening-card-action.is-playing {
  border-color: rgba(199, 103, 70, 0.24);
  background: #f4dfd4;
  color: #8b3d29;
}

.listening-card-settings {
  position: relative;
}

.listening-card-settings summary {
  list-style: none;
  min-height: 26px;
  min-width: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(198, 158, 132, 0.24);
  border-radius: 10px;
  background: #f8efe8;
  color: #8b4a35;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.listening-card-settings summary::-webkit-details-marker {
  display: none;
}

.listening-card-settings[open] summary {
  border-color: rgba(199, 103, 70, 0.22);
  background: #f4dfd4;
  color: #8b3d29;
}

.listening-card-settings-panel {
  position: absolute;
  left: 0;
  right: auto;
  top: calc(100% + 8px);
  z-index: 12;
  display: grid;
  gap: 8px;
  min-width: 220px;
  padding: 10px;
  border: 1px solid rgba(198, 158, 132, 0.22);
  border-radius: 14px;
  background: #fbf7f1;
  box-shadow: 0 12px 26px rgba(82, 68, 55, 0.10);
}

.listening-card-action.compact {
  justify-self: start;
  min-height: 26px;
  padding: 3px 9px;
  font-size: 0.74rem;
}

.listening-card-action:hover {
  transform: translateY(-1px);
  border-color: rgba(199, 103, 70, 0.28);
  background: rgba(255, 249, 243, 0.94);
}

.listening-card-action:disabled {
  opacity: 0.52;
  cursor: wait;
}

.listening-response-prompt {
  color: #6f584a;
  font-weight: 700;
}

.bubble.thinking {
  border-style: dashed;
  border-color: rgba(196, 75, 43, 0.22);
  background: rgba(244, 240, 235, 0.72);
}

.thinking-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.thinking-loader {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 24px;
}

.thinking-loader span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent-color);
  animation: thinking-bounce 1s infinite ease-in-out;
}

.thinking-loader span:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-loader span:nth-child(3) {
  animation-delay: 0.3s;
}

.thinking-text {
  color: var(--muted-color);
  font-size: 0.9rem;
}

.streaming-head {
  margin-bottom: 4px;
}

.assistant-reply {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assistant-reply p,
.assistant-reply ul,
.assistant-reply ol,
.assistant-reply blockquote {
  margin: 0;
}

.streaming-text {
  white-space: pre-wrap;
}

.assistant-reply ul,
.assistant-reply ol {
  padding-left: 18px;
}

.assistant-reply li + li {
  margin-top: 4px;
}

.bubble code {
  background: #e8e4df;
  color: var(--accent-color);
  border-radius: 3px;
  padding: 2px 5px;
}

.composer {
  min-height: 126px;
  display: grid;
  grid-template-rows: auto minmax(58px, auto) auto;
  gap: 8px;
  margin: 0 14px 12px;
  padding: 10px;
  border: 1px solid rgba(221, 216, 210, 0.58);
  border-radius: 14px;
  background: rgba(248, 244, 239, 0.82);
}

.composer-selection {
  display: none !important;
  min-height: 24px;
  margin-bottom: 0;
  position: relative;
  padding: 4px 22px 4px 9px;
  width: 104px;
  max-width: 104px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid rgba(176, 141, 108, 0.2);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.74);
  box-shadow: none;
}

.composer-selection[hidden] {
  display: none !important;
}

.composer-selection-copy {
  width: 66px;
  max-width: 66px;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.composer-selection-text {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.25;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-selection .icon-button {
  position: absolute;
  top: 4px;
  right: 5px;
  min-width: 14px;
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted-color);
}

textarea {
  width: 100%;
  resize: none;
  min-height: 58px;
  border: 1px solid rgba(221, 216, 210, 0.62);
  border-radius: 11px;
  background: rgba(255, 252, 247, 0.78);
  color: var(--text-color);
  padding: 9px 11px;
  font: inherit;
  line-height: 1.7;
}

textarea::placeholder {
  color: #96908b;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 0;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
}

.composer-tools {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-box {
  display: none !important;
}

.rich-card {
  background: #f4f1ed;
  border: 1px solid #ddd8d2;
  border-radius: 12px;
  padding: 12px;
}

.rich-card .meta {
  color: var(--muted-color);
  font-size: 0.92rem;
}

.rich-card ul,
.rich-card ol {
  margin: 8px 0 14px;
  padding-left: 20px;
}

.rich-card pre {
  white-space: pre-wrap;
  overflow-x: auto;
  background: #f7f4f1;
  border: 1px solid var(--line-color);
  border-radius: 8px;
  padding: 12px;
}

.semantic-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: #e8e4df;
  color: var(--accent-color);
}

.semantic-action {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(196, 75, 43, 0.08);
  color: var(--accent-color);
}

.semantic-mark {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(196, 75, 43, 0.1);
  color: #5c2d20;
}

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

button.recording,
.composer-button.recording,
.icon-button.recording {
  background: rgba(196, 75, 43, 0.12);
  border-color: rgba(196, 75, 43, 0.24);
  color: var(--accent-color);
}

details summary {
  cursor: pointer;
  color: var(--accent-color);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: #ccc8c2;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b5b0aa;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1220px) {
  .view-mode-switch {
    top: 8px;
  }

  .workspace-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .rail,
  .resize-handle {
    display: none;
  }

  .reading-content {
    padding: 28px 30px 56px;
  }

  .toc-shell {
    display: none;
  }
}
