/* RailInspector.Demo — сдержанный стиль для ноутбука и проектора. Цвета меток — как в Core/Rendering/OverlayStyle.cs. */
:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --border: #dde2e8;
  --text: #1c2128;
  --text-2: #5f6b78;
  --accent: #2563a8;
  --accent-bg: #e7effa;
  --now-bg: #fff6d6;
  --now-border: #e6c15a;
  --crack: #FF3B30;
  --spall: #FFB300;
  --joint: #4FC3F7;
  --soft: #D04BFF;
  --radius: 10px;
  --gutter: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --video-h: min(74vh, 920px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1317; --surface: #171c22; --surface-2: #1d232b; --border: #2a323c; --text: #e7eaee; --text-2: #9aa5b1;
    --accent: #7fb2ff; --accent-bg: #1b2a40; --now-bg: #3a3214; --now-border: #8a7320;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1317; --surface: #171c22; --surface-2: #1d232b; --border: #2a323c; --text: #e7eaee; --text-2: #9aa5b1;
  --accent: #7fb2ff; --accent-bg: #1b2a40; --now-bg: #3a3214; --now-border: #8a7320;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-2); }
button, select, input { font: inherit; color: inherit; }
::selection { background: var(--accent-bg); }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; color: var(--text); flex: none; }
.brand .sub { font-size: 12px; color: var(--text-2); margin-top: -1px; }
.facts { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); flex: 1; }
.facts .curve { background: var(--accent-bg); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-weight: 600; font-size: 13px; }
.facts b { color: var(--text); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a { padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--text-2); }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn { background: none; border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); margin-left: 6px; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

.banner { margin: var(--gutter) var(--gutter) 0; padding: 12px 14px; border-radius: var(--radius); background: #fdecec; color: #8b1a1a; border: 1px solid #f3b9b9; }
:root[data-theme="dark"] .banner { background: #3a1818; color: #ffb4b4; border-color: #6b2b2b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner { background: #3a1818; color: #ffb4b4; border-color: #6b2b2b; } }

main { padding: var(--gutter); display: grid; gap: 28px; max-width: 1800px; margin: 0 auto; }

/* ---------- карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 600; }

/* ---------- плеер ---------- */
.player { display: grid; grid-template-columns: auto minmax(280px, 1fr) minmax(360px, 440px); gap: var(--gutter); align-items: start; }
.video-col { min-width: 0; }
.video-wrap { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.video-wrap video { display: block; height: var(--video-h); width: auto; max-width: 100%; aspect-ratio: 9 / 16; background: #000; }
.video-missing { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: #ddd; background: #1a1a1a; }
.toolbar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 10px; }
.btn-group { display: inline-flex; gap: 6px; }
.btn { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer; box-shadow: var(--shadow); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; min-width: 132px; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.readout { font-family: var(--mono); font-size: 13px; color: var(--text-2); display: inline-flex; gap: 6px; flex-wrap: wrap; }
.readout .ro-time { color: var(--text); font-weight: 600; }
.readout .sep { opacity: .5; }
.ctl { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.ctl select { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; }
.ctl.check input { width: 15px; height: 15px; accent-color: var(--accent); }
.keys { font-size: 12px; margin-top: 8px; max-width: 520px; }

/* ---------- колонка пояснений ---------- */
.info-col { display: grid; gap: var(--gutter); min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--text-2); }
.chip.selected { border-color: var(--accent); background: var(--accent-bg); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.dot.crack, .dot.slit, .dot.field { background: var(--crack); }
.dot.spall { background: var(--spall); }
.dot.joint { background: var(--joint); }
.dot.soft { background: var(--soft); }

.defect-card .kind-bar { display: inline-block; width: 6px; height: 22px; border-radius: 3px; margin-right: 10px; vertical-align: middle; }
.defect-card h2.title { font-size: 20px; text-transform: none; letter-spacing: -0.01em; color: var(--text); display: flex; align-items: center; }
.defect-card h2.title .kind-name { font-weight: 500; color: var(--text-2); margin-left: 8px; font-size: 15px; }
.defect-card .state { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--now-bg); border: 1px solid var(--now-border); white-space: nowrap; }
.facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 10px 0; }
.facts-grid div { min-width: 0; }
.facts-grid dt { font-size: 12px; color: var(--text-2); }
.facts-grid dd { margin: 1px 0 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.facts-grid dd .muted { font-weight: 400; font-size: 12px; }
.hint { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--text); }
.actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1; text-align: center; }

.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.swatch { flex: none; width: 34px; height: 22px; margin-top: 1px; border-radius: 3px; position: relative; }
.swatch.box.crack { border: 2px solid var(--crack); }
.swatch.box.spall { border: 2px solid var(--spall); }
.swatch.box.joint { border: 2px solid var(--joint); }
.swatch.line.crack::after { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; background: var(--crack); transform: rotate(-20deg); }
.note { font-size: 12px; color: var(--text-2); margin-top: 8px; }

/* ---------- список ---------- */
.list-col { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; max-height: calc(var(--video-h) + 76px); }
.list-head { padding: 12px 14px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.filter { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px; user-select: none; }
.filter .n { font-variant-numeric: tabular-nums; color: var(--text-2); }
.filter.on { background: var(--accent-bg); border-color: var(--accent); }
.filter.on .n { color: var(--text); }
.filter:not(.on) { opacity: .6; }
.filter.all { font-weight: 600; }
.search-row { display: flex; gap: 6px; margin-bottom: 6px; }
.search-row input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.search-row input:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.list-cols, .row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 68px 92px 50px; gap: 8px; align-items: center; }
.list-cols { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 4px 6px 6px; border-bottom: 1px solid var(--border); }
.num { text-align: right; }
.list { overflow-y: auto; flex: 1; padding: 4px 6px 8px; min-height: 160px; }
.list:focus { outline: none; }
.row { padding: 5px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; font-variant-numeric: tabular-nums; }
.row:hover { background: var(--surface-2); }
.row .lbl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.row .kind { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .pos, .row .size, .row .score { text-align: right; white-space: nowrap; }
.row .score { color: var(--text-2); }
.row.now { background: var(--now-bg); border-color: var(--now-border); }
.row.selected { outline: 2px solid var(--accent); outline-offset: -1px; }
.row.hidden { display: none; }
.empty { padding: 20px; text-align: center; color: var(--text-2); }

/* ---------- карта ---------- */
.map-head, .section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.map-head h2 { font-size: 15px; }
.map-head .muted { font-size: 13px; }
.map { display: grid; gap: 6px; }
.map .map-head + .map-box + .map-head { margin-top: 10px; }
.map-box { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 10px; }
.map-box canvas { display: block; width: 100%; cursor: crosshair; touch-action: none; }
.map-tip { position: absolute; top: 4px; left: 0; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 12px; padding: 3px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; font-variant-numeric: tabular-nums; z-index: 5; }

.foot { padding: 20px var(--gutter) 28px; text-align: center; color: var(--text-2); font-size: 12px; }

/* ---------- адаптивность ---------- */
@media (max-width: 1280px) {
  .player { grid-template-columns: auto minmax(280px, 1fr); }
  .list-col { grid-column: 1 / -1; max-height: 70vh; }
}
@media (max-width: 860px) {
  :root { --video-h: min(60vh, 640px); }
  .player { grid-template-columns: 1fr; }
  .video-wrap { width: 100%; }
  .video-wrap video { width: 100%; height: auto; max-height: 80vh; object-fit: contain; }
  .facts { display: none; }
  .list-cols, .row { grid-template-columns: 60px minmax(0, 1fr) 62px 86px; }
  .row .score, .list-cols span:last-child { display: none; }
}
@media (max-width: 560px) {
  .nav a { display: none; }
  .facts-grid { grid-template-columns: 1fr; }
}

/* Рабочий экран: видео и дефекты рядом на ноутбуке, пояснения — под просмотром. */
:root { --bg: #edf0ef; --surface-2: #f4f6f5; --accent: #176655; --accent-bg: #e4f1eb; --radius: 8px; --font: "Aptos", "Trebuchet MS", "Segoe UI", sans-serif; --video-h: min(68vh, 700px); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #101715; --surface: #18211e; --surface-2: #1e2a25; --border: #314038; --text: #edf3ef; --text-2: #acbcb2; --accent: #8dd5b8; --accent-bg: #213b30; }
}
:root[data-theme="dark"] { --bg: #101715; --surface: #18211e; --surface-2: #1e2a25; --border: #314038; --text: #edf3ef; --text-2: #acbcb2; --accent: #8dd5b8; --accent-bg: #213b30; }
html { scroll-padding-top: 84px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip-link { position: fixed; top: -70px; left: 16px; z-index: 100; padding: 10px; background: var(--surface); }
.skip-link:focus { top: 8px; }
.top { padding-top: 13px; padding-bottom: 13px; }
main { max-width: 1680px; gap: 32px; }
.intro { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 10px 0 0; }
.eyebrow { color: var(--text-2); font-size: 10px; font-weight: 700; letter-spacing: .14em; display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.intro h2 { font-size: clamp(23px, 2.4vw, 36px); line-height: 1.15; font-weight: 600; letter-spacing: -.035em; }
.intro p { color: var(--text-2); margin-top: 8px; max-width: 800px; }
.intro-link { font-size: 13px; white-space: nowrap; }
.intro-link span { margin-left: 10px; }
.facts { flex: 0 0 100%; display: flex; gap: 0; padding: 13px 0; margin-top: 5px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.facts > span { padding: 0 22px; border-right: 1px solid var(--border); }
.facts > span:first-child { padding-left: 0; }
.facts > span:last-child { border: 0; }
.facts .curve { border-radius: 0; background: transparent; }
.player { grid-template-columns: minmax(280px, .9fr) minmax(470px, 1.1fr); gap: 20px; }
.video-wrap { width: 100%; border: 1px solid #26372f; background: #0b100e; }
.video-wrap video { width: 100%; height: var(--video-h); max-height: none; object-fit: contain; }
.inspection-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.now-card { padding: 10px 14px; }
.now-card .card-head { margin-bottom: 6px; }
.list-col { max-height: 340px; min-height: 225px; flex: 1; }
.list { min-height: 130px; }
.row { min-height: 33px; font-size: 13px; }
.row:focus-visible { outline-offset: -3px; }
.list-cols, .row { grid-template-columns: 60px minmax(70px, 1fr) 66px 94px 48px; gap: 5px; }
.chip { padding: 2px 8px; font-size: 12px; }
.defect-card { min-height: 152px; }
.defect-card .facts-grid { grid-template-columns: 1fr 1fr 1fr; gap: 7px 12px; }
.defect-card .facts-grid dd { font-size: 13px; }
.defect-card .facts-grid dd .muted { display: block; font-size: 10px; }
.defect-card h2.title { font-size: 18px; }
.actions .btn { font-size: 12px; padding: 5px 8px; }
.hint { font-size: 12px; }
.btn.primary { color: var(--surface); }
.legend { padding: 17px 20px; }
.legend-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.legend-list li { font-size: 12px; }
.legend .note { display: inline-block; margin-right: 20px; max-width: 700px; }
.section-head h2 { font-size: 24px; letter-spacing: -.025em; }
.foot { border-top: 1px solid var(--border); text-align: left; }
@media (max-width: 1100px) {
  .player { grid-template-columns: minmax(260px, .75fr) minmax(450px, 1.25fr); }
  .list-col { grid-column: auto; }
  .intro-link { display: none; }
  .facts > span { padding: 0 12px; }
  .legend-list { grid-template-columns: 1fr 1fr; gap: 16px; }
}
@media (max-width: 780px) {
  .player { grid-template-columns: 1fr; }
  .video-wrap video { height: min(65vh, 650px); }
  .facts { display: flex; flex-wrap: wrap; gap: 8px 0; font-size: 12px; }
  .facts > span { padding: 0 10px; }
  .facts .curve { flex: 0 0 100%; border: 0; }
  .facts > span:nth-child(2) { padding-left: 0; }
  .list-col { max-height: 360px; }
  .legend { padding: 14px; }
  .defect-card .facts-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .list-cols, .row { grid-template-columns: 54px minmax(60px, 1fr) 58px 88px; }
  .row .score, .list-cols span:last-child { display: none; }
  .nav a { display: none; }
  .nav a:first-child { display: block; }
  .intro p { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Рабочее место просмотра видео. */
main { gap: 16px; }
.compact-intro { padding: 0; }
.compact-intro .facts { margin: 0; border-top: 0; padding: 8px 0 14px; }
.player { grid-template-columns: minmax(320px, 1fr) minmax(420px, 1fr); }
.video-console { border: 1px solid #35483f; border-radius: 8px; overflow: hidden; background: #101713; color: #edf3ef; }
.viewer-heading { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #2b3b32; font-size: 12px; color: #b8c8bf; }
.viewer-light { width: 6px; height: 6px; background: #75c2a3; border-radius: 50%; }
.zoom-readout { margin-left: auto; font-family: var(--mono); font-size: 11px; }
.video-stage { position: relative; height: clamp(340px, 61vh, 740px); width: 100%; overflow: hidden; background: #060907; cursor: grab; touch-action: none; user-select: none; }
.video-stage.dragging { cursor: grabbing; }
.video-stage:focus-visible { outline-offset: -3px; }
#video { position: absolute; width: 1px; height: 1px; left: 0; top: 0; opacity: 0; pointer-events: none; }
#video.fallback-video { opacity: 1; max-width: none; max-height: none; transform-origin: 0 0; }
#videoCanvas { width: 100%; height: 100%; display: block; }
.video-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #c0d0c6; background: #0b100e; font-size: 13px; pointer-events: none; }
.compare-badge { position: absolute; top: 12px; left: 12px; padding: 5px 10px; border: 1px solid #ffffff40; background: #101713dd; border-radius: 4px; color: #fff; font-size: 12px; pointer-events: none; }
.player-controls { padding: 10px 12px 12px; border-top: 1px solid #2b3b32; display: grid; gap: 10px; }
.seekbar { display: flex; align-items: center; gap: 12px; }
.seekbar output { font: 11px var(--mono); color: #b8c8bf; font-variant-numeric: tabular-nums; }
input[type=range] { accent-color: var(--accent); cursor: pointer; min-width: 0; }
#timeline { appearance: none; -webkit-appearance: none; flex: 1; height: 6px; margin: 0; border-radius: 3px; background: linear-gradient(to right, #8dd5b8 var(--progress,0%), #35483f var(--progress,0%)); accent-color: #8dd5b8; }
#timeline::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 14px; height: 14px; border: 2px solid #101713; border-radius: 50%; background: #a8e6cc; }
#timeline::-moz-range-thumb { width: 12px; height: 12px; border: 2px solid #101713; border-radius: 50%; background: #a8e6cc; }
.transport-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.player-controls .btn { background: #202f26; border-color: #3d5044; color: #edf3ef; box-shadow: none; padding: 6px 10px; font-size: 12px; min-height: 32px; }
.player-controls .btn:hover { background: #30483a; }
.player-controls .btn.primary { background: #81c9a9; color: #0c281a; border-color: #81c9a9; min-width: 123px; font-weight: 600; }
.player-controls .btn[aria-pressed=true] { border-color: #8dd5b8; color: #c9f7e3; }
.speed-ctl select { background: #202f26; color: #edf3ef; border: 1px solid #3d5044; border-radius: 5px; padding: 5px 3px; font-size: 12px; }
.view-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.zoom-tools { margin-right: auto; }
.icon-tool { display: grid; place-items: center; min-width: 32px; }
.icon-tool svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.viewer-footer { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 10px; }
.viewer-footer .readout { font-size: 11px; }
.viewer-footer .ctl { font-size: 12px; }
.keys { font-size: 11px; margin-top: 7px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.panel-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.panel-tab { cursor: pointer; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-2); padding: 8px 18px 10px; font-size: 14px; }
.panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.defects-pane { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.inspection-panel { gap: 10px; }
.list-col { max-height: 360px; }
.list-cols, .row { grid-template-columns: 60px minmax(80px, 1fr) 70px 110px; }
.list-cols span:last-child { display: block; }
.image-pane { padding: 16px 18px; }
.image-pane-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.image-pane-head h2 { font-size: 16px; }
.mode-control { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); }
.mode-control select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; flex: 1; min-width: 0; }
.image-presets { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 20px; }
.image-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 24px; }
.image-control { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; min-width: 0; font-size: 13px; }
.image-control output { font-size: 12px; font-family: var(--mono); color: var(--text-2); }
.image-control input { width: 100%; grid-column: 1/-1; margin: 0; height: 18px; }
.image-control input:disabled { cursor: not-allowed; opacity: .4; }
.image-bottom { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#compareOriginal { user-select: none; touch-action: none; font-size: 12px; }
#compareOriginal[aria-pressed=true] { background: var(--accent-bg); border-color: var(--accent); }
.image-note { font-size: 12px; margin-top: 14px; }
.compact-legend { display: flex; flex-wrap: wrap; gap: 6px 24px; color: var(--text-2); font-size: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.compact-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.compact-legend .swatch { width: 18px; height: 12px; margin: 0; }
.compact-legend .swatch.line::after { left: 0; right: 0; }
#player:fullscreen, #player.expanded { width: 100vw; height: 100dvh; max-width: none; padding: 16px; background: var(--bg); overflow: auto; align-items: start; }
#player.expanded { position: fixed; inset: 0; z-index: 100; }
#player:fullscreen .video-stage, #player.expanded .video-stage { height: calc(100dvh - 230px); min-height: 260px; }
#player:fullscreen .inspection-panel, #player.expanded .inspection-panel { max-height: calc(100dvh - 32px); overflow: auto; }
#player:fullscreen .list-col, #player.expanded .list-col { max-height: calc(100dvh - 440px); min-height: 200px; }
@media (min-width: 1600px) { .video-stage { height: min(67vh, 850px); } .list-col { max-height: 420px; } }
@media (max-width: 1000px) { .player { grid-template-columns: minmax(300px, 1fr) minmax(380px, 1fr); gap: 16px; } .image-sliders { grid-template-columns: 1fr; gap: 16px; } .list-cols, .row { grid-template-columns: 54px minmax(70px,1fr) 58px 88px; font-size: 12px; } }
@media (max-width: 780px) {
  .player { grid-template-columns: 1fr; }
  .video-stage { height: min(64vh, 640px); min-height: 300px; }
  .image-sliders { grid-template-columns: 1fr 1fr; }
  #player:fullscreen .inspection-panel, #player.expanded .inspection-panel { max-height: none; overflow: visible; }
  .panel-tabs { position: sticky; top: 64px; background: var(--bg); z-index: 2; }
  #player:fullscreen .panel-tabs, #player.expanded .panel-tabs { top: -16px; }
}
@media (max-width: 430px) {
  .player-controls { padding: 10px 8px; }
  .transport { gap: 4px; }
  .player-controls .transport .btn { padding: 6px 7px; }
  .player-controls .btn.primary { min-width: 110px; }
  .seekbar { gap: 8px; }
  .seekbar output { font-size: 10px; }
  .transport-row { gap: 4px; }
  .speed-ctl select { padding-left: 2px; padding-right: 0; }
  .view-tools { gap: 4px; }
  .player-controls .view-tools .btn { padding-left: 8px; padding-right: 8px; }
  .image-pane { padding: 14px; }
  .image-sliders { gap: 20px 16px; }
  .image-control { font-size: 12px; }
  .image-control output { font-size: 11px; }
  .image-bottom { gap: 10px; }
  .compact-legend { gap: 8px 16px; }
}

@media (max-width:430px) { .transport-row { flex-wrap: wrap; } }

.player-controls { grid-template-columns: minmax(0,1fr); }
.seekbar, .transport-row, .view-tools { min-width: 0; max-width: 100%; }
