:root {
  color-scheme: dark;
  --background: #141414;
  --panel: #1b1a19;
  --panel-raised: #23211f;
  --text: #d9d5cd;
  --text-bright: #f0ece4;
  --muted: #99938a;
  --line: #35322e;
  --accent: #c98b91;
  --active: rgba(201, 139, 145, .11);
  --danger: #e8a39b;
}

* { box-sizing: border-box; }
html, body { min-width: 1000px; min-height: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif;
}
button, select { font: inherit; }
button { color: inherit; }
a { color: var(--accent); }

.vtuber-shell {
  display: grid;
  grid-template-columns: minmax(600px, 64%) minmax(360px, 36%);
  height: 100vh;
  overflow: hidden;
}

.reading-pane {
  overflow-y: auto;
  padding: 26px clamp(30px, 4vw, 68px) 52px;
  border-right: 1px solid var(--line);
}

.reader-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.reader-nav a { text-decoration: none; }
.reader-nav label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.reader-nav select {
  width: min(34vw, 430px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-raised);
  color: var(--text);
}

.chapter-header { padding: 32px 0 22px; }
.book-title {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}
.chapter-header h1 {
  margin: 0;
  color: var(--text-bright);
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 30px;
  line-height: 1.4;
}

.sentences {
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 20px;
  line-height: 2.05;
  letter-spacing: .025em;
}
.sentence {
  display: inline;
  margin: 0;
  padding: .13em .12em;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: color 100ms ease, background 100ms ease;
}
.sentence:hover { color: var(--text-bright); background: rgba(255,255,255,.045); }
.sentence.active { color: var(--text-bright); background: var(--active); }
.paragraph-break { display: block; height: .82em; }

.message, .engine-message {
  color: var(--muted);
  font-size: 14px;
}
.message.error, .engine-message.error { color: var(--danger); }
.chapter-navigation {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 42px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.chapter-navigation button, .play-toggle {
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-raised);
  cursor: pointer;
}
.chapter-navigation button:last-child { justify-self: end; }
.chapter-navigation button:disabled, .play-toggle:disabled { opacity: .42; cursor: not-allowed; }
.chapter-navigation span { color: var(--muted); font-size: 13px; }

.character-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  background: var(--panel);
}
.live2d-stage { position: relative; min-height: 0; overflow: hidden; }
#live2d-canvas { display: block; width: 100%; height: 100%; }
.stage-message {
  position: absolute;
  inset: auto 18px 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.playback-panel {
  padding: 20px 22px 24px;
  border-top: 1px solid var(--line);
  background: var(--panel-raised);
}
.play-toggle {
  width: 100%;
  border-color: #664b50;
  background: #3b2d30;
  color: var(--text-bright);
  font-weight: 750;
}
.playback-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.engine-message { margin: 10px 0 0; line-height: 1.5; }
