:root {
  color-scheme: light;
  --paper: #f8f7f3;
  --ink: #24382e;
  --muted: #768076;
  --line: #e2e5dd;
  --green: #264b39;
  --accent: #b2c591;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
button,
input,
textarea,
select {
  border-radius: 9px;
}
button {
  border: 0;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
input,
textarea,
select {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 11px 12px;
}
textarea {
  resize: vertical;
  line-height: 1.65;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 8px;
}
input:not([type="checkbox"]):not([type="file"]),
textarea {
  width: 100%;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
.primary {
  background: var(--green);
  color: var(--button-ink);
  padding: 12px 17px;
  font-weight: 600;
}
.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 13px;
  font-size: 12px;
}
.text-button,
.icon-button {
  background: transparent;
  color: var(--muted);
  padding: 7px;
}
.text-button {
  font-size: 12px;
}
.icon-button {
  font-size: 18px;
}
.eyebrow,
.small-caps {
  font-size: 10px;
  letter-spacing: 1.8px;
  font-weight: 600;
  color: var(--muted);
}
.brand-dot {
  color: var(--brand);
}
.hint,
.composer-note {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.error {
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}
.muted {
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.login-screen {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-card {
  width: 350px;
  max-width: calc(100% - 48px);
  margin: auto;
}
.login-card h1 {
  font-family: serif;
  font-size: 72px;
  font-weight: 400;
  letter-spacing: -5px;
  margin: 20px 0 8px;
}
.lead {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 42px;
}
.login-card .primary {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}
.login-art {
  background: #213b2e;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 70px;
  color: #c6d4b7;
}
.login-art span {
  position: relative;
  font-family: Georgia, serif;
  font-size: 36px;
  font-style: italic;
  line-height: 1.5;
}
.orb {
  position: absolute;
  left: 18%;
  top: 17%;
  height: 380px;
  width: 380px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 25% 20%,
    #d1d6ad,
    #809771 50%,
    #344f3e 77%
  );
  box-shadow: 0 0 100px #75846833;
}
.workspace {
  height: 100dvh;
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr) 255px;
}
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 30px 18px 20px;
  min-height: 0;
}
.brand {
  font-family: serif;
  font-size: 34px;
  letter-spacing: -2px;
  margin: 0 10px 32px;
}
.brand > span:last-child {
  font-family: system-ui;
  font-size: 8px;
  letter-spacing: 1.7px;
  margin-left: 13px;
  vertical-align: middle;
  color: var(--muted);
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 4px 12px;
}
.section-heading h2 {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
  color: var(--muted);
}
.scene-list {
  overflow: auto;
  flex: 1;
}
.scene-item {
  width: 100%;
  text-align: left;
  padding: 13px 12px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scene-item.active {
  background: var(--surface);
  box-shadow: 0 2px 8px #20352806;
}
.scene-item::before {
  content: "▤";
  color: var(--muted);
  margin-right: 10px;
}
.sidebar-bottom {
  border-top: 1px solid var(--line);
  padding-top: 15px;
  margin-top: 15px;
}
.nav-button {
  display: block;
  background: transparent;
  text-align: left;
  padding: 12px;
  width: 100%;
  font-size: 13px;
  color: var(--ink);
}
.story-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.story-header {
  min-height: 101px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 22px 32px;
}
.story-header h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 7px 0 0;
}
.story-header > .secondary {
  margin-left: auto;
}
.story-header .eyebrow {
  font-size: 8px;
}
#menu-button {
  display: none;
}
.messages {
  flex: 1;
  overflow: auto;
  padding: 30px max(24px, calc((100% - 720px) / 2));
  scroll-behavior: smooth;
}
.empty-state {
  text-align: center;
  max-width: 400px;
  margin: 16vh auto 0;
}
.empty-symbol {
  font-family: serif;
  font-size: 54px;
  color: var(--muted);
  margin-bottom: 22px;
}
.empty-state h2 {
  font-family: serif;
  font-weight: 400;
  font-size: 25px;
}
.empty-state p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}
.message {
  margin: 0 0 30px;
  display: flex;
  gap: 14px;
}
.avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--card);
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--positive);
}
.message-body {
  min-width: 0;
  flex: 1;
}
.message-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 5px 0 10px;
}
.speaker {
  font-size: 13px;
  font-weight: 650;
}
.message-kind {
  color: var(--muted);
  font-size: 10px;
}
.segment {
  font-size: 14px;
  line-height: 1.95;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 9px;
}
.segment.narration {
  color: var(--narration);
  font-style: italic;
}
.segment.thought {
  color: var(--thought);
  font-style: italic;
}
.message.user .message-body {
  background: var(--panel);
  border-radius: 0 13px 13px 13px;
  padding: 12px 17px;
}
.message.ooc .message-body {
  border: 1px dashed var(--line);
  background: transparent;
  border-radius: 10px;
  padding: 12px 17px;
}
.composer-area {
  padding: 14px 28px 12px;
}
.composer {
  max-width: 760px;
  margin: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 8px 30px #34482e05;
}
.composer-toolbar,
.composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.composer-toolbar label {
  margin: 0;
}
.composer-toolbar select {
  border: 0;
  background: var(--control);
  font-size: 11px;
  padding: 6px 9px;
}
.composer-toolbar > span,
.composer-footer > span {
  font-size: 10px;
  color: var(--muted);
}
.composer textarea {
  border: 0;
  padding: 14px 2px 5px;
  min-height: 92px;
  resize: none;
  font-size: 14px;
  background: transparent;
}
.composer textarea:focus-visible {
  outline: none;
}
.composer-footer .primary {
  padding: 9px 15px;
  font-size: 12px;
}
.composer-note {
  text-align: center;
  font-size: 10px;
  margin: 10px 0 0;
}
.cast-panel {
  padding: 15px 20px;
  border-left: 1px solid var(--line);
  overflow: auto;
  background: var(--panel);
}
.cast-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
}
.cast-image {
  width: 100%;
  height: 215px;
  object-fit: contain;
  display: block;
  background: linear-gradient(
    145deg,
    var(--gradient-start),
    var(--gradient-end)
  );
}
.cast-placeholder {
  height: 170px;
  display: grid;
  place-items: center;
  font-family: serif;
  font-size: 60px;
  color: var(--muted);
  background: linear-gradient(
    145deg,
    var(--gradient-start),
    var(--gradient-end)
  );
}
.cast-caption {
  padding: 14px;
  background: var(--surface);
}
.cast-caption strong {
  font-size: 14px;
}
.cast-caption p {
  font-size: 11px;
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.5;
}
.memory-note {
  border-top: 1px solid var(--line);
  padding-top: 25px;
  margin-top: 25px;
}
.memory-note .eyebrow {
  font-size: 8px;
}
.memory-note h3 {
  font-size: 13px;
  margin: 12px 0;
}
.memory-note p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.9;
}
.notice {
  padding: 12px 25px;
  font-size: 13px;
  background: var(--panel);
  color: var(--positive);
}
.notice.error {
  background: var(--danger-bg);
  color: var(--danger);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 24px;
  width: 560px;
  max-width: calc(100vw - 28px);
  max-height: 85dvh;
  color: var(--ink);
  background: var(--paper);
}
dialog::backdrop {
  background: #132a2066;
  backdrop-filter: blur(3px);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.modal-header h2 {
  font-size: 20px;
  margin: 0;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 15px;
}
.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 400;
}
.character-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.character-row strong {
  font-size: 14px;
}
.character-row p {
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0 0;
}
.asset-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-top: 15px;
}
.asset-thumb img {
  width: 100%;
  height: 85px;
  object-fit: contain;
  border-radius: 7px;
  background: var(--gradient-start);
}
.asset-thumb p {
  font-size: 10px;
  color: var(--muted);
  margin: 5px 0;
}
.inline-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
}
.modal-description {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.danger {
  color: var(--danger);
  border-color: var(--danger-line);
}
.separator {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
@media (min-width: 1600px) {
  .workspace {
    grid-template-columns: 255px minmax(0, 1fr) 300px;
  }
  .cast-image {
    height: 290px;
  }
}
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .cast-panel {
    display: none;
  }
  .sidebar {
    padding-left: 14px;
    padding-right: 14px;
  }
}
@media (max-width: 700px) {
  .login-screen {
    grid-template-columns: 1fr;
  }
  .login-art {
    display: none;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 5;
    box-shadow: 20px 0 70px #162c2444;
  }
  .sidebar.open {
    display: flex;
  }
  #menu-button {
    display: block;
  }
  .story-header {
    padding: 17px 16px;
    min-height: 85px;
  }
  .story-header > .secondary {
    font-size: 10px;
    padding: 8px;
  }
  .story-header h1 {
    font-size: 15px;
  }
  .story-header .eyebrow {
    font-size: 7px;
  }
  .messages {
    padding: 25px 17px;
  }
  .composer-area {
    padding: 8px 12px 12px;
  }
  .composer-toolbar > span {
    display: none;
  }
  .composer-footer > span {
    font-size: 9px;
  }
  .empty-state {
    margin-top: 12vh;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .asset-list {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* Stage layout and shared controls */
:root {
  --stage-ratio: 38%;
  --muted: #667164;
}
.workspace {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
}
.story-header {
  grid-row: 1;
  min-height: 86px;
  padding: 16px 28px;
  gap: 18px;
  background: var(--paper);
}
.title-block {
  min-width: 0;
}
.story-header h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}
#menu-button {
  display: block;
}
.sidebar {
  display: none;
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  z-index: 10;
  box-shadow: 20px 0 70px #162c2444;
}
.sidebar.open {
  display: flex;
}
.brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand > .brand-dot {
  margin-right: auto;
}
.brand > #close-sidebar {
  font-size: 18px;
}
.stage-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: var(--stage-ratio) minmax(0, 1fr);
}
.cast-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 20px 28px;
  overflow: auto;
}
.cast-panel .section-heading {
  margin: 0 0 16px;
}
.cast-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.cast-chip {
  padding: 8px 13px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid transparent;
  font-size: 12px;
}
.cast-chip.selected {
  border-color: var(--focus);
  background: var(--surface);
}
.cast-card {
  margin: 0 auto 15px;
  width: min(100%, 380px);
  border-radius: 16px;
  background: var(--card);
}
.cast-image {
  width: 100%;
  height: auto;
  aspect-ratio: 2/3;
  max-height: calc(100dvh - 285px);
  object-fit: contain;
  background: linear-gradient(
    145deg,
    var(--gradient-start),
    var(--gradient-end)
  );
}
.cast-placeholder {
  height: auto;
  min-height: 180px;
  aspect-ratio: 2/3;
  width: 100%;
  font-size: 16px;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  line-height: 1.8;
}
.cast-caption {
  padding: 15px 20px;
}
.cast-caption strong {
  font-size: 18px;
  font-family: serif;
}
.split-control {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}
.split-control input {
  padding: 0;
  max-width: 150px;
  accent-color: var(--green);
}
#stage-close {
  display: none;
}
.story-main {
  overflow: hidden;
}
.mobile-stage {
  display: none;
}
.messages {
  padding: 30px max(22px, calc((100% - 730px) / 2));
  overscroll-behavior: contain;
}
.empty-state {
  margin: 12vh auto 0;
}
.empty-state p {
  white-space: pre-line;
}
.empty-state .primary {
  margin-top: 10px;
}
.portrait-button {
  padding: 0;
  border-radius: 50%;
  background: none;
  height: 36px;
  flex-shrink: 0;
}
.portrait-button:disabled {
  opacity: 1;
  cursor: default;
}
.message-actions {
  display: flex;
  gap: 8px;
}
.message-actions .text-button {
  padding: 3px 0;
  font-size: 11px;
}
.message.failed .message-body {
  border: 1px solid var(--danger-line);
}
.message.highlight {
  background: var(--highlight);
  outline: 8px solid var(--highlight);
  border-radius: 6px;
}
.segment.thought::before {
  content: "생각 · ";
  font-style: normal;
  font-size: 10px;
}
.segment.narration {
  font-style: normal;
  color: var(--narration);
}
.composer-area {
  padding: 10px 24px 12px;
}
.composer-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}
.composer-toolbar select {
  font-size: 11px;
  padding: 7px;
  border: 0;
  background: var(--control);
  max-width: 100%;
}
.composer-footer {
  gap: 10px;
}
.composer-footer > span {
  line-height: 1.6;
}
.composer textarea {
  min-height: 88px;
}
.composer textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
}
.reading .stage-layout {
  grid-template-columns: minmax(0, 1fr);
}
.reading .cast-panel {
  display: none;
}
.reading .mobile-stage {
  display: flex;
}
.reading .messages {
  padding-left: max(24px, calc((100% - 780px) / 2));
  padding-right: max(24px, calc((100% - 780px) / 2));
}
.reading .composer-area {
  width: 100%;
  max-width: 820px;
  align-self: center;
}
.mobile-stage {
  align-items: center;
  gap: 10px;
  background: var(--panel);
  color: var(--ink);
  border-radius: 0;
  padding: 8px 20px;
  text-align: left;
  min-height: 52px;
  font-size: 12px;
}
.mobile-stage .hint {
  margin-left: auto;
}
.mobile-stage .avatar {
  width: 32px;
  height: 36px;
  border-radius: 5px;
}
.mobile-stage + .notice {
  border-top: 1px solid var(--line);
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px 18px;
  margin: 18px 0;
}
legend {
  font-size: 13px;
  font-weight: 600;
  padding: 0 6px;
}
select {
  max-width: 100%;
  width: 100%;
}
.header-actions select,
.composer-toolbar select {
  width: auto;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.prompt-text {
  white-space: pre-wrap;
  line-height: 1.8;
  font: 12px/1.8 inherit;
  background: var(--panel);
  padding: 15px;
  border-radius: 8px;
}
details {
  margin: 15px 0;
}
summary {
  cursor: pointer;
  font-size: 12px;
}
dialog {
  width: 650px;
  padding: 24px;
  max-height: 90dvh;
}
dialog form {
  min-width: 0;
}
input[type="file"] {
  width: 100%;
  max-width: 100%;
  font-size: 12px;
}
input[type="range"] {
  padding: 0;
  accent-color: var(--green);
  width: 100%;
  min-height: 28px;
}
.checkbox-row input {
  flex-shrink: 0;
}
.asset-thumb {
  padding: 7px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}
.asset-thumb img {
  height: auto;
  aspect-ratio: 2/3;
}
.asset-list {
  margin-bottom: 20px;
}
.comparison-image {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: contain;
  max-height: 150px;
}
.crop-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}
.crop-original,
.crop-canvas {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--surface);
  background-image:
    linear-gradient(45deg, var(--checker) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker) 75%);
  background-size: 20px 20px;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
}
.crop-canvas {
  touch-action: none;
  cursor: move;
}
.memory-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  margin: 15px 0;
}
.memory-card > p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.8;
}
.memory-card .hint {
  font-size: 11px;
}
.form-grid > div {
  min-width: 0;
}
.error,
.inline-error {
  overflow-wrap: anywhere;
}
button {
  min-height: 34px;
}
#login-error {
  margin-top: 15px;
}
.login-art span {
  font-family: serif;
  font-style: normal;
  font-size: 32px;
  line-height: 1.8;
}
@media (min-width: 1600px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .cast-image {
    height: auto;
  }
}
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .cast-panel {
    display: flex;
    padding: 18px;
  }
  .header-actions {
    gap: 5px;
  }
  .header-actions .secondary {
    padding: 8px;
    font-size: 11px;
  }
  .story-header {
    padding: 16px;
  }
  .stage-layout {
    grid-template-columns: 34% minmax(0, 1fr);
  }
  .split-control {
    display: none;
  }
  .composer-area {
    padding: 10px 16px;
  }
  .cast-placeholder {
    font-size: 13px;
  }
  .cast-image {
    max-height: none;
  }
  .cast-caption strong {
    font-size: 16px;
  }
}
@media (max-width: 850px) {
  .stage-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .cast-panel,
  .reading .cast-panel {
    display: none;
  }
  .mobile-stage {
    display: flex;
  }
  .cast-panel.open,
  .reading .cast-panel.open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 12;
    padding: 24px;
    max-height: 100dvh;
  }
  .cast-panel.open .cast-card {
    width: min(100%, 350px);
  }
  .cast-panel.open .cast-image {
    max-height: 65dvh;
  }
  .cast-panel.open #stage-close {
    display: block;
  }
  .header-actions {
    max-width: 50%;
    justify-content: flex-end;
  }
  .story-header {
    min-height: 85px;
    gap: 10px;
  }
  .messages {
    padding: 24px max(18px, calc((100% - 740px) / 2));
  }
  .empty-state {
    margin-top: 7vh;
  }
  .composer-area {
    width: 100%;
    max-width: 820px;
    align-self: center;
  }
  .cast-panel.open .split-control {
    display: none;
  }
}
@media (max-width: 700px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .story-header h1 {
    font-size: 15px;
  }
  .header-actions {
    max-width: 54%;
    gap: 4px;
  }
  .header-actions .secondary {
    padding: 6px 7px;
    font-size: 10px;
    min-height: 30px;
  }
  .story-header .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .story-header {
    padding: 11px 12px;
  }
  .title-block {
    flex: 1;
  }
  .messages {
    padding: 23px 15px;
  }
  .message {
    gap: 10px;
    margin-bottom: 25px;
  }
  .segment {
    font-size: 14px;
    line-height: 1.9;
  }
  .composer-area {
    padding: 7px 10px 8px;
  }
  .composer {
    padding: 9px 11px;
  }
  .composer-toolbar {
    gap: 4px;
  }
  .composer-toolbar select {
    font-size: 10px;
    padding: 7px 5px;
  }
  .composer-footer > span {
    font-size: 9px;
  }
  .composer-footer .primary {
    white-space: nowrap;
  }
  .composer-note {
    font-size: 9px;
    line-height: 1.5;
    margin-top: 7px;
  }
  .composer textarea {
    font-size: 16px;
    min-height: 78px;
  }
  .mobile-stage {
    padding: 7px 15px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .asset-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .login-art {
    display: none;
  }
  .login-screen {
    grid-template-columns: 1fr;
  }
  dialog {
    padding: 18px;
    max-width: calc(100vw - 20px);
  }
  .modal-header h2 {
    font-size: 18px;
  }
  .crop-previews {
    gap: 10px;
  }
  .crop-previews .hint {
    font-size: 10px;
  }
  .form-actions {
    margin-top: 16px;
  }
  .reading .messages {
    padding-left: 15px;
    padding-right: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
.segment.ooc {
  border-left: 2px dashed var(--line);
  padding: 8px 12px;
  background: var(--panel);
  font-size: 12px;
  color: var(--muted);
}
.reading .cast-panel.open {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 12;
  padding: 24px;
  max-height: 100dvh;
}
.reading .cast-panel.open .cast-card {
  width: min(100%, 350px);
}
.reading .cast-panel.open #stage-close {
  display: block;
}
.reading .cast-panel.open .split-control {
  display: none;
}
.response-info {
  max-width: 760px;
  margin: 8px auto 0;
  font-size: 11px;
}
.response-info > summary {
  font-size: 11px;
  color: var(--muted);
}
#response-info-body {
  max-height: 180px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
  margin-top: 8px;
}
.trace-call {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding: 8px 0;
  overflow-wrap: anywhere;
}
.trace-call .hint {
  font-size: 10px;
}
.trace-warning {
  font-size: 11px;
  color: var(--warning);
  line-height: 1.6;
  margin: 8px 0;
}
.response-info p:last-child {
  margin-bottom: 0;
}

/* Warm paper and sage colors shared across both themes. */
:root {
  --surface: #ffffff;
  --panel: #eef0e8;
  --control: #eef2e8;
  --card: #e5eadd;
  --narration: #61705e;
  --thought: #7b786d;
  --positive: #4c623a;
  --danger: #a03d35;
  --danger-bg: #f7e9e5;
  --danger-line: #dabbb5;
  --warning: #79542e;
  --highlight: #e0e8cf;
  --checker: #e3e7de;
  --focus: #a7be93;
  --brand: #9eaf7c;
  --gradient-start: #e6ebdd;
  --gradient-end: #d9e1cf;
  --button-ink: #ffffff;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #202823;
  --surface: #29332c;
  --panel: #253029;
  --control: #344036;
  --card: #303c32;
  --ink: #e9e7dc;
  --muted: #b0b9a8;
  --line: #465346;
  --green: #b5c795;
  --accent: #b5c795;
  --narration: #bec7b4;
  --thought: #c4baaa;
  --positive: #c4d7a7;
  --danger: #f0aea0;
  --danger-bg: #44322e;
  --danger-line: #8d655a;
  --warning: #e1c297;
  --highlight: #3e4d34;
  --checker: #3b463c;
  --focus: #c0d49e;
  --brand: #b5c795;
  --gradient-start: #334231;
  --gradient-end: #29362c;
  --button-ink: #223026;
}
.login-theme {
  position: absolute;
  top: 20px;
  left: 24px;
}
[data-theme-toggle] {
  touch-action: manipulation;
}

.character-profile-button {
  display: block;
  padding: 0;
  background: transparent;
  flex-shrink: 0;
  border-radius: 12px;
}
.character-profile {
  display: grid;
  place-items: center;
  width: 64px;
  height: 84px;
  object-fit: cover;
  object-position: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--positive);
  font: 20px/1.2 serif;
}
.character-info {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.character-row > .secondary {
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .character-profile {
    width: 54px;
    height: 72px;
  }
}
