/* HUD de la sala de trofeos (heredado de pichobosimulate). Glass sobrio con la paleta de client/palette.ts.
   Los contenedores no capturan el puntero (pointer-events: none); solo los controles. Nada en el centro. */

:root {
  --void: #05060f;
  --hull: #141826;
  --panel: #232a3d;
  --screen: #0a0f1e;
  --glass: rgba(14, 18, 32, 0.55);
  --glass-solid: rgba(14, 18, 32, 0.88);
  --line: rgba(140, 150, 179, 0.22);
  --line-hi: rgba(140, 150, 179, 0.38);
  --ink: #e8ecf8;
  --mute: #8c96b3;
  --holo: #38e1ff;
  --violet: #8c5bff;
  --amber: #ff9e3d;
  --warm: #ffb36b;
  --win: #2bd9a0;
  --loss: #ff7a33;
  --open: #f0e442;
  --radius: 14px;
  --gap: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font-ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-display: "Chakra Petch", "Space Grotesk", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--ink);
  font: 500 14px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  user-select: none;
  -webkit-user-select: none;
}

#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  outline: none;
}

#c.dragging {
  cursor: grabbing;
}

#app {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

button {
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  background: none;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid var(--holo);
  outline-offset: 2px;
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 0;
}

.win {
  color: var(--win);
}
.loss {
  color: var(--loss);
}
.mute {
  color: var(--mute);
}

.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- panel glass ---------- */

.panel {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.low .panel {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--glass-solid);
}

.dot {
  --c: var(--holo);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--c);
  box-shadow: 0 0 0 2px rgba(5, 6, 15, 0.6), 0 0 10px var(--c);
}

/* ---------- HUD ---------- */

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.6s ease;
}

.hud.pre {
  opacity: 0;
}

.hud.pre * {
  pointer-events: none !important;
}

.corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(50vw - var(--gap));
}

.tl {
  top: calc(var(--gap) + var(--safe-t));
  left: calc(var(--gap) + var(--safe-l));
  align-items: flex-start;
}

.tr {
  top: calc(var(--gap) + var(--safe-t));
  right: calc(var(--gap) + var(--safe-r));
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  max-width: none;
}

.bl {
  bottom: calc(var(--gap) + var(--safe-b));
  left: calc(var(--gap) + var(--safe-l));
}

.br {
  bottom: calc(var(--gap) + var(--safe-b));
  right: calc(var(--gap) + var(--safe-r));
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.you b {
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.you-text {
  color: var(--mute);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge.demo {
  color: var(--open);
  background: rgba(240, 228, 66, 0.1);
  border: 1px solid rgba(240, 228, 66, 0.4);
  box-shadow: 0 0 18px rgba(240, 228, 66, 0.12);
}

.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  padding: 7px 4px;
  font-size: 12.5px;
  border-radius: 12px;
}

.strip .s {
  padding: 0 10px;
  white-space: nowrap;
}

.strip .s + .s {
  border-left: 1px solid var(--line);
}

.strip .next {
  color: var(--mute);
}

.strip .stale {
  color: var(--open);
}

.status {
  height: 30px;
  font-size: 12.5px;
  color: var(--mute);
}

.status.full {
  color: var(--open);
  border-color: rgba(240, 228, 66, 0.4);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 1.2s ease-in-out infinite;
}

.status.full .pulse {
  background: var(--open);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* ---------- botones de arriba a la derecha ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  pointer-events: auto;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s var(--ease-out);
}

.btn:hover {
  border-color: var(--line-hi);
  background: rgba(24, 30, 50, 0.7);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn.icon-only {
  width: 38px;
  padding: 0;
  justify-content: center;
}

.btn.off {
  color: var(--mute);
}

.btn .num {
  font-weight: 500;
}

.btn .lbl {
  color: var(--mute);
}

.btn:hover .lbl {
  color: var(--ink);
}

.menu-wrap {
  position: relative;
  pointer-events: auto;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: drop 0.18s var(--ease-out);
  z-index: 5;
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.menu-title {
  padding: 6px 10px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.people-list {
  max-height: 50vh;
  overflow-y: auto;
  min-width: 210px;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.person .me {
  margin-left: auto;
  font-size: 11px;
  color: var(--holo);
  border: 1px solid rgba(56, 225, 255, 0.35);
  border-radius: 999px;
  padding: 1px 8px;
}

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  color: var(--mute);
}

.item:hover {
  background: rgba(140, 150, 179, 0.1);
  color: var(--ink);
}

.item .check {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--line-hi);
  flex: none;
}

.item.on {
  color: var(--ink);
}

.item.on .check {
  border-color: var(--holo);
  background: radial-gradient(circle, var(--holo) 0 38%, transparent 42%);
  box-shadow: 0 0 10px rgba(56, 225, 255, 0.45);
}

/* ---------- toasts (arriba al centro) ---------- */

.toasts {
  position: absolute;
  top: calc(var(--gap) + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  max-width: min(440px, calc(100vw - 2 * var(--gap)));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  font-size: 13.5px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-10px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s var(--ease-out);
}

.toast.in {
  opacity: 1;
  transform: none;
}

.toast.out {
  opacity: 0;
  transform: translateY(-6px);
}

.toast .t-text {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
}

.t-ic {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  font: 600 13px/1 var(--font-ui);
  color: var(--void);
  background: var(--holo);
  border-radius: 50%;
}

/* Forma además de color (accesible): ✓ en círculo, ✕ en octógono. */
.t-ic.win {
  background: var(--win);
  border-radius: 50%;
}

.t-ic.loss {
  background: var(--loss);
  border-radius: 0;
  clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
}

.t-ic.open {
  background: var(--open);
  border-radius: 6px;
}

.toast.win {
  border-color: rgba(43, 217, 160, 0.4);
}
.toast.loss {
  border-color: rgba(255, 122, 51, 0.4);
}
.toast.open {
  border-color: rgba(240, 228, 66, 0.35);
}
.toast.info {
  border-color: rgba(56, 225, 255, 0.3);
}
.toast.replay {
  border-style: dashed;
  opacity: 0.85;
}

/* ---------- abajo al centro ---------- */

.bottom {
  position: absolute;
  left: 50%;
  bottom: calc(var(--gap) + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 16px;
  pointer-events: auto;
}

.emote {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 12px 0 10px;
  border-radius: 11px;
  color: var(--mute);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s var(--ease-out);
}

.emote:hover {
  background: rgba(140, 150, 179, 0.12);
  color: var(--ink);
}

.emote:active {
  transform: scale(0.95);
}

.emote.on {
  color: var(--ink);
  background: rgba(56, 225, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(56, 225, 255, 0.35);
}

.emote .em {
  font-size: 19px;
  line-height: 1;
}

.emote .lbl {
  font-size: 13px;
}

.emote .key {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  font-size: 11px;
  color: var(--mute);
  border: 1px solid var(--line);
  background: rgba(5, 6, 15, 0.4);
}

.emote.palette {
  padding: 0 10px;
  display: none;
}

.sep {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;
}

.swatches {
  display: flex;
  gap: 5px;
  padding: 0 6px 0 2px;
}

.swatch {
  --c: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(5, 6, 15, 0.45);
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s ease;
}

.swatch:hover {
  transform: scale(1.15);
}

.swatch.on {
  box-shadow: 0 0 0 2px var(--void), 0 0 0 4px var(--c), 0 0 14px var(--c);
}

.prompt {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px 0 6px;
  border-radius: 999px;
  pointer-events: auto;
  border-color: rgba(56, 225, 255, 0.45);
  box-shadow: var(--shadow), 0 0 24px rgba(56, 225, 255, 0.16);
  animation: rise 0.22s var(--ease-out);
}

.prompt .key {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  font: 600 13px/1 var(--font-mono);
  color: var(--void);
  background: var(--holo);
  box-shadow: 0 0 14px rgba(56, 225, 255, 0.6);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.waveback {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  pointer-events: auto;
  border-color: rgba(255, 179, 107, 0.5);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s var(--ease-out);
}

.waveback.in {
  opacity: 1;
  transform: none;
}

.waveback .from {
  font-size: 12px;
  color: var(--mute);
}

/* ---------- ayuda / joystick fantasma ---------- */

.help {
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--mute);
  border-radius: 12px;
  max-width: 360px;
  transition: opacity 0.6s ease;
}

.help.fade,
.joy-ghost.fade {
  opacity: 0;
}

.joyzone {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  pointer-events: auto;
  touch-action: none;
  z-index: 2;
}

.joy-base {
  position: absolute;
  left: -64px;
  top: -64px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 225, 255, 0.35);
  background: radial-gradient(circle, rgba(56, 225, 255, 0.08), rgba(14, 18, 32, 0.25) 70%);
  pointer-events: none;
}

.joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(232, 236, 248, 0.16);
  border: 1.5px solid rgba(232, 236, 248, 0.55);
  box-shadow: 0 0 18px rgba(56, 225, 255, 0.35);
}

.joy-ghost {
  position: absolute;
  left: calc(56px + var(--safe-l));
  bottom: calc(150px + var(--safe-b));
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 1.5px dashed rgba(56, 225, 255, 0.45);
  animation: ghost 1.8s ease-in-out infinite;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.joy-ghost::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: rgba(232, 236, 248, 0.18);
}

@keyframes ghost {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.45;
  }
  50% {
    transform: scale(1.04);
    opacity: 0.9;
  }
}

.jump {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  transition: transform 0.1s ease;
}

.jump .ic {
  width: 28px;
  height: 28px;
}

.jump.down {
  transform: scale(0.92);
  border-color: rgba(56, 225, 255, 0.6);
}

/* ---------- nombres y burbuja ---------- */

.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.name {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--ink);
  background: rgba(10, 13, 26, 0.62);
  border: 1px solid rgba(140, 150, 179, 0.18);
  opacity: 0;
  will-change: transform, opacity;
}

.name .dot {
  width: 7px;
  height: 7px;
}

.bubble {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 260px;
  width: max-content;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.38;
  color: var(--ink);
  background: rgba(10, 15, 30, 0.86);
  border: 1px solid rgba(56, 225, 255, 0.42);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35), 0 0 22px rgba(56, 225, 255, 0.12);
  opacity: 0;
  will-change: transform, opacity;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: none;
}

/* Piquito que apunta al ancla (se corre con --tip-x cuando la burbuja choca con un borde). */
.bubble::after {
  content: "";
  position: absolute;
  left: calc(50% + var(--tip-x, 0px));
  bottom: -7px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: inherit;
  border-right: 1px solid rgba(56, 225, 255, 0.42);
  border-bottom: 1px solid rgba(56, 225, 255, 0.42);
  transform: rotate(45deg);
  border-bottom-right-radius: 3px;
}

.bubble.replay {
  border-style: dashed;
  border-color: rgba(140, 91, 255, 0.6);
  color: #cfd5ea;
}

.bubble.replay::after {
  border-color: rgba(140, 91, 255, 0.6);
  border-style: dashed;
}

.bubble.collapsed {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}

/* Robot fuera de cuadro: pastilla de una línea en el borde, con una flecha que apunta hacia él. */
.bubble.edge {
  max-width: min(240px, 70vw);
  padding: 5px 12px 5px 26px;
  border-radius: 999px;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bubble.edge::after {
  left: 10px;
  top: 50%;
  bottom: auto;
  width: 7px;
  height: 7px;
  margin: -4px 0 0 0;
  background: transparent;
  border: 0;
  border-top: 2px solid rgba(56, 225, 255, 0.85);
  border-right: 2px solid rgba(56, 225, 255, 0.85);
  border-radius: 0;
  transform: rotate(calc(var(--ang, 0deg) + 45deg));
}

.safe-probe {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  inset: 0 auto auto 0;
  width: 0;
  height: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.bubble.hide .b-text {
  opacity: 0.9;
}

/* ---------- pantalla de entrada ---------- */

.gate {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-t)) calc(20px + var(--safe-r)) calc(24px + var(--safe-b)) calc(20px + var(--safe-l));
  background: radial-gradient(120% 90% at 50% 40%, rgba(5, 6, 15, 0.35), rgba(5, 6, 15, 0.85)), rgba(5, 6, 15, 0.6);
  pointer-events: auto;
  transition: opacity 0.8s ease, backdrop-filter 0.8s ease;
}

.gate.gone {
  opacity: 0;
  pointer-events: none;
}

.gate-card {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  animation: gate-in 0.9s var(--ease-out) both;
}

@keyframes gate-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.gate-mark {
  position: relative;
  width: 84px;
  height: 84px;
  margin-bottom: 4px;
}

.gate-mark::before {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #c9b6ff, #8c5bff 55%, #2a1760);
  box-shadow: 0 0 40px rgba(140, 91, 255, 0.55);
}

.gate-mark::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  top: 32px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--holo);
  border-top-color: transparent;
  transform: rotate(-16deg);
  box-shadow: 0 6px 16px -6px rgba(56, 225, 255, 0.7);
  animation: orbit 6s linear infinite;
}

@keyframes orbit {
  50% {
    transform: rotate(-12deg) scaleX(1.04);
  }
}

.gate-title {
  margin: 0;
  font: 600 clamp(30px, 6vw, 44px) / 1.05 var(--font-ui);
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff, #c4cbe4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gate-sub {
  margin: 0;
  max-width: 380px;
  color: var(--mute);
  font-size: 15px;
  line-height: 1.5;
}

.gate-bar {
  width: min(280px, 80%);
  height: 3px;
  margin-top: 10px;
  border-radius: 3px;
  background: rgba(140, 150, 179, 0.18);
  overflow: hidden;
}

.gate-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--holo));
  box-shadow: 0 0 12px var(--holo);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s var(--ease-out);
}

.gate-label {
  font-size: 11.5px;
  color: var(--mute);
  letter-spacing: 0.04em;
  min-height: 16px;
}

.gate-btn {
  margin-top: 6px;
  min-width: 180px;
  height: 48px;
  padding: 0 28px;
  border-radius: 999px;
  font: 600 16px/1 var(--font-ui);
  letter-spacing: 0.02em;
  color: var(--void);
  background: linear-gradient(180deg, #7defff, var(--holo));
  box-shadow: 0 0 0 1px rgba(56, 225, 255, 0.5), 0 10px 30px rgba(56, 225, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  pointer-events: auto;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.gate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(56, 225, 255, 0.7), 0 14px 40px rgba(56, 225, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.gate-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.gate-btn:disabled {
  cursor: progress;
  opacity: 0.5;
  filter: saturate(0.4);
}

.gate-card.ready .gate-btn {
  animation: ready 2.4s ease-in-out 0.4s infinite;
}

@keyframes ready {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(56, 225, 255, 0.5), 0 10px 30px rgba(56, 225, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(56, 225, 255, 0.8), 0 10px 44px rgba(56, 225, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  }
}

.gate-net {
  font-size: 12px;
  color: var(--mute);
  min-height: 16px;
}

.gate-net.open {
  color: var(--win);
}

.gate-net.full {
  color: var(--open);
}

.gate-foot {
  margin: 10px 0 0;
  font-size: 12px;
  color: rgba(140, 150, 179, 0.8);
  letter-spacing: 0.02em;
}

/* ---------- overlay de datos ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: calc(20px + var(--safe-t)) calc(16px + var(--safe-r)) calc(20px + var(--safe-b)) calc(16px + var(--safe-l));
  pointer-events: auto;
}

.ov-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 15, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ov-panel {
  position: relative;
  width: 100%;
  max-width: 960px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(12, 16, 30, 0.78);
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition: opacity 0.2s ease, transform 0.22s var(--ease-out);
  user-select: text;
  -webkit-user-select: text;
}

.low .ov-panel {
  background: rgba(12, 16, 30, 0.96);
}

.overlay.show .ov-backdrop {
  opacity: 1;
}

.overlay.show .ov-panel {
  opacity: 1;
  transform: none;
}

.ov-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 14px 12px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(56, 225, 255, 0.06), transparent);
}

.ov-title {
  font: 600 19px/1 var(--font-display);
  letter-spacing: 0.14em;
  color: var(--holo);
  text-shadow: 0 0 18px rgba(56, 225, 255, 0.45);
  white-space: nowrap;
}

.ov-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
  padding: 3px;
  border-radius: 12px;
  background: rgba(5, 6, 15, 0.45);
  border: 1px solid var(--line);
}

.tab {
  height: 32px;
  padding: 0 14px;
  border-radius: 9px;
  color: var(--mute);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab.on {
  color: var(--ink);
  background: rgba(56, 225, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(56, 225, 255, 0.35);
}

.ov-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--mute);
}

.ov-close:hover {
  color: var(--ink);
  background: rgba(140, 150, 179, 0.12);
}

.ov-body {
  flex: 1;
  overflow: auto;
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 150, 179, 0.35) transparent;
}

.ov-foot {
  padding: 10px 22px calc(12px + var(--safe-b) * 0);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--mute);
}

.empty {
  margin: 28px 0;
  text-align: center;
  color: var(--mute);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.tile {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid var(--line);
  min-width: 0;
}

.t-lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}

.t-val {
  margin-top: 4px;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile.win .t-val {
  color: var(--win);
}
.tile.loss .t-val {
  color: var(--loss);
}
.tile.open .t-val {
  color: var(--open);
}
.tile.warn .t-val {
  color: var(--open);
  font-family: var(--font-ui);
}

.tbl-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(10, 15, 30, 0.45);
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tbl th {
  position: sticky;
  top: 0;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  background: rgba(14, 18, 32, 0.96);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(140, 150, 179, 0.1);
  white-space: nowrap;
  vertical-align: middle;
}

.tbl tbody tr:last-child td {
  border-bottom: 0;
}

.tbl tbody tr:hover td {
  background: rgba(56, 225, 255, 0.04);
}

.tbl .r {
  text-align: right;
}

.tbl th:nth-child(4),
.tbl th:nth-child(5),
.tbl.pos th:nth-child(2),
.tbl.pos th:nth-child(3) {
  text-align: right;
}

.tbl.pos th:nth-child(4),
.tbl.pos th:nth-child(5) {
  text-align: right;
}

.tbl td.open {
  color: var(--open);
}

.when {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.when .ago {
  color: var(--ink);
}

.when .hm {
  font-size: 11px;
  color: var(--mute);
}

.asset {
  font-weight: 600;
}

.asset .side-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

.side-dot.buy {
  background: var(--open);
}
.side-dot.win {
  background: var(--win);
}
.side-dot.loss {
  background: var(--loss);
  border-radius: 1px;
  transform: rotate(45deg);
}

.strong {
  font-weight: 600;
}

.thesis {
  white-space: normal !important;
  min-width: 220px;
  max-width: 360px;
  font-size: 12px;
  color: var(--mute);
}

.clamp2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.cycle {
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(10, 15, 30, 0.55);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cycle-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.cycle-head .mute {
  margin-left: auto;
  font-size: 12px;
}

.stance {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
}

.stance.def {
  color: var(--holo);
  background: rgba(56, 225, 255, 0.1);
}
.stance.neu {
  color: #c9cfe3;
  background: rgba(140, 150, 179, 0.12);
}
.stance.agg {
  color: var(--amber);
  background: rgba(255, 158, 61, 0.12);
}
.stance.none {
  color: var(--mute);
}

.note {
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.note.warn {
  color: var(--open);
  background: rgba(240, 228, 66, 0.08);
  border: 1px solid rgba(240, 228, 66, 0.3);
}

.assess {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  user-select: text;
}

.sub {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.obs,
.dec,
.news {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.obs li {
  position: relative;
  padding-left: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #cfd5ea;
}

.obs li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 8px var(--violet);
}

.dec li {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(5, 6, 15, 0.35);
  border: 1px solid rgba(140, 150, 179, 0.12);
  font-size: 13px;
}

.dec .act {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(140, 150, 179, 0.14);
}

.dec .act.open {
  color: var(--open);
  background: rgba(240, 228, 66, 0.12);
}
.dec .act.close {
  color: var(--loss);
  background: rgba(255, 122, 51, 0.12);
}
.dec .act.trim {
  color: var(--amber);
  background: rgba(255, 158, 61, 0.12);
}
.dec .act.hold {
  color: var(--holo);
  background: rgba(56, 225, 255, 0.1);
}

.dec .why {
  color: var(--mute);
  line-height: 1.45;
}

.spark-box {
  padding: 14px 16px 10px;
  border-radius: 14px;
  background: rgba(10, 15, 30, 0.55);
  border: 1px solid var(--line);
}

.spark-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 12px;
}

.spark {
  display: block;
  width: 100%;
  height: 110px;
  overflow: visible;
}

.news li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(5, 6, 15, 0.35);
  border: 1px solid rgba(140, 150, 179, 0.12);
}

.n-title {
  font-size: 13.5px;
  line-height: 1.4;
}

.n-src {
  font-size: 11.5px;
}

/* ---------- debug, error ---------- */

.debug {
  position: absolute;
  left: calc(var(--gap) + var(--safe-l));
  bottom: calc(76px + var(--safe-b));
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  color: #b9f3ff;
  background: rgba(5, 6, 15, 0.8);
  border: 1px solid rgba(56, 225, 255, 0.3);
  pointer-events: auto;
}

.debug-btn {
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid rgba(56, 225, 255, 0.4);
  font-size: 11px;
}

.fatal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 6, 15, 0.85);
  pointer-events: auto;
}

.fatal-card {
  max-width: 440px;
  padding: 26px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.fatal-card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.fatal-card p {
  margin: 0 0 10px;
  color: var(--mute);
  line-height: 1.5;
}

.boot-error {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: var(--mute);
  font: 500 15px/1.4 var(--font-ui);
}

/* ---------- touch y pantallas chicas ---------- */

.touch .btn .lbl,
.touch .emote .lbl {
  display: none;
}

.touch .emote {
  padding: 0 10px;
}

.touch .emote.palette {
  display: inline-flex;
}

.touch .swatches {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  padding: 8px;
  gap: 8px;
  flex-wrap: wrap;
  width: 156px;
  border-radius: 14px;
  background: var(--glass-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: none;
}

.touch .swatches.open {
  display: flex;
}

.touch .swatch {
  width: 28px;
  height: 28px;
}

.touch .bar {
  position: relative;
}

.touch .bar .sep {
  display: none;
}

.touch .bottom {
  bottom: calc(var(--gap) + var(--safe-b));
}

@media (max-width: 760px) {
  :root {
    --gap: 12px;
  }

  .btn .lbl {
    display: none;
  }

  .btn {
    padding: 0 11px;
  }

  .people .num {
    margin-left: -2px;
  }

  .emote .lbl {
    display: none;
  }

  .emote {
    padding: 0 9px;
  }

  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ov-head {
    flex-wrap: wrap;
    padding: 12px 10px 10px 16px;
    gap: 10px;
  }

  .ov-tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .tab {
    flex: 1;
    padding: 0 8px;
  }

  .ov-close {
    margin-left: auto;
  }

  .ov-body {
    padding: 14px;
  }

  .ov-panel {
    max-height: 86vh;
  }

  .strip {
    font-size: 11.5px;
  }

  .dec li {
    grid-template-columns: auto 1fr;
  }

  .dec .why {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .corner.tl {
    max-width: calc(100vw - 2 * var(--gap) - 72px);
  }

  /* Botones de arriba a la derecha en columna: dejan todo el ancho a la identidad y la tira. */
  .tr {
    flex-direction: column;
    align-items: flex-end;
  }

  .tr .btn:not(.people) {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .tr .btn.people {
    padding: 0 10px;
  }

  .swatch {
    width: 22px;
    height: 22px;
  }

  .strip .next {
    flex-basis: 100%;
    border-left: 0 !important;
  }

  .toast {
    white-space: normal;
    border-radius: 16px;
  }
}

/* Celular apaisado: menos alto, todo más compacto. */
@media (max-height: 460px) {
  .emote {
    height: 34px;
  }

  .jump {
    width: 58px;
    height: 58px;
  }

  .ov-panel {
    max-height: 92vh;
  }

  .joy-ghost {
    bottom: calc(90px + var(--safe-b));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Sala de trofeos: tarjeta del trofeo y lista completa ---------- */

.tier-platino { --tier: #dfe8f1; }
.tier-oro { --tier: #e0ad2c; }
.tier-plata { --tier: #c4cad1; }
.tier-bronce { --tier: #c27a45; }
.failed { --tier: #ff5a4f; }

.tcard { padding: 6px 4px 4px; }
.tcard-top { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tchip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid currentColor;
  color: var(--mute);
}
.tchip.tier { color: var(--tier); }
.tchip.st-actual,
.tchip.st-vivo { color: var(--win); }
.tchip.st-fallido { color: #ff5a4f; }
.tcard-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.15;
  margin: 0 0 6px;
  color: var(--ink);
  text-wrap: balance;
}
.tcard-meta { color: var(--mute); margin: 0 0 14px; font-size: 14px; }
.tcard-desc { margin: 0 0 12px; line-height: 1.55; color: var(--ink); }
.tcard-lesson { margin: 0 0 12px; color: var(--mute); }
.tcard-lesson b { color: var(--ink); font-weight: 500; }
.tcard-pending { margin: 0 0 12px; color: var(--mute); font-style: italic; }
.tcard-stack { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 4px 0 12px; }
.tcard-stack li {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(140, 150, 179, 0.12);
  color: var(--mute);
}
.tcard-link { color: var(--holo); text-decoration: none; font-size: 14px; }
.tcard-link:hover { text-decoration: underline; }

.tgroup {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 18px 0 8px;
  font-weight: 500;
}
.trow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(14, 18, 32, 0.4);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.trow:hover,
.trow:focus-visible { border-color: var(--tier); background: rgba(14, 18, 32, 0.75); outline: none; }
.trow.failed { border-style: dashed; }
.trow-cup {
  flex: none;
  width: 14px;
  height: 18px;
  border-radius: 3px 3px 7px 7px;
  background: var(--tier);
  box-shadow: 0 0 12px color-mix(in srgb, var(--tier) 45%, transparent);
}
.trow.failed .trow-cup { opacity: 0.5; transform: rotate(90deg); }
.trow-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trow-txt b { font-weight: 500; }
.trow-txt span { color: var(--mute); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow-tier { flex: none; font-family: var(--font-mono); font-size: 11px; color: var(--tier); text-transform: uppercase; letter-spacing: 0.08em; }
.tcard-bullets { margin: 0 0 14px; padding-left: 18px; display: grid; gap: 6px; line-height: 1.5; }
.tcard-bullets li::marker { color: var(--tier); }
