/* The Factory — Everything After Studios */
:root {
  --bg: #121212;
  --rail: #171717;
  --panel: #1c1c1c;
  --panel-2: #232323;
  --panel-3: #2b2b2b;
  --line: #2f2f2f;
  --line-2: #3d3d3d;
  --text: #ececec;
  --muted: #9a9a9a;
  --faint: #6f6f6f;
  --accent: #c5a2f6;
  --accent-ink: #1b1226;
  --ok: #83b5a3;
  --warn: #d6b46a;
  --bad: #d98a8a;
  --chatgpt: #74aa9c;
  --claude: #d08a6a;
  --gemini: #7f9be6;
  --radius: 12px;
  --radius-sm: 8px;
  --gap: 16px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --scale: 1;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f3f1; --rail: #eceae6; --panel: #ffffff; --panel-2: #f6f5f3; --panel-3: #eeece8;
  --line: #e1ded8; --line-2: #cfcbc3; --text: #1d1b19; --muted: #66625c; --faint: #8d8880;
  --accent: #7a4fc0; --accent-ink: #ffffff;
  color-scheme: light;
}
:root[data-density="compact"] { --gap: 11px; }

* { box-sizing: border-box; }
html { font-size: calc(15px * var(--scale)); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.5; }
a { color: var(--accent); }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- controls ---------- */
button, .button {
  font: inherit; font-size: 0.93rem; cursor: pointer; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; transition: filter .15s, background .15s, border-color .15s; white-space: nowrap;
}
button:hover, .button:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
button.secondary, .button.secondary { background: var(--panel-3); color: var(--text); border-color: var(--line-2); font-weight: 500; }
button.ghost, .button.ghost { background: transparent; color: var(--muted); border-color: transparent; font-weight: 500; padding: 6px 9px; }
button.ghost:hover { color: var(--text); background: var(--panel-2); }
button.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); font-weight: 500; }
button.small, .button.small { padding: 5px 10px; font-size: .84rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
label { display: grid; gap: 5px; font-size: .88rem; color: var(--muted); }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; padding: 2px 8px; border-radius: 99px; background: var(--panel-3); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.chip.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--rail);
  border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; padding: 2px 6px; }
.brand svg { width: 38px; height: 33px; color: var(--text); flex: none; }
.brand strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.brand small { display: block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.rail-section { display: grid; gap: 2px; }
.rail-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); padding: 4px 8px; }
.rail a.nav {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-size: .93rem; min-width: 0;
}
.rail a.nav span.label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail a.nav:hover { background: var(--panel-2); color: var(--text); }
.rail a.nav[aria-current="page"] { background: var(--panel-3); color: var(--text); }
.rail a.nav .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; background: var(--accent); }
.rail a.nav svg { width: 17px; height: 17px; flex: none; }
.rail-foot { margin-top: auto; display: grid; gap: 2px; }
.main { min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 60px; }
.topbar { display: none; }
.content { max-width: 1320px; margin: 0 auto; display: grid; gap: 28px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.section-title { font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.section-title .line { flex: 1; height: 1px; background: var(--line); }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); }

/* ---------- home ---------- */
.hero h1 { font-size: clamp(1.8rem, 3.2vw, 2.9rem); font-weight: 680; letter-spacing: -0.04em; }
.hero .quote { margin-top: 10px; color: var(--muted); font-size: 1rem; }
.hero .quote cite { color: var(--text); font-style: normal; }
.hero .films { margin-top: 3px; font-size: .8rem; color: var(--faint); }

.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--gap); }
.project-card {
  position: relative; display: grid; grid-template-rows: auto 1fr; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--text); text-decoration: none;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.project-card:hover { transform: translateY(-3px); border-color: var(--card-accent, var(--accent)); box-shadow: 0 10px 30px #0006; }
.project-card .art { aspect-ratio: 4 / 3; background: #0c0c0c; display: grid; place-items: center; overflow: hidden; }
.project-card .art img { width: 100%; height: 100%; object-fit: cover; }
.project-card .art .initials { font-size: 2.6rem; font-weight: 700; color: var(--card-accent, var(--accent)); letter-spacing: -0.04em; }
.project-card .meta { padding: 12px 14px 14px; display: grid; gap: 8px; }
.project-card .meta .row { gap: 6px; }
.project-card.new { grid-template-rows: 1fr; border-style: dashed; display: grid; place-items: center; min-height: 220px; color: var(--muted); background: transparent; cursor: pointer; font: inherit; }
.project-card.new:hover { color: var(--text); }

.gates-list { display: grid; gap: 4px; }
.gate-row { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 210px; gap: 18px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.gate-row:last-child { border-bottom: 0; }
.gate-row .name { font-weight: 600; color: var(--text); text-decoration: none; }
.gate-row .name small { display: block; font-weight: 400; }
.gate-row .status { text-align: right; font-size: .88rem; white-space: nowrap; }
.gate-track { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.gate-stop { height: 9px; border-radius: 99px; background: var(--line-2); border: 0; padding: 0; cursor: pointer; position: relative; }
.gate-stop.reached { background: var(--gate-color); opacity: .55; }
.gate-stop.current { opacity: 1; box-shadow: 0 0 0 2px color-mix(in srgb, var(--gate-color) 35%, transparent); }
.gate-stop:hover { filter: brightness(1.25); opacity: 1; }
.gate-track.readonly .gate-stop { cursor: default; }
.gate-desc { grid-column: 2 / -1; font-size: .84rem; color: var(--muted); margin-top: -6px; }

.studio-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--gap); }
.studio-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; grid-template-rows: 110px auto; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; position: relative; }
.studio-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.studio-card .art { background: #0e0e0e; display: grid; place-items: center; padding: 14px; }
.studio-card .art img { max-height: 82px; object-fit: contain; }
.studio-card .art.cover { padding: 0; } .studio-card .art.cover img { width: 100%; height: 100%; max-height: none; object-fit: cover; }
.studio-card .meta { padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.studio-card .meta strong { font-size: .92rem; display: block; }
.studio-card .meta small { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; }

.tile-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { display: flex; align-items: center; gap: 11px; padding: 11px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; min-width: 0; transition: border-color .15s, background .15s; }
.tile:hover { border-color: var(--tile-tint, var(--line-2)); background: var(--panel-2); }
.tile .logo { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; font-weight: 700; font-size: .9rem; color: #fff; background: var(--tile-tint, var(--panel-3)); }
.tile .logo img { width: 22px; height: 22px; }
.tile .name { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .name small { display: block; font-size: .74rem; }

.watch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.watch-card { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.watch-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.watch-card img { width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #000; }
.watch-card strong { font-size: .9rem; display: block; }
.watch-card small { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- project page ---------- */
.project-head { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.project-head .art { width: 112px; height: 112px; border-radius: 14px; overflow: hidden; background: #0c0c0c; border: 1px solid var(--line); display: grid; place-items: center; }
.project-head .art img { width: 100%; height: 100%; object-fit: cover; }
.project-head h1 { font-size: clamp(1.6rem, 2.6vw, 2.3rem); font-weight: 680; letter-spacing: -0.035em; }
.project-head .sub { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: .94rem; display: flex; gap: 7px; align-items: center; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { font-size: .74rem; color: var(--faint); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--gap); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.7rem; letter-spacing: -0.03em; }
.stat small { font-size: .8rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: var(--gap); align-items: start; }

.gate-editor { display: grid; gap: 14px; }
.gate-editor .gate-track { gap: 6px; }
.gate-editor .gate-stop { height: 12px; }
.gate-labels { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; font-size: .68rem; color: var(--faint); text-align: center; }
.gate-labels span.current { color: var(--text); font-weight: 600; }

.list { display: grid; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--panel-2); }
.list-item.active { background: var(--panel-3); }
.activity-item { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.activity-item:last-child { border-bottom: 0; }

/* chat */
.chat { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: calc(100vh - 260px); min-height: 460px; }
.chat-log { overflow-y: auto; padding: 18px; display: grid; gap: 14px; align-content: start; }
.msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; }
.msg .avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: .78rem; background: var(--panel-3); color: var(--text); }
.msg .avatar img { width: 20px; height: 20px; }
.msg.mark .avatar { background: var(--accent); color: var(--accent-ink); }
.msg .who { font-size: .84rem; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.msg .who small { font-weight: 400; }
.msg .body { margin-top: 3px; }
.msg.chatgpt .who { color: var(--chatgpt); } .msg.claude .who { color: var(--claude); } .msg.gemini .who { color: var(--gemini); }
.msg.error .body { color: var(--bad); }
.composer { border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 10px; }
.composer textarea { min-height: 64px; max-height: 260px; }
.toggle-group { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.toggle-group label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line-2); cursor: pointer; color: var(--muted); font-size: .84rem; }
.toggle-group input { width: auto; margin: 0; accent-color: var(--accent); }
.toggle-group label:has(input:checked) { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* markdown */
.md { font-size: .95rem; overflow-wrap: anywhere; }
.md > * + * { margin-top: .6em; }
.md h1, .md h2, .md h3, .md h4 { font-size: 1.02rem; margin-top: 1em; }
.md h1 { font-size: 1.15rem; }
.md ul, .md ol { padding-left: 1.3em; margin: .4em 0; }
.md li + li { margin-top: .2em; }
.md code { font-family: var(--mono); font-size: .86em; background: var(--panel-3); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--panel-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--line-2); margin: 0; padding-left: 12px; color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); }
.md table { border-collapse: collapse; width: 100%; font-size: .9em; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }

/* productions */
.prod-layout { display: grid; grid-template-columns: minmax(270px, 360px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.prod-list { max-height: calc(100vh - 230px); overflow-y: auto; position: sticky; top: 16px; }
.group-label { padding: 10px 14px 6px; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); background: var(--panel); position: sticky; top: 0; z-index: 1; }
.stage-steps { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 6px; }
.stage-step { padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2); font-size: .82rem; text-align: left; color: var(--muted); font-weight: 500; display: grid; gap: 3px; white-space: normal; }
.stage-step b { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.stage-step.current { border-color: var(--accent); color: var(--text); }
.stage-step.approved { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.stage-step.approved b { color: var(--ok); }
.stage-step.revise b { color: var(--warn); }
.progress { height: 5px; border-radius: 9px; background: var(--panel-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 9px; }
.round { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.round > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 14px; background: var(--panel-2); font-size: .86rem; }
.round-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.round-results > div { padding: 12px 14px; border-right: 1px solid var(--line); min-width: 0; }
.round-results > div:last-child { border-right: 0; }
.round-results h4 { font-size: .8rem; margin-bottom: 6px; }
.clamp { max-height: 320px; overflow: hidden; position: relative; }
.clamp.open { max-height: none; }
.clamp:not(.open)::after { content: ""; position: absolute; inset: auto 0 0; height: 60px; background: linear-gradient(transparent, var(--panel)); }

/* gallery */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; min-width: 150px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.thumb { position: relative; border-radius: 10px; overflow: hidden; background: #0b0b0b; border: 1px solid var(--line); cursor: zoom-in; aspect-ratio: 1; padding: 0; display: block; width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.thumb:hover img { transform: scale(1.03); }
.thumb .badge { position: absolute; top: 8px; left: 8px; }
.thumb .caption { position: absolute; inset: auto 0 0; padding: 22px 9px 7px; font-size: .76rem; color: #eee; background: linear-gradient(transparent, #000c); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dropzone { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--muted); }
.dropzone.over { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* dialogs & toasts */
dialog { border: 1px solid var(--line-2); background: var(--panel); color: var(--text); border-radius: 14px; padding: 0; width: min(560px, 94vw); max-height: 90vh; }
dialog::backdrop { background: #000a; backdrop-filter: blur(2px); }
dialog .dlg { padding: 20px; display: grid; gap: 14px; }
dialog.viewer { width: min(1200px, 96vw); background: #0d0d0d; }
.viewer-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; max-height: 90vh; }
.viewer-body .stage { display: grid; place-items: center; background: #050505; min-height: 50vh; }
.viewer-body .stage img { max-height: 88vh; object-fit: contain; }
.viewer-body aside { padding: 18px; overflow-y: auto; display: grid; gap: 12px; align-content: start; border-left: 1px solid var(--line); background: var(--panel); }
.toast-wrap { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 9999; }
.toast { background: var(--panel-3); border: 1px solid var(--line-2); padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 26px #0007; font-size: .9rem; max-width: 380px; }
.toast.error { border-color: var(--bad); }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--panel) 0, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius); min-height: 120px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* auth pages */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 50% -10%, #2a2135 0, var(--bg) 60%); }
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 16px; }
.auth-card h1 { font-size: 1.5rem; }
.auth-card .qr { background: #fff; padding: 8px; border-radius: 10px; justify-self: center; }
.auth-card code.secret { font-family: var(--mono); display: block; padding: 8px; background: var(--panel-2); border-radius: 8px; word-break: break-all; margin-top: 6px; }
.auth-mark { display: flex; justify-content: center; }
.auth-mark svg { width: 64px; height: 56px; color: var(--text); }
.error-text { color: var(--bad); font-size: .9rem; min-height: 1.2em; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .watch-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .viewer-body { grid-template-columns: 1fr; }
  .viewer-body aside { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px #000a; }
  .rail.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .topbar .brand svg { width: 30px; height: 26px; }
  .main { padding: 18px 14px 50px; }
  .prod-layout { grid-template-columns: 1fr; }
  .prod-list { position: static; max-height: 340px; }
  .gate-row { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .gate-row .gate-track { grid-column: 1 / -1; grid-row: 2; }
  .gate-desc { grid-column: 1 / -1; margin-top: 0; }
  .project-head { grid-template-columns: 72px minmax(0, 1fr); }
  .project-head .art { width: 72px; height: 72px; }
  .project-head .actions { grid-column: 1 / -1; }
  .gate-labels { display: none; }
  .chat { height: calc(100vh - 230px); }
  .stage-steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .watch-grid { grid-template-columns: 1fr; }
  .watch-card { grid-template-columns: 110px minmax(0, 1fr); }
  .watch-card img { width: 110px; }
  .project-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .studio-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .round-results > div { border-right: 0; border-bottom: 1px solid var(--line); }
}
.scrim { position: fixed; inset: 0; background: #0008; z-index: 45; }
a.list-item { color: var(--text); text-decoration: none; }
a.list-item small { text-decoration: none; }
@media (max-width: 560px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }

.rail-sub { display: grid; gap: 1px; margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px solid var(--line); }
.rail a.nav.sub { padding: 5px 9px; font-size: .86rem; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2); font-weight: 500; border-radius: 99px; padding: 6px 13px; }
.pill.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); border-color: var(--accent); }
details > summary::-webkit-details-marker { color: var(--muted); }
@media (min-width: 861px) { .tabs { display: none; } }
