:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #182230;
  --muted: #687383;
  --line: #e5e9ee;
  --navy: #111d2d;
  --navy-2: #19273a;
  --violet: #7357e8;
  --violet-dark: #5c43cf;
  --violet-soft: #f0edff;
  --mint: #0d9c7a;
  --mint-soft: #e8f8f3;
  --amber: #d98919;
  --amber-soft: #fff5e5;
  --shadow: 0 12px 34px rgba(24, 34, 48, .08);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; display: flex; flex-direction: column; padding: 28px 18px 20px; color: #dbe3ed; background: var(--navy); z-index: 5; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 30px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(145deg, #8168ef, #5f46d4); box-shadow: 0 8px 22px rgba(115,87,232,.3); }
.brand-mark svg { width: 27px; fill: none; stroke: #fff; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; color: #fff; font-size: 20px; letter-spacing: .05em; }
.brand span { display: block; margin-top: 1px; font: 600 10px "DM Sans"; color: #8492a5; letter-spacing: .17em; text-transform: uppercase; }
.side-nav { display: grid; gap: 7px; }
.nav-item { width: 100%; height: 47px; border: 0; border-radius: 10px; display: grid; grid-template-columns: 27px 1fr auto; align-items: center; padding: 0 13px; color: #9eabbb; background: transparent; text-align: left; transition: .2s ease; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(115,87,232,.27), rgba(115,87,232,.11)); color: #fff; box-shadow: inset 3px 0 #8369f1; }
.nav-icon { font-size: 21px; text-align: center; transform: translateY(-1px); }
.nav-count { min-width: 24px; padding: 2px 7px; border-radius: 12px; color: #c9c1ff; background: rgba(115,87,232,.2); text-align: center; font-size: 11px; }
.side-note { margin-top: auto; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 15px 13px; border: 1px solid rgba(255,255,255,.07); border-radius: 12px; background: rgba(255,255,255,.035); }
.privacy-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: #66d6b7; background: rgba(28,182,137,.14); font-weight: 800; }
.side-note strong { display: block; color: #dfe6ee; font-size: 12px; }
.side-note p { margin: 5px 0 0; color: #78879a; font-size: 10px; line-height: 1.7; }
.version { margin-top: 14px; color: #536174; font: 600 9px "DM Sans"; text-align: center; letter-spacing: .14em; }

.main { grid-column: 2; min-width: 0; padding-bottom: 70px; }
.topbar { height: 105px; padding: 23px 42px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.75); backdrop-filter: blur(16px); }
.eyebrow { margin-bottom: 4px; color: var(--violet); font: 700 9px "DM Sans"; letter-spacing: .19em; }
h1 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.status-pill { padding: 8px 12px; border: 1px solid #dce3e8; border-radius: 999px; color: #5c6977; background: #fff; font-size: 11px; }
.status-pill i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #23b88e; box-shadow: 0 0 0 4px rgba(35,184,142,.12); }
.status-pill i.offline { background: #e39a33; box-shadow: 0 0 0 4px rgba(227,154,51,.13); }
.api-status { display: flex; align-items: center; }
.api-status:hover { color: var(--violet); border-color: #c8c0f4; }
.api-status b { margin-left: 8px; color: #9aa5b2; font-size: 15px; line-height: 1; }
.icon-button { width: 34px; height: 34px; border: 1px solid #dce3e8; border-radius: 50%; color: #718092; background: #fff; font-weight: 800; }
.view { display: none; padding: 34px 42px 0; }
.view.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } }
.intro-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 23px; }
.intro-row h2, .section-intro h2 { margin: 0 0 7px; font-size: 20px; }
.intro-row p, .section-intro p { margin: 0; color: var(--muted); font-size: 12px; }
.step-indicator { display: flex; align-items: center; gap: 10px; color: #a0a9b5; font-size: 10px; }
.step-indicator span.on { color: var(--violet); font-weight: 700; }
.step-indicator b { width: 25px; height: 1px; background: #d7dce3; }

.upload-card { min-height: 148px; display: grid; grid-template-columns: 75px 1fr auto; align-items: center; gap: 22px; padding: 28px 34px; border: 1.5px dashed #cbd1dc; border-radius: 16px; background: var(--surface); transition: .2s ease; box-shadow: 0 3px 15px rgba(24,34,48,.025); }
.upload-card:hover, .upload-card.dragging { border-color: var(--violet); background: #fbfaff; box-shadow: 0 10px 30px rgba(115,87,232,.09); }
.upload-visual { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 16px; background: var(--violet-soft); }
.upload-visual svg { width: 40px; fill: none; stroke: var(--violet); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.upload-copy h3 { margin: 0 0 8px; font-size: 16px; }
.upload-copy p { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.upload-meta { display: flex; gap: 7px; }
.upload-meta span, .mini-tags i { padding: 3px 8px; border-radius: 5px; color: #778294; background: #f2f4f7; font-size: 9px; font-style: normal; }
button { border: 0; transition: .18s ease; }
.primary-button, .secondary-button, .ghost-button { border-radius: 9px; font-weight: 600; }
.primary-button { padding: 12px 22px; color: #fff; background: var(--violet); box-shadow: 0 7px 18px rgba(115,87,232,.18); }
.primary-button:hover { background: var(--violet-dark); transform: translateY(-1px); }
.secondary-button { padding: 10px 17px; border: 1px solid #d9dee6; color: #465365; background: #fff; }
.secondary-button:hover { border-color: #b9b2ea; color: var(--violet); }
.ghost-button { padding: 10px 18px; color: var(--violet); background: var(--violet-soft); }
.compact { padding: 9px 14px; font-size: 11px; box-shadow: none; }
.text-button { padding: 5px; color: var(--violet); background: none; font-size: 11px; }
.text-button.danger { color: #ca6571; }

.file-panel { margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { height: 54px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-heading > div { display: flex; align-items: baseline; gap: 9px; }
.panel-heading h3 { margin: 0; font-size: 13px; }
.panel-heading span { color: #919aa7; font-size: 10px; }
.file-list { max-height: 252px; padding: 8px 14px; overflow: auto; }
.import-report { margin: 0 14px 10px; padding: 10px 12px; border: 1px solid #efd5a6; border-radius: 8px; color: #7f6746; background: #fffbf2; font-size: 9px; line-height: 1.65; }
.import-report.success { border-color: #bde7da; color: #31755f; background: #f0faf7; }
.import-report b { display: block; margin-bottom: 2px; color: inherit; }
.import-report p { margin: 1px 0; }
.file-item { display: grid; grid-template-columns: 35px minmax(0, 1fr) auto auto; gap: 11px; align-items: center; padding: 9px 8px; border-bottom: 1px solid #f0f2f5; }
.file-item:last-child { border-bottom: 0; }
.file-type { width: 32px; height: 35px; display: grid; place-items: center; border-radius: 7px; color: var(--violet); background: var(--violet-soft); font: 800 8px "DM Sans"; }
.file-name { min-width: 0; }
.file-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.file-name span { color: #929daa; font-size: 9px; }
.file-status { padding: 3px 8px; border-radius: 10px; color: var(--mint); background: var(--mint-soft); font-size: 9px; }
.remove-file { width: 26px; height: 26px; border-radius: 50%; color: #9ba5b1; background: transparent; }
.remove-file:hover { color: #d35b68; background: #fff0f2; }
.analysis-options { min-height: 78px; padding: 13px 20px; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr) auto; gap: 22px; align-items: end; border-top: 1px solid var(--line); background: #fafbfc; }
.analysis-options label > span, .option-note > span { display: block; margin-bottom: 5px; color: #737f8f; font-size: 9px; }
.analysis-options input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid #dbe0e7; border-radius: 7px; outline: none; background: #fff; font-size: 11px; }
.analysis-options input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(115,87,232,.09); }
.mini-tags { height: 38px; display: flex; align-items: center; gap: 5px; }
.mini-tags i { color: #6353ba; background: var(--violet-soft); }
.analysis-options .primary-button { min-width: 168px; height: 44px; display: flex; align-items: center; justify-content: center; gap: 9px; }
.analysis-options .primary-button small { padding-left: 9px; border-left: 1px solid rgba(255,255,255,.3); font-weight: 400; opacity: .85; }
.analyze-actions { min-width: 205px; display: grid; gap: 6px; }
.analyze-actions button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.analyze-actions .deep-button { height: 34px; padding: 6px 11px; color: #6554bd; background: #faf9ff; font-size: 9px; }
.analyze-actions .deep-button small { padding-left: 8px; border-left: 1px solid #ddd7f6; color: #8f84c4; }
.analyze-actions .concise-button { height: 38px; padding: 7px 11px; border-color: transparent; color: #fff; background: var(--mint); font-size: 10px; }
.analyze-actions .concise-button:hover { color: #fff; background: #087f64; }
.analyze-actions .concise-button small { padding-left: 8px; border-left: 1px solid rgba(255,255,255,.3); opacity: .82; }
.concise-report-list { margin: 0; padding-left: 28px; }
.concise-report-list li { padding: 9px 3px; color: #303d4d; font-size: 11px; line-height: 1.95; }
.paywall-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.paywall-section h3 { margin: 0 0 5px; font-size: 13px; }
.paywall-section > p { margin: 0 0 12px; color: #8a94a2; font-size: 9px; }
.paywall-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.paywall-card { padding: 11px; border: 1px solid #f0dcba; border-radius: 9px; background: #fffbf3; }
.paywall-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.paywall-card b { display: block; color: #c77a12; font-size: 10px; }
.paywall-card-head span { padding: 2px 6px; border-radius: 10px; color: #fff; background: #df8b17; font-size: 8px; white-space: nowrap; }
.paywall-card > small { display: inline-block; margin-bottom: 5px; color: #a36c24; font-size: 8px; }
.paywall-card p { margin: 0; color: #735f43; font-size: 8px; line-height: 1.65; }
.paywall-analyze-button { background: linear-gradient(135deg, #f29b29, #db7412); box-shadow: 0 7px 18px rgba(219,116,18,.2); }
.paywall-model-note { margin: 13px 0 0; color: #818b99; font-size: 9px; line-height: 1.6; }
@media (max-width: 1100px) { .paywall-grid { grid-template-columns: repeat(3, 1fr); } }
.progress-card { margin-top: 18px; min-height: 102px; display: grid; grid-template-columns: 58px 1fr auto; gap: 17px; align-items: center; padding: 20px 22px; border: 1px solid #ddd7fb; border-radius: 14px; background: linear-gradient(110deg, #faf9ff, #fff); box-shadow: 0 10px 28px rgba(115,87,232,.08); }
.progress-orbit { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--violet) var(--progress, 0%), #e9e5fb 0); position: relative; }
.progress-orbit::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.progress-orbit span { position: relative; z-index: 1; color: var(--violet); font: 700 10px "DM Sans"; }
.progress-copy > div { display: flex; justify-content: space-between; gap: 12px; }
.progress-copy strong { font-size: 12px; }
.progress-copy > div span { color: #8f99a6; font-size: 9px; }
.progress-copy p { margin: 5px 0 10px; color: #717d8c; font-size: 9px; }
.progress-track { height: 5px; border-radius: 5px; background: #ebe8f8; overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), #9b85fa); transition: width .3s ease; }

.empty-state { min-height: 305px; display: grid; justify-items: center; align-content: center; text-align: center; }
.empty-state h3 { margin: 17px 0 6px; font-size: 14px; }
.empty-state p { margin: 0 0 14px; color: #8a95a4; font-size: 10px; }
.sample-preview { position: relative; width: 122px; height: 84px; border: 1px solid #e0e3e8; border-radius: 9px; background: white; box-shadow: 0 10px 24px rgba(24,34,48,.08); transform: rotate(-2deg); overflow: visible; }
.sample-top { height: 18px; display: flex; align-items: center; gap: 4px; padding: 0 7px; border-bottom: 1px solid #edf0f3; }
.sample-top span { width: 4px; height: 4px; border-radius: 50%; background: #d5d9e0; }
.sample-body { padding: 12px; display: grid; gap: 6px; }
.sample-body i { height: 4px; width: 80%; border-radius: 3px; background: #eceef3; }
.sample-body i:nth-child(2) { width: 60%; }
.sample-body strong { position: absolute; right: 12px; top: 31px; width: 25px; height: 25px; border-radius: 5px; background: var(--violet-soft); }
.sample-float { position: absolute; right: -13px; bottom: -12px; width: 33px; height: 33px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--violet); box-shadow: 0 6px 14px rgba(115,87,232,.3); transform: rotate(2deg); }

.results { margin-top: 28px; }
.result-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
.success-badge { display: inline-block; margin-bottom: 8px; padding: 4px 8px; border-radius: 5px; color: var(--mint); background: var(--mint-soft); font-size: 9px; font-weight: 700; }
.result-header h2 { margin: 0 0 4px; font-size: 19px; }
.result-header p { margin: 0; color: var(--muted); font-size: 10px; }
.result-actions { display: flex; gap: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 17px; }
.stat-card { padding: 16px 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.stat-card span { color: #818b98; font-size: 9px; }
.stat-card strong { display: block; margin: 7px 0 3px; font: 700 22px "DM Sans", sans-serif; }
.stat-card small { color: #9da5af; font-size: 8px; }
.stat-card:nth-child(2) strong { color: var(--violet); }
.stat-card:nth-child(3) strong { color: var(--amber); }
.stat-card:nth-child(4) strong { color: var(--mint); }
.analysis-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.global-report-section { margin-bottom: 17px; padding: 28px 34px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.global-report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.global-report-head h2 { margin: 0 0 5px; font-size: 20px; }
.global-report-head p { margin: 0; color: #8a94a2; font-size: 9px; }
.report-mark { padding: 5px 9px; border-radius: 6px; color: var(--violet); background: var(--violet-soft); font: 700 9px "DM Sans"; }
.global-overview { margin: 18px 0 20px; padding: 14px 16px; border-radius: 9px; color: #4d5968; background: #f8f9fb; font-size: 10px; line-height: 1.85; }
.global-overview b { display: block; margin-bottom: 4px; color: #263344; font-size: 11px; }
.global-episode-list { margin: 0; padding-left: 26px; }
.global-episode-list li { padding: 10px 4px 11px 6px; border-bottom: 1px solid #eef0f3; color: #394657; }
.global-episode-list li:last-child { border-bottom: 0; }
.global-episode-list h4 { display: inline; margin: 0 7px 0 0; font-size: 11px; }
.global-episode-list p { display: inline; margin: 0; font-size: 10px; line-height: 1.85; }
.global-episode-list small { display: block; margin-top: 4px; color: #8b72dc; font-size: 8px; }
.episode-rail { border-right: 1px solid var(--line); background: #fafbfc; }
.rail-title { height: 52px; display: flex; justify-content: space-between; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--line); }
.rail-title strong { font-size: 12px; }
.rail-title span { color: #929ba7; font-size: 9px; }
.episode-list { max-height: 725px; overflow: auto; }
.episode-item { width: 100%; display: grid; grid-template-columns: 33px 1fr; gap: 10px; padding: 13px 14px; border-bottom: 1px solid #eef1f3; background: transparent; text-align: left; }
.episode-item:hover { background: #f7f5ff; }
.episode-item.active { background: #f1eeff; box-shadow: inset 3px 0 var(--violet); }
.episode-number { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: #798596; background: #e9edf1; font: 700 11px "DM Sans"; }
.episode-item.active .episode-number { color: #fff; background: var(--violet); }
.episode-info strong { display: block; margin-bottom: 3px; color: #344152; font-size: 10px; }
.episode-info span { display: block; color: #969fab; font-size: 8px; }
.episode-info i { display: block; height: 3px; margin-top: 7px; border-radius: 3px; background: #e6e9ee; overflow: hidden; }
.episode-info i b { display: block; height: 100%; border-radius: inherit; background: var(--violet); }
.episode-detail { min-width: 0; padding: 25px 29px 32px; }
.detail-heading { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.detail-heading span { display: block; margin-bottom: 4px; color: var(--violet); font: 700 9px "DM Sans"; letter-spacing: .12em; }
.detail-heading h2 { margin: 0; font-size: 18px; }
.confidence { padding: 5px 9px; border-radius: 14px; color: var(--mint); background: var(--mint-soft); font-size: 8px; }
.confidence.medium { color: #b66d08; background: var(--amber-soft); }
.detail-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; padding-bottom: 0; }
.detail-section h3 { margin: 0 0 12px; font-size: 12px; }
.summary-box { padding: 14px 16px; border-left: 3px solid var(--violet); border-radius: 3px 9px 9px 3px; color: #465365; background: #f8f7ff; font-size: 11px; line-height: 1.9; }
.story-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.story-tags span { padding: 4px 8px; border-radius: 5px; color: #6456af; background: var(--violet-soft); font-size: 8px; }
.hook-reason { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; margin-top: 10px; padding: 9px 11px; border-radius: 7px; background: #f7f8fa; font-size: 8px; line-height: 1.6; }
.hook-reason b { color: var(--violet); }
.hook-reason span { color: #6e7987; }
.timeline { position: relative; display: grid; gap: 0; }
.timeline::before { content: ""; position: absolute; left: 44px; top: 16px; bottom: 16px; width: 1px; background: #ddd9f7; }
.timeline-item { position: relative; display: grid; grid-template-columns: 34px 13px 1fr; gap: 10px; align-items: start; padding: 7px 0; }
.timeline-item time { padding-top: 2px; color: var(--violet); font: 700 9px "DM Sans"; }
.timeline-item i { position: relative; z-index: 1; width: 9px; height: 9px; margin-top: 3px; border: 2px solid white; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 2px #dcd6fa; }
.timeline-copy strong { display: block; margin-bottom: 2px; font-size: 10px; }
.timeline-copy span { display: block; color: #7b8795; font-size: 9px; line-height: 1.55; }
.character-table { display: grid; gap: 7px; }
.character-row { display: grid; grid-template-columns: 34px minmax(90px,.7fr) minmax(160px,2fr) auto; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid #eceff2; border-radius: 9px; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: linear-gradient(145deg, #8e79ec, #6450c9); font: 700 12px "DM Sans"; }
.character-row strong { font-size: 10px; }
.character-row small { display: block; margin-top: 2px; color: #929ba7; font-size: 8px; }
.character-row p { margin: 0; color: #6f7a88; font-size: 9px; line-height: 1.55; }
.role-label { padding: 4px 7px; border-radius: 5px; color: #7863df; background: var(--violet-soft); font-size: 8px; }
.role-label.support { color: #74808f; background: #f0f2f5; }
.edit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.edit-tip { padding: 12px; border: 1px solid #eceef2; border-radius: 9px; }
.edit-tip b { display: block; margin-bottom: 5px; color: var(--violet); font-size: 9px; }
.edit-tip p { margin: 0; color: #737f8d; font-size: 8px; line-height: 1.6; }
.warning-note { margin-top: 12px; padding: 9px 11px; border-radius: 7px; color: #91704a; background: #fff8eb; font-size: 8px; }
.uncertainty-box { margin-top: 12px; padding: 11px 13px; border: 1px solid #f0d7a8; border-radius: 8px; color: #806747; background: #fffbf3; font-size: 8px; }
.uncertainty-box b { display: block; margin-bottom: 5px; color: #ac741f; }
.uncertainty-box p { margin: 3px 0; line-height: 1.6; }

.section-intro { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.standalone-empty { min-height: 500px; display: grid; place-content: center; justify-items: center; text-align: center; }
.standalone-empty > span { width: 70px; height: 70px; display: grid; place-items: center; border-radius: 20px; color: var(--violet); background: var(--violet-soft); font-size: 30px; }
.standalone-empty h3 { margin: 18px 0 7px; }
.standalone-empty p { margin: 0 0 18px; color: var(--muted); font-size: 11px; }
.cast-hero { margin: 24px 0 14px; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; border-radius: 14px; color: #fff; background: linear-gradient(120deg, #18263a, #293b53); overflow: hidden; position: relative; }
.cast-hero::after { content: ""; position: absolute; width: 230px; height: 230px; right: -50px; top: -90px; border-radius: 50%; background: rgba(115,87,232,.25); }
.cast-hero h3 { margin: 0 0 5px; font-size: 16px; }
.cast-hero p { margin: 0; color: #aeb9c7; font-size: 10px; }
.cast-hero strong { position: relative; z-index: 1; font: 700 34px "DM Sans"; }
.cast-hero strong small { display: block; color: #aab5c4; font: 400 8px "Noto Sans SC"; text-align: right; }
.character-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.cast-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 5px 16px rgba(24,34,48,.035); }
.cast-card-head { display: flex; align-items: center; gap: 11px; }
.cast-card .avatar { width: 42px; height: 42px; border-radius: 12px; font-size: 15px; }
.cast-card h3 { margin: 0 0 3px; font-size: 12px; }
.cast-card .role-label { display: inline-block; }
.cast-card p { min-height: 38px; margin: 14px 0; color: #6d7988; font-size: 9px; line-height: 1.7; }
.cast-card p.relationship-line { min-height: 0; margin-top: -7px; padding-top: 8px; border-top: 1px dashed #e7e9ee; color: #7b6fc2; }
.cast-metrics { display: grid; grid-template-columns: repeat(3,1fr); padding-top: 12px; border-top: 1px solid var(--line); }
.cast-metrics div { text-align: center; border-right: 1px solid var(--line); }
.cast-metrics div:last-child { border: 0; }
.cast-metrics strong { display: block; font: 700 13px "DM Sans"; }
.cast-metrics span { color: #9aa3ae; font-size: 7px; }
.export-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 24px; }
.export-card { min-height: 250px; display: flex; flex-direction: column; align-items: flex-start; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: left; box-shadow: 0 6px 20px rgba(24,34,48,.04); }
.export-card:hover { transform: translateY(-3px); border-color: #c8c0f4; box-shadow: var(--shadow); }
.export-type { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 12px; font: 800 12px "DM Sans"; }
.export-type.violet { color: var(--violet); background: var(--violet-soft); }
.export-type.blue { color: #377dc1; background: #eaf4ff; }
.export-type.amber { color: var(--amber); background: var(--amber-soft); }
.export-type.green { color: var(--mint); background: var(--mint-soft); }
.export-card h3 { margin: 0 0 9px; font-size: 14px; }
.export-card p { min-height: 50px; margin: 0; color: #768190; font-size: 9px; line-height: 1.7; }
.export-card em { display: block; margin-top: 14px; color: #9ba4af; font-size: 8px; font-style: normal; }
.export-card b { margin-top: auto; color: var(--violet); font-size: 10px; }

.toast { position: fixed; left: 50%; bottom: 25px; z-index: 20; padding: 10px 16px; border-radius: 9px; color: white; background: #202b39; box-shadow: 0 10px 28px rgba(0,0,0,.2); font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 15px); transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
dialog { width: min(430px, calc(100vw - 30px)); padding: 29px; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 25px 80px rgba(10,18,29,.28); }
dialog::backdrop { background: rgba(11,18,29,.55); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; right: 14px; top: 12px; width: 30px; height: 30px; border-radius: 50%; color: #8290a0; background: #f1f3f6; font-size: 18px; }
.dialog-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--violet); font-weight: 800; }
dialog h2 { margin: 16px 0 12px; font-size: 17px; }
dialog ol { margin: 0 0 21px; padding-left: 20px; color: #657181; font-size: 10px; line-height: 1.9; }
dialog code { padding: 2px 5px; border-radius: 4px; background: #f0f1f4; }
dialog .primary-button { width: 100%; }
.api-dialog { width: min(560px, calc(100vw - 30px)); padding: 27px; }
.dialog-title-row { display: flex; align-items: center; gap: 12px; }
.dialog-title-row .dialog-icon { flex: 0 0 auto; font: 800 11px "DM Sans"; }
.dialog-title-row h2 { margin: 0 0 4px; }
.dialog-title-row p { margin: 0; color: #808b98; font-size: 9px; }
.security-callout { display: grid; grid-template-columns: auto 1fr; gap: 9px; margin: 19px 0 17px; padding: 10px 12px; border-radius: 8px; color: #536271; background: #eff9f6; font-size: 9px; line-height: 1.55; }
.security-callout b { color: var(--mint); }
.api-form { display: grid; gap: 12px; }
.api-form label > span { display: block; margin-bottom: 5px; color: #637081; font-size: 9px; }
.api-form input, .api-form select { width: 100%; height: 39px; padding: 0 11px; border: 1px solid #d9dee6; border-radius: 7px; color: #354153; background: #fff; outline: none; font-size: 10px; }
.api-form input:focus, .api-form select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(115,87,232,.09); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.password-wrap { display: grid; grid-template-columns: 1fr auto; }
.password-wrap input { border-radius: 7px 0 0 7px; }
.password-wrap button { padding: 0 12px; border: 1px solid #d9dee6; border-left: 0; border-radius: 0 7px 7px 0; color: var(--violet); background: #faf9ff; font-size: 9px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 19px; }
.dialog-actions .primary-button { width: auto; }
.api-test-result { margin-top: 13px; padding: 9px 11px; border-radius: 7px; color: var(--mint); background: var(--mint-soft); font-size: 9px; }
.api-test-result.error { color: #bd5260; background: #fff0f2; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px minmax(0,1fr); }
  .sidebar { width: 76px; padding: 22px 10px; }
  .brand { padding: 0 9px 25px; }
  .brand > div:last-child, .nav-item > span:nth-child(2), .nav-count, .side-note, .version { display: none; }
  .nav-item { grid-template-columns: 1fr; padding: 0; text-align: center; }
  .main { grid-column: 2; }
  .topbar, .view { padding-left: 25px; padding-right: 25px; }
  .analysis-layout { grid-template-columns: 210px minmax(0,1fr); }
  .analysis-options { grid-template-columns: 1fr 1fr; }
  .analyze-actions { grid-column: 1 / -1; width: 100%; }
  .character-grid, .export-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: auto 0 0; width: 100%; height: 64px; padding: 7px 12px; flex-direction: row; z-index: 15; }
  .brand, .side-note, .version { display: none; }
  .side-nav { width: 100%; grid-template-columns: repeat(4,1fr); gap: 5px; }
  .nav-item { height: 50px; grid-template-columns: 22px auto; justify-content: center; gap: 6px; font-size: 9px; }
  .nav-item > span:nth-child(2) { display: block; }
  .nav-item.active { box-shadow: inset 0 -2px #8369f1; }
  .main { padding-bottom: 85px; }
  .topbar { height: 82px; padding: 16px 18px; }
  .view { padding: 24px 16px 0; }
  .status-pill { display: none; }
  .intro-row { display: block; }
  .step-indicator { margin-top: 16px; }
  .upload-card { grid-template-columns: 54px 1fr; gap: 13px; padding: 20px; }
  .upload-visual { width: 52px; height: 52px; }
  .upload-copy h3 { font-size: 13px; }
  .upload-card .secondary-button { grid-column: 1 / -1; width: 100%; }
  .analysis-options { grid-template-columns: 1fr; gap: 12px; }
  .analyze-actions { grid-column: auto; }
  .progress-card { grid-template-columns: 48px 1fr; }
  .progress-card > button { grid-column: 1 / -1; width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .analysis-layout { grid-template-columns: 1fr; }
  .episode-rail { border: 0; border-bottom: 1px solid var(--line); }
  .episode-list { display: flex; overflow-x: auto; }
  .episode-item { min-width: 160px; border-right: 1px solid var(--line); }
  .episode-detail { padding: 20px 17px; }
  .character-row { grid-template-columns: 34px 1fr auto; }
  .character-row p { grid-column: 2 / -1; }
  .edit-grid, .character-grid, .export-grid { grid-template-columns: 1fr; }
  .paywall-grid { grid-template-columns: 1fr; }
  .result-header { display: block; }
  .result-actions { margin-top: 14px; }
}
