:root {
  color-scheme: dark;
  --canvas: #15151a; --rail: #19191f; --panel: #1f1f27; --panel2: #25252f;
  --text: #f2f1f6; --muted: #a9a8b7; --line: #343440; --accent: #7c5cff;
  --accent-text: #c3b5ff; --button: #6244df; --button-text: #fff; --warning: #ffd3a1; --error: #ffabb7;
  --radius: 13px; --rail-width: 218px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --canvas: #f6f5f9; --rail: #eeedf4; --panel: #fff; --panel2: #f2f0f8;
  --text: #201e2a; --muted: #5d596c; --line: #d9d5e5; --accent-text: #5438c5; --warning: #794400; --error: #a2223f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--text); font-size: 1rem; line-height: 1.5; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--text); }
button, input, select, textarea { font: inherit; }
button, .primary, .secondary { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.15rem, 5vw, 3.85rem); font-weight: 670; letter-spacing: -.065em; line-height: 1.05; overflow-wrap: anywhere; }
h2 { font-size: 1.28rem; letter-spacing: -.025em; }
h3 { font-size: 1.03rem; }
p + p { margin-top: .5rem; }
.skip { position: fixed; z-index: 10; left: 12px; top: 12px; padding: 10px; transform: translateY(-150%); background: var(--panel); }
.skip:focus { transform: none; }
.brand { color: var(--text); display: inline-flex; gap: 10px; align-items: center; font-weight: 730; letter-spacing: -.035em; white-space: nowrap; text-decoration: none; }
.brand-mark { position: relative; display: inline-block; width: 27px; height: 27px; flex: 0 0 27px; border: 2px solid var(--accent); border-radius: 8px; }
.brand-mark::after { content: ""; position: absolute; inset: 5px; background: var(--accent); border-radius: 3px; }
.auth-stage { min-height: 100svh; display: grid; align-items: center; grid-template-columns: minmax(0, 420px) minmax(220px, 540px); justify-content: center; gap: clamp(24px, 7vw, 105px); padding: clamp(22px, 6vw, 82px); }
.auth-stage > .auth-card:only-child { grid-column: 1 / -1; width: min(100%, 455px); justify-self: center; }
.auth-card { display: grid; gap: 22px; }
.auth-card .brand { margin-bottom: clamp(6px, 5vh, 45px); }
.auth-card h1 { font-size: clamp(2.75rem, 6vw, 5.25rem); }
.auth-card p { color: var(--muted); }
.auth-card form { display: grid; gap: 9px; margin-top: .55rem; }
.auth-card button { margin-top: 8px; }
.auth-art { min-height: 475px; position: relative; isolation: isolate; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 34px; }
.auth-art::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 35px 35px; mask-image: linear-gradient(145deg, #000, transparent 85%); opacity: .65; }
.auth-art i { position: absolute; display: block; width: 77%; height: 56%; left: calc(9% + 3% * var(--i)); top: calc(12% + 6% * var(--i)); border: 1px solid var(--accent); border-radius: 31px; transform: rotate(-28deg) skew(13deg); background: color-mix(in srgb, var(--accent) calc(var(--i) * 6% + 4%), var(--canvas)); box-shadow: 0 16px 26px #110e2244; }
.auth-art i:nth-child(1) { --i: 4; }.auth-art i:nth-child(2) { --i: 3; }.auth-art i:nth-child(3) { --i: 2; }.auth-art i:nth-child(4) { --i: 1; }.auth-art i:nth-child(5) { --i: 0; }
.auth-art i:last-child::after { content: ""; position: absolute; height: 40%; aspect-ratio: 1; border: 1px solid var(--accent); border-radius: 50%; left: 20%; top: 18%; }
#studio { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: 100svh; }
.rail { padding: 26px 16px 18px; position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 44px; border-right: 1px solid var(--line); background: var(--rail); }
.rail > .brand { padding: 0 10px; }
.rail nav, .rail-bottom { display: grid; gap: 5px; }
.rail-bottom { margin-top: auto; }
.rail nav a, .quiet { color: var(--muted); min-height: 44px; border: 1px solid transparent; border-radius: 8px; display: flex; align-items: center; gap: 12px; padding: 8px 10px; text-decoration: none; background: transparent; text-align: left; }
.rail nav a span { min-width: 16px; text-align: center; font-size: 1.12rem; }
.rail nav a:hover, .quiet:hover, .rail nav a[aria-current] { background: var(--panel2); color: var(--text); }
.rail nav a[aria-current] { border-color: var(--line); box-shadow: inset 3px 0 var(--accent); }
.topbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 11px clamp(20px, 4vw, 54px); min-height: 69px; border-bottom: 1px solid var(--line); color: var(--muted); }
#main { padding: clamp(22px, 4vw, 56px); max-width: 1480px; margin-inline: auto; min-height: 55vh; }
#main:focus { outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 26px; }
.page-head .muted { margin-top: 9px; overflow-wrap: anywhere; }
.section-head, .inline { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.stack { display: grid; align-content: start; gap: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid .wide { grid-column: 1 / -1; }
label { font-weight: 600; font-size: .93rem; }
.field { display: grid; gap: 5px; align-content: start; min-width: 0; }
input:not([type="checkbox"]), textarea, select { width: 100%; color: var(--text); background: var(--canvas); border: 1px solid var(--line); border-radius: 8px; min-height: 42px; padding: 9px 12px; }
textarea { min-height: 105px; resize: vertical; }
input[type="checkbox"] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
.check { display: flex; gap: 9px; align-items: center; }
.primary, .secondary { min-height: 42px; display: inline-flex; justify-content: center; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; text-decoration: none; font-weight: 620; font-size: .9rem; line-height: 1.3; white-space: nowrap; }
.primary { color: var(--button-text); background: var(--button); border-color: transparent; }
.primary:hover { color: #fff; background: #5134c7; }
.secondary { color: var(--text); background: var(--panel2); }
.secondary:hover { border-color: var(--accent); }
.muted, small { color: var(--muted); }
small { font-size: .84rem; }
.error { color: var(--error) !important; }
.warning { color: var(--warning); }
.panel, .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel { padding: clamp(14px, 2.3vw, 24px); }
.hero { position: relative; overflow: hidden; padding: clamp(20px, 4vw, 48px); }
.hero::before { content: ""; position: absolute; inset: 0 0 0 66%; pointer-events: none; opacity: .65; background: repeating-linear-gradient(143deg, transparent 0 20px, var(--line) 20px 21px, transparent 21px 41px); mask-image: linear-gradient(90deg, transparent, #000); }
.hero .section-head, .hero > p, .hero > progress { position: relative; }
.hero h2 { font-size: clamp(1.4rem, 4vw, 2.4rem); letter-spacing: -.05em; }
progress { width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--line); accent-color: var(--accent); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); } progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.hero progress { max-width: 720px; margin: 14px 0 3px; }
.metrics { display: grid; gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric { text-decoration: none; color: var(--text); }
.metric:hover { border-color: var(--accent); }
.metric strong { display: block; font-size: 1.85rem; letter-spacing: -.05em; font-weight: 650; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 185px), 1fr)); gap: 13px; }
.card { display: grid; overflow: hidden; color: var(--text); text-decoration: none; align-content: start; }
.card:hover { border-color: var(--accent); }
.card .copy { display: grid; padding: 12px; gap: 3px; overflow-wrap: anywhere; }
.thumb { background: var(--panel2); aspect-ratio: 1.65; width: 100%; display: grid; place-items: center; color: var(--muted); position: relative; overflow: hidden; }
.thumb::before { content: ""; width: 34px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 7px; box-shadow: 5px -5px var(--panel2), 6px -6px var(--line); position: absolute; }
.thumb img { position: relative; width: 100%; height: 100%; max-height: 215px; object-fit: contain; background: var(--panel2); }
.subnav { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 17px; }
.subnav a { color: var(--muted); padding: 7px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.subnav a[aria-current] { color: var(--text); border-color: var(--accent); }
.filter { display: grid; grid-template-columns: 2fr 1fr auto; align-items: end; gap: 9px; margin-bottom: 18px; }
.empty { padding: 23px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 14px; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.list li:last-child { border-bottom: 0; }
.list .line-detail { display: grid; min-width: 0; gap: 1px; }
.list time { font-size: .84rem; color: var(--muted); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 1fr); gap: 18px; align-items: start; }
.video-layout { grid-template-columns: minmax(190px, 270px) minmax(0, 1fr); }
.folder-tree { list-style: none; margin: 0; padding: 0; }
.folder-tree ul { list-style: none; padding-left: 16px; border-left: 1px solid var(--line); margin-left: 7px; }
.folder-tree a { display: inline-block; padding: 4px 2px; overflow-wrap: anywhere; }
.folder-tree a[aria-current] { color: var(--text); font-weight: 700; }
.checklists { display: grid; grid-template-columns: repeat(auto-fit, minmax(143px, 1fr)); gap: 13px; }
.checklists section { border: 1px solid var(--line); padding: 12px; border-radius: 8px; }
.checklists ul { padding: 0; margin: 5px 0 0; list-style: none; }
.checklists li { font-size: .86rem; line-height: 1.8; }
.present { color: var(--accent-text); }
.previews { min-height: 98px; }
.previews img { max-height: 560px; max-width: 100%; display: block; margin: auto; object-fit: contain; }
.previews audio { width: 100%; }
.preview-text { overflow: auto; max-height: 430px; overflow-wrap: anywhere; white-space: pre-wrap; }
.table-wrap { max-height: 440px; overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { border: 1px solid var(--line); padding: 7px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.markdown { overflow: auto; max-height: 430px; overflow-wrap: anywhere; display: grid; gap: .7em; }
.markdown pre { white-space: pre-wrap; margin: 0; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 13px; margin: 0; font-size: .9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.drop { padding: 32px 15px; border: 1px dashed var(--accent); border-radius: 10px; background: var(--panel2); text-align: center; display: grid; gap: 7px; justify-items: center; }
.drop[data-drag] { box-shadow: inset 0 0 0 2px var(--accent); }
.drop input { max-width: 380px; }
.queue { display: grid; gap: 10px; }
.queue-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; min-width: 0; }
.queue-row .feedback, .queue-row progress { grid-column: 1 / -1; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 3; right: 18px; bottom: 18px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 16px; max-width: min(calc(100vw - 36px), 460px); box-shadow: 0 7px 28px #0003; }
@media (max-width: 840px) {
  .two-col:not(.video-layout) { grid-template-columns: minmax(0, 1fr); }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(107px, 1fr)); }
  :root { --rail-width: 175px; }
}
@media (max-width: 680px) {
  #studio { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; padding: 12px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .rail > .brand { padding: 0 3px; }
  .rail nav { grid-row: 2; grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .rail nav a { padding: 6px 2px; flex-direction: column; gap: 0; min-height: 48px; font-size: .8rem; }
  .rail nav a[aria-current] { box-shadow: inset 0 -2px var(--accent); }
  .rail-bottom { grid-row: 1; grid-column: 2; grid-auto-flow: column; margin: 0; }
  .quiet { min-height: 38px; padding: 4px 5px; font-size: .83rem; }
  .topbar { min-height: 54px; padding: 6px 16px; }
  #main { padding: 20px 15px 32px; }
  .auth-stage { grid-template-columns: minmax(0, 450px); }
  .auth-art { display: none; }
  .video-layout { grid-template-columns: 1fr; }
}
@media (max-width: 410px) {
  .form-grid, .filter { grid-template-columns: minmax(0, 1fr); }
  .auth-card h1 { font-size: clamp(2.4rem, 13vw, 3.2rem); }
  .grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 133px), 1fr)); }
  .facts { grid-template-columns: minmax(90px, auto) minmax(0, 1fr); }
}
