@import url('../../../../../font/fonts.css');

/* ==========================================================================
   Taller 3D — hoja de estilos
   Paleta clara, paneles compactos, área de trabajo blanca/gris con cuadrícula azul tenue.
   ========================================================================== */

:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --line: #dde3ea;
  --line-2: #c9d2dd;
  --text: #1d2733;
  --text-2: #5b6878;
  --text-3: #8a96a5;
  --accent: #1f6feb;
  --accent-2: #e8f0fe;
  --accent-ink: #0b4fc4;
  --danger: #d93a3a;
  --danger-2: #fdecec;
  --ok: #138a52;
  --ok-2: #e5f6ee;
  --warn: #b26a00;
  --warn-2: #fff4e0;
  --hole: #8a95a3;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .08);
  --shadow-lg: 0 10px 40px rgba(16, 24, 40, .18);
  --topbar-h: 96px;
  --lib-w: 288px;
  --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --field: #ffffff;
  --vp-bg: #f4f6f9;
  --accent-line: #c6dafc;
  --danger-line: #f2c4c4;
  --ok-ink: #0d5c37;
  --warn-ink: #7a4800;
  --danger-ink: #8f1f1f;
  color-scheme: light;
  color-scheme: light;
}

/* ---------------------------------------------------------- modo oscuro */
:root[data-theme="dark"] {
  --bg: #0f141b;
  --panel: #161d27;
  --panel-2: #1d2633;
  --line: #2a3443;
  --line-2: #3a4657;
  --text: #e6edf5;
  --text-2: #a9b6c6;
  --text-3: #7c899b;
  --accent: #4c8dff;
  --accent-2: rgba(76, 141, 255, .16);
  --accent-ink: #9cc0ff;
  --accent-line: rgba(76, 141, 255, .45);
  --danger: #ff6b6b;
  --danger-2: rgba(255, 107, 107, .14);
  --danger-line: rgba(255, 107, 107, .4);
  --danger-ink: #ffb4b4;
  --ok: #3ccf8e;
  --ok-2: rgba(60, 207, 142, .14);
  --ok-ink: #8ef0c0;
  --warn: #f5b042;
  --warn-2: rgba(245, 176, 66, .14);
  --warn-ink: #ffd99a;
  --hole: #8a95a3;
  --field: #1a222d;
  --vp-bg: #121821;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
:root[data-theme="dark"] .dim-label { box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .rot-handle path { stroke: #e6edf5; }
:root[data-theme="dark"] .rot-handle path.h { stroke: rgba(15, 20, 27, .85); }
:root[data-theme="dark"] .rot-handle path.tip { fill: #e6edf5; stroke: rgba(15, 20, 27, .85); }
:root[data-theme="dark"] .rot-readout, :root[data-theme="dark"] .ruler-label { background: #e6edf5; color: #10161e; }
:root[data-theme="dark"] .project-name:focus, :root[data-theme="dark"] .insp-name:focus { background: var(--field); }


* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* --------------------------------------------------------------- iconos */
i[data-icon] { display: inline-flex; width: 18px; height: 18px; flex: 0 0 auto; }
i[data-icon] svg { width: 100%; height: 100%; }
.chev { width: 12px !important; height: 12px !important; opacity: .6; margin-left: 2px; }

/* ----------------------------------------------------------- barra sup. */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 20;
  flex: 0 0 auto;
}
.tb-row { display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.tb-row1 { height: 50px; border-bottom: 1px solid var(--line); }
.tb-row2 { height: 46px; overflow-x: auto; scrollbar-width: thin; }
.tb-spacer { flex: 1 1 auto; min-width: 6px; }

.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); padding-right: 6px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .2px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.brand img { object-fit: contain; border-radius: 6px; }

.project { display: flex; align-items: center; gap: 8px; min-width: 0; }
.project-name {
  border: 1px solid transparent; background: transparent; border-radius: var(--radius-sm);
  padding: 5px 8px; font-weight: 700; font-size: 15px; width: 240px; max-width: 32vw;
  text-overflow: ellipsis;
}
.project-name:hover { border-color: var(--line); }
.project-name:focus { outline: none; border-color: var(--accent); background: var(--field); box-shadow: 0 0 0 3px var(--accent-2); }
.save-state { font-size: 12px; color: var(--text-3); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.project { flex: 0 1 auto; overflow: hidden; }
.project-name { flex: 0 1 auto; min-width: 90px; }
.menus { flex: 0 0 auto; }
.save-state.dirty { color: var(--warn); }

.menus { display: flex; gap: 2px; margin-left: 4px; }
.menu-btn {
  border: 0; background: transparent; padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 600;
}
.menu-btn:hover, .menu-btn.open { background: var(--panel-2); color: var(--text); }
.menu-link { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.menu-link i[data-icon] { width: 16px; height: 16px; }
.boot-warn {
  position: fixed; left: 50%; top: 60px; transform: translateX(-50%); z-index: 400; max-width: min(620px, 92vw);
  background: var(--warn-2); color: var(--warn-ink); border: 1px solid var(--warn); border-radius: 10px;
  padding: 10px 40px 10px 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; line-height: 1.45;
}
.boot-warn kbd { background: var(--field); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; font: inherit; font-weight: 800; }
.boot-warn button { position: absolute; right: 8px; top: 6px; border: 0; background: transparent; font-size: 20px; color: inherit; cursor: pointer; }
.theme-btn { border: 0; background: transparent; width: 34px; height: 32px; border-radius: var(--radius-sm); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.theme-btn:hover { background: var(--panel-2); color: var(--text); }
.theme-btn .ic-sun, :root[data-theme="dark"] .theme-btn .ic-moon { display: none; }
/* configuración: solo en el PC del docente (stlBiblioteca pone .t3d-docente en <html>) */
.cfg-btn { display: none; }
:root.t3d-docente .cfg-btn { display: inline-flex; }
.cfg-sec { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 6px; margin-bottom: 12px; background: var(--panel); }
.cfg-sec h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent-ink); }
.cfg-row { display: grid; grid-template-columns: 210px 1fr; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px dashed var(--line); }
.cfg-sec h4 + .cfg-row, .cfg-sec h4 + div > .cfg-row:first-child { border-top: 0; }
.cfg-lbl { font-weight: 700; color: var(--text-2); font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.cfg-lbl small { font-weight: 600; color: var(--text-3); font-size: 11.5px; }
.cfg-val { font-weight: 600; color: var(--text); }
.cfg-val a, .cfg-id a { color: var(--accent-ink); font-weight: 700; text-decoration: none; }
.cfg-chk { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 4px 0; }
.cfg-sel { height: 30px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--field); color: var(--text); padding: 0 8px; font-weight: 700; }
.cfg-mini { padding: 3px 9px; margin-left: 6px; }
.cfg-seg { display: inline-flex; }
.cfg-note { margin: 6px 0; color: var(--text-3); font-size: 12px; line-height: 1.45; }
.cfg-id { display: flex; gap: 14px; align-items: center; padding: 4px 0 8px; }
.cfg-id img { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; background: var(--panel-2); padding: 4px; }
.cfg-id b { display: block; font-size: 17px; }
.cfg-id span { display: block; font-size: 12.5px; color: var(--text-2); margin: 2px 0 4px; line-height: 1.4; }
.cfg-foot { margin: 4px 2px 0; font-size: 11.5px; color: var(--text-3); }
@media (max-width: 640px) { .cfg-row { grid-template-columns: 1fr; gap: 4px; } }
:root[data-theme="dark"] .theme-btn .ic-sun { display: block; }

.mode-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-2); color: var(--accent-ink); font-weight: 700; font-size: 12px; white-space: nowrap;
}
.mode-chip i { width: 15px; height: 15px; }
.tb-actions { display: flex; gap: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-sm);
  padding: 7px 12px; border: 1px solid var(--line-2); background: var(--field); font-weight: 700; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--panel-2); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-2); border-color: var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-2); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: default; }

.tool-group { display: flex; align-items: center; gap: 2px; }
.tool-sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; flex: 0 0 auto; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; min-width: 34px; justify-content: center;
  border: 1px solid transparent; background: transparent; border-radius: var(--radius-sm); padding: 0 7px;
  color: var(--text-2); font-weight: 600; white-space: nowrap;
}
.tool:hover:not([disabled]) { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.tool.active { background: var(--accent-2); color: var(--accent-ink); border-color: var(--accent-line); }
.tool[disabled] { opacity: .35; cursor: default; }
.tool i { width: 19px; height: 19px; }

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; border-radius: 7px;
  padding: 5px 10px; color: var(--text-2); font-weight: 700; font-size: 12.5px; white-space: nowrap;
}
.seg-btn i { width: 16px; height: 16px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--field); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(16,24,40,.12); }

/* ---------------------------------------------------- área de trabajo */
.workspace { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }
.viewport { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; background: var(--vp-bg); }
#scene3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
.overlay-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.marquee { position: absolute; border: 1px solid var(--accent); background: rgba(31, 111, 235, .08); pointer-events: none; }

/* etiquetas de cotas */
.dim-label {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto;
  background: var(--field); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px;
  font-size: 12px; font-weight: 700; color: var(--text); box-shadow: 0 1px 4px rgba(16,24,40,.15);
  white-space: nowrap; cursor: text; user-select: none;
}
.dim-label:hover { border-color: var(--accent); color: var(--accent-ink); }
.dim-label input { width: 64px; border: 0; outline: none; font-weight: 700; font-size: 12px; padding: 0; background: transparent; }
.dim-label.dx { border-bottom: 2px solid #e5484d; }
.dim-label.dy { border-bottom: 2px solid #30a46c; }
.dim-label.dz { border-bottom: 2px solid #3e63dd; }
.ruler-label {
  position: absolute; transform: translate(-50%, -140%); background: #1d2733; color: #fff; border-radius: 6px;
  padding: 2px 7px; font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none;
}
.rot-handle {
  position: absolute; width: 38px; height: 26px; margin: -13px 0 0 -19px; pointer-events: auto; cursor: grab;
  display: flex; align-items: center; justify-content: center; border-radius: 13px; touch-action: none; user-select: none;
  transition: transform .12s, background-color .12s;
}
.rot-handle svg { width: 34px; height: 22px; overflow: visible; }
.rot-handle path { fill: none; stroke: #2b3542; stroke-width: 2.6; stroke-linecap: round; }
.rot-handle path.h { stroke: rgba(255, 255, 255, .95); stroke-width: 6.5; }
.rot-handle path.tip { fill: #2b3542; stroke: rgba(255, 255, 255, .95); stroke-width: 1.4; stroke-linejoin: round; }
.rot-handle.rot-side svg { transform: rotate(90deg); }
.rot-handle:hover, .rot-handle.active { transform: scale(1.22); background: rgba(31, 111, 235, .1); }
.rot-handle:hover path:not(.h):not(.tip), .rot-handle.active path:not(.h):not(.tip) { stroke: var(--accent); }
.rot-handle:hover path.tip, .rot-handle.active path.tip { fill: var(--accent); }
.rot-handle.active { cursor: grabbing; }
.sz-handle {
  position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; pointer-events: auto; touch-action: none;
  display: flex; align-items: center; justify-content: center; user-select: none;
}
.sz-handle::after {
  content: ''; width: 10px; height: 10px; background: #fff; border: 1.5px solid #3b4654; border-radius: 2px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .35); transition: transform .1s, background-color .1s;
}
.sz-handle.sz-edge::after { width: 7px; height: 7px; background: #2b3542; border-color: #fff; border-width: 1px; }
.sz-handle.sz-corner { cursor: nwse-resize; }
.sz-handle.sz-edge { cursor: ew-resize; }
.sz-handle.sz-top { cursor: ns-resize; }
.sz-handle:hover::after, .sz-handle.active::after { transform: scale(1.35); background: var(--accent); border-color: #fff; }
.sz-handle.dim { opacity: .35; }
.rot-readout {
  position: absolute; pointer-events: none; background: #1d2733; color: #fff; border-radius: 8px; padding: 4px 9px;
  display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; box-shadow: 0 4px 14px rgba(16,24,40,.25);
}
.rot-readout b { font-size: 16px; font-weight: 800; }
.rot-angle {
  position: absolute; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap;
  background: var(--field); color: var(--accent-ink); border: 1.5px solid var(--accent); border-radius: 7px;
  padding: 1px 7px; font-size: 13px; font-weight: 800; box-shadow: 0 1px 4px rgba(16,24,40,.2);
}
.rot-readout span { font-size: 11px; opacity: .75; font-weight: 600; }
.axis-label { position: absolute; transform: translate(-50%, -50%); font-weight: 800; font-size: 12px; pointer-events: none; }

/* columna de navegación */
.nav-col { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 5; }
.viewcube-wrap { width: 120px; height: 120px; }
#viewcube { width: 120px; height: 120px; display: block; cursor: grab; touch-action: none; }
#viewcube.dragging { cursor: grabbing; }
/* barra de navegación: tarjeta blanca vertical, iconos de trazo fino gris pizarra */
.nav-btns {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 46px; padding: 8px 0;
  background: var(--field); border: 0; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 10px rgba(16, 24, 40, .07);
}
.nav-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: transparent;
  border-radius: 9px; color: var(--text-2); transition: background .12s, color .12s;
}
.nav-btn i { width: 20px; height: 20px; display: grid; }
.nav-btn svg { width: 20px; height: 20px; stroke-width: 1.6; }
.nav-btn:hover { background: var(--panel-2); color: var(--text); }
.nav-btn:active { background: var(--line); }
.nav-btn.active { background: var(--accent-2); color: var(--accent-ink); }
.nav-sep { width: 34px; height: 1px; background: var(--line); margin: 4px 0; }

/* «Volver a la Intranet»: flotante en la esquina superior izquierda del área 3D, justo debajo de la
   barra superior (no tapa el logo ni el nombre). En PC solo muestra ← y revela el texto al pasar el
   mouse; en táctil queda como icono con zona cómoda. La columna del cubo baja lo justo para no chocar. */
:root { --volver-h: 32px; }
.t3d-volver {
  position: fixed; z-index: 15;
  top: calc(var(--t3d-topbar, 97px) + 8px);
  left: max(10px, env(safe-area-inset-left));
  height: var(--volver-h); min-width: var(--volver-h); padding: 0 6px;
  display: inline-flex; align-items: center; gap: 0;
  border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .62); color: var(--text-2);
  -webkit-backdrop-filter: blur(8px) saturate(1.3); backdrop-filter: blur(8px) saturate(1.3);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
  text-decoration: none; font-size: 12.5px; font-weight: 700; white-space: nowrap;
  opacity: .55; transition: opacity .15s, background .15s, color .15s, gap .2s;
  -webkit-tap-highlight-color: transparent;
}
:root[data-theme="dark"] .t3d-volver { background: rgba(22, 29, 39, .62); }
.t3d-volver svg { flex: 0 0 auto; }
.t3d-volver-txt {
  max-width: 0; overflow: hidden; opacity: 0;
  transition: max-width .22s ease, opacity .18s ease;
}
.t3d-volver:hover, .t3d-volver:focus-visible, .t3d-volver:active { opacity: 1; color: var(--accent-ink); background: var(--panel); }
.t3d-volver:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .t3d-volver:hover, .t3d-volver:focus-visible { gap: 6px; padding-right: 11px; }
  .t3d-volver:hover .t3d-volver-txt, .t3d-volver:focus-visible .t3d-volver-txt { max-width: 160px; opacity: 1; }
}
@media (pointer: coarse) {
  :root { --volver-h: 40px; }
  .t3d-volver { padding: 0 9px; opacity: .7; }
}
.nav-col { top: calc(var(--volver-h) + 20px); }

/* barra inferior del área */
.vp-status {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; gap: 10px;
  padding: 0 12px 10px; pointer-events: none; z-index: 4;
}
.vp-status > * { pointer-events: auto; }
.hint {
  flex: 1 1 auto; min-width: 0; color: var(--text-2); font-size: 12.5px; padding-left: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none !important;
}
.coords { font-variant-numeric: tabular-nums; color: var(--text-3); font-size: 12px; white-space: nowrap; pointer-events: none !important; }
.grid-ctl {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 5px 8px; box-shadow: var(--shadow); flex: 0 0 auto;
}
.grid-ctl select {
  border: 1px solid var(--line-2); border-radius: 6px; background: var(--field); padding: 3px 4px; font-size: 12.5px; font-weight: 600;
}
.snap-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; cursor: pointer; }
.snap-toggle input { accent-color: var(--accent); }
.chip-btn {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--field); padding: 3px 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip-btn i { width: 15px; height: 15px; }
.warn-chip {
  display: inline-flex; align-items: center; gap: 4px; background: var(--warn-2); color: var(--warn);
  border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}

/* ------------------------------------------------------------ inspector */
.inspector {
  position: absolute; right: 12px; top: 12px; width: 268px; max-height: calc(100% - 80px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 6; display: flex; flex-direction: column; overflow: hidden;
}
.insp-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 10px; border-bottom: 1px solid var(--line); }
.insp-head .type-ico { width: 22px; height: 22px; color: var(--text-2); flex: 0 0 auto; }
.insp-name {
  flex: 1 1 auto; min-width: 0; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px;
  font-weight: 800; font-size: 13.5px; background: transparent;
}
.insp-name:hover { border-color: var(--line); }
.insp-name:focus { outline: none; border-color: var(--accent); background: var(--field); }
.icon-btn {
  width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); flex: 0 0 auto;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.on { color: var(--accent-ink); background: var(--accent-2); }
.icon-btn i { width: 16px; height: 16px; }
.insp-body { overflow-y: auto; padding: 4px 10px 10px; scrollbar-width: thin; }
.insp-sec { padding: 8px 0 6px; border-bottom: 1px solid var(--line); }
.insp-sec:last-child { border-bottom: 0; }
.insp-sec h4 {
  margin: 0 0 6px; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--text-3);
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.kind-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kind-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 6px; border-radius: 8px;
  border: 1.5px solid var(--line-2); background: var(--field); font-weight: 700; font-size: 12.5px; color: var(--text-2);
}
.kind-btn .sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); }
.kind-btn .sw.hole {
  background: repeating-linear-gradient(135deg, #c4ccd6 0 3px, var(--panel-2) 3px 6px);
}
.kind-btn.active { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-2); }
.kind-btn:hover:not(.active) { border-color: var(--text-3); }

.fields { display: grid; gap: 5px; }
.fields.three { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.field > span { font-size: 11px; color: var(--text-2); font-weight: 700; display: flex; align-items: center; gap: 4px; }
.field > span .ax { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.ax-x { background: #e5484d; } .ax-y { background: #30a46c; } .ax-z { background: #3e63dd; }
.num {
  display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 6px; background: var(--field);
  overflow: hidden; height: 28px;
}
.num:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-2); }
.num input {
  border: 0; outline: none; width: 100%; min-width: 0; padding: 0 2px 0 6px; font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; background: transparent; height: 100%;
}
.num input:disabled { color: var(--text-3); }
.num .unit { font-size: 11px; color: var(--text-3); padding-right: 6px; flex: 0 0 auto; }
.row-field { display: grid; grid-template-columns: 1fr 112px; align-items: center; gap: 6px; }
.row-field > span { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.row-field select, .row-field input[type=text], .txt-in {
  width: 100%; border: 1px solid var(--line-2); border-radius: 6px; background: var(--field); height: 28px; padding: 0 6px;
  font-size: 12.5px; font-weight: 600;
}
.row-field select:focus, .txt-in:focus { outline: none; border-color: var(--accent); }
textarea.txt-in { height: auto; min-height: 54px; padding: 5px 6px; resize: vertical; grid-column: 1 / -1; }
.row-field.col { grid-template-columns: 1fr; }
input[type=range] { accent-color: var(--accent); width: 100%; }
.color-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.color-dot {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2);
  padding: 0;
}
.color-dot.sel { box-shadow: 0 0 0 2px var(--accent); }
.color-pick { width: 30px; height: 26px; border: 1px solid var(--line-2); border-radius: 6px; padding: 1px; background: var(--field); }
.insp-info { font-size: 12px; color: var(--text-2); display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; }
.insp-info b { color: var(--text); font-variant-numeric: tabular-nums; }
.lock-ratio { font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--text-2); display: inline-flex; gap: 4px; align-items: center; cursor: pointer; font-weight: 600; }
.lock-ratio input { accent-color: var(--accent); margin: 0; }
.insp-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.insp-collapsed .insp-body { display: none; }
.muted { color: var(--text-3); font-size: 12px; }

/* -------------------------------------------------------- lista escena */
.scene-tree {
  position: absolute; left: 12px; bottom: 56px; width: 250px; max-height: 42%;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  z-index: 5; display: flex; flex-direction: column; overflow: hidden;
}
.tree-head {
  display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--line);
  font-weight: 800; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-2);
}
.tree-head .count { color: var(--text-3); font-weight: 700; }
.tree-head .grow { flex: 1; }
.scene-tree.collapsed .tree-body { display: none; }
.scene-tree.collapsed .tree-head { border-bottom: 0; }
.tree-body { overflow-y: auto; padding: 4px 0; scrollbar-width: thin; }
.tree-empty { padding: 10px 12px; color: var(--text-3); font-size: 12px; }
.tree-row {
  display: flex; align-items: center; gap: 4px; height: 28px; padding-right: 4px; cursor: pointer; user-select: none;
  border-left: 3px solid transparent;
}
.tree-row:hover { background: var(--panel-2); }
.tree-row.sel { background: var(--accent-2); border-left-color: var(--accent); }
.tree-row.child { color: var(--text-2); }
.tree-row.hidden-obj .tree-name { opacity: .45; text-decoration: line-through; }
.tree-caret { width: 16px; height: 16px; display: grid; place-items: center; border: 0; background: transparent; padding: 0; color: var(--text-3); }
.tree-caret i { width: 12px; height: 12px; transition: transform .12s; }
.tree-caret.open i { transform: rotate(90deg); }
.tree-ico { width: 15px; height: 15px; flex: 0 0 auto; border-radius: 4px; }
.tree-ico.hole { background: repeating-linear-gradient(135deg, #b8c1cc 0 2px, var(--panel-2) 2px 4px); border: 1px solid #b8c1cc; }
.tree-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 600; }
.tree-name input { width: 100%; border: 1px solid var(--accent); border-radius: 4px; padding: 1px 4px; font-size: 12.5px; outline: none; }
.tree-act { width: 22px; height: 22px; border: 0; background: transparent; border-radius: 4px; display: grid; place-items: center; color: var(--text-3); opacity: 0; padding: 0; }
.tree-act i { width: 14px; height: 14px; }
.tree-row:hover .tree-act, .tree-act.on { opacity: 1; }
.tree-act:hover { background: var(--field); color: var(--text); }
.tree-act.on { color: var(--warn); }

/* --------------------------------------------------------- biblioteca */
.library {
  width: var(--lib-w); flex: 0 0 var(--lib-w); background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 8;
  transition: margin-right .18s ease;
}
.library.collapsed { margin-right: calc(-1 * var(--lib-w)); }
.lib-toggle {
  position: absolute; left: -26px; top: 12px; width: 26px; height: 40px; border: 1px solid var(--line);
  border-right: 0; border-radius: 8px 0 0 8px; background: var(--panel); display: grid; place-items: center;
  color: var(--text-2); box-shadow: -2px 1px 6px rgba(16,24,40,.06);
}
.lib-toggle i { width: 14px; height: 14px; transform: rotate(-90deg); }
.library.collapsed .lib-toggle i { transform: rotate(90deg); }
.lib-head { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.lib-head select {
  width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 0 8px;
  font-weight: 700; background: var(--field);
}
.lib-search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 0 8px; height: 34px; background: var(--field); }
.lib-search:focus-within, .lib-head select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-2); }
.lib-search i { color: var(--text-3); width: 16px; height: 16px; }
.lib-search input { border: 0; outline: none; width: 100%; background: transparent; }
.lib-grid {
  flex: 1 1 auto; overflow-y: auto; padding: 10px 12px; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 8px; align-content: start; scrollbar-width: thin;
}
.lib-group-title { grid-column: 1 / -1; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--text-3); margin-top: 6px; }
.shape-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 6px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; cursor: grab; user-select: none; min-width: 0;
}
.shape-card:hover { background: var(--panel-2); border-color: var(--line); }
.shape-card:active { cursor: grabbing; }
.shape-card .thumb { width: 64px; height: 64px; display: grid; place-items: center; }
.shape-card .thumb img { width: 64px; height: 64px; display: block; pointer-events: none; }
.shape-card .thumb .ph { width: 36px; height: 36px; border-radius: 8px; background: linear-gradient(135deg, var(--panel-2), var(--line)); }
.shape-card .lbl { font-size: 11.5px; font-weight: 700; text-align: center; line-height: 1.15; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.shape-card .tag { font-size: 9.5px; font-weight: 800; color: var(--accent-ink); background: var(--accent-2); border-radius: 4px; padding: 0 4px; }
.lib-empty { grid-column: 1/-1; color: var(--text-3); text-align: center; padding: 30px 10px; }

/* modelos STL del docente */
.shape-card { position: relative; }
.shape-card .lbl { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.shape-card.is-hidden .thumb { opacity: .45; }
.shape-card.upload-card { cursor: pointer; border: 1.5px dashed var(--line-2); }
.shape-card.upload-card:hover { border-color: var(--accent); background: var(--accent-2); }
.shape-card.upload-card .thumb { color: var(--accent); }
.shape-card.upload-card .thumb i { width: 28px; height: 28px; display: grid; }
.shape-card.upload-card .lbl { color: var(--accent-ink); }
.card-acts {
  position: absolute; top: 2px; right: 2px; display: flex; flex-direction: column; gap: 2px;
  opacity: 0; transition: opacity .12s;
}
.shape-card:hover .card-acts, .shape-card:focus-within .card-acts { opacity: 1; }
.card-act {
  width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line);
  border-radius: 6px; background: var(--panel); color: var(--text-2); cursor: pointer; box-shadow: var(--shadow);
}
.card-act i, .card-act svg { width: 13px; height: 13px; display: block; }
.card-act:hover { color: var(--accent-ink); border-color: var(--accent); }
.card-act:last-child:hover { color: var(--danger); border-color: var(--danger); }
.library.lib-drop .lib-grid { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-2); }
@media (pointer: coarse) { .card-acts { opacity: 1; } }
.card-url {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; background: var(--panel); color: var(--accent); border: 1px solid var(--accent-2);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12); text-decoration: none; z-index: 1;
}
.card-url i, .card-url svg { width: 13px; height: 13px; display: block; }
.card-url:hover, .card-url:focus-visible { background: var(--accent); color: #fff; border-color: var(--accent); outline: none; }
/* formulario Nombre + URL de los modelos */
.model-forms { display: flex; flex-direction: column; gap: 12px; }
.model-form + .model-form { border-top: 1px solid var(--line); padding-top: 12px; }
.model-form .form-grid { margin-top: 6px; }
.model-file { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--text); min-width: 0; }
.model-file i { width: 16px; height: 16px; color: var(--accent); flex: none; }
.model-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbl-url { display: flex; align-items: center; gap: 5px; }
.lbl-url i { width: 14px; height: 14px; color: var(--accent); display: grid; }
.lbl-url em { font-style: normal; font-weight: 600; color: var(--text-3); }
.url-field input { width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: 7px; padding: 0 8px; font-weight: 600; background: var(--field); color: var(--text); }
.url-field input.invalid { border-color: var(--danger); background: var(--danger-2); }
.field-err { color: var(--danger); font-weight: 700; font-size: 11.5px; }

/* ------------------------------------------------------------- regla */
.ruler-card {
  position: absolute; right: 12px; bottom: 60px; width: 230px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 6; padding: 10px;
}
.ruler-card h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.ruler-card h4 i { width: 16px; height: 16px; }
.ruler-card .seg { width: 100%; margin-bottom: 8px; }
.ruler-card .seg-btn { flex: 1; justify-content: center; }
.ruler-vals { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 13px; }
.ruler-vals b { text-align: right; font-variant-numeric: tabular-nums; }
.ruler-vals .tot { font-size: 15px; border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; }
.ruler-help { font-size: 12px; color: var(--text-2); margin: 6px 0 0; }

/* ------------------------------------------------------- menús/popover */
.popover-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.popover {
  position: absolute; pointer-events: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px;
  animation: pop .12s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; border-radius: 6px;
  padding: 7px 10px; text-align: left; font-weight: 600; color: var(--text);
}
.menu-item:hover:not([disabled]) { background: var(--accent-2); color: var(--accent-ink); }
.menu-item[disabled] { opacity: .4; cursor: default; }
.menu-item i { width: 16px; height: 16px; color: var(--text-2); }
.menu-item .kbd { margin-left: auto; font-size: 11px; color: var(--text-3); font-weight: 700; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-title { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--text-3); padding: 6px 10px 4px; }
.pop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 2px; }
.pop-grid .menu-item { flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11.5px; text-align: center; }
.pop-grid .menu-item i { width: 22px; height: 22px; }
.pop-note { font-size: 11.5px; color: var(--text-3); padding: 4px 8px 2px; max-width: 260px; }

/* -------------------------------------------------------------- modal */
.modal-layer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.modal-back {
  position: absolute; inset: 0; background: rgba(15, 23, 35, .38); display: grid; place-items: center; padding: 16px;
  pointer-events: auto; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 800; flex: 1; }
.modal-head i { width: 20px; height: 20px; color: var(--accent); }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel-2); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.fmt-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fmt-card {
  border: 1.5px solid var(--line-2); border-radius: 10px; padding: 10px; background: var(--field); text-align: left;
  display: flex; flex-direction: column; gap: 3px;
}
.fmt-card b { font-size: 15px; }
.fmt-card span { font-size: 11.5px; color: var(--text-2); }
.fmt-card.active { border-color: var(--accent); background: var(--accent-2); }
.fmt-card .rec { font-size: 10px; font-weight: 800; color: var(--ok); text-transform: uppercase; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.form-grid label, .lbl-block { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.form-grid input[type=text], .form-grid input[type=number], .form-grid select, .lbl-block input, .lbl-block select {
  height: 34px; border: 1px solid var(--line-2); border-radius: 7px; padding: 0 8px; font-weight: 600; background: var(--field); color: var(--text);
}
.form-grid .full { grid-column: 1 / -1; }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; font-weight: 600; color: var(--text); }
.radio-row label { flex-direction: row; align-items: center; gap: 5px; color: var(--text); font-size: 13px; }
.radio-row input { accent-color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat span { display: block; font-size: 11px; color: var(--text-2); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.checks { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.checks li i { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.checks li.ok { background: var(--ok-2); color: var(--ok-ink); }
.checks li.warn { background: var(--warn-2); color: var(--warn-ink); }
.checks li.bad { background: var(--danger-2); color: var(--danger-ink); }
.checks li small { display: block; color: inherit; opacity: .8; }
.note { font-size: 12px; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 12px; }
.proj-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.proj-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--field); display: flex; flex-direction: column; }
.proj-card.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-2); }
.proj-card .pthumb { height: 110px; background: var(--panel-2) center/contain no-repeat; border-bottom: 1px solid var(--line); cursor: pointer; }
.proj-card .pinfo { padding: 7px 9px; }
.proj-card .pinfo b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-card .pinfo span { font-size: 11px; color: var(--text-3); }
.proj-card .pact { display: flex; gap: 4px; padding: 0 6px 7px; }
.kbd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kbd-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); }
.kbd-table td:first-child { white-space: nowrap; width: 1%; }
kbd {
  display: inline-block; font-family: inherit; font-size: 11.5px; font-weight: 800; padding: 1px 6px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--field); margin: 0 1px;
}
.kbd-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* ------------------------------------------------------------- toasts */
.toasts { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 60; pointer-events: none; }
.toast {
  background: #1d2733; color: #fff; border-radius: 9px; padding: 8px 14px; font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow-lg); animation: toastIn .18s ease; max-width: min(520px, 90vw); display: flex; gap: 8px; align-items: center;
}
.toast i { width: 16px; height: 16px; }
.toast.ok i { color: #4ade80; } .toast.warn i { color: #fbbf24; } .toast.err { background: #8f1f1f; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------- arrastrar archivo */
.drop-hint {
  position: absolute; inset: 10px; border: 2.5px dashed var(--accent); border-radius: 16px; background: rgba(232, 240, 254, .82);
  display: grid; place-items: center; z-index: 30; pointer-events: none;
}
.drop-hint div { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--accent-ink); }
.drop-hint i { width: 40px; height: 40px; }
.drop-hint b { font-size: 18px; }
.busy {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%); background: var(--field); border: 1px solid var(--line);
  box-shadow: var(--shadow); border-radius: 999px; padding: 6px 14px 6px 8px; display: flex; gap: 8px; align-items: center;
  font-weight: 700; z-index: 20; font-size: 12.5px;
}
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--accent-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fatal {
  position: fixed; inset: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center;
  background: var(--field); z-index: 100; padding: 24px; text-align: center; font-size: 15px; color: var(--text-2);
}
.fatal b { font-size: 20px; color: var(--text); }

/* ----------------------------------------------------------- responsivo */
@media (max-width: 1280px) {
  .tool-txt span { display: none; }
  .tool-txt .chev { display: none; }
  .project-name { width: 180px; }
}
@media (max-width: 1100px) {
  :root { --lib-w: 250px; }
  .save-state { display: none; }
  .lib-grid { grid-template-columns: repeat(2, 1fr); }
  .tb-actions .btn span { display: none; }
  .tb-actions .btn { padding: 7px 9px; }
  .snap-toggle span { display: none; }
  .inspector { width: 248px; }
}
@media (max-width: 900px) {
  .menus .menu-btn { padding: 6px 7px; }
  .mode-chip, .brand-name, .seg-btn span { display: none; }
  .library { position: absolute; right: 0; top: 0; bottom: 0; box-shadow: var(--shadow-lg); }
  /* la biblioteca plegada queda fuera, a la derecha (margin-right negativo):
     sin recortar, el celular ensanchaba toda la página para mostrarla */
  .workspace { overflow: hidden; }
  .coords { display: none; }
  .scene-tree { width: 210px; }
  .nav-col { transform: scale(.88); transform-origin: top left; }
  /* la biblioteca flota sobre el área 3D: los paneles de la derecha se apartan mientras está abierta */
  .app.lib-open .inspector, .app.lib-open .ruler-card { right: calc(var(--lib-w) + 12px); }
  .app.lib-open .vp-status { padding-right: calc(var(--lib-w) + 12px); }
}
@media (max-width: 640px) {
  /* Antes los menús (Archivo, Editar, Ver, Ayuda, Webs, ⚙, tema) se ocultaban
     y en el celular no había forma de abrir/guardar/exportar desde ellos. Ahora
     bajan a una segunda línea que se desliza en horizontal si no cabe (los
     desplegables se abren en #popoverLayer, así que el recorte no los afecta). */
  .tb-row1 { flex-wrap: wrap; height: auto; padding: 4px 8px; row-gap: 2px; }
  .menus {
    display: flex; order: 10; flex: 1 0 100%; margin-left: 0;
    overflow-x: auto; scrollbar-width: none;
  }
  .menus::-webkit-scrollbar { display: none; }
  .menus > * { flex: 0 0 auto; }
  .tb-row2 { padding: 0 8px; }
  .save-state { display: none; }
  .inspector { width: calc(100% - 24px); max-height: 46%; }
  .scene-tree { display: none; }
  .hint { display: none; }
  .grid-ctl { flex-wrap: wrap; }
}
@media (pointer: coarse) {
  .tool { height: 40px; min-width: 40px; }
  .nav-btn { width: 40px; height: 40px; }
  .tree-act { opacity: 1; }
}
