/* ==========================================================================
   Cabezazo — design system
   Extracted from the mockup artifact (Design artifact, five mobile frames).
   Chunky dark borders, hard offset shadows, cream ground, Fredoka + DM Sans.
   ========================================================================== */

:root {
  /* Core palette — from the brief, confirmed against the rendered mockup */
  --cream: #FFF7EC;
  --ink: #221A33;
  --yellow: #FFD24C;
  --blue: #3B6FE0;

  /* Tints used for category cards, zone banners, podium places */
  --pale-blue: #DCE6FB;
  --pale-yellow: #FBEFC0;
  --pale-green: #DCF0DC;
  --pale-pink: #FADFE0;
  --red: #E0574E;
  --green: #3E9B57;

  --paper: #FFFFFF;
  --muted: #7A7186;
  --track: #F0E6D7;
  --locked: #BDB4C6;

  /* Shape language — the two numbers that define the whole look */
  --bw: 2.5px;                       /* border width */
  --shadow: 5px 5px 0 var(--ink);    /* hard offset shadow, no blur */
  --shadow-sm: 3px 3px 0 var(--ink);

  --r-card: 20px;
  --r-tile: 14px;
  --r-pill: 999px;

  --nav-h: 74px;
  --maxw: 440px;

  --font-head: 'Fredoka', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
}

/* Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; line-height: 1.15; }
p { margin: 0; }
button { font: inherit; color: inherit; }

/* Focus: visible, and in the app's own language rather than the browser's */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Shell ------------------------------------------------------------------ */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* On desktop the app sits in a centred column with the chunky frame around it,
   echoing the phone frames in the mockup. */
@media (min-width: 560px) {
  body { background: var(--track); padding: 24px 0; }
  .app {
    background: var(--cream);
    border: var(--bw) solid var(--ink);
    border-radius: 32px;
    box-shadow: 8px 8px 0 var(--ink);
    min-height: min(880px, calc(100dvh - 48px));
    overflow: hidden;
  }
}

.screen {
  flex: 1;
  padding: 20px 18px calc(var(--nav-h) + 28px);
  animation: fade .18s ease-out;
}
.screen.no-nav { padding-bottom: 28px; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Boot placeholder ------------------------------------------------------- */
.boot {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  color: var(--muted);
}
.boot-ball {
  width: 46px; height: 46px; border-radius: 50%;
  border: var(--bw) solid var(--ink); background: var(--paper);
  animation: bounce .9s ease-in-out infinite;
}
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* Typography helpers ----------------------------------------------------- */
.eyebrow {
  font-family: var(--font-body);
  font-size: 11px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
}
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

/* Cards ------------------------------------------------------------------ */
.card {
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-card);
  padding: 16px;
}
.card.raised { box-shadow: var(--shadow); }
.card.cream { background: var(--cream); }

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-head); font-weight: 600; font-size: 16px;
  padding: 12px 20px;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-pill);
  background: var(--paper);
  cursor: pointer;
  text-decoration: none;
  transition: transform .06s ease, box-shadow .06s ease;
  box-shadow: var(--shadow-sm);
}
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { cursor: not-allowed; background: var(--locked); color: #fff; box-shadow: none; border-color: var(--locked); }

.btn-primary { background: var(--blue); color: #fff; }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--yellow); }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 15px 24px; font-size: 18px; border-radius: var(--r-card); }

/* Round icon button, e.g. the back arrow */
.btn-round {
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  box-shadow: none; flex: 0 0 auto; background: var(--paper);
}

/* Pills ------------------------------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-head); font-weight: 600; font-size: 13px;
  padding: 6px 13px; border-radius: var(--r-pill);
  border: var(--bw) solid var(--ink); background: var(--paper);
  white-space: nowrap;
}
.pill-yellow { background: var(--yellow); }
.pill-pale-yellow { background: var(--pale-yellow); }
.pill-pink { background: var(--pale-pink); border-color: transparent; }
.pill-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill-sm { font-size: 11px; padding: 4px 10px; letter-spacing: .06em; text-transform: uppercase; }

/* Header row ------------------------------------------------------------- */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.topbar h1 { font-size: 26px; font-weight: 700; }
.topbar .spacer { flex: 1; }

/* Mascot ----------------------------------------------------------------- */
.mascot {
  width: 44px; height: 44px; flex: 0 0 auto;
  border: var(--bw) solid var(--ink); border-radius: 50%;
  background: var(--paper);
  display: grid; place-items: center;
}
.mascot svg { width: 30px; height: 30px; display: block; }

/* Forms ------------------------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label {
  display: block; margin-bottom: 7px;
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
}
.input {
  width: 100%;
  font-family: var(--font-body); font-size: 16px; /* 16px avoids iOS zoom-on-focus */
  padding: 13px 15px;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-tile);
  background: var(--paper);
  color: var(--ink);
}
.input::placeholder { color: var(--locked); }
.input.uppercase { text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-head); }
.input.err { border-color: var(--red); }

.form-msg { font-size: 13px; margin-top: -6px; margin-bottom: 14px; min-height: 18px; font-weight: 500; }
.form-msg.err { color: var(--red); }
.form-msg.ok { color: var(--green); }

/* Bottom nav ------------------------------------------------------------- */
.nav {
  position: fixed; bottom: 12px;
  left: 50%; transform: translateX(-50%);
  width: min(calc(var(--maxw) - 28px), calc(100vw - 28px));
  height: var(--nav-h);
  background: var(--ink);
  border: var(--bw) solid var(--ink);
  border-radius: 22px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  align-items: center;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@media (min-width: 560px) { .nav { position: absolute; } }

.nav button {
  background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #FFFFFF; padding: 6px 0;
  font-family: var(--font-head); font-weight: 600; font-size: 11px;
}
.nav button svg { width: 22px; height: 22px; }
.nav button[aria-current="page"] { color: var(--yellow); }

/* Category grid ---------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat {
  display: flex; align-items: center; gap: 9px;
  padding: 14px 13px;
  border: var(--bw) solid var(--ink); border-radius: var(--r-tile);
  font-family: var(--font-head); font-weight: 600; font-size: 15px;
  cursor: pointer; text-align: left; width: 100%;
}
.cat svg { width: 19px; height: 19px; flex: 0 0 auto; }
.cat-logica { background: var(--pale-blue); }
.cat-palabras { background: var(--pale-yellow); }
.cat-numeros { background: var(--pale-green); }
.cat-stats { background: var(--pale-pink); }

/* Progress bar ----------------------------------------------------------- */
.bar {
  height: 15px; border: var(--bw) solid var(--ink); border-radius: var(--r-pill);
  background: var(--cream); overflow: hidden;
}
.bar > i { display: block; height: 100%; background: var(--yellow); border-radius: inherit; transition: width .3s ease; }

/* Hero (Reto del dia on Inicio) ------------------------------------------ */
.hero {
  background: var(--blue); color: #fff;
  border: var(--bw) solid var(--ink); border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px;
}
.hero h2 { font-size: 25px; font-weight: 700; margin: 12px 0 8px; }
.hero .badges { display: flex; gap: 8px; flex-wrap: wrap; }
.hero .lede { font-size: 14px; opacity: .95; }
.hero .foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.hero .countdown { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; }
.hero .countdown svg { width: 15px; height: 15px; }

/* Toast ------------------------------------------------------------------ */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px);
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  border-radius: var(--r-pill); padding: 11px 20px;
  font-size: 14px; font-weight: 500;
  z-index: 60; max-width: 90vw; text-align: center;
  animation: fade .2s ease-out;
}
.toast.err { background: var(--red); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   Puzzle screens (Stage B)
   Same shape language as everything else: 2.5px ink borders, 5px hard shadow
   on anything that is meant to look pressable.
   ========================================================================== */

.puz-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.puz-head .titles { flex: 1; min-width: 0; }
.puz-head h2 { font-size: 21px; margin-top: 2px; }
.puz-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.puz-instr { font-size: 14px; color: var(--muted); margin-bottom: 16px; }

.timer { font-variant-numeric: tabular-nums; }

/* Mistake dots — filled red as they are spent. */
.dots { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.dots i {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--paper); display: block;
}
.dots i.spent { background: var(--red); }

.puz-actions { display: flex; gap: 10px; margin-top: 18px; }
.puz-actions .btn { flex: 1; }

/* --- Lógica -------------------------------------------------------------- */
.clues { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 9px; }
.clues li {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--paper); border: var(--bw) solid var(--ink);
  border-radius: var(--r-tile); padding: 11px 13px; font-size: 14.5px;
}
.clues b {
  font-family: var(--font-head); background: var(--yellow);
  border: 2px solid var(--ink); border-radius: 50%;
  width: 22px; height: 22px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12px;
}
.opts { display: grid; gap: 10px; }
.opt {
  width: 100%; text-align: left; cursor: pointer;
  background: var(--paper); border: var(--bw) solid var(--ink);
  border-radius: var(--r-tile); padding: 13px 15px;
  font-family: var(--font-head); font-weight: 600; font-size: 16px;
  text-transform: capitalize;
}
.opt[aria-pressed="true"] { background: var(--pale-blue); box-shadow: var(--shadow-sm); }
.opt.wrong { background: var(--red); color: #fff; }
.opt.right { background: var(--yellow); }
.opt:disabled { cursor: default; opacity: .55; }
.opt[aria-pressed="true"]:disabled, .opt.right:disabled, .opt.wrong:disabled { opacity: 1; }

/* --- Palabras ------------------------------------------------------------ */
.pal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.pal-tile {
  min-height: 62px; padding: 4px 3px; cursor: pointer;
  background: var(--paper); border: var(--bw) solid var(--ink);
  border-radius: 11px;
  font-family: var(--font-head); font-weight: 600;
  font-size: 12px; line-height: 1.1; letter-spacing: -.2px;
  display: grid; place-items: center; text-align: center;
  word-break: break-word; hyphens: auto;
}
.pal-tile.long { font-size: 10px; }
.pal-tile[aria-pressed="true"] { background: var(--ink); color: #fff; }
.pal-tile:disabled { cursor: default; }
.pal-solved {
  border: var(--bw) solid var(--ink); border-radius: var(--r-tile);
  padding: 10px 12px; text-align: center; box-shadow: var(--shadow-sm);
}
.pal-solved .name {
  font-family: var(--font-head); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .05em;
}
.pal-solved .ws { font-size: 12.5px; font-weight: 500; margin-top: 2px; }
.bg-pale-blue { background: var(--pale-blue); }
.bg-pale-yellow { background: var(--pale-yellow); }
.bg-pale-green { background: var(--pale-green); }
.bg-pale-pink { background: var(--pale-pink); }

@keyframes shake { 0%,100%{transform:none} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
.shake { animation: shake .34s ease; }

/* --- Adivina ------------------------------------------------------------- */
.adv-board { display: grid; gap: 6px; justify-content: center; margin-bottom: 16px; }
.adv-row { display: grid; grid-template-columns: repeat(5, 54px); gap: 6px; }
.adv-cell {
  height: 54px; display: grid; place-items: center;
  border: var(--bw) solid var(--ink); border-radius: 10px;
  background: var(--paper);
  font-family: var(--font-head); font-weight: 700; font-size: 25px;
}
.adv-cell.filled { background: var(--cream); }
.adv-cell.correcta { background: var(--yellow); }
.adv-cell.presente { background: var(--pale-blue); }
.adv-cell.ausente { background: var(--locked); color: #fff; }

@media (max-width: 380px) {
  .adv-row { grid-template-columns: repeat(5, 46px); }
  .adv-cell { height: 46px; font-size: 21px; }
}

.kb { display: grid; gap: 6px; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.kb button {
  flex: 1 1 0; min-width: 0; height: 48px; padding: 0;
  border: 2px solid var(--ink); border-radius: 8px; background: var(--paper);
  font-family: var(--font-head); font-weight: 600; font-size: 15px; cursor: pointer;
}
.kb button.wide { flex: 1.7 1 0; font-size: 11px; letter-spacing: .03em; }
.kb button.correcta { background: var(--yellow); }
.kb button.presente { background: var(--pale-blue); }
.kb button.ausente { background: var(--locked); color: #fff; border-color: var(--locked); }

/* --- Números ------------------------------------------------------------- */
.num-try {
  display: flex; align-items: center; gap: 10px;
  border: var(--bw) solid var(--ink); border-radius: var(--r-tile);
  background: var(--paper); padding: 9px 12px; margin-bottom: 8px;
}
.num-digits { display: flex; gap: 5px; }
.num-digits span {
  width: 34px; height: 38px; display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 8px;
  font-family: var(--font-head); font-weight: 700; font-size: 19px;
}
.num-digits span.correcta { background: var(--yellow); }
.num-digits span.presente { background: var(--pale-blue); }
.num-digits span.ausente { background: var(--locked); color: #fff; }
.num-hint { font-size: 13px; font-weight: 700; margin-left: auto; text-align: right; }
.num-form { display: flex; gap: 9px; margin-top: 4px; }
.num-form .input { text-align: center; font-family: var(--font-head); font-size: 22px; letter-spacing: .12em; }

/* --- Result card --------------------------------------------------------- */
.result { text-align: center; padding: 22px 18px; }
.result h3 { font-size: 24px; margin-bottom: 6px; }
.result .stars { display: flex; justify-content: center; gap: 6px; margin: 12px 0; }
.result .stars svg { width: 34px; height: 34px; }
.result .stars .on { color: var(--yellow); fill: var(--yellow); }
.result .stars .off { color: var(--locked); fill: none; }
.result .pts { font-family: var(--font-head); font-weight: 700; font-size: 38px; }
.reveal {
  background: var(--cream); border: var(--bw) solid var(--ink);
  border-radius: var(--r-tile); padding: 12px 14px; margin-top: 14px; text-align: left;
}
.reveal table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.reveal th, .reveal td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--track); }
.reveal th { font-family: var(--font-head); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
