/* EBIM Play — sistema visual compartido (marca: menta #aeea94, petróleo #055658, DM Sans). */
:root {
  color-scheme: dark;
  --bg: #041413;
  --bg-2: #072423;
  --panel: #0c2a28;
  --panel-2: #103431;
  --line: #1f4a45;
  --text: #f7f6f3;
  --muted: #a3bdb7;
  --mint: #aeea94;
  --green: #5aa97f;
  --teal: #055658;
  --gold: #ffd76a;
  --coral: #ff9a8b;
  --violet: #b9a2ff;
  --sky: #7fd6ff;
  --pink: #ff9ed2;
  --red: #ff8f87;
  --accent: var(--mint);
  --accent-ink: #0b2415;
  --radius: 22px;
  font-family: "DM Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--text); background: var(--bg);
  background-image:
    radial-gradient(900px 520px at 12% -8%, #0b5a55aa 0%, transparent 62%),
    radial-gradient(760px 520px at 100% 0%, #2b6b3d66 0%, transparent 60%),
    radial-gradient(900px 700px at 50% 115%, #05565877 0%, transparent 60%);
  background-attachment: fixed; overflow-x: hidden; line-height: 1.45;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
h1, h2, h3, p { margin: 0; }
.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; }

/* Formas de la marca flotando al fondo */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop i { position: absolute; display: block; background: var(--green); opacity: .09; animation: drift 26s ease-in-out infinite alternate; }
.backdrop i:nth-child(1) { width: 190px; height: 190px; border-radius: 50%; left: -50px; top: 30%; }
.backdrop i:nth-child(2) { width: 130px; height: 130px; border-radius: 38%; right: 6%; top: 14%; animation-duration: 32s; animation-delay: -8s; background: var(--mint); }
.backdrop i:nth-child(3) { width: 230px; height: 230px; border-radius: 22%; right: -70px; bottom: 8%; animation-duration: 38s; animation-delay: -15s; }
.backdrop i:nth-child(4) { width: 96px; height: 96px; border-radius: 12%; left: 16%; bottom: 6%; animation-duration: 30s; animation-delay: -4s; background: var(--gold); opacity: .07; }
.backdrop i:nth-child(5) { width: 70px; height: 70px; border-radius: 30%; left: 46%; top: 8%; animation-duration: 34s; animation-delay: -20s; background: var(--sky); opacity: .07; }
@keyframes drift { from { transform: translate3d(0, 0, 0) rotate(0deg); } to { transform: translate3d(40px, -60px, 0) rotate(120deg); } }

/* Barra superior */
.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: #041413cc; border-bottom: 1px solid #ffffff14; }
.topbar .wrap { display: flex; align-items: center; gap: 14px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand img { height: 40px; width: auto; display: block; }
.brand-play { font-weight: 800; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); background: var(--mint); padding: 5px 10px 4px; border-radius: 999px; transform: rotate(-4deg); box-shadow: 0 6px 18px #aeea9440; }
.nav-back { text-decoration: none; font-weight: 700; font-size: 14px; color: var(--muted); padding: 9px 12px; border-radius: 999px; }
.nav-back:hover { color: var(--text); background: #ffffff10; }
.player-chip { display: inline-flex; align-items: center; gap: 9px; border: 1px solid #ffffff22; background: #ffffff0d; border-radius: 999px; padding: 5px 14px 5px 5px; font-weight: 700; font-size: 14px; max-width: 46vw; }
.player-chip:hover { background: #ffffff1a; }
.player-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { --hue: 140; flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 36%; background: hsl(var(--hue) 70% 72%); color: #0a1f1c; font-weight: 800; font-size: 15px; text-transform: uppercase; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 22px; border-radius: 14px; border: 0; font-weight: 800; font-size: 16px; text-decoration: none; transition: transform .12s ease, box-shadow .2s ease, background .2s ease; }
.btn:active { transform: translateY(2px) scale(.98); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 55%, #000), 0 14px 30px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 55%, #000); }
.btn-ghost { background: #ffffff10; color: var(--text); border: 1px solid #ffffff26; }
.btn-ghost:hover { background: #ffffff1c; }
.btn-small { min-height: 38px; padding: 8px 14px; font-size: 14px; border-radius: 11px; }

/* Paneles */
.panel { background: linear-gradient(180deg, #ffffff0d, #ffffff05), var(--panel); border: 1px solid #ffffff17; border-radius: var(--radius); box-shadow: 0 24px 60px #00000040; }
.label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.kicker::before { content: ""; width: 10px; height: 10px; border-radius: 30%; background: var(--accent); transform: rotate(18deg); }

/* Página de juego */
.game-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 0 16px; }
.game-hero h1 { font-size: clamp(36px, 6vw, 58px); font-weight: 900; letter-spacing: -.05em; line-height: 1; margin-top: 8px; }
.game-hero h1 em { font-style: normal; color: var(--accent); }
.game-hero p.sub { color: var(--muted); font-size: clamp(15px, 2vw, 18px); margin-top: 10px; max-width: 46ch; }
.hero-emoji { flex: none; font-size: clamp(56px, 9vw, 96px); line-height: 1; filter: drop-shadow(0 18px 30px #00000066); animation: bob 4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-5deg); } }
.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 340px); gap: 20px; align-items: start; padding-bottom: 48px; }
.stage { position: relative; padding: 20px; min-width: 0; border-color: color-mix(in srgb, var(--accent) 30%, #ffffff17); }
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.meter { background: #00000033; border: 1px solid #ffffff12; border-radius: 16px; padding: 10px 14px; display: grid; gap: 2px; }
.meter strong { font-size: clamp(22px, 4vw, 30px); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.meter strong.hot { color: var(--accent); }
.timebar { height: 8px; border-radius: 99px; background: #00000055; overflow: hidden; margin-bottom: 14px; }
.timebar > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #fff); transform-origin: left; }
.arena { position: relative; border-radius: 18px; background: #031110; border: 1px solid #ffffff12; padding: 16px; min-height: 340px; display: grid; place-items: center; overflow: hidden; }
.overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; padding: 20px; border-radius: inherit; background: radial-gradient(closest-side, #062321f2, #031110f7); animation: fade .25s ease; }
.overlay .big { font-size: 58px; line-height: 1; animation: bob 3s ease-in-out infinite; }
.overlay h2 { font-size: clamp(26px, 5vw, 40px); font-weight: 900; letter-spacing: -.04em; }
.overlay p { color: var(--muted); max-width: 36ch; }
.overlay .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.overlay .stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.overlay .stats span { background: #ffffff10; border: 1px solid #ffffff1c; border-radius: 99px; padding: 6px 12px; font-weight: 700; font-size: 14px; }
.count { font-size: clamp(90px, 22vw, 150px); font-weight: 900; color: var(--accent); line-height: 1; animation: pop .9s ease both; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 35% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(.9); opacity: .2; } }
@keyframes fade { from { opacity: 0; } }

/* Barra lateral y ranking */
.sidebar { display: grid; gap: 16px; }
.side { padding: 18px; }
.side h2 { font-size: 18px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.side h2 small { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank-list li { display: grid; grid-template-columns: 30px 32px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 13px; background: #00000026; font-size: 14.5px; animation: fade .3s ease both; }
.rank-list li.you { background: color-mix(in srgb, var(--accent) 16%, transparent); outline: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.rank-list li:first-child { background: linear-gradient(90deg, #ffd76a2e, #ffd76a0a); }
.rank-list .pos { text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-list li:nth-child(-n+3) .pos { font-size: 19px; }
.rank-list .who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.rank-list .pts small { color: var(--muted); font-weight: 600; }
.rank-empty { color: var(--muted); font-size: 14px; padding: 14px; text-align: center; border: 1px dashed #ffffff26; border-radius: 13px; }
.my-rank { margin-top: 10px; font-size: 14px; color: var(--muted); }
.my-rank b { color: var(--accent); }
.howto { color: var(--muted); font-size: 14.5px; }
.howto p + p, .howto ul { margin-top: 8px; }
.howto ul { padding-left: 18px; margin-bottom: 0; }
.howto b { color: var(--text); }

/* Diálogos y avisos */
dialog { width: min(420px, 100% - 28px); color: var(--text); background: linear-gradient(180deg, #123b37, #0b2725); border: 1px solid #ffffff26; border-radius: 26px; padding: 26px; box-shadow: 0 40px 100px #000000aa; }
dialog::backdrop { background: #020b0be0; backdrop-filter: blur(6px); }
dialog h2 { font-size: 26px; font-weight: 900; letter-spacing: -.03em; margin: 8px 0 6px; }
dialog p { color: var(--muted); font-size: 15px; }
dialog .field { display: grid; gap: 6px; margin: 14px 0 8px; font-weight: 700; font-size: 14px; }
dialog input[type="text"], dialog input[type="password"] { width: 100%; min-height: 52px; padding: 10px 16px; border-radius: 14px; border: 2px solid #ffffff2b; background: #031110; font-size: 18px; font-weight: 700; }
dialog input[type="text"]:focus, dialog input[type="password"]:focus { outline: none; border-color: var(--mint); }
dialog .status { min-height: 22px; color: var(--gold); font-size: 14px; }
dialog .row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
dialog .row .btn { flex: 1 1 140px; }
.dialog-mark { font-size: 44px; line-height: 1; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 60; transform: translateX(-50%); background: #f7f6f3; color: #0b2415; font-weight: 700; padding: 12px 18px; border-radius: 14px; box-shadow: 0 16px 40px #00000088; max-width: calc(100% - 32px); text-align: center; animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } }
.confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; }

.footer { color: #7e9a94; font-size: 13px; text-align: center; padding: 10px 0 34px; }

@media (max-width: 860px) {
  .wrap { width: calc(100% - 28px); }
  .columns { grid-template-columns: 1fr; gap: 16px; }
  .game-hero { padding: 20px 0 14px; }
  .stage { padding: 12px; border-radius: 20px; }
  .arena { padding: 10px; min-height: 300px; }
  .brand img { height: 34px; }
  .nav-back span { display: none; }
  .meter { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
