:root {
  --bg: #0d0e10;
  --steel: #16181c;
  --steel-2: #1e2127;
  --line: #2c3037;
  --text: #e9e6df;
  --muted: #8d9199;
  --rust: #e8761f;
  --amber: #ffb347;
  --red: #d94b3b;
  --green: #5fbf6a;
  --radius: 14px;
  --font: "Bahnschrift", "DIN Alternate", "Barlow Condensed", "Arial Narrow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overscroll-behavior: none; }
body {
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(232, 118, 31, .13), transparent 60%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.012) 0 2px, transparent 2px 6px),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
b { font-weight: 700; }

/* ------------------------------------------------------------------ pantallas */
.screen { min-height: 100%; padding: calc(var(--sat) + 20px) calc(var(--sar) + 16px) calc(var(--sab) + 24px) calc(var(--sal) + 16px); }
#screen-auth { display: grid; place-items: center; }

.card {
  background: linear-gradient(180deg, var(--steel-2), var(--steel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04);
}
#screen-auth .card { max-width: 400px; text-align: center; }
.logo { display: block; margin: 0 auto 6px; filter: drop-shadow(0 6px 18px rgba(232,118,31,.35)); }
h1 { margin: 0; font-size: 2.2rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
h1 span { color: var(--rust); }
h2 { margin: 0 0 12px; font-size: 1rem; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); font-weight: 700; }
.sub { color: var(--muted); margin: 6px 0 18px; font-size: .95rem; }
.note { color: var(--muted); font-size: .85rem; line-height: 1.45; margin: 12px 0 0; }
.msg { min-height: 1.3em; font-size: .9rem; margin: 12px 0 0; color: var(--amber); }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }

.stack { display: grid; gap: 12px; text-align: left; }
label { display: grid; gap: 6px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input:not([type]) {
  width: 100%; padding: 13px 14px; font: inherit; font-size: 16px; /* 16px evita el zoom de iOS */
  color: var(--text); background: #0f1114; border: 1px solid var(--line); border-radius: 10px; outline: none; text-transform: none; letter-spacing: 0;
}
input:focus { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(232,118,31,.22); }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--steel-2); color: var(--text);
  padding: 12px 16px; border-radius: 10px; font: inherit; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem;
  cursor: pointer; transition: transform .06s, background .15s, border-color .15s; touch-action: manipulation; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { border-color: #444a54; background: #262a31; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: linear-gradient(180deg, #f08a36, var(--rust)); border-color: #ffb36e; color: #1a0e04; box-shadow: 0 6px 18px rgba(232,118,31,.28); }
.btn.primary:hover { background: linear-gradient(180deg, #ff9a4a, #ee7f2a); }
.btn.big { width: 100%; padding: 16px; font-size: 1rem; }
.btn.small { padding: 6px 10px; min-height: 34px; font-size: .75rem; }
.btn.ghost { background: transparent; }
.btn.link { background: none; border: 0; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; min-height: 32px; text-decoration: underline; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.file { cursor: pointer; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; background: #0f1114; padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tab { appearance: none; border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 9px; font: inherit; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .8rem; cursor: pointer; }
.tab.on { background: var(--steel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

/* ------------------------------------------------------------------ lobby */
.topbar { display: flex; align-items: center; justify-content: space-between; max-width: 980px; margin: 0 auto 18px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.brand b { color: var(--rust); font-size: 1.5rem; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.who span { color: var(--text); font-weight: 700; }
.grid { display: grid; gap: 16px; max-width: 980px; margin: 0 auto; grid-template-columns: 1fr; }
@media (min-width: 820px) { .grid { grid-template-columns: 1fr 1fr; } .grid > .card:last-child { grid-column: 1 / -1; } }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.row { display: flex; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .25em; text-align: center; font-weight: 700; font-family: var(--mono); }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.status { font-size: .95rem; margin-bottom: 12px; color: var(--text); }
.status .ok { color: var(--green); } .status .warn { color: var(--amber); } .status .bad { color: var(--red); }

.rooms { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rooms li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: #0f1114; border: 1px solid var(--line); border-radius: 10px; }
.rooms li.empty { color: var(--muted); justify-content: center; font-size: .9rem; }
.rooms .code { font-family: var(--mono); font-weight: 700; letter-spacing: .2em; color: var(--amber); }
.rooms .meta { color: var(--muted); font-size: .8rem; }

.bar { height: 8px; background: #0f1114; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin: 0 0 12px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--rust), var(--amber)); transition: width .2s; }

/* ------------------------------------------------------------------ juego */
.game { position: fixed; inset: 0; padding: 0; background: #000; overflow: hidden; z-index: 5; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#dos { position: absolute; inset: 0; }
#dos .jsdos-rso, #dos .flex, #dos .jsdos-rso > div { max-width: 100%; }
#touch { position: absolute; inset: 0; z-index: 10; touch-action: none; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='5' fill='none' stroke='%23fff' stroke-width='2'/%3E%3Ccircle cx='10' cy='10' r='6.5' fill='none' stroke='%23000' stroke-opacity='.6'/%3E%3C/svg%3E") 10 10, crosshair; }

.loading { position: absolute; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 14px; background: radial-gradient(600px 300px at 50% 40%, rgba(232,118,31,.14), #07080a 70%); text-align: center; padding: 20px; }
.loading .bar { width: min(320px, 70vw); }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #2a2d33; border-top-color: var(--rust); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { position: fixed; inset: 0; z-index: 99; display: grid; place-items: center; background: var(--bg); transition: opacity .25s; }
.boot.gone { opacity: 0; pointer-events: none; }

#hud { position: absolute; z-index: 20; top: calc(var(--sat) + 8px); left: calc(var(--sal) + 8px); right: calc(var(--sar) + 8px); pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
#hud > * { pointer-events: auto; }
.hud-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(13,14,16,.62); color: #fff; font-size: 18px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); cursor: pointer; opacity: .55; touch-action: manipulation; }
.hud-btn:hover, .hud-btn.on { opacity: 1; }
.panel { background: rgba(16,17,20,.92); border: 1px solid var(--line); border-radius: 14px; padding: 12px; width: min(360px, calc(100vw - 16px - var(--sal) - var(--sar))); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); max-height: calc(100dvh - var(--sat) - var(--sab) - 70px); overflow: auto; }
.hud-status { font-size: .9rem; margin-bottom: 10px; }
.hud-status ul { list-style: none; margin: 6px 0 0; padding: 0; color: var(--muted); font-size: .82rem; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.hud-status li::before { content: "● "; color: var(--green); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 8px; vertical-align: 0; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--red); }
.hud-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hud-grid button, .bar-keys button, .dpad button { appearance: none; background: var(--steel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 11px 8px; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; min-height: 44px; touch-action: manipulation; }
.hud-grid button.on, .bar-keys button.on { background: var(--rust); color: #1a0e04; border-color: #ffb36e; }
.hud-grid button.danger { color: #ff9b8f; }
.hud-grid button:active, .bar-keys button:active, .dpad button:active { background: #303541; }
.bar-keys { position: fixed; left: calc(var(--sal) + 8px); bottom: calc(var(--sab) + 8px); display: flex; flex-wrap: wrap; gap: 6px; max-width: min(560px, calc(100vw - 16px - 170px)); background: rgba(16,17,20,.82); padding: 8px; border-radius: 12px; border: 1px solid var(--line); }
.bar-keys button { min-width: 44px; padding: 8px 10px; }
.dpad { position: fixed; right: calc(var(--sar) + 16px); bottom: calc(var(--sab) + 16px); display: grid; grid-template: "u u" "l r" "d d" / 1fr 1fr; gap: 6px; width: 150px; opacity: .85; }
.dpad button { min-height: 54px; font-size: 1.1rem; }
.dpad [data-d=up] { grid-area: u; } .dpad [data-d=left] { grid-area: l; } .dpad [data-d=right] { grid-area: r; } .dpad [data-d=down] { grid-area: d; }
.textbar { position: fixed; left: calc(var(--sal) + 8px); top: calc(var(--sat) + 56px); display: flex; gap: 8px; width: min(480px, calc(100vw - 16px)); background: rgba(16,17,20,.92); padding: 8px; border-radius: 12px; border: 1px solid var(--line); }
.textbar input { flex: 1; }

.zmodal { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0,0,0,.68); padding: 16px; }
.modal-card { background: var(--steel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; max-width: 460px; width: 100%; max-height: 90dvh; overflow: auto; }
.modal-card ol { padding-left: 20px; line-height: 1.55; color: #cfcbc2; }
.modal-card li { margin-bottom: 6px; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(var(--sab) + 24px); transform: translateX(-50%); background: #0b0c0e; border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 99px; font-size: .9rem; max-width: calc(100vw - 32px); text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.err { border-color: var(--red); }

@media (max-height: 460px) {
  .panel { width: min(640px, calc(100vw - 16px)); padding: 10px; }
  .hud-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .hud-grid button { min-height: 40px; padding: 8px 4px; font-size: .74rem; }
  .hud-status { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ---- idioma y aviso de sonido ---- */
.lang { position: fixed; z-index: 60; bottom: calc(var(--sab) + 12px); right: calc(var(--sar) + 12px); appearance: none; border: 1px solid var(--line); background: rgba(22,24,28,.85); color: var(--text); font: inherit; font-weight: 700; font-size: .75rem; letter-spacing: .08em; padding: 7px 11px; border-radius: 99px; cursor: pointer; backdrop-filter: blur(6px); }
html[data-screen="game"] .lang { display: none; }
.audio-hint { position: fixed; z-index: 90; left: 50%; top: calc(var(--sat) + 14px); transform: translateX(-50%); appearance: none; border: 1px solid #ffb36e; background: var(--rust); color: #1a0e04; font: inherit; font-weight: 700; padding: 10px 16px; border-radius: 99px; box-shadow: 0 10px 30px rgba(0,0,0,.5); cursor: pointer; max-width: calc(100vw - 24px); }

/* =================================================================== rediseño: lobby (azul noche + naranja) */
:root {
  --bg: #070b14; --steel: #0e1524; --steel-2: #131c30; --line: #212c45;
  --text: #eef1f8; --muted: #8d99b2; --rust: #ff7a12; --amber: #ffa63d; --green: #2fd68a; --blue: #7fb2ff;
}
body {
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(255,122,18,.13), transparent 60%),
    radial-gradient(700px 420px at -5% 105%, rgba(50,100,220,.10), transparent 60%),
    var(--bg);
}
.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.lobby { padding: 0; display: flex; flex-direction: column; min-height: 100dvh; }
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; max-width: 1360px; margin: 0 auto;
  padding: calc(var(--sat) + 14px) calc(var(--sar) + 16px) 12px calc(var(--sal) + 16px); }
.lb-brand { display: flex; align-items: center; gap: 12px; font-size: 1.35rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.lb-brand img { width: 46px; height: 46px; border-radius: 12px; }
.lb-brand b { color: var(--rust); font-size: 1.5rem; margin-right: -4px; }
.lb-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 99px; background: rgba(19,28,48,.85); border: 1px solid var(--line); font-weight: 600; max-width: 46vw; }
.pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill .dot { margin: 0; flex: none; }
.avatar { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: rgba(19,28,48,.85); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.avatar .ic { width: 22px; height: 22px; }
.usermenu { position: relative; }
.pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 180px; background: var(--steel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 10px; box-shadow: 0 18px 40px rgba(0,0,0,.55); }
.pop-name { font-weight: 700; text-align: center; overflow: hidden; text-overflow: ellipsis; }

.lb-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; width: 100%; max-width: 1360px; margin: 0 auto;
  padding: 0 calc(var(--sar) + 16px) 12px calc(var(--sal) + 16px); }
.side { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; border-bottom: 1px solid var(--line); }
.side::-webkit-scrollbar { display: none; }
.nav { appearance: none; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; border: 1px solid transparent; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; white-space: nowrap; flex: none; touch-action: manipulation; }
.nav:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav.on { color: #fff; background: linear-gradient(90deg, rgba(255,122,18,.34), rgba(255,122,18,.12)); border-color: rgba(255,140,50,.7); }
.nav .ic { width: 26px; height: 26px; }
.nav.settings { display: none; }

.content { display: grid; gap: 16px; align-content: start; grid-template-columns: minmax(0, 1fr); }
#card-players { display: none; }
.content[data-view="rooms"] > .card:not(#card-rooms), .content[data-view="players"] > .card:not(#card-players) { display: none; }
.content[data-view="players"] #card-players { display: block; }

.card.fx { position: relative; overflow: hidden; padding: 22px; border-radius: 20px; background: linear-gradient(180deg, #111a2e, #0d1424); border-color: var(--line); }
.card.fx::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(380px 150px at 100% 0, rgba(255,122,18,.20), transparent 70%); }
#card-rooms::after, #card-players::after { background: radial-gradient(380px 150px at 100% 0, rgba(47,214,138,.10), transparent 70%); }
.card.fx > * { position: relative; z-index: 1; }
.card-title { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.card-title > div { min-width: 0; flex: 1; }
.card-title h2 { margin: 0; font-size: 1.55rem; letter-spacing: 0; text-transform: none; color: var(--text); font-weight: 800; line-height: 1.15; }
.card-title p { margin: 3px 0 0; color: var(--blue); font-size: .98rem; }
.card-title .refresh { margin-left: auto; width: 46px; padding: 0; }
.ico { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,122,18,.12); border: 1px solid rgba(255,122,18,.4); color: var(--rust); flex: none; }
.ico .ic { width: 28px; height: 28px; }
.ico.green { background: rgba(47,214,138,.12); border-color: rgba(47,214,138,.4); color: var(--green); }
#card-game .ico .ic { fill: currentColor; stroke: none; }
.card-title .status { margin: 4px 0 0; }

.btn { border-radius: 12px; }
.btn.big { min-height: 58px; font-size: 1.1rem; }
.btn.primary { background: linear-gradient(180deg, #ff9230, #ff6f0a); border-color: #ffb36e; color: #1c0d02; }
.btn .ic { width: 1.3em; height: 1.3em; }
.btn.dark { background: #0f1729; border-color: #2a3654; min-height: 56px; padding: 12px 22px; }
.btn.dark .ic { fill: none; }
.btn.dark:hover { border-color: #3a4a70; background: #141e35; }
.btn.small .ic { width: 1.1em; height: 1.1em; }
.or { margin: 18px 0; }
.row { align-items: stretch; }
.field { position: relative; flex: 1; min-width: 0; display: block; }
.field .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; color: var(--muted); pointer-events: none; }
.field input { height: 100%; min-height: 52px; padding-left: 50px; text-align: left; letter-spacing: .12em; font-family: var(--font); font-weight: 700; text-transform: uppercase; background: #0b1120; border-radius: 12px; }
.field input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 500; color: #6f7c97; }
.note.info { display: flex; gap: 10px; align-items: flex-start; color: #a7b2c8; }
.note.info .ic { width: 22px; height: 22px; margin-top: 1px; color: var(--muted); }
.note.info span { flex: 1; min-width: 0; }
.rooms li { background: #0b1120; border-color: var(--line); border-radius: 14px; padding: 12px 14px; }
.rooms li.empty { flex-direction: column; gap: 6px; padding: 26px 16px; text-align: center; color: var(--blue); }
.rooms li.empty .ic { width: 64px; height: 64px; color: #5f6f95; margin-bottom: 4px; }
.rooms li.empty b { color: var(--text); font-size: 1.1rem; }
.rooms .code { letter-spacing: .15em; }
.deco { display: none; }
@media (min-width: 900px) {
  .deco { display: block; position: absolute; right: 36px; bottom: 14px; width: 150px; height: 150px; color: var(--rust); opacity: .9; filter: drop-shadow(0 8px 22px rgba(255,122,18,.45)); pointer-events: none; z-index: 0 !important; }
  #card-game .row, #card-game .note { max-width: calc(100% - 200px); }
}

.lb-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; max-width: 1360px; margin: 0 auto;
  padding: 12px calc(var(--sar) + 18px) calc(var(--sab) + 14px) calc(var(--sal) + 18px); border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.foot-settings { appearance: none; background: none; border: 0; color: var(--muted); font: inherit; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; }
.foot-settings .ic { width: 24px; height: 24px; }
.credit { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.credit:hover { color: var(--amber); }
.credit .star { color: var(--rust); font-style: normal; font-size: 1.1em; }
.credit.center { display: flex; justify-content: center; margin-top: 14px; font-size: .85rem; }

@media (min-width: 900px) {
  .lb-top { padding-left: calc(var(--sal) + 24px); padding-right: calc(var(--sar) + 24px); }
  .lb-body { grid-template-columns: 250px minmax(0, 1fr); gap: 28px; padding-left: calc(var(--sal) + 24px); padding-right: calc(var(--sar) + 24px); }
  .side { flex-direction: column; overflow: visible; border-bottom: 0; border-right: 1px solid var(--line); padding: 6px 22px 6px 0; min-height: 520px; }
  .nav { padding: 15px 18px; font-size: 1.08rem; }
  .nav.settings { display: flex; margin-top: auto; }
  .content { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; }
  .content #card-game { grid-column: 1 / -1; }
  .content[data-view="rooms"], .content[data-view="players"] { grid-template-columns: minmax(0, 1fr); }
  .foot-settings { display: none; }
  .lb-foot { justify-content: flex-end; border-top: 0; padding-left: calc(var(--sal) + 24px); padding-right: calc(var(--sar) + 24px); }
}
@media (max-width: 420px) {
  .card.fx { padding: 18px; }
  .card-title h2 { font-size: 1.35rem; }
  .btn.dark { flex: 1 1 100%; }
  .lb-brand { font-size: 1.15rem; }
  .pill { padding: 9px 12px; }
}

.zmodal.fixed { position: fixed; z-index: 70; }
.modal-card .set-label { margin: 16px 0 8px; color: var(--muted); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; }
.modal-card .btn { width: 100%; }
.modal-card .btn.primary { margin-top: 16px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg .btn.on { background: var(--rust); color: #1c0d02; border-color: #ffb36e; }
html[data-screen="lobby"] .lang { display: none; }

/* =================================================================== controles táctiles */
.rail { display: none; position: fixed; left: calc(var(--sal) + 8px); top: 50%; transform: translateY(-50%); flex-direction: column; gap: 8px; z-index: 22; }
@media (pointer: coarse) { .rail { display: flex; } }
.rail button { appearance: none; width: 54px; height: 54px; border-radius: 14px; border: 1px solid rgba(255,255,255,.24); background: rgba(8,12,22,.62); color: #fff; font: inherit; font-size: .6rem; font-weight: 700;
  display: grid; align-content: center; justify-items: center; line-height: 1.05; padding: 3px; touch-action: manipulation; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.rail button span { font-size: 1.2rem; display: block; }
.rail button.on { background: var(--rust); color: #1c0d02; border-color: #ffb36e; }
@media (max-height: 380px) { .rail button { width: 46px; height: 46px; } .rail { gap: 6px; } }
.rotate-hint { display: none; position: absolute; left: 50%; bottom: calc(var(--sab) + 18px); transform: translateX(-50%); z-index: 25; padding: 10px 16px; border-radius: 99px; background: rgba(8,12,22,.88); border: 1px solid var(--rust); font-weight: 700; pointer-events: none; text-align: center; max-width: calc(100vw - 24px); }
@media (orientation: portrait) and (pointer: coarse) { .rotate-hint { display: block; } }

/* ---- ajustes tras revisar capturas ---- */
html { background: var(--bg); }
body { background-attachment: fixed; min-height: 100%; }
.card.fx > .deco { position: absolute; z-index: 0; }
.card-title p, .card-title .status { line-height: 1.3; }
@media (max-width: 520px) {
  .side { gap: 4px; }
  .nav { padding: 8px 6px; gap: 5px; font-size: .74rem; }
  .nav .ic { width: 20px; height: 20px; }
}
html { background:
    radial-gradient(900px 520px at 85% -10%, rgba(255,122,18,.13), transparent 60%),
    radial-gradient(700px 420px at -5% 105%, rgba(50,100,220,.10), transparent 60%),
    var(--bg) no-repeat; }
body { background: transparent; background-attachment: scroll; }
@media (pointer: coarse) { .bar-keys { left: calc(var(--sal) + 72px); max-width: min(560px, calc(100vw - 72px - 170px - var(--sal))); } }

/* =================================================================== v3: fuentes, fondo, login, lobby y HUD con iconos */
@font-face { font-family: "Exo 2"; font-weight: 500; font-style: normal; font-display: swap; src: url(/fonts/exo-2-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Exo 2"; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/exo-2-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Exo 2"; font-weight: 800; font-style: normal; font-display: swap; src: url(/fonts/exo-2-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Exo 2"; font-weight: 800; font-style: italic; font-display: swap; src: url(/fonts/exo-2-latin-800-italic.woff2) format("woff2"); }
:root { --font: "Exo 2", "Bahnschrift", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color-scheme: dark; }
/* js-dos.css (DaisyUI) pinta :root de blanco en esquemas claros: :root gana a html, así que se fuerza aquí */
html:root { background-color: #070b14 !important; background-image: radial-gradient(900px 520px at 85% -10%, rgba(255,122,18,.16), transparent 60%), radial-gradient(700px 420px at -5% 105%, rgba(50,100,220,.12), transparent 60%) !important; background-repeat: no-repeat !important; color: var(--text); }
body { background: transparent !important; font-family: var(--font); }
.ic.inline { width: 1.1em; height: 1.1em; vertical-align: -.2em; }
.ic.star { width: 1em; height: 1em; color: var(--rust); }

/* ---------- acceso ---------- */
#screen-auth { position: relative; min-height: 100dvh; isolation: isolate;
  background: linear-gradient(rgba(7,11,20,.22), rgba(7,11,20,.5)), url(/img/login-bg.jpg) center / cover no-repeat #070b14; }
@media (max-width: 760px) { #screen-auth { background: linear-gradient(rgba(7,11,20,.12), rgba(7,11,20,.3)), url(/img/login-bg-m.jpg) center / cover no-repeat #070b14; } }
.auth-tag { display: none; }
#screen-auth .auth-card { position: relative; z-index: 1; max-width: 430px; padding: 26px 26px 18px; border-radius: 20px;
  background: linear-gradient(180deg, rgba(15,22,40,.94), rgba(8,12,22,.96)); border: 1px solid rgba(255,140,50,.38);
  box-shadow: 0 0 0 1px rgba(255,122,18,.10), 0 30px 90px rgba(0,0,0,.75), 0 0 70px rgba(255,122,18,.14); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.auth-card .logo { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 8px; filter: drop-shadow(0 6px 26px rgba(255,122,18,.55)); }
.auth-card h1 { font-size: 2.7rem; font-style: italic; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; line-height: 1.05; }
.auth-card h1 i { font-style: italic; background: linear-gradient(180deg, #fff, #9aa5bd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card h1 span { background: linear-gradient(180deg, #ffb347, #ff6a00); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card .sub { color: #aab4c9; margin: 10px 0 20px; font-size: .98rem; line-height: 1.4; }
.auth-card .tabs { background: rgba(5,8,16,.7); border-color: #25314d; border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 16px; }
.auth-card .tab { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 8px; border-radius: 9px; font-size: .86rem; min-height: 46px; }
.auth-card .tab .ic { width: 20px; height: 20px; }
.auth-card .tab.on { background: linear-gradient(180deg, #ff9a3a, #ff6a00); color: #1c0d02; box-shadow: 0 6px 20px rgba(255,106,0,.35); }
.auth-card .tab:not(.on):hover { color: var(--text); }
.auth-card .stack { gap: 14px; }
.auth-card label { gap: 8px; }
.lbl { display: flex; align-items: center; gap: 8px; color: #b8c2d8; font-weight: 700; letter-spacing: .1em; }
.lbl .ic { width: 18px; height: 18px; color: var(--rust); }
.auth-card input { background: rgba(5,8,16,.8); border: 1px solid #2a3654; border-radius: 12px; min-height: 50px; color: var(--text); }
.auth-card input::placeholder { color: #66738f; }
.auth-card input:focus { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(255,122,18,.22); }
.passwrap { position: relative; display: block; }
.passwrap input { padding-right: 52px; }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: transparent; color: #8d99b2; display: grid; place-items: center; cursor: pointer; border-radius: 10px; }
.eye:hover { color: var(--text); }
.eye .ic { width: 22px; height: 22px; }
.auth-card .btn.primary.big { min-height: 54px; font-size: 1rem; letter-spacing: .08em; margin-top: 4px; box-shadow: 0 10px 30px rgba(255,106,0,.35), inset 0 1px 0 rgba(255,255,255,.35); }
.auth-card .btn.link { color: #8d99b2; }
.msg { display: flex; justify-content: center; align-items: center; gap: 8px; text-align: left; }
.msg .ic { width: 20px; height: 20px; flex: none; }
.msg.ok { color: var(--green); }
.auth-card .credit.center { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.07); }
@media (max-width: 460px) { #screen-auth .auth-card { padding: 22px 18px 16px; } .auth-card h1 { font-size: 2.3rem; } }

/* ---------- lobby (según las capturas de diseño) ---------- */
.lb-brand { font-style: normal; font-weight: 800; letter-spacing: .04em; }
.lb-brand img { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 6px 22px rgba(255,122,18,.25); }
.lb-brand b { font-size: 1.7rem; font-style: italic; }
.card.fx { background: linear-gradient(180deg, #101a30, #0b1222); border: 1px solid #243153; box-shadow: 0 24px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04); }
.card.fx::after { background: radial-gradient(420px 170px at 100% 0, rgba(255,122,18,.30), transparent 70%); }
/* destellos diagonales naranjas de la esquina superior derecha */
.card.fx::before { content: ""; position: absolute; right: -30px; top: -40px; width: 58%; height: 130%; pointer-events: none; z-index: 0;
  background:
    linear-gradient(118deg, transparent 54%, rgba(255,150,50,0) 54.6%, rgba(255,150,50,.9) 55.3%, rgba(255,150,50,0) 56.1%, transparent 56.5%),
    linear-gradient(118deg, transparent 60%, rgba(255,110,20,.55) 60.5%, transparent 61.4%),
    linear-gradient(118deg, transparent 46%, rgba(255,122,18,.20) 62%, transparent 78%);
  -webkit-mask-image: radial-gradient(70% 55% at 100% 0, #000 20%, transparent 78%); mask-image: radial-gradient(70% 55% at 100% 0, #000 20%, transparent 78%); }
#card-rooms::before, #card-players::before { opacity: .55; filter: hue-rotate(110deg) saturate(.8); }
#card-net h2 { font-style: italic; }
.card-title h2 { font-weight: 800; }
.ico { background: radial-gradient(circle at 30% 25%, rgba(255,150,50,.28), rgba(255,122,18,.08)); box-shadow: 0 0 24px rgba(255,122,18,.18); }
.ico.green { background: radial-gradient(circle at 30% 25%, rgba(47,214,138,.26), rgba(47,214,138,.07)); box-shadow: 0 0 24px rgba(47,214,138,.14); }
#card-game .ico { border-radius: 18px; width: 62px; height: 62px; }
#card-net .ico .ic { fill: none; }
.ico .ic { fill: currentColor; }
.ico .ic[viewBox] use { pointer-events: none; }
.status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status span { display: inline-flex; align-items: center; gap: 8px; }
.status .ic { width: 22px; height: 22px; flex: none; }
.status .ok { color: var(--green); font-weight: 700; } .status .warn { color: var(--amber); } .status .bad { color: #ff7d6e; }
.btn.dark { background: linear-gradient(180deg, #121c33, #0d1527); border-color: #2c3a5c; }
.btn.dark .ic, .btn.primary .ic { fill: currentColor; stroke: none; }
.btn.primary .ic[viewBox] { stroke: currentColor; fill: none; }
#btn-create .ic { stroke: currentColor; fill: none; stroke-width: 2.6; }
#form-join .btn .ic { stroke: currentColor; fill: none; }
.btn.dark .ic use { }
.nav .ic { fill: currentColor; stroke: none; }
.nav[data-nav="create"] .ic { fill: currentColor; }
@media (min-width: 900px) {
  .nav.on { background: linear-gradient(180deg, #ff9a3a, #ff6a00); color: #fff; border-color: #ffb36e; box-shadow: 0 10px 28px rgba(255,106,0,.38), inset 0 1px 0 rgba(255,255,255,.35); text-shadow: 0 1px 0 rgba(0,0,0,.18); }
  .deco { right: 40px; bottom: 6px; width: 190px; height: 190px; }
}
.deco { fill: currentColor; stroke: none; }
#card-game .deco { transform: rotate(-4deg); }
.rooms li.empty .ic { fill: none; }
.lb-foot { border-top: 1px solid #1c2640; }
.credit { font-weight: 500; }
.credit .star { color: var(--rust); }
.pill, .avatar { background: rgba(14,22,40,.9); }

/* ---------- HUD, rail, d-pad: todo con iconos SVG ---------- */
#hud .ic, .rail .ic, .dpad .ic, .bar-keys .ic, .skip-intro .ic, .audio-hint .ic, .rotate-hint .ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#hud .ic use { pointer-events: none; }
.hud-btn { display: grid; place-items: center; padding: 0; }
.hud-btn .ic { width: 22px; height: 22px; }
.hud-grid button { display: flex; align-items: center; justify-content: flex-start; gap: 9px; text-align: left; }
.hud-grid button .ic { width: 20px; height: 20px; flex: none; }
.hud-grid button[data-act="mute"].muted { color: #ff9b8f; }
.rail button { align-content: center; gap: 2px; }
.rail button .ic { width: 22px; height: 22px; }
.rail button em { font-style: normal; display: block; }
.dpad button { display: grid; place-items: center; }
.dpad button .ic { width: 26px; height: 26px; }
.bar-keys button .ic { width: 18px; height: 18px; vertical-align: middle; }
.hud-status li::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 6px; vertical-align: 1px; }
.skip-intro { position: absolute; z-index: 24; right: calc(var(--sar) + 10px); top: calc(var(--sat) + 10px); appearance: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 99px;
  border: 1px solid rgba(255,179,110,.9); background: rgba(8,12,22,.78); color: #fff; font: inherit; font-weight: 700; font-size: .9rem; letter-spacing: .04em; cursor: pointer; touch-action: manipulation; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 8px 26px rgba(0,0,0,.5), 0 0 18px rgba(255,122,18,.25); }
.skip-intro .ic { width: 20px; height: 20px; color: var(--rust); fill: var(--rust); }
.skip-intro:hover, .skip-intro:active { background: var(--rust); color: #1c0d02; } .skip-intro:hover .ic, .skip-intro:active .ic { color: #1c0d02; fill: #1c0d02; }
.audio-hint { display: inline-flex; align-items: center; gap: 8px; } .audio-hint .ic { width: 20px; height: 20px; fill: currentColor; }
.rotate-hint { align-items: center; gap: 8px; } @media (orientation: portrait) and (pointer: coarse) { .rotate-hint { display: flex; } }
.rotate-hint .ic { width: 20px; height: 20px; flex: none; }

/* ---------- retoques tras revisar capturas ---------- */
#screen-auth .auth-card { padding: 22px 26px 16px; }
.auth-card .logo { width: 80px; height: 80px; margin-bottom: 4px; }
.auth-card h1 { font-size: 2.4rem; }
.auth-card .sub { margin: 8px 0 14px; font-size: .94rem; }
.auth-card .tabs { margin-bottom: 12px; }
.auth-card .stack { gap: 10px; }
.auth-card label { gap: 6px; }
.auth-card input { min-height: 46px; }
.auth-card .btn.primary.big { min-height: 50px; }
.auth-card .msg { margin-top: 8px; min-height: 0; }
.auth-card .credit.center { margin-top: 10px; padding-top: 12px; }
@media (max-width: 760px) {
  #screen-auth .auth-card { background: linear-gradient(180deg, rgba(15,22,40,.84), rgba(8,12,22,.9)); padding: 18px 16px 14px; }
  .auth-card .logo { width: 68px; height: 68px; }
  .auth-card h1 { font-size: 2rem; }
  .auth-card .sub { font-size: .88rem; margin: 6px 0 12px; }
  #screen-auth { padding-top: calc(var(--sat) + 14px); padding-bottom: calc(var(--sab) + 14px); }
}
.lb-brand { font-size: 1.9rem; gap: 14px; }
.lb-brand img { width: 62px; height: 62px; border-radius: 16px; }
.lb-brand b { font-size: 2.1rem; margin-right: -6px; }
@media (max-width: 520px) { .lb-brand { font-size: 1.35rem; gap: 10px; } .lb-brand img { width: 52px; height: 52px; } .lb-brand b { font-size: 1.6rem; } }
#hud.panel-open .rail { visibility: hidden; }

/* =================================================================== v4: idioma, ranking, invitar */
.langsw { position: fixed; z-index: 60; top: calc(var(--sat) + 12px); right: calc(var(--sar) + 12px); display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 99px;
  background: rgba(8,12,22,.88); border: 1px solid rgba(255,179,110,.75); box-shadow: 0 8px 26px rgba(0,0,0,.5), 0 0 18px rgba(255,122,18,.2); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.langsw > .ic { width: 20px; height: 20px; margin: 0 4px 0 8px; color: var(--rust); }
.langsw button { appearance: none; border: 0; background: transparent; color: #c3cde2; font: inherit; font-weight: 800; font-size: .86rem; letter-spacing: .08em; min-width: 46px; min-height: 36px; padding: 0 12px; border-radius: 99px; cursor: pointer; touch-action: manipulation; }
.langsw button.on { background: linear-gradient(180deg, #ff9a3a, #ff6a00); color: #1c0d02; box-shadow: 0 4px 14px rgba(255,106,0,.45); }
.langsw button:not(.on):hover { color: #fff; background: rgba(255,255,255,.08); }
html[data-screen="lobby"] .langsw, html[data-screen="game"] .langsw { display: none; }
@media (max-width: 760px) { #screen-auth { padding-top: calc(var(--sat) + 64px); } }

.count:not(:empty) { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; margin-left: 8px; border-radius: 99px; background: rgba(47,214,138,.16); border: 1px solid rgba(47,214,138,.5); color: var(--green); font-size: .85rem; font-weight: 800; vertical-align: 2px; }
.new-room { margin-left: auto; min-height: 44px; padding: 8px 16px; }
.new-room + .refresh { margin-left: 0; }
.rooms .nm { margin-left: 2px; }
.rooms .pn { display: inline-flex; align-items: center; }
.rooms .pn .dot { margin-right: 8px; }

#card-ranking { display: none; }
.content[data-view="ranking"] > .card:not(#card-ranking) { display: none; }
.content[data-view="ranking"] #card-ranking { display: block; }
.content[data-view="ranking"] { grid-template-columns: minmax(0, 1fr); }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank li.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; text-align: center; color: var(--blue); background: #0b1120; border: 1px solid var(--line); border-radius: 14px; }
.rank li.empty .ic { width: 64px; height: 64px; color: #5f6f95; fill: none; }
.rank li.empty b { color: var(--text); font-size: 1.1rem; }
.rank-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; background: #0b1120; border: 1px solid var(--line); border-radius: 14px; }
.rank-row .pos { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #131c30; border: 1px solid #2a3654; font-weight: 800; color: #aab4c9; }
.rank-row .pos .ic { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.rank-row.top1 .pos { color: #ffcf4a; border-color: #ffcf4a; background: rgba(255,207,74,.12); }
.rank-row.top2 .pos { color: #d3dbe8; border-color: #d3dbe8; background: rgba(211,219,232,.1); }
.rank-row.top3 .pos { color: #e39a5c; border-color: #e39a5c; background: rgba(227,154,92,.12); }
.rank-row .who { min-width: 0; display: grid; }
.rank-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.rank-row .wl { color: var(--muted); font-size: .8rem; }
.rank-row .pts { text-align: right; line-height: 1.05; }
.rank-row .pts b { display: block; font-size: 1.35rem; color: var(--amber); }
.rank-row .pts i { font-style: normal; font-size: .7rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.rank-row.me { border-color: rgba(255,140,50,.8); background: linear-gradient(90deg, rgba(255,122,18,.18), #0b1120 70%); }

.modal-card.center { text-align: center; display: grid; gap: 10px; justify-items: stretch; }
.modal-card.center h2 { margin: 4px 0 0; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 1.4rem; }
.modal-card.center .note { margin: 0; }
.ico.big { width: 70px; height: 70px; justify-self: center; }
.ico.big .ic { width: 34px; height: 34px; fill: none; }
.roomcode { font-weight: 800; font-size: 2.6rem; letter-spacing: .3em; padding: 8px 0 8px .3em; border-radius: 14px; background: #0b1120; border: 1px dashed rgba(255,140,50,.7); color: var(--amber); }
#invite-link { word-break: break-all; font-size: .8rem; }
.btn.wa { background: linear-gradient(180deg, #2bd46b, #12a74c); border-color: #6df0a0; color: #052412; min-height: 52px; font-size: .95rem; box-shadow: 0 8px 24px rgba(18,167,76,.35); }
.btn.wa .ic { fill: none; stroke: currentColor; }
.modal-card .seg { margin-top: 2px; }
.modal-card.center .btn.primary { margin-top: 0; }
.nav[data-nav="ranking"] .ic, #card-ranking .ico .ic, .ico.big .ic { fill: none; stroke: currentColor; }
.nav[data-nav="ranking"] .ic path[fill], #card-ranking .ico .ic path[fill] { stroke: none; }
@media (max-width: 520px) { .nav { padding: 8px 5px; font-size: .7rem; gap: 4px; } .side { gap: 2px; justify-content: space-between; } }
#invite .seg, .modal-card.center .seg { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.content[data-view="home"] .new-room { display: none; } .new-room + .refresh, .new-room { flex: none; }

/* =================================================================== v5: controles táctiles estilo móvil */
.rail { display: none !important; }                       /* sin botones laterales: todo se hace con gestos */
@media (pointer: coarse) { .bar-keys { left: calc(var(--sal) + 8px); max-width: min(560px, calc(100vw - 16px - 170px)); } }
.hud-btn { width: 42px; height: 42px; opacity: .6; background: rgba(8,12,22,.55); }
.touch-ring { position: absolute; z-index: 15; width: 74px; height: 74px; margin: -37px 0 0 -37px; border-radius: 50%; pointer-events: none;
  border: 3px solid var(--rust); box-shadow: 0 0 18px rgba(255,122,18,.6), inset 0 0 12px rgba(255,122,18,.35); }
.touch-ring.go { animation: ring .35s ease-out; }
@keyframes ring { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.coach h2 { margin-bottom: 4px !important; }
.gestures { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.gestures li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: #0b1120; border: 1px solid var(--line); }
.gestures .g { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--rust); background: rgba(255,122,18,.12); border: 1px solid rgba(255,122,18,.35); }
.gestures .g .ic { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.gestures div { display: grid; line-height: 1.25; }
.gestures b { font-size: .95rem; }
.gestures div span { color: var(--muted); font-size: .82rem; }
@media (max-height: 460px) { .coach { max-width: 640px; } .gestures { grid-template-columns: 1fr 1fr; gap: 6px; } .gestures li { padding: 6px 8px; } .coach .note { font-size: .78rem; } }
#hud .ic.inline, .coach .ic.inline { fill: none; stroke: currentColor; }
@media (max-height: 460px) { .modal-card.coach { padding: 12px 16px; gap: 6px; } .coach h2 { font-size: 1.1rem !important; margin: 0 !important; } .gestures .g { width: 34px; height: 34px; } .gestures .g .ic { width: 22px; height: 22px; } .coach .btn.primary { min-height: 40px; } }
/* barra táctil mínima: modo selección + cancelar (abajo a la izquierda, sobre la franja negra) */
.touchbar { display: none; position: absolute; z-index: 21; left: calc(var(--sal) + 10px); bottom: calc(var(--sab) + 12px); flex-direction: column; gap: 10px; }
@media (pointer: coarse) { .touchbar { display: flex; } }
.touchbar button { appearance: none; width: 64px; height: 64px; border-radius: 18px; border: 1px solid rgba(255,255,255,.22); background: rgba(8,12,22,.66); color: #fff;
  font: inherit; font-size: .62rem; font-weight: 700; display: grid; place-items: center; align-content: center; gap: 3px; padding: 4px; touch-action: manipulation; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.touchbar .ic { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; }
.touchbar #sel-mode.on { background: linear-gradient(180deg, #ff9a3a, #ff6a00); color: #1c0d02; border-color: #ffb36e; box-shadow: 0 6px 20px rgba(255,106,0,.45); }
.touchbar #sel-mode.on .ic use { }
@media (max-height: 380px) { .touchbar button { width: 56px; height: 56px; } }
.fxbtn.on, .hud-grid button[data-fx].on { border-color: rgba(47,214,138,.6); color: #bff5da; }
.fxbtn.on .ic, .hud-grid button[data-fx].on .ic { color: var(--green); }

/* =================================================================== v6: ping, red, chat, avatares, temporadas */
.hud-row { display: flex; align-items: center; gap: 8px; }
.hud-row .hud-btn { position: relative; }
.pingchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; background: rgba(8,12,22,.6); border: 1px solid rgba(255,255,255,.16); color: #dfe7f5; font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pingchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pingchip.good i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.pingchip.mid i { background: var(--amber); }
.pingchip.bad i { background: var(--red); box-shadow: 0 0 8px var(--red); }
#chat-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font: 700 .68rem/18px system-ui; text-align: center; font-style: normal; }
.netbanner { position: absolute; z-index: 24; top: calc(var(--sat) + 10px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: rgba(40,16,12,.92); border: 1px solid rgba(255,120,100,.5); color: #ffd9d2; font-size: .85rem; max-width: calc(100vw - 24px); }
.netbanner .spinner.sm { width: 18px; height: 18px; border-width: 2px; flex: none; }
.netbanner.ok { background: rgba(10,40,26,.92); border-color: rgba(47,214,138,.5); color: #c9f7de; }

.chatlog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 220px; min-height: 60px; font-size: .88rem; }
.chatlog li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 10px; background: #0f1520; border: 1px solid var(--line); word-break: break-word; }
.chatlog li.me { background: #15233a; }
.chatlog li.sys { justify-content: center; color: var(--muted); background: transparent; border-style: dashed; font-size: .8rem; }
.chatlog li .nm { font-weight: 700; color: var(--amber); margin-right: 6px; }
.chatlog li .tx { flex: 1; min-width: 0; }
.chatform { display: flex; gap: 8px; margin-top: 8px; }
.chatform input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0b1120; color: var(--text); font: inherit; font-size: 16px; }
.chatform .btn { min-width: 46px; }
.chatbox { margin-top: 14px; }
.chatpanel { position: absolute; z-index: 26; left: calc(var(--sal) + 8px); bottom: calc(var(--sab) + 8px); width: min(340px, calc(100vw - 16px - var(--sal) - var(--sar))); max-height: 60dvh; display: flex; flex-direction: column; padding: 10px; border-radius: 16px; background: rgba(12,16,26,.94); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.chatpanel .chat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chatpanel .chatlog { max-height: 38dvh; }
@media (pointer: coarse) { .chatpanel { left: calc(var(--sal) + 84px); } }
@media (max-height: 420px) { .chatpanel { max-height: 78dvh; } .chatpanel .chatlog { max-height: 40dvh; } }

.av { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; color: #fff; font: 800 .8rem/1 "Exo 2", system-ui; text-transform: uppercase; border: 1.5px solid rgba(255,255,255,.35); text-shadow: 0 1px 2px rgba(0,0,0,.5); background: var(--avc, #3b6fe0); }
.av.big { width: 46px; height: 46px; font-size: 1.1rem; }
.av.c0 { --avc: linear-gradient(135deg,#ff9a3a,#e8531c); } .av.c1 { --avc: linear-gradient(135deg,#4aa3ff,#2257d6); }
.av.c2 { --avc: linear-gradient(135deg,#2fd68a,#0f9a5c); } .av.c3 { --avc: linear-gradient(135deg,#c06bff,#7a2bd6); }
.av.c4 { --avc: linear-gradient(135deg,#ff6b8b,#d6234f); } .av.c5 { --avc: linear-gradient(135deg,#ffd24a,#d99a0a); }
.av.c6 { --avc: linear-gradient(135deg,#3fe0e0,#0b8fa3); } .av.c7 { --avc: linear-gradient(135deg,#9aa6b8,#586274); }
.av.c8 { --avc: linear-gradient(135deg,#a5e04a,#5b9a0f); } .av.c9 { --avc: linear-gradient(135deg,#ff8a5c,#b8381c); }
.av.c10 { --avc: linear-gradient(135deg,#6b7bff,#2a2fa8); } .av.c11 { --avc: linear-gradient(135deg,#f0f4ff,#9fb2d6); color: #14213a; text-shadow: none; }
.avpick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; justify-items: center; }
.avpick button { appearance: none; background: none; border: 2px solid transparent; border-radius: 50%; padding: 2px; cursor: pointer; }
.avpick button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--rust); }
.avpick .av { width: 36px; height: 36px; }
.rank-row .av, .rooms .av { width: 32px; height: 32px; }
.rank-row { gap: 10px; }
.rooms .pn { display: flex; align-items: center; gap: 8px; }
.rooms .pn .dot { margin: 0; }
.avatar.has-av { padding: 0; border: 0; background: none; }
.avatar.has-av .av { width: 46px; height: 46px; font-size: 1.05rem; }

.ranktabs { margin: 0 0 12px; grid-template-columns: 1fr 1fr; }
.ranktabs .btn.on { background: linear-gradient(180deg, #ff9a3a, #ff6a00); color: #1c0d02; border-color: #ffb36e; }

.updbar { position: fixed; z-index: 120; left: 50%; bottom: calc(var(--sab, 0px) + 14px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(14,22,40,.96); border: 1px solid var(--rust); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.5); font-size: .9rem; max-width: calc(100vw - 20px); }
.rank-row { grid-template-columns: 38px 36px minmax(0, 1fr) auto; gap: 10px; }
.rank-row .av { width: 36px; height: 36px; }
@media (max-width: 420px) { .rank-row { grid-template-columns: 34px 32px minmax(0, 1fr) auto; gap: 8px; padding: 9px 10px; } .rank-row .av { width: 32px; height: 32px; } .rank-row .pos { width: 34px; height: 34px; } }
#hud.panel-open ~ .touchbar { display: none !important; }

/* =================================================================== v7: botones del mapa, aviso de girar */
.rotate-hint { bottom: auto; top: calc(var(--sat) + 10px); left: calc(50% + 24px); padding: 6px 8px 6px 12px; font-size: .78rem; gap: 6px; pointer-events: auto; background: rgba(8,12,22,.8); }
.rotate-hint.gone { display: none !important; }
.rotate-hint button { appearance: none; border: 0; background: rgba(255,255,255,.12); color: #fff; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; padding: 0; flex: none; touch-action: manipulation; }
.rotate-hint button .ic { width: 14px; height: 14px; }
.dpad { z-index: 22; opacity: .62; }
.dpad button { background: rgba(14,20,36,.55); border-color: rgba(255,255,255,.22); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dpad button:active { background: rgba(255,122,18,.55); }
@media (pointer: coarse) { .dpad { width: 168px; } .dpad button { min-height: 58px; } }
@media (orientation: landscape) and (pointer: coarse) {
  .game.dpad-on #dos { right: 200px; }                 /* el juego se corre a la izquierda: los botones caben en la franja negra */
  .dpad { right: calc(var(--sar) + 14px); bottom: 50%; transform: translateY(50%); opacity: .7; }
}
.rotate-hint { left: calc(var(--sal) + 62px); transform: none; max-width: calc(100vw - 62px - 150px - var(--sal)); }

/* =================================================================== v8: alto visible real + ventana de instalación */
.game { inset: 0 0 auto 0; height: var(--vvh, 100dvh); }
#dos { left: var(--sal); right: var(--sar); }
@media (orientation: landscape) and (pointer: coarse) { .game.dpad-on #dos { right: calc(200px + var(--sar)); } }

.pwa { position: fixed; z-index: 110; left: 50%; bottom: calc(var(--sab) + 14px); transform: translateX(-50%); width: min(360px, calc(100vw - 20px)); padding: 14px 14px 12px; border-radius: 18px;
  background: rgba(12,18,32,.97); border: 1px solid rgba(255,140,50,.55); box-shadow: 0 18px 50px rgba(0,0,0,.6); color: var(--text); font-size: .86rem; animation: pwaIn .3s ease-out; }
@keyframes pwaIn { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.pwa-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.pwa-x .ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.pwa-head { display: flex; gap: 10px; align-items: center; padding-right: 34px; margin-bottom: 10px; }
.pwa-head img { border-radius: 10px; flex: none; }
.pwa-head div { display: grid; line-height: 1.25; }
.pwa-head b { font-size: 1rem; }
.pwa-head span { color: var(--muted); font-size: .78rem; }
.pwa-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.pwa-tabs button { appearance: none; border: 1px solid var(--line); background: #0b1120; color: var(--muted); border-radius: 10px; padding: 7px 6px; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.pwa-tabs button.on { background: rgba(255,122,18,.16); border-color: rgba(255,140,50,.7); color: #ffd2a8; }
.pwa-steps { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 5px; }
.pwa-steps li { line-height: 1.35; }
.pwa-steps li::marker { color: var(--rust); font-weight: 800; }
.pwa .ic.inline { width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; color: #ffb36e; }
.pwa-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pwa-never { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .76rem; cursor: pointer; margin-left: auto; }
.pwa-never input { width: 16px; height: 16px; accent-color: var(--rust); }
@media (max-height: 460px) and (orientation: landscape) { .pwa { bottom: 8px; padding: 10px 12px; } .pwa-steps { gap: 2px; margin-bottom: 6px; } }
@media (max-height: 460px) and (orientation: landscape) { .pwa { left: auto; right: calc(var(--sar) + 10px); transform: none; animation: none; width: min(330px, 45vw); } }
.pwa { z-index: 35; }
.screen.game { min-height: 0; bottom: auto; height: var(--vvh, 100dvh); }

/* v12: pestañas de acceso (Android) · ejes de pantalla · barra táctil */
.auth-card .tabs { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.auth-card .tab { flex-direction: row; flex-wrap: nowrap; white-space: nowrap; min-width: 0; gap: 6px; padding: 12px 6px; font-size: clamp(.68rem, 3.3vw, .86rem); letter-spacing: .03em; overflow: hidden; }
.auth-card .tab > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: inherit; }
.auth-card .tab .ic { flex: 0 0 auto; width: 18px; height: 18px; }
.auth-card .tab.on, .auth-card .tab.on > span { color: #fff; text-shadow: 0 1px 2px rgba(120,40,0,.6); }
.auth-card .tab.on { background: linear-gradient(180deg, #ff8a22, #e85d00); }
.auth-card .tab.on .ic { stroke: #fff; }
/* horizontal: el juego se corre a la derecha de la barra táctil (Selección/Cancelar) y deja la franja derecha para las flechas */
@media (orientation: landscape) and (pointer: coarse) {
  .game #dos { left: calc(var(--sal) + 84px); }
  .touchbar { left: calc(var(--sal) + 10px); }
}
@media (orientation: landscape) and (pointer: coarse) and (max-height: 380px) { .game #dos { left: calc(var(--sal) + 74px); } }

/* v13: "Jugar solo" grande junto a "Crear sala" */
.solo-big { width: 100%; margin-top: 10px; background: linear-gradient(180deg, #2f7dff, #1f56d6); border: 1px solid #6aa2ff; color: #fff; box-shadow: 0 8px 24px rgba(47,125,255,.32); }
.solo-big:hover { filter: brightness(1.1); }
.solo-big .ic { fill: currentColor; stroke: none; }
