:root {
  --bg: #03040C; --ink: #EEF6FF; --mute: #8FA3D8; --blue: #1FA8FF; --pink: #FF1FB4;
  --bglow: 0 0 6px rgba(31,168,255,.9), 0 0 18px rgba(31,168,255,.55); --pglow: 0 0 6px rgba(255,31,180,.95), 0 0 20px rgba(255,31,180,.6);
  --display: 'Chakra Petch', 'Arial Narrow', system-ui, sans-serif; --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: clamp(15px, 0.25vw + 13px, 17px); }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 1rem/1.45 var(--body); overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; -webkit-user-select: text; user-select: text; }
svg { width: 1.25em; height: 1.25em; flex: none; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }

#app { position: fixed; inset: 0; background:
  radial-gradient(90% 55% at 15% 0%, rgba(31,168,255,.22), transparent 60%),
  radial-gradient(80% 55% at 90% 100%, rgba(255,31,180,.2), transparent 60%),
  linear-gradient(rgba(31,168,255,.09) 1px, transparent 1px) 0 0 / 32px 32px,
  linear-gradient(90deg, rgba(255,31,180,.07) 1px, transparent 1px) 0 0 / 32px 32px, var(--bg); }
#app::after { content: ''; position: absolute; inset: 0; background: radial-gradient(80% 80% at 50% 50%, transparent 40%, var(--bg)); pointer-events: none; }
body.in-game #app { background: transparent; pointer-events: none; }
body.in-game #app::after { display: none; }
body.in-game .screen.active { pointer-events: auto; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: none; touch-action: none; }
body.in-game #game { display: block; }

.screen { position: absolute; inset: 0; z-index: 1; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: calc(var(--sat) + 12px) calc(var(--sar) + 16px) calc(var(--sab) + 12px) calc(var(--sal) + 16px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen.active { display: flex; animation: screenIn .28s cubic-bezier(.2,.8,.2,1) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.screen:has(> .topbar) { justify-content: flex-start; }
.screen.overlay { background: rgba(3, 4, 12, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 20; }

.panel { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.panel.narrow { max-width: 400px; } .panel.wide { max-width: 560px; }
.center { text-align: center; align-items: center; }
h2 { font: 600 1.4rem/1.2 var(--display); margin: 0; text-shadow: 0 0 12px rgba(31,168,255,.45); }
.muted { color: var(--mute); margin: 0; } .small { font-size: .85rem; }
.err { color: #FF6CC8; min-height: 1.2em; margin: 0; font-size: .9rem; }
.big-num { font: 700 2.8rem/1 var(--display); margin: 0; font-variant-numeric: tabular-nums; text-shadow: var(--bglow); }

/* botones tubo de neón */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 12px 18px; border-radius: 16px;
  background: rgba(6, 14, 44, .65); border: 1.5px solid rgba(31,168,255,.75); color: #DDF1FF; font: 600 1.05rem/1.1 var(--display); letter-spacing: .02em;
  box-shadow: 0 0 12px rgba(31,168,255,.35), inset 0 0 12px rgba(31,168,255,.18); text-shadow: 0 0 8px rgba(31,168,255,.9);
  transition: transform .1s ease, box-shadow .2s ease, background .2s ease; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; }
.btn.primary { background: rgba(255,31,180,.12); border: 2px solid var(--pink); color: #fff;
  box-shadow: 0 0 20px rgba(255,31,180,.6), 0 0 44px rgba(255,31,180,.25), inset 0 0 18px rgba(255,31,180,.35); text-shadow: var(--pglow); }
.btn.primary:active { background: rgba(255,31,180,.3); }
.btn.danger { background: rgba(255,31,180,.2); border: 2px solid var(--pink); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; border-color: rgba(31,168,255,.4); }
.btn.big { min-height: 60px; font-size: 1.15rem; width: 100%; }
.btn.huge { width: 100%; min-height: 76px; flex-direction: column; gap: 3px; font-size: 1.5rem; border-radius: 18px; }
.btn.huge small { font: 600 .82rem var(--body); letter-spacing: 0; opacity: .8; text-shadow: none; }
.btn.pulse { animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 34px rgba(255,31,180,.95), 0 0 70px rgba(255,31,180,.45), inset 0 0 22px rgba(255,31,180,.5); transform: scale(1.03); } }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.icon-btn { width: 46px; height: 46px; border-radius: 14px; border: 1.5px solid rgba(31,168,255,.55); background: rgba(8, 14, 40, .6); display: grid; place-items: center; color: #BFE4FF; box-shadow: 0 0 10px rgba(31,168,255,.25); transition: opacity .2s; }
.icon-btn.off { opacity: .35; box-shadow: none; }
.big-input { width: 100%; min-height: 60px; padding: 10px 16px; border-radius: 16px; border: 1.5px solid rgba(31,168,255,.6); background: rgba(4, 8, 26, .85); color: var(--ink);
  font: 600 1.3rem var(--display); text-align: center; box-shadow: inset 0 0 12px rgba(31,168,255,.15); }
.big-input:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 16px rgba(255,31,180,.5); }

/* logo */
.logo { position: relative; text-align: center; }
.logo h1 { margin: 0; font: 700 clamp(3rem, 15vw, 5.6rem)/.86 var(--display); letter-spacing: -.02em; display: flex; flex-direction: column; }
.logo h1 span:first-child { color: transparent; -webkit-text-stroke: 2px #6CC8FF; text-shadow: 0 0 10px rgba(31,168,255,.9), 0 0 30px rgba(31,168,255,.7), 0 0 60px rgba(31,168,255,.4); }
.logo h1 span:last-child { color: #FFE6F7; text-shadow: 0 0 8px var(--pink), 0 0 22px var(--pink), 0 0 50px rgba(255,31,180,.7); animation: neonOn 1.4s .9s both; }
@keyframes neonOn { 0%, 10%, 18%, 30% { opacity: .25; } 5%, 14%, 24%, 100% { opacity: 1; } }
#s-nick .logo h1 { font-size: 2.6rem; }
.trail { width: min(340px, 86vw); height: auto; display: block; margin: 0 auto 10px; overflow: visible; }
.trail path { fill: none; stroke: var(--blue); stroke-width: 7; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 5px var(--blue)) drop-shadow(0 0 12px var(--blue));
  stroke-dasharray: 560; stroke-dashoffset: 560; animation: draw 1.3s cubic-bezier(.6, 0, .2, 1) .1s forwards; }
.trail-head { fill: #fff; filter: drop-shadow(0 0 8px var(--blue)); opacity: 0; animation: pop .3s 1.35s forwards; }
.trail.done path { animation: none; stroke-dashoffset: 0; } .trail.done .trail-head { animation: none; opacity: 1; }
@keyframes draw { to { stroke-dashoffset: 0; } } @keyframes pop { to { opacity: 1; } }
.boot-mark { font: 700 1.4rem var(--display); color: var(--mute); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .35; } }

/* menú */
.topbar { width: 100%; max-width: 560px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.spacer { width: 46px; }
.toggles { display: flex; gap: 8px; }
.chip { display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 999px; border: 1.5px solid rgba(31,168,255,.55); background: rgba(8, 14, 40, .7); text-align: left; min-height: 50px; box-shadow: 0 0 12px rgba(31,168,255,.25); }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 10px var(--blue); flex: none; }
.chip-text { display: flex; flex-direction: column; line-height: 1.15; }
.chip-text b { font: 600 1rem var(--display); } .chip-text small { color: #FF9EDD; font-weight: 700; font-size: .8rem; }
#s-menu { justify-content: space-between; }
.menu-main { flex: 1; width: 100%; max-width: 420px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.tagline { text-align: center; color: #BFD3FF; margin: -4px 0 12px; font-weight: 600; }
.menu-actions { display: flex; flex-direction: column; gap: 12px; }
#b-live { animation: flicker 1.1s 1.5s; }
@keyframes flicker { 0%, 12%, 20%, 34% { opacity: .35; } 8%, 16%, 28%, 100% { opacity: 1; } }

/* búsqueda */
.radar { position: relative; width: 150px; height: 150px; margin: 10px auto 6px; }
.radar i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--pink); box-shadow: 0 0 12px rgba(255,31,180,.6); opacity: 0; animation: ping 2.4s ease-out infinite; }
.radar i:nth-child(2) { animation-delay: .8s; } .radar i:nth-child(3) { animation-delay: 1.6s; }
.radar b { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 22px var(--blue); }
@keyframes ping { 0% { transform: scale(.15); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }

/* VS */
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; width: 100%; max-width: 620px; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; animation: slidein .5s cubic-bezier(.2, .9, .2, 1) both; }
.vs-side.op { animation-name: slidein2; }
.vs-side b { font: 700 clamp(1.3rem, 6vw, 2.1rem)/1.1 var(--display); word-break: break-word; }
.vs-side.me b { text-shadow: var(--bglow); } .vs-side.op b { text-shadow: var(--pglow); }
.vs-side small { color: var(--mute); }
.vs-dot { width: 28px; height: 28px; border-radius: 50%; }
.vs-dot.blue { background: var(--blue); box-shadow: 0 0 26px var(--blue); } .vs-dot.pink { background: var(--pink); box-shadow: 0 0 26px var(--pink); }
.vs-mid { font: 700 2.6rem var(--display); color: #fff; text-shadow: var(--pglow); animation: vsIn .6s .2s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes vsIn { from { transform: scale(2.2); opacity: 0; } }
.vs-note { color: var(--mute); margin-top: 24px; }
@keyframes slidein { from { transform: translateX(-60px); opacity: 0; } }
@keyframes slidein2 { from { transform: translateX(60px); opacity: 0; } }

/* IA */
.ai-level { display: grid; grid-template-columns: 1fr auto; align-items: center; text-align: left; gap: 2px 12px; padding: 14px 18px; min-height: 70px; }
.ai-level small { grid-column: 1; color: var(--mute); font: 500 .82rem var(--body); text-shadow: none; }
.ai-level .pips { grid-row: 1 / span 2; grid-column: 2; letter-spacing: 3px; color: var(--pink); text-shadow: var(--pglow); }

/* amigos */
#room-host { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.btn.wa { border-color: var(--pink); box-shadow: 0 0 22px rgba(255,31,180,.55), inset 0 0 16px rgba(255,31,180,.3); background: rgba(255,31,180,.14); color: #fff; text-shadow: var(--pglow); min-height: 68px; font-size: 1.25rem; }
.room-wait { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 16px 0 4px; }
.room-wait p { margin: 0; font: 600 1.1rem var(--display); text-shadow: var(--bglow); }
.dots { display: flex; gap: 10px; } .dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 12px var(--blue); animation: bounce 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; background: var(--pink); box-shadow: 0 0 12px var(--pink); } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-10px); } }
.code { font: 700 1.1rem var(--display); letter-spacing: .15em; color: #FFB3E6; }

/* resultado + revancha */
.result { gap: 10px; }
.res-title { font: 700 clamp(3.2rem, 17vw, 5.2rem)/.95 var(--display); margin: 0; animation: stamp .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.res-title.win { color: #E4F4FF; text-shadow: 0 0 10px var(--blue), 0 0 30px var(--blue), 0 0 70px rgba(31,168,255,.6); }
.res-title.lose { color: #FFE6F7; text-shadow: 0 0 10px var(--pink), 0 0 30px var(--pink), 0 0 70px rgba(255,31,180,.6); }
.res-title.draw { color: #fff; text-shadow: var(--bglow), var(--pglow); }
@keyframes stamp { from { transform: scale(1.7); opacity: 0; } }
.res-reason { color: #BFD3FF; margin: 0; }
.res-points { font: 700 2.6rem/1 var(--display); margin: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: stamp .5s .15s cubic-bezier(.2,1.4,.4,1) both; }
.res-points small { font-size: 1rem; color: var(--mute); }
.res-points em { font: 700 .95rem var(--display); font-style: normal; color: #FFB3E6; text-shadow: var(--pglow); }
.res-points.gain { color: #fff; text-shadow: var(--bglow); } .res-points.zero { color: var(--mute); }
.rematch { width: 100%; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; border: 1.5px solid rgba(255,31,180,.45); background: rgba(255,31,180,.06); box-shadow: inset 0 0 18px rgba(255,31,180,.12); }
.rm-q { margin: 0; font: 700 1.4rem var(--display); text-shadow: var(--pglow); }
.rm-bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.rm-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--pink)); transform-origin: left; box-shadow: 0 0 10px var(--pink); }
.rm-status { margin: 0; min-height: 1.3em; font-weight: 700; color: #FFB3E6; }

/* ranking en directo */
#s-rank { gap: 10px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 10px var(--pink); animation: breathe 1.2s ease-in-out infinite; }
.rank-panel { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
.rank-me { margin: 0; text-align: center; color: #BFD3FF; } .rank-me b { color: #fff; text-shadow: var(--bglow); }
.ladder { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ladder li { position: relative; display: grid; grid-template-columns: 2.6em 1fr auto auto; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: rgba(8, 14, 40, .6); border: 1px solid rgba(31,168,255,.18); will-change: transform; }
.ladder li.empty { display: block; text-align: center; color: var(--mute); }
.ladder .pos { font: 700 1.05rem var(--display); color: var(--mute); text-align: right; }
.ladder li:nth-child(-n+3) .pos { color: #FF9EDD; text-shadow: var(--pglow); }
.ladder .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ladder .wl { color: var(--mute); font-size: .78rem; }
.ladder .pts { font: 700 1.15rem var(--display); font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.ladder li.me { border: 1.5px solid var(--blue); box-shadow: 0 0 16px rgba(31,168,255,.45), inset 0 0 14px rgba(31,168,255,.2); z-index: 2; }
.ladder li.me .pts { text-shadow: var(--bglow); }
.ladder li.up { animation: flashUp 1.6s ease-out; } .ladder li.down { animation: flashDown 1.6s ease-out; }
@keyframes flashUp { 0% { background: rgba(31,168,255,.55); box-shadow: 0 0 30px var(--blue); } 100% { } }
@keyframes flashDown { 0% { background: rgba(255,31,180,.4); box-shadow: 0 0 24px var(--pink); } 100% { } }
.gain-badge { position: absolute; right: 12px; top: -12px; padding: 2px 10px; border-radius: 999px; background: var(--pink); color: #fff; font: 700 .85rem var(--display);
  box-shadow: 0 0 16px var(--pink); animation: badge 2.6s ease-out both; white-space: pre; }
@keyframes badge { 0% { transform: translateY(8px) scale(.6); opacity: 0; } 12% { transform: none; opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-12px); opacity: 0; } }
.rank-actions { width: 100%; max-width: 560px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* HUD */
#hud, #touch { display: none; }
body.in-game #hud, body.in-game #touch { display: block; }
body.show-result #hud, body.show-result #touch, body.show-vs .quit { display: none; }
#touch { position: fixed; inset: 0; z-index: 5; touch-action: none; }
#hud { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.hud-top { position: absolute; top: calc(var(--sat) + 10px); left: calc(var(--sal) + 60px); right: calc(var(--sar) + 14px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.hp { display: flex; align-items: center; gap: 8px; min-width: 0; } .hp.op { justify-content: flex-end; }
.hp .nm { font: 600 1rem var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp.me .nm { text-shadow: var(--bglow); } .hp.op .nm { text-shadow: var(--pglow); }
.hp.op .dot { background: var(--pink); box-shadow: 0 0 10px var(--pink); }
.chat-btn { pointer-events: auto; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid rgba(31,168,255,.5); background: rgba(6, 10, 30, .7); display: grid; place-items: center; color: #9FB8E8; position: relative; }
.chat-dot { position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 8px var(--pink); }
.hud-btn { pointer-events: auto; width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid rgba(31,168,255,.5); background: rgba(6, 10, 30, .7); display: grid; place-items: center; color: #9FB8E8; }
.quit { position: absolute; top: calc(var(--sat) + 6px); left: calc(var(--sal) + 10px); }
.net-pill { position: absolute; top: calc(var(--sat) + 52px); left: 50%; transform: translateX(-50%); padding: 6px 12px; border-radius: 999px; background: rgba(40,4,30,.85); border: 1px solid var(--pink); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.net-pill.warn { border-color: var(--blue); background: rgba(4,20,44,.85); }
.count { position: absolute; inset: 0; display: grid; place-items: center; font: 700 clamp(5rem, 30vw, 11rem) var(--display); color: #fff; text-shadow: 0 0 20px var(--pink), 0 0 60px var(--pink); pointer-events: none; opacity: 0; }
.count.pulse { animation: cnt .85s ease-out both; }
@keyframes cnt { from { transform: scale(1.6); opacity: 0; } 25% { opacity: 1; } to { transform: scale(.85); opacity: 0; } }
.hint { position: absolute; left: 50%; bottom: calc(var(--sab) + 26px); transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: rgba(3, 4, 12, .85); border: 1px solid var(--pink); box-shadow: 0 0 16px rgba(255,31,180,.5); font-weight: 700; font-size: .9rem; text-align: center; width: max-content; max-width: min(92vw, 520px); }

#chat-pop { position: fixed; z-index: 40; top: calc(var(--sat) + 56px); right: calc(var(--sar) + 12px); width: min(78vw, 250px); max-height: 46vh; display: flex; flex-direction: column;
  border-radius: 14px; background: rgba(6, 9, 26, .92); border: 1.5px solid rgba(31,168,255,.5); box-shadow: 0 0 20px rgba(31,168,255,.3); overflow: hidden; animation: screenIn .15s both; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; font: 700 .8rem var(--display); color: var(--mute); border-bottom: 1px solid rgba(31,168,255,.25); }
.chat-head .icon-btn { width: 26px; height: 26px; }
.chat-msgs { flex: 1; min-height: 40px; max-height: 30vh; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; font-size: .82rem; }
.chat-msg { line-height: 1.3; word-break: break-word; }
.chat-msg b { text-shadow: var(--bglow); } .chat-msg.op b { text-shadow: var(--pglow); }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid rgba(31,168,255,.25); }
.chat-form input { flex: 1; min-width: 0; border-radius: 10px; border: 1px solid rgba(31,168,255,.5); background: rgba(4,8,26,.85); color: var(--ink); padding: 7px 10px; font-size: .82rem; }
.chat-form input:focus { outline: none; border-color: var(--pink); }
.chat-send { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--pink); background: rgba(255,31,180,.12); color: #fff; flex: none; }

#toast { position: fixed; left: 50%; bottom: calc(var(--sab) + 24px); transform: translate(-50%, 20px); z-index: 50; padding: 12px 18px; border-radius: 12px; background: rgba(8, 12, 34, .95); border: 1.5px solid rgba(31,168,255,.6); box-shadow: 0 0 18px rgba(31,168,255,.35); font-weight: 600; opacity: 0; transition: opacity .2s, transform .25s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#modal, #rename { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0, 0, 0, .6); padding: 20px; }
.modal-card { width: 100%; max-width: 360px; padding: 20px; border-radius: 18px; background: #0A1030; border: 1.5px solid rgba(31,168,255,.6); box-shadow: 0 0 22px rgba(31,168,255,.35); display: grid; gap: 16px; text-align: center; font-weight: 600; animation: screenIn .2s both; }
.modal-card p { margin: 0; }
#debug { position: fixed; left: calc(var(--sal) + 6px); bottom: calc(var(--sab) + 60px); z-index: 70; font: 11px/1.35 ui-monospace, Menlo, monospace; background: rgba(0, 0, 0, .7); padding: 6px 8px; border-radius: 6px; white-space: pre; pointer-events: auto; }
#debug button { font: 11px ui-monospace, monospace; margin: 2px; padding: 3px 6px; }

@media (orientation: landscape) and (max-height: 520px) {
  .menu-main { flex-direction: row; max-width: 820px; align-items: center; gap: 28px; flex-wrap: wrap; }
  .menu-main .logo { flex: 1; } .menu-main .tagline { display: none; } .menu-actions { flex: 1.1; }
  .logo h1 { font-size: 3rem; } .trail { width: 240px; }
  .topbar { max-width: none; }
  .btn.huge { min-height: 66px; font-size: 1.35rem; }
  .res-title { font-size: 2.8rem; } .res-points { font-size: 1.9rem; }
  .result { max-width: 720px; display: grid; grid-template-columns: 1fr 1.1fr; column-gap: 24px; align-items: center; }
  .result > .res-title, .result > .res-reason, .result > .res-points { grid-column: 1; }
  .result > .rematch, .result > #ai-after { grid-column: 2; grid-row: 1 / span 3; }
  .radar { width: 90px; height: 90px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ===== emblema: dos serpientes de neón frente a frente ===== */
.emblem { width: min(300px, 74vw); height: auto; display: block; margin: 0 auto -6px; overflow: visible; }
.logo.small .emblem { width: 190px; }
.emblem .body { fill: none; stroke-width: 11; stroke-linecap: round; stroke-dasharray: 330; stroke-dashoffset: 330; animation: draw 1.2s cubic-bezier(.6,0,.2,1) .1s forwards; }
.emblem .scales { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 2.2; stroke-dasharray: 1 9; stroke-linecap: round; opacity: 0; animation: pop .4s 1.2s forwards; }
.emblem .blue { filter: drop-shadow(0 0 4px #1FA8FF) drop-shadow(0 0 14px #1FA8FF); }
.emblem .pink { filter: drop-shadow(0 0 4px #FF1FB4) drop-shadow(0 0 14px #FF1FB4); }
.emblem .head { opacity: 0; animation: pop .25s 1.15s forwards; }
.emblem .tongue { stroke: #fff; stroke-width: 2; stroke-linecap: round; fill: none; transform-origin: 14px 0; animation: tongue 2.4s 1.6s ease-in-out infinite; }
.emblem .apple { filter: drop-shadow(0 0 6px #FF1FB4) drop-shadow(0 0 16px rgba(255,31,180,.7)); transform-box: fill-box; opacity: 0; animation: applePop .5s 1.35s cubic-bezier(.2,1.6,.4,1) forwards, float 3s 2s ease-in-out infinite; }
@keyframes tongue { 0%, 70%, 100% { transform: scaleX(0); } 76%, 90% { transform: scaleX(1); } }
@keyframes applePop { from { opacity: 0; transform: translate(130px, 96px) scale(0); } to { opacity: 1; transform: translate(130px, 96px) scale(1); } }
@keyframes float { 0%, 100% { transform: translate(130px, 96px); } 50% { transform: translate(130px, 91px); } }
.emblem.done .body { animation: none; stroke-dashoffset: 0; } .emblem.done .scales, .emblem.done .head { animation: none; opacity: 1; }
.emblem.done .apple { animation: float 3s ease-in-out infinite; opacity: 1; }
@media (orientation: landscape) and (max-height: 520px) { .emblem { width: 200px; } }

.hud-top { top: calc(var(--sat) + 6px); left: calc(var(--sal) + 54px); right: calc(var(--sar) + 12px); height: 30px; }
.quit { top: calc(var(--sat) + 2px); width: 38px; height: 38px; }
body.in-game::after { content: ''; position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px); mix-blend-mode: overlay; }
.hp .nm { font-size: .95rem; }

.menu-main { max-width: min(400px, 100%); gap: 10px; }

.emblem .body { stroke-dasharray: 400; stroke-dashoffset: 400; }

/* ===== marca: NEON / SNAKES + serpiente de neón ===== */
.brand { display: flex; flex-direction: column; align-items: center; line-height: 1; user-select: none; }
.brand-neon { font: 900 clamp(2.8rem, min(15vw, 9vh), 4.6rem)/.95 'Orbitron', var(--display); letter-spacing: .06em;
  background: linear-gradient(180deg, #D8F4FF 0%, #6CCBFF 45%, #1C8DFF 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 3px rgba(31,168,255,.95)) drop-shadow(0 0 12px rgba(31,168,255,.8)) drop-shadow(0 0 28px rgba(31,168,255,.45)); }
.brand-neon .o { position: relative; display: inline-block; background: linear-gradient(180deg, #D8F4FF 0%, #6CCBFF 45%, #1C8DFF 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-neon .o::after { content: ''; position: absolute; left: 50%; top: 50%; width: .15em; height: .15em; margin: -.075em 0 0 -.075em; border-radius: 50%;
  background: #FF4FD0; box-shadow: 0 0 6px #FF1FB4, 0 0 14px #FF1FB4; animation: dot 2.2s ease-in-out infinite; }
@keyframes dot { 50% { transform: scale(1.35); box-shadow: 0 0 10px #FF1FB4, 0 0 24px #FF1FB4; } }
.brand-snakes { margin-top: .12em; font: 700 clamp(1.3rem, min(7vw, 4.2vh), 2.1rem)/1 'Orbitron', var(--display); letter-spacing: .32em; padding-left: .32em;
  background: linear-gradient(180deg, #FFD0F0 0%, #FF5AD2 55%, #E0149E 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 3px rgba(255,31,180,.95)) drop-shadow(0 0 12px rgba(255,31,180,.75)) drop-shadow(0 0 26px rgba(255,31,180,.4));
  animation: neonOn 1.4s .6s both; }
.brand-snake { width: clamp(180px, min(62vw, 38vh), 280px); height: auto; margin-top: 6px; overflow: visible; }
.brand-snake path { fill: none; stroke-linecap: round; }
.brand-snake .sn-glow { stroke: #1FA8FF; stroke-width: 16; opacity: .25; filter: blur(4px); }
.brand-snake .sn-body { stroke: #1FA8FF; stroke-width: 7; filter: drop-shadow(0 0 4px #1FA8FF) drop-shadow(0 0 10px #1FA8FF);
  stroke-dasharray: 300; stroke-dashoffset: 300; animation: draw 1.4s cubic-bezier(.6,0,.2,1) .2s forwards; }
.brand-snake .sn-scales { stroke: #E8F7FF; stroke-width: 2; stroke-dasharray: 2 10; opacity: .8; animation: slither 1.1s linear infinite; }
.brand-snake .sn-head ellipse { fill: #FF1FB4; filter: drop-shadow(0 0 5px #FF1FB4) drop-shadow(0 0 12px #FF1FB4); }
.brand-snake .sn-head { opacity: 0; animation: pop .3s 1.5s forwards; }
.brand-snake .sn-tongue { stroke: #fff; stroke-width: 1.8; fill: none; stroke-linecap: round; transform-origin: 10px 0; animation: tongue 2.2s 2s ease-in-out infinite; }
@keyframes slither { to { stroke-dashoffset: -12; } }
@keyframes tongue { 0%, 70%, 100% { transform: scaleX(0); } 76%, 90% { transform: scaleX(1); } }
.brand.small .brand-neon { font-size: 2.4rem; } .brand.small .brand-snakes { font-size: 1.05rem; } .brand.small .brand-snake { width: 160px; }
@media (orientation: landscape) and (max-height: 520px) {
  .brand-neon { font-size: 2.6rem; } .brand-snakes { font-size: 1.1rem; } .brand-snake { width: 170px; }
}
@media (orientation: landscape) and (max-height: 520px) { .menu-main .brand { flex: 1; } }
@media (orientation: landscape) and (max-height: 520px) {
  .menu-main { max-width: min(760px, 100%); flex-direction: row; align-items: center; gap: 32px; }
  .menu-actions { flex: 1 1 340px; min-width: 300px; }
  .menu-actions .btn { min-height: 48px; } .btn.huge { min-height: 62px; }
}
.btn { white-space: nowrap; }
/* ===== logo oficial (imagen del usuario, fondo transparente) ===== */
.logo-img { display: block; width: min(440px, 88vw, 62vh); margin: 0 auto; }
.logo-img img { width: 100%; height: auto; display: block; animation: logoIn .9s cubic-bezier(.2,.8,.2,1) both, logoGlow 3.5s 1s ease-in-out infinite; }
.logo-img.small { width: min(300px, 76vw); }
@keyframes logoIn { from { opacity: 0; transform: scale(.94); filter: brightness(2.2) blur(2px); } }
@keyframes logoGlow { 50% { filter: brightness(1.12) drop-shadow(0 0 14px rgba(31,168,255,.35)); } }
@media (orientation: landscape) and (max-height: 520px) { .logo-img { width: min(360px, 44vw); flex: 1; } }
@media (min-width: 900px) and (min-height: 760px) { .logo-img { width: 520px; } }
.trophy { color: #FFB43D; filter: drop-shadow(0 0 6px rgba(255,180,61,.8)); }
.trophy.big { width: 1.4em; height: 1.4em; }
#b-rank { gap: 8px; }
/* ajustes */
#settings { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0,0,0,.6); padding: 20px; }
.settings-card { gap: 4px; text-align: left; }
.set-title { display: flex; align-items: center; gap: 8px; font: 700 1.2rem var(--display); margin: 0 0 6px; text-shadow: var(--bglow); }
.toggle { display: flex; align-items: center; justify-content: space-between; min-height: 56px; border-bottom: 1px solid rgba(31,168,255,.2); cursor: pointer; }
.toggle span { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.toggle input { position: absolute; opacity: 0; }
.toggle i { width: 50px; height: 30px; border-radius: 99px; background: #28325a; position: relative; transition: background .15s, box-shadow .15s; flex: none; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .18s cubic-bezier(.2,.8,.2,1); }
.toggle input:checked + i { background: var(--pink); box-shadow: 0 0 12px var(--pink); } .toggle input:checked + i::after { transform: translateX(20px); }
.settings-card .btn { margin-top: 12px; }
.hud-mute { position: absolute; top: calc(var(--sat) + 2px); left: calc(var(--sal) + 54px); width: 38px; height: 38px; }
.hud-mute.off { opacity: .4; }
.hud-top { left: calc(var(--sal) + 100px); }
body.show-vs .hud-mute { display: none; }
@media (orientation: portrait) { .hp .nm { font-size: .85rem; } }
@media (orientation: landscape) and (max-height: 520px) { .logo-img { width: min(420px, 46vw, 90vh); flex: 0 0 auto; } }
/* ===== podio top 3 bajo el nickname ===== */
.topbar:has(.who) { align-items: flex-start; }
.who { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.podium { display: grid; gap: 1px; padding: 6px 12px 7px 10px; border-radius: 14px; text-align: left; max-width: 62vw;
  background: rgba(8, 14, 40, .55); border: 1px solid rgba(255,180,61,.35); box-shadow: 0 0 12px rgba(255,180,61,.12); animation: screenIn .35s both; }
.pod { display: flex; align-items: baseline; gap: 7px; min-width: 0; line-height: 1.25; }
.pod i { font: 700 .7rem var(--display); font-style: normal; width: 1em; text-align: center; color: var(--mute); }
.pod b { font-family: var(--display); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11em; }
.pod em { font-style: normal; font-size: .72rem; color: var(--mute); white-space: nowrap; }
.pod.p1 b { font-size: 1rem; color: #FFD27A; text-shadow: 0 0 8px rgba(255,180,61,.8); }
.pod.p1 i { color: #FFB43D; font-size: .8rem; text-shadow: 0 0 6px rgba(255,180,61,.9); }
.pod.p1 em { color: #FFCF8A; font-size: .78rem; }
.pod.p2 b { font-size: .84rem; color: #CFE6FF; } .pod.p2 i { color: #9FC8FF; }
.pod.p3 b { font-size: .76rem; color: #FFC2E8; } .pod.p3 i { color: #FF9EDD; }
.pod.me b { text-decoration: underline; text-decoration-color: rgba(31,168,255,.8); text-underline-offset: 3px; }
