:root {
  --tinta: #f4ede2;
  --fondo: rgba(26, 23, 20, 0.82);
  --borde: rgba(255, 255, 255, 0.12);
  --eter: #5ff5e6;
  --peligro: #e2654b;
  --sup: env(safe-area-inset-top, 0px);
  --inf: env(safe-area-inset-bottom, 0px);
  --izq: env(safe-area-inset-left, 0px);
  --der: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1d1a17; color: var(--tinta);
  font: 500 15px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; user-select: none; -webkit-user-select: none; }
#escena { position: fixed; inset: 0; }
#escena canvas { display: block; touch-action: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.pastilla, .boton, .tarjeta { background: var(--fondo); border: 1px solid var(--borde); border-radius: 14px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--tinta); }
.boton { font: 600 15px system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 44px; padding: 0 16px; cursor: pointer; }
.boton[aria-pressed="true"], .boton.principal { background: #1f6f69; border-color: var(--eter); }
.boton.peligro { background: #7d2f22; border-color: var(--peligro); }
.boton:disabled { opacity: 0.45; cursor: default; }
.boton:focus-visible { outline: 2px solid var(--eter); outline-offset: 2px; }

#arriba { position: fixed; top: calc(10px + var(--sup)); left: calc(12px + var(--izq)); right: calc(12px + var(--der));
  display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
#arriba > * { pointer-events: auto; }
.pastilla { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; font-size: 18px; font-weight: 700; }
.pastilla svg { width: 26px; height: 26px; }
#pendientes { font-size: 13px; font-weight: 500; color: #ffd28a; }
#pendientes:empty { display: none; }

#abajo { position: fixed; bottom: calc(10px + var(--inf)); left: 0; right: 0; display: flex; flex-direction: column;
  align-items: center; gap: 8px; pointer-events: none; }
#abajo > * { pointer-events: auto; }
#modos, #colocacion { display: flex; gap: 8px; }
#catalogo { display: flex; gap: 8px; max-width: calc(100vw - 24px); overflow-x: auto; padding: 2px; }
.ficha-cat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 14px; min-height: 56px; }
.ficha-cat small { font-weight: 500; color: #d9c2a0; }

.tarjeta { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#ficha { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.velo { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; }
.velo[hidden], [hidden] { display: none !important; }
.velo .tarjeta { max-width: min(460px, 90vw); }
.velo p { margin: 0; color: #d6ccbd; font-size: 14px; }

#aviso { position: fixed; top: calc(64px + var(--sup)); left: 50%; transform: translateX(-50%); max-width: 80vw;
  background: var(--fondo); border: 1px solid var(--borde); border-radius: 12px; padding: 8px 14px; font-size: 14px;
  text-align: center; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
#aviso.ver { opacity: 1; }

#girar { display: none; position: fixed; inset: 0; background: #1d1a17; place-items: center; text-align: center; z-index: 9; }
#girar b { display: block; font-size: 22px; margin-bottom: 6px; }
#girar span { color: #bfb3a2; }
@media (orientation: portrait) and (max-width: 820px) { #girar { display: grid; } }

#cargando { position: fixed; inset: 0; display: grid; place-items: center; background: #1d1a17; font-size: 16px;
  transition: opacity 0.6s; z-index: 8; }
#cargando.fuera { opacity: 0; pointer-events: none; }
