/* Lo que comparten la tele y el móvil: tipografías, colores y las piezas de juego
   (moneda, barras de vida, avatar, mapa, dados, logros). */
@font-face { font-family: "Bungee"; src: url(fuentes/bungee-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 400; src: url(fuentes/barlow-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 500; src: url(fuentes/barlow-latin-500-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 600; src: url(fuentes/barlow-latin-600-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 700; src: url(fuentes/barlow-latin-700-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; src: url(fuentes/barlow-condensed-latin-500-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; src: url(fuentes/barlow-condensed-latin-600-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; src: url(fuentes/barlow-condensed-latin-700-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; src: url(fuentes/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; src: url(fuentes/ibm-plex-mono-latin-600-normal.woff2) format("woff2"); font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #120b1c;
  --bg2: #0a0611;
  --panel: #1d1430;
  --panel2: #281b40;
  --line: #3a2a55;
  --fg: #efe8f7;
  --muted: #a898c2;
  --gold: #ffc23d;
  --gold2: #ff9d2e;
  --pink: #ff3d8b;
  --sys: #6fd3ff;
  --ok: #69e08f;
  --bad: #ff6b5e;
  --violet: #8b5cff;
  --yo: var(--sys);
  --f-display: "Bungee", "Impact", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, sans-serif;
  --f-cond: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); line-height: 1.4; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
em { font-style: normal; color: var(--gold); }
[hidden] { display: none !important; }

/* Fondo vivo: dos focos de plató que se pasean y una trama de líneas de emisión */
.fondo { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(ellipse at 50% -20%, #3b1a55 0%, transparent 60%), var(--bg); }
.fondo::before, .fondo::after { content: ""; position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(60px); opacity: .28; will-change: transform; }
.fondo::before { background: radial-gradient(circle, var(--violet), transparent 65%); left: -25vmax; top: -30vmax; animation: foco1 38s ease-in-out infinite alternate; }
.fondo::after { background: radial-gradient(circle, var(--pink), transparent 65%); right: -30vmax; bottom: -35vmax; opacity: .16; animation: foco2 47s ease-in-out infinite alternate; }
.fondo i { position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(0,0,0,.16) 3px 4px); mix-blend-mode: multiply; }
body.combate .fondo::after { background: radial-gradient(circle, var(--bad), transparent 65%); opacity: .3; }
@keyframes foco1 { to { transform: translate(35vmax, 20vmax) scale(1.2); } }
@keyframes foco2 { to { transform: translate(-30vmax, -22vmax) scale(.85); } }

/* ---------- Moneda y contador de oro ---------- */
.moneda { display: inline-block; width: 1.15em; height: 1.15em; border-radius: 50%; position: relative; vertical-align: -.2em; flex: none;
  background: radial-gradient(circle at 34% 28%, #fff8d2 0 10%, #ffd95e 28%, #ffb21f 62%, #c97800 100%);
  box-shadow: inset 0 0 0 .08em #9a5f00, inset 0 0 0 .2em rgba(255,236,160,.45), 0 0 .55em rgba(255,194,61,.5); }
.moneda::after { content: ""; position: absolute; inset: 26%; background: #9a5f00; opacity: .8;
  clip-path: polygon(50% 0, 62% 36%, 100% 38%, 70% 60%, 81% 100%, 50% 77%, 19% 100%, 30% 60%, 0 38%, 38% 36%); }
.moneda.gira { animation: gira .9s cubic-bezier(.3,.7,.3,1); }
@keyframes gira { 0% { transform: rotateY(0) scale(1); } 40% { transform: rotateY(540deg) scale(1.35); } 100% { transform: rotateY(1080deg) scale(1); } }
.oro { display: inline-flex; align-items: center; gap: .4em; font-family: var(--f-display); color: var(--gold); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 .7em rgba(255,194,61,.45); position: relative; }
.oro.salta b { animation: salta .5s; }
.oro b { font-weight: 400; display: inline-block; }
@keyframes salta { 30% { transform: scale(1.35) translateY(-8%); color: #fff3c4; } }

/* ---------- Barras ---------- */
.pv { position: relative; height: .62em; border-radius: 99px; background: #2c2040; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.pv > i, .pv > u { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }
.pv > u { background: #fff; opacity: .8; transition: width 1s .45s ease-out; }
.pv > i { background: linear-gradient(90deg, #3fbf78, var(--ok)); transition: width .45s cubic-bezier(.2,.8,.2,1), background .4s; box-shadow: 0 0 .7em rgba(105,224,143,.45); }
.pv.media > i { background: linear-gradient(90deg, #e09a2c, var(--gold)); box-shadow: 0 0 .7em rgba(255,194,61,.45); }
.pv.baja > i { background: linear-gradient(90deg, #d8382c, var(--bad)); box-shadow: 0 0 .7em rgba(255,107,94,.6); animation: late 1s ease-in-out infinite; }
@keyframes late { 50% { filter: brightness(1.5); } }
.px { position: relative; height: .28em; border-radius: 99px; background: #2c2040; overflow: hidden; }
.px > i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--violet), var(--sys)); transition: width .8s cubic-bezier(.2,.8,.2,1); }

/* ---------- Avatar hexagonal ---------- */
.avatar { --c: var(--sys); width: 2.4em; aspect-ratio: 1 / 1.1; flex: none; display: grid; place-items: center; position: relative;
  font-family: var(--f-display); color: var(--bg2); background: var(--c);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.avatar::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255,255,255,.55), transparent 45%, rgba(0,0,0,.3)); }
.avatar span { position: relative; font-size: 1.1em; line-height: 1; }

/* ---------- Efectos sueltos ---------- */
.flota { position: absolute; left: 50%; top: 0; z-index: 30; pointer-events: none; font-family: var(--f-display); font-size: 1.3em; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0,0,0,.6), 0 0 .6em currentColor; animation: flota 1.5s ease-out forwards; }
.flota.mal { color: var(--bad); } .flota.bien { color: var(--ok); } .flota.oro { color: var(--gold); } .flota.pex { color: var(--sys); }
@keyframes flota { 0% { transform: translate(-50%, 20%) scale(.6); opacity: 0; } 15% { transform: translate(-50%, -30%) scale(1.25); opacity: 1; } 100% { transform: translate(-50%, -190%) scale(1); opacity: 0; } }
.sacude { animation: sacude .5s; }
@keyframes sacude { 10% { transform: translate(-7px, 2px) rotate(-1deg); } 30% { transform: translate(6px, -3px) rotate(1deg); } 50% { transform: translate(-5px, 2px); } 70% { transform: translate(4px, -1px); } 90% { transform: translate(-2px, 0); } }
.golpe::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--bad); opacity: 0; pointer-events: none; animation: destello .6s; }
.alivio::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--ok); opacity: 0; pointer-events: none; animation: destello .9s; }
@keyframes destello { 10% { opacity: .55; } 100% { opacity: 0; } }
.chispa { position: fixed; z-index: 90; width: 10px; height: 10px; border-radius: 50%; pointer-events: none; background: var(--gold); box-shadow: 0 0 10px currentColor;
  animation: chispa var(--t, .9s) cubic-bezier(.1,.7,.3,1) forwards; }
.chispa.cuadro { border-radius: 2px; }
@keyframes chispa { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r, 200deg)) scale(.2); opacity: 0; } }

/* ---------- Mapa ---------- */
.mapa svg { display: block; width: 100%; height: 100%; font-family: var(--f-mono); }
.mapa .ficha { transition: transform .8s cubic-bezier(.3,.8,.3,1); }
.mapa .ficha.muerto { opacity: .55; }
.mapa .aro { fill: none; stroke: #fff; stroke-width: .08; transform-box: fill-box; transform-origin: center; animation: aro 1.6s ease-out infinite; }
@keyframes aro { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.9); opacity: 0; } }
.leyenda { display: flex; flex-wrap: wrap; gap: .3em 1em; font-family: var(--f-mono); font-size: .74em; color: var(--muted); align-items: center; }
.leyenda i { display: inline-grid; place-items: center; width: 1.55em; height: 1.55em; border-radius: 50%; color: var(--bg2); font-style: normal; font-weight: 600; margin-right: .4em; }
.leyenda i.sq { border-radius: 3px; }
.leyenda b { color: var(--fg); font-weight: 600; }

/* ---------- Dados: escenario a pantalla completa ---------- */
.dados { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 4vmin;
  background: radial-gradient(ellipse at center, rgba(18,11,28,.82), rgba(5,3,9,.95)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: aparece .25s ease-out; }
.dados.fuera { animation: desaparece .3s ease-in forwards; }
@keyframes aparece { from { opacity: 0; } }
@keyframes desaparece { to { opacity: 0; } }
.tirada { --c: var(--pink); text-align: center; display: grid; gap: .5em; justify-items: center; font-size: clamp(22px, 3.6vmin, 46px); max-width: 94vw; }
.tirada .quien { font-family: var(--f-display); font-size: 1.5em; line-height: 1; color: var(--c); text-shadow: 0 0 1em color-mix(in srgb, var(--c) 60%, transparent); animation: entra .3s cubic-bezier(.2,1.4,.4,1) both; }
.tirada .que { font-family: var(--f-cond); font-weight: 600; font-size: 1.05em; letter-spacing: .04em; text-transform: uppercase; color: var(--fg); animation: entra .3s .05s cubic-bezier(.2,1.4,.4,1) both; text-wrap: balance; }
@keyframes entra { from { transform: translateY(40%) scale(.9); opacity: 0; } }
.tirada .fila { display: flex; align-items: center; justify-content: center; gap: .45em; font-family: var(--f-display); margin: .2em 0; min-height: 5.4em; }
.dado { position: relative; width: 5em; height: 5em; display: grid; place-items: center; flex: none; filter: drop-shadow(0 .25em .5em rgba(0,0,0,.6)); }
.dado svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dado svg .cara { fill: #2a1c47; stroke: var(--c); stroke-width: 3; stroke-linejoin: round; }
.dado svg .arista { fill: none; stroke: var(--c); stroke-width: 1.4; opacity: .5; stroke-linejoin: round; }
.dado b { position: relative; font-weight: 400; font-size: 1.9em; line-height: 1; color: #fff; text-shadow: 0 0 .5em var(--c); font-variant-numeric: tabular-nums; }
.dado small { position: absolute; bottom: -1.5em; left: 50%; transform: translateX(-50%); font-family: var(--f-mono); font-size: .36em; color: var(--muted); white-space: nowrap; letter-spacing: .08em; }
.dado.rueda { animation: rueda .32s linear infinite; }
.dado.rueda b { filter: blur(1.5px); opacity: .85; }
@keyframes rueda { 0% { transform: rotate(0) translateY(0) scale(1); } 25% { transform: rotate(90deg) translateY(-12%) scale(1.06); } 50% { transform: rotate(180deg) translateY(0) scale(.96); } 75% { transform: rotate(270deg) translateY(-8%) scale(1.04); } 100% { transform: rotate(360deg) translateY(0) scale(1); } }
.dado.cae { animation: cae .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes cae { 0% { transform: scale(1.7) rotate(-14deg); } 55% { transform: scale(.9) rotate(3deg); } 100% { transform: scale(1) rotate(0); } }
.tirada .mod, .tirada .igual, .tirada .total { opacity: 0; transform: translateX(-30%); transition: opacity .2s, transform .3s cubic-bezier(.2,1.5,.4,1); }
.tirada .mod { font-size: 1.5em; color: var(--muted); }
.tirada .igual { font-size: 1.3em; color: var(--muted); }
.tirada .total { font-size: 3em; line-height: 1; color: var(--gold); text-shadow: 0 0 .5em rgba(255,194,61,.6); min-width: 1.2em; }
.tirada.suma .mod, .tirada.suma .igual, .tirada.suma .total { opacity: 1; transform: none; }
.tirada.suma .igual { transition-delay: .08s; } .tirada.suma .total { transition-delay: .16s; }
.tirada .contra { font-family: var(--f-mono); font-size: .75em; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); min-height: 1.4em; opacity: 0; transition: opacity .2s .2s; }
.tirada.suma .contra { opacity: 1; }
.tirada .sello { font-family: var(--f-display); font-size: 1.9em; line-height: 1; padding: .12em .5em .16em; border: .12em solid currentColor; border-radius: .18em; min-height: 1.5em;
  opacity: 0; transform: scale(2.6) rotate(-14deg); }
.tirada.fin .sello { opacity: 1; transform: scale(1) rotate(-5deg); transition: transform .28s cubic-bezier(.3,1.7,.5,1), opacity .12s; }
.tirada .sello:empty { border-color: transparent; }
.tirada.exito .sello { color: var(--ok); text-shadow: 0 0 .6em rgba(105,224,143,.6); }
.tirada.falla .sello { color: var(--bad); text-shadow: 0 0 .6em rgba(255,107,94,.6); }
.tirada.critico .sello { color: var(--gold); text-shadow: 0 0 .8em rgba(255,194,61,.9); }
.tirada.critico.fin .dado svg .cara { fill: #6b4a08; stroke: var(--gold); }
.tirada.critico.fin .dado b { text-shadow: 0 0 .6em var(--gold); }
.tirada.pifia.fin .dado svg .cara { fill: #4a1512; stroke: var(--bad); }
.tirada.pifia.fin { animation: sacude .5s; }
.tirada .cuenta { font-family: var(--f-mono); font-size: .55em; color: var(--muted); letter-spacing: .2em; margin-top: .6em; }
.dados .saltar { position: absolute; bottom: 4vmin; left: 50%; transform: translateX(-50%); font-family: var(--f-mono); font-size: 12px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; opacity: .7; }

/* ---------- Logro ---------- */
.logro-capa { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 5vmin; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(18,11,28,.7), rgba(5,3,9,.9)); animation: aparece .25s ease-out; }
.logro-capa.fuera { animation: desaparece .4s ease-in forwards; }
.logro { position: relative; text-align: center; font-size: clamp(15px, 3vmin, 40px); max-width: 30em; padding: 1.2em 1.8em 1.4em; border-radius: .5em; overflow: hidden;
  background: linear-gradient(160deg, #3a2608, #1d1430 55%); border: .12em solid var(--gold);
  box-shadow: 0 0 0 .3em rgba(255,194,61,.12), 0 0 4em rgba(255,194,61,.35); animation: logro .6s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes logro { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }
.logro::before { content: ""; position: absolute; top: -50%; bottom: -50%; left: -40%; width: 30%; transform: rotate(20deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); animation: brillo 1.6s .4s ease-in-out; }
@keyframes brillo { to { left: 130%; } }
.logro .cinta { font-family: var(--f-mono); font-weight: 600; font-size: .62em; letter-spacing: .3em; color: var(--gold); text-transform: uppercase; }
.logro h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.7em; line-height: 1.05; margin: .25em 0 .2em; color: #fff; text-shadow: 0 0 .6em rgba(255,194,61,.7); text-wrap: balance; }
.logro .para { font-family: var(--f-cond); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c, var(--sys)); }
.logro p { margin: .5em 0 0; color: var(--fg); font-size: .82em; text-wrap: pretty; }
.logro .premio { display: inline-block; margin-top: .8em; font-family: var(--f-mono); font-size: .62em; letter-spacing: .12em; text-transform: uppercase; color: var(--bg2); background: var(--gold); padding: .25em .8em; border-radius: 99px; font-weight: 600; }
.logro.nivel { border-color: var(--sys); background: linear-gradient(160deg, #0b3246, #1d1430 55%); box-shadow: 0 0 0 .3em rgba(111,211,255,.12), 0 0 4em rgba(111,211,255,.35); }
.logro.nivel .cinta { color: var(--sys); }
.logro.nivel h3 { text-shadow: 0 0 .6em rgba(111,211,255,.8); }

@media (prefers-reduced-motion: reduce) {
  .fondo::before, .fondo::after { animation: none; }
  .dado.rueda { animation: none; }
  .pv.baja > i { animation: none; }
}

/* ---------- Imagen de la escena a pantalla completa ---------- */
.cine { position: fixed; inset: 0; z-index: 78; background: #05030a; display: grid; place-items: center; overflow: hidden; animation: aparece .5s ease-out; }
.cine.fuera { animation: desaparece .5s ease-in forwards; }
.cine .fondo-cine { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; filter: blur(30px) brightness(.45); }
.cine .foto-cine { position: relative; max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 0 80px rgba(0,0,0,.8); animation: zum 9s ease-out both; }
@keyframes zum { from { transform: scale(1.12); } to { transform: scale(1); } }
.cine .pie-cine { position: absolute; left: 0; right: 0; bottom: 0; padding: 3em 5vw 1.6em; background: linear-gradient(transparent, rgba(5,3,10,.92)); font-family: var(--f-display); font-size: clamp(16px, 3.2vmin, 40px); line-height: 1.1; color: var(--gold); text-shadow: 0 2px 0 rgba(0,0,0,.7); text-wrap: balance; animation: entra .6s .5s cubic-bezier(.2,1.2,.4,1) both; }
.cine .pie-cine span { display: block; font-family: var(--f-mono); font-size: .42em; letter-spacing: .26em; text-transform: uppercase; color: var(--sys); margin-bottom: .5em; }
