:root {
    color-scheme: dark;
    --bg: #09090f;
    --panel: rgba(21, 21, 32, .82);
    --line: rgba(255, 255, 255, .1);
    --text: #f7f5ff;
    --muted: #aaa6bb;
    --accent: #9b87ff;
    --accent-2: #66e5c4;
    --danger: #ff7288;
    --success: #6de0ad;
    --radius: 22px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.catalog-grid video, .catalog-grid audio, .catalog-image { width: 100%; max-width: 100%; border-radius: 12px; }
.catalog-image { aspect-ratio: 4/3; object-fit: cover; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 50% -20%, #221b48 0, transparent 43%), var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
.ambient { position: fixed; z-index: -1; width: 420px; height: 420px; border-radius: 999px; filter: blur(110px); opacity: .11; pointer-events: none; }
.ambient--one { top: 12%; left: -250px; background: #8b5cf6; }
.ambient--two { right: -260px; bottom: 5%; background: #22d3aa; }

.site-header, .site-footer, .page-shell { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.site-header { height: 84px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 760; letter-spacing: -.02em; }
.brand__mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; background: linear-gradient(135deg, #9b87ff, #6651df); box-shadow: 0 10px 32px rgba(126,96,255,.28); font-size: 12px; }
.site-nav { display: flex; align-items: center; gap: 24px; color: var(--muted); font-size: 14px; }
.site-nav a:hover, .link-button:hover, .text-link:hover { color: var(--text); }
.site-nav form { margin: 0; }
.link-button { padding: 0; color: inherit; border: 0; background: transparent; }
.page-shell { padding: 54px 0 100px; }
.site-footer { display: flex; justify-content: space-between; padding: 28px 0 40px; border-top: 1px solid var(--line); color: #716d80; font-size: 12px; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 20px; font-size: clamp(42px, 7vw, 78px); line-height: .98; letter-spacing: -.055em; }
h1 span { color: var(--accent); }
h2 { margin-bottom: 12px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; }
.hero { max-width: 850px; margin-bottom: 38px; }
.hero .lede { max-width: 650px; }
.lede { color: var(--muted); font-size: clamp(17px, 2vw, 21px); line-height: 1.55; }
.eyebrow { margin-bottom: 12px; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.panel, .creator-card, .production-panel, .library-row { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 20px 70px rgba(0,0,0,.24); backdrop-filter: blur(18px); }
.panel { padding: 28px; border-radius: var(--radius); }
.creator-card { overflow: hidden; border-radius: 28px; }
.idea-input textarea { width: 100%; min-height: 220px; padding: 30px; resize: vertical; color: var(--text); border: 0; outline: 0; background: transparent; font-size: clamp(18px, 2.5vw, 25px); line-height: 1.55; }
.idea-input textarea::placeholder { color: #6f6b7d; }
.creator-card__bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 20px; border-top: 1px solid var(--line); background: rgba(8,8,13,.3); }
.options-toggle { display: flex; gap: 16px; color: var(--muted); border: 0; background: none; }
.options-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; padding: 22px; border-top: 1px solid var(--line); }
.options-grid__wide { grid-column: span 4; }

label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; color: var(--text); border: 1px solid var(--line); border-radius: 12px; outline: none; background: #0d0d15; }
input, select { min-height: 46px; padding: 0 13px; }
textarea { padding: 14px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(155,135,255,.72); box-shadow: 0 0 0 3px rgba(155,135,255,.11); }
.form-stack { display: grid; gap: 17px; }
.form-note { margin: 2px 0 0; color: var(--muted); text-align: center; font-size: 13px; }
.form-note a { color: var(--accent); }
.check-row { display: flex; align-items: center; }
.check-row input { width: 16px; min-height: auto; }
.field-error { margin: -4px 0 0; color: #ff98a8; font-size: 13px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 12px; color: var(--text); background: transparent; font-weight: 700; }
.button:disabled { cursor: wait; opacity: .58; }
.button--primary { color: #0b0913; background: linear-gradient(135deg, #b4a5ff, #8773f2); box-shadow: 0 12px 32px rgba(131,105,255,.2); }
.button--quiet { border-color: var(--line); background: rgba(255,255,255,.04); }
.button--danger { color: #ff9eae; border-color: rgba(255,114,136,.22); }
.button--large { min-height: 54px; padding-inline: 26px; }
.button--wide { width: 100%; }
.button-loading { align-items: center; gap: 9px; }
.spinner { width: 24px; height: 24px; flex: 0 0 auto; border: 3px solid rgba(155,135,255,.28); border-top-color: var(--accent); border-radius: 999px; animation: spin .8s linear infinite; }
.spinner--small { width: 17px; height: 17px; border-width: 2px; border-color: rgba(11,9,19,.28); border-top-color: #0b0913; }
@keyframes spin { to { transform: rotate(360deg); } }

.section-block { margin-top: 78px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-heading--top { align-items: center; margin-bottom: 42px; }
.section-heading--top h1 { margin-bottom: 14px; font-size: clamp(44px, 6vw, 70px); }
.text-link, .back-row { color: var(--muted); font-size: 14px; }
.back-row { margin-bottom: 28px; }
.empty-state { padding: 46px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.video-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.video-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.025); transition: transform .2s, border-color .2s; }
.video-card:hover { transform: translateY(-3px); border-color: rgba(155,135,255,.45); }
.video-card__preview { aspect-ratio: 16/10; display: flex; align-items: flex-start; justify-content: space-between; padding: 14px; color: #9a95aa; background: linear-gradient(145deg, #252137, #11111a 65%); font-size: 11px; }
.video-card__body { display: grid; gap: 7px; padding: 17px; }
.video-card__body strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-card__body span { color: var(--muted); font-size: 12px; }

.status-dot, .status-orb { display: block; border-radius: 999px; background: #7d7987; }
.status-dot { width: 9px; height: 9px; }
.status-orb { width: 17px; height: 17px; box-shadow: 0 0 0 7px rgba(255,255,255,.04); }
.status-dot--ready, .status-orb--ready { background: var(--accent-2); }
.status-dot--rendering, .status-orb--rendering, .status-dot--concept, .status-orb--concept { background: #f0bd68; }
.status-dot--completed, .status-orb--completed { background: var(--success); }
.status-dot--failed, .status-orb--failed { background: var(--danger); }

.library-list { display: grid; gap: 12px; }
.library-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px; border-radius: 16px; }
.library-row__main { min-width: 0; display: flex; align-items: center; gap: 16px; }
.library-row__main > span:last-child { min-width: 0; display: grid; gap: 5px; }
.library-row__main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library-row__main small { color: var(--muted); }
.library-row__actions { display: flex; gap: 8px; }
.format-chip { display: grid; place-items: center; width: 55px; height: 55px; flex: 0 0 55px; border-radius: 13px; color: var(--accent); background: rgba(155,135,255,.1); font-size: 12px; font-weight: 800; }
.pagination { margin-top: 28px; }

.detail-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 34px; }
.detail-hero h1 { max-width: 850px; font-size: clamp(42px, 6vw, 70px); }
.detail-hero .lede { max-width: 760px; }
.meta-stack { display: grid; gap: 8px; min-width: 96px; }
.meta-stack span { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); text-align: center; font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 22px; align-items: start; }

.production-panel { padding: 26px; border-radius: var(--radius); }
.production-panel__status { display: flex; align-items: center; gap: 18px; }
.production-panel__status h2 { margin: 0; }
.concept-progress { display: flex; align-items: center; gap: 16px; margin-top: 22px; padding: 18px; border: 1px solid rgba(155,135,255,.18); border-radius: 14px; background: rgba(155,135,255,.07); }
.concept-progress strong { display: block; }
.concept-progress p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.production-options { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 24px; }
.auto-choice { display: grid; gap: 7px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.auto-choice span { color: var(--muted); font-size: 12px; }
.production-panel__action { display: flex; justify-content: space-between; align-items: center; gap: 28px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.production-panel__action p { max-width: 620px; margin: 0; color: var(--muted); font-size: 13px; }
.progress-line { height: 4px; overflow: hidden; margin: 24px 0 16px; border-radius: 99px; background: rgba(255,255,255,.06); }
.progress-line span { display: block; width: 42%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: progress 1.5s infinite ease-in-out; }
@keyframes progress { from { transform: translateX(-120%); } to { transform: translateX(330%); } }
.completed-result { display: grid; gap: 18px; margin-top: 22px; }
.completed-result video { width: min(100%, 480px); max-height: 650px; border-radius: 18px; background: #000; }
.completed-result .button { justify-self: start; }
.fake-result, .failure-box { display: grid; gap: 8px; padding: 18px; border-radius: 14px; }
.fake-result { color: #b9f4df; background: rgba(59,209,157,.08); }
.fake-result span { color: var(--muted); }
.failure-box { margin-top: 20px; color: #ffc1cb; background: rgba(255,114,136,.08); }
.failure-box p { margin: 0; }
.failure-box .button { justify-self: start; margin-top: 8px; }

.scene-list { display: grid; gap: 20px; padding: 0; list-style: none; }
.scene-list li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; }
.scene-list li > span { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: var(--accent); background: rgba(155,135,255,.1); font-size: 12px; font-weight: 800; }
.scene-list p { margin: 7px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.scene-list small { color: #706c7c; }
.notice { margin-bottom: 22px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; }
.notice--success { color: #b9f4df; background: rgba(59,209,157,.08); }
.notice--error { margin-top: 18px; color: #ffc1cb; background: rgba(255,114,136,.08); }
.auth-shell { width: min(470px, 100%); margin: 60px auto; }
.auth-shell h1 { font-size: clamp(40px, 7vw, 62px); }
.auth-shell .panel { margin-top: 30px; }

@media (max-width: 900px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .options-grid { grid-template-columns: repeat(2, 1fr); }
    .options-grid__wide { grid-column: span 2; }
}

@media (max-width: 650px) {
    .site-header, .site-footer, .page-shell { width: min(100% - 26px, 1160px); }
    .site-header { height: auto; padding: 20px 0; align-items: flex-start; }
    .site-nav { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
    .page-shell { padding-top: 38px; }
    .creator-card__bar, .production-panel__action, .detail-hero, .section-heading, .library-row { align-items: stretch; flex-direction: column; }
    .creator-card__bar .button, .production-panel__action .button { width: 100%; }
    .options-grid, .production-options, .video-grid { grid-template-columns: 1fr; }
    .options-grid__wide { grid-column: auto; }
    .meta-stack { grid-template-columns: repeat(3, 1fr); }
    .library-row__actions { width: 100%; }
    .site-footer { gap: 14px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .spinner, .progress-line span { animation: none; }
}
