/* Shared light palette and component styles; dark-theme.css overrides semantic tokens. */
:root {
  color-scheme: light;
  --bg-app: #fafafa;
  --bg-panel: #fff;
  --glass-card: #fff;
  --glass-solid: #fff;
  --glass-raised: #f3f4f6;
  --border-subtle: #e5e7eb;
  --border-glow: #dfb6c4;
  --brand-start: #b05073;
  --brand-middle: #b45675;
  --brand-end: #b45878;
  --brand-primary: #b05073;
  --brand-gradient: var(--brand-primary);
  --brand-hover: #a74c6c;
  --text-main: #111827;
  --text-narrative: #7c3aed;
  --text-sub: #6b7280;
  --text-placeholder: #6b7280;
  --focus-ring: #b55778;
  --shadow-brand: 0 2px 5px rgba(92, 45, 62, .1);
  --shadow-glow: 0 2px 8px rgba(17, 24, 39, .05);
  --shadow-surface: 0 12px 40px rgba(17, 24, 39, .12);
  --glass-blur: 0px;
  --tavern-bg: var(--bg-app);
  --tavern-surface: #fff;
  --tavern-solid: #fff;
  --tavern-raised: #f3f4f6;
  --tavern-border: var(--border-subtle);
  --tavern-primary: var(--brand-start);
  --tavern-accent: var(--brand-end);
  --tavern-secondary: #6b7280;
  --tavern-gradient: var(--brand-primary);
  --paper: var(--bg-app);
  --sidebar: #fff;
  --white: #fff;
  --surface: #fff;
  --panel: #fff;
  --ink: var(--text-main);
  --muted: var(--text-sub);
  --line: var(--border-subtle);
  --border: var(--border-subtle);
  --accent: #9d4666;
  --accent-dark: #8f3c5a;
  --wash: #faf2f5;
  --green: #26734c;
  --red: #b42335;
  --shadow: var(--shadow-surface);
  background: var(--bg-app);
  color: var(--text-main);
  --theme-color-scheme: light;
  --theme-surface: var(--bg-panel);
  --theme-muted-surface: #f9fafb;
  --theme-raised: var(--glass-raised);
  --theme-control-border: #d1d5db;
  --theme-border-strong: #b7bdc7;
  --theme-text-secondary: #374151;
  --theme-text-soft: #586170;
  --theme-accent: #9d4666;
  --theme-accent-strong: #91435f;
  --theme-accent-bg: #faf0f4;
  --theme-accent-soft: #faf2f5;
  --theme-accent-border: #ead2db;
  --theme-accent-border-strong: #dfb6c4;
  --theme-narrative-bg: #faf8ff;
  --theme-narrative-border: #ddd6fe;
  --theme-cover-bg: #f3edf0;
  --theme-on-brand: #fff;
  --theme-selection-text: #54273a;
  --theme-selection-bg: #f2dce5;
  --theme-success-text: #26734c;
  --theme-success-bg: #edf7f1;
  --theme-success-border: #cfe8d9;
  --theme-warning-text: #875f22;
  --theme-warning-bg: #fffaeb;
  --theme-warning-border: #efe0b9;
  --theme-danger-text: #b42335;
  --theme-danger-strong: #9f1e2e;
  --theme-danger-bg: #fff1f2;
  --theme-danger-border: #efc9d0;
  --theme-info-text: #525d78;
  --theme-info-bg: #f0f2f7;
  --theme-overlay: rgba(17,24,39,.32);
  --theme-focus-shadow: rgba(181,87,120,.12);
  --theme-preview-shade: rgba(255,255,255,.94);
}
html, body { background: var(--bg-app); color: var(--text-main); }
::selection { color: var(--theme-selection-text); background: var(--theme-selection-bg); }
.ambient-backdrop { background: var(--bg-app); }

/* Neutral navigation; no width, transform, or stacking changes. */
.shell .sidebar { color: var(--theme-text-secondary); background: var(--theme-surface); border-right-color: var(--border-subtle); -webkit-backdrop-filter: none; backdrop-filter: none; }
.brand-title, .plaza-wordmark, .plaza-wordmark span { color: var(--text-main); }
.brand-mark { color: var(--theme-accent); background: var(--theme-accent-soft); border-color: var(--theme-accent-border); }
.brand-sub, .sidebar-label, .recent-empty, .user-info small, .topbar-key { color: var(--text-sub); }
.nav a, .recent-link, .sidebar-bottom .icon-button, .desktop-sidebar-toggle { color: var(--theme-text-soft); }
.nav a:hover, .recent-link:hover, .recent-link.selected { color: var(--theme-text-secondary); background: var(--theme-raised); }
.nav a.active { color: var(--theme-accent-strong); background: var(--theme-accent-bg); }
.nav a.active::before { background: var(--brand-start); }
.recent-dot { background: var(--text-placeholder); }
.sidebar-bottom { border-color: var(--border-subtle); }
.sidebar-label>a { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; color: var(--text-sub); }
.sidebar-label>a .icon { width: 15px; height: 15px; }
.sidebar-label>a:hover { color: var(--theme-accent-strong); background: var(--theme-accent-bg); }
.desktop-sidebar-toggle { border-color: var(--border-subtle); }
.desktop-sidebar-toggle:hover, .sidebar-bottom .icon-button:hover { background: var(--theme-raised); color: var(--theme-text-secondary); }
.user-badge, .avatar { color: var(--theme-accent); background: var(--theme-accent-bg); border-color: var(--theme-accent-border); }
.topbar, .plaza-topbar { background: var(--theme-surface); border-color: var(--border-subtle); -webkit-backdrop-filter: none; backdrop-filter: none; }
.breadcrumb, .story-availability { color: var(--text-sub); }
.breadcrumb span:last-child { color: var(--theme-text-secondary); }
.topbar-page-title { min-width: 0; padding-left: 13px; border-left: 1px solid var(--border-subtle); color: var(--text-sub); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-availability::before { background: var(--text-placeholder); }
.story-availability.is-ready { color: var(--theme-success-text); }
.story-availability.is-ready::before { background: var(--theme-success-text); box-shadow: none; }
.mobile-bottom { background: var(--theme-surface); border-color: var(--border-subtle); }
.mobile-bottom a { color: var(--text-sub); }
.mobile-bottom a.active { color: var(--theme-accent); }
.mobile-dimmer.open { background: var(--theme-overlay); }

/* Shared controls also cover admin forms and dialogs outside #app. */
.btn, .immersive-button, .btn.dark { color: var(--theme-text-secondary); background: var(--theme-surface); border-color: var(--border-subtle); background-image: none; box-shadow: none; text-shadow: none; }
.btn:hover, .immersive-button:hover, .btn.dark:hover { color: var(--text-main); background: var(--theme-muted-surface); border-color: var(--theme-border-strong); box-shadow: none; }
.btn.primary, .btn.new-story, .composer-send, .immersive-button.primary,
.btn.recharge-cta, .topbar .subscription-recharge, .topbar .subscription-link, .profile-recharge {
  color: var(--theme-on-brand); background: var(--brand-primary); border-color: var(--brand-start);
  box-shadow: var(--shadow-brand); text-shadow: none;
}
.btn.primary:hover, .btn.new-story:hover, .composer-send:hover, .immersive-button.primary:hover,
.btn.recharge-cta:hover, .topbar .subscription-recharge:hover, .topbar .subscription-link:hover, .profile-recharge:hover {
  color: var(--theme-on-brand); background: var(--brand-hover); border-color: var(--theme-accent-strong); box-shadow: var(--shadow-brand);
}
.workshop-page .btn.primary, .preset-editor .btn.primary, .workshop-rule-form .btn.primary {
  color: var(--theme-on-brand); background: var(--brand-primary); border-color: var(--brand-start); box-shadow: var(--shadow-brand); text-shadow: none;
}
.workshop-page .btn.primary:hover, .preset-editor .btn.primary:hover, .workshop-rule-form .btn.primary:hover {
  color: var(--theme-on-brand); background: var(--brand-hover); border-color: var(--theme-accent-strong); box-shadow: var(--shadow-brand);
}
.workshop-card-copy>p, .workshop-tags span, .workshop-stats, .workshop-sort,
.workshop-library-tabs button, .workshop-detail-description, .workshop-author,
.workshop-loading, .workshop-confirm-copy, .workshop-empty, .preset-step-tabs button { color: var(--text-sub); }
.workshop-library-tabs button.active, .preset-step-tabs button.active { color: var(--theme-accent-strong); border-color: var(--focus-ring); }
.workshop-categories>.btn.active, .workshop-rating .btn.active { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border-strong); }
.workshop-thumbnail>small { background: var(--brand-start); }
.btn.ghost { color: var(--theme-text-soft); background: transparent; border-color: transparent; }
.btn.ghost:hover, .icon-button:hover { color: var(--theme-text-secondary); background: var(--theme-raised); }
.btn.danger { color: var(--theme-danger-text); background: var(--theme-surface); border-color: var(--theme-danger-border); }
.btn.danger:hover { color: var(--theme-danger-strong); background: var(--theme-danger-bg); border-color: var(--theme-danger-border); }
.tag, .type-badge, .status-label { color: var(--theme-text-soft); background: var(--theme-raised); border-color: var(--border-subtle); }
.type-image { color: var(--theme-accent); background: var(--theme-accent-bg); }
.type-video, .type-intelligence { color: var(--theme-info-text); background: var(--theme-info-bg); }
.type-audio, .type-embedding { color: var(--theme-success-text); background: var(--theme-success-bg); }
.pill, .status-label.complete, .note.success { color: var(--theme-success-text); background: var(--theme-success-bg); border-color: var(--theme-success-border); }
.pill.pending, .status-label.running, .status-label.queued { color: var(--theme-warning-text); background: var(--theme-warning-bg); border-color: var(--theme-warning-border); }
.pill.error, .note.error, .status-label.failed, .status-label.interrupted { color: var(--theme-danger-text); background: var(--theme-danger-bg); border-color: var(--theme-danger-border); }
.note { color: var(--theme-text-soft); background: var(--theme-raised); border-color: var(--border-subtle); }
.spinner { border-color: var(--theme-accent-border); border-top-color: var(--brand-start); }
.tabs, .setting-tabs { background: var(--theme-raised); border-color: var(--border-subtle); }
.tabs button, .setting-tabs button, .pool-types button, .model-type-tabs button, .model-picker-groups button { color: var(--theme-text-soft); }
.tabs button:hover, .pool-types button:hover, .model-type-tabs button:hover, .model-picker-groups button:hover { color: var(--text-main); background: var(--theme-raised); }
.tabs button.active, .setting-tabs button.active, .pool-types button.active, .model-type-tabs button.active,
.model-picker-groups button.active, .chooser.selected, .world-choice.selected {
  color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border-strong); box-shadow: none;
}
input:where(:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"])),
textarea, select, .auth-box input:not([type="checkbox"]), .field textarea, .immersive-input,
.generation-lyrics textarea, .wb-inline-editor input, .wb-inline-editor textarea {
  color: var(--text-main); background-color: var(--theme-surface); border-color: var(--theme-control-border); caret-color: var(--text-main);
}
input::placeholder, textarea::placeholder { color: var(--text-sub); }
select option, select optgroup { color: var(--text-main); background: var(--theme-surface); }
input[readonly], textarea[readonly] { color: var(--theme-text-soft); }
input:focus, textarea:focus, select:focus, .auth-box input:not([type="checkbox"]):focus, .immersive-input:focus {
  border-color: var(--focus-ring); box-shadow: 0 0 0 3px var(--theme-focus-shadow);
}
.field label, .checkline, .chooser-label, .modal .chooser-label, .auth-field label, .report-filter-row label { color: var(--theme-text-secondary); }
.field small, .backup-info, .detail-top p, .auth-foot, .auth-box .auth-intro { color: var(--text-sub); }
.searchbar, .search-box, .wb-search, .wb-studio .wb-search, .plaza-search { color: var(--text-sub); background: var(--theme-surface); border-color: var(--border-subtle); }
.searchbar input, .search-box input, .wb-search input, .plaza-search input { background: transparent; }
.plaza-search:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 0 3px var(--theme-focus-shadow); }
.plaza-search-submit { color: var(--text-sub); }
.plaza-search-submit:hover { color: var(--theme-accent-strong); background: var(--theme-accent-bg); }
.plaza-create, .plaza-profile-link { color: var(--theme-accent-strong); background: var(--theme-accent-soft); border-color: var(--theme-accent-border); }

.glass-card, .glass-panel, .panel, .usage-card, .archive-row, .continue-card,
.support-message, .world-card, .profile-worldbook { color: var(--text-main); background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: none; }
.continue-card:hover, .world-card:hover { background: var(--theme-surface); border-color: var(--theme-accent-border-strong); box-shadow: 0 3px 12px rgba(17, 24, 39, .05); }
.continue-card strong, .page-heading h1, .section-heading h2, .world-body h3,
.detail-section h3, .report-detail-section h3 { color: var(--text-main); }
.continue-card p, .continue-card .icon, .world-body p, .world-banner, .detail-section p,
.page-foot, .report-row p, .report-detail-section>p, .report-snapshot p { color: var(--text-sub); }
.eyebrow, .details summary, .file-transcript summary { color: var(--theme-accent); }
.hero { color: var(--text-main); background: var(--theme-surface); border-color: var(--border-subtle); }
.hero h1, .hero h1 em, .hero-facts strong { color: var(--text-main); background: none; }
.hero p, .hero-facts, .hero-mark { color: var(--text-sub); }
.hero-art, .hero-art::before, .hero-art::after { border-color: var(--theme-accent-border); box-shadow: none; }
.hero-art svg { color: var(--theme-accent); }
.stat-compact .stat-icon { color: var(--theme-accent); background: var(--theme-accent-bg); }
.world-cover { color: var(--theme-accent); background: var(--theme-cover-bg); }
.world-cover::before, .world-cover::after { border-color: var(--theme-accent-border); }
.card-heat, .world-card .card-heat { color: var(--theme-text-soft); }
.announcement-card { background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: none; }
.announcement-heading { color: var(--theme-text-secondary); }
.announcement-body { color: var(--theme-text-soft); }
.announcement-card h2 { font-weight: 650; }
.code, .recovery-code, .report-preview, .report-snapshot { color: var(--theme-text-secondary); background: var(--theme-muted-surface); border-color: var(--border-subtle); }
.report-status { color: var(--theme-accent-strong); background: var(--theme-accent-bg); }
.report-status.status-resolved { color: var(--theme-success-text); background: var(--theme-success-bg); }
.report-status.status-dismissed { color: var(--theme-text-soft); background: var(--theme-raised); }
.report-status.status-reviewing { color: var(--theme-info-text); background: var(--theme-info-bg); }
.report-id, .scene-report button, .report-chat-button { color: var(--text-sub); }
.ai-disclaimer { color: var(--theme-text-soft); background: var(--theme-muted-surface); border-color: var(--border-subtle); }

/* Home and shared discovery cards. Desktop always has three columns. */
.home-feed { max-width: 1536px; margin: 0 auto; }
.feed-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.feed-toolbar h1, .feed-toolbar h2 { color: var(--text-main); font-size: 21px; }
.feed-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.feed-tabs button { min-height: 34px; padding: 7px 12px; border: 1px solid transparent; border-radius: 8px; color: var(--theme-text-soft); font-size: 12px; }
.feed-tabs button:hover { color: var(--theme-accent-strong); background: var(--theme-accent-soft); }
.feed-tabs button.active, .feed-tabs button[aria-selected="true"] { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border); }
.feed-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0 0 20px; }
.feed-tags button { min-height: 30px; padding: 5px 10px; border: 1px solid var(--border-subtle); border-radius: 7px; background: var(--theme-surface); color: var(--theme-text-soft); font-size: 11px; }
.feed-tags button:hover, .feed-tags button.active { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border-strong); }
.feed-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: stretch; }
.feed-card { min-width: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--theme-surface); box-shadow: 0 1px 3px rgba(17, 24, 39, .035); }
.feed-card:hover { border-color: var(--theme-accent-border-strong); box-shadow: 0 3px 12px rgba(17, 24, 39, .06); }
.feed-card-main { display: block; flex: 1; width: 100%; min-width: 0; margin: 0; padding: 14px; border: 0; border-radius: 0; text-align: left; color: var(--text-main); background: transparent; box-shadow: none; cursor: pointer; }
.feed-card-main:hover { background: transparent; }
.feed-card-top { display: flex; align-items: stretch; gap: 14px; min-width: 0; }
.feed-card-cover { position: relative; flex: 0 0 84px; width: 84px; height: 112px; aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 8px; color: var(--text-placeholder); background: var(--theme-raised); font-size: 24px; font-weight: 700; }
.feed-card-cover img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.feed-card-fallback { display: grid; place-items: center; width: 100%; height: 100%; }
.feed-card-cover>.icon { width: 30px; height: 30px; }
.feed-card-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.feed-card-copy h3 { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-main); font-family: var(--font-sans, "Segoe UI", "Microsoft YaHei", sans-serif); font-size: 14px; font-weight: 700; line-height: 1.5; }
.feed-card:hover .feed-card-copy h3 { color: var(--theme-accent-strong); }
.feed-card-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; color: var(--text-sub); font-size: 12px; font-style: normal; line-height: 1.65; margin: 5px 0 8px; overflow-wrap: anywhere; }
.feed-card-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.feed-card-tags>span, .feed-card-tags>.tag { padding: 2px 6px; border: 0; border-radius: 4px; color: var(--theme-text-soft); background: var(--theme-raised); font-size: 10px; line-height: 1.5; }
.feed-card-tags>:nth-child(n+3) { display: none; }
.feed-card-type, .feed-preset-badge { position: absolute; top: 4px; left: 4px; padding: 1px 5px; border-radius: 4px; color: var(--theme-on-brand); background: var(--brand-start); font-size: 9px; font-weight: 500; }
.feed-card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 14px; padding: 10px 0; border-top: 1px solid var(--border-subtle); color: var(--text-sub); font-size: 11px; }
.feed-card-bottom .card-heat { margin: 0; color: var(--theme-text-soft); font-size: 11px; }
.feed-card-bottom .card-heat .heat-icon { width: 13px; height: 13px; }
.feed-card-details { flex: none; min-height: 29px; padding: 5px 9px; border: 1px solid var(--border-subtle); border-radius: 6px; background: var(--theme-muted-surface); color: var(--theme-text-soft); font-size: 11px; font-weight: 500; }
.feed-card-details:hover { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border-strong); }
.feed-card-main:focus-visible { outline-offset: -3px; border-radius: 10px; }
@media (min-width: 768px) { .home-feed .feed-grid, .feed-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) { .home-feed .feed-grid, .feed-grid { grid-template-columns: minmax(0, 1fr); } .feed-toolbar { gap: 12px; } .feed-toolbar h1, .feed-toolbar h2 { font-size: 19px; } .feed-tabs { width: 100%; } .feed-tabs button { flex: 1; padding-inline: 7px; } }

/* Plain, high contrast chat. Stored background preferences are not rendered. */
.story-backdrop, .story-backdrop.with-user-background::before { display: none; background: none; }
.chat-page, .chat-page .workspace, .chat-page .immersive-chat { background: var(--theme-surface); }
.chat-page .immersive-chat { border-color: var(--border-subtle); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.chat-page .workspace>.topbar, .chat-page .chat-header, .chat-page .story-panel, .chat-page .composer-wrap { background: var(--theme-surface); border-color: var(--border-subtle); -webkit-backdrop-filter: none; backdrop-filter: none; }
.chat-page .chat-header h2 { color: var(--text-main); }
.chat-page .chat-header p, .chat-page .chat-header .story-heading p { color: var(--text-sub); }
.story-exit, .chat-settings-trigger { color: var(--theme-text-soft); background: var(--theme-surface); border-color: var(--border-subtle); }
.chat-settings-trigger:hover, .story-exit:hover { color: var(--theme-accent-strong); background: var(--theme-accent-soft); border-color: var(--theme-accent-border-strong); }
.story-primary-dot { background: var(--brand-start); box-shadow: none; }
.chat-page .chat-model-picker, .chat-model-picker { color: var(--theme-text-secondary); background: var(--theme-muted-surface); border-color: var(--border-subtle); }
.chat-page .messages, .has-scene-background .messages { background: var(--theme-surface); background-image: none; }
.chat-page .message>.avatar { border-color: var(--border-subtle); }
.chat-page .message-label>span:first-child { color: var(--theme-text-secondary); }
.chat-page .message-label>span:last-child, .message-label { color: var(--text-sub); }
.chat-page .message-text { color: var(--text-main); background: var(--theme-muted-surface); border-color: var(--border-subtle); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.chat-page .message.user .message-text { color: var(--text-main); background: var(--theme-accent-bg); border-color: var(--theme-accent-border); }
.chat-page .message.action-only .message-text { color: var(--text-narrative); background: var(--theme-narrative-bg); border-left-color: var(--theme-narrative-border); }
.chat-page .message-text em, .message-text em, .scene-narrative { color: var(--text-narrative); }
.chat-page .message-actions button { color: var(--text-sub); }
.chat-page .message-actions button:hover { color: var(--theme-accent-strong); background: var(--theme-accent-bg); }
.chat-page .opening-narrative, .opening-narrative { color: var(--text-narrative)!important; background: var(--theme-narrative-bg)!important; border-left: 3px solid var(--theme-narrative-border)!important; }
.scene strong, .chat-page .scene-label { color: var(--text-sub); }
.chat-page .scene-narrative, .text-narrative { color: var(--text-narrative); }
.chat-page .message-text .roleplay-text .roleplay-dialogue { color: var(--text-main); font-weight: 700; font-style: normal; }
.chat-page .message-text .roleplay-text .roleplay-narration { color: var(--text-narrative); font-style: italic; border-inline-start-color: var(--theme-narrative-border); }
.chat-page .message-text .roleplay-dialogue em { color: inherit; font-style: normal; }
.message-text code, .message-text pre { color: var(--theme-text-secondary); background: var(--theme-raised); border-color: var(--border-subtle); }
.typing i { background: var(--brand-start); }
.chat-page .composer { background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: 0 2px 8px rgba(17, 24, 39, .04); }
.chat-page .composer textarea#composer-input { color: var(--text-main); caret-color: var(--text-main); }
.chat-page .composer-footer small, .story-cost-link { color: var(--text-sub); }
.chat-page .connection-banner { color: var(--text-sub); }
.chat-page .connection-banner button { color: var(--theme-accent); }
.story-cost-link:hover { color: var(--theme-accent-strong); }
.chat-page .story-input-tools>.btn, .story-input-tools>.btn { color: var(--theme-text-soft); border-color: var(--border-subtle); background: var(--theme-muted-surface); }
.input-guide, .chat-page .input-guide { color: var(--theme-text-soft); background: var(--theme-muted-surface); border-color: var(--border-subtle); }
.input-guide strong { color: var(--theme-text-secondary); }
.chat-page .chat-disclaimer { background: var(--theme-surface); }
.chat-page .chat-disclaimer .ai-disclaimer { color: var(--text-sub); opacity: 1; }
.chat-page .chat-aside { color: var(--text-main); background: var(--theme-surface)!important; border-color: var(--border-subtle); box-shadow: -8px 0 24px rgba(17, 24, 39, .08); }
.aside-heading, .memory-count, .aside-block p, .aside-fact { color: var(--text-sub); }
.branch-link { color: var(--theme-accent); }
.story-more summary { color: var(--theme-text-soft); }
.story-more>div, .extra-input-tools[open]>div { color: var(--theme-text-secondary); background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: var(--shadow-surface); }
.chat-settings-overlay { background: var(--theme-overlay); -webkit-backdrop-filter: none; backdrop-filter: none; }
.chat-settings-drawer { color: var(--text-main); background: var(--theme-surface); border-left-color: var(--border-subtle); box-shadow: -12px 0 36px rgba(17, 24, 39, .1); }
.chat-settings-drawer .modal-head { background: var(--theme-surface); }
.chat-settings-panel>section+section { border-top-color: var(--border-subtle); }
.chat-settings-panel h3 { color: var(--text-main); }
.story-stage-select, .story-stage-select small, .story-book-count { color: var(--theme-text-soft); }
.story-slot-chip, .story-slot-add { color: var(--theme-text-soft); background: var(--theme-muted-surface); border-color: var(--border-subtle); }
.story-slot-chip small, .story-slot-add small { color: var(--text-sub); }
.chat-page .story-slot-chip.primary-slot, .story-slot-chip.primary-slot { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border-strong); box-shadow: none; }
.story-slot-chip.primary-slot small { color: var(--theme-accent-strong); }
.story-book-option, .story-slot-row, .story-candidate, .picture-choices section { background: var(--theme-surface); border-color: var(--border-subtle); }
.story-book-option:has(input:checked), .story-slot-row.primary-slot { background: var(--theme-accent-soft); border-color: var(--theme-accent-border-strong); }
.story-book-option input { accent-color: var(--brand-start); }
.picture-choices p { color: var(--text-sub); }
.pending-file, .message-file, .generation-controls, .generation-lyrics textarea { color: var(--theme-text-secondary); background: var(--theme-muted-surface); border-color: var(--border-subtle); }
.pending-file button:hover { background: var(--theme-accent-bg); }
.generation-quote { color: var(--theme-text-soft); }
.recording-bar { color: var(--theme-accent-strong); background: var(--theme-accent-bg); }
.recording-dot { background: var(--brand-start); }
.floating-panel { color-scheme: var(--theme-color-scheme); color: var(--theme-text-secondary); background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: var(--shadow-surface); }
.extra-input-menu .btn, .model-options-panel [role="option"] { color: var(--theme-text-secondary); }
.extra-input-menu .btn:hover, .extra-input-menu .btn:focus-visible,
.model-options-panel [role="option"]:hover, .model-options-panel [role="option"].is-active { color: var(--theme-accent-strong); background: var(--theme-accent-bg); }
.model-options-panel [role="option"] small, .model-options-empty { color: var(--text-sub); }
.model-picker-toggle { color: var(--text-sub); }
.model-picker-toggle:hover { color: var(--theme-accent-strong); background: var(--theme-accent-bg); }

/* Dialogs, authentication, account payments, and customer support. */
.modal-overlay { background-color: var(--theme-overlay); -webkit-backdrop-filter: none; backdrop-filter: none; }
.modal, .modal.wide, .immersive-modal { color: var(--text-main); background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: var(--shadow-surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
.modal-head, .modal-foot { color: var(--text-main); background: var(--theme-surface); border-color: var(--border-subtle); }
.modal-head h2, .modal h3 { color: var(--text-main); }
.world-choice .checkmark { color: var(--theme-accent); }
.detail-favorite { position: static; display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 6px; width: auto; height: auto; min-height: 32px; padding: 6px 10px; border: 1px solid var(--border-subtle); border-radius: 8px; color: var(--text-sub); background: var(--theme-surface); box-shadow: none; font-size: 12px; }
.detail-favorite svg { width: 15px; height: 15px; fill: none; stroke: currentColor; }
.detail-favorite:hover, .detail-favorite.is-favorite { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border-strong); }
.detail-favorite.is-favorite svg { fill: var(--theme-accent-border); }
.toast { color: var(--theme-text-secondary); background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: var(--shadow-surface); }
.toast.error { color: var(--theme-danger-text); background: var(--theme-danger-bg); border-color: var(--theme-danger-border); }
.skeleton { background: linear-gradient(90deg, var(--theme-raised), var(--theme-raised), var(--theme-raised)); }
.auth-scene, .auth-story { color: var(--text-main); background: var(--theme-muted-surface); }
.auth-scene.has-auth-background::before, .auth-scene.has-auth-background::after { display: none; background: none; }
.auth-glass { color: var(--text-main); background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: 0 8px 32px rgba(17, 24, 39, .06); -webkit-backdrop-filter: none; backdrop-filter: none; }
.auth-brand>span { color: var(--theme-accent); background: var(--theme-accent-bg); border-color: var(--theme-accent-border); }
.auth-brand strong, .auth-story .brand-title { color: var(--text-main); }
.auth-brand small, .auth-kicker, .auth-copy .eyebrow { color: var(--theme-accent); }
.auth-back, .auth-copy p, .auth-story-foot, .auth-disclaimer, .auth-scene-foot, .auth-glass .auth-links { color: var(--text-sub); }
.auth-back:hover, .auth-links a:hover { color: var(--theme-accent-strong); }
.auth-tabs { background: var(--theme-raised); border-color: var(--border-subtle); }
.auth-tabs button.active { color: var(--theme-on-brand); background: var(--brand-primary); box-shadow: none; }
.auth-input>span { color: var(--text-sub); }
.auth-input input { background: var(--theme-surface)!important; }
.auth-consent button, .auth-links { color: var(--theme-accent); }
.auth-disclaimer, .auth-circle, .auth-circle::before, .auth-circle::after { border-color: var(--border-subtle); }
th { color: var(--theme-text-soft); background: var(--theme-muted-surface); }
td { color: var(--theme-text-secondary); border-color: var(--border-subtle); }
.bar-item .bar { background: var(--theme-accent); }
.bar-item .bar-value { color: var(--theme-text-soft); }
.subscription-card, .subscription-card:nth-child(3n+2), .subscription-card:nth-child(3n) { border-top-color: var(--theme-accent-border-strong); }
.subscription-model, .pool-models>div, .subscription-grants>div, .point-wallet-grid>div,
.payment-secret-grid section, .group-model-row, .grant-option, .model-radio { color: var(--theme-text-secondary); background: var(--theme-muted-surface); border-color: var(--border-subtle); }
.grant-option:has(input:checked), .model-radio:has(input:checked) { background: var(--theme-accent-bg); border-color: var(--theme-accent-border-strong); }
.subscription-offer-grid article, .subscription-offer-grid .tier-card, .tier-editor-preview .tier-card { color: var(--text-main); background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: none; }
.tier-card .tier-name, .tier-editor-preview .tier-name { color: var(--text-main); }
.tier-card .tier-description, .tier-price>span, .tier-price-note, .tier-term { color: var(--text-sub); }
.tier-card .subscription-price, .payment-amount { color: var(--text-main); }
.tier-features { border-color: var(--border-subtle); }
.variable-chips button { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border); }
.variable-chips button:hover { background: var(--theme-accent-bg); }
.admin-ai-tab { color: var(--theme-accent); }
.admin-ai-tab:hover { background: var(--theme-accent-bg); }
.payment-test { border-top-color: var(--theme-accent-border-strong); }
.support-message.staff { color: var(--text-main); background: var(--theme-accent-bg); border-color: var(--theme-accent-border); }
.support-message p { color: inherit; }

/* Worldbook and character editors retain all tree and scrolling behavior. */
.wb-studio .wb-layout, .wb-layout, .wb-entry, .worldbook-scope { background: var(--theme-surface); border-color: var(--border-subtle); }
.wb-studio .wb-tree, .wb-tree, .card-editor-preview-side { background: var(--theme-muted-surface); border-color: var(--border-subtle); }
.wb-studio .wb-content, .wb-content, .wb-inline-save { color: var(--text-main); background: var(--theme-surface); }
.wb-work button, .wb-global-node>.wb-scene-button, .wb-studio .wb-entry-node { color: var(--theme-text-soft); }
.wb-work button:hover { color: var(--theme-text-secondary); background: var(--theme-raised); }
.wb-work-title.selected, .wb-studio .wb-work-title.selected, .wb-scenes button.selected,
.wb-studio .wb-entry-node.selected { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border-strong); }
.wb-studio .wb-scenes, .wb-scenes, .wb-studio .wb-entry-tree, .worldbook-scope-content, .worldbook-detail-entry { border-color: var(--border-subtle); }
.wb-studio .wb-work button .wb-tree-chevron, .wb-studio .wb-global-overview, .wb-studio .wb-scene-head .wb-scope-hint,
.wb-scene-details summary, .wb-editor-heading .eyebrow, .wb-entry-empty .eyebrow,
.worldbook-scope>summary::after, .worldbook-scope>summary .icon { color: var(--text-sub); }
.wb-entry-node.selected .wb-node-dot { background: var(--brand-start); box-shadow: none; }
.wb-node-dot { background: var(--text-placeholder); }
.wb-scene-head p, .wb-entry p, .wb-readonly-text, .wb-scope-overview .wb-scope-description { color: var(--theme-text-soft); }
.wb-entry-empty h3, .wb-empty h3, .worldbook-detail-entry>strong { color: var(--text-main); }
.wb-entry-empty>.icon, .wb-empty>.icon { color: var(--theme-accent); }
.wb-keyword-chip, .wb-keywords span { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border); }
.wb-keyword-chip button { color: var(--theme-accent); }
.wb-keyword-chip button:hover { color: var(--theme-accent-strong); background: var(--theme-accent-bg); }
.wb-scope-overview .wb-scope-description, #new-story-world-scope:not(:empty) { background: var(--theme-muted-surface); border-color: var(--border-subtle); }
.card-editor-tabs, .card-editor-footer { color: var(--theme-text-secondary); background: var(--theme-surface); }
.card-editor-tabs button, .card-editor-tabs button>span { color: var(--text-sub); }
.card-editor-tabs button.active { color: var(--theme-accent-strong); background: var(--theme-accent-bg); box-shadow: none; }
.card-editor-tabs button.active>span { color: var(--theme-accent-strong); }
.card-editor-preview-side>.eyebrow, .editor-cover-note, .editor-section-title p,
.editor-world-option small, .editor-world-empty, .card-editor-footer small { color: var(--text-sub); }
.editor-world-option { background: var(--theme-surface); border-color: var(--border-subtle); }
.editor-world-option:has(input:checked), .editor-inspiration { background: var(--theme-accent-soft); border-color: var(--theme-accent-border); }
.editor-inspiration summary, #editor-preset-status { color: var(--theme-accent); }
.editor-inspiration p { color: var(--text-sub); }
.card-live-preview { background: var(--theme-cover-bg); border-color: var(--border-subtle); box-shadow: none; }
.editor-symbol { color: var(--text-sub); }
.editor-preview-shade { background: linear-gradient(180deg, transparent 32%, var(--theme-preview-shade) 72%, var(--theme-surface)); }
.editor-preview-copy h3 { color: var(--text-main); }
.editor-preview-subtitle, .editor-preview-summary, .editor-preview-credit { color: var(--theme-text-soft); }
.editor-preview-tags span { color: var(--theme-text-soft); background: var(--theme-preview-shade); border-color: var(--border-subtle); }
.editor-preview-credit { border-color: var(--border-subtle); }
.card-editor-panel textarea[name="opening_narrative"] { color: var(--text-narrative); border-left-color: var(--theme-narrative-border); }

.profile-hero, .profile-empty { background: var(--theme-surface); border-color: var(--border-subtle); box-shadow: none; }
.profile-avatar-link { border-color: var(--border-subtle); box-shadow: none; }
.profile-avatar-link>span:not(.avatar) { color: var(--theme-accent); background: var(--theme-accent-bg); border-color: var(--theme-accent-border); }
.profile-badges>span, .profile-badges>a { color: var(--theme-text-soft); background: var(--theme-raised); border-color: var(--border-subtle); }
.profile-wallet-link>span .icon, .profile-wallet-link small { color: var(--theme-accent); }
.profile-tabs>button { color: var(--theme-text-soft); background: var(--theme-surface); border-color: var(--border-subtle); }
.profile-tabs>button.active { color: var(--theme-accent-strong); background: var(--theme-accent-bg); border-color: var(--theme-accent-border-strong); box-shadow: none; }
.profile-tabs>button:hover { color: var(--text-main); border-color: var(--focus-ring); }
.profile-tabs b { background: var(--theme-raised); }
.profile-collection-note span, .profile-book-summary { color: var(--text-sub); }
.profile-card-actions .btn { background: var(--theme-surface); }
.profile-source-kind, .profile-source-kind.stage, .profile-source-kind.attached { color: var(--theme-text-soft); background: var(--theme-raised); }
.profile-source-link, .profile-source-link .icon, .profile-book-source>small { color: var(--text-sub); }
.profile-source-link:hover { color: var(--theme-accent-strong); }
.profile-empty>span { color: var(--theme-accent); background: var(--theme-accent-bg); border-color: var(--theme-accent-border); }
.load-progress-track i { box-shadow: none; }
.load-progress>span { background: var(--theme-surface); border-color: var(--border-subtle); color: var(--theme-text-soft); }

.topbar .recharge-cta { flex: none; min-height: 36px; padding: 8px 12px; font-size: 12px; border-radius: 10px; }
.topbar .recharge-cta .icon { width: 15px; height: 15px; }
.profile-data-tools { margin-top: 24px; }
.profile-data-tools h2 { margin: 0 0 18px; font-size: 16px; }
.profile-data-tools>.row { align-items: flex-end; gap: 12px; }
.profile-data-tools .field { flex: 1 1 220px; max-width: 380px; min-width: 0; margin: 0; }
.profile-data-tools .field>span { display: block; margin-bottom: 7px; color: var(--theme-text-soft); font-size: 11px; }
.profile-data-tools .field select { font-size: 12px; }
.profile-data-tools>.row>.btn { min-height: 43px; font-size: 12px; }
.create-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.create-menu>.btn, .create-menu>a, .create-menu>button { display: flex; align-items: center; justify-content: flex-start; gap: 10px; min-width: 0; padding: 16px; border: 1px solid var(--border-subtle); border-radius: 10px; color: var(--theme-text-secondary); background: var(--theme-surface); font-size: 13px; text-align: left; }
.create-menu>.btn:hover, .create-menu>a:hover, .create-menu>button:hover { color: var(--theme-accent-strong); background: var(--theme-accent-soft); border-color: var(--theme-accent-border-strong); }
.create-menu .icon { color: var(--theme-accent); width: 20px; height: 20px; }
@media (max-width: 760px) {
  .topbar .recharge-cta { min-height: 33px; padding: 6px 9px; gap: 5px; font-size: 11px; }
  .topbar-page-title { display: none; }
  .profile-data-tools>.row { align-items: stretch; }
  .profile-data-tools .field { flex-basis: 100%; max-width: none; }
  .profile-data-tools>.row>.btn { flex: 1 1 180px; }
  .create-menu { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 440px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr); height: auto; gap: 9px; padding: 10px 12px; }
  .topbar .plaza-brand-group { grid-column: 1; grid-row: 1; }
  .topbar .topbar-actions { grid-column: 1; grid-row: 2; justify-content: flex-end; }
  .plaza-topbar .plaza-search { grid-column: 1; grid-row: 2; }
  .plaza-topbar .topbar-actions { grid-row: 3; }
}

/* Three independently scrollable discovery rows; category pages keep the grid. */
.feed-page-tabs{display:flex;gap:6px;flex-wrap:wrap}.feed-page-tabs a{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:8px 16px;border-radius:9px;color:var(--text-sub);font-weight:600;text-decoration:none;border:1px solid transparent}.feed-page-tabs a.active{background:var(--theme-accent-bg);color:var(--brand-start);border-color:var(--theme-accent-border)}.feed-page-tabs a:focus-visible{outline:2px solid var(--focus-ring);outline-offset:2px}
.home-feed,.feed-section{min-width:0}.feed-section{margin:12px 0 26px}.feed-section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.feed-section-head h2,.feed-category-title{font-size:19px;margin:0}.feed-section-head small{font-size:13px;font-weight:400;color:var(--text-sub)}.feed-see-all{font-size:13px;color:var(--brand-start);text-decoration:none}.feed-carousel{display:flex;gap:16px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;padding:2px 1px 12px;scrollbar-width:thin;scrollbar-color:var(--theme-accent-border) transparent;max-width:100%}.feed-carousel>.feed-card{flex:0 0 clamp(260px,calc((100% - 32px)/3),350px);scroll-snap-align:start}.feed-carousel:focus-visible{outline:2px solid var(--focus-ring);outline-offset:2px}.feed-row-empty{padding:24px;color:var(--text-sub);min-height:80px}.feed-category-title{margin-bottom:16px}
@media(max-width:767px){.feed-page-tabs{width:100%;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}.feed-page-tabs a{padding:8px 6px;white-space:nowrap}.feed-carousel>.feed-card{flex-basis:85%;max-width:340px}.feed-section-head{gap:6px}.feed-section-head .row{gap:6px}.feed-section{margin-bottom:22px}}

/* Home section ranking and disclosure direction. */
.feed-section-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px;min-width:0;flex-wrap:wrap}.feed-section-actions .feed-tabs{width:auto}.feed-see-all{white-space:nowrap}.feed-expand-icon{display:inline-flex;vertical-align:middle;transition:transform .15s ease}.feed-expand-icon.is-expanded{transform:rotate(180deg)}
@media(max-width:767px){.feed-section-head{flex-wrap:wrap;align-items:flex-start}.feed-section-actions{width:100%;justify-content:space-between;gap:6px}.feed-section-actions .feed-tabs{flex:1;min-width:0;gap:2px;flex-wrap:wrap}.feed-section-actions .feed-tabs button{flex:0 1 auto;padding:6px;font-size:11px}.feed-section-actions .feed-see-all{font-size:12px}}
@media(prefers-reduced-motion:reduce){.feed-expand-icon{transition:none}}
