/* ==========================================================
   Tably — editor de pizarra a pantalla completa.
   Misma línea que mwo.es (Inter, grises de Apple, rojo de la marca, cristal) y variables de /assets/css/style.css.
   ========================================================== */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/assets/fonts/inter-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/assets/fonts/inter-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f5f5f7; --bg-alt: #ececf0; --panel: rgba(255, 255, 255, .86); --ink: #1d1d1f; --ink-2: #6e6e73; --ink-3: #86868b; --line: #d2d2d7;
  --rojo: #e10600; --rojo-2: #c40500; --sel: #0a84ff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --obj: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.28, .11, .32, 1);
  --sombra: 0 10px 30px -12px rgba(0, 0, 0, .28), 0 0 0 .5px rgba(0, 0, 0, .1);
  --sup: env(safe-area-inset-top, 0px); --inf: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body.tb-app { background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
svg { display: block; }

/* ---------- lienzo ---------- */
.tb-raiz { position: fixed; inset: 0; }
.tb-escenario {
  position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: default;
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(0, 0, 0, .16) 1px, transparent 1.2px);
  background-size: 24px 24px;
}
.tb-escenario.sin-puntos { background-image: none; }
.tb-escenario.soltando { box-shadow: inset 0 0 0 3px var(--sel); }
.tb-mundo { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
body[data-herr="mano"] .tb-escenario, body.espacio .tb-escenario { cursor: grab; }
body[data-herr="mano"] .tb-escenario:active, body.espacio .tb-escenario:active { cursor: grabbing; }
body[data-herr="nota"] .tb-escenario, body[data-herr="texto"] .tb-escenario, body[data-herr="forma"] .tb-escenario, body[data-herr="marco"] .tb-escenario, body[data-herr="linea"] .tb-escenario { cursor: crosshair; }
body[data-herr="lapiz-lapiz"] .tb-escenario, body[data-herr="lapiz-resaltador"] .tb-escenario { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><circle cx="4" cy="20" r="3" fill="black" stroke="white" stroke-width="1.5"/></svg>') 4 20, crosshair; }
body[data-herr="lapiz-borrador"] .tb-escenario { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><circle cx="12" cy="12" r="8" fill="white" fill-opacity=".6" stroke="black" stroke-width="1.5"/></svg>') 12 12, cell; }
body[data-herr="comentario"] .tb-escenario { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26"><path d="M3 23V12a9 9 0 1 1 9 9H3z" fill="%23e10600" stroke="white" stroke-width="1.6"/></svg>') 3 23, crosshair; }

/* ---------- objetos ---------- */
.tb-o { position: absolute; transform-origin: 50% 50%; font-family: var(--obj); letter-spacing: -.012em; }
.tb-tx { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; outline: none; line-height: 1.28; }
.editando .tb-tx { -webkit-user-select: text; user-select: text; cursor: text; caret-color: var(--rojo); }
.tb-nota { background: var(--c, #ffe27a); box-shadow: 0 1px 1px rgba(0, 0, 0, .06), 0 8px 18px -10px rgba(0, 0, 0, .35); display: flex; }
.tb-nota .tb-tx { position: absolute; inset: 8%; display: flex; flex-direction: column; justify-content: center; text-align: center; font-weight: 500; color: #1d1d1f; overflow: hidden; }
.tb-nota .tb-tx:empty::before, .tb-forma .tb-tx:empty::before { content: ''; }
.editando.tb-nota .tb-tx, .editando.tb-forma .tb-tx { overflow: visible; }
.tb-texto { min-height: 20px; }
.tb-texto .tb-tx { min-height: 1.28em; color: #1d1d1f; font-weight: 500; }
/* el texto de la pista lo pone interfaz.js en el idioma de la persona (--tb-escribe) */
.tb-texto .tb-tx:empty::before { content: var(--tb-escribe, 'Escribe aquí'); color: var(--ink-3); }
.tb-forma .tb-forma-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tb-forma path { stroke-linejoin: round; }
.tb-forma .tb-tx { position: absolute; display: flex; flex-direction: column; justify-content: center; text-align: center; font-weight: 500; overflow: hidden; }
.tb-marco { background: var(--c, #fff); box-shadow: 0 0 0 1px rgba(0, 0, 0, .1), 0 2px 12px -4px rgba(0, 0, 0, .12); pointer-events: none; }
.tb-marco-t { position: absolute; left: 0; bottom: 100%; padding: 0 2px 6px; pointer-events: auto; cursor: default; font-size: 16px; font-weight: 600; color: var(--ink-2); white-space: nowrap; max-width: 100%; }
.tb-marco-t .tb-tx { display: inline-block; min-width: 20px; white-space: nowrap; }
.tb-imagen img { width: 100%; height: 100%; display: block; object-fit: fill; -webkit-user-drag: none; pointer-events: none; opacity: 0; transition: opacity .3s; }
.tb-imagen { background: rgba(0, 0, 0, .04); }
.tb-imagen.cargada { background: none; }
.tb-imagen.cargada img { opacity: 1; }
.tb-trazo { pointer-events: none; }
.tb-trazo svg, .tb-linea svg { position: absolute; left: 0; top: 0; overflow: visible; }
.tb-trazo svg { width: 100%; height: 100%; }
.tb-trazo path, .tb-trazo-vivo path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tb-trazo .tb-hit { stroke: transparent; pointer-events: stroke; }
.tb-trazo-vivo { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 9000000; }
.tb-linea { left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.tb-linea path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tb-linea .tb-hit { stroke: transparent; pointer-events: stroke; cursor: pointer; }
.tb-linea-et { position: absolute; width: max-content; transform: translate(-50%, -50%); background: #fff; border-radius: 6px; padding: 2px 7px; font-size: 15px; font-weight: 500; white-space: pre-wrap; max-width: 240px; text-align: center; pointer-events: auto; box-shadow: 0 0 0 1px rgba(0, 0, 0, .04); }
.tb-linea-et.vacia { display: none; }
.tb-linea-et .tb-tx { min-width: 12px; display: inline-block; }

/* ---------- capas de pantalla (selección, comentarios, cursores) ---------- */
.tb-capa { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tb-sel { position: absolute; border: 1.5px solid var(--sel); border-radius: 2px; }
.tb-sel-grupo { border-style: dashed; }
.tb-sel-una { position: absolute; border: 1px solid rgba(10, 132, 255, .55); }
.tb-sel-linea { position: absolute; left: 0; top: 0; overflow: visible; }
.tb-sel-linea path { fill: none; stroke: var(--sel); stroke-dasharray: 4 3; opacity: .8; }
.tb-asa { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; background: #fff; border: 1.5px solid var(--sel); border-radius: 3px; pointer-events: auto; touch-action: none; }
.tb-asa-nw { left: 0; top: 0; cursor: nwse-resize; } .tb-asa-n { left: 50%; top: 0; cursor: ns-resize; } .tb-asa-ne { left: 100%; top: 0; cursor: nesw-resize; }
.tb-asa-e { left: 100%; top: 50%; cursor: ew-resize; } .tb-asa-se { left: 100%; top: 100%; cursor: nwse-resize; } .tb-asa-s { left: 50%; top: 100%; cursor: ns-resize; }
.tb-asa-sw { left: 0; top: 100%; cursor: nesw-resize; } .tb-asa-w { left: 0; top: 50%; cursor: ew-resize; }
.tb-asa-n, .tb-asa-s { width: 18px; height: 7px; margin: -3.5px 0 0 -9px; border-radius: 4px; }
.tb-asa-e, .tb-asa-w { width: 7px; height: 18px; margin: -9px 0 0 -3.5px; border-radius: 4px; }
.tb-asa-rot { left: 50%; top: -30px; border-radius: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; cursor: grab; background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 12a7 7 0 1 1-2.1-5" fill="none" stroke="%230a84ff" stroke-width="3" stroke-linecap="round"/></svg>') center / 10px no-repeat; }
.tb-asa-ext { width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; cursor: move; }
.tb-asa-ext.pegada { background: var(--sel); }
.tb-asa-mas { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--sel); pointer-events: auto; cursor: crosshair; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .2s var(--ease); box-shadow: 0 2px 6px rgba(10, 132, 255, .4); touch-action: none; }
.tb-asa-mas::after { content: ''; position: absolute; inset: 0; background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 6v12M6 12h12" stroke="white" stroke-width="3" stroke-linecap="round"/></svg>') center / 12px no-repeat; }
.tb-sel:hover .tb-asa-mas, .tb-asa-mas:hover { opacity: 1; transform: scale(1); }
@media (pointer: coarse) { .tb-asa-mas { opacity: .9; transform: scale(1); } }
.tb-mas-n { left: 50%; top: -40px; } .tb-mas-s { left: 50%; top: calc(100% + 40px); } .tb-mas-e { left: calc(100% + 26px); top: 50%; } .tb-mas-o { left: -26px; top: 50%; }
.tb-mas-n { top: -54px; }
.tb-marquee { position: absolute; background: rgba(10, 132, 255, .08); border: 1px solid rgba(10, 132, 255, .7); border-radius: 2px; }
.tb-guia { position: absolute; background: #ff2d55; }
.tb-guia.v { top: 0; bottom: 0; width: 1px; } .tb-guia.h { left: 0; right: 0; height: 1px; }
.tb-destino { position: absolute; border: 2px solid var(--sel); border-radius: 6px; background: rgba(10, 132, 255, .06); }
.tb-otra-sel { position: absolute; border: 2px solid var(--c); border-radius: 4px; }
.tb-otra-sel span { position: absolute; left: -2px; bottom: 100%; background: var(--c); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px 4px 4px 0; white-space: nowrap; }
@media (pointer: coarse) {
  .tb-asa { width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; }
  .tb-asa-n, .tb-asa-s, .tb-asa-e, .tb-asa-w { display: none; }
  .tb-asa-rot { width: 22px; height: 22px; margin: -11px 0 0 -11px; top: -28px; left: -28px; }
  .tb-asa-mas { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
}

.tb-cursor { position: absolute; left: 0; top: 0; transition: transform .55s linear; will-change: transform; z-index: 2; }
.tb-cursor.sin-anim { transition: none; }
.tb-cursor svg path { fill: var(--c); }
.tb-cursor span { position: absolute; left: 14px; top: 16px; background: var(--c); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }

.tb-pin { position: absolute; width: 30px; height: 30px; margin: -30px 0 0 0; border: 2px solid #fff; border-radius: 15px 15px 15px 3px; background: var(--c); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; pointer-events: auto; cursor: pointer; box-shadow: 0 4px 12px -2px rgba(0, 0, 0, .3); transition: transform .2s var(--ease); padding: 0; }
.tb-pin:hover, .tb-pin.abierto { transform: scale(1.12); }
.tb-pin i { position: absolute; right: -8px; top: -8px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #1d1d1f; color: #fff; font: 600 10px/17px var(--font); font-style: normal; }
.tb-pin.resuelto { opacity: .5; filter: grayscale(.6); }
.tb-pin-nuevo { animation: tbLatido 1.4s ease-in-out infinite; }
@keyframes tbLatido { 50% { transform: scale(1.1); } }

/* ---------- barra superior ---------- */
.tb-barra { position: fixed; left: 12px; right: 12px; top: calc(10px + var(--sup)); display: flex; justify-content: space-between; align-items: center; gap: 10px; pointer-events: none; z-index: 20; }
.tb-barra > div { pointer-events: auto; display: flex; align-items: center; gap: 6px; background: var(--panel); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-radius: 14px; padding: 5px; box-shadow: var(--sombra); min-width: 0; }
.tb-barra-izq { flex: 0 1 auto; }
.tb-logo { display: flex; align-items: center; gap: 2px; padding: 3px 6px 3px 2px; border-radius: 10px; color: var(--ink-2); text-decoration: none; }
.tb-logo:hover { background: rgba(0, 0, 0, .05); }
.tb-logo img { border-radius: 7px; }
.tb-titulo, .tb-titulo-fijo { font: 600 15px var(--font); letter-spacing: -.015em; border: 0; background: transparent; color: var(--ink); padding: 6px 8px; border-radius: 8px; width: 240px; min-width: 60px; max-width: 34vw; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.tb-titulo:hover { background: rgba(0, 0, 0, .04); }
.tb-titulo:focus { outline: none; background: #fff; box-shadow: 0 0 0 2px rgba(225, 6, 0, .25); }
.tb-estado { font-size: 12.5px; color: var(--ink-3); padding: 0 8px 0 2px; white-space: nowrap; }
.tb-estado[data-e="sin-conexion"], .tb-estado[data-e="sin-espacio"] { color: #c93400; }
.tb-estado[data-e="lectura"] { background: var(--bg-alt); color: var(--ink-2); border-radius: 99px; padding: 3px 10px; font-weight: 500; }
.tb-bt { border: 0; background: transparent; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; cursor: pointer; color: var(--ink); position: relative; padding: 0; }
.tb-bt:hover { background: rgba(0, 0, 0, .06); }
.tb-compartir { border: 0; background: var(--rojo); color: #fff; font-weight: 600; font-size: 14px; border-radius: 99px; padding: 8px 15px 8px 12px; display: flex; align-items: center; gap: 6px; cursor: pointer; transition: background .2s; }
.tb-compartir:hover { background: var(--rojo-2); }
.tb-insignia { position: absolute; right: 2px; top: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--rojo); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; padding: 0 4px; }
.tb-caras { display: flex; padding-left: 4px; }
.tb-caras:empty { display: none; }
.tb-cara { width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; border: 2px solid #fff; margin-left: -6px; cursor: pointer; padding: 0; flex: 0 0 auto; }
.tb-cara-yo { cursor: default; }

/* ---------- herramientas ---------- */
.tb-herr { position: fixed; left: 12px; top: 50%; transform: translateY(-50%); display: grid; gap: 8px; z-index: 20; }
.tb-herr-grupo { display: grid; gap: 2px; background: var(--panel); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-radius: 14px; padding: 5px; box-shadow: var(--sombra); }
.tb-h { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: var(--ink); transition: background .15s, color .15s; padding: 0; }
.tb-h:hover { background: rgba(0, 0, 0, .06); }
.tb-h.activo { background: var(--ink); color: #fff; }
.tb-h:disabled { opacity: .3; cursor: default; background: transparent; }
.tb-sep { height: 1px; background: rgba(0, 0, 0, .08); margin: 3px 6px; }

/* ---------- barra contextual ---------- */
.tb-ctx { position: fixed; z-index: 25; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--panel); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-radius: 12px; box-shadow: var(--sombra); animation: tbAparece .16s var(--ease); }
.tb-ctx[hidden] { display: none; }
.tb-cb { border: 0; background: transparent; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.tb-cb:hover { background: rgba(0, 0, 0, .06); }
.tb-cb.activo { background: rgba(0, 0, 0, .1); }
.tb-csep { width: 1px; height: 22px; background: rgba(0, 0, 0, .1); margin: 0 3px; }
.tb-muestra { width: 20px; height: 20px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); display: grid; place-items: center; }
.tb-muestra.aro { background: transparent; box-shadow: inset 0 0 0 4px var(--c), inset 0 0 0 5px rgba(0, 0, 0, .12); }
.tb-muestra.letra { background: transparent; box-shadow: none; color: var(--c); font-weight: 800; font-size: 16px; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 1px; }
.tb-fs { font-size: 13px; font-weight: 600; min-width: 26px; text-align: center; }
@keyframes tbAparece { from { opacity: 0; transform: translateY(4px); } }

/* ---------- ventanas emergentes y menús ---------- */
.tb-pop, .tb-menu { position: fixed; z-index: 60; background: rgba(255, 255, 255, .96); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-radius: 14px; box-shadow: 0 18px 50px -14px rgba(0, 0, 0, .35), 0 0 0 .5px rgba(0, 0, 0, .12); padding: 8px; animation: tbAparece .15s var(--ease); }
.tb-colores { display: grid; grid-template-columns: repeat(5, 30px); gap: 7px; padding: 4px; }
.tb-color { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); cursor: pointer; padding: 0; transition: transform .15s; }
.tb-color:hover { transform: scale(1.1); }
.tb-color.activo { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14), 0 0 0 2px #fff, 0 0 0 4px var(--sel); }
.tb-color.vacio { background: #fff linear-gradient(135deg, transparent 46%, #ff3b30 46%, #ff3b30 54%, transparent 54%); }
.tb-rejilla { display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; }
.tb-fila { display: flex; gap: 4px; align-items: center; padding: 2px; }
.tb-fila + .tb-fila, .tb-colores + .tb-fila, .tb-fila + .tb-colores { margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(0, 0, 0, .07); }
.tb-pb { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--ink); padding: 0; }
.tb-pb:hover { background: rgba(0, 0, 0, .06); }
.tb-pb.activo { background: rgba(10, 132, 255, .14); color: var(--sel); }
.tb-pb:disabled { opacity: .3; }
.tb-punto { display: block; border-radius: 50%; background: currentColor; }
.tb-raya { display: block; width: 22px; background: currentColor; border-radius: 4px; }
.tb-pop-nota { font-size: 12px; color: var(--ink-3); margin: 6px 4px 0; }
.tb-pop-et { font-size: 12px; color: var(--ink-2); width: 44px; }
.tb-tams { display: grid; grid-template-columns: repeat(3, 56px); gap: 4px; }
.tb-tam { border: 0; background: transparent; height: 34px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.tb-tam:hover { background: rgba(0, 0, 0, .06); }
.tb-tam.activo { background: rgba(10, 132, 255, .14); color: var(--sel); }
.tb-menu { min-width: 230px; padding: 6px; }
.tb-menu-i { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-size: 14px; }
.tb-menu-i:hover, .tb-menu-i:focus-visible { background: rgba(0, 0, 0, .06); outline: none; }
.tb-menu-i span { flex: 1; }
.tb-menu-i kbd { font: 12px var(--font); color: var(--ink-3); }
.tb-menu-i svg:last-child:not(:first-child) { color: var(--sel); }
.tb-menu-i.peligro { color: #d70015; }
.tb-menu-i:disabled { opacity: .4; }
.tb-menu-vacio { width: 18px; flex: 0 0 18px !important; }
.tb-menu-sep { height: 1px; background: rgba(0, 0, 0, .08); margin: 5px 6px; }
.tb-menu-nota { font-size: 12px; color: var(--ink-3); padding: 4px 10px 2px; }

/* ---------- zoom y minimapa ---------- */
.tb-zoom { position: fixed; right: 12px; bottom: calc(12px + var(--inf)); display: flex; align-items: center; gap: 1px; padding: 4px; background: var(--panel); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-radius: 12px; box-shadow: var(--sombra); z-index: 20; }
.tb-zb { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.tb-zb:hover, .tb-zp:hover { background: rgba(0, 0, 0, .06); }
.tb-zb.activo { color: var(--sel); }
.tb-zp { border: 0; background: transparent; height: 32px; min-width: 56px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.tb-zsep { width: 1px; height: 20px; background: rgba(0, 0, 0, .1); margin: 0 3px; }
.tb-mini { position: fixed; right: 12px; bottom: calc(60px + var(--inf)); width: 220px; height: 140px; border-radius: 12px; background: var(--panel); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: var(--sombra); z-index: 20; cursor: pointer; touch-action: none; }
.tb-mini[hidden] { display: none; }

/* ---------- avisos y pista ---------- */
.tb-aviso { position: fixed; left: 50%; bottom: calc(24px + var(--inf)); transform: translateX(-50%); z-index: 100; background: #1d1d1f; color: #f5f5f7; border-radius: 99px; padding: 10px 18px; font-size: 14px; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .5); animation: tbAvisoIn .3s var(--ease); max-width: calc(100% - 32px); text-align: center; transition: opacity .3s; }
.tb-aviso.fuera { opacity: 0; }
@keyframes tbAvisoIn { from { opacity: 0; transform: translate(-50%, 10px); } }
.tb-pista { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: var(--ink-3); display: grid; gap: 6px; pointer-events: none; animation: tbAparece .6s var(--ease); }
.tb-pista strong { font-size: 22px; color: var(--ink-2); letter-spacing: -.02em; }
.tb-pista[hidden] { display: none; }

/* ---------- diálogos ---------- */
.tb-fondo { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .3); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: tbFundido .2s ease; -webkit-user-select: text; user-select: text; touch-action: auto; }
@keyframes tbFundido { from { opacity: 0; } }
.tb-dlg { position: relative; background: #fff; border-radius: 22px; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 26px 24px 22px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .45); animation: tbSube .3s var(--ease); }
.tb-dlg-ancho { width: min(720px, 100%); }
.tb-dlg-compartir { width: min(500px, 100%); }
@keyframes tbSube { from { opacity: 0; transform: translateY(14px); } }
.tb-dlg h2 { margin: 0 30px 4px 0; font-size: 22px; letter-spacing: -.025em; }
.tb-dlg h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 10px; }
.tb-dlg-sub { margin: 0 0 18px; color: var(--ink-2); font-size: 14.5px; }
.tb-dlg-nota { margin: 12px 0 0; color: var(--ink-3); font-size: 13px; }
.tb-dlg-x { position: absolute; right: 14px; top: 14px; border: 0; background: var(--bg); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.tb-dlg-x:hover { background: var(--bg-alt); }
.tb-dlg-ico { display: grid; place-items: center; margin-bottom: 12px; }
.tb-dlg-ico img { border-radius: 13px; box-shadow: 0 10px 22px -12px rgba(0, 0, 0, .5); }
.tb-dlg-btns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.tb-dlg-btns.tb-izq { justify-content: flex-start; }
.tb-btn, .tb-btn2 { border: 0; border-radius: 99px; padding: 10px 20px; font-weight: 500; font-size: 15px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; }
.tb-btn { background: var(--rojo); color: #fff; }
.tb-btn:hover { background: var(--rojo-2); }
.tb-btn2 { background: var(--bg); color: var(--ink); }
.tb-btn2:hover { background: var(--bg-alt); }
.tb-btn:disabled, .tb-btn2:disabled { opacity: .55; cursor: default; }
.tb-peligro { background: #d70015; }
.tb-plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tb-plant-b { border: 0; background: var(--bg); border-radius: 16px; padding: 10px; display: grid; gap: 8px; cursor: pointer; text-align: left; font-weight: 600; transition: transform .3s var(--ease), box-shadow .3s; }
.tb-plant-b:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -18px rgba(0, 0, 0, .4); }
.tb-plant-b img { width: 100%; height: auto; border-radius: 10px; background: #fff; }
.tb-plant-b span { padding: 0 4px 2px; }
.tb-exp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tb-exp-b { border: 1.5px solid var(--line); background: #fff; border-radius: 16px; padding: 16px; display: grid; gap: 4px; justify-items: start; text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.tb-exp-b strong { font-size: 16px; margin-top: 6px; }
.tb-exp-b span { color: var(--ink-2); font-size: 13px; }
.tb-exp-b.activo { border-color: var(--rojo); background: #fff5f4; }
.tb-exp-op:empty { display: none; }
.tb-exp-op { margin-top: 14px; }
.tb-check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); }
.tb-atajos { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px 22px; }
.tb-atajos div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 6px 0; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.tb-atajos kbd { font: 600 12.5px var(--font); background: var(--bg); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.tb-atajos span { color: var(--ink-2); text-align: right; }

.tb-c-sec { padding: 16px 0; border-top: 1px solid rgba(0, 0, 0, .07); }
.tb-c-sec:first-of-type { border-top: 0; padding-top: 0; }
.tb-personas { display: grid; gap: 8px; max-height: 220px; overflow: auto; }
.tb-persona { display: flex; align-items: center; gap: 10px; }
.tb-persona .tb-cara { margin: 0; cursor: default; border: 0; width: 32px; height: 32px; }
.tb-p-tx { flex: 1; min-width: 0; display: grid; }
.tb-p-tx b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-p-tx b em { font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--ink-3); background: var(--bg); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.tb-p-tx small { color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-p-x { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: var(--ink-3); display: grid; place-items: center; }
.tb-p-x:hover { background: var(--bg); color: #d70015; }
.tb-invitar { display: flex; gap: 8px; margin-top: 12px; }
.tb-invitar[hidden] { display: none; }
.tb-invitar input, .tb-enlace input { flex: 1; min-width: 0; font: inherit; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); }
.tb-invitar input:focus, .tb-enlace input:focus { outline: none; border-color: var(--rojo); box-shadow: 0 0 0 4px rgba(225, 6, 0, .12); }
.tb-enlace { display: flex; gap: 8px; margin-top: 12px; }
.tb-enlace[hidden] { display: none; }
.tb-vis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tb-vis label { cursor: pointer; }
.tb-vis input { position: absolute; opacity: 0; pointer-events: none; }
.tb-vis span { display: grid; gap: 2px; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 14px; transition: border-color .2s, background .2s; }
.tb-vis b { font-weight: 600; font-size: 14px; } .tb-vis em { font-style: normal; font-size: 12.5px; color: var(--ink-2); }
.tb-vis input:checked + span { border-color: var(--rojo); background: #fff5f4; }
.tb-interruptor { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.tb-interruptor input { position: absolute; opacity: 0; pointer-events: none; }
.tb-interruptor span { flex: 0 0 auto; width: 42px; height: 26px; border-radius: 13px; background: #e5e5ea; position: relative; transition: background .25s; }
.tb-interruptor span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .25s var(--ease); }
.tb-interruptor input:checked + span { background: #34c759; }
.tb-interruptor input:checked + span::after { transform: translateX(16px); }
.tb-interruptor.peq { font-size: 13px; margin: 0 0 10px; }
.tb-cargando { display: block; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--bg-alt); border-top-color: var(--rojo); animation: tbGira .8s linear infinite; }
@keyframes tbGira { to { transform: rotate(360deg); } }

/* ---------- comentarios ---------- */
.tb-hilo { position: fixed; z-index: 50; width: 300px; max-width: calc(100vw - 16px); background: #fff; border-radius: 16px; box-shadow: 0 18px 50px -14px rgba(0, 0, 0, .35), 0 0 0 .5px rgba(0, 0, 0, .12); animation: tbAparece .16s var(--ease); -webkit-user-select: text; user-select: text; touch-action: auto; }
.tb-hilo-cab { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 14px; font-weight: 600; font-size: 14px; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.tb-hilo-acc { display: flex; }
.tb-hilo-lista { max-height: 300px; overflow: auto; padding: 6px 14px; }
.tb-msg { display: flex; gap: 10px; padding: 8px 0; }
.tb-msg .tb-cara, .tb-com .tb-cara { margin: 0; border: 0; width: 28px; height: 28px; font-size: 12px; cursor: default; }
.tb-msg b { font-size: 13.5px; } .tb-msg small { color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.tb-msg p { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.tb-hilo-form { display: flex; gap: 8px; padding: 10px; align-items: flex-end; border-top: 1px solid rgba(0, 0, 0, .06); }
.tb-hilo-form textarea { flex: 1; font: inherit; font-size: 14px; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 40px; }
.tb-hilo-form textarea:focus { outline: none; border-color: var(--rojo); box-shadow: 0 0 0 3px rgba(225, 6, 0, .12); }
.tb-hilo-form .tb-btn { padding: 9px 14px; font-size: 14px; }
.tb-panel-com { position: fixed; right: 12px; top: calc(66px + var(--sup)); bottom: calc(64px + var(--inf)); width: 320px; z-index: 30; background: rgba(255, 255, 255, .96); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-radius: 18px; box-shadow: var(--sombra); padding: 14px; overflow: auto; animation: tbAparece .2s var(--ease); -webkit-user-select: text; user-select: text; touch-action: auto; }
.tb-panel-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tb-panel-cab h2 { font-size: 18px; margin: 0; }
.tb-com { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 8px; border-radius: 12px; cursor: pointer; }
.tb-com:hover { background: var(--bg); }
.tb-com > span:last-child { display: grid; gap: 2px; min-width: 0; }
.tb-com b { font-size: 13.5px; } .tb-com b small { color: var(--ink-3); font-weight: 400; }
.tb-com em { font-style: normal; font-size: 14px; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tb-com > span > small { color: var(--ink-3); font-size: 12px; }
.tb-com.resuelto { opacity: .55; }
.tb-panel-vacio { color: var(--ink-3); text-align: center; padding: 30px 10px; display: grid; justify-items: center; gap: 10px; font-size: 14px; }
.tb-panel-vacio svg:not(:first-child) { display: inline; vertical-align: -3px; }

/* ---------- solo lectura ---------- */
.tb-lectura .tb-escenario { cursor: grab; }

/* ---------- móvil ---------- */
@media (max-width: 699px) {
  .tb-barra { left: 8px; right: 8px; top: calc(8px + var(--sup)); }
  .tb-titulo, .tb-titulo-fijo { width: 34vw; font-size: 14px; padding: 6px 4px; }
  .tb-estado { display: none; }
  .tb-lectura .tb-estado { display: inline-block; font-size: 11.5px; padding: 3px 8px; }
  .tb-compartir { padding: 8px; }
  .tb-compartir span { display: none; }
  .tb-caras .tb-cara:nth-child(n+3) { display: none; }
  .tb-herr { left: 8px; right: 8px; top: auto; bottom: calc(8px + var(--inf)); transform: none; display: flex; gap: 6px; }
  .tb-herr-grupo { display: flex; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
  .tb-herr-grupo::-webkit-scrollbar { display: none; }
  .tb-herr-hist { flex: 0 0 auto; }
  .tb-h { flex: 0 0 auto; width: 42px; height: 42px; }
  .tb-sep { width: 1px; height: auto; margin: 6px 3px; }
  .tb-zoom { bottom: calc(66px + var(--inf)); right: 8px; padding: 3px; }
  .tb-zoom .tb-zb[data-z="menos"], .tb-zoom .tb-zb[data-z="mas"], .tb-zoom .tb-zsep, .tb-zmapa { display: none; }
  .tb-zp { min-width: 48px; }
  .tb-mini { display: none; }
  .tb-panel-com { left: 8px; right: 8px; width: auto; top: calc(60px + var(--sup)); bottom: calc(66px + var(--inf)); }
  .tb-hilo { left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: calc(66px + var(--inf)); }
  .tb-exp { grid-template-columns: 1fr; }
  .tb-vis { grid-template-columns: 1fr; }
  .tb-ctx { max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; }
  .tb-lectura .tb-zoom { bottom: calc(12px + var(--inf)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Selector de idioma en la barra (en el móvil, en el menú «⋯») */
.tb-barra .mw-idioma .mw-idioma-btn { height: 36px; border-radius: 10px; padding: 0 8px; }
@media (max-width: 699px) { .tb-barra .mw-idioma { display: none; } }
