/* Minijuegos · base. © 2026 Extun. Todos los derechos reservados. */
:root {
  --paper: #f2f5f8;
  --sheet: #fbfcfd;
  --grid: #dbe4ee;
  --line: #bccadb;
  --ink: #16213a;
  --ink-soft: #566580;
  --ink-faint: #8b97ac;
  --margin: #d9473f;
  --pen: #2349c9;
  --hl: #ffe14d;
  --ok: #1d8556;
  --ok-bg: #dff3e8;
  --bad: #c33a32;
  --bad-bg: #fbe4e1;
  --warn-bg: #fff3c4;
  --pen-margen: #d9473f;
  --pen-boli: #2349c9;
  --pen-verde: #1d8556;
  --pen-naranja: #e0701a;
  --pen-lila: #7a4fd0;
  --pen-teal: #0e8a96;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --hand: 'Kalam', 'Segoe Print', 'Bradley Hand', cursive;
  --r: 10px;
  --gap: 16px;
  --vh: 100dvh;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: var(--vh);
  font: 400 16px/1.5 var(--font); color: var(--ink); background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px; background-position: -1px -1px;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--hand); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--pen); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1 1 auto; min-width: 0; }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

/* estructura general */
.shell { min-height: 100vh; min-height: var(--vh); display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 12px clamp(14px, 3vw, 32px); }
.brand { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--hand); font-weight: 700; font-size: 26px; line-height: 1; }
.brand .mk { background: linear-gradient(transparent 58%, var(--hl) 58% 92%, transparent 92%); padding: 0 4px; }
.top .sp { flex: 1; }
.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px clamp(14px, 3vw, 32px) 28px; }
.foot { padding: 18px clamp(14px, 3vw, 32px) calc(18px + env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--ink-soft); background: linear-gradient(transparent, var(--paper) 40%); }
.foot b { color: var(--ink); font-weight: 600; }
.foot .sep { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--line); margin: 0 8px; vertical-align: middle; }

/* hoja de cuaderno */
.sheet { position: relative; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px 22px 22px; box-shadow: 0 1px 0 rgba(22,33,58,.04), 0 10px 24px -18px rgba(22,33,58,.35); }
.sheet.ruled { padding-left: 62px; }
.sheet.ruled::before { content: ''; position: absolute; left: 44px; top: 0; bottom: 0; width: 2px; background: var(--margin); opacity: .75; }
.sheet h2 { font-size: 26px; margin-bottom: 10px; }
.sheet h3 { font-size: 21px; margin-bottom: 8px; }
.note { font-size: 14px; color: var(--ink-soft); }

/* botones */
.btn { --c: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: 9px; border: 1.5px solid var(--c); background: var(--c); color: #fff; font-weight: 600; text-decoration: none; transition: transform .08s, background .15s, color .15s; user-select: none; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--c); }
.btn.ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--c) 9%, transparent); }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: 14px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.pen { --c: var(--game, var(--pen)); }
.btn.danger { --c: var(--bad); }
.iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; border: 1.5px solid transparent; background: transparent; color: var(--ink-soft); }
.iconbtn:hover { background: rgba(22,33,58,.07); color: var(--ink); }
.iconbtn.sm { width: 32px; height: 32px; }

/* formularios */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .lab { font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.input { width: 100%; min-height: 46px; padding: 8px 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 9px; transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--game, var(--pen)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--game, var(--pen)) 18%, transparent); }
.input::placeholder { color: var(--ink-faint); }
.input:disabled { background: #eef2f6; color: var(--ink-soft); }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-family: var(--hand); font-size: 24px; text-align: center; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; overflow: hidden; }
.stepper button { width: 38px; height: 38px; border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--ink); }
.stepper button:hover:not(:disabled) { background: #eef2f6; }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 54px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.switch { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .tr { width: 42px; height: 24px; flex: none; border-radius: 12px; background: var(--line); position: relative; transition: background .15s; }
.switch .tr::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .tr { background: var(--game, var(--pen)); }
.switch input:checked + .tr::after { transform: translateX(18px); }
.switch input:focus-visible + .tr { outline: 3px solid var(--pen); outline-offset: 2px; }
.switch input:disabled + .tr { opacity: .5; }
.switch small { display: block; color: var(--ink-soft); font-size: 13px; line-height: 1.3; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 14px; font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--game, var(--ink)); color: #fff; }
.seg button:disabled { cursor: not-allowed; opacity: .6; }

/* avatares: resaltador con la inicial */
.av { --s: 36px; display: inline-grid; place-items: center; width: var(--s); height: var(--s); flex: none; border-radius: 42% 58% 55% 45% / 55% 45% 58% 42%; font-family: var(--hand); font-weight: 700; font-size: calc(var(--s) * .52); line-height: 1; color: var(--ink); background: var(--hl); text-transform: uppercase; }
.av.c0 { background: #ffe14d; } .av.c1 { background: #ff9ecb; } .av.c2 { background: #8ee3a3; } .av.c3 { background: #8cd3ff; }
.av.c4 { background: #ffb26b; } .av.c5 { background: #c9a8ff; } .av.c6 { background: #ff8f8f; } .av.c7 { background: #7fe8d6; }
.av.c8 { background: #d9f26b; } .av.c9 { background: #ffd1a1; } .av.c10 { background: #a9b8ff; } .av.c11 { background: #f5a3e8; }
.av.off { opacity: .45; filter: grayscale(.6); }
.picker { display: flex; flex-wrap: wrap; gap: 8px; }
.picker button { border: 2px solid transparent; border-radius: 50%; padding: 2px; background: none; }
.picker button[aria-checked="true"] { border-color: var(--ink); }

/* avisos */
#toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 15px; box-shadow: 0 8px 24px -8px rgba(0,0,0,.4); animation: toast-in .18s ease-out; }
.toast.bad { background: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(22,33,58,.45); display: grid; place-items: center; padding: 16px; }
.modal { width: min(440px, 100%); background: var(--sheet); border-radius: 14px; padding: 22px; box-shadow: 0 20px 50px -10px rgba(0,0,0,.4); }
.modal h3 { font-size: 24px; margin-bottom: 8px; }
.modal .acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
@media (max-width: 560px) { .sheet { padding: 16px; } .sheet.ruled { padding-left: 46px; } .sheet.ruled::before { left: 30px; } .brand { font-size: 23px; } }

@media (max-width: 560px) { .top { gap: 8px; } .brand .muted { display: none; } .top .btn.sm { padding: 4px 10px; } .codechip { font-size: 17px; letter-spacing: .12em; padding-left: 8px; } }
@media (max-width: 560px) { .top { flex-wrap: wrap; } .top .sp { display: none; } .top .brand { margin-right: auto; } }
@media (max-width: 560px) { .top .btn .lbl { display: none; } .top .btn.sm { padding: 4px 9px; } }
