/* Kadr - dark, dense review tool. */

:root {
  --bg: #0f1115;
  --panel: #171a21;
  --raised: #1f232c;
  --raised-2: #262b36;
  --border: #2a2f3a;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --accent: #7c8cff;
  --accent-ink: #0f1115;
  --accent-soft: rgba(124, 140, 255, 0.16);
  --open: #f2b33d;
  --fixed: #3ecf8e;
  --approved: #8fa3bf;
  --reopened: #ff5d5d;
  --danger: #ff5d5d;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --rail-w: 56px;
  --panel-w: 344px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.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;
}

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.icon { display: block; flex: none; }

/* ---------- buttons and fields ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--raised); color: var(--text);
  cursor: pointer; white-space: nowrap; font-weight: 500;
}
.btn:hover { background: var(--raised-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.sm { height: 26px; padding: 0 8px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: #8e9cff; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--raised); }
.btn-danger { background: transparent; border-color: rgba(255, 93, 93, 0.5); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 93, 93, 0.12); }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--raised); border-color: var(--border); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn.sm { width: 28px; height: 28px; }

.field, select, input[type="text"], input[type="number"], textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; color: var(--text);
}
select { height: 32px; padding: 0 8px; cursor: pointer; }
.field:focus, select:focus, input:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
input[type="range"] { accent-color: var(--accent); }

.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--raised);
  color: var(--muted); font-size: 12px; white-space: nowrap;
}

.chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: #111; white-space: nowrap;
}
.chip-open { background: var(--open); }
.chip-fixed { background: var(--fixed); }
.chip-approved { background: var(--approved); }
.chip-reopened { background: var(--reopened); }

kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px; background: var(--raised);
  font: 12px/1.5 var(--mono); text-align: center;
}

/* ---------- home ---------- */

.home { min-height: 100%; display: flex; flex-direction: column; }
.home-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; }
.home-bar-actions { display: flex; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: 0.01em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  -webkit-mask: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  position: relative;
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--bg); border-radius: 2px; }
.brand-mark::before { left: 8px; top: 6px; width: 3px; height: 14px; }
.brand-mark::after { left: 12px; top: 11px; width: 8px; height: 3px; transform: rotate(-38deg); transform-origin: left center; box-shadow: 0 5px 0 0 var(--bg); }

.home-main { width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 20px; }
.home-main h1 { font-size: 30px; line-height: 1.2; letter-spacing: -0.01em; }
.lead { color: var(--muted); font-size: 15px; max-width: 620px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 44px 24px; border: 1.5px dashed #3a4150; border-radius: 14px;
  background: linear-gradient(180deg, rgba(124, 140, 255, 0.06), rgba(124, 140, 255, 0.015));
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: linear-gradient(180deg, rgba(124, 140, 255, 0.12), rgba(124, 140, 255, 0.03)); }
.drop-art { color: var(--accent); margin-bottom: 4px; }
.drop-title { font-size: 18px; font-weight: 600; }
.drop-sub { color: var(--muted); margin-bottom: 10px; }
.drop .btn { height: 38px; padding: 0 18px; font-size: 15px; }

.privacy { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.privacy .icon { color: var(--fixed); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.steps strong { display: block; }
.steps span:last-child { color: var(--muted); font-size: 13px; }
.steps strong { color: var(--text); font-size: 14px; }
.step-no { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; }

.recent { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.recent h2 { font-size: 15px; }
.recent-hint { padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); }
.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recent-list li { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.recent-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; text-align: left; }
.recent-open:hover { background: var(--raised); }
.recent-icon { color: var(--muted); }
.recent-main { display: flex; flex-direction: column; min-width: 0; }
.recent-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- review layout ---------- */

.review { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }

.topbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); background: var(--panel); min-width: 0;
}
.title-input {
  flex: 1 1 200px; min-width: 80px; max-width: 420px; height: 32px;
  background: transparent; border-color: transparent; font-weight: 600; font-size: 15px;
}
.title-input:hover { border-color: var(--border); }
.reviewer input { width: 140px; height: 32px; }
.save-state { font-size: 12px; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 290px;
  padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--raised);
  display: flex; flex-direction: column; gap: 2px;
}
.menu > button {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px; border: 0; border-radius: 6px;
  background: transparent; cursor: pointer; text-align: left;
}
.menu > button:hover, .menu > button:focus-visible { background: var(--raised-2); outline: none; }
.menu > button .icon { margin-top: 2px; color: var(--accent); }
.menu strong { display: block; font-weight: 600; }
.menu small { display: block; color: var(--muted); font-size: 12px; }
.menu-check { display: flex; align-items: center; gap: 8px; padding: 8px; margin-top: 4px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; cursor: pointer; }

.editor {
  display: grid; min-height: 0;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--panel-w);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "rail center panel" "timeline timeline timeline";
}

.rail {
  grid-area: rail; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 0; border-right: 1px solid var(--border); background: var(--panel); overflow-y: auto;
}
.rail-group { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.rail-sep { width: 28px; height: 1px; background: var(--border); flex: none; }
.rail-btn {
  display: grid; place-items: center; width: 38px; height: 34px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer;
}
.rail-btn:hover { background: var(--raised); color: var(--text); }
.rail-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.rail-btn:disabled { opacity: 0.35; cursor: default; background: transparent; }
.swatches { display: grid; grid-template-columns: repeat(2, 18px); gap: 6px; }
.swatch {
  width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--c); cursor: pointer;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.size-btn span { display: block; width: 18px; height: var(--w); border-radius: 4px; background: currentColor; }

.center { grid-area: center; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.stage { position: relative; flex: 1 1 auto; min-height: 180px; background: #000; overflow: hidden; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.stage .draw { position: absolute; left: 0; top: 0; touch-action: none; z-index: 2; }
/* Note markers: placed in percent of this layer, which covers the fitted picture exactly. */
.markers { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; }
.marker {
  --dx: 0px; --dy: 0px; --c: var(--open);
  position: absolute; transform: translate(-50%, -50%) translate(var(--dx), var(--dy));
  min-width: 22px; height: 18px; padding: 0 5px; border: 1px solid rgba(0, 0, 0, 0.7); border-radius: 9px;
  background: var(--c); color: #111; font: 700 10.5px/16px var(--font); text-align: center; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55); cursor: pointer; pointer-events: auto; opacity: 0.92;
}
.marker[hidden] { display: none; }
.marker.status-fixed { --c: var(--fixed); }
.marker.status-approved { --c: var(--approved); }
.marker.status-reopened { --c: var(--reopened); color: #fff; }
.marker:hover, .marker.selected { opacity: 1; z-index: 2; }
.marker.selected { box-shadow: 0 0 0 2px var(--accent), 0 1px 4px rgba(0, 0, 0, 0.55); }
/* A stacked marker keeps a dot on its real spot. */
.marker.stacked::before {
  content: ""; position: absolute; left: calc(50% - var(--dx)); top: calc(50% - var(--dy)); width: 5px; height: 5px;
  border-radius: 50%; background: var(--c); border: 1px solid #000; transform: translate(-50%, -50%); pointer-events: none;
}
.marker::after {
  content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  max-width: 260px; width: max-content; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: rgba(15, 17, 21, 0.94); color: var(--text); font: 400 12px/1.35 var(--font); white-space: normal; text-align: left;
  opacity: 0; visibility: hidden; pointer-events: none;
}
.marker:hover::after, .marker:focus-visible::after { opacity: 1; visibility: visible; }
.cursor-pos {
  position: absolute; z-index: 4; padding: 2px 6px; border-radius: 4px; background: rgba(15, 17, 21, 0.8);
  color: var(--text); font-size: 11px; pointer-events: none; white-space: nowrap;
}
.markers-toggle { font-size: 12px; color: var(--muted); }
/* The film frame keeps the film's native size and is scaled into the stage with a transform. */
.film-host { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.film-frame { position: absolute; left: 0; top: 0; transform-origin: 0 0; border: 0; background: #000; pointer-events: none; }
.film-notice {
  position: absolute; left: 10px; bottom: 10px; z-index: 3; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 20px);
  padding: 6px 10px; border: 1px solid rgba(242, 179, 61, 0.6); border-radius: var(--radius); background: rgba(15, 17, 21, 0.88); font-size: 12px;
}
.film-notice.allowed { border-color: var(--border); }
.film-notice > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.film-open-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.film-open-row .muted { font-size: 13px; }
.recent-icon.film { color: var(--accent); }
.stage:fullscreen { background: #000; }
.stage-msg {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center;
  background: rgba(15, 17, 21, 0.75); color: var(--text); font-size: 15px;
}
.draw-textbox {
  position: absolute; z-index: 5; min-width: 160px; max-width: 60%; padding: 2px 6px; margin: 0;
  border: 1px dashed var(--accent); border-radius: 4px; background: rgba(0, 0, 0, 0.55);
  font-weight: 600; line-height: 1.25; resize: none; overflow: hidden; field-sizing: content;
}

.transport {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; flex-wrap: wrap;
  border-top: 1px solid var(--border); background: var(--panel);
}
.tp-group { display: flex; align-items: center; gap: 2px; }
.tp-right { margin-left: auto; gap: 6px; }
.icon-btn.play { width: 40px; height: 36px; background: var(--raised); border-color: var(--border); }
.tp-readout { display: flex; align-items: baseline; gap: 12px; font-size: 14px; white-space: nowrap; }
.tp-tc { font-size: 16px; font-weight: 600; color: var(--text); min-width: 76px; }
.tp-frame { color: var(--text); min-width: 86px; }
.tp-shuttle { color: var(--accent); font-weight: 700; }
.tp-speed select { height: 30px; }
.tp-volume { width: 84px; }

.composer {
  display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 10px;
  border-top: 1px solid var(--border); background: var(--panel);
}
.composer textarea { width: 100%; min-height: 44px; max-height: 140px; resize: vertical; line-height: 1.4; }
.composer.editing { box-shadow: inset 3px 0 0 var(--accent); }
.composer-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-row select { height: 28px; }
.range-readout { font-size: 12px; white-space: nowrap; }
.range-readout.set { color: var(--accent); }
.spacer { flex: 1; }
.draft-info { font-size: 12px; white-space: nowrap; }

.panel { grid-area: panel; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--border); background: var(--panel); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.panel-head h2 .count { white-space: nowrap; }
.count { color: var(--muted); font-weight: 500; font-size: 12px; }
.panel-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-left: auto; min-width: 0; max-width: 100%; }
.panel-tools select { height: 28px; font-size: 13px; }
.note-list { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 0; }
.notes-empty { padding: 16px 14px; font-size: 13px; }

.note-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 9px 10px 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--raised); cursor: pointer;
}
.note-card::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--open); }
.note-card.status-fixed::before { background: var(--fixed); }
.note-card.status-approved::before { background: var(--approved); }
.note-card.status-reopened::before { background: var(--reopened); }
.note-card:hover { border-color: #3a4150; }
.note-card.selected { border-color: var(--accent); background: #232842; }
.note-card.editing { outline: 1px dashed var(--accent); outline-offset: 2px; }
.nc-head { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.nc-id { font-weight: 700; font-size: 13px; }
.nc-time { color: var(--text); }
.nc-frame { color: var(--muted); }
.nc-kind { color: var(--muted); text-transform: lowercase; }
.nc-scene { color: var(--accent); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-still { background: rgba(255, 93, 93, 0.12); }
.nc-still span { color: var(--reopened); }
.nc-check { display: flex; align-items: center; gap: 6px; font-size: 12px; flex-wrap: wrap; }
.nc-head .chip { margin-left: auto; }
.nc-body { display: flex; gap: 10px; align-items: flex-start; }
.nc-thumb { flex: none; width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); background: #000; }
.nc-pos { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-pos .nc-el { color: var(--accent); }
.nc-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.nc-reply { font-size: 12px; padding: 6px 8px; border-radius: 6px; background: var(--accent-soft); white-space: pre-wrap; word-break: break-word; }
.nc-reply span { font-weight: 700; color: var(--accent); margin-right: 4px; }
.nc-foot { display: flex; align-items: center; gap: 6px; }
.nc-author { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.nc-menu-wrap { position: relative; }
.nc-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 150px; padding: 4px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--raised-2);
  display: flex; flex-direction: column;
}
.nc-menu button { padding: 7px 10px; border: 0; border-radius: 5px; background: transparent; text-align: left; cursor: pointer; white-space: nowrap; }
.nc-menu button:hover, .nc-menu button:focus-visible { background: var(--border); outline: none; }

/* ---------- timeline ---------- */

#timeline { grid-area: timeline; }
.timeline { padding: 6px 12px 8px; border-top: 1px solid var(--border); background: var(--panel); }
.tl-scenes { position: relative; height: 18px; margin-bottom: 4px; }
.tl-scene {
  position: absolute; top: 0; bottom: 0; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 4px; background: var(--raised); color: var(--muted);
  font-size: 11px; line-height: 16px; text-align: left; cursor: pointer;
}
.tl-scene:nth-child(even) { background: var(--raised-2); }
.tl-scene:hover { color: var(--text); border-color: var(--accent); }
.tl-track { position: relative; height: 58px; border-radius: 6px; background: var(--bg); cursor: pointer; touch-action: none; user-select: none; }
.tl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tl-markers { position: absolute; left: 0; right: 0; bottom: 6px; height: 14px; }
.tl-marker {
  position: absolute; bottom: 0; width: 12px; height: 12px; margin-left: -6px; padding: 0;
  border: 2px solid var(--bg); border-radius: 50%; background: var(--open); cursor: pointer; z-index: 2;
}
.tl-marker.range { height: 10px; margin-left: 0; border-radius: 5px; border-width: 1px; min-width: 10px; opacity: 0.85; }
.tl-marker.status-fixed { background: var(--fixed); }
.tl-marker.status-approved { background: var(--approved); }
.tl-marker.status-reopened { background: var(--reopened); }
.tl-marker.selected { box-shadow: 0 0 0 2px var(--accent); z-index: 3; }
.tl-marker:hover { transform: scale(1.25); }
.tl-marker.range:hover { transform: scaleY(1.3); }
.tl-playhead { position: absolute; left: 0; top: 0; bottom: 0; width: 0; pointer-events: none; will-change: transform; z-index: 4; }
.tl-playhead span { position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.tl-playhead span::before { content: ""; position: absolute; left: -5px; top: -2px; border: 6px solid transparent; border-top-color: var(--accent); }

/* ---------- dialogs ---------- */

.dlg {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text);
}
.dlg-wide { width: min(640px, calc(100vw - 32px)); }
.dlg-keys { width: min(880px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(5, 6, 9, 0.6); }
.dlg-form { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 18px; }
.dlg-head h2 { font-size: 16px; }
.dlg-body { padding: 4px 18px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--border); }
.dlg-text { color: var(--text); white-space: pre-wrap; }
.dlg-label { display: flex; flex-direction: column; gap: 5px; }
.dlg-label > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.dlg-label small, .fieldset small { color: var(--muted); font-size: 12px; }
.dlg textarea.field { width: 100%; resize: vertical; }
.dlg .field.mono { font-size: 12px; line-height: 1.5; white-space: pre; }
.form-grid { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row .field { flex: 1; min-width: 0; }
.fps-custom { max-width: 120px; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.fieldset legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.logo-row label.btn { cursor: pointer; }
.logo-preview { max-width: 120px; max-height: 48px; border-radius: 4px; background: #fff; padding: 3px; }
.inline-alert { color: var(--danger); font-size: 13px; }
.danger-zone .btn { align-self: flex-start; }
.keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.keys-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; align-items: center; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- toasts ---------- */

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  max-width: min(420px, calc(100vw - 32px)); padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--raised-2); color: var(--text);
  opacity: 0; transform: translateY(6px); transition: opacity 0.18s, transform 0.18s; pointer-events: auto;
}
.toast.show { opacity: 1; transform: none; }
.toast-ok { border-color: rgba(62, 207, 142, 0.6); }
.toast-warn { border-color: rgba(242, 179, 61, 0.7); }
.toast-error { border-color: rgba(255, 93, 93, 0.7); }

/* ---------- narrow screens: stacked editor ---------- */

@media (max-width: 1180px) {
  :root { --panel-w: 300px; }
  .btn-label { display: none; }
  .reviewer input { width: 110px; }
}

@media (max-width: 900px) {
  .review { height: auto; min-height: 100vh; display: block; }
  .topbar { flex-wrap: wrap; position: sticky; top: 0; z-index: 25; }
  .title-input { order: 1; flex-basis: calc(100% - 50px); max-width: none; }
  .reviewer { order: 2; }
  #fps-badge { order: 3; }
  .save-state { order: 4; }
  .topbar-actions { order: 5; }
  .editor { display: flex; flex-direction: column; }
  .rail { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 6px; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .rail-group { flex-direction: row; }
  .swatches { display: flex; }
  .rail-sep { width: 1px; height: 24px; }
  .stage { flex: none; height: auto; aspect-ratio: 16 / 9; max-height: 70vh; min-height: 0; }
  .center { order: 1; }
  #timeline { order: 2; }
  .panel { order: 3; border-left: 0; border-top: 1px solid var(--border); }
  .note-list { overflow: visible; }
  .steps { grid-template-columns: 1fr; }
  .keys { grid-template-columns: 1fr; }
  .tp-right { margin-left: 0; }
}

@media (max-width: 520px) {
  .home-main h1 { font-size: 24px; }
  .tp-volume { display: none; }
  .reviewer input { width: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- renders (desktop app only) ---------- */

.renders-btn.busy { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.renders { min-height: 100%; display: flex; flex-direction: column; }
.renders-title { font-size: 17px; }
.renders-main { width: 100%; max-width: 900px; margin: 0 auto; padding: 8px 24px 64px; display: flex; flex-direction: column; gap: 22px; }
.rv-section { display: flex; flex-direction: column; gap: 10px; }
.rv-section h2 { font-size: 15px; }
.rv-film h3 { font-size: 14px; display: flex; align-items: baseline; gap: 10px; min-width: 0; margin: 4px 0 8px; }
.rv-film h3 small { font-weight: 400; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rv-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.rv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rv-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-main small { color: var(--muted); font-size: 12px; }
.rv-pos { min-width: 30px; color: var(--muted); font-size: 12px; }
.rv-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.rv-state { font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); min-width: 84px; }
.rv-done .rv-state { color: var(--fixed); }
.rv-failed .rv-state, .rv-interrupted .rv-state { color: var(--danger); }
.rv-error { margin: 6px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--bg); border: 1px solid rgba(255, 93, 93, 0.35); color: var(--text); font: 11px/1.5 var(--mono); white-space: pre-wrap; max-height: 180px; overflow: auto; }
.rv-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.rv-card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rv-card .rv-state { min-width: 0; color: var(--accent); }
.rv-card.rv-waiting .rv-state, .rv-card.rv-paused .rv-state { color: var(--open); }
.rv-bar { height: 6px; border-radius: 3px; background: var(--raised-2); overflow: hidden; }
.rv-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.2s linear; }
.rv-progress { font-size: 12px; color: var(--muted); }
.rv-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-preset { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.rv-preset select { height: 28px; }
.dlg-render .render-modes .check { white-space: normal; }
.render-range .field { width: 90px; flex: none; }
.render-power { flex-wrap: wrap; gap: 14px; }
.render-out { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 8px; font-size: 12px; }
.render-plan { font-size: 13px; color: var(--muted); min-height: 20px; }
.render-plan.bad { color: var(--open); }
.render-film { font-size: 13px; }
.render-grid { grid-template-columns: minmax(0, 1fr); }
.render-grid .dlg-label, .render-grid .row { min-width: 0; }
.render-grid .row .render-out { flex: 1; min-width: 0; }
