/* ==========================================================================
   HT Explore English Challenge — shared styles
   Audience: 6–10 year olds. Big buttons, bright colors, playful type.
   ========================================================================== */

:root {
  --c-red:    #ff5b6e;
  --c-blue:   #3a8dff;
  --c-yellow: #ffd23f;
  --c-green:  #2ecc71;
  --c-purple: #a06bff;
  --c-orange: #ff8c42;
  --c-pink:   #ff5fa2;
  --c-cyan:   #2bd4d4;

  --c-bg-1: #1b1140;
  --c-bg-2: #3a1e7a;
  --c-bg-3: #ff5b6e;
  --c-bg-4: #ffd23f;

  --c-text: #ffffff;
  --c-text-soft: rgba(255, 255, 255, 0.78);
  --c-card: rgba(255, 255, 255, 0.10);
  --c-card-strong: rgba(255, 255, 255, 0.18);

  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.30);
  --shadow-deep: 0 20px 60px rgba(0, 0, 0, 0.45);

  --radius: 22px;
  --radius-lg: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #0a0626;
  color: var(--c-text);
  font-family: 'Fredoka', 'Quicksand', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* -------------------- animated confetti background -------------------- */
.bg-stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #1b1140 0%, #3a1e7a 50%, #6b2d9c 100%);
}
.bg-stage::before {
  /* giant soft gradient blobs */
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 91, 110, 0.55) 0%, transparent 28%),
    radial-gradient(circle at 88% 22%, rgba(255, 210, 63, 0.50) 0%, transparent 28%),
    radial-gradient(circle at 18% 82%, rgba(43, 212, 212, 0.55) 0%, transparent 30%),
    radial-gradient(circle at 82% 78%, rgba(160, 107, 255, 0.55) 0%, transparent 32%);
  filter: blur(40px);
  animation: float 14s ease-in-out infinite alternate;
}
@keyframes float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-3%, -2%) scale(1.06); }
}

.confetti, .confetti span {
  position: absolute;
  top: -10vh;
  width: 14px;
  height: 22px;
  opacity: 0.85;
  border-radius: 4px;
  animation: fall linear infinite;
}
.confetti span:nth-child(1)  { left:  5%; background: var(--c-red);    animation-duration: 11s; animation-delay: 0s;   transform: rotate(20deg); }
.confetti span:nth-child(2)  { left: 15%; background: var(--c-yellow); animation-duration: 14s; animation-delay: 2s;   transform: rotate(-15deg); }
.confetti span:nth-child(3)  { left: 25%; background: var(--c-blue);   animation-duration: 10s; animation-delay: 1s;   transform: rotate(40deg); }
.confetti span:nth-child(4)  { left: 35%; background: var(--c-green);  animation-duration: 13s; animation-delay: 3s;   transform: rotate(-25deg); }
.confetti span:nth-child(5)  { left: 45%; background: var(--c-purple); animation-duration: 12s; animation-delay: 0.5s; transform: rotate(15deg); }
.confetti span:nth-child(6)  { left: 55%; background: var(--c-orange); animation-duration: 15s; animation-delay: 4s;   transform: rotate(-40deg); }
.confetti span:nth-child(7)  { left: 65%; background: var(--c-pink);   animation-duration: 11s; animation-delay: 1.5s; transform: rotate(25deg); }
.confetti span:nth-child(8)  { left: 75%; background: var(--c-cyan);   animation-duration: 14s; animation-delay: 2.5s; transform: rotate(-20deg); }
.confetti span:nth-child(9)  { left: 85%; background: var(--c-yellow); animation-duration: 12s; animation-delay: 3.5s; transform: rotate(30deg); }
.confetti span:nth-child(10) { left: 92%; background: var(--c-red);    animation-duration: 13s; animation-delay: 1.8s; transform: rotate(-35deg); }

@keyframes fall {
  0%   { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(120vh) rotate(360deg); }
}

/* -------------------- typography -------------------- */
.title {
  font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.25),
    0 8px 24px rgba(0, 0, 0, 0.40);
}
.brand {
  font-family: 'Lilita One', 'Fredoka', system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: 1px;
  /* Near-white with a faint sky→sun→grass tint — bright and reads well
     on top of the cartoon background. */
  background: linear-gradient(90deg,
    #ffffff 0%,
    #f4faff 25%,
    #fff8d6 50%,      /* warm sun hint */
    #e8f7ee 75%,      /* soft grass hint */
    #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* Thin dark outline + soft halo for legibility without darkening the fill */
  filter:
    drop-shadow(0 1px 0 rgba(0,0,0,0.35))
    drop-shadow(0 4px 10px rgba(0,0,0,0.25));
}

/* -------------------- layout primitives -------------------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 18px 80px;
  position: relative;
}

.card {
  background: var(--c-card);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.card-strong {
  background: var(--c-card-strong);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-deep);
}

.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 14px; }

.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

.muted { color: var(--c-text-soft); }
.tiny  { font-size: 14px; opacity: 0.8; }
.small { font-size: 16px; }
.large { font-size: 22px; }
.xl    { font-size: 30px; }
.xxl   { font-size: 48px; }
.huge  { font-size: 72px; }

/* -------------------- inputs -------------------- */
.input, .textarea, .select {
  width: 100%;
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.30);
  border: 2px solid rgba(255, 255, 255, 0.18);
  color: var(--c-text);
  font-size: 22px;
  font-weight: 600;
  border-radius: var(--radius);
  outline: none;
  transition: all 0.15s ease;
  font-family: inherit;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--c-yellow);
  background: rgba(0, 0, 0, 0.40);
  box-shadow: 0 0 0 4px rgba(255, 210, 63, 0.20);
}
.input::placeholder { color: rgba(255, 255, 255, 0.45); }
.textarea { resize: vertical; min-height: 80px; }

/* -------------------- buttons -------------------- */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 700;
  font-size: 20px;
  padding: 16px 26px;
  border-radius: var(--radius);
  color: white;
  background: linear-gradient(180deg, #5b6bff 0%, #3a47d6 100%);
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}
.btn:hover  { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.30); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.4); }

.btn.primary { background: linear-gradient(180deg, #ff7a8a 0%, var(--c-red) 100%); }
.btn.success { background: linear-gradient(180deg, #5fdf8a 0%, var(--c-green) 100%); }
.btn.warn    { background: linear-gradient(180deg, #ffc34f 0%, var(--c-orange) 100%); color: #2a1500; }
.btn.ghost   { background: rgba(255,255,255,0.10); border: 2px solid rgba(255,255,255,0.25); }
.btn.danger  { background: linear-gradient(180deg, #ff7676 0%, #d04848 100%); }

.btn.huge {
  font-size: 30px;
  padding: 22px 38px;
  border-radius: 28px;
}

/* giant answer buttons (multi-choice) */
.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}
@media (max-width: 640px) {
  .answer-grid { grid-template-columns: 1fr; }
}

.answer-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: 'Lilita One', 'Fredoka', sans-serif;
  font-size: 30px;
  font-weight: 900;
  color: white;
  padding: 36px 22px;
  border-radius: 28px;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.18);
  box-shadow:
    inset 0 -8px 0 rgba(0,0,0,0.20),
    0 10px 28px rgba(0, 0, 0, 0.40);
  transition: transform 0.06s ease, filter 0.15s ease, box-shadow 0.06s ease;
  position: relative;
  overflow: hidden;
}
.answer-btn:hover  { filter: brightness(1.06); }
.answer-btn:active { transform: translateY(4px); box-shadow: inset 0 -4px 0 rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.30); }
.answer-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.answer-btn .shape {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-size: 80px;
  background-repeat: repeat;
}
.answer-btn.red    { background: linear-gradient(180deg, #ff7a8a 0%, var(--c-red)    100%); }
.answer-btn.blue   { background: linear-gradient(180deg, #6aa8ff 0%, var(--c-blue)   100%); }
.answer-btn.yellow { background: linear-gradient(180deg, #ffe27a 0%, var(--c-yellow) 100%); color: #2a1500; text-shadow: 0 2px 0 rgba(255,255,255,0.6); }
.answer-btn.green  { background: linear-gradient(180deg, #6ce299 0%, var(--c-green)  100%); }
.answer-btn .icon {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.25);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
}

/* -------------------- badges & meta -------------------- */
.pin {
  font-family: 'Lilita One', sans-serif;
  font-size: 64px;
  letter-spacing: 6px;
  background: linear-gradient(180deg, var(--c-yellow), var(--c-orange));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1.5px solid rgba(255,255,255,0.22);
  font-size: 14px;
  font-weight: 700;
}
.badge.gold   { background: linear-gradient(180deg, #ffe27a, #ffb300); color: #2a1500; border-color: transparent; }
.badge.silver { background: linear-gradient(180deg, #ecf0ff, #b8c2d8); color: #1b1140; border-color: transparent; }
.badge.bronze { background: linear-gradient(180deg, #f3a877, #c47a3f); border-color: transparent; }

/* -------------------- leaderboard -------------------- */
.leaderboard {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lb-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(255,255,255,0.10);
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 18px;
  font-size: 22px;
  font-weight: 700;
}
.lb-row.first  { background: linear-gradient(90deg, rgba(255,210,63,0.30), rgba(255,140,66,0.25)); border-color: rgba(255,210,63,0.55); }
.lb-row.second { background: linear-gradient(90deg, rgba(220,232,255,0.25), rgba(180,200,230,0.20)); }
.lb-row.third  { background: linear-gradient(90deg, rgba(243,168,119,0.28), rgba(196,122,63,0.20)); }
.lb-rank {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Lilita One', sans-serif;
  font-size: 26px;
  background: rgba(0,0,0,0.30);
}
.lb-row.first  .lb-rank { background: linear-gradient(180deg, #ffe27a, #ffb300); color: #2a1500; }
.lb-row.second .lb-rank { background: linear-gradient(180deg, #ecf0ff, #b8c2d8); color: #1b1140; }
.lb-row.third  .lb-rank { background: linear-gradient(180deg, #f3a877, #c47a3f); color: #2a1500; }
.lb-score {
  font-family: 'Lilita One', sans-serif;
  font-size: 26px;
  background: linear-gradient(180deg, var(--c-yellow), var(--c-orange));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* -------------------- timer ring -------------------- */
.timer {
  --pct: 100;
  --size: 92px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    conic-gradient(var(--c-yellow) calc(var(--pct) * 1%), rgba(255,255,255,0.18) 0);
  position: relative;
}
.timer::after {
  content: "";
  position: absolute;
  inset: 8px;
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
}
.timer .num {
  position: relative;
  z-index: 1;
  font-family: 'Lilita One', sans-serif;
  font-size: 30px;
}

/* -------------------- decorations -------------------- */
.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.sparkles::before, .sparkles::after {
  content: "✦ ✧ ★ ✦ ✧";
  position: absolute;
  font-size: 28px;
  color: rgba(255,255,255,0.18);
  letter-spacing: 12px;
}
.sparkles::before { top: 8%; left: 4%; transform: rotate(-12deg); }
.sparkles::after  { bottom: 8%; right: 4%; transform: rotate(14deg); }

/* -------------------- toast / status -------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.80);
  color: white;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  z-index: 50;
  border: 1.5px solid rgba(255,255,255,0.18);
  animation: rise 0.2s ease;
}
.toast.error { background: linear-gradient(180deg, #ff7676, #d04848); }
.toast.ok    { background: linear-gradient(180deg, #6ce299, #1faa59); }
@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* -------------------- responsive tweaks -------------------- */
@media (max-width: 520px) {
  .xxl  { font-size: 36px; }
  .huge { font-size: 56px; }
  .pin  { font-size: 52px; letter-spacing: 4px; }
  .answer-btn { font-size: 24px; min-height: 110px; padding: 24px 16px; }
  .answer-btn .icon { width: 50px; height: 50px; font-size: 28px; }
}