:root {
  --red: #a60b0b;
  --red-dark: #8c0808;
  --title: #b01520;
  --teal: #04aaa2;
  --coral: #f24e3d;
  --yellow: #fdb62e;
  --green: #8bc84f;
  --ink: #3b4543;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: Montserrat, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--red);
  color: #fff;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ───────── Cabecera ───────── */
.top {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px clamp(12px, 3vw, 36px) 0;
  min-height: clamp(76px, 12vw, 150px);
  position: relative;
  z-index: 2;
}
.top .logo { height: clamp(40px, 7vw, 92px); width: auto; flex: none; }
.top h1 {
  margin: 0;
  flex: 1;
  text-align: center;
  color: var(--title);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: clamp(1.05rem, 4.6vw, 3.3rem);
  line-height: 1.05;
}
.top .cane { height: clamp(48px, 9vw, 130px); width: auto; flex: none; margin-top: -4px; }

.drip {
  height: clamp(36px, 7vw, 100px);
  margin-top: -1px;
  background: url('/assets/drip.svg') center top / 100% 100% no-repeat;
  position: relative;
  z-index: 1;
  flex: none;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(14px, 4vw, 40px) 56px;
  position: relative;
  z-index: 3;
}

/* franja de bastón de caramelo al pie */
body::after {
  content: '';
  height: 14px;
  flex: none;
  background: repeating-linear-gradient(115deg, #fff 0 10px, #d4262c 10px 14px, #fff 14px 24px, #6aa92f 24px 28px);
}

.hidden { display: none !important; }

/* ───────── Tarjetas / formularios ───────── */
.card {
  background: #fff;
  color: var(--ink);
  border-radius: 22px;
  padding: clamp(20px, 4vw, 36px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.card h2 { margin: 0 0 6px; color: var(--title); font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 800; }
.card p.sub { margin: 0 0 18px; color: #6a7472; }

.center-wrap { max-width: 520px; margin: clamp(0px, 3vh, 28px) auto 0; }

label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; color: var(--ink); }
input[type='text'], input[type='password'], input[type='number'] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid #e3e6e5;
  font: inherit;
  font-size: 1.1rem;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(4, 170, 162, 0.18); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 14px 26px;
  border: 0;
  border-radius: 12px;
  background: var(--yellow);
  color: #7a1010;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; margin-top: 16px; }
.btn.green { background: var(--green); color: #1d3a05; }
.btn.red { background: var(--coral); color: #fff; }
.btn.ghost { background: #eef0ef; color: var(--ink); }
.btn.small { padding: 8px 14px; font-size: 0.85rem; border-radius: 9px; box-shadow: none; }

.error { color: #c0261b; font-weight: 700; margin-top: 12px; min-height: 1.2em; }

/* ───────── Pregunta ───────── */
.q-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-top: 6px; }
.q-head h2 { margin: 0; font-size: clamp(1.6rem, 5.5vw, 3rem); font-weight: 800; letter-spacing: 0.01em; }
.q-head .clue { margin: 4px 0 0; font-size: clamp(0.9rem, 2.4vw, 1.2rem); font-weight: 500; opacity: 0.95; max-width: 60ch; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}
.chip b { font-weight: 800; }

.timer {
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  margin: 16px 0 0;
  overflow: hidden;
}
.timer > i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: background 0.3s;
}
.timer.warn > i { background: var(--yellow); }
.timer.danger > i { background: #fff; }

.emoji-pill {
  background: #fff;
  border-radius: 999px;
  padding: clamp(10px, 2.2vw, 22px) clamp(18px, 4vw, 52px);
  margin: clamp(18px, 4vw, 38px) auto;
  width: fit-content;
  max-width: 100%;
  display: flex;
  gap: clamp(4px, 1.4vw, 14px);
  justify-content: center;
  font-size: clamp(1.9rem, 7.4vw, 4rem);
  line-height: 1.1;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

.options { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 3vw, 32px) clamp(14px, 4vw, 48px); margin-top: 8px; }
.option {
  position: relative;
  font: inherit;
  text-align: left;
  color: #fff;
  font-weight: 600;
  font-size: clamp(1.1rem, 3.6vw, 2.2rem);
  line-height: 1.15;
  border: 0;
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 34px) clamp(16px, 3vw, 28px) clamp(18px, 4vw, 34px) clamp(54px, 9vw, 72px);
  min-height: clamp(70px, 11vw, 116px);
  display: flex;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.1s, filter 0.2s, opacity 0.25s, box-shadow 0.1s;
}
.option::before {
  content: '';
  position: absolute;
  left: -10px;
  top: -14px;
  width: clamp(40px, 6vw, 62px);
  height: clamp(40px, 6vw, 62px);
  background: url('/assets/caramelo.png') center / contain no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}
.option:nth-child(1) { background: var(--teal); }
.option:nth-child(2) { background: var(--coral); }
.option:nth-child(3) { background: var(--yellow); }
.option:nth-child(4) { background: var(--green); }
.option:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.07); }
.option:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); }
.option:disabled { cursor: default; }
.option.dim { opacity: 0.35; }
.option.picked { outline: 4px solid #fff; }
.option.right { outline: 5px solid #fff; animation: pop 0.45s; }
.option.right::after, .option.wrong::after {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.6em;
  line-height: 1;
}
.option.right::after { content: '✅'; }
.option.wrong { animation: shake 0.4s; }
.option.wrong::after { content: '❌'; }

@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.feedback {
  text-align: center;
  font-weight: 800;
  font-size: clamp(1.2rem, 4vw, 2rem);
  min-height: 2.6em;
  margin-top: 22px;
}
.feedback small { display: block; font-weight: 500; font-size: 0.6em; opacity: 0.9; }

/* ───────── Pantallas de estado ───────── */
.state { text-align: center; padding-top: clamp(10px, 4vh, 40px); }
.state .big-candy { width: clamp(90px, 22vw, 170px); animation: spin 9s linear infinite; }
.state h2 { font-size: clamp(1.6rem, 5vw, 3rem); margin: 18px 0 8px; font-weight: 800; }
.state p { font-size: clamp(1rem, 2.6vw, 1.4rem); margin: 6px 0; opacity: 0.95; }
@keyframes spin { to { transform: rotate(360deg); } }

.score-badge {
  display: inline-block;
  background: #fff;
  color: var(--title);
  font-weight: 800;
  font-size: clamp(1.6rem, 6vw, 3rem);
  padding: 10px 34px;
  border-radius: 999px;
  margin: 14px 0;
}

/* ───────── Podio ───────── */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, 2.5vw, 28px); margin: 26px auto 8px; max-width: 900px; }
.podium .place { flex: 1; min-width: 0; text-align: center; animation: rise 0.8s both; }
.podium .who { padding: 0 4px 10px; }
.podium .medal { font-size: clamp(2rem, 7vw, 4.4rem); line-height: 1; }
.podium .name {
  font-weight: 800;
  font-size: clamp(1rem, 3vw, 2.2rem);
  overflow-wrap: anywhere;
  line-height: 1.1;
  margin-top: 6px;
}
.podium .pts { font-weight: 600; opacity: 0.95; font-size: clamp(0.85rem, 2vw, 1.4rem); margin-top: 2px; }
.podium .block {
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
  font-weight: 800;
  font-size: clamp(1.6rem, 5vw, 3.6rem);
  color: rgba(255, 255, 255, 0.92);
}
.place.p1 { order: 2; animation-delay: 0.5s; }
.place.p2 { order: 1; animation-delay: 0.25s; }
.place.p3 { order: 3; animation-delay: 0s; }
.p1 .block { height: clamp(110px, 24vw, 250px); background: var(--yellow); color: #7a1010; }
.p2 .block { height: clamp(80px, 17vw, 180px); background: var(--teal); }
.p3 .block { height: clamp(60px, 12vw, 130px); background: var(--coral); }
.place.empty { visibility: hidden; }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }

/* ───────── Responsive ───────── */
@media (max-width: 640px) {
  .options { grid-template-columns: 1fr; }
  .q-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .chips { justify-content: flex-start; }
  .top .cane { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
