/* components.css: los componentes, definidos UNA vez y usados en toda la página (Le 2026-11-06). Sin colores propios:
   todo sale de tokens.css. Un ajuste de un componente va por una variable local, no por otra regla. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 500 15px/1.5 var(--font); color: var(--text); background: var(--mat) url("/app/ui/mat.jpg") center top / cover no-repeat fixed;
  overflow-wrap: anywhere; } /* P2: una palabra larga de cualquier idioma se corta antes que ensanchar la columna */
h1, h2, h3 { font-weight: 800; color: var(--ink); line-height: 1.2; margin: 0; }
h2 { font-size: 1.05rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-weight: 500; }
.small { font-size: 0.85rem; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

/* íconos del sprite: <svg class="ico"><use href="/app/ui/icons.svg#bomb"/></svg> */
.ico { width: 1.25em; height: 1.25em; flex: 0 0 auto; vertical-align: -0.25em; color: var(--ink); }
.ico.lg { width: 2em; height: 2em; }

/* el marco (en desktop flota sobre el tapete) y la tarjeta de papel */
.frame { width: 100%; max-width: 1180px; margin: 0 auto; min-height: 100vh; padding: 10px 10px 28px; }
@media (min-width: 768px) { .frame { padding: 18px 20px 40px; } }
.card { background: var(--paper); border-radius: var(--r-xl); box-shadow: var(--card-sh); padding: 16px; min-width: 0; animation: card-in var(--dur-rise) var(--ease-soft) backwards; }
.card + .card { margin-top: 12px; }
.panel { background: var(--paper-hi); border-radius: var(--r-list); box-shadow: var(--row-sh); padding: 12px; min-width: 0; }
@keyframes card-in { from { opacity: 0; translate: 0 12px; } }

/* botones (P1.5: el pulido del skin del Wardrobe, tyb-skin.css:96-102 y 130-142). Tres familias:
   - .btn: la tinta negra grande; al pasar sube 1 px, al apretar se comprime, deshabilitado no se ve "levantado";
   - .ghost: el claro, con la luz de arriba (--lift);
   - .chip: la pastilla de filtro; encendido, la tinta suave.
   Todos miden 44 px o más de alto (toque cómodo en el celular). */
.btn { appearance: none; font: 700 15px/1.2 var(--font); color: var(--white); background: var(--ink-bg); box-shadow: var(--ink-sh);
  border: 0; border-radius: var(--r-md); padding: 12px 18px; min-height: 44px; cursor: pointer;
  transition: background var(--dur-press) var(--ease), box-shadow var(--dur-press) var(--ease), translate var(--dur-press) var(--ease),
    scale var(--dur-press) var(--ease), opacity var(--dur-press) var(--ease); }
.btn:not(:disabled):hover { background: var(--ink-bg-hover); box-shadow: var(--ink-sh-hover); translate: 0 -1px; }
.btn:not(:disabled):active { translate: 0 0; scale: .985; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn:focus-visible, .ghost:focus-visible, .switch__btn:focus-visible, .chip:focus-visible, .cellbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn.wide { width: 100%; }
.btn.sm { padding: 8px 14px; min-height: 44px; font-size: 14px; border-radius: var(--r-pill); }
.ghost { appearance: none; font: 700 14px/1.2 var(--font); color: var(--text); background: var(--white); box-shadow: var(--lift);
  border: 0; border-radius: var(--r-md); padding: 10px 14px; min-height: 44px; cursor: pointer;
  transition: box-shadow var(--dur-press) var(--ease), translate var(--dur-press) var(--ease), scale var(--dur-press) var(--ease),
    color var(--dur-press) var(--ease), background-color var(--dur-press) var(--ease); }
.ghost:not(:disabled):hover { translate: 0 -1px; box-shadow: var(--lift-hover); }
.ghost:not(:disabled):active { translate: 0 0; scale: .96; }
/* encendido: el color de fondo y el gradiente van aparte; con la shorthand, al apagarse el gradiente se iba de golpe y
   el texto quedaba ilegible unos 100 ms (tyb-skin.css:353) */
.ghost.on { color: var(--white); background-color: var(--ink); background-image: var(--thumb-bg); box-shadow: var(--thumb-sh); }
.ghost:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: var(--soft); }
/* cargando (P1.5, W7): el botón que espera una respuesta queda quieto y con el spinner del Wardrobe; el texto no cambia
   (el spinner no lleva palabras: el idioma lo pone la página) */
.is-busy { cursor: progress !important; }
.is-busy:disabled { opacity: 0.75; }
.is-busy::after { content: ""; display: inline-block; width: 1em; height: 1em; margin-left: 8px; vertical-align: -0.15em;
  border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin var(--dur-spin) linear infinite; }
@keyframes spin { to { rotate: 1turn; } }

/* el switch con el "cerrojo" negro que se desliza (doc-switch de la gacha) */
.switch { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--seg);
  border-radius: var(--r-md); padding: 4px; box-shadow: var(--field); max-width: 100%; }
.switch__thumb { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n, 3));
  background: var(--thumb-bg); box-shadow: var(--thumb-sh); border-radius: var(--r-sm);
  translate: calc(100% * var(--i, 0)) 0; transition: translate var(--dur-latch) var(--ease-latch); }
.switch__btn { position: relative; z-index: 1; appearance: none; border: 0; background: transparent; cursor: pointer; min-width: 0;
  font: 700 14px/1.15 var(--font); color: var(--muted); padding: 10px 10px; min-height: 44px; border-radius: var(--r-sm); transition: color var(--dur-sel) var(--ease);
  text-align: center; } /* P2: el texto puede bajar de línea (un idioma más largo no rompe el tercio) */
.switch__btn.on { color: var(--white); }

/* pill y chip */
.pill { display: inline-flex; align-items: center; gap: 4px; font: 700 12px/1 var(--font); color: var(--text); background: var(--seg);
  border-radius: var(--r-pill); padding: 5px 9px; white-space: nowrap; }
.pill.ink { color: var(--white); background: var(--ink); }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }
.chip { appearance: none; font: 700 13px/1.1 var(--font); color: var(--text); background-color: var(--white); background-image: none;
  box-shadow: var(--soft); border: 0; border-radius: var(--r-pill); padding: 10px 14px; min-height: 44px; cursor: pointer;
  transition: box-shadow var(--dur-press) var(--ease), scale var(--dur-press) var(--ease), color var(--dur-press) var(--ease),
    background-color var(--dur-press) var(--ease); }
.chip:not(:disabled):hover { box-shadow: var(--chip-hover-sh); }
.chip:not(:disabled):active { scale: .96; }
.chip.on { color: var(--white); background-color: var(--ink); background-image: var(--ink-bg); box-shadow: var(--chip-on-sh); }

/* campos (16 px en el celular: iOS no hace zoom). Foco: el anillo suave del Wardrobe (tyb-skin.css:388) */
.field { font: 500 16px/1.3 var(--font); color: var(--ink); background: var(--white); border: 0; border-radius: var(--r-md);
  box-shadow: var(--field); padding: 10px 12px; min-height: 44px; min-width: 0;
  transition: box-shadow var(--dur-press) var(--ease); }
.field:focus { outline: none; box-shadow: var(--field), 0 0 0 4px var(--focus-ring), 0 0 0 1px var(--focus); }
.field.mono { font-family: var(--mono); }
/* etiqueta chica en mono, como los rótulos del Wardrobe (tyb-wardrobe.css:436) */
.label { font: 700 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* avisos: los banners del Wardrobe (tyb-wardrobe.css:430-434), con la entrada de .32s. Vacío, no ocupa lugar */
.notice { margin: 0; color: var(--warn); background: var(--warn-bg); font-weight: 700; padding: 10px 14px; border-radius: var(--r-list);
  box-shadow: var(--banner-sh); animation: banner-in var(--dur-swap) var(--ease-soft) backwards; }
.notice:empty { display: none; }
.fatal { margin: 0; padding: 10px 14px; background: var(--bad-bg); color: var(--bad); border-radius: var(--r-list); font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--bad-line); animation: banner-in var(--dur-swap) var(--ease-soft) backwards; }
@keyframes banner-in { from { opacity: 0; translate: 0 -6px; } }

/* la celda de la grilla: un TYB */
.grid { display: grid; grid-template-columns: repeat(var(--cols, 40), minmax(0, 1fr)); gap: 2px; }
.cellbtn { appearance: none; border: 0; padding: 0; margin: 0; display: block; aspect-ratio: 1; border-radius: 2px; background: var(--cell-alive); cursor: pointer; }
.cellbtn.b { background: var(--cell-bomb); }
.cellbtn.r { background: var(--cell-urgent); }
.cellbtn.x { background: var(--cell-dead); }
.cellbtn.g { background: var(--cell-gone); }
.cellbtn.m { box-shadow: 0 0 0 2px var(--cell-mine); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 3px; background: var(--cell-alive); vertical-align: -1px; }
.sw.b { background: var(--cell-bomb); } .sw.r { background: var(--cell-urgent); } .sw.x { background: var(--cell-dead); }
.sw.g { background: var(--cell-gone); } .sw.m { background: var(--paper); box-shadow: inset 0 0 0 2px var(--cell-mine); }

/* listas de eventos */
.log { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; font-size: 0.88rem; display: grid; gap: 4px; }
.log li { padding: 6px 10px; border-radius: var(--r-sm); }
.log li.mine { background: var(--mine-bg); box-shadow: inset 0 0 0 1px var(--line); }
.log li.kill { box-shadow: inset 3px 0 var(--cell-urgent); }
.log li.hit { box-shadow: inset 3px 0 var(--cell-bomb); }
.log li .t { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }

/* hojas y cajones: <dialog> (foco atrapado; Esc cierra y el foco vuelve a quien lo abrió) */
.sheet { border: 0; padding: 0; background: var(--paper); color: var(--text); border-radius: var(--r-xl); box-shadow: var(--card-sh);
  width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; }
/* el fondo entra tiñéndose con blur, y la hoja con un pop (tyb-skin.css:167-186) */
.sheet::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: tint-in var(--dur-tint) var(--ease) backwards; }
@media (hover: hover) and (pointer: fine) { .sheet::backdrop { -webkit-backdrop-filter: blur(10px) saturate(140%); backdrop-filter: blur(10px) saturate(140%); } }
@keyframes tint-in { from { opacity: 0; } }
.sheet[open] { animation: sheet-in var(--dur-pop) var(--ease-soft); }
@keyframes sheet-in { from { opacity: 0; translate: 0 10px; scale: .97; } }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 8px; }
.sheet__body { padding: 4px 16px 16px; display: grid; gap: 10px; }
.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; border-radius: var(--r-xl) 0 0 var(--r-xl); width: min(380px, 92vw); }
.drawer[open] { animation: drawer-in var(--dur-pop) var(--ease-soft); }
@keyframes drawer-in { from { translate: 30px 0; opacity: 0; } }
@media (max-width: 767px) {
  .sheet { margin: auto auto 0; width: 100vw; max-width: 100vw; max-height: 85dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .drawer { margin: auto auto 0; height: auto; max-height: 85dvh; width: 100vw; border-radius: var(--r-xl) var(--r-xl) 0 0; }
}
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* el punto vivo: el "ahora" de la franja late como el punto de la barra del Wardrobe (tyb-skin.css:90-94) */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); margin-right: 6px; vertical-align: 1px; }
.live { animation: ping var(--dur-ping) var(--ease) infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 var(--ping); } 75%, 100% { box-shadow: 0 0 0 6px var(--ping-0); } }

/* movimiento reducido (W10, tyb-skin.css:527-584): además de las duraciones en 0 (tokens.css), nada se mueve al pasar o
   al apretar, y el punto vivo no late */
@media (prefers-reduced-motion: reduce) {
  .btn, .ghost, .chip, .btn:hover, .ghost:hover, .chip:hover, .btn:active, .ghost:active, .chip:active { translate: none !important; scale: none !important; }
  .live { animation: none; }
}
