@font-face {
  font-family: 'Baloo 2';
  src: url(/fonts/baloo2-latin.woff2) format('woff2');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --bg: #12092a;
  --ink: #1b1035;
  --cream: #fff6e2;
  --cream2: #f4e2b8;
  --cream-edge: #dcc28a;
  --gold: #ffc23d;
  --coral: #ff5d73;
  --mint: #3ddc97;
  --sky: #4cc9f0;
  --lilac: #b388ff;
  --text: #f8f2ff;
  --muted: #b3a3e0;
  --glass: rgba(255, 255, 255, .07);
  --glass-line: rgba(255, 255, 255, .13);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease-pop: cubic-bezier(.2, 1.5, .4, 1);
  font-family: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% 0%, #41208c 0%, transparent 60%),
    radial-gradient(80% 50% at 100% 100%, #0d4a5c80, transparent 70%),
    radial-gradient(70% 50% at 0% 85%, #82205e55, transparent 70%),
    linear-gradient(180deg, #170b36, var(--bg) 60%);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overflow: hidden;
}

/* trama de azulejo muy sutil */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .06;
  background:
    radial-gradient(circle at 50% 50%, transparent 38%, #fff 39% 41%, transparent 42%) 0 0 / 48px 48px,
    radial-gradient(circle at 0 0, #fff 0 9%, transparent 10%) 0 0 / 48px 48px,
    radial-gradient(circle at 100% 100%, #fff 0 9%, transparent 10%) 0 0 / 48px 48px;
}

/* focos de plató */
.stage-lights { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.stage-lights i {
  position: absolute;
  top: -20%;
  width: 70vmax;
  height: 140vmax;
  opacity: .16;
  filter: blur(18px);
  background: conic-gradient(from 180deg at 50% 0%, transparent 168deg, #ffe7a8 176deg 184deg, transparent 192deg);
  transform-origin: 50% 0;
  animation: sweep 9s ease-in-out infinite alternate;
}
.stage-lights i:first-child { left: -25%; }
.stage-lights i:last-child { right: -25%; animation-delay: -4.5s; background: conic-gradient(from 180deg at 50% 0%, transparent 168deg, #c8a8ff 176deg 184deg, transparent 192deg); }
@keyframes sweep { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }

#app { height: 100dvh; max-width: 1320px; margin: 0 auto; position: relative; z-index: 1; }

.screen { display: none; height: 100%; }
.screen.active { display: flex; flex-direction: column; animation: screenin .35s ease-out; }
@keyframes screenin { from { opacity: 0; transform: translateY(8px); } }

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { cursor: default; }
input { font: inherit; -webkit-user-select: text; user-select: text; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Botones ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  min-height: 50px;
  padding: .45em 1.1em;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
  background: var(--glass);
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--glass-line), 0 4px 0 #0000004d;
  transition: transform .09s, filter .15s, opacity .15s, box-shadow .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 0 0 1.5px var(--glass-line), 0 1px 0 #0000004d; }
.btn:disabled { opacity: .38; filter: saturate(.4); }
.btn.big { min-height: 62px; font-size: 1.25rem; font-weight: 800; border-radius: 20px; letter-spacing: .01em; }
.btn.primary {
  background: linear-gradient(180deg, #ffe07a 0%, #ffb52e 55%, #ff9418 100%);
  color: var(--ink);
  box-shadow: inset 0 2px 0 #fff6, inset 0 -3px 0 #e07a0080, 0 6px 0 #b85f00, 0 12px 26px #ff9f1c45;
}
.btn.primary:active:not(:disabled) { box-shadow: inset 0 2px 0 #fff6, 0 2px 0 #b85f00; transform: translateY(4px); }
.btn.secondary { background: rgba(255, 255, 255, .1); }
.btn.local {
  background: linear-gradient(180deg, #7fe0ff 0%, #4cc9f0 50%, #2a8fd6 100%);
  color: #052139;
  box-shadow: inset 0 2px 0 #fff6, 0 6px 0 #1a669f, 0 12px 26px #2a8fd640;
}
.btn.local:active:not(:disabled) { box-shadow: inset 0 2px 0 #fff6, 0 2px 0 #1a669f; transform: translateY(4px); }
.btn.tv-btn {
  background: linear-gradient(180deg, #3a2580, #2a1868);
  box-shadow: inset 0 0 0 1.5px #b388ff66, 0 5px 0 #160a3a;
  font-size: .98rem;
}
.btn.ghost { background: none; box-shadow: none; color: var(--muted); min-height: 42px; }
.btn.ghost:active:not(:disabled) { box-shadow: none; }
.btn.danger { background: #ff5d7322; box-shadow: inset 0 0 0 1.5px #ff5d7380; color: #ffb6c1; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 1.25rem;
  display: grid;
  place-items: center;
  background: var(--glass);
  box-shadow: inset 0 0 0 1.5px var(--glass-line);
  flex: none;
}
.icon-btn:active { transform: scale(.94); }

.input {
  width: 100%;
  min-height: 52px;
  padding: .3em .9em;
  border-radius: 16px;
  border: 2px solid #ffffff22;
  background: #0b061ccc;
  box-shadow: inset 0 3px 8px #0007;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: #ffffff4d; }
.input:focus { outline: none; border-color: var(--gold); box-shadow: inset 0 3px 8px #0007, 0 0 0 4px #ffc23d26; }

.lbl { display: block; font-size: .8rem; color: var(--muted); font-weight: 700; margin: 0 0 .35em; letter-spacing: .07em; text-transform: uppercase; }
.hint { color: var(--muted); font-size: .92rem; text-align: center; margin: .3em 0; line-height: 1.3; }

/* ---------- Inicio ---------- */
.home {
  flex: 1;
  overflow-y: auto;
  padding: calc(14px + var(--safe-t)) 20px calc(16px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
}
.logo { text-align: center; margin-top: 1.5vh; position: relative; padding-top: 6px; }
.home-wheel {
  position: absolute;
  left: 50%;
  top: -70px;
  width: 270px;
  height: 270px;
  margin-left: -135px;
  border-radius: 50%;
  opacity: .24;
  background: repeating-conic-gradient(#ff5d73 0 15deg, #ffc23d 15deg 30deg, #3ddc97 30deg 45deg, #4cc9f0 45deg 60deg, #b388ff 60deg 75deg, #ff8a3d 75deg 90deg);
  -webkit-mask: radial-gradient(circle, transparent 0 22%, #000 23% 68%, transparent 69%);
  mask: radial-gradient(circle, transparent 0 22%, #000 23% 68%, transparent 69%);
  animation: spinslow 28s linear infinite;
}
@keyframes spinslow { to { transform: rotate(360deg); } }
.logo-img { position: relative; width: 88px; height: 88px; filter: drop-shadow(0 10px 18px #000a); animation: bob 3.2s ease-in-out infinite; }
.logo-text {
  position: relative;
  margin: .05em 0 0;
  font-size: clamp(2.7rem, 13.5vw, 3.8rem);
  line-height: .92;
  font-weight: 800;
  letter-spacing: .015em;
}
.logo-text span:first-child { color: var(--gold); text-shadow: 0 4px 0 #b06a00, 0 10px 24px #ffb02e55; }
.logo-text span:last-child { color: var(--cream); text-shadow: 0 4px 0 #6a3fd0, 0 10px 24px #8a5cff55; }
.tagline { position: relative; margin: .45em 0 0; color: var(--muted); font-weight: 600; font-size: .98rem; }

.card {
  background: linear-gradient(180deg, #ffffff14, #ffffff07);
  border-radius: 22px;
  padding: 14px;
  box-shadow: inset 0 0 0 1px #ffffff1c, 0 14px 30px #0005;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.avatars { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; margin-top: 10px; }
.avatars button {
  aspect-ratio: 1;
  border-radius: 12px;
  font-size: clamp(1.05rem, 5.4vw, 1.45rem);
  background: #ffffff0d;
  min-width: 0;
  padding: 0;
  display: grid;
  place-items: center;
  transition: transform .15s var(--ease-pop), background .15s;
}
.avatars button:active { transform: scale(.9); }
.avatars button[aria-checked='true'] { background: linear-gradient(180deg, #ffe07a, #ffb52e); transform: scale(1.1); box-shadow: 0 0 0 3px #ffc23d44, 0 6px 14px #ff9f1c55; }

.home-actions { display: flex; flex-direction: column; gap: 12px; }
.join-row { display: flex; gap: 8px; }
.code-input { text-transform: uppercase; letter-spacing: .35em; text-align: center; font-size: 1.45rem; padding-left: 1.2em; }
.foot { text-align: center; color: #ffffff59; font-size: .82rem; margin-top: auto; padding-top: 6px; }

/* ---------- Sala ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 8px;
}
.bar h2 { margin: 0; font-size: 1.3rem; }
.scroll { flex: 1; overflow-y: auto; }
.lobby {
  padding: 4px 18px calc(18px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}
.code-card {
  text-align: center;
  background: linear-gradient(180deg, #ffffff15, #ffffff06);
  border-radius: 26px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px #ffffff1f, 0 16px 34px #0006;
}
.room-code { display: flex; justify-content: center; gap: 8px; margin: 2px 0 14px; }
.room-code span {
  width: 56px;
  height: 68px;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  font-weight: 800;
  border-radius: 12px;
  color: var(--ink);
  background: linear-gradient(180deg, #fffaf0, var(--cream) 60%, var(--cream2));
  box-shadow: inset 0 -4px 0 var(--cream-edge), 0 5px 0 #0006, 0 0 22px #ffe3a033;
  animation: pop .45s var(--ease-pop) backwards;
}
.room-code span:nth-child(2) { animation-delay: .06s; }
.room-code span:nth-child(3) { animation-delay: .12s; }
.room-code span:nth-child(4) { animation-delay: .18s; }
.qr { width: 184px; height: 184px; border-radius: 18px; background: #fff; padding: 8px; display: block; margin: 0 auto 8px; box-shadow: 0 10px 26px #0007; }
.share-url { font-size: .8rem; color: var(--muted); word-break: break-all; margin: 0 0 10px; -webkit-user-select: all; user-select: all; }
.section-title { margin: 6px 0 0; font-size: 1.1rem; }
.section-title span { color: var(--muted); font-size: .9rem; }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 18px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pc, #fff) 18%, transparent), #ffffff08 60%);
  box-shadow: inset 0 0 0 1px #ffffff14;
  animation: slidein .35s ease-out backwards;
}
@keyframes slidein { from { opacity: 0; transform: translateX(-14px); } }
.plist .av {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 60%, #fff), var(--pc));
  box-shadow: 0 0 0 3px #ffffff1f, 0 4px 10px #0006;
  flex: none;
}
.plist .nm { flex: 1; font-weight: 700; font-size: 1.1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .nm small { color: var(--muted); font-weight: 600; }
.plist .x { width: 36px; height: 36px; border-radius: 11px; background: #ffffff12; font-size: 1rem; flex: none; }
.plist.editable .input { min-height: 46px; font-size: 1.05rem; }
.add-local { display: flex; gap: 8px; }
.add-local .btn, .join-row .btn { flex: none; white-space: nowrap; }
.lobby-foot { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }

.switch { display: flex; align-items: center; gap: 12px; font-weight: 600; padding: 6px 2px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .sw { width: 52px; height: 30px; border-radius: 30px; background: #ffffff22; position: relative; transition: background .2s; flex: none; box-shadow: inset 0 2px 5px #0006; }
.switch .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease-pop); box-shadow: 0 2px 5px #0006; }
.switch input:checked + .sw { background: var(--mint); }
.switch input:checked + .sw::after { transform: translateX(22px); }
.switch input:focus-visible + .sw { outline: 3px solid var(--gold); }

/* ---------- Partida ---------- */
#screen-game.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: 'top' 'timer' 'players' 'board' 'msg' 'wheel' 'controls';
  height: 100dvh;
}
#screen-game.no-wheel {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: 'top' 'timer' 'players' 'board' 'msg' 'controls';
}
#screen-game.no-wheel .wheel-wrap { display: none; }
#screen-game.no-wheel .board-wrap { align-self: center; }

.g-top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(6px + var(--safe-t)) 10px 4px;
  min-width: 0;
}
.g-round { display: flex; flex-direction: column; line-height: 1.02; flex: none; min-width: 66px; }
#g-num { font-weight: 800; font-size: 1.02rem; letter-spacing: .01em; }
.badge { font-size: .7rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.badge.speed { color: var(--sky); }
.badge.final { color: var(--gold); }
.badge.double { color: var(--mint); }
/* la pista, como un cartel de feria */
.g-cat {
  position: relative;
  flex: 1;
  min-width: 0;
  text-align: center;
  font-weight: 800;
  font-size: 1.04rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #fffaf0, var(--cream) 55%, var(--cream2));
  border-radius: 12px;
  padding: 5px 12px 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 -3px 0 var(--cream-edge), 0 0 0 2px #e09a1f, 0 0 0 4px #ffffff10, 0 6px 16px #0007;
}
.g-cat:empty { visibility: hidden; }
.g-room {
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .12em;
  flex: none;
  padding: 3px 7px;
  border-radius: 8px;
  background: var(--glass);
}
.g-room:empty { display: none; }

.timer { grid-area: timer; height: 6px; margin: 6px 12px 0; border-radius: 6px; background: #ffffff10; position: relative; }
.timer i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), #a6f0c9);
  box-shadow: 0 0 10px #3ddc9766;
}
.timer i.warn { background: linear-gradient(90deg, var(--gold), #ffe08a); box-shadow: 0 0 10px #ffc23d66; }
.timer i.crit { background: linear-gradient(90deg, var(--coral), #ff9aa8); box-shadow: 0 0 12px #ff5d73aa; animation: crit .5s ease-in-out infinite alternate; }
@keyframes crit { to { opacity: .55; } }
.timer b { position: absolute; right: 0; top: 7px; font-size: .78rem; color: var(--coral); font-weight: 800; }

.board-wrap { grid-area: board; padding: 8px 12px 0; }
.board-frame {
  container-type: inline-size;
  position: relative;
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(9px, 2.8vw, 18px);
  border-radius: 20px;
  background:
    radial-gradient(120% 90% at 50% 0%, #3d2389, transparent 70%),
    linear-gradient(180deg, #2b186a, #170b3d);
  box-shadow:
    0 0 0 2px #c98a1c,
    0 0 0 5px #ffd56b,
    0 0 0 7px #8a5a0e,
    0 16px 40px #000a,
    0 0 60px #ffb02e22,
    inset 0 2px 12px #0008;
}
.board-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: clamp(3px, 1vw, 6px);
  background: radial-gradient(circle, #fff3c4 0 1.6px, #ffd56b 2.2px, #ffd56b00 3.2px) 0 0 / 12px 12px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: bulbs 1.1s steps(2) infinite;
  pointer-events: none;
}
.board-frame.party::before { animation-duration: .22s; filter: brightness(1.3); }
.board-frame.party { box-shadow: 0 0 0 2px #c98a1c, 0 0 0 5px #ffd56b, 0 0 0 7px #8a5a0e, 0 16px 40px #000a, 0 0 90px #ffd56b66, inset 0 2px 12px #0008; }
@keyframes bulbs { to { background-position: 6px 0; } }

.board {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: clamp(2px, .75cqw, 6px);
  perspective: 700px;
}
.board.shake { animation: shake .45s; }
.tile {
  aspect-ratio: 5 / 6.3;
  border-radius: clamp(3px, .9cqw, 8px);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: calc(100cqw / 14 * .66);
  line-height: 1;
  background: linear-gradient(180deg, #ffffff0c, #ffffff05);
  box-shadow: inset 0 0 0 1px #ffffff09;
  position: relative;
}
.tile span { transform: translateY(.07em); }
.tile.hidden, .tile.shown {
  color: var(--ink);
  background: linear-gradient(180deg, #fffcf3, var(--cream) 55%, var(--cream2));
  box-shadow: inset 0 -.35cqw 0 var(--cream-edge), inset 0 .2cqw 0 #fff, 0 .35cqw .6cqw #0007;
}
.tile.hidden {
  background:
    radial-gradient(circle, #ecd49b 0 11%, transparent 12%),
    linear-gradient(45deg, transparent 45%, #ecd49b55 46% 54%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #ecd49b55 46% 54%, transparent 55%),
    linear-gradient(180deg, #fffcf3, var(--cream) 55%, var(--cream2));
}
.tile.shown span { text-shadow: 0 1px 0 #fff; }
.tile.lit {
  background: radial-gradient(circle at 50% 35%, #d9f6ff, var(--sky) 60%, #1d8fc0);
  box-shadow: 0 0 2.6cqw var(--sky), inset 0 0 0 .3cqw #fffb;
  animation: litpulse .3s ease-in-out infinite alternate;
}
.tile.flip { animation: flip .55s var(--ease-pop); }
.tile.pop { animation: pop .45s ease-out backwards; }
.tile.fill span { color: #6a2ff0; }
.tile.cursor { box-shadow: inset 0 0 0 .55cqw var(--gold), 0 0 2.2cqw #ffc23d99; animation: cursor 1s ease-in-out infinite; }
.tile.tappable { cursor: pointer; }
@keyframes flip { 0% { transform: rotateX(95deg); filter: brightness(1.6); } 100% { transform: rotateX(0); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes litpulse { to { filter: brightness(1.3); } }
@keyframes cursor { 50% { box-shadow: inset 0 0 0 .55cqw #ffc23d55, 0 0 1cqw #ffc23d44; } }
@keyframes shake { 20%, 60% { transform: translateX(-7px) rotate(-.4deg); } 40%, 80% { transform: translateX(7px) rotate(.4deg); } }

.g-msg {
  grid-area: msg;
  min-height: 1.7em;
  margin: 10px 14px 0;
  text-align: center;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.25;
  color: var(--cream);
  text-shadow: 0 2px 8px #000a;
}
.g-msg.flash { animation: msgin .4s var(--ease-pop); }
@keyframes msgin { from { transform: translateY(8px) scale(.96); opacity: 0; } }

.players {
  grid-area: players;
  display: flex;
  gap: 7px;
  padding: 8px 10px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.players::-webkit-scrollbar { display: none; }
.players.many .pchip { justify-content: center; gap: 5px; padding: 4px 5px 4px 4px; }
.players.many .pname, .players.many .ptotal { display: none; }
.players.many .pround { font-size: 1.02rem; }
.players.many .pav { width: 30px; height: 30px; font-size: 1.05rem; }
.pchip {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px 5px 5px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff10, #ffffff06);
  box-shadow: inset 0 0 0 1.5px #ffffff12;
  position: relative;
  transition: background .3s, box-shadow .3s, transform .3s var(--ease-pop);
}
.pchip.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 34%, transparent), color-mix(in srgb, var(--pc) 12%, transparent));
  box-shadow: inset 0 0 0 2px var(--pc), 0 8px 22px color-mix(in srgb, var(--pc) 45%, transparent);
}
.pchip.active::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -5px;
  height: 3px;
  border-radius: 3px;
  background: var(--pc);
  box-shadow: 0 0 8px var(--pc);
  animation: nudge 1.2s ease-in-out infinite;
}
@keyframes nudge { 50% { opacity: .45; } }
.pchip.off { opacity: .42; }
.pchip.locked { filter: grayscale(1); opacity: .5; }
.pav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 55%, #fff), var(--pc));
  box-shadow: 0 0 0 2px #ffffff26, 0 3px 8px #0006;
  display: grid;
  place-items: center;
  font-size: 1.28rem;
  flex: none;
}
.pinfo { min-width: 0; line-height: 1.02; }
.pname { font-size: .78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ffffffd9; }
.pname small { color: var(--muted); }
.pround { font-size: 1.2rem; font-weight: 800; color: var(--cream); font-variant-numeric: tabular-nums; }
.ptotal { font-size: .68rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.pjoker {
  position: absolute;
  top: -7px;
  right: -4px;
  background: linear-gradient(180deg, #ffe07a, #ffb52e);
  color: var(--ink);
  font-size: .7rem;
  font-weight: 800;
  border-radius: 10px;
  padding: 0 6px;
  box-shadow: 0 3px 8px #0007;
  animation: pop .4s var(--ease-pop);
}
.pround.bump { animation: bump .7s ease-out; }
@keyframes bump { 25% { transform: scale(1.35); color: var(--mint); text-shadow: 0 0 12px #3ddc97aa; } }

.wheel-wrap {
  grid-area: wheel;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 0;
  overflow: visible;
  padding-top: 2px;
}
/* foco bajo la ruleta */
.wheel-wrap::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(92%, 640px);
  aspect-ratio: 1;
  transform: translate(-50%, -48%);
  border-radius: 50%;
  background: radial-gradient(circle, #ffd56b2e 0%, #b388ff14 45%, transparent 68%);
  pointer-events: none;
}
#wheel { position: relative; display: block; touch-action: none; filter: drop-shadow(0 18px 26px #000b); transition: filter .3s; }
#wheel.grab { cursor: grab; animation: wheelcall 1.8s ease-in-out infinite; }
@keyframes wheelcall { 50% { filter: drop-shadow(0 18px 26px #000b) drop-shadow(0 0 22px #ffd56b99); } }

/* pista de arrastre: una mano que recorre el arco superior */
.spin-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.spin-hint b {
  font-size: .95rem;
  font-weight: 800;
  color: var(--ink);
  background: linear-gradient(180deg, #fffaf0, var(--cream2));
  border-radius: 999px;
  padding: 4px 14px 2px;
  box-shadow: 0 6px 18px #000a, 0 0 0 2px #e09a1f;
  white-space: nowrap;
  animation: hintpulse 1.8s ease-in-out infinite;
}
.spin-hint .hand {
  font-size: 2.4rem;
  filter: drop-shadow(0 4px 6px #000a);
  animation: swipe 1.8s ease-in-out infinite;
}
@keyframes swipe {
  0% { transform: translate(-46px, 10px) rotate(-25deg); opacity: 0; }
  15% { opacity: 1; }
  60% { transform: translate(46px, 10px) rotate(25deg); opacity: 1; }
  80%, 100% { transform: translate(60px, 18px) rotate(30deg); opacity: 0; }
}
@keyframes hintpulse { 50% { transform: scale(1.05); } }
#wheel.grabbing { cursor: grabbing; }

.controls {
  grid-area: controls;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px calc(10px + var(--safe-b));
  min-height: 0;
  margin: 6px 4px 0;
  position: relative;
  z-index: 3;
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #2c1868e6, #170b3df5 60%);
  box-shadow: inset 0 1px 0 #ffffff2a, 0 -14px 30px #0009;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.controls::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 38px;
  height: 4px;
  margin-left: -19px;
  border-radius: 4px;
  background: #ffffff26;
}
.controls:empty { display: none; }
.controls > :first-child { margin-top: 6px; }
.ctrl-head { text-align: center; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.ctrl-head b { color: var(--gold); font-size: 1.18em; }

.turn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 1.05rem; padding: 0 2px; }
.turn-head b { color: var(--gold); }
.pill { font-size: .85rem; font-weight: 700; color: var(--muted); background: #ffffff10; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill b { color: var(--cream); font-size: 1.05rem; }
.turn-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.btn.solve {
  flex-direction: column;
  gap: 0;
  min-width: 96px;
  min-height: 56px;
  padding: .3em .8em;
  font-size: 1rem;
  font-weight: 800;
  border-radius: 20px;
  background: linear-gradient(180deg, #cdb0ff 0%, #9b6bff 50%, #7044e6 100%);
  color: #fff;
  text-shadow: 0 1px 2px #0005;
  box-shadow: inset 0 2px 0 #fff5, 0 6px 0 #45209e, 0 12px 26px #7b4cf044;
}
.btn.solve .i { font-size: 1.3rem; line-height: 1; }
.vowel-box { display: flex; align-items: center; gap: 6px; min-width: 0; }
.vowel-box .vrow .key { height: 56px; }
.vowel-box .lbl { margin: 0; flex: none; line-height: 1.1; text-align: center; }
.vowel-box .lbl b { display: block; color: var(--gold); font-size: 1.1rem; }

.kb { display: flex; flex-direction: column; gap: 6px; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1 1 0;
  min-width: 0;
  max-width: 50px;
  height: clamp(42px, 6.2dvh, 54px);
  border-radius: 11px;
  background: linear-gradient(180deg, #fffcf3, var(--cream) 60%, var(--cream2));
  color: var(--ink);
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 #b99c5e, 0 5px 8px #0005;
  display: grid;
  place-items: center;
  transition: transform .06s;
}
.key:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 1px 0 #fff, 0 1px 0 #b99c5e; }
.key.vowel { background: linear-gradient(180deg, #ffeef2, #ffd6de 60%, #ffc2ce); box-shadow: inset 0 1px 0 #fff, 0 3px 0 #cf7f90, 0 5px 8px #0005; }
.key.used, .key:disabled { background: #ffffff10; color: #ffffff47; box-shadow: inset 0 0 0 1px #ffffff12; }
.key.used { text-decoration: line-through; }
.key.sel { background: linear-gradient(180deg, #ffe07a, #ffb52e); box-shadow: inset 0 1px 0 #fff8, 0 3px 0 #b06a00, 0 0 14px #ffc23d88; }
.key.wide { flex-grow: 1.7; max-width: 84px; font-size: 1.1rem; }
.vrow { display: flex; gap: 6px; flex: 1; }
.vrow .key { max-width: none; }

.solve-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; }
.solve-actions.solo { grid-template-columns: 1fr; }
.btn.ok { background: linear-gradient(180deg, #8ff5c6, #3ddc97 55%, #1fae74); color: #04291a; box-shadow: inset 0 2px 0 #fff6, 0 6px 0 #0f6c45; font-weight: 800; }

.ctrl-wait { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; padding: 2px 0; }
.who { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; font-weight: 700; flex-wrap: wrap; justify-content: center; }
.who .pav { width: 32px; height: 32px; font-size: 1.1rem; }
.used-strip { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; max-width: 520px; }
.used-strip span {
  width: 23px;
  height: 27px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 800;
  background: #ffffff12;
  color: #ffffffd0;
}
.used-strip span.u { background: transparent; color: #ffffff2e; text-decoration: line-through; box-shadow: inset 0 0 0 1px #ffffff0d; }
.used-strip span.v:not(.u) { color: #ffb8c6; }
.reacts { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.reacts button { width: 42px; height: 42px; border-radius: 13px; background: #ffffff10; font-size: 1.3rem; box-shadow: inset 0 0 0 1px #ffffff12; transition: transform .15s var(--ease-pop); }
.reacts button:active { transform: scale(1.3) rotate(-8deg); }

.buzz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; align-content: center; }
.buzz {
  min-height: 112px;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--pc) 55%, #fff), var(--pc) 58%, color-mix(in srgb, var(--pc) 70%, #000));
  color: var(--ink);
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: inset 0 3px 0 #fff8, 0 9px 0 color-mix(in srgb, var(--pc) 50%, #000), 0 16px 34px #0007;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  touch-action: none;
}
.buzz:not(:disabled) { animation: buzzglow 1.2s ease-in-out infinite; }
@keyframes buzzglow { 50% { filter: brightness(1.12); } }
.buzz .e { font-size: 2.1rem; }
.buzz:active:not(:disabled) { transform: translateY(7px); box-shadow: inset 0 3px 0 #fff8, 0 2px 0 color-mix(in srgb, var(--pc) 50%, #000); }
.buzz.solo { min-height: 170px; font-size: 1.7rem; border-radius: 999px; }

.final-slots { display: flex; justify-content: center; gap: 6px; align-items: center; }
.final-slots span {
  width: 42px;
  height: 50px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.5rem;
  background: #ffffff10;
  box-shadow: inset 0 0 0 2px #ffffff2a;
}
.final-slots span.on { background: linear-gradient(180deg, #ffe07a, #ffb52e); color: var(--ink); box-shadow: 0 4px 0 #b06a00; animation: pop .3s var(--ease-pop); }
.final-slots i { font-style: normal; color: var(--muted); margin: 0 4px; font-weight: 800; }

.result {
  text-align: center;
  background: linear-gradient(180deg, #ffffff18, #ffffff08);
  border-radius: 22px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  box-shadow: inset 0 0 0 1px #ffffff1c;
  animation: pop .45s var(--ease-pop);
}
.result .rw { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; font-weight: 800; }
.result .prize { color: var(--mint); font-size: 1.8rem; font-weight: 800; line-height: 1; text-shadow: 0 0 18px #3ddc9788; }
.result .ans { color: var(--muted); font-weight: 600; font-size: .9rem; }

/* ---------- Efectos ---------- */
.float-score {
  position: fixed;
  z-index: 44;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: 2rem;
  color: #fff;
  -webkit-text-stroke: 1.5px var(--c);
  text-shadow: 0 0 18px var(--c), 0 4px 0 #0008;
  pointer-events: none;
  animation: scoreup 1.6s cubic-bezier(.2, .9, .3, 1) forwards;
}
.float-score.big { font-size: 3.4rem; }
@keyframes scoreup {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(.4); }
  18% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  70% { opacity: 1; transform: translate(-50%, -110%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(.9); }
}
.screen-flash { position: fixed; inset: 0; z-index: 42; pointer-events: none; animation: sflash .65s ease-out forwards; }
.screen-flash.bad { background: radial-gradient(circle, transparent 30%, #ff2d4b88); }
.screen-flash.gold { background: radial-gradient(circle, transparent 30%, #ffc23d77); }
@keyframes sflash { from { opacity: 1; } to { opacity: 0; } }

/* ---------- Superposiciones ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 45%, #2a1563d0, #07031ae8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadein .25s;
  overflow: hidden;
}
@keyframes fadein { from { opacity: 0; } }
.intro-card {
  position: relative;
  isolation: isolate;
  text-align: center;
  padding: 28px 22px 24px;
  border-radius: 30px;
  background: linear-gradient(180deg, #43278f, #1d1045);
  box-shadow: 0 24px 70px #000b, inset 0 0 0 3px #ffc23d77, inset 0 2px 0 #fff3;
  width: min(92vw, 400px);
  animation: zoomin .5s var(--ease-pop);
}
/* rayos de sol detrás de la tarjeta */
.overlay .rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240vmax;
  height: 240vmax;
  margin: -120vmax 0 0 -120vmax;
  background: repeating-conic-gradient(#ffffff0d 0 7deg, transparent 7deg 14deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 38%);
  mask: radial-gradient(circle, #000 0, transparent 38%);
  animation: spinslow 50s linear infinite;
  pointer-events: none;
}
.intro-card.speed { box-shadow: 0 24px 70px #000b, inset 0 0 0 3px var(--sky), 0 0 60px #4cc9f044; }
.intro-card.final { box-shadow: 0 24px 70px #000b, inset 0 0 0 3px var(--gold), 0 0 80px #ffc23d66; }
.intro-n { font-size: 3.8rem; font-weight: 800; line-height: 1; color: var(--gold); text-shadow: 0 4px 0 #b06a00; }
.intro-n small { font-size: 1.4rem; color: var(--muted); text-shadow: none; }
.intro-type { font-size: 1.55rem; font-weight: 800; margin-top: 4px; }
.intro-cat {
  display: inline-block;
  margin: 14px 0 8px;
  padding: 7px 18px 5px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffaf0, var(--cream) 55%, var(--cream2));
  color: var(--ink);
  font-weight: 800;
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  box-shadow: inset 0 -3px 0 var(--cream-edge), 0 0 0 2px #e09a1f, 0 8px 20px #0007;
  animation: pop .5s .2s var(--ease-pop) backwards;
}
.intro-card p { margin: 8px 0 0; color: #d8ccff; font-weight: 600; line-height: 1.35; }
.intro-card .skip { display: block; margin-top: 12px; font-size: .78rem; color: #ffffff55; }
@keyframes zoomin { from { transform: scale(.5) rotate(-4deg); opacity: 0; } }

.go-card {
  position: relative;
  width: min(94vw, 460px);
  max-height: 92dvh;
  overflow-y: auto;
  text-align: center;
  padding: 22px 18px;
  border-radius: 30px;
  background: linear-gradient(180deg, #43278f, #1d1045);
  box-shadow: 0 24px 70px #000b, inset 0 0 0 3px #ffc23d77;
  animation: zoomin .55s var(--ease-pop);
}
.go-card h2 { margin: 0; font-size: 1.9rem; }
.go-card .winner { color: var(--gold); font-weight: 800; font-size: 1.15rem; margin: 2px 0 8px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: 26px 0 10px; }
.podium .col { position: relative; flex: 1; max-width: 124px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; animation: rise .7s var(--ease-pop) backwards; }
.podium .second { animation-delay: .25s; }
.podium .first { animation-delay: .5s; }
.podium .third { animation-delay: .1s; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.podium .av { width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 55%, #fff), var(--pc)); display: grid; place-items: center; font-size: 1.9rem; box-shadow: 0 0 0 3px #ffffff30, 0 6px 16px #0008; }
.podium .first .av { width: 70px; height: 70px; font-size: 2.5rem; box-shadow: 0 0 0 3px var(--gold), 0 0 30px #ffc23d88; }
.podium .first::before { content: '👑'; position: absolute; top: -26px; font-size: 1.6rem; animation: bob 2s ease-in-out infinite; }
.podium .nm { font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .pts { color: var(--cream); font-weight: 700; font-size: .92rem; font-variant-numeric: tabular-nums; }
.podium .step {
  width: 100%;
  border-radius: 14px 14px 4px 4px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--ink);
  box-shadow: inset 0 2px 0 #fff8, 0 8px 18px #0007;
}
.podium .first .step { height: 100px; background: linear-gradient(180deg, #ffe895, #ffb21f); }
.podium .second .step { height: 74px; background: linear-gradient(180deg, #f4f5ff, #b7bde0); }
.podium .third .step { height: 54px; background: linear-gradient(180deg, #ffd0ac, #d9824a); }
.rank { list-style: none; margin: 0 0 12px; padding: 0; text-align: left; }
.rank li { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 12px; background: #ffffff0c; margin-top: 6px; }
.rank li b { margin-left: auto; }
.aw-h { margin: 14px 0 8px; font-size: .95rem; color: var(--gold); letter-spacing: .06em; text-transform: uppercase; }
.awards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.award {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: 'i t' 'i p' 'i n';
  column-gap: 8px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--pc) 26%, transparent), #ffffff08);
  box-shadow: inset 0 0 0 1px #ffffff18;
  line-height: 1.15;
  animation: pop .45s var(--ease-pop) backwards;
}
.award:nth-child(2) { animation-delay: .08s; }
.award:nth-child(3) { animation-delay: .16s; }
.award:nth-child(4) { animation-delay: .24s; }
.award:nth-child(5) { animation-delay: .32s; }
.award:nth-child(6) { animation-delay: .4s; }
.aw-i { grid-area: i; font-size: 1.8rem; align-self: center; }
.aw-t { grid-area: t; font-weight: 800; font-size: .86rem; color: var(--cream); }
.aw-p { grid-area: p; font-size: .8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aw-n { grid-area: n; font-size: .72rem; color: var(--muted); font-weight: 600; }
.go-actions { display: flex; flex-direction: column; gap: 8px; }

.banner {
  position: fixed;
  left: 50%;
  top: 38%;
  z-index: 25;
  transform: translate(-50%, -50%);
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 14px 26px;
  border-radius: 24px;
  font-size: 1.55rem;
  font-weight: 800;
  background: radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--pc, var(--gold)) 50%, #fff), var(--pc, var(--gold)));
  color: var(--ink);
  box-shadow: inset 0 3px 0 #fff8, 0 18px 44px #000b, 0 0 40px color-mix(in srgb, var(--pc, var(--gold)) 60%, transparent);
  pointer-events: none;
  white-space: nowrap;
  animation: banner 1.5s ease forwards;
}
@keyframes banner {
  0% { transform: translate(-50%, -50%) scale(.4) rotate(-6deg); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.08) rotate(1deg); opacity: 1; }
  25% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -64%); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  z-index: 50;
  transform: translate(-50%, 30px);
  opacity: 0;
  padding: 11px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fffaf0, var(--cream2));
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 12px 30px #000a;
  transition: opacity .25s, transform .3s var(--ease-pop);
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: linear-gradient(180deg, #ff8094, var(--coral)); color: #fff; }

.net-status {
  position: fixed;
  top: calc(8px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 4px 14px;
  border-radius: 20px;
  background: var(--coral);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  box-shadow: 0 6px 18px #0008;
  animation: fadein .3s;
}

.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

.float-emoji {
  position: fixed;
  bottom: 18%;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  animation: floatup 2.8s ease-out forwards;
}
.fe-e { font-size: 2.7rem; filter: drop-shadow(0 4px 8px #0008); }
.fe-n { font-size: .75rem; font-weight: 800; color: var(--c); background: #0009; border-radius: 8px; padding: 0 6px; }
@keyframes floatup {
  0% { transform: translateY(0) scale(.4); opacity: 0; }
  12% { transform: translateY(-20px) scale(1.2) rotate(-6deg); opacity: 1; }
  100% { transform: translateY(-46vh) scale(1) rotate(6deg); opacity: 0; }
}

.dlg {
  border: 0;
  padding: 20px;
  width: min(94vw, 480px);
  max-height: 88dvh;
  border-radius: 26px;
  background: linear-gradient(180deg, #34207a, #1b0f40);
  color: var(--text);
  box-shadow: 0 24px 70px #000c, inset 0 0 0 1.5px #ffffff22;
}
.dlg[open] { animation: zoomin .35s var(--ease-pop); }
.dlg::backdrop { background: #07031099; backdrop-filter: blur(4px); }
.dlg h2 { margin: 0 0 8px; }
.dlg form { margin-top: 12px; display: flex; flex-direction: column; }
.rules { font-size: .98rem; line-height: 1.42; }
.rules h3 { margin: 14px 0 4px; font-size: 1.05rem; color: var(--gold); }
.rules ul { margin: 0; padding-left: 1.1em; }
.rules li { margin: 3px 0; }
.menu-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

@keyframes bob { 50% { transform: translateY(-7px) rotate(-3deg); } }

/* ---------- Horizontal / escritorio ---------- */
@media (min-width: 820px) and (min-aspect-ratio: 5/4) {
  #screen-game.active {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
    grid-template-areas:
      'top top'
      'timer timer'
      'wheel players'
      'wheel board'
      'wheel msg'
      'wheel controls';
  }
  #screen-game.no-wheel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
    grid-template-areas: 'top' 'timer' 'players' 'board' 'msg' 'controls';
  }
  #screen-game.no-wheel .board-wrap, #screen-game.no-wheel .controls, #screen-game.no-wheel .players, #screen-game.no-wheel .g-msg { width: 100%; max-width: 860px; margin-left: auto; margin-right: auto; }
  .controls { align-self: start; justify-content: flex-start; border-radius: 24px; margin: 8px 10px 10px; box-shadow: inset 0 1px 0 #ffffff2a, 0 10px 30px #0007; }
  .controls::before { display: none; }
  .wheel-wrap { align-items: center; }
  .spin-hint { bottom: 18%; }
  .g-cat { font-size: 1.2rem; }
}

/* ---------- Pantalla grande (TV) ---------- */
body.tv .lobby { max-width: 1100px; display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: auto auto auto 1fr; gap: 14px 28px; align-items: start; }
body.tv .code-card { grid-row: 1 / span 4; padding: 26px; }
body.tv .lobby-hint-big { font-size: 1.3rem; color: var(--cream); }
body.tv .room-code span { width: 84px; height: 100px; font-size: 3.6rem; }
body.tv .qr { width: 300px; height: 300px; }
body.tv .share-url { font-size: 1rem; }
body.tv .g-msg { font-size: 1.5rem; }
body.tv .pround { font-size: 1.6rem; }
body.tv .pav { width: 48px; height: 48px; font-size: 1.7rem; }
body.tv .pname { font-size: 1rem; }
body.tv .controls { background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
body.tv .used-strip { max-width: 760px; }
body.tv .used-strip span { width: 34px; height: 40px; font-size: 1.15rem; }
body.tv .who { font-size: 1.6rem; }
@media (min-width: 820px) and (min-aspect-ratio: 5/4) {
  body.tv #screen-game.active { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
}

/* Móvil vertical: aprovechar el ancho */
@media (max-width: 819px), (max-aspect-ratio: 5/4) {
  .g-top { padding: calc(6px + var(--safe-t)) 8px 2px; gap: 6px; }
  .g-round { min-width: 0; }
  #g-num { font-size: .92rem; }
  .icon-btn#btn-menu { width: 38px; height: 38px; }
  .board-wrap { padding: 8px 7px 0; }
  .board-frame { padding: clamp(7px, 2.2vw, 12px); border-radius: 16px; }
  .board { gap: clamp(2px, .6cqw, 4px); }
  .tile { font-size: calc(100cqw / 14 * .7); }
  .players { padding: 6px 7px 4px; gap: 5px; }
  .pchip { padding: 4px 6px 4px 4px; gap: 6px; border-radius: 14px; }
  .g-msg { margin: 8px 10px 0; font-size: .96rem; min-height: 1.4em; }
}

/* Pantallas bajas: compactar */
@media (max-height: 700px) {
  .pav { width: 30px; height: 30px; font-size: 1.05rem; }
  .ptotal { display: none; }
  .key { height: 42px; }
  .vowel-box .vrow .key, .btn.solve { height: auto; min-height: 50px; }
  .used-strip span { width: 21px; height: 24px; }
  .reacts button { width: 36px; height: 36px; font-size: 1.1rem; }
  .controls .hint { font-size: .78rem; margin: 0; }
  .spin-hint .hand { font-size: 1.8rem; }
  .spin-hint b { font-size: .8rem; }
  .g-msg { font-size: .92rem; margin-top: 6px; }
  .board-wrap { padding-top: 6px; }
  .players { padding-top: 4px; }
}

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