/* CaFra Fútbol · tema "cuaderno de cancha": blanco puro, tinta casi negra, marcador amarillo para lo
   seleccionado, verde cancha para la acción principal. Pensado para leerse al sol en una tablet.
   Pantalla despejada como TacticalPad: la cancha ocupa todo y hay UNA barra abajo que cambia según el modo. */
/* fuentes incluidas en la app, para que funcione sin señal */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("../assets/fonts/barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-700.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-semi-condensed-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-semi-condensed-700.woff2") format("woff2"); }

:root {
  --bg: oklch(1 0 0);
  --surface: oklch(0.965 0.004 95);       /* superficies secundarias */
  --surface-2: oklch(0.93 0.006 95);      /* hover */
  --line: oklch(0.85 0.007 95);
  --line-strong: oklch(0.7 0.01 95);
  --ink: oklch(0.2 0.012 95);
  --muted: oklch(0.44 0.012 95);
  --marker: oklch(0.87 0.165 92);         /* seleccionado / activo */
  --marker-line: oklch(0.62 0.13 78);
  --pitch: oklch(0.46 0.125 150);         /* acción principal */
  --pitch-hover: oklch(0.4 0.115 150);
  --danger: oklch(0.53 0.2 27);
  --pass: oklch(0.72 0.16 85);
  --board-bg: oklch(0.93 0.008 140);      /* alrededor de la cancha */
  --shadow: oklch(0.2 0.012 95 / 0.22);

  --r: 8px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-cond: "Barlow Semi Condensed", var(--font);
  --z-float: 2;
  --z-panel: 10;
  --z-modal: 30;
  --z-loading: 40;
  --z-gate: 50;

  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }

.ic {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tone-pass { color: var(--pass); }
.tone-shot { color: var(--danger); }

/* ---------- botones (un solo vocabulario en toda la app) ---------- */
button {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r);
  min-height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
button:hover { background: var(--surface-2); }
button:active { background: var(--line); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
button:disabled { opacity: 0.35; cursor: default; }

.btn {
  background: var(--bg);
  border-color: var(--line);
  font-weight: 600;
}
.btn.icon { padding: 0; width: 44px; }
.btn.primary, button.primary {
  background: var(--pitch);
  border-color: var(--pitch);
  color: #fff;
}
.btn.primary:hover { background: var(--pitch-hover); }
.tone-danger { color: var(--danger); }

/* activo / seleccionado = marcador amarillo */
button.active, .steps button.active {
  background: var(--marker);
  border-color: var(--marker-line);
  color: var(--ink);
}
button.active .ic { color: var(--ink); }

kbd {
  margin-left: auto;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 600 11px var(--font);
  color: var(--muted);
}

/* ---------- vistas ---------- */
.view { position: fixed; inset: 0; display: flex; flex-direction: column; }
body[data-view="2d"] #viewer-view,
body[data-view="3d"] #editor-view { display: none; }

.canvas-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--board-bg); }
.canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
#viewer-view .canvas-wrap { background: #a9cfe6; }
#board { -webkit-touch-callout: none; }

.sep { flex: none; width: 1px; align-self: stretch; margin: 8px 4px; background: var(--line); }
.grow { flex: 1; }

/* avisos: flotan sobre la cancha y solo existen mientras hay algo que decir */
.status {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-float);
  max-width: min(640px, calc(100% - 200px));
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 0 2px 10px var(--shadow);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.status:empty { display: none; }
.status.flash { background: var(--marker); border-color: var(--marker-line); font-weight: 600; }

/* ---------- escudos de los equipos, como en TacticalPad ---------- */
.team-badge {
  position: absolute;
  top: 10px;
  z-index: var(--z-float);
  flex-direction: column;
  gap: 3px;
  width: 66px;
  min-height: 62px;
  padding: 6px 2px;
  background: var(--bg);
  border-color: var(--line);
  box-shadow: 0 2px 10px var(--shadow);
  font-size: 11px;
  font-weight: 600;
}
.team-badge-l { left: 10px; }
#team-pop { width: 230px; }
#export-pop { width: 270px; }
.pop-title { margin: 4px 8px 6px; font: 700 14px var(--font-cond); color: var(--muted); }
.export-check { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; cursor: pointer; }
.export-check input { width: 20px; height: 20px; accent-color: var(--pitch); }
#team-pop .chip { width: 20px; height: 20px; }
.team-badge .chip { width: 26px; height: 26px; }
.chip { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); flex: none; display: inline-block; }

/* paso actual, a mano mientras se dibuja */
.step-pill {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: var(--z-float);
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 2px 10px var(--shadow);
  font: 600 15px var(--font-cond);
  font-variant-numeric: tabular-nums;
}
.step-pill button { width: 42px; padding: 0; }
.step-pill span { padding: 0 2px; white-space: nowrap; }
body[data-mode="anim"] .step-pill { display: none; }

/* ---------- la barra de abajo ---------- */
.bar, .bar-row { display: flex; align-items: center; min-width: 0; }
/* alto fijo: cambiar de modo nunca mueve la cancha */
.bar { flex: none; height: 61px; gap: 6px; padding: 5px 8px; background: var(--bg); border-top: 1px solid var(--line); }
.modes { flex: none; display: flex; gap: 2px; padding-right: 6px; border-right: 1px solid var(--line); }
.bar-row { flex: 1; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.bar-row::-webkit-scrollbar { display: none; }

.modes button, .bar-row > button:not(.btn):not(.tray-team) {
  flex: none;
  flex-direction: column;
  gap: 1px;
  width: 58px;
  min-height: 50px;
  padding: 2px 0;
  font-size: 11px;
  font-weight: 600;
}
.bar-3d { flex: none; min-height: 50px; padding: 0 14px; }
.collapse { flex: none; width: 34px; padding: 0; color: var(--muted); }

/* solo se ve la fila del modo elegido */
.bar-row[data-panel] { display: none; }
body[data-mode="file"] .bar-row[data-panel="file"],
body[data-mode="draw"] .bar-row[data-panel="draw"],
body[data-mode="team"] .bar-row[data-panel="team"],
body[data-mode="anim"] .bar-row[data-panel="anim"] { display: flex; }

/* Menú: siempre con nombre (hay lugar y los íconos solos no se distinguen) */
.bar-row[data-panel="file"] > button:not(.btn) { width: auto; min-width: 56px; padding: 2px 8px; }
.bar-row[data-panel="file"] > button:not(.btn) > span { display: inline !important; }
.bar-row[data-panel="file"] > .boards-btn:not(.btn) { flex-direction: row; gap: 7px; max-width: 220px; }
.bar-row[data-panel="file"] > .boards-btn:not(.btn) > span { display: flex !important; }
.boards-text { display: flex; flex-direction: column; min-width: 0; max-width: 170px; text-align: left; line-height: 1.15; }
.boards-text b { overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.boards-text small { font-size: 12px; font-weight: 500; color: var(--muted); }

.style-dot { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--ink); }

/* bandeja de jugadores */
.tray-team { flex: none; min-height: 50px; padding: 0 8px; }
.tray-team .chip { width: 22px; height: 22px; }
.tray-team .chev { width: 16px; height: 16px; }
.tray { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 2px 4px; }
.tray-chip {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line-strong);
  font-weight: 700;
  font-size: 16px;
  touch-action: none;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.45);
}
.tray-chip.placed { opacity: 0.3; touch-action: manipulation; }
.drag-ghost {
  position: fixed;
  z-index: var(--z-modal);
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 6px 18px var(--shadow);
  background-color: var(--bg);
  pointer-events: none;
}
.tray-chip.drag-ghost { background-color: transparent; }
.popover.dragging { opacity: 0; pointer-events: none; }

/* animación: los pasos como frames */
.steps { display: flex; flex: 0 1 auto; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 0 4px; }
.steps button { flex: none; min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: var(--bg); font: 600 15px var(--font-cond); }
.pb-step { flex: none; min-width: 70px; padding: 0 8px; font: 600 15px var(--font-cond); font-variant-numeric: tabular-nums; white-space: nowrap; }
.seek { flex: 0 1 300px; min-width: 80px; accent-color: var(--pitch); height: 32px; }
.playbar .btn { flex: none; }
.bar-row.playbar { gap: 4px; }

/* reproduciendo: la barra pasa a ser solo los controles, y no queda nada encima de la cancha */
.playbar2d { display: none; }
body.playing2d .playbar2d { display: flex; }
body.playing2d .bar-row[data-panel],
body.playing2d .modes,
body.playing2d .team-badge,
body.playing2d .step-pill,
body.playing2d .edge-tab { display: none !important; }

/* ocultar la barra: solo la cancha */
body.hide-bar .bar,
body.hide-bar .team-badge,
body.hide-bar .step-pill { display: none; }
body.panel-closed .panel { display: none; }
.edge-tab {
  display: none;
  position: absolute;
  z-index: var(--z-float);
  right: 16px;
  bottom: 0;
  width: 56px;
  min-height: 32px;
  padding: 0;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 2px 10px var(--shadow);
}
body.hide-bar [data-show="bar"] { display: inline-flex; }

/* ---------- panel lateral: flota encima de la cancha y arranca cerrado ---------- */
.panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-panel);
  width: min(320px, 92vw);
  overflow-y: auto;
  padding: 18px 18px 24px;
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px var(--shadow);
  -webkit-user-select: text;
  user-select: text;
}
.panel-close { position: absolute; top: 10px; right: 10px; min-height: 40px; }
.panel section + section { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.panel h2, .modal h2 { margin: 0 0 12px; font: 700 18px var(--font-cond); }
.panel label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.panel input:not([type="checkbox"]), .panel select, .panel textarea {
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--ink);
  font: 400 15px var(--font);
}
.panel textarea { resize: vertical; line-height: 1.4; }
.panel .check { display: flex; align-items: center; gap: 10px; }
.panel .check input { width: 20px; height: 20px; accent-color: var(--pitch); }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
.row > * { flex: 1; }
.row.end { justify-content: flex-end; }
.row.end > * { flex: 0 0 auto; }
.note { margin: 10px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted); }

.field-label { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.field-label span { font-weight: 400; }
.team-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 12px; }
.team-grid button { min-height: 44px; padding: 0; border: 1px solid var(--line); background: var(--bg); }
.team-grid button.active { background: var(--marker); border-color: var(--marker-line); }
.team-grid .chip { width: 24px; height: 24px; }

/* ---------- vista 3D ---------- */
.dock { flex: none; padding: 5px 8px; background: var(--bg); border-top: 1px solid var(--line); }
.dock .bar-row { gap: 4px; }
.dock .btn { flex: none; }
#pb-speed { min-width: 48px; padding: 0 6px; }

/* grabación de video */
#scene.recording { object-fit: contain; background: #000; }
.recbar { display: none; gap: 12px; font-weight: 600; }
body.is-recording .recbar { display: flex; }
body.is-recording .dock .playbar { display: none; }
.rec-dot { flex: none; width: 12px; height: 12px; margin-left: 4px; border-radius: 50%; background: var(--danger); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* ---------- modal de video y carga ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 16px;
  background: oklch(0.2 0.012 95 / 0.45);
}
.modal-box {
  width: min(720px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 20px 50px var(--shadow);
}
.modal-box video { width: 100%; border-radius: var(--r); background: #000; }

.loading {
  position: fixed;
  inset: 0;
  z-index: var(--z-loading);
  display: grid;
  place-items: center;
  background: var(--bg);
  font: 600 18px var(--font);
  transition: opacity 200ms ease-out;
}
.loading.done { opacity: 0; pointer-events: none; }

/* ---------- cuenta: pantalla de entrada (account.js) ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: var(--z-gate);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: var(--bg);
}
.gate-box { width: min(420px, 100%); text-align: center; }
.gate-logo { display: block; margin: 0 auto 10px; border-radius: 16px; }
.gate h1 { margin: 0 0 16px; font: 700 30px var(--font-cond); }
.gate h2 { margin: 0 0 8px; font: 700 22px var(--font-cond); }
.gate p { margin: 0 0 14px; font-size: 16px; line-height: 1.45; }
.gate label { display: block; margin-bottom: 12px; text-align: left; font-size: 14px; font-weight: 600; }
.gate input {
  width: 100%;
  height: 50px;
  margin-top: 5px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font: 500 18px var(--font);
}
#acc-code { font-size: 26px; letter-spacing: 0.3em; text-align: center; }
.gate section .btn { width: 100%; min-height: 50px; margin-bottom: 8px; font-size: 16px; }
.gate .file-list { text-align: left; }
.gate .file-list .btn { width: auto; min-height: 40px; margin: 0 8px 0 0; font-size: 14px; }
#acc-msg:empty { display: none; }
#acc-msg.error { color: var(--danger); font-weight: 600; }
.acc-who { margin: 0 0 4px; font-weight: 600; }
.acc-state { margin: 0 0 14px; color: var(--muted); }
.acc-state[data-state="active"] { color: var(--pitch); font-weight: 600; }
.acc-state[data-state="expired"] { color: var(--danger); font-weight: 600; }
.gate-lang { position: absolute; top: 16px; right: 16px; min-height: 40px; }
.lang-row { display: flex; gap: 6px; }
#acc-dev-list li { cursor: default; }
#acc-dev-list li:hover { background: none; }
#acc-dev-list .btn { margin-right: 8px; }

/* ---------- ventanas: Abrir / Guardar como y Tableros ---------- */
.sheet {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 20px 50px var(--shadow);
}
.sheet-wide { width: min(760px, calc(100vw - 24px)); }
.sheet::backdrop { background: oklch(0.2 0.012 95 / 0.45); }
.sheet h2 { margin: 0 0 12px; font: 700 20px var(--font-cond); }
.sheet label { display: block; font-size: 14px; font-weight: 600; }
.sheet label input {
  width: 100%;
  height: 44px;
  margin-top: 5px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  color: var(--ink);
  font: 500 16px var(--font);
}
.sheet-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.sheet-tools .note { width: 100%; margin: 4px 0 0; }
.sheet .row.end { margin-top: 12px; }

.file-list { list-style: none; max-height: 42dvh; overflow-y: auto; margin: 12px 0; padding: 0; border-top: 1px solid var(--line); }
.file-list li { display: flex; align-items: center; gap: 6px; min-height: 52px; padding-left: 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.file-list li:hover { background: var(--surface); }
.file-list li.current { background: var(--marker); }
.file-list li span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-list b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-list small { font-size: 13px; color: var(--muted); }
.file-list li.current small { color: var(--ink); }
.file-list li button { width: 44px; padding: 0; color: var(--muted); }
.file-list li button:hover { color: var(--danger); }

.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; max-height: 58dvh; overflow-y: auto; padding: 3px; }
.board-grid button { flex-direction: column; align-items: stretch; gap: 4px; padding: 6px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; white-space: normal; }
.board-grid button.active { border: 2px solid var(--marker-line); background: var(--marker); padding: 5px; }
.board-grid canvas { width: 100%; aspect-ratio: 200 / 136; display: block; border-radius: 4px; }
.board-grid span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }

/* ---------- desplegables de la barra ---------- */
.popover {
  position: fixed;
  z-index: var(--z-modal);
  width: min(340px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 14px 40px var(--shadow);
}
.popover-colors { width: min(300px, calc(100vw - 24px)); }
.popover-list { width: 220px; display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.popover-list button { justify-content: flex-start; font-weight: 600; }
.popover-style { width: min(330px, calc(100vw - 24px)); max-height: calc(100dvh - 90px); display: flex; flex-direction: column; gap: 6px; }
.style-title { margin: 6px 0 0; font: 700 14px var(--font-cond); color: var(--muted); }
.style-row { display: flex; gap: 6px; }
.style-row [data-zfill], .style-row [data-opt] { flex: 1; padding: 0 6px; border-color: var(--line); font-weight: 600; font-size: 14px; }
.swatch {
  flex: none;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--c) !important;
}
.swatch.active { outline: 2px solid var(--ink); outline-offset: 2px; border-color: var(--line-strong); }
.popover input[type="search"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font: 400 16px var(--font);
  color: var(--ink);
}
.mat-cat { margin: 12px 4px 6px; font: 700 14px var(--font-cond); color: var(--muted); }
.mat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.mat-grid button { justify-content: flex-start; border: 1px solid var(--line); background: var(--bg); font-weight: 500; }
/* panel de materiales: todos a la vista, para arrastrarlos a la cancha */
#mat-list .mat-grid { grid-template-columns: repeat(3, 1fr); }
#mat-list .mat-grid button { flex-direction: column; justify-content: center; gap: 2px; min-height: 62px; padding: 4px 2px; font-size: 13px; }
#mat-list .mat-grid .ic { width: 28px; height: 28px; }
.mat-empty { padding: 14px 6px 6px; color: var(--muted); }

/* ---------- acciones rápidas (toque largo / clic derecho) ---------- */
.quick {
  position: fixed;
  z-index: var(--z-modal);
  min-width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 14px 40px var(--shadow);
}
.quick button { justify-content: flex-start; font-weight: 600; padding: 0 14px; }
.quick .tone-danger:hover { background: oklch(0.95 0.03 27); }

.text-input {
  position: fixed;
  z-index: var(--z-modal);
  width: 260px;
  height: 46px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  background: var(--bg);
  font: 600 18px var(--font);
  color: var(--ink);
  box-shadow: 0 10px 30px var(--shadow);
}

/* ---------- video (js/video.js) ---------- */
body[data-view="video"] #editor-view,
body[data-view="video"] #viewer-view,
body:not([data-view="video"]) #video-view { display: none; }
.video-wrap { background: #111; }
#vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #111; }
#v-draw { pointer-events: none; }
#video-view[data-vmode="dibujar"] #v-draw { pointer-events: auto; cursor: crosshair; }
#video-view.no-video .vdock .bar-row,
#video-view.no-video .v-timeline { visibility: hidden; }
.vdock { flex: none; background: var(--bg); border-top: 1px solid var(--line); }
.vdock .bar { border-top: 0; }
.v-timeline { display: flex; align-items: center; gap: 10px; padding: 4px 10px 0; }
.v-name { flex: 0 1 auto; max-width: 22%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 14px var(--font-cond); }
.v-track { position: relative; flex: 1; min-width: 0; display: flex; }
.v-track .seek { flex: 1; max-width: none; position: relative; z-index: 1; }
.v-ticks { position: absolute; left: 8px; right: 8px; top: 0; bottom: 0; pointer-events: none; }
.v-ticks i { position: absolute; top: 3px; width: 3px; height: 9px; margin-left: -1.5px; border-radius: 2px; }
.ic-txt { display: block; height: 22px; font: 700 17px/22px var(--font-cond); }
.bar-row[data-vpanel] { display: none; }
#video-view[data-vmode="ver"] [data-vpanel="ver"],
#video-view[data-vmode="marcar"] [data-vpanel="marcar"],
#video-view[data-vmode="dibujar"] [data-vpanel="dibujar"] { display: flex; }
#video-view .modes [data-view-btn] { color: var(--muted); }
#v-speed { font: 700 16px var(--font-cond); }
.v-tags { display: flex; gap: 4px; }
.v-tags button { flex: none; flex-direction: column; gap: 3px; min-height: 50px; min-width: 64px; padding: 2px 8px; border: 1px solid var(--line); background: var(--bg); font-size: 12px; font-weight: 600; }
.tag-dot { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--c); }
.v-list-btn, .vdock [data-v-library] { flex: none; min-height: 50px; }
.count:not(:empty) { min-width: 20px; padding: 0 5px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 12px; line-height: 20px; }
.v-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-float);
  width: min(440px, calc(100% - 32px));
  padding: 22px;
  border-radius: 12px;
  background: var(--bg);
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.v-card h2 { margin: 6px 0 8px; font: 700 22px var(--font-cond); }
.v-card p { margin: 0 0 16px; line-height: 1.45; color: var(--muted); }
.v-card-ic { width: 40px; height: 40px; }
.row.center { justify-content: center; }
.row.center > * { flex: 0 0 auto; }
.v-marks {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-panel);
  width: min(320px, 86vw);
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.25);
}
.v-marks-head { display: flex; align-items: center; justify-content: space-between; }
.v-marks-head h2 { margin: 0; font: 700 18px var(--font-cond); }
.v-filter { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.chip-btn { min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 600; gap: 6px; }
.chip-btn .tag-dot { width: 10px; height: 10px; }
.v-marks-list { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.v-marks-list li { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.mark-go { flex: 1; justify-content: flex-start; gap: 10px; min-height: 48px; padding: 0 8px; }
.mark-go b { min-width: 52px; font: 700 16px var(--font-cond); font-variant-numeric: tabular-nums; text-align: left; }
.v-marks-list .btn.icon { border: 0; color: var(--muted); }
.file-list li .file-open { flex: 1; width: auto; min-width: 0; flex-direction: column; align-items: flex-start; gap: 0; padding: 4px 0; color: var(--ink); }
.file-list li .file-open:hover { color: var(--ink); background: transparent; }
.file-list li .file-open b { max-width: 100%; }

/* ---------- sesión impresa: solo se ve al imprimir ---------- */
.print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { height: auto; overflow: visible; background: #fff; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block; color: #000; font: 11pt var(--font); }
  .ps-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-bottom: 6px; border-bottom: 2px solid #000; }
  .ps-head h1 { margin: 0; font: 700 22pt var(--font-cond); }
  .ps-head p { margin: 0; text-align: right; }
  .ps-mat { margin: 6px 0 10px; }
  .ps-board { display: grid; grid-template-columns: 58% 1fr; gap: 10px 14px; padding: 10px 0; border-bottom: 1px solid #999; break-inside: avoid; }
  .ps-board h2 { grid-column: 1 / -1; display: flex; justify-content: space-between; margin: 0; font: 700 14pt var(--font-cond); }
  .ps-board img { width: 100%; border: 1px solid #999; }
  .ps-board .ps-notes { margin: 0; white-space: pre-wrap; line-height: 1.4; }
  .ps-board .ps-meta { margin: 8px 0 0; font-size: 9.5pt; color: #333; white-space: pre-line; }
}

/* ---------- pantallas angostas: solo íconos en la fila del modo ---------- */
@media (max-width: 1240px) {
  .bar-row { gap: 1px; }
  .sep { margin: 8px 2px; }
  .bar-row:not([data-panel="file"]) > button:not(.btn):not(.tray-team) { width: 44px; }
  .bar-row:not([data-panel="file"]) > button:not(.btn):not(.tray-team) > span { display: none; }
  .bar-row[data-panel="file"] > button:not(.btn) { padding: 2px 5px; }
  .bar-row[data-panel="file"] > .boards-btn:not(.btn) { gap: 4px; max-width: 130px; }
  .boards-text { max-width: 84px; }
  .modes button { width: 50px; }
  .bar-row:not([data-panel="file"]) > button:not(.btn):not(.tray-team) { width: 42px; }
  .bar-3d { padding: 0 10px; }
  /* el video tiene la barra para él solo: conserva los nombres hasta tablet vertical */
  #video-view .bar-row > button:not(.btn) { width: 54px; }
  #video-view .bar-row > button:not(.btn) > span { display: inline; }
}
@media (max-width: 900px) {
  kbd { display: none; }
  #video-view .bar-row > button:not(.btn) { width: 44px; }
  #video-view .bar-row > button:not(.btn) > span, .v-hide-narrow, .v-name { display: none; }
  .v-tags button { min-width: 0; padding: 2px 5px; font-size: 11px; }
  /* Menú en tablet vertical: más apretado, "Guardar como" en dos renglones */
  .bar-row[data-panel="file"] > button:not(.btn) { min-width: 0; padding: 2px 3px; font-size: 10.5px; }
  #f-saveas > span { white-space: normal; max-width: 48px; line-height: 1; text-align: center; }
  .bar-row[data-panel="file"] > .boards-btn:not(.btn) { max-width: 104px; }
  .boards-text { max-width: 66px; }
  .modes button > span { display: none; }
  .modes button { width: 44px; }
  .team-badge { width: 54px; min-height: 52px; font-size: 10px; }
}

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