/* Shared with the introduction: warm paper, plum ink, quiet editorial type. */
:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f3ec;
  --panel: #fcfaf6;
  --panel-2: #f2ece7;
  --line: #ded3d4;
  --line-soft: #e9e0dc;
  --text: #44343f;
  --muted: #756b70;
  --accent: #805b6c;
  --accent-soft: rgba(128, 91, 108, 0.09);
  --accent-strong: #704d61;
  --on-accent: #fffaf5;
  --notice-bg: #f4e8d9;
  --notice-text: #775136;
  --user-bubble: #ede2e6;
  --user-avatar: #e5d7de;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #25212b;
  --panel: #2d2831;
  --panel-2: #36303a;
  --line: #544651;
  --line-soft: #443943;
  --text: #eee5e1;
  --muted: #b5a6b0;
  --accent: #c6a2b4;
  --accent-strong: #dfbfd0;
  --on-accent: #30222c;
  --notice-bg: #453830;
  --notice-text: #efd0ae;
  --user-bubble: #4d3b4b;
  --user-avatar: #5b4856;
}
html {
  height: 100%;
  scroll-behavior: smooth;
}
body {
  height: 100%;
  overscroll-behavior: none;
}
button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.48;
}
button,
a {
  transition:
    background 0.18s,
    border-color 0.18s;
}
h1,
h2,
.now-title {
  font-family: Georgia, "Songti SC", serif;
  font-weight: 400;
  text-wrap: balance;
}
.app-frame {
  height: 100dvh;
  height: var(--app-height, 100dvh);
  max-width: 1800px;
  margin: auto;
}
.topbar {
  height: 76px;
  background: var(--bg);
  padding: 0 34px;
}
.brand-moon {
  width: 29px;
  height: 29px;
  color: var(--accent);
}
.brand-name {
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 400;
  letter-spacing: -0.6px;
  background: none;
  -webkit-text-fill-color: var(--text);
}
.brand-sub {
  margin-left: 12px;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.topbar-right {
  max-width: 60%;
  gap: 9px;
}
.topbar-status {
  max-width: 280px;
  font-size: 11px;
}
.theme-toggle {
  width: 42px;
  height: 42px;
  background: transparent;
  border-color: transparent;
  color: var(--text);
  font-size: 12px;
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
}
.columns {
  grid-template-columns: 240px minmax(320px, 1fr) 360px;
}
.sidebar {
  padding: 30px 24px 100px;
  background: var(--bg);
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.sidebar-left {
  font-size: 13px;
}
.side-section {
  margin-bottom: 30px;
}
.side-section h3 {
  font-size: 11px;
  letter-spacing: 0.1em;
  margin: 22px 0 12px;
}
.eyebrow {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.17em;
  line-height: 1.5;
  font-weight: 600;
  margin: 0 0 12px;
}
.side-section h2 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 22px;
}
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.account-actions a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.side-hint {
  line-height: 1.7;
}
.recent-item,
.analysis-line,
.segment-item {
  border-color: var(--line-soft);
  background: var(--panel);
  border-radius: 14px;
  padding: 14px;
}
.recent-item strong {
  font-weight: 500;
}
.analysis-line strong {
  font-weight: 500;
}
.side-section dl {
  font-size: 12px;
  gap: 12px 8px;
}
.chat-column {
  background: var(--panel);
}
.chat-heading {
  padding: 38px 32px 20px;
  width: min(760px, 100%);
  margin: 0 auto;
}
.chat-heading h1 {
  font-size: 36px;
  line-height: 1.17;
  letter-spacing: -0.7px;
  margin: 0 0 12px;
}
.chat-heading > p:last-child {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.chat-scroll {
  padding: 22px 0 12px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  overflow-anchor: none;
}
.chat-message {
  width: calc(100% - 56px);
  gap: 10px;
  margin-bottom: 24px;
}
.chat-message span {
  width: 28px;
  height: 28px;
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 400;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent);
}
.chat-message p {
  font-size: 15px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
.chat-message.user span {
  display: none;
}
.chat-message.user p {
  border-radius: 20px 20px 5px 20px;
  padding: 12px 17px;
  max-width: 90%;
}
.chat-message.assistant p {
  padding-top: 0;
}
.chat-status {
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.chat-status.error {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--notice-text);
  background: var(--notice-bg);
}
.chat-retry {
  margin-top: 8px;
  display: block;
}
.chat-interrupted {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.chat-listening-button {
  min-height: 44px;
  border-color: var(--line);
  color: var(--accent-strong);
  background: var(--panel-2);
}
.chat-generation-task {
  font-size: 12px;
  line-height: 1.6;
  opacity: 1;
  color: var(--muted);
  border-color: var(--line);
}
.composer-dock {
  width: calc(100% - 48px);
  padding: 12px 0 20px;
  position: relative;
}
.agent-hints {
  flex-wrap: nowrap;
  overflow: auto;
  scrollbar-width: none;
  gap: 7px;
  margin-bottom: 12px;
}
.agent-hints button {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11px;
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
}
.agent-hints #tryStoryButton {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
  order: -1;
}
.composer {
  padding: 9px 9px 9px 16px;
  border-radius: 22px;
  background: var(--bg);
  box-shadow: 0 3px 16px #44343f05;
  gap: 8px;
}
.composer textarea {
  font-size: 16px;
  min-height: 30px;
  line-height: 1.6;
  padding: 6px 0;
  max-height: 120px;
}
.send-button {
  border-radius: 50%;
  padding: 0;
  min-height: 42px;
  width: 42px;
  align-self: flex-end;
  display: grid;
  place-items: center;
}
.send-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.composer-note {
  font-size: 10px;
  letter-spacing: 0.02em;
  margin-top: 9px;
}
.story-status {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  padding: 12px 15px;
  margin: 0 24px;
  flex-shrink: 0;
}
.story-status > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.story-status strong {
  font-size: 12px;
  font-weight: 600;
}
.story-status p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}
.story-status-icon {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: spin 1s linear infinite;
}
.story-status[data-state="error"] .story-status-icon {
  animation: none;
  border-color: var(--notice-text);
  border-radius: 5px;
}
.story-status[data-state="ready"] .story-status-icon {
  animation: none;
  background: var(--accent);
  border: 5px solid var(--panel);
  outline: 1px solid var(--accent);
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 12px;
  padding: 8px;
  min-height: 42px;
}
.story-art {
  position: relative;
  margin: 0 0 25px;
  overflow: hidden;
  border-radius: 16px;
}
.story-art svg {
  width: 100%;
  display: block;
}
.listening-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.listening-heading .eyebrow {
  margin: 0;
}
.listening-heading .text-button {
  min-height: 40px;
  font-size: 11px;
}
.story-art > span {
  position: absolute;
  bottom: 15px;
  left: 20px;
  color: #fff8ef;
  font-size: 8px;
  letter-spacing: 0.18em;
}
.now-title {
  font-size: 25px;
  line-height: 1.3;
  margin-bottom: 10px;
}
.now-meta {
  font-size: 11px;
  line-height: 1.7;
}
.controls {
  grid-template-columns: 1fr;
  gap: 8px;
}
.primary-action,
.ghost-action {
  min-height: 44px;
  font-size: 12px;
  border-radius: 12px;
  padding: 0 14px;
}
.controls .ghost-action {
  background: transparent;
}
.feedback-row {
  gap: 8px;
  margin-top: 20px;
}
.feedback-row button {
  min-height: 42px;
  background: transparent;
  border-radius: 12px;
  font-size: 11px;
}
.play-icon-button {
  height: 44px;
  width: 44px;
  font-family: Arial, sans-serif;
  font-size: 14px;
}
.play-icon-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.recent-item-footer {
  margin-top: 8px;
}
.quality-notice {
  font-size: 12px;
  line-height: 1.7;
}
.playback-controls {
  margin: 20px 0 22px;
}
.playback-controls > p {
  font-size: 11px;
  text-align: center;
  color: var(--muted);
  min-height: 18px;
  line-height: 1.6;
}
.playback-controls input {
  width: 100%;
  accent-color: var(--accent);
  height: 24px;
  cursor: pointer;
}
.playback-times {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.transport {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  margin: 15px 0;
}
.main-play {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}
.main-play svg,
.mini-play svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}
.skip-button {
  height: 44px;
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 12px;
  color: var(--text);
  background: transparent;
}
.custom-player .audio-player {
  display: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.mini-player {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  width: 360px;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 18px;
  box-shadow: 0 8px 30px #44343f15;
  overflow: hidden;
}
.mini-player > button:first-child {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  min-height: 40px;
}
.mini-player strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  max-width: 230px;
}
.mini-player small {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  color: var(--muted);
}
.mini-art {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 70% 30%, #f9f1df 0 12%, transparent 13%),
    linear-gradient(155deg, #d5c7d3 45%, #9294af 46% 65%, #737b98 66%);
}
.mini-play {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--accent);
  height: 44px;
  width: 44px;
  flex-shrink: 0;
}
.mini-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--line-soft);
}
.mini-progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}
.toast {
  bottom: 95px;
  box-shadow: 0 8px 30px #44343f18;
  font-size: 13px;
  line-height: 1.6;
}
.structure-details summary {
  letter-spacing: 0.03em;
  text-transform: none;
  min-height: 44px;
  padding-top: 10px;
}
.gen-log {
  background: transparent;
  max-height: 180px;
}
.hidden,
[hidden] {
  display: none !important;
}
@media (min-width: 761px) {
  body[data-mobile-panel="right"] .mini-player {
    display: none;
  }
  .mobile-nav {
    display: none;
  }
}
@media (max-width: 1150px) and (min-width: 761px) {
  .columns {
    grid-template-columns: 180px minmax(0, 1fr) 260px;
  }
  .sidebar-left {
    display: block;
  }
  .brand-sub {
    display: none;
  }
  .topbar {
    padding: 0 24px;
  }
}
@media (max-width: 760px) {
  .app-frame {
    padding-top: env(safe-area-inset-top);
  }
  .topbar {
    height: 62px;
    padding: 0 20px;
    gap: 10px;
  }
  .brand-name {
    font-size: 24px;
  }
  .brand-moon {
    width: 25px;
    height: 25px;
  }
  .brand-sub,
  .topbar-status {
    display: none;
  }
  .topbar-right {
    gap: 2px;
    max-width: 50%;
  }
  .columns {
    display: block;
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
    position: relative;
  }
  .chat-column,
  .sidebar-left,
  .sidebar-right {
    height: 100%;
  }
  .sidebar {
    padding: 26px 24px 35px;
  }
  .sidebar-left,
  .sidebar-right {
    display: none;
  }
  body[data-mobile-panel="right"] .sidebar-right,
  body[data-mobile-panel="left"] .sidebar-left {
    display: block;
  }
  body[data-mobile-panel="chat"] .chat-column {
    display: flex;
  }
  .chat-heading {
    padding: 25px 24px 13px;
  }
  .chat-heading h1 {
    font-size: 30px;
    line-height: 1.17;
    letter-spacing: -0.5px;
  }
  .chat-heading .eyebrow {
    font-size: 9px;
    margin-bottom: 10px;
  }
  .chat-heading > p:last-child {
    font-size: 12px;
  }
  .chat-scroll {
    padding-top: 18px;
  }
  .chat-message {
    width: calc(100% - 40px);
    gap: 9px;
    margin-bottom: 20px;
  }
  .chat-message p {
    font-size: 15px;
  }
  .chat-message span {
    width: 24px;
    height: 24px;
    font-size: 13px;
    margin-top: 2px;
  }
  .chat-status {
    width: calc(100% - 40px);
    margin-bottom: 16px;
  }
  .composer-dock {
    width: calc(100% - 32px);
    padding: 8px 0 10px;
  }
  .composer-note {
    font-size: 9px;
    margin: 7px 0 0;
  }
  .agent-hints {
    margin-bottom: 10px;
  }
  .story-status {
    margin: 0 16px;
    padding: 10px 12px;
    gap: 9px;
  }
  .story-status p {
    max-height: 50px;
    overflow: auto;
  }
  .story-status .text-button {
    font-size: 11px;
    padding: 4px;
    max-width: 66px;
  }
  .mobile-nav {
    position: absolute;
    bottom: 0;
    display: flex;
    height: calc(66px + env(safe-area-inset-bottom));
    padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--line-soft);
  }
  .mobile-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 48px;
    font-size: 10px;
    font-weight: 400;
    color: var(--muted);
  }
  .mobile-nav button svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
  }
  .mobile-nav button.active {
    color: var(--accent-strong);
  }
  .mobile-nav button.active svg {
    fill: var(--accent-soft);
  }
  .mini-player {
    bottom: calc(75px + env(safe-area-inset-bottom));
    width: calc(100% - 32px);
    max-width: none;
    border-radius: 14px;
    padding: 7px 12px;
    box-shadow: 0 4px 18px #44343f0d;
  }
  .mini-player strong {
    max-width: calc(100vw - 145px);
  }
  body[data-has-player="true"][data-mobile-panel="chat"] .composer-dock {
    padding-bottom: 80px;
  }
  body[data-has-player="true"][data-mobile-panel="left"] .sidebar-left {
    padding-bottom: 110px;
  }
  body[data-mobile-panel="right"] .mini-player {
    display: none;
  }
  .toast {
    bottom: calc(150px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 32px);
  }
  .story-art {
    max-width: 480px;
    margin: 0 auto 24px;
  }
  .sidebar-right .now-section {
    max-width: 480px;
    margin: 0 auto 28px;
  }
  .now-title {
    font-size: 29px;
  }
  .playback-controls {
    margin: 22px 0;
  }
  .controls {
    grid-template-columns: 1fr 1fr;
  }
  .side-section h2 {
    font-size: 30px;
  }
  body[data-keyboard="true"] .mobile-nav,
  body[data-keyboard="true"] .mini-player {
    display: none;
  }
  body[data-keyboard="true"] .columns {
    padding-bottom: 0;
  }
  body[data-keyboard="true"] .composer-dock {
    padding-bottom: 8px !important;
  }
  body[data-keyboard="true"] .chat-heading {
    display: none;
  }
  body[data-keyboard="true"] .composer-note {
    display: none;
  }
}
@media (max-height: 700px) {
  .chat-heading {
    padding-top: 16px;
    padding-bottom: 8px;
  }
  .chat-heading h1 {
    font-size: 25px;
  }
  .chat-heading > p:last-child {
    display: none;
  }
  .chat-heading .eyebrow {
    margin-bottom: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition: none !important;
  }
}

.dismiss-keyboard {
  display: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 30px;
  height: 42px;
  padding: 4px;
  align-self: flex-end;
}
.dismiss-keyboard svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
body[data-keyboard="true"] .dismiss-keyboard {
  display: block;
}

.boot-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin: 0 24px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.boot-status > span:nth-child(2) {
  flex: 1;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .app-frame {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
  }
  .mini-player {
    position: absolute;
  }
  .mobile-nav {
    position: absolute;
  }
}

@media (max-width: 760px) {
  html,
  body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    scroll-behavior: auto;
  }
  .app-frame {
    top: 0 !important;
  }
}
