/* Sudoku Zen: estilos (tema claro y oscuro con variables). */
:root {
  --bg: #f3efe6; --bg2: #e3ece6; --surface: #ffffff; --surface2: #f7f5f0; --ink: #1e2a3a; --muted: #6b7686; --line: #d3d9df; --line-strong: #3a4757;
  --given: #1e2a3a; --user: #2e6bd8; --accent: #2fa38a; --accent2: #1f8a73; --accent-soft: #d6efe7; --sel: #b9e3d6; --peer: #edf3f0; --same: #9fd6c6;
  --wrong: #e0474c; --wrong-bg: #fde3e3; --gold: #ffb020; --gold2: #f08a1c; --coral: #ff7a59; --hint-bg: #fff3d1; --note: #5d6b7b;
  --shadow: 0 10px 30px rgba(30,42,58,.12); --veil: rgba(243,239,230,.6);
  --logo-tile: #ffffff; --logo-line: #c9d1d9; --logo-ink: #1e2a3a; --logo-acc: #2e6bd8;
  --font: 'Fredoka', 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);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #10151c; --bg2: #16202a; --surface: #1b232d; --surface2: #222c37; --ink: #e8eef5; --muted: #93a1b2; --line: #2e3945; --line-strong: #8a99ab;
  --given: #e8eef5; --user: #7fb0ff; --accent: #3cc3a3; --accent2: #27a487; --accent-soft: #1d3d36; --sel: #245a4d; --peer: #1f2a33; --same: #2f6a5b;
  --wrong: #ff6b70; --wrong-bg: #45232a; --gold: #ffc13d; --gold2: #f59f2a; --hint-bg: #4a3b16; --note: #a8b5c4;
  --shadow: 0 10px 30px rgba(0,0,0,.4); --veil: rgba(16,21,28,.55);
  --logo-tile: #222c37; --logo-line: #3a4757; --logo-ink: #e8eef5; --logo-acc: #7fb0ff;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); 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; touch-action: manipulation; transition: background .4s;
  background: radial-gradient(1200px 700px at 110% -10%, var(--bg2), transparent 60%), radial-gradient(900px 600px at -20% 110%, var(--bg2), transparent 60%), var(--bg); }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; padding: 0; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
a { color: var(--accent); }

/* ---------- botones ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: 52px; padding: .45em 1.3em; border-radius: 18px; font-size: 1.1rem; font-weight: 600; color: #fff; text-decoration: none;
  background: linear-gradient(180deg, #4cc3a8, var(--accent) 60%, var(--accent2)); box-shadow: 0 4px 0 #17725f, 0 10px 20px rgba(31,138,115,.25), inset 0 2px 0 rgba(255,255,255,.35); transition: transform .08s, box-shadow .08s, filter .15s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #17725f, inset 0 2px 0 rgba(255,255,255,.35); }
.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; text-align: left; }
.btn small { font-size: .66em; font-weight: 500; opacity: .9; margin-top: .2em; }
.btn.mint { color: #3a2300; background: linear-gradient(180deg, #ffe08a, var(--gold) 60%, var(--gold2)); box-shadow: 0 4px 0 #b86a0c, 0 10px 20px rgba(240,138,28,.22), inset 0 2px 0 rgba(255,255,255,.5); }
.btn.mint:active { box-shadow: 0 1px 0 #b86a0c, inset 0 2px 0 rgba(255,255,255,.5); }
.btn.ghost { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 2px var(--line), 0 4px 12px rgba(0,0,0,.05); }
.btn.ghost:active { transform: translateY(2px); }
.btn.big { min-height: 62px; font-size: 1.32rem; padding: .4em 1.4em; border-radius: 22px; }
.btn.small { min-height: 42px; font-size: .95rem; padding: .3em .95em; border-radius: 13px; }
.btn[disabled] { filter: grayscale(.6) brightness(.9); pointer-events: none; }
.icon-btn { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 2px var(--line), 0 4px 12px rgba(0,0,0,.05); flex: none; }
.icon-btn svg { width: 24px; height: 24px; }
.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; }

/* ---------- 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(.985); } }
@keyframes out { to { opacity: 0; transform: scale(.985); } }
.overlay { justify-content: center; background: var(--veil); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.card { width: min(430px, 100%); max-height: 100%; overflow: auto; padding: 22px 20px; border-radius: 26px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line), var(--shadow); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.card h2 { margin: 0; font-size: 1.8rem; line-height: 1.1; font-weight: 600; }
.card .sub { margin: 0; color: var(--muted); font-size: 1rem; }
.card.scroll { max-height: min(88vh, 760px); }

/* portada */
.title-screen { justify-content: center; gap: clamp(18px, 5vh, 46px); }
.logo { text-align: center; display: flex; flex-direction: column; align-items: center; }
.logo .mark { width: clamp(84px, 14vh, 128px); height: auto; color: var(--accent); filter: drop-shadow(0 8px 14px rgba(47,163,138,.25)); animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04) rotate(-2deg); } }
.logo .h1 { display: flex; align-items: baseline; gap: .22em; line-height: 1; font-weight: 600; margin-top: .25em; }
.logo .l1 { font-size: clamp(2.8rem, 12vw, 4.6rem); color: var(--ink); letter-spacing: -.01em; }
.logo .l2 { font-size: clamp(2.8rem, 12vw, 4.6rem); color: var(--accent); }
.logo p { margin: .55em 0 0; color: var(--muted); font-weight: 500; font-size: 1.08rem; letter-spacing: .02em; }
.title-bottom { display: flex; flex-direction: column; gap: 14px; align-items: stretch; width: min(360px, 100%); }
.title-bottom .btn.big { justify-content: flex-start; }
.title-bottom .row { margin-top: 4px; }
.b-daily .flame { margin-left: auto; display: flex; align-items: center; gap: 2px; font-style: normal; font-weight: 700; font-size: 1.05rem; color: #b8460c; }
.b-daily .flame svg { width: 22px; height: 22px; color: #e8590c; }
.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: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.portal-link svg { width: 26px; height: 26px; }

/* elegir dificultad */
.diffs { display: flex; flex-direction: column; gap: 8px; }
.diff { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 10px 14px; border-radius: 16px; background: var(--surface2); box-shadow: inset 0 0 0 1.5px var(--line); transition: transform .1s, box-shadow .15s; }
.diff:active { transform: scale(.98); }
.diff.last { box-shadow: inset 0 0 0 2.5px var(--accent); }
.diff .dots { grid-row: 1 / 3; display: flex; gap: 3px; }
.diff .dots i { width: 7px; height: 22px; border-radius: 4px; background: var(--line); }
.diff .dots i.on { background: var(--accent); }
.diff.d3 .dots i.on { background: var(--gold2); } .diff.d4 .dots i.on { background: var(--coral); }
.diff b { font-size: 1.15rem; font-weight: 600; }
.diff small { grid-column: 2; color: var(--muted); font-size: .86rem; line-height: 1.2; }
.diff em { grid-row: 1 / 3; grid-column: 3; font-style: normal; font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }

/* ---------- partida ---------- */
#game { position: absolute; inset: 0; display: grid; justify-content: center; align-content: center; row-gap: 12px; padding: calc(8px + var(--safe-t)) calc(8px + var(--safe-r)) calc(8px + var(--safe-b)) calc(8px + var(--safe-l));
  grid-template-columns: var(--bs, 360px); grid-template-areas: "top" "board" "controls"; }
#game.land { grid-template-columns: var(--bs, 360px) var(--cw, 360px); grid-template-rows: auto auto; grid-template-areas: "board top" "board controls"; column-gap: 28px; row-gap: 14px; align-content: center; align-items: start; }
#game.land .board-wrap { align-self: center; }
#game.land .topbar { align-self: end; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 10px; height: 50px; }
.topbar .info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.topbar .diffname { font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .errs { font-size: .88rem; color: var(--muted); font-weight: 500; }
.topbar .errs.bad { color: var(--wrong); font-weight: 600; }
.timer { font-variant-numeric: tabular-nums; font-size: 1.2rem; font-weight: 600; padding: 6px 12px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); min-width: 74px; text-align: center; }
.board-wrap { grid-area: board; position: relative; width: var(--bs, 360px); height: var(--bs, 360px); }
.board { --cs: calc(var(--bs, 360px) / 9); width: 100%; height: 100%; display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr); background: var(--surface); border-radius: 14px; overflow: hidden;
  box-shadow: 0 0 0 2.5px var(--line-strong), var(--shadow); transition: filter .3s; }
.cell { position: relative; display: grid; place-items: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); transition: background-color .15s; min-width: 0; min-height: 0; }
.cell.c2, .cell.c5 { border-right: 2.5px solid var(--line-strong); }
.cell.r2, .cell.r5 { border-bottom: 2.5px solid var(--line-strong); }
.cell.c8 { border-right: 0; } .cell.r8 { border-bottom: 0; }
.cell .v { font-size: calc(var(--cs) * .6); font-weight: 500; line-height: 1; color: var(--user); pointer-events: none; }
.cell.given .v { color: var(--given); font-weight: 600; }
.cell .ns { position: absolute; inset: 6%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); pointer-events: none; }
.cell .ns i { font-style: normal; font-size: calc(var(--cs) * .24); line-height: 1; display: grid; place-items: center; color: var(--note); font-weight: 600; visibility: hidden; border-radius: 4px; }
.cell .ns i.on { visibility: visible; }
.cell .ns i.hl { background: var(--accent); color: #fff; }
.cell.peer { background: var(--peer); }
.cell.same { background: var(--same); }
.cell.hunit { background: var(--hint-bg); }
.cell.sel { background: var(--sel); }
.cell.wrong { background: var(--wrong-bg); }
.cell.wrong .v, .cell.conflict .v { color: var(--wrong); }
.cell.conflict-g { background: var(--wrong-bg); }
.cell.hsrc { box-shadow: inset 0 0 0 2.5px var(--coral); }
.cell.hint { box-shadow: inset 0 0 0 3px var(--gold); animation: hintpulse 1.2s ease-in-out infinite; z-index: 1; }
@keyframes hintpulse { 50% { box-shadow: inset 0 0 0 5px var(--gold); } }
.cell.pop .v { animation: pop .42s cubic-bezier(.3,1.7,.5,1); }
@keyframes pop { from { transform: scale(.4); opacity: .3; } }
.cell.shake { animation: shake .45s; }
@keyframes shake { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.cell.nudge .v { animation: nudge .3s; }
@keyframes nudge { 30% { transform: translateX(-2px); } 70% { transform: translateX(2px); } }
.cell.wave { animation: wave .7s ease-out; }
@keyframes wave { 0% { background-color: var(--accent-soft); } 30% { background-color: var(--same); box-shadow: inset 0 0 0 2px var(--accent); } 100% { } }
.cell.wave .v { animation: wavev .7s ease-out; }
@keyframes wavev { 30% { transform: scale(1.18); } }
.paused-veil { position: absolute; inset: 0; display: none; place-items: center; z-index: 3; border-radius: 14px; }
#game.paused .board { filter: blur(12px) saturate(.6); }
#game.paused .paused-veil { display: grid; }
#game.paused .controls { opacity: .4; pointer-events: none; }

/* controles */
.controls { grid-area: controls; position: relative; display: flex; flex-direction: column; gap: 10px; transition: opacity .2s; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; height: 62px; }
.tool { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); font-size: .78rem; font-weight: 600; transition: transform .08s, background .15s; }
.tool svg { width: 25px; height: 25px; }
.tool:active { transform: scale(.95); }
.tool.off { opacity: .45; }
.tool.on { background: var(--accent); color: #fff; box-shadow: none; }
.tool .tg { position: absolute; top: 5px; right: 7px; font-style: normal; font-size: .62rem; font-weight: 700; padding: 1px 5px; border-radius: 99px; background: var(--line); color: var(--ink); }
.tool.on .tg { background: #fff; color: var(--accent2); }
.tool .badge { position: absolute; top: 4px; right: 6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; display: grid; place-items: center; font-style: normal; font-size: .72rem; font-weight: 700; background: var(--gold); color: #3a2300; }
.tool .badge.ad { background: var(--coral); color: #fff; font-size: .62rem; }
.tool .badge.zero { background: var(--line); color: var(--muted); }
.pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; height: var(--keyh, 64px); }
.key { position: relative; display: grid; place-items: center; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line), 0 3px 0 var(--line); color: var(--user); transition: transform .06s, opacity .2s, background .15s; }
.key b { font-size: min(2.1rem, calc(var(--keyh, 64px) * .52)); font-weight: 500; line-height: 1; }
.key small { position: absolute; top: 4px; right: 6px; font-size: .66rem; font-weight: 600; color: var(--muted); }
.key:active { transform: translateY(2px) scale(.96); box-shadow: inset 0 0 0 1.5px var(--line); background: var(--accent-soft); }
.key.cur { box-shadow: inset 0 0 0 2.5px var(--accent), 0 3px 0 var(--line); }
.key.done { opacity: .28; }
#game.land .pad { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, var(--keyh, 64px)); height: auto; gap: 8px; }
#game.land .key b { font-size: min(2.3rem, calc(var(--keyh, 64px) * .5)); }
#game.land .tools { height: 64px; }

/* hoja de pista */
.sheet { position: absolute; left: 0; right: 0; top: 0; max-height: calc(100vh - 20px); overflow: auto; z-index: 4; padding: 14px 16px; border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--gold), 0 12px 34px rgba(0,0,0,.22); display: flex; flex-direction: column; gap: 8px; animation: sheetin .25s cubic-bezier(.2,1.2,.4,1) both; }
#game.land .sheet { top: auto; bottom: 0; }
.sheet.out { animation: out .2s both; }
@keyframes sheetin { from { transform: translateY(16px); opacity: 0; } }
.sh-head { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.sh-head svg { width: 22px; height: 22px; color: var(--gold2); flex: none; }
.sheet p { margin: 0; font-size: .98rem; line-height: 1.35; color: var(--ink); }
.sheet .row { justify-content: flex-end; }

/* ---------- efectos ---------- */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.spark { position: absolute; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--gold); animation: spark .75s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
.confetti { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }
.banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: clamp(1.8rem, 8vw, 3rem); font-weight: 600; color: var(--accent); text-align: center; white-space: nowrap; animation: banner 1.6s ease-out both; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#toasts { position: absolute; left: 0; right: 0; top: calc(66px + var(--safe-t)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 30; padding: 0 12px; }
.toast { padding: 9px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: 0 6px 16px rgba(0,0,0,.2); font-weight: 500; animation: in .25s both; max-width: min(92vw, 460px); text-align: center; }
.toast.out { animation: out .3s both; }

/* tarjetas de resultado */
.win .card h2, .record .card h2 { color: var(--accent); }
.win-time { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.win-time b { font-size: 3.2rem; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.win-time span { color: var(--muted); font-weight: 500; min-height: 1.2em; }
.win-stats { display: flex; justify-content: center; gap: 10px; }
.win-stats span { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 14px; background: var(--surface2); color: var(--muted); font-size: .85rem; }
.win-stats b { font-size: 1.4rem; color: var(--ink); display: flex; align-items: center; gap: 2px; }
.win-stats .fl svg, .stats-daily .fl svg { width: 20px; height: 20px; color: #e8590c; }
.perfect { margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; color: var(--accent2); }
.perfect svg { width: 20px; height: 20px; }
.win .row .btn, .failed .row .btn { flex: 1 1 0; min-width: 0; }

/* estadísticas */
.stats-daily { padding: 12px 14px; border-radius: 18px; background: var(--surface2); display: flex; flex-direction: column; gap: 10px; text-align: left; }
.sd-top { display: flex; align-items: center; gap: 12px; }
.sd-top .fl { display: flex; align-items: center; gap: 2px; font-size: 1.7rem; font-weight: 700; color: #e8590c; }
.sd-top .fl svg { width: 30px; height: 30px; }
.sd-top b { display: block; } .sd-top small { color: var(--muted); }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.days i { aspect-ratio: 1; border-radius: 6px; background: var(--line); }
.days i.on { background: var(--accent); }
.days i.today { box-shadow: 0 0 0 2px var(--gold); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.st { padding: 10px 12px; border-radius: 16px; background: var(--surface2); }
.st b { font-weight: 600; }
.st dl { margin: 6px 0 0; display: grid; grid-template-columns: auto auto; gap: 2px 8px; font-size: .85rem; }
.st dt { color: var(--muted); } .st dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.st.d4 { grid-column: 1 / -1; }

/* ajustes, cómo se juega */
.settings { display: flex; flex-direction: column; gap: 7px; text-align: left; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 12px; border-radius: 14px; background: var(--surface2); font-weight: 500; }
.setting select { font-family: inherit; font-size: .98rem; font-weight: 500; padding: 7px 10px; border-radius: 10px; border: 0; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); max-width: 55%; }
.tog { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; background: var(--line); font-weight: 600; min-width: 74px; }
.tog i { width: 26px; height: 26px; border-radius: 50%; background: var(--surface); transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tog.on { background: var(--accent); color: #fff; }
.settings .note { margin: 2px 4px; font-size: .82rem; color: var(--muted); line-height: 1.3; }
.links { margin-top: 6px; }
.howto-body { text-align: left; }
.howto-body .t1 { font-size: 1.3rem; font-weight: 600; margin: 0 0 .4em; color: var(--accent); }
.howto-body h2 { font-size: 1.12rem; margin: 1em 0 .3em; font-weight: 600; }
.howto-body ul { padding-left: 1.2em; margin: .3em 0; }
.howto-body li { margin: .25em 0; line-height: 1.38; }
.howto-body p { line-height: 1.42; }

/* 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; }
.dev-ad-count { font-weight: 600; }
.dev-ad .btn.ghost { color: #fff; background: rgba(255,255,255,.1); }

/* 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-dot { width: 54px; height: 54px; border-radius: 50%; border: 6px solid var(--accent-soft); border-top-color: var(--accent); 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; }

/* pantallas bajas (móvil en horizontal) */
@media (max-height: 520px) {
  .title-screen { flex-direction: row; align-items: center; justify-content: space-evenly; }
  .logo .l1, .logo .l2 { font-size: 3rem; } .logo .mark { width: 80px; }
  .btn.big { min-height: 52px; font-size: 1.15rem; }
  .title-bottom { gap: 10px; }
  .card { padding: 14px; gap: 10px; } .card h2 { font-size: 1.45rem; }
  .settings { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .setting { padding: 4px 8px; } .settings .links, .settings .note { grid-column: 1 / -1; }
  .settings-p .card, .stats-p .card, .new-p .card { width: min(720px, 100%); }
  .stats-grid { grid-template-columns: repeat(5, 1fr); } .st.d4 { grid-column: auto; } .st dl { font-size: .8rem; }
  .days i { aspect-ratio: auto; height: 14px; border-radius: 4px; } .stats-daily { padding: 8px 12px; gap: 6px; }
  .diffs { display: grid; grid-template-columns: 1fr 1fr; } .diff.d4 { grid-column: 1 / -1; }
  .card .b-close { position: sticky; bottom: 0; }
  .settings-p .card, .stats-p .card { position: relative; }
  .settings-p .card > .b-close, .stats-p .card > .b-close { position: absolute; top: 10px; right: 12px; bottom: auto; min-height: 38px; padding: .2em 1em; font-size: .95rem; border-radius: 12px; }
  .win .card { width: min(560px, 100%); }
  .topbar { height: 46px; }
  #toasts { top: calc(12px + var(--safe-t)); }
}
@media (max-width: 360px) { .tool span { font-size: .7rem; } .topbar .icon-btn { width: 42px; height: 42px; } .timer { min-width: 64px; font-size: 1.05rem; } }
@media (prefers-reduced-motion: reduce) { .logo .mark, .cell.hint { animation: none; } .cell.wave, .cell.wave .v, .cell.pop .v { animation-duration: .01s; } }

/* el texto rastreable «Cómo se juega» lo coloca y le da estilo el generador del portal */
.howto-src { display: none; }
.st dt::first-letter { text-transform: uppercase; }

/* 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; }
