:root {
  --page-gutter: 16px;
  --nav-height: 50px;
  --radius-card: 16px;
  --shadow-card: 0 1px 2px rgb(40 20 35 / 4%), 0 7px 20px rgb(40 20 35 / 5%);
}

body { letter-spacing: -.1px; }
.shell { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
.topbar {
  min-height: var(--nav-height);
  padding: calc(10px + env(safe-area-inset-top)) var(--page-gutter) 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent);
}
.shell .topbar h1, .shell .topbar h2 { font-size: 17px; line-height: 22px; font-weight: 650; }
.topbar > :first-child, .topbar > :last-child { min-width: 58px; }
.topbar h1, .topbar h2 { text-align: center; flex: 1; }
.content { padding: 18px var(--page-gutter); }

.card { border-radius: var(--radius-card); border-color: color-mix(in srgb, var(--line) 65%, transparent); box-shadow: var(--shadow-card); padding: 15px; }
.hero { min-height: 204px; border-radius: 22px; padding: 20px; box-shadow: 0 12px 28px rgb(177 77 139 / 24%); }
.hero h2 { font-size: 25px; line-height: 1.25; letter-spacing: -.7px; }
.hero .badge { width: fit-content; background: rgb(255 255 255 / 20%); color: white; backdrop-filter: blur(8px); }
.title { font-size: 15px; font-weight: 650; }
.muted, .meta { font-size: 12px; line-height: 1.45; }
.avatar { width: 48px; height: 48px; border-radius: 14px; font-size: 25px; }
.row { gap: 11px; }

.discover-orders { padding-top: 2px; }
.genre-scroll { margin: 0 calc(-1 * var(--page-gutter)); padding: 2px var(--page-gutter) 14px; }
.filter-chip { padding: 7px 12px; font-size: 12px; border-color: transparent; background: var(--input); }
.filter-chip.active { box-shadow: 0 3px 8px rgb(214 112 164 / 20%); }

.tabs { height: calc(74px + env(safe-area-inset-bottom)); border-top-color: color-mix(in srgb, var(--line) 72%, transparent); background: color-mix(in srgb, var(--card) 93%, transparent); }
.tab { font-size: 10px; gap: 4px; padding-top: 5px; }
.tab .ico { font-size: 21px; line-height: 21px; }
.tab.active .ico { transform: translateY(-1px); }
.tab.active::after { content: ''; width: 4px; height: 4px; border-radius: 99px; background: var(--accent); margin: 0 auto; }

.segmented { margin: 0 0 20px; border-radius: 13px; padding: 4px; }
.segmented button { min-height: 38px; padding: 8px; font-size: 13px; }
.empty { padding: 76px 24px; }
.empty .big { font-size: 46px; }
.fab { right: max(18px, calc((100vw - 548px) / 2)); bottom: calc(94px + env(safe-area-inset-bottom)); padding: 14px 18px; font-size: 14px; }

.form label { font-size: 12px; margin: 18px 2px 7px; color: var(--textSecondary, var(--muted)); }
.form input, .form textarea, .form select { border-radius: 12px; border-color: color-mix(in srgb, var(--line) 75%, transparent); padding: 12px 13px; font-size: 15px; box-shadow: 0 1px 1px rgb(0 0 0 / 2%); }
.form textarea { min-height: 116px; line-height: 1.55; }
.btn { border-radius: 12px; padding: 11px 14px; font-size: 14px; }
.btn.primary { box-shadow: 0 5px 12px rgb(214 112 164 / 20%); }
.editor-tabs { top: calc(var(--nav-height) + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(14px); }
.editor-tab { font-size: 12px; padding: 12px 2px 10px; }
.section-head { padding: 9px 2px 5px; }
.section-head h3 { font-size: 19px; letter-spacing: -.35px; }
.style-chip { border-radius: 12px; font-size: 13px; }
.dashed { color: var(--accent); font-weight: 600; }
.editor-empty { box-shadow: var(--shadow-card); }

.menu-row { min-height: 62px; padding: 13px 14px; }
.settings-group { margin-bottom: 24px; }
.group-title { padding-left: 2px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.menu-icon { width: 36px; height: 36px; border-radius: 11px; }
.profile-photo, .character-photo { box-shadow: inset 0 0 0 1px var(--line); }

.messages { padding: 14px var(--page-gutter) 172px; }
.chat-message-row { display: flex; width: 100%; align-items: flex-end; gap: 8px; margin: 9px 0; }
.chat-message-row.user { justify-content: flex-end; }
.chat-message-row.narrator { justify-content: flex-start; align-items: flex-start; margin: 14px 0; }
.chat-message-row.continued { margin-top: -5px; }
.chat-avatar,.chat-avatar-spacer { flex: 0 0 34px; width: 34px; height: 34px; }
.chat-avatar { overflow: hidden; border-radius: 50%; font-size: 13px; }
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.message-stack { display: grid; max-width: calc(82% - 42px); justify-items: start; }
.chat-message-row.user .message-stack { max-width: 82%; justify-items: end; }
.chat-message-row.narrator .message-stack { width: auto; max-width: none; flex: 1; justify-items: start; }
.bubble { max-width: 100%; margin: 0; border-radius: 18px; padding: 6px 11px; font-size: 15px; box-shadow: 0 1px 1px rgb(0 0 0 / 3%); }
.chat-message-row.user .bubble { border-bottom-right-radius: 5px; }
.chat-message-row.character:not(.continued) .bubble { border-bottom-left-radius: 5px; }
.chat-message-row.character.continued .bubble { border-radius: 7px 18px 18px 7px; }
.chat-message-row.narrator .bubble { width: 100%; max-width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--muted); box-shadow: none; }
.chat-message-row.narrator .message-text { font-size: 15px; line-height: 1.6; text-align: left; }
.chat-message-row.narrator .story-narration { margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font-size: inherit; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message-row .message-text,
.chat-message-row .story-dialogue,
.chat-message-row .story-description,
.chat-message-row .story-narration { font-size: 15px; }
.story-dialogue { white-space: pre-wrap; }
.story-description { display: block; margin: 4px 0; color: var(--muted); font-size: 1em; font-style: normal; line-height: 1.6; white-space: pre-wrap; }
.story-narration { display: block; margin: 7px -4px; padding: 8px 10px; border-left: 2px solid var(--accent); border-radius: 8px; background: color-mix(in srgb,var(--accent) 7%,transparent); color: var(--muted); font-size: 1em; line-height: 1.6; white-space: pre-wrap; }
.bubble.user .story-description { color: rgb(255 255 255 / 82%); }
.bubble.user .story-narration { border-left-color: rgb(255 255 255 / 58%); background: rgb(255 255 255 / 12%); color: rgb(255 255 255 / 86%); }
.message-actions { display: flex; flex-wrap: wrap; gap: 6px 10px; min-height: 20px; padding: 4px 4px 0; }
.message-actions button { border: 0; padding: 2px 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 400; }
.typing-bubble { min-width: 52px; min-height: 34px; display: grid; place-items: center; }
.typing-indicator { display: flex; align-items: center; justify-content: center; gap: 4px; height: 18px; padding: 0 3px; }
.typing-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.message-edit-overlay { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 18px; background: rgb(20 12 24 / 34%); backdrop-filter: blur(3px); }
.message-edit-popup { width: min(100%,430px); padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 20px 60px rgb(20 12 24 / 28%); }
.message-edit-popup .title { margin-bottom: 12px; font-size: 15px; }
.message-edit-popup textarea { width: 100%; min-height: 150px; border: 1px solid var(--line); border-radius: 13px; padding: 12px; background: var(--input); color: var(--text); line-height: 1.6; resize: vertical; outline: none; }
.message-edit-popup textarea:focus { border-color: var(--accent); }
.message-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.composer-wrap { background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(15px); }
.chat-command-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px var(--page-gutter) 0; }
.chat-command-bar .status-open { margin: 0; }
.chat-format-commands { display: flex; gap: 7px; }
.chat-format-commands button { min-width: 38px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; background: var(--card); color: var(--accent); font-size: 11px; font-weight: 700; }
.sender-bar { padding: 7px var(--page-gutter) 0; }
.composer-wrap .composer { padding: 8px var(--page-gutter) 10px; }
.composer textarea { font-size: 15px; min-height: 44px; }
.send { width: 44px; height: 44px; flex: 0 0 44px; }

@media (min-width: 700px) {
  .shell { border-radius: 26px; overflow: hidden; min-height: calc(100dvh - 28px); margin-top: 14px; }
  .modal { border-radius: 26px; top: 14px; bottom: 14px; }
}

.editor-tabs { display: flex; grid-template-columns: none; overflow-x: auto; scrollbar-width: none; padding: 0 6px; }
.editor-tab { flex: 0 0 76px; }
.option-group { margin: 18px 0 24px; border-radius: 15px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.option-group > .title { padding: 13px 14px 8px; }
.option-row { width: 100%; display: flex; align-items: center; gap: 11px; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 11px 14px; text-align: left; }
.option-row.active { background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.radio { color: var(--accent); font-size: 17px; }
.option-title, .option-sub { display: block; }
.option-title { font-size: 14px; font-weight: 650; }
.option-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.toggle-setting { display: flex !important; align-items: center; gap: 14px; margin: 18px 0 !important; padding: 14px; border-radius: 15px; background: var(--card); border: 1px solid var(--line); }
.toggle-setting input { width: 46px !important; accent-color: var(--accent); }
.settings-label { margin: 24px 2px 10px; }
.mood-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mood-chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 12px; font-size: 12px; }
.mood-chip.active { color: white; background: var(--accent); border-color: var(--accent); }
.showcase-toolbar { margin: 14px 0 11px; }
.cover-editor { display: flex; gap: 10px; overflow-x: auto; padding: 2px 1px 10px; }
.cover-thumb, .cover-add { position: relative; flex: 0 0 116px; aspect-ratio: 3/4; border-radius: 15px; overflow: hidden; }
.cover-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cover-add { border: 1px dashed var(--line); background: var(--card); display: grid; place-content: center; gap: 5px; color: var(--accent); }
.cover-plus { font-size: 28px; text-align: center; }
.cover-remove { position: absolute; right: 6px; top: 6px; width: 25px; height: 25px; border: 0; border-radius: 50%; background: rgb(0 0 0 / 60%); color: white; }
.main-cover { position: absolute; left: 6px; bottom: 6px; padding: 4px 7px; border-radius: 99px; background: rgb(0 0 0 / 62%); color: white; font-size: 9px; }
.tag-editor, .preview-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.tag-chip, .preview-tags span { border: 0; border-radius: 99px; background: var(--input); color: var(--accent); padding: 6px 9px; font-size: 11px; }
.ai-generate { color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, var(--card)); margin-bottom: 8px; }
.preview-body { padding-bottom: 30px; }
.preview-covers { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
.preview-covers img, .preview-placeholder { width: 100%; flex: 0 0 100%; aspect-ratio: 3/4; object-fit: cover; scroll-snap-align: start; background: linear-gradient(145deg,#e078ab,#8b5ac7); display: grid; place-items: center; font-size: 72px; }
.preview-body > h1, .preview-body > p, .preview-body > .preview-tags, .preview-body > .preview-stats, .preview-body > article, .preview-body > button { margin-left: 18px; margin-right: 18px; }
.preview-body > h1 { font-size: 24px; margin-top: 18px; margin-bottom: 7px; }
.preview-short { color: var(--muted); margin-top: 0; }
.preview-stats { color: var(--muted); font-size: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.preview-intro { white-space: pre-wrap; line-height: 1.75; font-size: 14px; padding: 18px 0; }

.status-notice { margin: 14px 0; padding: 13px 14px; border-radius: 13px; background: color-mix(in srgb,var(--accent) 8%,var(--card)); border: 1px solid color-mix(in srgb,var(--accent) 18%,var(--line)); }
.status-mode { margin: 14px 0 22px; }
.status-manager-card { margin: 14px 0 22px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow-card); }
.status-category-head { margin: 4px 2px 16px; }
.btn.compact { width: auto; margin: 0; padding: 7px 9px; font-size: 11px; }
.status-mode-chips { display: flex; gap: 7px; overflow-x: auto; margin-top: 13px; padding-bottom: 2px; scrollbar-width: none; }
.status-mode-chips::-webkit-scrollbar { display: none; }
.status-mode-chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; background: var(--input); color: var(--muted); font-size: 11px; }
.status-mode-chip.active { border-color: var(--accent); background: color-mix(in srgb,var(--accent) 12%,var(--card)); color: var(--accent); font-weight: 700; }
.status-choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.status-choice { display: flex; min-height: 48px; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; background: var(--card); color: var(--muted); text-align: left; }
.status-choice.active { border-color: var(--accent); background: color-mix(in srgb,var(--accent) 9%,var(--card)); color: var(--text); box-shadow: 0 0 0 2px color-mix(in srgb,var(--accent) 9%,transparent); }
.choice-dot { color: var(--accent); font-size: 11px; }
.ai-instruction-field { margin-top: 15px; padding: 13px; border: 1px solid color-mix(in srgb,var(--accent) 30%,var(--line)); border-radius: 14px; background: color-mix(in srgb,var(--accent) 5%,var(--card)); }
.ai-instruction-field[hidden] { display: none; }
.ai-instruction-field .field-head label { margin: 0; }
.ai-instruction-field textarea { min-height: 110px; }
.status-manager-list { display: grid; gap: 9px; margin-top: 16px; }
.status-manager-row { display: flex; align-items: center; gap: 8px; }
.status-manager-row input { flex: 1; min-width: 0; }
.status-manager-row .delete { flex: 0 0 auto; border: 0; border-radius: 10px; padding: 9px; background: color-mix(in srgb,var(--danger) 9%,var(--card)); color: var(--danger); font-size: 11px; }
.account-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: 24px; padding: 3px; border-radius: 13px; background: var(--input); }
.account-tabs button { border: 0; border-radius: 10px; padding: 9px; background: transparent; color: var(--muted); font-size: 12px; }
.account-tabs button.active { background: var(--card); color: var(--accent); font-weight: 700; box-shadow: 0 2px 8px rgb(0 0 0 / 7%); }
.account-form-title { margin-bottom: 12px; font-size: 18px; font-weight: 750; }
.account-panel input + input { margin-top: 10px; }
.account-message { min-height: 22px; margin-top: 12px; font-size: 12px; line-height: 1.6; }
.account-message.error { color: var(--danger); }
.account-message.success { color: #29945d; }
.account-note { margin-top: 18px; text-align: center; }
.account-identity { display: grid; justify-items: center; gap: 7px; padding: 30px 16px; text-align: center; }
.account-check { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 50%; background: color-mix(in srgb,#29945d 13%,var(--card)); color: #29945d; font-size: 24px; font-weight: 800; }
.status-badge, .source-badge { padding: 5px 8px; border-radius: 99px; font-size: 10px; font-weight: 650; background: var(--input); color: var(--muted); }
.source-badge.ai { background: color-mix(in srgb,#8b5cf6 13%,var(--card)); color: #8150d8; }
.source-badge.fixed { background: color-mix(in srgb,#64748b 12%,var(--card)); color: #64748b; }
.source-badge.app { background: color-mix(in srgb,#0ea5e9 12%,var(--card)); color: #1686ad; }
.status-definition-section { margin: 0 0 22px; }
.status-definition-section > .row { margin: 0 2px 8px; }
.status-definition-card { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: var(--card); padding: 12px 14px; }
.status-order-controls { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; }
.status-order-controls button,.category-order-buttons button { display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 8px; background: var(--input); color: var(--muted); font-size: 11px; }
.status-order-controls button:active,.category-order-buttons button:active { background: color-mix(in srgb,var(--accent) 12%,var(--input)); color: var(--accent); }
.category-order-buttons { display: grid; flex: 0 0 auto; grid-template-columns: 28px 28px; gap: 3px; }
.category-order-buttons button:disabled { opacity: .28; }
.category-manager-row input { min-width: 90px; }
.status-definition-card:nth-child(2) { border-radius: 14px 14px 0 0; }
.status-definition-card:last-child { border-radius: 0 0 14px 14px; border-bottom: 0; }
.status-definition-section > .status-definition-card:nth-child(2):last-child { border-radius: 14px; }
.status-definition-card .row { gap: 7px; justify-content: flex-start; }
.status-add { margin-bottom: 28px; }
.number-options { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.status-number-settings[hidden], .status-change-rules[hidden], .ai-instruction-field[hidden], .status-time-settings[hidden] { display: none; }
.status-number-settings { display: grid; gap: 12px; }
.status-number-change-rules { margin-top: 20px; }
.status-change-rules { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.status-trigger-rules { margin-top: 22px; }
.status-trigger-target { display: grid; gap: 6px; grid-column: 1 / -1; }
.status-trigger-target > .muted { font-size: 12px; }
.status-popup-choice-trigger { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--input); color: var(--text); text-align: left; }
.status-popup-choice-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-option-popup-overlay { position: fixed; z-index: 160; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 18px max(12px,env(safe-area-inset-right)) max(18px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); background: rgb(0 0 0 / 30%); }
.status-option-popup { width: min(100%,520px); max-height: min(70dvh,520px); overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: 0 20px 55px rgb(0 0 0 / 24%); }
.status-option-popup-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 9px 10px; }
.status-option-popup-close { display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 50%; background: var(--input); color: var(--muted); font-size: 20px; }
.status-option-popup-item { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; border-radius: 12px; padding: 13px 12px; background: transparent; color: var(--text); text-align: left; }
.status-option-popup-item.active { background: color-mix(in srgb,var(--accent) 10%,var(--input)); font-weight: 700; }
.status-trigger-row { grid-template-columns: minmax(0,1fr) 118px auto; }
.status-rule-list { display: grid; gap: 10px; }
.status-rule-row { display: grid; grid-template-columns: minmax(0,1fr) 118px auto; gap: 8px; align-items: end; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.status-rule-row:last-child { padding-bottom: 0; border-bottom: 0; }
.status-rule-delta { display: grid; gap: 5px; }
.status-rule-delta span { color: var(--muted); font-size: 11px; }
@media (max-width: 520px) { .status-rule-row { grid-template-columns: minmax(0,1fr) 94px; } .status-rule-row .delete { grid-column: 1 / -1; justify-self: end; } }
@media (max-width: 520px) { .status-trigger-row { grid-template-columns: minmax(0,1fr) 94px; } }

.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; padding: 20px 12px calc(24px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; }
.legal-links a { color: inherit; text-decoration: none; }
.legal-links a:active { opacity: .55; }
.legal-page { z-index: 120; }
.legal-article { max-width: 720px; margin: 0 auto; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.legal-lead { margin: 8px 0 4px; color: var(--text); font-size: 16px; line-height: 1.8; }
.legal-date { margin: 0 0 24px; color: var(--muted); font-size: 12px; }
.legal-article section { padding: 20px 0; border-top: 1px solid var(--line); }
.legal-article h3 { margin: 0 0 10px; font-size: 17px; }
.legal-article section p { margin: 8px 0 0; color: var(--text); font-size: 14px; line-height: 1.85; }
.legal-article > .legal-links { border-top: 1px solid var(--line); }
.account-note a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.btn.danger { color: var(--danger); background: color-mix(in srgb,var(--danger) 8%,var(--card)); }

.chat.modal { max-width: 980px; overflow: hidden; }
.chat-layout { min-height: 0; flex: 1; display: flex; }
.chat-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.chat-main .messages { min-height: 0; overflow-y: auto; padding-bottom: 24px; }
.chat-main .composer-wrap { position: sticky; width: 100%; flex: 0 0 auto; }
.status-open { align-self: flex-start; margin: 7px 16px 0; padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--accent); font-size: 11px; }
.runtime-status-panel { width: 330px; flex: 0 0 330px; overflow-y: auto; background: var(--bg); border-left: 1px solid var(--line); padding: 15px; }
.status-panel-head { position: sticky; top: -15px; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 14px 0 12px; background: var(--bg); }
.status-close { display: none; border: 0; background: var(--input); width: 30px; height: 30px; border-radius: 50%; }
.runtime-category { margin-bottom: 14px; padding: 13px; border-radius: 15px; background: var(--card); border: 1px solid var(--line); }
.runtime-category h3 { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.runtime-field { display: block; width: 100%; padding: 9px 7px; margin: 0 -7px; border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.runtime-field:hover, .runtime-field:focus-visible { background: var(--input); outline: none; }
.runtime-label { font-size: 12px; color: var(--muted); }
.runtime-value { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; }
.runtime-edit-mark { color: var(--muted); font-size: 17px; line-height: 1; }
.status-progress { height: 5px; overflow: hidden; border-radius: 99px; background: var(--input); margin-top: 6px; }
.status-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--accent),var(--accent2)); }
.event-item { width: 100%; display: grid; grid-template-columns: minmax(76px,auto) 1fr auto; gap: 7px; align-items: start; border: 0; border-top: 1px solid var(--line); padding: 9px 0; background: transparent; color: inherit; text-align: left; }
.event-item time { color: var(--muted); font-size: 9px; }
.event-item p { margin: 0; font-size: 11px; line-height: 1.5; }
.status-time-settings { display: grid; gap: 10px; }
.status-year-toggle { width: 100%; min-width: 0; flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; margin: 0 !important; writing-mode: horizontal-tb; }
.status-year-toggle > span { flex: 1 1 auto; min-width: 0; text-align: left; white-space: normal; writing-mode: horizontal-tb; }
.form .status-year-toggle > input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 20px; margin: 0 0 0 auto; padding: 0; }
.reuse-settings-button { margin: 2px 0 16px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.reuse-settings-list { display: grid; gap: 9px; margin-top: 14px; }
.reuse-settings-item { width: 100%; margin: 0; text-align: left; display: flex; align-items: center; gap: 11px; color: var(--text); }
.reuse-settings-item .title, .reuse-settings-item .muted { display: block; }
.reuse-settings-item .muted { margin-top: 3px; }
.reuse-settings-avatar { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; overflow: hidden; background: var(--input); display: grid; place-items: center; }
.reuse-settings-avatar img { width: 100%; height: 100%; object-fit: cover; }
.status-rule-row textarea { min-height: 76px; }
.turn-change-item { display: grid; grid-template-columns: minmax(70px,.7fr) minmax(0,1.3fr) auto; gap: 7px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 10px; }
.turn-change-label { font-weight: 700; }
.turn-change-values { color: var(--muted); overflow-wrap: anywhere; }
.turn-change-delta { color: var(--accent); font-weight: 700; white-space: nowrap; }
@media (max-width: 520px) { .status-rule-row textarea { grid-column: 1 / -1; } }

@media (max-width: 699px) {
  .runtime-status-panel { display: block; position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; width: min(100%,560px); max-height: 82dvh; margin: auto; padding: 16px; border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -15px 50px rgb(0 0 0 / 22%); transform: translateY(105%); transition: transform .22s ease; }
  .runtime-status-panel.open { transform: translateY(0); }
  .status-close { display: block; }
}

@media (min-width: 700px) {
  .status-open { display: none; }
  .chat-main { max-width: 650px; }
}

/* Image-forward home discovery */
.discover-home { margin: -4px -2px 18px; }
.home-search { width: 100%; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; margin: 4px 0 15px; padding: 10px 12px; border: 0; border-radius: 13px; background: var(--input); color: var(--muted); text-align: left; font-size: 13px; }
.home-search > span:first-child { font-size: 20px; line-height: 1; }
.search-action { color: var(--accent); font-weight: 700; }
.featured-rail { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 1px 5px; scrollbar-width: none; }
.featured-rail::-webkit-scrollbar, .work-rail::-webkit-scrollbar { display: none; }
.featured-card { position: relative; flex: 0 0 88%; min-height: 218px; overflow: hidden; border: 0; border-radius: 20px; padding: 0; color: white; text-align: left; scroll-snap-align: start; background: #372846; box-shadow: 0 9px 24px rgb(44 26 52 / 15%); }
.featured-cover { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; aspect-ratio: auto !important; border-radius: 0 !important; }
.featured-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg,rgb(22 13 30 / 82%) 0%,rgb(22 13 30 / 43%) 55%,transparent 100%); }
.featured-copy { position: relative; z-index: 2; width: 70%; padding: 26px 20px; }
.featured-label { display: inline-block; color: #ffe2f2; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.featured-copy h2 { margin: 8px 0 6px; color: white; font-size: 21px; line-height: 1.28; }
.featured-copy p { margin: 0 0 16px; color: rgb(255 255 255 / 78%); font-size: 11px; line-height: 1.55; }
.featured-cta { font-size: 11px; font-weight: 700; }
.home-genres { margin: 15px -16px 2px; padding: 0 16px 6px; }
.home-section { margin-top: 22px; }
.home-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.home-section-head h2 { margin: 0 0 3px; font-size: 17px; }
.home-section-head p { margin: 0; color: var(--muted); font-size: 10px; }
.section-more { flex: 0 0 auto; border: 0; background: transparent; color: var(--muted); font-size: 10px; }
.work-rail { display: flex; gap: 11px; overflow-x: auto; scroll-snap-type: x proximity; margin-right: -16px; padding: 0 16px 6px 0; scrollbar-width: none; }
.work-card { flex: 0 0 143px; min-width: 0; border: 0; padding: 0; background: transparent; color: var(--text); text-align: left; scroll-snap-align: start; }
.work-cover-wrap { position: relative; }
.discover-cover { position: relative; width: 100%; aspect-ratio: 3/4; display: grid; place-items: center; overflow: hidden; border-radius: 15px; background: linear-gradient(145deg,#d77ea9,#7d5aaa); isolation: isolate; }
.discover-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-emoji { position: relative; z-index: 1; font-size: 53px; filter: drop-shadow(0 10px 12px rgb(25 12 35 / 35%)); transform: translateY(-3px); }
.cover-shine { position: absolute; z-index: 0; width: 125px; height: 125px; border-radius: 50%; background: rgb(255 255 255 / 19%); right: -36px; top: -28px; box-shadow: -120px 170px 0 15px rgb(255 255 255 / 8%); }
.tone-sunset { background: linear-gradient(155deg,#223754 0%,#d66f83 58%,#f2ad7f 100%); }
.tone-cafe { background: linear-gradient(155deg,#23454a,#799389 55%,#d9b187); }
.tone-moon { background: linear-gradient(150deg,#182346,#5a4a89 56%,#d593bd); }
.tone-school { background: linear-gradient(155deg,#87a7c2,#e7b7c8 60%,#f2d1b5); }
.tone-detective { background: linear-gradient(155deg,#1f2d35,#58616a 55%,#a47358); }
.tone-demon { background: linear-gradient(155deg,#4b1d43,#9b4254 52%,#e29b66); }
.tone-original { background: linear-gradient(145deg,var(--accent),var(--accent2)); }
.rank-badge { position: absolute; z-index: 3; top: 7px; left: 7px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; color: white; background: rgb(17 12 22 / 70%); backdrop-filter: blur(8px); font-size: 11px; font-weight: 800; }
.chat-count { position: absolute; z-index: 3; right: 6px; bottom: 6px; padding: 4px 6px; border-radius: 99px; color: white; background: rgb(17 12 22 / 62%); backdrop-filter: blur(7px); font-size: 8px; }
.work-title { overflow: hidden; margin-top: 8px; font-size: 13px; font-weight: 750; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.work-intro { display: -webkit-box; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.work-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.work-tags span { color: var(--accent); font-size: 9px; }
.work-stats { margin-top: 6px; color: var(--muted); font-size: 9px; }
.discover-preview { overflow-y: auto; }
.discover-preview-cover { width: min(72%,320px); margin: 18px auto 0; box-shadow: 0 16px 40px rgb(45 28 50 / 22%); }
.discover-preview-body { padding: 20px 20px 38px; }
.discover-preview-body h1 { margin: 7px 0 6px; font-size: 23px; }
.discover-preview-body .featured-label { color: var(--accent); }
.preview-lead { color: var(--muted); line-height: 1.6; }
.discover-preview-body > p:not(.preview-lead) { margin: 18px 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.7; }
.connection-result { min-height: 18px; margin: 8px 2px 12px; font-size: 11px; }
.connection-result.checking { color: var(--muted); }
.connection-result.success { color: #20a46b; }
.connection-result.error { color: var(--danger); line-height: 1.5; }
.chat-menu { width: min(330px,calc(100vw - 24px)); max-height: calc(100dvh - 90px); overflow-y: auto; }
.chat-model-picker { padding: 7px; }
.chat-menu-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.chat-model-current { display: block; margin: 0; color: var(--text); font-size: 12px; font-weight: 700; }
.chat-selector-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 5px; padding: 10px 11px !important; border: 1px solid var(--line) !important; background: var(--input) !important; }
.chat-selector-trigger .chevron-small { color: var(--muted); font-size: 20px; line-height: 1; }
.chat-menu .chat-model-option { display: flex; align-items: center; width: 100%; gap: 9px; padding: 9px 8px; }
.chat-model-option.active { background: color-mix(in srgb,var(--accent) 10%,var(--card)); }
.model-radio { color: var(--accent); font-size: 14px; }
.model-name,.model-sub { display: block; }
.model-name { color: var(--text); font-size: 12px; font-weight: 650; }
.model-sub { margin-top: 2px; color: var(--muted); font-size: 9px; }
.chat-menu-divider { height: 1px; margin: 3px 7px; background: var(--line); }
.summary-editor { display: grid; gap: 14px; padding: 18px 16px 42px; }
.summary-card { width: 100%; padding: 16px; border: 1px solid color-mix(in srgb,var(--line) 84%,transparent); border-radius: 20px; background: var(--card); box-shadow: 0 7px 24px rgb(41 22 47 / 5%); }
.summary-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 13px; }
.summary-hero .title { font-size: 16px; }
.summary-hero .muted { display: block; margin-top: 3px; font-size: 10px; }
.summary-text { display: block; width: 100%; min-width: 0; min-height: 330px; max-height: 62dvh; border: 1px solid var(--line); border-radius: 15px; padding: 14px; background: color-mix(in srgb,var(--input) 72%,var(--card)); color: var(--text); line-height: 1.75; font-size: 13px; resize: vertical; outline: none; }
.summary-text:focus { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb,var(--accent) 12%,transparent); }
.summary-status { min-height: 18px; margin: 8px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.summary-body-card .ai-generate { min-height: 48px; margin-top: 10px; border: 1px solid color-mix(in srgb,var(--accent) 25%,var(--line)); background: color-mix(in srgb,var(--accent) 8%,var(--card)); color: var(--accent); font-weight: 750; }
.summary-body-card .ai-generate:disabled { opacity: .65; }
.summary-settings { display: grid; gap: 14px; margin: 0; }
.summary-section-head { padding: 1px 1px 2px; }
.summary-section-head .title { font-size: 15px; }
.summary-section-head .muted { display: block; margin-top: 4px; font-size: 10px; line-height: 1.5; }
.summary-settings .toggle-setting { margin: 0 !important; padding: 13px 14px; }
.summary-auto-toggle .title,.summary-auto-toggle .muted { display: block; }
.summary-auto-toggle .muted { margin-top: 3px; font-size: 10px; }
.summary-control { display: grid; gap: 7px; }
.summary-control > label { color: var(--muted); font-size: 11px; font-weight: 650; }
.summary-control select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 13px; padding: 0 38px 0 13px; background: var(--input); color: var(--text); font-size: 13px; outline: none; }
.summary-control select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb,var(--accent) 11%,transparent); }
.summary-native-select { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.summary-select-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: var(--input); color: var(--text); text-align: left; font-size: 13px; }
.summary-select-trigger:hover,.summary-select-trigger:focus-visible { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb,var(--accent) 10%,transparent); outline: none; }
.summary-select-arrow { color: var(--muted); font-size: 17px; }
.summary-choice-popup { max-height: min(360px,60dvh); }
.summary-save { min-height: 50px; margin-top: 2px; }
.summary-history { margin-top: 22px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.summary-history summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.summary-history-item { width: 100%; margin-top: 8px; padding: 9px 10px; border: 0; border-radius: 9px; background: var(--input); color: var(--text); text-align: left; font-size: 11px; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder { display: grid; place-items: center; background: color-mix(in srgb,var(--accent) 12%,var(--input)); color: var(--accent); font-weight: 750; text-transform: uppercase; }
.character-photo { overflow: hidden; border-radius: 22px; }
.character-photo img { width: 100%; height: 100%; object-fit: cover; }
.character-toggle-card { padding: 0; overflow: hidden; }
.character-toggle-summary { display: flex; align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; list-style: none; }
.character-toggle-summary::-webkit-details-marker { display: none; }
.character-toggle-avatar { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 15px; overflow: hidden; background: var(--input); display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.character-toggle-avatar img { width: 100%; height: 100%; object-fit: cover; }
.character-toggle-chevron { color: var(--muted); font-size: 18px; transition: transform .2s ease; }
.character-toggle-card[open] .character-toggle-chevron { transform: rotate(180deg); }
.character-toggle-content { display: grid; gap: 12px; padding: 2px 14px 14px; border-top: 1px solid var(--line); }
.character-setting-group { margin-top: 12px; padding: 13px; border-radius: 14px; background: var(--input); }
.character-setting-group h4 { margin: 0 0 8px; font-size: 13px; color: var(--accent); }
.character-setting-row { display: grid; grid-template-columns: minmax(86px, 32%) 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.character-setting-row:first-of-type { border-top: 0; }
.character-setting-label { color: var(--muted); font-size: 12px; }
.character-setting-value { min-width: 0; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.character-toggle-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 0 14px 14px; }
.character-toggle-actions .btn { margin: 0; }
.image-actions { display: flex; justify-content: center; gap: 8px; margin: -10px 0 6px; }
.image-actions .btn { margin: 0; }
.image-help { margin: 0 auto 20px; max-width: 300px; text-align: center; line-height: 1.5; }
.image-remove { color: var(--danger); }
.book-select-card { display: flex; width: 100%; min-width: 0; box-sizing: border-box; align-items: center; text-align: left; }
.book-select-icon { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: color-mix(in srgb,var(--accent) 11%,var(--input)); color: var(--accent); font-size: 13px; font-weight: 800; }
.book-select-copy { min-width: 0; }
.book-select-copy .title,.book-select-copy .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-card { display: block; cursor: pointer; }
.book-list-icon { color: var(--accent); font-size: 14px; font-weight: 800; }
.item-actions-popup { position: fixed; z-index: 100; display: grid; width: 180px; overflow: hidden; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb,var(--card) 94%,transparent); box-shadow: 0 12px 32px rgb(25 13 29 / 20%); backdrop-filter: blur(18px); }
.item-actions-popup button { width: 100%; border: 0; border-radius: 9px; padding: 11px 12px; background: transparent; color: var(--text); text-align: left; font-size: 13px; }
.item-actions-popup button:hover,.item-actions-popup button:focus-visible { background: var(--input); outline: none; }
.item-actions-popup button.danger { color: var(--danger); }
.book-contents { padding-bottom: 40px; }
.book-overview { margin: 0 2px 18px; color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.book-content-item .title { margin-bottom: 7px; }
.book-keywords { margin: 0 0 9px; color: var(--accent); font-size: 10px; }
.book-content-item p { margin: 0; color: var(--text); font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
.collapsible-entry { padding: 0; overflow: hidden; }
.collapsible-entry > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; cursor: pointer; list-style: none; }
.collapsible-entry > summary::-webkit-details-marker { display: none; }
.book-entry-summary-title { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.book-entry-toggle { color: var(--muted); transition: transform .18s ease; }
.collapsible-entry[open] .book-entry-toggle { transform: rotate(180deg); }
.book-entry-fields { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.book-entry-actions { margin-top: 14px; }
.book-entry-actions .btn { padding: 10px 13px; }
.editor-add-fab { position: fixed; z-index: 55; right: max(20px,calc((100vw - 520px)/2)); bottom: calc(24px + env(safe-area-inset-bottom)); display: grid; width: 54px; height: 54px; place-items: center; border: 0; border-radius: 50%; background: linear-gradient(135deg,var(--accent),var(--accent2)); color: white; box-shadow: 0 10px 28px rgb(115 58 109 / 30%); font-size: 28px; font-weight: 400; }
.intro-list-card { display: flex; align-items: center; gap: 12px; min-height: 78px; padding: 13px 14px; cursor: pointer; }
.intro-list-avatar { flex: 0 0 46px; width: 46px; height: 46px; overflow: hidden; border-radius: 50%; font-size: 14px; }
.intro-list-avatar img,.intro-speaker-avatar img { width: 100%; height: 100%; object-fit: cover; }
.intro-card-copy { min-width: 0; }
.intro-card-meta { gap: 7px; margin-bottom: 4px; }
.intro-order { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 7px; background: var(--input); color: var(--muted); font-size: 9px; font-weight: 700; }
.intro-excerpt { display: -webkit-box; overflow: hidden; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.intro-excerpt .story-description,.intro-excerpt .story-narration { display: inline; margin: 0; padding: 0; border: 0; background: none; color: inherit; font-size: inherit; font-style: normal; }
.intro-card-controls { display: grid; grid-template-columns: repeat(2,28px); gap: 3px; }
.intro-card-controls button { display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; }
.intro-card-controls button:hover { background: var(--input); }
.intro-card-controls .delete { color: var(--danger); }
.intro-speaker-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.intro-editor .field-help { margin: -4px 0 2px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.intro-speaker-option { display: grid; min-width: 0; justify-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 14px; padding: 11px 7px; background: var(--card); color: var(--muted); font-size: 11px; }
.intro-speaker-option.active { border-color: var(--accent); background: color-mix(in srgb,var(--accent) 10%,var(--card)); color: var(--text); box-shadow: 0 0 0 2px color-mix(in srgb,var(--accent) 10%,transparent); }
.intro-speaker-avatar { display: grid; width: 38px; height: 38px; place-items: center; overflow: hidden; border-radius: 50%; font-size: 12px; }
.intro-format-guide { display: grid; gap: 6px; margin: 2px 0 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--input); }
.intro-format-guide > div { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.intro-format-guide code { color: var(--text); font-family: inherit; font-weight: 700; }
.intro-insert-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.intro-insert-tools .btn { width: auto; padding: 9px 11px; font-size: 11px; }
.intro-chat-workspace { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: var(--shadow-card); }
.intro-chat-timeline { display: flex; min-height: 320px; max-height: 52vh; flex-direction: column; gap: 11px; overflow-y: auto; padding: 20px 14px; background: color-mix(in srgb,var(--bg) 82%,var(--card)); }
.intro-chat-empty { margin: auto; padding: 38px 20px; text-align: center; }
.intro-chat-empty .title { margin-bottom: 6px; }
.intro-chat-row { display: flex; align-items: flex-end; gap: 8px; width: 100%; }
.intro-chat-row.user { justify-content: flex-end; }
.intro-chat-row.narrator { justify-content: flex-start; }
.intro-chat-avatar { flex: 0 0 32px; width: 32px; height: 32px; overflow: hidden; border-radius: 50%; font-size: 11px; }
.intro-chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.intro-chat-stack { display: grid; max-width: 78%; justify-items: start; }
.intro-chat-row.user .intro-chat-stack { justify-items: end; }
.intro-narrator-stack { display: grid; width: auto; max-width: none; flex: 1; justify-items: start; }
.intro-chat-bubble { max-width: 100%; border: 1px solid var(--line); border-radius: 17px 17px 17px 5px; padding: 6px 11px; background: var(--card); color: var(--text); font: inherit; text-align: left; box-shadow: 0 1px 2px rgb(20 12 24 / 4%); }
.intro-chat-row.user .intro-chat-bubble { border-color: transparent; border-radius: 17px 17px 5px 17px; background: linear-gradient(135deg,var(--accent),var(--accent2)); color: white; }
.intro-chat-row.narrator .intro-chat-bubble { width: 100%; border: 0; padding: 7px 0; background: transparent; color: var(--muted); font-size: 15px; line-height: 1.6; text-align: left; box-shadow: none; }
.intro-chat-row.narrator .story-narration { margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font-size: inherit; text-align: left; }
.intro-chat-row.same-turn { margin-top: 3px; }
.intro-chat-avatar-spacer { width: 36px; flex: 0 0 36px; }
.narration-icon { display: grid; width: 26px; height: 26px; flex: 0 0 26px; place-items: center; align-self: flex-start; margin-top: 4px; border: 1px solid var(--line); border-radius: 50%; background: color-mix(in srgb,var(--accent) 8%,var(--card)); color: var(--accent); font-size: 11px; line-height: 1; }
.intro-chat-name { display: block; margin-bottom: 4px; color: var(--accent); font-size: 10px; font-weight: 700; }
.intro-chat-actions { display: flex; gap: 9px; padding: 4px 4px 0; }
.intro-chat-actions button { border: 0; padding: 2px; background: transparent; color: var(--muted); font-size: 10px; }
.intro-chat-actions .delete { color: var(--danger); }
.intro-chat-composer { padding: 13px; border-top: 1px solid var(--line); background: var(--card); }
.intro-composer-head,.intro-composer-bottom,.intro-send-group { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.intro-chat-speakers { display: flex; gap: 6px; overflow-x: auto; margin: 9px -2px 10px; padding: 2px; scrollbar-width: none; }
.intro-chat-speakers::-webkit-scrollbar { display: none; }
.intro-chat-speaker { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: var(--input); color: var(--muted); font-size: 11px; }
.intro-chat-speaker.active { border-color: var(--accent); background: color-mix(in srgb,var(--accent) 12%,var(--card)); color: var(--accent); font-weight: 700; }
.intro-format-mini { margin-bottom: 8px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.intro-chat-composer textarea { width: 100%; min-height: 92px; max-height: 180px; border: 1px solid var(--line); border-radius: 15px; padding: 11px 12px; background: var(--input); color: var(--text); font: inherit; line-height: 1.6; resize: vertical; outline: none; }
.intro-chat-composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb,var(--accent) 10%,transparent); }
.intro-composer-bottom { margin-top: 8px; }
.intro-composer-bottom .intro-insert-tools { margin: 0; }
.intro-send-group { flex: 0 0 auto; }
.intro-send { display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 50%; background: linear-gradient(135deg,var(--accent),var(--accent2)); color: white; font-size: 18px; box-shadow: 0 5px 14px color-mix(in srgb,var(--accent) 28%,transparent); }

@media (min-width: 700px) {
  .featured-card { flex-basis: 72%; }
  .work-card { flex-basis: 160px; }
}

/* Cohesive spacing and modern surface polish */
:root {
  --page-gutter: 18px;
  --radius-card: 18px;
  --control-radius: 14px;
  --shadow-card: 0 1px 2px rgb(30 15 28 / 3%), 0 10px 30px rgb(30 15 28 / 6%);
}
body { -webkit-font-smoothing: antialiased; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }
button, input, textarea, select { transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .12s ease; }
button:active { transform: scale(.985); }
.content { padding-top: 22px; padding-bottom: 30px; }
.modal > .content { padding-bottom: calc(38px + env(safe-area-inset-bottom)); }
.card { margin-bottom: 14px; border-radius: var(--radius-card); }
.section-head { margin: 2px 0 14px; padding: 0 2px; }
.section-head h3 { margin-bottom: 5px; font-size: 20px; line-height: 1.3; }
.section-head .muted { max-width: 42em; }
.field-head { min-height: 25px; margin-top: 20px; gap: 12px; }
.field-head:first-child { margin-top: 2px; }
.field-head > label { margin: 0 !important; }
.form label { margin-top: 20px; margin-bottom: 8px; font-weight: 650; }
.form input, .form textarea, .form select {
  min-height: 48px;
  border-radius: var(--control-radius);
  border-color: color-mix(in srgb,var(--line) 82%,transparent);
  background: color-mix(in srgb,var(--card) 84%,var(--input));
  padding: 13px 14px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 3%);
}
.form textarea { min-height: 120px; }
.form input::placeholder, .form textarea::placeholder { color: color-mix(in srgb,var(--muted) 78%,transparent); }
.form input:focus, .form textarea:focus, .form select:focus {
  border-color: color-mix(in srgb,var(--accent) 72%,var(--line));
  background: var(--card);
  box-shadow: 0 0 0 3px color-mix(in srgb,var(--accent) 14%,transparent);
  outline: none;
}
.form > input + input,
.form > input + select,
.form > select + input,
.form > select + select,
.form > textarea + input,
.form > input + textarea { margin-top: 10px; }
.btn { min-height: 44px; border-radius: var(--control-radius); }
.btn.primary { box-shadow: 0 7px 18px rgb(185 83 155 / 20%); }
.btn.ghost:hover { background: color-mix(in srgb,var(--accent) 9%,transparent); }
.dashed { min-height: 52px; border-radius: var(--control-radius); padding: 15px 16px; }
.segmented { margin-bottom: 22px; }
.list-item-card { padding: 16px; }
.list-item-card:hover { border-color: color-mix(in srgb,var(--accent) 30%,var(--line)); }
.persona-card { min-height: 76px; padding: 13px 14px; }
.option-group { margin-top: 22px; margin-bottom: 28px; border-radius: var(--radius-card); }
.option-group > .title { padding: 15px 16px 10px; }
.option-row { min-height: 58px; padding: 12px 16px; }
.toggle-setting { margin: 22px 0 !important; border-radius: var(--radius-card); padding: 16px; }
.settings-label { margin-top: 28px; }
.status-notice { margin: 18px 0; padding: 15px 16px; border-radius: var(--control-radius); }
.status-definition-section { margin-bottom: 26px; }
.status-definition-section > .row { margin-bottom: 10px; }
.status-definition-card { min-height: 64px; padding: 13px 16px; }
.runtime-category { border-radius: var(--radius-card); padding: 15px; }
.collapsible-entry { margin-bottom: 12px; border-radius: var(--radius-card); }
.collapsible-entry > summary { min-height: 56px; padding: 16px 17px; }
.book-entry-fields { padding: 2px 17px 17px; }
.book-entry-actions { padding-top: 2px; }
.settings-group { margin-bottom: 28px; }
.group-title { margin-bottom: 2px; }
.menu-row { min-height: 66px; padding: 14px 16px; }
.profile-photo, .character-photo { margin-top: 14px; margin-bottom: 24px; }
.image-actions { margin-bottom: 9px; }
.image-help { margin-bottom: 24px; }
.message-edit-popup, .item-actions-popup { border-color: color-mix(in srgb,var(--line) 80%,transparent); }

.persona-list { display: grid; gap: 11px; }
.persona-user-card { margin: 0; padding: 14px; display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.persona-user-card.active { border-color: color-mix(in srgb,var(--accent) 70%,var(--line)); }
.persona-user-icon { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 50%; background: var(--input); color: var(--accent); font-weight: 800; }
.persona-user-title { gap: 7px; }
.persona-card-actions { flex: 0 0 100%; display: flex; justify-content: flex-end; gap: 15px; padding-top: 10px; border-top: 1px solid var(--line); }
.persona-card-actions button { border: 0; background: transparent; color: var(--accent); font-size: 12px; }
.persona-card-actions .delete { color: var(--danger); }
.persona-add { margin-top: 2px; }
.persona-title-help { margin: 7px 2px 0; font-size: 10px; line-height: 1.5; }
.plot-budget { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 18px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb,var(--input) 72%,var(--card)); color: var(--muted); font-size: 10px; }
.plot-budget strong { flex: 0 0 auto; color: var(--text); font-size: 11px; }
.plot-budget.over { border-color: var(--danger); background: color-mix(in srgb,var(--danger) 7%,var(--card)); color: var(--danger); }
.plot-budget.over strong { color: var(--danger); }
.chat-choice-popup { position: fixed; z-index: 110; max-height: 360px; overflow-y: auto; padding: 7px; border: 1px solid var(--line); border-radius: 15px; background: color-mix(in srgb,var(--card) 96%,transparent); box-shadow: 0 16px 42px rgb(25 13 29 / 25%); backdrop-filter: blur(20px); }
.chat-choice-title { padding: 7px 9px 8px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.chat-choice-option { display: flex; align-items: center; width: 100%; gap: 10px; border: 0; border-radius: 10px; padding: 10px; background: transparent; color: var(--text); text-align: left; }
.chat-choice-option:hover,.chat-choice-option:focus-visible,.chat-choice-option.active { background: color-mix(in srgb,var(--accent) 10%,var(--card)); outline: none; }

@media (max-width: 480px) {
  .content { padding-top: 20px; }
  .number-options { grid-template-columns: 1fr 1fr; }
  .number-options > :last-child { grid-column: 1 / -1; }
  .persona-card { flex-wrap: wrap; }
  .persona-card .grow { min-width: calc(100% - 64px); }
}

/* 2026 refresh: calmer canvas, clearer hierarchy, stronger conversation entry points */
:root {
  --bg: #fbf8fb;
  --card: #ffffff;
  --input: #f4eff5;
  --line: #e8e0e8;
  --text: #281d2a;
  --muted: #887b8b;
  --accent: #c95f96;
  --accent2: #835cc4;
  --page-gutter: 18px;
  --nav-height: 56px;
  --shadow-card: 0 1px 2px rgb(40 20 35 / 3%), 0 12px 28px rgb(40 20 35 / 5%);
}
html[data-theme="dark"] {
  --bg: #171218;
  --card: #231c25;
  --input: #302632;
  --line: #403443;
  --text: #f8f1f7;
  --muted: #b4a3b5;
}
body { background: radial-gradient(circle at 50% -15%, #f8e8f0 0, var(--bg) 38%); }
html[data-theme="dark"] body { background: radial-gradient(circle at 50% -20%, #33203a 0, var(--bg) 40%); }
.shell { background: transparent; padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.topbar {
  min-height: 58px;
  border-bottom: 0;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}
.topbar h1, .shell .topbar h1, .shell .topbar h2 { font-size: 16px; font-weight: 750; letter-spacing: -.35px; }
.header-side { display: flex; align-items: center; width: 64px; min-height: 28px; }
.header-end { justify-content: flex-end; }
.header-spacer { display: block; width: 1px; }
.wordmark { color: var(--accent); font-size: 15px; font-weight: 850; letter-spacing: -1px; }
.header-presence { color: #46a879; font-size: 10px; filter: drop-shadow(0 0 5px rgb(70 168 121 / 35%)); }
.content { padding: 14px var(--page-gutter) 34px; }

.tabs {
  left: 50%; bottom: max(12px, env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 536px);
  height: 68px;
  padding: 6px;
  transform: translateX(-50%);
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  box-shadow: 0 12px 34px rgb(39 20 35 / 14%);
  backdrop-filter: blur(20px) saturate(135%);
}
.tab { position: relative; min-width: 0; padding: 4px 2px; border-radius: 16px; color: var(--muted); font-size: 10px; font-weight: 600; }
.tab .ico { display: grid; place-items: center; height: 24px; font-size: 19px; line-height: 1; }
.tab .tab-label { line-height: 14px; }
.tab.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tab.active::after { display: none; }
.tab-create .ico { width: 28px; height: 28px; margin: -13px auto 1px; border: 3px solid var(--bg); border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 5px 14px rgb(186 78 144 / 33%); }
.tab-create.active { background: transparent; }
.tab-create.active .tab-label { color: var(--accent); }

.home-search { min-height: 46px; margin: 2px 0 17px; border: 1px solid transparent; border-radius: 15px; background: color-mix(in srgb, var(--card) 80%, var(--input)); box-shadow: var(--shadow-card); }
.featured-card { min-height: 236px; border-radius: 23px; }
.featured-copy { padding: 28px 22px; }
.featured-copy h2 { font-size: 23px; }
.featured-label { letter-spacing: .15em; }
.home-section { margin-top: 28px; }
.home-section-head h2 { font-size: 18px; letter-spacing: -.35px; }
.work-card { flex-basis: 148px; }
.discover-cover { border-radius: 17px; box-shadow: 0 7px 18px rgb(41 22 47 / 11%); }
.work-title { margin-top: 9px; font-size: 13px; }
.work-intro { font-size: 10px; }

.card { background: color-mix(in srgb, var(--card) 94%, transparent); }
.talk-list { width: 100%; padding-top: 2px; }
.list-context { display: flex; align-items: baseline; justify-content: space-between; margin: 3px 3px 10px; font-size: 13px; font-weight: 750; }
.thread-card { width: 100%; min-height: 78px; margin-bottom: 10px; padding: 13px 14px; border-color: transparent; box-shadow: 0 5px 18px rgb(40 20 35 / 4%); text-align: left; }
.thread-card .grow { text-align: left; }
.thread-card .avatar { width: 50px; height: 50px; border-radius: 17px; }
.thread-chevron { color: var(--muted); font-size: 24px; line-height: 1; }
.talk-empty { padding-top: 104px; }
.talk-empty .big { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 25px; background: color-mix(in srgb, var(--accent) 10%, var(--card)); font-size: 31px; }
.empty-cta { display: block; min-width: 152px; margin: 21px auto 0; }

.settings-group { margin-bottom: 25px; }
.group-title { padding-left: 4px; color: color-mix(in srgb, var(--muted) 90%, transparent); font-size: 10px; letter-spacing: .08em; }
.menu-row { min-height: 68px; padding: 14px 15px; background: color-mix(in srgb, var(--card) 91%, transparent); }
.menu-icon { background: color-mix(in srgb, var(--accent) 8%, var(--input)); }
.menu-row .title { font-size: 14px; }
.menu-row .muted { margin-top: 2px; font-size: 11px; }

.chat.modal { background: var(--bg); }
.chat .topbar { border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.messages { padding-top: 20px; }
.bubble { padding: 8px 12px; line-height: 1.6; }

.threshold-debug { display: grid; gap: 12px; }
.threshold-debug .card { margin: 0; padding: 14px; }
.threshold-debug-field h3,
.threshold-debug-prompt h3 { margin: 0 0 8px; font-size: 15px; }
.threshold-debug-rule,
.threshold-debug-prompt pre { margin: 10px 0 0; padding: 11px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--input); color: var(--text); font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (min-width: 700px) {
  .shell { border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); }
  .tabs { bottom: 0; }
}

/* Simple, consistent tab bar: every destination follows the same visual rule. */
.tabs {
  position: fixed;
  bottom: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  padding: 5px 5px env(safe-area-inset-bottom);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 8px 24px rgb(39 20 35 / 10%);
}
.tab,
.tab-create {
  display: grid;
  grid-template-rows: 24px 15px;
  place-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 5px 2px;
  border-radius: 13px;
  font-size: 11px;
  font-weight: 600;
}
.tab .ico,
.tab-create .ico {
  width: auto;
  height: 24px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: currentColor;
  font-size: 19px;
  line-height: 24px;
}
.tab .ico svg,
.tab-create .ico svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab.active .ico svg,
.tab-create.active .ico svg { stroke-width: 2.15; }
.tab.active,
.tab-create.active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}
.tab-create.active .tab-label { color: inherit; }

/* Compact story messages and mobile-safe input sizing. */
html { -webkit-text-size-adjust: 100%; touch-action: pan-x pan-y; }
input, textarea, select { font-size: 16px; }
.composer textarea { font-size: 16px; }
.chat-message-row.same-turn { margin-top: 2px; }
.chat-message-row.narrator.same-turn { margin-top: 4px; margin-bottom: 4px; }
.message-stack { row-gap: 0; }
.speaker { margin: 0 0 3px 3px; line-height: 1.25; }
.message-text { display: flex; flex-direction: column; gap: 4px; }
.story-dialogue, .story-description { margin: 0; white-space: pre-wrap; }
.story-description { line-height: 1.55; }
.intro-chat-bubble .message-text { gap: 4px; }
.thread-card { position: relative; display: flex; padding: 0; overflow: hidden; }
.thread-open { display: flex; align-items: center; width: 100%; min-width: 0; gap: 11px; border: 0; padding: 13px 46px 13px 14px; background: transparent; color: var(--text); text-align: left; }
.thread-delete { position: absolute; z-index: 1; top: 50%; right: 8px; width: 34px; height: 38px; transform: translateY(-50%); border: 0; border-radius: 11px; background: transparent; color: var(--muted); letter-spacing: 1px; }
.thread-delete:active { background: var(--input); }

/* White neutral palette */
:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --input: #f2f2f4;
  --line: #dedee2;
  --text: #1c1c1e;
  --muted: #74747a;
  --accent: #303034;
  --accent2: #626268;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 3%), 0 10px 26px rgb(0 0 0 / 5%);
}
html[data-theme="dark"] {
  --bg: #151516;
  --card: #202022;
  --input: #2a2a2d;
  --line: #3b3b3f;
  --text: #f7f7f8;
  --muted: #aaaab0;
  --accent: #f4f4f5;
  --accent2: #c9c9ce;
}
body,
html[data-theme="dark"] body { background: var(--bg); }
.hero,
.bubble.user,
.intro-chat-row.user .intro-chat-bubble,
.btn.primary,
.fab,
.send,
.editor-add-fab,
.intro-send,
.tab-create .ico {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 5px 16px rgb(0 0 0 / 8%);
}
.hero .meta,
.hero .badge { color: var(--muted); }
.filter-chip.active,
.sender-chip.active,
.mood-chip.active {
  border-color: var(--text);
  background: var(--card);
  color: var(--text);
}
.bubble.user .story-description,
.bubble.user .story-narration { color: var(--muted); }
.bubble.user .story-narration { border-left-color: var(--line); background: var(--input); }
.narration-icon {
  width: 18px;
  height: 24px;
  flex-basis: 18px;
  margin-top: 1px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}
.tab-create .ico,
.tab-create.active .ico {
  width: auto;
  height: 24px;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: currentColor;
  box-shadow: none;
}
.theme-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow-card); }
.theme-card-head { padding: 15px 16px 11px; }
.theme-card-head .muted { margin-top: 3px; }
.theme-choice-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 0 12px 13px; }
.theme-choice { position: relative; display: grid; justify-items: center; gap: 7px; min-width: 0; min-height: 112px; padding: 12px 7px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text); text-align: center; }
.theme-choice.active { border-color: var(--text); background: var(--card); box-shadow: inset 0 0 0 1px var(--text); }
.theme-preview { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 17px; }
.theme-preview.system { background: linear-gradient(90deg,#fff 50%,#242426 50%); color: #777; }
.theme-preview.light { background: #fff; color: #333; }
.theme-preview.dark { background: #242426; color: #fff; }
.theme-choice-copy { display: grid; gap: 1px; min-width: 0; }
.theme-choice-copy .title { font-size: 12px; }
.theme-choice-copy .muted { font-size: 9px; white-space: nowrap; }
.theme-check { position: absolute; top: 7px; right: 8px; min-width: 13px; color: var(--text); font-size: 10px; font-weight: 800; }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #151516;
    --card: #202022;
    --input: #2a2a2d;
    --line: #3b3b3f;
    --text: #f7f7f8;
    --muted: #aaaab0;
    --accent: #f4f4f5;
    --accent2: #c9c9ce;
  }
}

/* Compact bottom areas and follow iOS's visible viewport while the keyboard is open. */
:root { --bottom-inset: min(env(safe-area-inset-bottom), 10px); }
.shell { padding-bottom: calc(70px + var(--bottom-inset)); }
.tabs {
  height: calc(60px + var(--bottom-inset));
  padding: 3px 5px var(--bottom-inset);
}
.tab,.tab-create { min-height: 50px; padding-block: 3px; }
.composer-wrap { padding-bottom: var(--bottom-inset); }
.chat.modal {
  inset: auto 0 auto 0;
  top: var(--visual-viewport-top,0px);
  height: var(--visual-viewport-height,100dvh);
  min-height: 0;
}
body.chat-open { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body.chat-open #app .tabs { visibility: hidden; pointer-events: none; }
@media (max-height: 560px) {
  .composer-wrap { padding-bottom: 0; }
}

/* Lightweight motion: avoid layout jitter and expensive blur on mobile. */
button,input,textarea,select {
  transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}
button:active { transform: none; filter: brightness(.97); }
.typing-indicator i { animation: typing-fade 1.05s ease-in-out infinite; }
.typing-indicator i:nth-child(2) { animation-delay: .14s; }
.typing-indicator i:nth-child(3) { animation-delay: .28s; }
@keyframes typing-fade { 0%,65%,100% { opacity: .3; } 32% { opacity: 1; } }
.ai-motion .bubble,
.ai-motion.chat-message-row.narrator .message-text { animation: ai-message-fade .18s ease-out both; }
@keyframes ai-message-fade { from { opacity: .25; } to { opacity: 1; } }
.topbar,.tabs,.composer-wrap {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.topbar { background: var(--bg); }
.tabs { background: var(--card); }
.composer-wrap { background: var(--bg); }
.typing-cast-avatar { position: relative; overflow: visible; background: transparent; }
.typing-cast-face { position: absolute; top: 4px; display: grid; width: 24px; height: 24px; place-items: center; overflow: hidden; border: 2px solid var(--bg); border-radius: 50%; background: var(--input); color: var(--muted); font-size: 9px; font-weight: 750; }
.typing-cast-face:nth-child(1) { left: 0; z-index: 3; }
.typing-cast-face:nth-child(2) { left: 8px; z-index: 2; }
.typing-cast-face:nth-child(3) { left: 16px; z-index: 1; }
.typing-cast-face img { width: 100%; height: 100%; object-fit: cover; }
