/* Rayos X · IIM — consola oscura, acento naranjo (orgánico) y azul (metal). */
:root {
  --bg: #0a0e13;
  --bg2: #0f151c;
  --panel: #131b24;
  --panel2: #18222d;
  --line: #233140;
  --line2: #2f4152;
  --text: #e7edf3;
  --muted: #93a4b6;
  --dim: #66788b;
  --accent: #ff8a1f;
  --accent-2: #ffb15e;
  --metal: #4f8dff;
  --ok: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  /* categorías */
  --c-permitido: #34d399;
  --c-prohibido: #f59e0b;
  --c-mp: #ef4444;
  --c-peligroso: #e879f9;
  --c-retenido: #38bdf8;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 70% -10%, #13202c 0%, transparent 60%);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h2, h3 { margin: 0; line-height: 1.25; }
kbd { font: 12px var(--mono); background: var(--panel2); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }

/* ------------------------------------------------------------- cabecera */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: rgba(10, 14, 19, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand strong { display: block; font-size: 15px; letter-spacing: .02em; }
.brand small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.modes { margin-left: auto; display: flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.modes button {
  border: 0; background: none; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.modes button[aria-selected="true"] { background: var(--accent); color: #1a0d00; }
.modes button:not([aria-selected="true"]):hover { color: var(--text); }

.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px; color: var(--text);
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { border-color: var(--line2); background: var(--panel2); }
.guide-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-2); }

/* --------------------------------------------------------------- layout */
.layout { display: flex; align-items: flex-start; }
.main {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px;
  padding: 16px; max-width: 1500px; margin: 0 auto;
}

/* --------------------------------------------------------------- monitor */
.monitor {
  background: linear-gradient(#0d131a, #0b1016);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 10px; min-width: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .03);
}
.monitor-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 2px 6px 10px; font: 13px var(--mono); color: var(--muted);
}
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.mb-item { color: var(--text); text-transform: uppercase; letter-spacing: .06em; }
.mb-dim { color: var(--muted); text-transform: none; letter-spacing: 0; }
.mb-spacer { flex: 1; }
.mb-prompt {
  font-family: var(--font); font-size: 14px; color: #1a0d00; background: var(--accent);
  border-radius: 999px; padding: 2px 12px; font-weight: 700;
}
.mb-timer, .mb-score {
  font: 700 18px var(--mono); color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 2px 10px; font-variant-numeric: tabular-nums;
}
.mb-timer.low { color: var(--bad); border-color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.stage {
  position: relative; aspect-ratio: 4 / 3;
  width: min(100%, calc((100vh - 230px) * 4 / 3));
  min-width: 280px;
  margin: 0 auto; border-radius: 10px; overflow: hidden;
  background: #000; cursor: crosshair; user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.stage.busy { cursor: progress; }
.stage.locked { cursor: default; }

/* polígonos y marcas */
.obj { fill-opacity: .14; stroke-width: 4; vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: fill-opacity .15s; }
.obj.dashed { stroke-dasharray: 8 6; }
.obj.sel { fill-opacity: .32; stroke-width: 5; }
.obj.reveal { fill-opacity: .1; stroke-dasharray: 10 6; animation: dash 1.2s linear infinite; }
.obj.found { fill-opacity: .18; }
.obj.flash { animation: flash 1.1s ease-out 1; }
@keyframes dash { to { stroke-dashoffset: -32; } }
@keyframes flash { 0% { fill-opacity: .55; } 100% { fill-opacity: .18; } }
.cat-permitido { --c: var(--c-permitido); }
.cat-prohibido { --c: var(--c-prohibido); }
.cat-mp { --c: var(--c-mp); }
.cat-peligroso { --c: var(--c-peligroso); }
.cat-retenido { --c: var(--c-retenido); }
.obj { fill: var(--c, #fff); stroke: var(--c, #fff); }
.obj.wrongcat { stroke-dasharray: 2 7; stroke-linecap: round; }
.tag-svg rect { fill: rgba(8, 11, 15, .82); }
.tag-svg text { fill: #fff; font: 600 22px var(--font); }
.mark-ok circle { fill: none; stroke: var(--ok); stroke-width: 4; vector-effect: non-scaling-stroke; }
.mark-bad path { stroke: var(--bad); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mark-pick circle { fill: var(--accent); stroke: #000; stroke-width: 2; }
.mark { animation: fadeout 1.6s ease-in forwards; }
.mark-pick { animation: none; }
@keyframes fadeout { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }

/* popover de respuesta */
.popover {
  position: absolute; z-index: 5; width: 330px; max-width: calc(100% - 16px);
  background: rgba(17, 24, 32, .97); border: 1px solid var(--line2); border-radius: 12px;
  padding: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .55); cursor: default;
}
.popover h4 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.answer-row + .answer-row { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line2); }
.answer-row input[type=text] {
  width: 100%; background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px;
}
.answer-row input[type=text]:focus { border-color: var(--accent); outline: none; }
.catpick { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.catpick button {
  border: 1px solid var(--line2); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 600;
}
.catpick button::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 1px; }
.catpick button[aria-pressed="true"] { color: #071016; background: var(--c); border-color: var(--c); }
.catpick button[aria-pressed="true"]::before { background: #071016; }
.pop-actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.pop-actions .grow { flex: 1; }
.linkish { white-space: nowrap; background: none; border: 0; color: var(--accent-2); padding: 0; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

/* portada de desafío sobre el monitor */
.stage-cover {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; text-align: center;
  background: rgba(6, 9, 12, .78); backdrop-filter: blur(3px); cursor: default; padding: 16px;
}
.cover-card { max-width: 460px; }
.cover-card h2 { font-size: clamp(22px, 3vw, 30px); margin-bottom: 8px; }
.cover-card p { color: var(--muted); margin: 0 0 16px; }
.big-num { font: 800 clamp(48px, 9vw, 96px)/1 var(--mono); color: var(--accent); }

/* tira de imágenes */
.filmstrip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: thin; }
.filmstrip button {
  flex: none; position: relative; width: 92px; aspect-ratio: 4/3; padding: 0; border: 2px solid transparent;
  border-radius: 8px; overflow: hidden; background: #000; opacity: .72;
}
.filmstrip button:hover { opacity: 1; }
.filmstrip button[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.filmstrip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.filmstrip span {
  position: absolute; left: 4px; bottom: 3px; font: 600 10px var(--mono); background: rgba(0,0,0,.7); padding: 0 4px; border-radius: 4px;
}
.filmstrip .sep { flex: none; width: 1px; background: var(--line2); margin: 6px 2px; }

/* ------------------------------------------------------------- panel */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
  position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto;
}
.panel h2 { font-size: 18px; }
.panel .lead { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 7px; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 16px; font-weight: 700;
  background: var(--accent); color: #1a0d00;
}
.btn:hover { background: var(--accent-2); }
.btn.ghost { background: var(--panel2); color: var(--text); border-color: var(--line2); font-weight: 600; }
.btn.ghost:hover { border-color: var(--dim); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font: 700 20px var(--mono); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.progress { height: 8px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: width .3s; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feed li {
  border-left: 3px solid var(--line2); background: var(--bg2); border-radius: 0 8px 8px 0; padding: 7px 10px; font-size: 13.5px;
}
.feed li:first-child { animation: slidein .2s ease-out; }
.feed li.ok { border-color: var(--ok); }
.feed li.bad { border-color: var(--bad); }
.feed li.info { border-color: var(--metal); }
.feed li.warn { border-color: var(--warn); }
.feed li small { display: block; color: var(--muted); margin-top: 2px; }
@keyframes slidein { from { transform: translateY(-4px); opacity: 0; } }

.badge {
  display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700;
  color: #071016; background: var(--c);
}
.badge.mp { background: repeating-linear-gradient(-45deg, var(--c-mp) 0 7px, #c22f2f 7px 14px); color: #fff; }

.found-list, .obj-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.found-list li, .obj-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.obj-list button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 8px; padding: 5px 8px;
}
.obj-list button:hover, .obj-list button[aria-pressed="true"] { background: var(--bg2); border-color: var(--line2); }
.badge.pv-badge { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line2); font-weight: 600; }

.questions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.questions button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-weight: 600;
}
.questions button:hover:not(:disabled) { border-color: var(--line2); }
.questions button[aria-pressed="true"] { border-color: var(--accent); background: #22180d; }
.questions button:disabled { cursor: default; opacity: .75; }
.questions .q-state { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line2); flex: none; display: grid; place-items: center; font-size: 12px; }
.questions .done .q-state { background: var(--ok); border-color: var(--ok); color: #04130c; }
.questions .revealed .q-state { background: var(--warn); border-color: var(--warn); color: #1a1200; }
.questions .q-name { flex: 1; }

.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.card h3 { font-size: 16px; margin-bottom: 4px; }
.card p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend button { border: 1px solid var(--line2); background: var(--bg2); border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 12.5px; color: var(--text); }
.legend button::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 0; }
.legend button[aria-pressed="false"] { opacity: .4; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.best { font-size: 13px; color: var(--muted); }
.best b { color: var(--text); }

/* ---------------------------------------------------------------- guía */
.guide {
  width: 380px; flex: none; position: sticky; top: 57px; height: calc(100vh - 57px);
  background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.guide-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.guide-head h2 { font-size: 17px; }
.guide-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 12px; border-bottom: 1px solid var(--line); }
.guide-tabs button {
  border: 1px solid var(--line2); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600;
}
.guide-tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.guide-tabs .hazard-tab { border-color: rgba(239, 68, 68, .55); color: #fca5a5; }
.guide-tabs .hazard-tab[aria-selected="true"] { background: var(--c-mp); border-color: var(--c-mp); color: #fff; }
.guide-body { overflow: auto; padding: 14px 16px 40px; flex: 1; }
.guide-body section > * + * { margin-top: 10px; }
.guide-body h3 { font-size: 15px; margin-top: 18px; }
.guide-body section > h3:first-child { margin-top: 0; }
.guide-body p, .guide-body li, .guide-body dd { font-size: 14px; color: #c7d2dd; }
.guide-body .note { font-size: 13px; color: var(--muted); border-left: 2px solid var(--line2); padding-left: 10px; }
.zrow { display: flex; gap: 10px; align-items: flex-start; }
.zrow .sw { width: 34px; height: 34px; border-radius: 8px; flex: none; border: 1px solid rgba(255,255,255,.15); }
.z-org .sw { background: linear-gradient(135deg, #f7a24b, #e2711d); }
.z-mix .sw { background: linear-gradient(135deg, #8bd17c, #3f9d5a); }
.z-met .sw { background: linear-gradient(135deg, #5b8cff, #1d3fbf); }
.z-opq .sw { background: #050608; }
.steps, .look { padding-left: 20px; margin: 0; }
.steps li + li, .look li + li { margin-top: 6px; }
.cats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.cats li { border-left: 4px solid var(--c); background: var(--panel); border-radius: 0 10px 10px 0; padding: 8px 10px; }
.cats b { display: block; color: var(--text); }
.cats span { display: block; font-size: 13.5px; color: var(--muted); }
.hazard-banner {
  display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(239,68,68,.18), rgba(239,68,68,.06)); border: 1px solid rgba(239,68,68,.45);
}
.hazard-banner div { font-size: 14px; color: #fde2e2; }
.diamond {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; transform: rotate(45deg);
  background: var(--c-mp); border-radius: 4px; color: #fff;
}
.hazard-banner .diamond { font-size: 0; position: relative; }
.hazard-banner .diamond::after { content: "2"; transform: rotate(-45deg); font: 800 18px var(--mono); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line2); background: var(--panel); border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--text); }
.chips button:hover { border-color: var(--accent); }
.modes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.modes-grid button { padding: 0; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: #000; position: relative; aspect-ratio: 4/3; }
.modes-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modes-grid span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; font-weight: 700; background: rgba(0,0,0,.72); padding: 2px 4px; }
.defs { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.defs dt { font-weight: 700; font-size: 13.5px; }
.defs dd { margin: 0; }
.search { width: 100%; background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; }
.lib-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.lib-list button {
  width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; background: none; border: 0; border-radius: 6px; padding: 5px 6px; font-size: 14px;
}
.lib-list button:hover { background: var(--panel); }
.lib-list .n { font: 12px var(--mono); color: var(--dim); width: 24px; text-align: right; }
.tag { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 0 5px; text-transform: uppercase; }
.tag-mp { background: var(--c-mp); color: #fff; }
.tag-fl { background: var(--c-prohibido); color: #1a1200; }
.slides-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.slides-grid button { padding: 0; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; background: #fff; aspect-ratio: 1982/1071; }
.slides-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ------------------------------------------------------------ diálogos */
.dlg {
  border: 1px solid var(--line2); border-radius: 16px; background: var(--panel); color: var(--text);
  padding: 22px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.dlg::backdrop { background: rgba(3, 5, 8, .7); backdrop-filter: blur(2px); }
.res-head { text-align: center; }
.res-head .eyebrow { font: 600 12px var(--mono); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.res-nota { font: 800 72px/1 var(--mono); margin: 8px 0 2px; }
.res-nota.aprob { color: var(--ok); }
.res-nota.reprob { color: var(--bad); }
.res-rec { display: inline-block; margin-top: 6px; padding: 3px 12px; border-radius: 999px; font-weight: 700; background: var(--panel2); border: 1px solid var(--line2); }
.res-rec.l1 { border-color: var(--ok); color: var(--ok); }
.res-rec.l2 { border-color: var(--accent); color: var(--accent-2); }
.res-rec.l3 { background: linear-gradient(90deg, var(--accent), #ffd28a); color: #1a0d00; border: 0; }
.res-list { list-style: none; padding: 0; margin: 18px 0; display: flex; flex-direction: column; gap: 6px; }
.res-list li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; font-size: 14px; }
.res-list b { font-family: var(--mono); }
.res-alert { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.45); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.res-ok { background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.4); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.viewer { width: min(1200px, calc(100vw - 24px)); padding: 12px; }
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 700; }
.viewer-head div { display: flex; gap: 6px; }
.viewer img { display: block; width: 100%; max-height: calc(100vh - 120px); object-fit: contain; background: #fff; border-radius: 8px; }
.noscript { padding: 20px; text-align: center; }

/* ----------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .guide { position: fixed; left: 0; top: 57px; z-index: 25; box-shadow: 20px 0 50px rgba(0,0,0,.5); }
}
@media (max-width: 1080px) {
  .main { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  .stage { width: 100%; }
}
@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .brand small { display: none; }
  .modes { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
  .modes button { flex: 1; padding: 6px 8px; font-size: 13.5px; }
  .guide-toggle span { display: none; }
  .guide { width: 100%; top: 0; height: 100vh; z-index: 40; }
  .main { padding: 10px 16px 24px; gap: 12px; }
  .monitor { padding: 6px; border-radius: 12px; }
  .stage { min-width: 0; }
  .popover {
    position: fixed; left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-width: none; z-index: 50;
    background: var(--panel);
  }
  .filmstrip button { width: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
