:root {
  color-scheme: dark;
  --app-width: 430px;
  --bg: #0b0d12;
  --panel: rgba(26, 29, 38, 0.82);
  --panel-strong: rgba(33, 37, 48, 0.96);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5f5f7;
  --muted: #9a9aa3;
  --assistant: #232838;
  --user: #0a84ff;
  --field: rgba(118, 118, 128, 0.18);
  --danger: #ff6b6b;
}

:root[data-theme="campus"] {
  color-scheme: light;
  --bg: #e8eff5;
  --panel: rgba(248, 251, 253, 0.86);
  --panel-strong: rgba(252, 253, 255, 0.98);
  --line: rgba(55, 79, 99, 0.16);
  --text: #24313d;
  --muted: #71808d;
  --assistant: #ffffff;
  --user: #3b8edb;
  --field: rgba(86, 119, 145, 0.09);
  --danger: #cb4e5b;
}

:root[data-theme="cinema"] {
  color-scheme: dark;
  --bg: #050505;
  --panel: rgba(12, 12, 12, 0.82);
  --panel-strong: rgba(16, 16, 15, 0.98);
  --line: rgba(219, 190, 130, 0.17);
  --text: #f0ece3;
  --muted: #9d978d;
  --assistant: rgba(12, 12, 12, 0.82);
  --user: #8a6a35;
  --field: rgba(226, 211, 181, 0.08);
  --danger: #d9655f;
}

:root[data-theme="wechat"] {
  color-scheme: light;
  --bg: #ededed;
  --panel: rgba(247, 247, 247, 0.98);
  --panel-strong: #ffffff;
  --line: rgba(0, 0, 0, 0.1);
  --text: #171717;
  --muted: #999999;
  --assistant: #ffffff;
  --user: #95ec69;
  --field: #ffffff;
  --danger: #d94c4c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(10, 132, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #11141c 0%, var(--bg) 50%, #07080b 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

:root[data-theme="campus"] body {
  background: #dbe6ef;
}

:root[data-theme="cinema"] body {
  background: #020202;
}

:root[data-theme="wechat"] body {
  background: #ededed;
}

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

button {
  cursor: pointer;
}

.app {
  width: min(var(--app-width), 100%);
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(9, 11, 16, 0.72);
  backdrop-filter: blur(24px);
  box-shadow: 0 0 70px rgba(0, 0, 0, 0.38);
}

.chat-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

.scene-background {
  position: absolute;
  z-index: -2;
  inset: -28px;
  background-color: #10141c;
  background-position: center;
  background-size: cover;
  filter: blur(20px) saturate(0.88);
  opacity: 0.72;
  transform: scale(1.08);
  transition: background-image 0.28s ease, opacity 0.28s ease;
  pointer-events: none;
}

.chat-stage::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: rgba(7, 10, 15, 0.58);
  pointer-events: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 18, 25, 0.86);
}

.chat-contact-btn {
  display: none;
}

.settings-summary {
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.settings-summary > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
}

.settings-summary dt {
  color: var(--muted);
  font-size: 12px;
}

.settings-summary dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.script-badge {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(10, 132, 255, 0.35);
  background: rgba(10, 132, 255, 0.12);
  color: #9ecbff;
  font-size: 12px;
  line-height: 1.4;
}

.script-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.script-list {
  display: grid;
  gap: 10px;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding-right: 2px;
}

.script-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--field);
  color: var(--text);
  display: grid;
  gap: 6px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.script-card:hover {
  border-color: rgba(10, 132, 255, 0.55);
}

.script-card.active {
  border-color: rgba(10, 132, 255, 0.85);
  background: rgba(10, 132, 255, 0.14);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.12);
}

.script-card:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.script-card .script-card-title {
  font-weight: 700;
  font-size: 15px;
}

.script-card .script-card-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.script-card .script-card-meta {
  color: #7aa8d8;
  font-size: 11px;
}

.script-panel {
  width: min(520px, 100%);
}

.actor-panel {
  width: min(520px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
}

.affection-panel {
  width: min(500px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.affection-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.affection-list {
  display: grid;
  gap: 10px;
}

.affection-control {
  display: grid;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
}

.affection-control-head {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
}

.affection-control-head img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
}

.affection-control-head span {
  display: grid;
  gap: 2px;
}

.affection-control-head strong { font-size: 14px; }
.affection-control-head small { color: var(--muted); font-size: 10px; }

.affection-control-head output {
  min-width: 42px;
  color: #f2a8bd;
  font-size: 18px;
  font-weight: 750;
  text-align: right;
}

.affection-slider {
  width: 100%;
  accent-color: #e78eaa;
}

.affection-stepper {
  display: grid;
  grid-template-columns: 44px 44px minmax(58px, 1fr) 44px 44px;
  gap: 6px;
}

.affection-stepper button,
.affection-stepper input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-align: center;
}

.affection-stepper button { padding: 0; }
.affection-stepper input { width: 100%; padding: 0 5px; }

.affection-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.affection-history-head strong { font-size: 13px; }
.affection-history-head small { color: var(--muted); font-size: 10px; }

.affection-log {
  display: grid;
}

.affection-log-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.affection-log-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.affection-log-row > span { display: flex; align-items: baseline; gap: 7px; }
.affection-log-row strong { font-size: 12px; }
.affection-log-row small { color: var(--muted); font-size: 9px; }
.affection-log-row em { font-size: 13px; font-style: normal; font-weight: 750; }
.affection-log-row em.positive { color: #74d69a; }
.affection-log-row em.negative { color: #ff8c8c; }
.affection-log-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: #aeb6c2;
  font-size: 10px;
  line-height: 1.45;
}

.person-panel,
.scene-panel {
  width: min(400px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.switch-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.person-list,
.scene-list {
  display: grid;
  gap: 9px;
}

.person-option,
.scene-option {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  text-align: left;
}

.person-option.current,
.scene-option.current {
  border-color: rgba(100, 210, 255, 0.62);
  background: rgba(100, 210, 255, 0.08);
}

.person-option-avatar {
  --affection-angle: 0deg;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 3px;
  border-radius: 50%;
  background: conic-gradient(#64d2ff var(--affection-angle), rgba(255, 255, 255, 0.13) 0);
}

.person-option-avatar i {
  width: 100%;
  height: 100%;
  display: block;
  border: 2px solid #151a23;
  border-radius: 50%;
  background-position: 50% 18%;
  background-size: cover;
}

.person-option > span:nth-child(2),
.scene-option > span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.person-option strong,
.scene-option strong {
  font-size: 14px;
}

.person-option small,
.scene-option small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.person-option em,
.scene-option em {
  color: #8edcea;
  font-size: 11px;
  font-style: normal;
}

.scene-option > i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(100, 210, 255, 0.28);
  border-radius: 50%;
  overflow: hidden;
  background-color: rgba(100, 210, 255, 0.08);
  background-position: center;
  background-size: cover;
  color: #aee7f2;
  font-family: ui-serif, "Songti SC", "STSong", serif;
  font-style: normal;
}

.scene-option > i b {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: rgba(6, 10, 16, 0.42);
  font-weight: 600;
}

.actor-readonly {
  margin: -2px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #64d2ff;
  border-radius: 8px;
  background: rgba(100, 210, 255, 0.08);
  color: #c6eaff;
  font-size: 12px;
  line-height: 1.55;
}

.actor-list {
  display: grid;
  gap: 10px;
}

.actor-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
}

.actor-row.selected {
  border-color: rgba(100, 210, 255, 0.62);
  background: rgba(100, 210, 255, 0.08);
}

.actor-row > img {
  width: 58px;
  height: 72px;
  object-fit: cover;
  object-position: 50% 18%;
  border-radius: 10px;
  background: #11151e;
}

.actor-info {
  min-width: 0;
}

.actor-name {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.actor-name strong {
  font-size: 15px;
}

.actor-name span,
.actor-name em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.actor-name em {
  margin-left: auto;
  color: #64d2ff;
}

.actor-info p,
.actor-info small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.actor-info small {
  color: #b7b9c2;
}

.actor-row > button {
  min-width: 58px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 11px;
}

.actor-row > button[aria-pressed="true"] {
  border-color: #64d2ff;
  background: #64d2ff;
  color: #071017;
  font-weight: 700;
}

.save-panel {
  width: min(560px, 100%);
}

.save-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.save-slots {
  border-top: 1px solid var(--line);
}

.save-slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.save-slot-info {
  min-width: 0;
}

.save-slot-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.save-slot-heading strong {
  font-size: 14px;
}

.save-slot-heading time,
.save-slot-meta {
  color: var(--muted);
  font-size: 11px;
}

.save-slot-meta {
  margin-top: 5px;
  color: #7fb7c2;
}

.save-slot-info p {
  overflow: hidden;
  margin: 7px 0 0;
  color: #c2c7d0;
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-slot-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.save-slot-actions button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  font-size: 12px;
}

.save-slot-actions .load-save {
  border-color: rgba(10, 132, 255, 0.45);
  color: #8fc7ff;
}

.save-slot-actions .delete-save {
  color: #ff9c9c;
}

h1,
h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-trigger,
.scene-trigger {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 3px;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(#64d2ff var(--affection-angle, 0deg), rgba(255, 255, 255, 0.13) 0);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
}

.scene-trigger {
  display: grid;
  place-items: center;
  border: 1px solid rgba(118, 175, 215, 0.7);
  background: #111722;
  color: #aee7f2;
  font-family: ui-serif, "Songti SC", "STSong", serif;
  font-size: 15px;
  font-weight: 700;
}

.character-trigger .avatar-photo,
.avatar .avatar-photo {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
}

.character-trigger .avatar-photo {
  border: 2px solid #111722;
}

.avatar-photo.text-avatar {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #263b52, #152231);
  color: #bdebf1;
  font-size: 12px;
  font-weight: 800;
}

.character-trigger.multi-character {
  width: 76px;
  flex-basis: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  overflow: visible;
  border-radius: 20px;
  background: rgba(17, 23, 34, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 0 0 3px rgba(10, 132, 255, 0.08);
}

.character-trigger.multi-character .script-cast-photo {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  background-size: cover;
  background-position: 50% 18%;
}

.character-trigger.multi-character .script-cast-photo + .script-cast-photo {
  margin-left: -9px;
}

.profile-avatar-trigger {
  padding: 0;
  border: 0;
  cursor: pointer;
}

.profile-avatar-trigger:focus-visible {
  outline: 2px solid #64d2ff;
  outline-offset: 2px;
}

.avatar-photo,
.character-portrait-photo,
.avatar-preview,
.avatar-preset-photo {
  background-position: center;
  background-repeat: no-repeat;
}

.more-btn {
  width: 38px;
  height: 38px;
  padding: 0 0 5px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--field);
  color: var(--text);
  font-size: 16px;
  letter-spacing: 2px;
}

.more-menu {
  position: absolute;
  z-index: 20;
  top: 46px;
  right: 0;
  width: 236px;
  display: none;
  overflow: hidden;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(27, 31, 40, 0.98);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(24px);
}

.more-menu.show {
  display: grid;
}

.more-menu button {
  display: grid;
  grid-template-columns: minmax(70px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.more-menu button > span {
  white-space: nowrap;
}

.more-menu button:disabled {
  cursor: default;
  opacity: 0.64;
}

.more-menu button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.more-menu button.danger span {
  color: #ff9c9c;
}

.more-menu small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.ghost-btn,
.icon-btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--field);
  border-radius: 12px;
}

.ghost-btn {
  min-width: 58px;
  padding: 8px 12px;
}

.ghost-btn.danger {
  color: #ffd4d4;
}

.icon-btn {
  width: 34px;
  height: 34px;
  font-size: 22px;
  line-height: 1;
}

.messages {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 28px 24px 86px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.empty {
  margin: auto;
  max-width: 360px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.story-turn {
  display: flex;
  flex-direction: column;
  gap: 17px;
  align-items: flex-start;
  width: 100%;
}

.story-turn.streaming {
  min-height: 52px;
}

.story-narration {
  width: min(100%, 640px);
  margin: 2px auto;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-left-color: rgba(120, 198, 211, 0.46);
  border-radius: 8px;
  background: rgba(35, 41, 53, 0.68);
  color: #aab2be;
  backdrop-filter: blur(8px);
  font-family: ui-serif, "Songti SC", "STSong", serif;
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
}

.story-narration.live::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  border-radius: 1px;
  background: #78c6d3;
  vertical-align: -0.12em;
  animation: narration-caret 0.8s steps(1, end) infinite;
}

@keyframes narration-caret {
  0%, 48% { opacity: 0.9; }
  49%, 100% { opacity: 0; }
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.message-row.user {
  justify-content: flex-end;
}

.user-avatar,
.chat-time {
  display: none;
}

.dialogue-row {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.dialogue-row > .avatar {
  margin-top: 21px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, #5ac8fa, #0a84ff);
  color: white;
  font-weight: 700;
  overflow: hidden;
}

.bubble {
  max-width: min(78%, 580px);
  padding: 12px 15px;
  border-radius: 20px;
  background: var(--assistant);
  border: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: 0.01em;
}

.dialogue-content {
  max-width: min(76%, 560px);
}

.speaker-name {
  margin: 0 0 5px 4px;
  color: #8dbfca;
  font-size: 11px;
  font-weight: 650;
}

.dialogue-bubble {
  max-width: none;
  padding: 11px 14px;
  background: #202633;
  color: #f2f4f7;
  font-size: 15px;
  line-height: 1.8;
  border-bottom-left-radius: 7px;
}

.message-row.user .bubble {
  border: 0;
  border-bottom-right-radius: 7px;
  background: linear-gradient(135deg, #2d9cff, var(--user));
}

.system-strip {
  width: min(100%, 640px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid rgba(93, 177, 194, 0.22);
  border-left: 3px solid #5db1c2;
  border-radius: 8px;
  background: rgba(68, 110, 123, 0.1);
  color: #c5ccd5;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.system-strip strong {
  color: #78c6d3;
  white-space: nowrap;
}

.story-choices {
  width: min(100%, 640px);
  margin: 2px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.story-choices button {
  min-height: 46px;
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: #e7eaf0;
  text-align: left;
  line-height: 1.45;
}

.story-choices button:hover {
  border-color: rgba(82, 169, 255, 0.55);
  background: rgba(10, 132, 255, 0.1);
}

.story-choices button span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 132, 255, 0.15);
  color: #8fc7ff;
  font-size: 11px;
  font-weight: 750;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(16, 18, 25, 0.92);
}

.composer textarea {
  width: 100%;
  min-height: 46px;
  max-height: 132px;
  resize: none;
  border: 1px solid var(--line);
  outline: none;
  border-radius: 18px;
  padding: 12px 14px;
  background: var(--field);
  color: var(--text);
}

.composer textarea:focus,
.profile-panel input:focus,
.profile-panel textarea:focus,
.profile-panel select:focus {
  border-color: rgba(10, 132, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}

.composer.continue-mode textarea {
  cursor: text;
  text-align: left;
  font-weight: 400;
  animation: continue-nudge 3.2s ease-in-out infinite;
}

.composer.continue-mode textarea[data-continue-default="true"] {
  color: rgba(211, 225, 247, 0.78);
}

.composer.continue-mode textarea:hover,
.composer.continue-mode textarea:focus {
  border-color: rgba(100, 210, 255, 0.68);
  box-shadow: 0 0 0 4px rgba(100, 210, 255, 0.1);
}

.composer.continue-mode textarea:focus {
  text-align: left;
  font-weight: 400;
  animation: none;
}

@keyframes continue-nudge {
  0%, 8%, 16%, 100% { transform: translateX(0); }
  4% { transform: translateX(2px); }
  12% { transform: translateX(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .composer.continue-mode textarea { animation: none; }
}

.composer button,
.primary-wide {
  border: 0;
  border-radius: 16px;
  background: var(--user);
  color: #fff;
  font-weight: 700;
}

.composer button {
  min-width: 70px;
  min-height: 46px;
  padding: 0 16px;
}

.composer button.stop {
  background: #ff453a;
}

.modal {
  position: fixed;
  inset: 0 auto 0 50%;
  width: min(var(--app-width), 100%);
  transform: translateX(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.54);
  backdrop-filter: blur(16px);
}

.modal.show {
  display: flex;
}

.onboarding-modal {
  z-index: 60;
  padding: 20px;
  background: rgba(5, 7, 11, 0.82);
}

.onboarding-panel {
  width: min(370px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 20px 22px;
  border: 1px solid rgba(100, 210, 255, 0.22);
  border-radius: 22px;
  background: #1c212c;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.56);
  text-align: center;
}

.onboarding-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border: 1px solid rgba(100, 210, 255, 0.5);
  border-radius: 50%;
  background: rgba(100, 210, 255, 0.1);
  color: #bceeff;
  font-family: ui-serif, "Songti SC", "STSong", serif;
  font-size: 24px;
}

.onboarding-panel h2 {
  margin: 0;
  font-size: 24px;
}

.onboarding-panel > p {
  max-width: 290px;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.gender-options {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.gender-options button {
  min-height: 62px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  text-align: left;
}

.gender-options button:hover,
.gender-options button:focus-visible {
  border-color: #64d2ff;
  background: rgba(100, 210, 255, 0.1);
  outline: none;
}

.gender-options i {
  color: #8cdae8;
  font-size: 21px;
  font-style: normal;
  text-align: center;
}

.gender-options span {
  font-size: 14px;
  font-weight: 650;
}

.onboarding-panel > small {
  margin-top: 3px;
  color: #7f8793;
  font-size: 11px;
}

.character-modal {
  overflow-y: auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
}

.character-sheet {
  width: min(430px, 100%);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  border: 1px solid rgba(111, 151, 183, 0.4);
  border-radius: 22px;
  background: #121722;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.script-actor-sheet {
  width: min(430px, 100%);
}

.script-actor-visual {
  min-height: 270px;
}

.script-actor-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 16%;
}

.script-actor-badges {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 7px;
}

.script-actor-badges span {
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  background: rgba(9, 14, 21, 0.78);
  color: #e9f7ff;
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.script-actor-badges span:last-child { color: #f1c45d; }

.script-actor-info {
  padding: 18px 20px 22px;
}

.script-actor-identity h2 {
  margin: 2px 0 3px;
  color: #ffffff;
  font-size: 30px;
}

.script-actor-identity p {
  margin: 0;
  color: #c6ccd5;
  font-size: 13px;
}

#scriptActorSource {
  color: #8fcfd8;
  font-size: 11px;
  font-weight: 700;
}

.script-actor-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 13px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.script-actor-facts div {
  min-width: 0;
  padding: 0 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.script-actor-facts div:first-child { padding-left: 0; }
.script-actor-facts div:last-child { padding-right: 0; border-right: 0; }

.script-actor-facts dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.script-actor-facts dd {
  margin: 0;
  color: #eef3f8;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.script-actor-detail { margin-top: 16px; }

.script-actor-detail h3 {
  margin: 0 0 6px;
  color: #83d1d7;
  font-size: 12px;
  font-weight: 700;
}

.script-actor-detail p {
  color: #e7edf4;
  font-size: 13px;
  line-height: 1.65;
}

.character-visual {
  position: relative;
  min-height: 270px;
  overflow: hidden;
  border-radius: 21px 21px 0 0;
  background: #0c1520;
}

.character-visual::after {
  content: '';
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(180deg, transparent, rgba(10, 14, 21, 0.94));
  pointer-events: none;
}

.character-portrait-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.character-tags {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 7px;
}

.character-tags span {
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  background: rgba(9, 14, 21, 0.72);
  color: #e9f7ff;
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.character-tags span:last-child {
  border-color: rgba(85, 203, 222, 0.45);
  color: #9de6ef;
}

.character-close {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  background: rgba(9, 14, 21, 0.7);
  backdrop-filter: blur(10px);
}

.character-identity {
  position: absolute;
  z-index: 2;
  right: 20px;
  bottom: 18px;
  left: 20px;
}

.character-stars {
  margin-bottom: 5px;
  color: #f1c45d;
  font-size: 15px;
  letter-spacing: 2px;
}

.character-identity p {
  margin: 0;
}

#characterLatinName {
  color: #8fcfd8;
  font-size: 11px;
  font-weight: 700;
}

.character-title-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.character-title-line h2 {
  font-size: 30px;
}

.character-title-line span {
  color: #c7d1dd;
  font-size: 12px;
}

#characterTitle {
  margin-top: 3px;
  color: #c6ccd5;
  font-size: 13px;
}

.character-body {
  padding: 18px 20px 20px;
}

.affection-row {
  display: grid;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.affection-row > div:first-child,
.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.affection-row span,
.stat-label span {
  color: var(--muted);
  font-size: 12px;
}

.affection-row strong {
  color: #f2a8bd;
  font-size: 13px;
}

.affection-track,
.stat-track {
  height: 5px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
}

.affection-track i,
.stat-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d87594, #f2a8bd);
}

.character-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  padding: 17px 0;
}

.character-stat {
  display: grid;
  gap: 6px;
}

.stat-label strong {
  font-size: 13px;
}

.stat-track i {
  background: #61b9ca;
}

.stat-attack .stat-track i { background: #df766f; }
.stat-defense .stat-track i { background: #d3ad61; }
.stat-speed .stat-track i { background: #77c08a; }
.stat-magic .stat-track i { background: #8f8dd9; }

.character-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.character-facts div {
  min-width: 0;
  padding: 0 10px;
  border-right: 1px solid var(--line);
}

.character-facts div:first-child { padding-left: 0; }
.character-facts div:last-child { padding-right: 0; border-right: 0; }

.character-facts dt {
  color: var(--muted);
  font-size: 11px;
}

.character-facts dd {
  overflow: hidden;
  margin: 4px 0 0;
  color: #eef2f7;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-body blockquote {
  margin: 15px 0 0;
  color: #aeb7c4;
  font-family: ui-serif, "Songti SC", serif;
  font-size: 13px;
  line-height: 1.7;
}

.edit-avatar-btn {
  width: 100%;
  min-height: 38px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--field);
  color: #dce3eb;
  font-size: 13px;
}

.character-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 9px;
}

.wardrobe-panel {
  width: min(420px, 100%);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
}

.wardrobe-actor-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.wardrobe-actor-tabs button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--field);
  color: var(--muted);
  font-size: 12px;
}

.wardrobe-actor-tabs button.active {
  border-color: rgba(100, 210, 255, 0.72);
  background: rgba(100, 210, 255, 0.12);
  color: #dff8ff;
}

.wardrobe-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.wardrobe-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  color: var(--text);
  text-align: left;
}

.wardrobe-card.selected {
  border-color: #64d2ff;
  box-shadow: 0 0 0 2px rgba(100, 210, 255, 0.12);
}

.wardrobe-images {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #10141c;
}

.wardrobe-images.has-back {
  grid-template-columns: 1fr 1fr;
}

.wardrobe-images img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  object-fit: cover;
  object-position: 50% 18%;
  background: #10141c;
}

.wardrobe-card > span {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 10px;
}

.wardrobe-card strong {
  font-size: 13px;
}

.wardrobe-card small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.wardrobe-card i {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(8, 11, 16, 0.78);
  color: #d8e0e9;
  font-size: 10px;
  font-style: normal;
  backdrop-filter: blur(8px);
}

.wardrobe-card.selected i {
  border-color: #64d2ff;
  background: #64d2ff;
  color: #071017;
  font-weight: 700;
}

.avatar-panel {
  width: min(400px, 100%);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
}

.avatar-preview {
  width: 154px;
  aspect-ratio: 1;
  margin: 2px auto 4px;
  border: 1px solid rgba(111, 183, 199, 0.45);
  border-radius: 50%;
  background-color: #111722;
  box-shadow: 0 0 0 5px rgba(76, 168, 188, 0.08);
}

.avatar-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.avatar-preset {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 7px 3px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.avatar-preset:hover,
.avatar-preset.active {
  border-color: rgba(93, 177, 194, 0.45);
  background: rgba(93, 177, 194, 0.09);
  color: #dff8fb;
}

.avatar-preset-photo {
  width: 48px;
  height: 48px;
  display: block;
  border-radius: 50%;
  background-color: #111722;
}

.upload-avatar-btn {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(127, 183, 194, 0.5);
  border-radius: 9px;
  background: rgba(93, 177, 194, 0.06);
  color: #a8d8df;
  font-size: 13px;
  cursor: pointer;
}

.avatar-note {
  margin: -7px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.avatar-controls {
  display: grid;
  gap: 11px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.avatar-controls label {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 10px;
}

.avatar-controls span {
  color: #bdc4ce;
  font-size: 12px;
}

.avatar-controls input {
  width: 100%;
  accent-color: #5db1c2;
}

.avatar-controls input:disabled {
  opacity: 0.3;
}

.avatar-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 9px;
}

.avatar-actions > button:first-child {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
}

.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.profile-panel {
  width: min(480px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

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

.profile-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.profile-panel input,
.profile-panel textarea,
.profile-panel select {
  width: 100%;
  border: 1px solid var(--line);
  outline: none;
  border-radius: 14px;
  padding: 11px 12px;
  background: var(--field);
  color: var(--text);
}

.profile-panel textarea {
  resize: vertical;
  min-height: 86px;
}

.theme-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-picker legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.theme-options label {
  min-width: 0;
  display: block;
  cursor: pointer;
}

.theme-options input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-option {
  min-height: 70px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 9px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.theme-option i {
  display: flex;
  gap: 4px;
  font-style: normal;
}

.theme-option b {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.theme-option strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-option-midnight b:nth-child(1) { background: #0b0d12; }
.theme-option-midnight b:nth-child(2) { background: #232838; }
.theme-option-midnight b:nth-child(3) { background: #0a84ff; }
.theme-option-campus b:nth-child(1) { background: #f8fbfd; }
.theme-option-campus b:nth-child(2) { background: #a9c8dc; }
.theme-option-campus b:nth-child(3) { background: #3b8edb; }
.theme-option-cinema b:nth-child(1) { background: #050505; }
.theme-option-cinema b:nth-child(2) { background: #8a6a35; }
.theme-option-cinema b:nth-child(3) { background: #d6c4a1; }
.theme-option-wechat b:nth-child(1) { background: #ededed; }
.theme-option-wechat b:nth-child(2) { background: #ffffff; }
.theme-option-wechat b:nth-child(3) { background: #95ec69; }

.theme-options input:checked + .theme-option {
  border-color: #64bde5;
  box-shadow: 0 0 0 3px rgba(70, 171, 218, 0.14);
}

.theme-options input:focus-visible + .theme-option {
  outline: 2px solid #64bde5;
  outline-offset: 2px;
}

/* 校园 Galgame：明亮、轻快，保留聊天效率。 */
:root[data-theme="campus"] .app {
  background: rgba(244, 249, 252, 0.8);
  box-shadow: 0 0 60px rgba(55, 79, 99, 0.16);
}

:root[data-theme="campus"] .topbar,
:root[data-theme="campus"] .composer {
  background: rgba(248, 252, 254, 0.94);
}

:root[data-theme="campus"] .scene-background {
  filter: blur(12px) saturate(0.72) brightness(1.08);
  opacity: 0.5;
}

:root[data-theme="campus"] .chat-stage::after {
  background: rgba(239, 246, 250, 0.55);
}

:root[data-theme="campus"] .story-narration {
  border-color: rgba(75, 122, 151, 0.2);
  border-left-color: #6da7bd;
  background: rgba(250, 253, 255, 0.74);
  color: #556776;
}

:root[data-theme="campus"] .dialogue-bubble {
  border-color: rgba(63, 91, 112, 0.13);
  background: rgba(255, 255, 255, 0.94);
  color: #24313d;
  box-shadow: 0 8px 24px rgba(66, 91, 111, 0.1);
}

:root[data-theme="campus"] .speaker-name { color: #39738a; }
:root[data-theme="campus"] .more-menu { background: rgba(253, 254, 255, 0.98); box-shadow: 0 18px 55px rgba(55, 79, 99, 0.2); }
:root[data-theme="campus"] .more-menu button:hover { background: rgba(63, 116, 153, 0.08); }
:root[data-theme="campus"] .story-choices button { border-color: rgba(55, 79, 99, 0.14); background: rgba(255, 255, 255, 0.7); color: #263746; }
:root[data-theme="campus"] .system-strip { background: rgba(87, 155, 175, 0.09); color: #526572; }
:root[data-theme="campus"] .character-trigger.multi-character { background: rgba(248, 252, 254, 0.94); }
:root[data-theme="campus"] .character-trigger .avatar-photo { border-color: #eef5f8; }

/* 电影叙事：弱化控件，以字幕和场景为中心。 */
:root[data-theme="cinema"] .app {
  background: rgba(3, 3, 3, 0.7);
  box-shadow: 0 0 90px rgba(0, 0, 0, 0.72);
}

:root[data-theme="cinema"] .topbar,
:root[data-theme="cinema"] .composer {
  background: rgba(4, 4, 4, 0.88);
}

:root[data-theme="cinema"] .scene-background {
  filter: blur(7px) saturate(0.78) brightness(0.74);
  opacity: 0.9;
}

:root[data-theme="cinema"] .chat-stage::after { background: rgba(0, 0, 0, 0.38); }

:root[data-theme="cinema"] .story-turn { gap: 20px; }

:root[data-theme="cinema"] .story-narration {
  border: 0;
  border-left: 2px solid rgba(196, 157, 91, 0.62);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.34);
  color: #c8c0b3;
  font-size: 13px;
}

:root[data-theme="cinema"] .dialogue-bubble {
  border-color: rgba(214, 196, 161, 0.18);
  border-radius: 6px;
  background: rgba(5, 5, 5, 0.8);
  color: #f0ece3;
  font-family: ui-serif, "Songti SC", "STSong", serif;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

:root[data-theme="cinema"] .speaker-name { color: #c6a86e; }
:root[data-theme="cinema"] .message-row.user .bubble { border-radius: 6px; background: #7d6032; }
:root[data-theme="cinema"] .story-choices { grid-template-columns: 1fr; }
:root[data-theme="cinema"] .story-choices button { border-color: rgba(214, 196, 161, 0.17); border-radius: 5px; background: rgba(5, 5, 5, 0.66); color: #ece6da; }
:root[data-theme="cinema"] .story-choices button span { background: rgba(157, 123, 64, 0.2); color: #d4b87f; }
:root[data-theme="cinema"] .more-menu { background: rgba(12, 12, 11, 0.98); }
:root[data-theme="cinema"] .composer textarea { border-radius: 8px; }
:root[data-theme="cinema"] .composer button { border-radius: 8px; background: #806236; }

/* 经典聊天：严格沿用参考图的浅灰会话、左右头像与绿色己方气泡。 */
:root[data-theme="wechat"] .app {
  background: #ededed;
  box-shadow: none;
}

:root[data-theme="wechat"] .topbar {
  position: relative;
  min-height: 62px;
  justify-content: stretch;
  padding: 0 16px;
  border-bottom-color: rgba(0, 0, 0, 0.08);
  background: #ededed;
  box-shadow: none;
}

:root[data-theme="wechat"] .top-actions {
  width: 100%;
  justify-content: space-between;
}

:root[data-theme="wechat"] .chat-contact-btn {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  display: block;
  max-width: 58%;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: #171717;
  font-size: 18px;
  font-weight: 650;
  text-overflow: ellipsis;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

:root[data-theme="wechat"] .chat-contact-btn:disabled {
  color: #171717;
}

:root[data-theme="wechat"] .character-trigger {
  display: none;
}

:root[data-theme="wechat"] .scene-trigger {
  width: 38px;
  height: 44px;
  flex-basis: 38px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #171717;
}

:root[data-theme="wechat"] .scene-trigger span {
  display: none;
}

:root[data-theme="wechat"] .scene-trigger::before {
  content: "‹";
  display: block;
  font-family: Arial, sans-serif;
  font-size: 42px;
  font-weight: 300;
  line-height: 36px;
  transform: translateY(-1px);
}

:root[data-theme="wechat"] .more-btn {
  width: 42px;
  height: 44px;
  padding: 0 0 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #171717;
  box-shadow: none;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 3px;
}

:root[data-theme="wechat"] .more-menu {
  top: 50px;
  border-color: rgba(0, 0, 0, 0.09);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.16);
}

:root[data-theme="wechat"] .more-menu button:hover {
  background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="wechat"] .scene-background,
:root[data-theme="wechat"] .chat-stage::after {
  display: none;
}

:root[data-theme="wechat"] .chat-stage,
:root[data-theme="wechat"] .messages {
  background: #ededed;
}

:root[data-theme="wechat"] .messages {
  gap: 18px;
  padding: 26px 12px 88px;
}

:root[data-theme="wechat"] .chat-time {
  align-self: center;
  display: block;
  margin: 2px 0 4px;
  color: #adadad;
  font-size: 12px;
  line-height: 1.4;
}

:root[data-theme="wechat"] .story-turn {
  gap: 16px;
}

:root[data-theme="wechat"] .dialogue-row {
  align-items: flex-start;
  gap: 10px;
}

:root[data-theme="wechat"] .dialogue-row > .avatar {
  margin-top: 0;
}

:root[data-theme="wechat"] .avatar,
:root[data-theme="wechat"] .user-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  border-radius: 4px;
  background-color: #d8d8d8;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: none;
  overflow: hidden;
}

:root[data-theme="wechat"] .user-avatar {
  display: block;
}

:root[data-theme="wechat"] .dialogue-content {
  max-width: calc(100% - 96px);
}

:root[data-theme="wechat"] .speaker-name {
  display: none;
}

:root[data-theme="wechat"] .bubble,
:root[data-theme="wechat"] .dialogue-bubble {
  position: relative;
  max-width: calc(100% - 96px);
  padding: 10px 13px;
  border: 0;
  border-radius: 4px;
  color: #171717;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  box-shadow: none;
}

:root[data-theme="wechat"] .dialogue-bubble {
  max-width: 100%;
  background: #ffffff;
}

:root[data-theme="wechat"] .dialogue-bubble::before {
  position: absolute;
  top: 13px;
  left: -6px;
  width: 0;
  height: 0;
  content: "";
  border-top: 6px solid transparent;
  border-right: 7px solid #ffffff;
  border-bottom: 6px solid transparent;
}

:root[data-theme="wechat"] .message-row.user {
  align-items: flex-start;
  gap: 10px;
}

:root[data-theme="wechat"] .message-row.user .bubble {
  border-radius: 4px;
  background: #95ec69;
  color: #171717;
}

:root[data-theme="wechat"] .message-row.user .bubble::after {
  position: absolute;
  top: 13px;
  right: -6px;
  width: 0;
  height: 0;
  content: "";
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid #95ec69;
}

:root[data-theme="wechat"] .story-narration {
  width: 86%;
  margin: 3px auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #8d8d8d;
  backdrop-filter: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

:root[data-theme="wechat"] .story-narration.live::after {
  background: #8d8d8d;
}

:root[data-theme="wechat"] .system-strip {
  width: auto;
  max-width: 86%;
  grid-template-columns: 1fr;
  gap: 3px;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  background: #dedede;
  color: #777777;
  font-size: 12px;
  text-align: center;
}

:root[data-theme="wechat"] .system-strip strong {
  color: #696969;
}

:root[data-theme="wechat"] .story-choices {
  width: calc(100% - 50px);
  margin-left: 50px;
  grid-template-columns: 1fr;
  gap: 8px;
}

:root[data-theme="wechat"] .story-choices button {
  min-height: 42px;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  color: #171717;
  box-shadow: none;
}

:root[data-theme="wechat"] .story-choices button span {
  background: #e8e8e8;
  color: #777777;
}

:root[data-theme="wechat"] .composer {
  gap: 8px;
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  border-top-color: rgba(0, 0, 0, 0.09);
  background: #f7f7f7;
}

:root[data-theme="wechat"] .composer textarea {
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 5px;
  background: #ffffff;
  color: #171717;
  box-shadow: none;
}

:root[data-theme="wechat"] .composer textarea:focus {
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

:root[data-theme="wechat"] .composer.continue-mode textarea[data-continue-default="true"] {
  color: #888888;
}

:root[data-theme="wechat"] .composer button {
  min-width: 58px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 5px;
  background: #07c160;
  color: #ffffff;
  font-size: 14px;
}

:root[data-theme="wechat"] .profile-panel {
  background: #ffffff;
}

:root[data-theme="wechat"] .avatar-preset:hover,
:root[data-theme="wechat"] .avatar-preset.active {
  border-color: #69b8ca;
  background: #eaf7fa;
  color: #173f48;
}

:root[data-theme="wechat"] .upload-avatar-btn {
  border-color: #9bbfc7;
  background: #f7fbfc;
  color: #3b626b;
}

.primary-wide {
  min-height: 46px;
}

@media (max-width: 560px) {
  .app {
    border: 0;
    box-shadow: none;
  }

  .topbar {
    padding: 14px 14px 12px;
    gap: 8px;
  }

  h1 {
    font-size: 18px;
  }

  .actor-row {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .actor-row > img {
    width: 50px;
    height: 66px;
  }

  .actor-info small {
    display: none;
  }

  .ghost-btn {
    min-width: 0;
    padding: 7px 8px;
    font-size: 12px;
  }

  .character-trigger,
  .scene-trigger {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .more-btn {
    width: 34px;
    height: 34px;
  }

  .messages {
    padding: 22px 14px 80px;
  }

  .bubble {
    max-width: 82%;
    font-size: 15px;
  }

  .dialogue-content {
    max-width: calc(100% - 46px);
  }

  .dialogue-bubble {
    max-width: 100%;
  }

  .story-narration {
    padding: 11px 12px;
    font-size: 13px;
  }

  .story-choices {
    grid-template-columns: 1fr;
  }

  .save-slot {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .save-slot-actions {
    justify-content: flex-end;
  }

  .character-visual {
    min-height: 245px;
  }

  .character-title-line h2 {
    font-size: 26px;
  }
}
