/* Rebote — Núcleo Games
   Mobile-first vertical. Tipografías libres autohospedadas (Google Fonts). */

@font-face {
  font-family: 'Big Shoulders';
  src: url('assets/fonts/big-shoulders-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: 'Big Shoulders';
  src: url('assets/fonts/big-shoulders-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Public Sans';
  src: url('assets/fonts/public-sans-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Public Sans';
  src: url('assets/fonts/public-sans-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Public Sans';
  src: url('assets/fonts/public-sans-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #1B120F;
  --bg2: #33201A;
  --ink: #FFF6E8;
  --ink-soft: rgba(255, 246, 232, 0.62);
  --rosa: #F0145A;
  --maiz: #FFC93C;
  --limon: #8BC53F;
  --naranja: #FF7A29;
  --jade: #14B8A6;
  --madera: #5A3524;
  --card: rgba(255, 246, 232, 0.06);
  --line: rgba(255, 246, 232, 0.14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Public Sans', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  height: 100dvh;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: calc(16px + var(--safe-top)) 18px calc(16px + var(--safe-bottom));
}
.screen.visible { display: flex; }

/* ------------------------------------------------------------- portada */

#screen-start {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
}

.brand {
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--ink-soft);
  font-weight: 700;
}

.logo {
  font-family: 'Big Shoulders', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(72px, 22vw, 128px);
  line-height: 0.86;
  margin: 10px 0 4px;
  letter-spacing: -0.02em;
  display: flex;
  flex-direction: column;
}
.logo-line { color: var(--ink); }
.logo-line.accent {
  color: var(--maiz);
  text-shadow: 0 0 34px rgba(255, 201, 60, 0.35);
}

.tagline {
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.5;
  margin: 6px 0 26px;
}

.how {
  list-style: none;
  padding: 0;
  margin: 30px 0 0;
  display: grid;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 300px;
}
.how li {
  padding-left: 16px;
  position: relative;
  text-align: left;
}
.how li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rosa);
}

/* -------------------------------------------------------------- botones */

.btn {
  font-family: 'Big Shoulders', system-ui, sans-serif;
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 15px 46px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.2s ease;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--rosa);
  color: #fff;
  box-shadow: 0 10px 34px rgba(240, 20, 90, 0.4);
}
.btn-ghost {
  background: transparent;
  border: 2px solid var(--line);
  color: var(--ink-soft);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.sound {
  position: fixed;
  right: max(14px, calc(50% - 262px));
  bottom: calc(14px + var(--safe-bottom));
  z-index: 20;
}
/* dentro del juego vive en la fila de objetivos, en flujo normal */
.goals-row > .sound {
  position: static;
  margin-left: auto;
  width: 34px;
  height: 34px;
  flex: none;
}
.sound .slash { opacity: 0; }
.sound.off .wave { opacity: 0.25; }
.sound.off .slash { opacity: 1; }

/* ----------------------------------------------------------------- mapa */

.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.map-head h2 {
  font-family: 'Big Shoulders', system-ui, sans-serif;
  font-weight: 800;
  font-size: 42px;
  margin: 0;
  letter-spacing: 0.01em;
}

.lives {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.lives-icons {
  color: var(--rosa);
  font-size: 15px;
  letter-spacing: 3px;
}
.lives-timer {
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  overflow-y: auto;
  padding-bottom: 60px;
  -webkit-overflow-scrolling: touch;
}

.level-card {
  display: grid;
  gap: 6px;
  padding: 16px 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.2s ease;
}
.level-card:active { transform: scale(0.97); }
.level-card.locked {
  opacity: 0.42;
  cursor: not-allowed;
}
.level-num {
  font-family: 'Big Shoulders', system-ui, sans-serif;
  font-weight: 800;
  font-size: 38px;
  line-height: 1;
  color: var(--maiz);
}
.level-name {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.3;
}
.level-stars { display: flex; align-items: center; gap: 3px; }
.star { color: rgba(255, 246, 232, 0.2); font-size: 16px; }
.star.on { color: var(--maiz); }
.lock { color: var(--ink-soft); }

/* ----------------------------------------------------------------- juego */

#screen-game { padding: calc(10px + var(--safe-top)) 12px calc(8px + var(--safe-bottom)); }

.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.hud-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}
.hud-level {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-score {
  font-family: 'Big Shoulders', system-ui, sans-serif;
  font-weight: 800;
  font-size: 40px;
  font-variant-numeric: tabular-nums;
}
.hud-side { display: flex; gap: 6px; }

.chip {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 38px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  font-family: 'Big Shoulders', system-ui, sans-serif;
  font-weight: 800;
  font-size: 22px;
}
.chip.hot {
  background: var(--maiz);
  color: #3A2408;
  border-color: transparent;
}
.chip.shots { color: var(--maiz); }
.chip.shots::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--maiz);
  margin-left: 6px;
}

.goals-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 34px;
}
.goals {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.goal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.goal.done {
  border-color: var(--limon);
  color: var(--limon);
  opacity: 0.7;
}
.goal .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.goal .dot.lit {
  background: var(--maiz);
  box-shadow: 0 0 8px var(--maiz);
}

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}
/* el tamaño real lo fija resize() en JS; aquí solo la presentación */
#game {
  border-radius: 20px;
  display: block;
  touch-action: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

/* ------------------------------------------------------------- resultado */

#screen-result {
  align-items: center;
  justify-content: center;
  background: rgba(15, 10, 8, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.result-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  padding: 34px 26px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 246, 232, 0.10), rgba(255, 246, 232, 0.04));
  border: 1px solid var(--line);
}
.result-card h2 {
  font-family: 'Big Shoulders', system-ui, sans-serif;
  font-weight: 800;
  font-size: 44px;
  margin: 0 0 12px;
  line-height: 1;
}
.stars-big { font-size: 44px; letter-spacing: 6px; margin-bottom: 12px; }
.stars-big .star { font-size: 44px; }
.result-score {
  font-family: 'Big Shoulders', system-ui, sans-serif;
  font-weight: 800;
  font-size: 56px;
  margin: 0;
  color: var(--maiz);
  font-variant-numeric: tabular-nums;
}
.result-target {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 2px 0 24px;
  font-variant-numeric: tabular-nums;
}
.result-actions { display: grid; gap: 10px; }
.result-actions .btn { width: 100%; font-size: 26px; padding: 13px 20px; }

@media (max-height: 700px) {
  .logo { font-size: clamp(58px, 18vw, 92px); }
  .how { display: none; }
  .hud-score { font-size: 32px; }
}
