/* 4 en Raya: estilos de la interfaz (sobre el lienzo 3D). */
:root {
  --bg: #10233b; --bg2: #0a1828; --panel: #183453; --panel2: #21446a; --line: rgba(170,215,255,.18); --text: #f4fbff; --muted: #9fbad6;
  --accent: #ffd23f; --accent2: #ff9a3c; --accent-text: #2a1a05; --mint: #47d96b; --mint2: #22a84a; --danger: #ff5a5a; --gem: #4ff0ff;
  --font: 'Fredoka', 'Baloo 2', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --sky1: #8fd4ff; --sky2: #e6f7ff;
}
* { 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 { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overflow: hidden; }
#app { position: fixed; inset: 0; overflow: hidden; background: linear-gradient(180deg, var(--sky1), var(--sky2)); transition: background .6s; touch-action: none; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent2); outline-offset: 3px; }
a { color: var(--accent); }

/* ---------- botones ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 52px; padding: .45em 1.3em; border-radius: 18px; font-size: 1.12rem; font-weight: 700; letter-spacing: .02em; color: var(--accent-text); text-decoration: none;
  background: linear-gradient(180deg, #fff1a6, var(--accent) 55%, #f2a922); box-shadow: 0 5px 0 #b77812, 0 10px 22px rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.6); transition: transform .08s, box-shadow .08s, filter .15s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b77812, inset 0 2px 0 rgba(255,255,255,.6); }
.btn svg { width: 1.25em; height: 1.25em; flex: none; }
.btn span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.btn small { font-size: .62em; font-weight: 600; opacity: .8; letter-spacing: 0; margin-top: .15em; }
.btn.mint { color: #06301a; background: linear-gradient(180deg, #b9ffc9, var(--mint) 55%, var(--mint2)); box-shadow: 0 5px 0 #157233, 0 10px 22px rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.6); }
.btn.mint:active { box-shadow: 0 1px 0 #157233, inset 0 2px 0 rgba(255,255,255,.6); }
.btn.ghost { color: var(--text); background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:active { transform: translateY(2px); }
.btn.big { min-height: 64px; font-size: 1.45rem; padding: .4em 1.6em; border-radius: 22px; }
.btn.small { min-height: 40px; font-size: .92rem; padding: .3em .9em; border-radius: 13px; }
.btn[disabled] { filter: grayscale(.7) brightness(.85); pointer-events: none; }
.icon-btn { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; color: var(--text); background: rgba(16,35,59,.72); box-shadow: inset 0 0 0 2px var(--line), 0 4px 12px rgba(0,0,0,.2); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.icon-btn svg { width: 26px; height: 26px; }
.icon-btn:active { transform: scale(.94); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: rgba(0,0,0,.25); font-weight: 700; }
.pill svg { width: 20px; height: 20px; fill: var(--gem); }

/* ---------- pantallas ---------- */
#screens { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.screen { position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; animation: in .25s ease-out both; padding: calc(14px + var(--safe-t)) calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l)); }
.screen.out { animation: out .2s ease-in both; pointer-events: none; }
@keyframes in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes out { to { opacity: 0; transform: scale(.98); } }
.overlay { justify-content: center; background: rgba(6,18,32,.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.card { width: min(420px, 100%); max-height: 100%; overflow: auto; padding: 22px 20px; border-radius: 26px; background: linear-gradient(180deg, var(--panel2), var(--panel)); box-shadow: inset 0 0 0 2px var(--line), 0 20px 50px rgba(0,0,0,.4); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.card h2 { margin: 0; font-size: 1.9rem; line-height: 1.1; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.card .sub { margin: 0; color: var(--muted); font-size: 1rem; }
.card.scroll { max-height: min(86vh, 720px); }

/* portada */
.title-screen { justify-content: space-between; }
.logo { text-align: center; margin-top: 1.5vh; filter: drop-shadow(0 6px 0 rgba(0,0,0,.12)); }
.logo .h1 { display: flex; align-items: center; justify-content: center; gap: .12em; font-weight: 700; line-height: .9; }
.logo .l4 { font-size: clamp(4.4rem, 22vw, 7.6rem); color: var(--p1, #ff4757); -webkit-text-stroke: 4px #7a1424; paint-order: stroke fill; text-shadow: 0 7px 0 #7a1424, 0 12px 22px rgba(0,0,0,.25); transform: rotate(-6deg); }
.logo .l2 { font-size: clamp(2.3rem, 11vw, 4.2rem); color: #ffc93c; -webkit-text-stroke: 3px #8a4a0a; paint-order: stroke fill; text-shadow: 0 5px 0 #8a4a0a; transform: rotate(2deg); max-width: 7.5em; text-align: left; }
.logo p { margin: .6em auto 0; display: inline-block; padding: .3em .9em; border-radius: 99px; background: rgba(16,35,59,.72); font-weight: 600; font-size: 1.02rem; }
.title-bottom { display: flex; flex-direction: column; gap: 12px; align-items: stretch; width: min(360px, 100%); margin-bottom: .5vh; }
.title-bottom .btn.big { justify-content: flex-start; }
.title-bottom .row .icon-btn .disc-svg { width: 30px; height: 30px; }
.btn.pink { color: #fff; background: linear-gradient(180deg, #ffb0d8, #ff6fb5 55%, #e0418f); box-shadow: 0 5px 0 #9c2563, 0 10px 22px rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.5); }
.btn.pink:active { box-shadow: 0 1px 0 #9c2563, inset 0 2px 0 rgba(255,255,255,.5); }
.portal-link { position: absolute; left: calc(12px + var(--safe-l)); top: calc(12px + var(--safe-t)); display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 99px; background: rgba(16,35,59,.7); color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.portal-link svg { width: 28px; height: 28px; }
.disc-svg { display: block; }

/* portada en horizontal: título y botones a la izquierda, tablero a la derecha */
.land .title-screen { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2.5vh; padding-left: calc(4vw + var(--safe-l)); }
.land .title-screen .logo { margin-top: 0; width: min(44vw, 430px); }
.land .title-bottom { width: min(40vw, 380px); margin-bottom: 0; }

/* elegir rival */
.card.wide { width: min(480px, 100%); }
.card .bar { display: flex; align-items: center; gap: 10px; } .card .bar h2 { flex: 1; }
.card .bar > span { width: 50px; }
.levels { display: flex; flex-direction: column; gap: 8px; }
.lvl { display: grid; grid-template-columns: 46px 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 12px; padding: 8px 12px 8px 8px; border-radius: 18px; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 2px var(--line); text-align: left; transition: transform .1s, background .15s; }
.lvl:active { transform: scale(.98); }
.lvl.on { background: rgba(255,210,63,.18); box-shadow: inset 0 0 0 3px var(--accent); }
.lvl .num { grid-row: 1 / 3; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.25), inset 0 2px 0 rgba(255,255,255,.4); }
.lv1 .num, .lvdot.lv1 { background: #47d96b; } .lv2 .num, .lvdot.lv2 { background: #2fbfe0; } .lv3 .num, .lvdot.lv3 { background: #ffb23c; } .lv4 .num, .lvdot.lv4 { background: #ff6a4a; } .lv5 .num, .lvdot.lv5 { background: #b05cff; }
.lvl .txt { display: flex; flex-direction: column; line-height: 1.15; }
.lvl .txt b { font-size: 1.15rem; display: flex; align-items: center; gap: 6px; } .lvl .txt small { color: var(--muted); font-weight: 600; }
.lvl .cr svg { width: 18px; height: 18px; color: var(--accent); }
.lvl .rec { font-size: .85rem; font-weight: 700; color: var(--muted); grid-row: 1; } .lvl .rec em { font-style: normal; } .lvl .rec .w { color: #7dff9a; } .lvl .rec .l { color: #ff8a8a; }
.lvl .pips { grid-row: 2; grid-column: 3; display: flex; gap: 3px; justify-content: flex-end; } .lvl .pips i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .85; }
.starter { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; flex-wrap: wrap; }
.seg { display: flex; padding: 3px; border-radius: 14px; background: rgba(0,0,0,.28); }
.seg button { padding: 8px 12px; border-radius: 11px; font-weight: 700; font-size: .95rem; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-text); }

/* marcador */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.hud-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: calc(10px + var(--safe-t)) calc(10px + var(--safe-r)) 0 calc(10px + var(--safe-l)); }
.hud-top > * { pointer-events: auto; }
.players { flex: 1; display: flex; gap: 8px; justify-content: center; min-width: 0; }
.chip { position: relative; display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 99px; background: rgba(16,35,59,.72); box-shadow: inset 0 0 0 2px var(--line); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-weight: 700; min-width: 0; max-width: 50%; opacity: .7; transform: scale(.94); transition: transform .2s, opacity .2s, box-shadow .2s; }
.chip .disc-svg { width: 36px; height: 36px; flex: none; }
.chip .nm { display: flex; flex-direction: column; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; } .chip .nm small { font-size: .72rem; color: var(--muted); }
.chip.on { opacity: 1; transform: scale(1.04); box-shadow: inset 0 0 0 3px var(--accent), 0 0 18px rgba(255,210,63,.45); }
.chip.c1.on { box-shadow: inset 0 0 0 3px var(--p1), 0 0 18px color-mix(in srgb, var(--p1) 60%, transparent); } .chip.c2.on { box-shadow: inset 0 0 0 3px var(--p2), 0 0 18px color-mix(in srgb, var(--p2) 60%, transparent); }
.chip.won { opacity: 1; transform: scale(1.08); background: rgba(255,210,63,.35); }
.chip .dots { display: none; gap: 3px; } .chip.think .dots { display: flex; }
.chip .dots i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: dot 1s infinite ease-in-out; } .chip .dots i:nth-child(2) { animation-delay: .15s; } .chip .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 40% { transform: translateY(-4px); opacity: 1; } 0%, 80%, 100% { opacity: .4; } }
.streak { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 99px; background: rgba(16,35,59,.72); box-shadow: inset 0 0 0 2px var(--line); font-weight: 700; color: #ffb23c; height: 50px; }
.streak svg { width: 22px; height: 22px; }
.hud-bottom { position: absolute; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); display: flex; justify-content: center; gap: 14px; pointer-events: none; }
.hbtn { pointer-events: auto; position: relative; display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 6px 18px 6px 12px; border-radius: 20px; font-weight: 700; font-size: 1.1rem; color: var(--text); background: rgba(16,35,59,.78); box-shadow: inset 0 0 0 2px var(--line), 0 6px 16px rgba(0,0,0,.25); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: transform .08s, opacity .2s; }
.hbtn svg { width: 30px; height: 30px; } .hbtn.b-hint svg { color: #ffe066; }
.hbtn:active { transform: scale(.95); }
.hbtn.off { opacity: .45; }
.hbtn .badge { position: absolute; top: -9px; right: -8px; display: grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 99px; font-style: normal; font-size: .72rem; font-weight: 700; background: var(--mint); color: #06301a; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.hbtn .badge:empty { display: none; }
.hbtn.ad .badge { background: var(--accent); color: var(--accent-text); padding: 0 5px; } .hbtn.ad .badge svg { width: 18px; height: 18px; }
.hbtn.spent { opacity: .45; }
/* horizontal: jugadores a la izquierda y ayudas a la derecha */
.land .hud-top { align-items: flex-start; bottom: 0; }
.land .players { position: absolute; left: calc(12px + var(--safe-l)); top: 50%; transform: translateY(-50%); flex-direction: column; align-items: stretch; width: min(210px, 21vw); }
.land .chip { max-width: none; }
.land .streak { position: absolute; right: calc(12px + var(--safe-r)); top: calc(10px + var(--safe-t)); }
.land .hud-bottom { left: auto; right: calc(14px + var(--safe-r)); top: 50%; bottom: auto; transform: translateY(-50%); flex-direction: column; width: min(200px, 20vw); }
.land .hbtn { justify-content: flex-start; }
/* avisos */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.pop { position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: 1.15rem; color: #fff; -webkit-text-stroke: 2px rgba(0,0,0,.5); paint-order: stroke fill; animation: popup 1.05s ease-out forwards; white-space: nowrap; }
.pop.gold { color: var(--accent); font-size: 1.5rem; }
.pop.gem { color: var(--gem); font-size: 1.35rem; }
.pop.lasso { color: #ffe066; font-size: 1.9rem; }
.pop.bad { color: #ff6a6a; }
@keyframes popup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
.banner { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: clamp(2rem, 9vw, 3.4rem); font-weight: 700; color: #fff; -webkit-text-stroke: 3px rgba(0,0,0,.45); paint-order: stroke fill; text-align: center; white-space: nowrap; animation: banner 1.7s ease-out forwards; }
.banner.gold { color: var(--accent); } .banner.mint { color: #8affa0; } .banner.red { color: #ff7a7a; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); } 22% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%); } }
#toasts { position: absolute; left: 0; right: 0; top: calc(110px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 30; }
.toast { padding: 8px 16px; border-radius: 14px; background: rgba(16,35,59,.92); box-shadow: inset 0 0 0 2px var(--line), 0 6px 16px rgba(0,0,0,.3); font-weight: 600; animation: in .25s both; max-width: 90vw; text-align: center; }
.toast.gold { background: linear-gradient(180deg, #fff1a6, var(--accent)); color: var(--accent-text); }
.toast.red { background: #b8302a; }
.toast.out { animation: out .3s both; }
.banner.p1 { color: var(--p1); } .banner.p2 { color: var(--p2); }
#toasts { top: calc(118px + var(--safe-t)); }
.land #toasts { top: auto; bottom: calc(14px + var(--safe-b)); }

/* resultado: abajo, para que se vea la línea ganadora */
.result-p { justify-content: flex-end; padding-bottom: calc(10px + var(--safe-b)); }
.result-p .card { gap: 10px; padding: 16px 18px 18px; animation: rise .45s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.res-face { display: flex; justify-content: center; gap: 6px; margin-top: -48px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.3)); }
.res-face .disc-svg { width: 74px; height: 74px; animation: bounce 1.1s ease-in-out infinite; } .res-face .disc-svg + .disc-svg { animation-delay: .2s; }
@keyframes bounce { 50% { transform: translateY(-8px) rotate(4deg); } }
.result-p .card { margin-top: 40px; overflow: visible; max-height: none; }
.result-p.win h2, .result-p.p1 h2, .result-p.p2 h2 { color: var(--accent); }
.result-p.lose h2 { color: #ffb0b0; }
.streak-line { margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: #ffb23c; font-weight: 700; } .streak-line svg { width: 22px; height: 22px; }
.streak-line.best { animation: bump .5s 2; }
@keyframes bump { 40% { transform: scale(1.12); } }
.result-p .row .btn { flex: 1 1 0; min-width: 0; padding-left: .6em; padding-right: .6em; font-size: 1rem; } .result-p .row { flex-wrap: nowrap; }
.land .result-p { align-items: flex-end; justify-content: center; padding-right: calc(14px + var(--safe-r)); }
.land .result-p .card { width: min(340px, 40vw); }
.helpad .help-ico svg { width: 64px; height: 64px; color: var(--accent); }

/* estadísticas y fichas */
.stats { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.stats h3 { margin: 6px 0 0; font-size: 1.05rem; } .stats h3 small { color: var(--muted); font-weight: 600; }
.stats table { width: 100%; border-collapse: collapse; font-weight: 600; }
.stats th, .stats td { padding: 6px 6px; text-align: center; border-bottom: 1px solid var(--line); } .stats th:first-child { text-align: left; display: flex; align-items: center; gap: 8px; }
.stats tr:first-child th { color: var(--muted); font-size: .8rem; }
.stats td.w { color: #7dff9a; } .stats td.l { color: #ff8a8a; }
.lvdot { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .85rem; color: #fff; flex: none; }
.streaks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.streaks > div { padding: 10px; border-radius: 16px; background: rgba(255,255,255,.07); text-align: center; } .streaks small { display: block; color: var(--muted); font-weight: 600; }
.streaks b { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 1.8rem; color: #ffb23c; } .streaks svg { width: 26px; height: 26px; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.theme { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px 10px; border-radius: 18px; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03)); box-shadow: inset 0 0 0 2px var(--line); }
.theme .pair { display: flex; padding: 8px 10px; border-radius: 14px; background: var(--b); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); } .theme .pair .disc-svg { width: 44px; height: 44px; } .theme .pair .disc-svg + .disc-svg { margin-left: -6px; }
.theme b { font-size: 1.05rem; } .theme small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; font-size: .8rem; } .theme small svg { width: 14px; height: 14px; }
.theme.on { box-shadow: inset 0 0 0 3px var(--accent); background: rgba(255,210,63,.14); } .theme.on small { color: var(--accent); }
.theme.locked { filter: grayscale(.9) brightness(.7); }

/* ajustes, cómo se juega, ranking */
.settings { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 14px; background: rgba(255,255,255,.06); font-weight: 600; }
.setting select, .setting input { font-family: inherit; font-size: 1rem; font-weight: 600; padding: 7px 10px; border-radius: 10px; border: 0; background: #0d2238; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); max-width: 55%; }
.tog { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; background: rgba(0,0,0,.3); font-weight: 700; min-width: 74px; }
.tog i { width: 26px; height: 26px; border-radius: 50%; background: #5a6b7d; transition: .2s; }
.tog.on i { background: var(--mint); transform: translateX(2px); }
.links { margin-top: 6px; }
.howto-body { text-align: left; }
.howto-body .t1 { font-size: 1.35rem; font-weight: 700; margin: 0 0 .4em; color: var(--accent); }
.howto-body h2 { font-size: 1.15rem; margin: 1em 0 .3em; }
.howto-body ul { padding-left: 1.2em; margin: .3em 0; }
.howto-body li { margin: .25em 0; line-height: 1.35; }
.howto-body p { line-height: 1.4; }
.rank-list ol { list-style: none; margin: 0; padding: 0; text-align: left; counter-reset: r; }
.rank-list li { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 10px; counter-increment: r; }
.rank-list li::before { content: counter(r); width: 2em; color: var(--muted); font-weight: 700; }
.rank-list li span { flex: 1; } .rank-list li.me { background: rgba(255,210,63,.18); }
.rank-list li:nth-child(odd) { background: rgba(255,255,255,.04); }

/* anuncio de prueba */
.dev-ad { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.75); }
.dev-ad-box { width: min(340px, 90%); padding: 20px; border-radius: 20px; background: #111; color: #fff; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.dev-ad-tag { font-size: .8rem; color: #aaa; }
.dev-ad-art { width: 100%; aspect-ratio: 16/9; border-radius: 12px; display: grid; place-items: center; background: repeating-linear-gradient(45deg, #333 0 12px, #2a2a2a 12px 24px); font-size: 2rem; font-weight: 700; }

/* carga */
#loader { position: absolute; inset: 0; display: grid; place-items: center; z-index: 60; background: var(--bg); transition: opacity .4s; }
#loader.out { opacity: 0; pointer-events: none; }
.loader-disc { width: 64px; height: 64px; border-radius: 50%; border: 8px solid rgba(255,71,87,.25); border-top-color: #ff4757; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.noscript { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; }
.howto-src { display: none; }

/* pantallas bajas (móvil en horizontal) */
@media (max-height: 520px) {
  .logo .l4 { font-size: 4.2rem; } .logo .l2 { font-size: 2.2rem; } .logo p { font-size: .9rem; }
  .title-screen { align-items: flex-start; justify-content: center; gap: 10px; padding-left: calc(24px + var(--safe-l)); }
  .title-screen .logo { margin-top: 0; }
  .btn.big { min-height: 50px; font-size: 1.15rem; }
  .title-bottom { gap: 8px; }
  .card { padding: 14px; gap: 10px; } .card h2 { font-size: 1.5rem; }
  .lvl { padding: 4px 10px 4px 6px; } .lvl .num { width: 36px; height: 36px; font-size: 1.2rem; } .levels { gap: 5px; }
  .settings { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .setting { padding: 4px 8px; } .settings .links { grid-column: 1 / -1; }
  .card .b-close { position: sticky; bottom: 0; }
  .settings-p .card, .levels-p .card, .stats-p .card { width: min(720px, 100%); }
  .levels-p .levels { display: grid; grid-template-columns: 1fr 1fr; } .levels-p .lvl:last-child { grid-column: 1 / -1; }
  .res-face { margin-top: -30px; } .res-face .disc-svg { width: 54px; height: 54px; }
  .hbtn { min-height: 50px; font-size: 1rem; }
}
@media (min-height: 521px) and (max-aspect-ratio: 1/1) { .title-screen .logo { margin-top: 4vh; } }
@media (prefers-reduced-motion: reduce) { .res-face .disc-svg, .chip .dots i { animation: none; } }

/* fichas.py: ficha del juego bajo la pantalla de juego (visible al desplazarse; al jugar la página vuelve arriba y no se mueve) */
html, body { height: auto !important; min-height: 100%; overflow-x: hidden !important; overflow-y: auto !important; }
html:has(body.playing), body.playing { overflow: hidden !important; }
body:not(.playing) { touch-action: pan-y; }
body:not(.playing) #wrap, body:not(.playing) #app, body:not(.playing) #app canvas, body:not(.playing) #app .screen { touch-action: pan-y !important; }   /* fuera de la partida se puede bajar a la ficha deslizando sobre el juego */
#wrap, #app { position: relative !important; inset: auto !important; width: 100% !important; height: 100vh !important; height: 100dvh !important; }
.game-info { max-width: 860px; margin: 0 auto; padding: 26px 18px 40px; font-family: Fredoka, ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif; color: #f4f0ff; line-height: 1.55; user-select: text; -webkit-user-select: text; }
.game-info .crumbs { font-size: .92rem; color: #b9b0d8; margin-bottom: 10px; } .game-info .crumbs a { color: #b9b0d8; } .game-info .crumbs span { margin: 0 6px; opacity: .6; }
.game-info .howto-src { display: block; } .game-info .howto { background: none; color: inherit; padding: 0; border-radius: 0; box-shadow: none; border: 0; }
.game-info h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); line-height: 1.15; margin: 0 0 10px; color: #fff; }
.game-info h2 { font-size: 1.3rem; margin: 26px 0 8px; color: #ffd23f; }
.game-info p, .game-info li { color: #e8e2fa; } .game-info ul { padding-left: 1.2em; } .game-info a { color: #ffd23f; }
.game-info details { margin: 8px 0; padding: 12px 16px; border-radius: 14px; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1.5px rgba(190,160,255,.22); }
.game-info summary { cursor: pointer; font-weight: 600; } .game-info details p { margin: 6px 0 0; }
.game-info .more { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.game-info .more a { display: block; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1.5px rgba(190,160,255,.22); text-decoration: none; color: #fff; }
.game-info .more img { display: block; width: 100%; height: auto; aspect-ratio: 40 / 21; object-fit: cover; } .game-info .more b { display: block; padding: 8px 10px 0; } .game-info .more span { display: block; padding: 0 10px 10px; font-size: .88rem; color: #c9c0e6; }
.game-info .foot { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 34px; padding-top: 16px; border-top: 1px solid rgba(190,160,255,.22); font-size: .92rem; } .game-info .foot a { color: #b9b0d8; }
.howto .t1 { font-size: 1.25rem; font-weight: 700; margin: .67em 0; }
