:root {
  --theme: #8b5cf6;
  --theme-dark: #6d28d9;
  --theme-soft: #c4b5fd;
  --accent: #facc15;
  --accent-dark: #eab308;
  --sky-top: #7dd3fc;
  --sky-bottom: #bae6fd;
  --grass-top: #86efac;
  --grass-bottom: #4ade80;
  --ink: #4c1d95;
  --ink-soft: #5b21b6;
  --card: rgba(255, 255, 255, 0.55);
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Fredoka', 'Baloo 2', 'Quicksand', 'Inter', system-ui, sans-serif;
  color: #1f2937;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(to bottom,
      var(--sky-top) 0%,
      var(--sky-bottom) 55%,
      var(--grass-top) 60%,
      var(--grass-bottom) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

body.has-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--bg-image, none) center/cover no-repeat;
  opacity: 0.4;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Decorative grass + flowers ---------- */
.scene-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.scene-deco .flag {
  position: absolute;
  top: 14px;
  width: 22px;
  height: 30px;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
  opacity: 0.85;
}
.scene-deco .flower {
  position: absolute;
  bottom: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 30%, transparent 32%),
              conic-gradient(from 0deg, #ec4899, #f472b6, #ec4899);
  opacity: 0.9;
}

/* ---------- App shell ---------- */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 14px 16px 32px;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #fff7ed;
  border: 2px solid #f3e8d3;
  color: #92400e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 18px;
  text-decoration: none;
}
.icon-btn:hover { transform: translateY(-1px); }

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff7ed;
  border: 2px solid #f3e8d3;
  box-shadow: var(--shadow);
  font-weight: 700;
  color: #78350f;
  font-size: 16px;
}
.coin-pill .coin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 65%, #b45309);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #78350f;
  font-weight: 800;
}
.coin-pill .plus {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.pick-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 14px;
  padding: 6px 12px 6px 8px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(0,0,0,0.04);
}
.pick-pill .badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--theme);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}
.pick-pill .text {
  text-align: left;
  line-height: 1.1;
}
.pick-pill .text strong {
  color: var(--theme);
  font-size: 18px;
}
.pick-pill .text small {
  color: #4b5563;
  font-size: 11px;
  display: block;
}

/* ---------- Title block ---------- */
.title-wrap {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}
.title {
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(34px, 9vw, 52px);
  line-height: 0.95;
  color: #facc15;
  text-align: center;
  -webkit-text-stroke: 3px var(--theme-dark);
  text-shadow:
    0 2px 0 var(--theme-dark),
    0 4px 0 var(--theme-dark),
    0 6px 6px rgba(0,0,0,0.25);
  letter-spacing: 0.02em;
}
.title .row { display: block; }
.title .row.green {
  color: #84cc16;
  -webkit-text-stroke: 3px #3f6212;
  text-shadow:
    0 2px 0 #3f6212,
    0 4px 0 #3f6212,
    0 6px 6px rgba(0,0,0,0.25);
}
.golden-egg {
  width: 70px;
  height: 86px;
  border-radius: 50% 50% 48% 48% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 35% 30%, #fef9c3 0%, #fde047 35%, #f59e0b 75%, #b45309 100%);
  box-shadow:
    inset -6px -8px 0 rgba(0,0,0,0.12),
    0 6px 16px rgba(0,0,0,0.25);
  position: relative;
  flex-shrink: 0;
}
.golden-egg::after {
  content: "★";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fbbf24;
  text-shadow: 0 0 0 #b45309;
  -webkit-text-stroke: 2px #b45309;
}
.golden-egg-glow {
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 224, 71, 0.6), transparent 65%);
  filter: blur(6px);
  z-index: -1;
}

/* ---------- Subtitle banner ---------- */
.subtitle {
  margin: 14px auto 12px;
  background: #fff7ed;
  border-radius: 12px;
  padding: 8px 16px;
  font-weight: 600;
  color: #1f2937;
  box-shadow: var(--shadow);
  text-align: center;
  font-size: 14px;
}
.subtitle b { color: var(--theme); font-weight: 800; }

/* ---------- Basket grid ---------- */
.grid-card {
  background: #fef3c7cc;
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow);
  border: 2px solid #fde68a;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.basket-cell {
  position: relative;
  background: #fffbeb;
  border-radius: 14px;
  padding: 8px 6px 6px;
  border: 2px solid #fde68a;
  aspect-ratio: 1 / 1.05;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.basket-cell:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.15); }
.basket-cell.picked { animation: shake 0.4s ease; }
.basket-cell.opened { transform: translateY(-4px); }
.basket-cell .num {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  background: #fff;
  border: 2px solid #fde68a;
  border-radius: 50%;
  font-weight: 800;
  font-size: 12px;
  color: #6b4226;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

/* Basket SVG-ish: stacked layers */
.basket {
  position: relative;
  width: 78%;
  height: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.basket .handle {
  position: absolute;
  top: 4%;
  width: 70%;
  height: 50%;
  border: 5px solid #a16207;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  border-bottom: none;
  background: transparent;
  z-index: 1;
}
.basket .bow {
  position: absolute;
  top: -2%;
  right: 8%;
  width: 16px;
  height: 14px;
  background: var(--bow, #ec4899);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  box-shadow: -8px 0 0 var(--bow, #ec4899);
  z-index: 4;
  transform: rotate(-12deg);
}
.basket .bow::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--bow, #ec4899);
  border-radius: 2px;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}
.basket .lid {
  position: relative;
  width: 100%;
  height: 38%;
  background: var(--lid, #ec4899);
  border-radius: 50% 50% 12px 12px / 60% 60% 12px 12px;
  z-index: 2;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.1);
}
.basket .lid::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 7px;
  background: var(--lid, #ec4899);
  filter: brightness(0.92);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.basket .body {
  width: 96%;
  height: 52%;
  background:
    repeating-linear-gradient(135deg, #b45309 0 4px, #92400e 4px 8px),
    #92400e;
  border-radius: 6px 6px 14px 14px / 6px 6px 30% 30%;
  position: relative;
  z-index: 1;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.18);
}

/* Reveal: hide basket lid and show egg */
.basket-cell.opened .lid,
.basket-cell.opened .bow,
.basket-cell.opened .handle { opacity: 0; transition: opacity 0.25s; }
.basket-cell.opened .body { transform: translateY(6%); transition: transform 0.25s; }
.basket-cell .reveal-egg {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -10px) scale(0.6);
  width: 36px;
  height: 44px;
  border-radius: 50% 50% 48% 48% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 35% 30%, #fef9c3, #fde047 40%, #f59e0b 80%, #b45309);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 5;
}
.basket-cell.opened .reveal-egg {
  opacity: 1;
  transform: translate(-50%, -8px) scale(1);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* ---------- Footer CTAs ---------- */
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: linear-gradient(180deg, var(--theme-soft), var(--theme));
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  padding: 14px 22px;
  border-radius: 999px;
  border: 3px solid #fff;
  margin-top: 16px;
  box-shadow:
    0 4px 0 var(--theme-dark),
    0 8px 18px rgba(109, 40, 217, 0.4);
  cursor: pointer;
  letter-spacing: 0.03em;
}
.cta:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--theme-dark); }
.cta .finger { font-size: 22px; }

.egglist-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px auto 0;
  background: var(--theme);
  color: #fff;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid #fff;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 3px 0 var(--theme-dark);
}

/* ---------- Login page ---------- */
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
  border: 2px solid #fde68a;
  margin-top: 18px;
}
.login-card h2 {
  margin: 0 0 14px;
  font-size: 22px;
  color: var(--ink);
  text-align: center;
  font-weight: 800;
}
.field { display: block; margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #4b5563;
  margin-bottom: 5px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  outline: none;
  background: #f9fafb;
  transition: border-color 0.15s, background 0.15s;
}
.field input:focus {
  border-color: var(--theme);
  background: #fff;
}
.msg {
  min-height: 18px;
  font-size: 13px;
  margin-bottom: 8px;
  color: #b91c1c;
  text-align: center;
}
.brand-logo {
  display: block;
  margin: 8px auto 4px;
  max-width: 160px;
  max-height: 90px;
  object-fit: contain;
}
.brand-name {
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--theme-dark);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Small helpers ---------- */
.hidden { display: none !important; }
.spacer { flex: 1; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.modal {
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  width: min(360px, 88vw);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  border: 3px solid var(--accent);
}
.modal h3 {
  margin: 6px 0 8px;
  color: var(--theme-dark);
  font-size: 22px;
}
.modal p { margin: 0 0 14px; color: #374151; }
.modal .big-egg {
  width: 90px;
  height: 110px;
  margin: 0 auto 8px;
  border-radius: 50% 50% 48% 48% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 35% 30%, #fef9c3, #fde047 35%, #f59e0b 75%, #b45309);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.modal .ok {
  background: var(--theme);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--theme-dark);
}

/* ---------- Prize eggs (9 tiers) ---------- */
.prize-egg {
  width: 90px;
  height: 110px;
  margin: 0 auto 10px;
  border-radius: 50% 50% 48% 48% / 60% 60% 40% 40%;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  position: relative;
}
.prize-egg::before {
  content: "";
  position: absolute;
  top: 18%;
  left: 22%;
  width: 28%;
  height: 18%;
  background: rgba(255,255,255,0.55);
  border-radius: 50%;
  filter: blur(2px);
}
.egg-1 { background: radial-gradient(circle at 35% 30%, #f3f4f6, #d1d5db 70%, #6b7280); }
.egg-1::after {
  content: "";
  position: absolute;
  inset: 30% 30% 30% 40%;
  background:
    linear-gradient(transparent 45%, #4b5563 45%, #4b5563 50%, transparent 50%),
    linear-gradient(90deg, transparent 45%, #4b5563 45%, #4b5563 50%, transparent 50%);
  opacity: 0.5;
  border-radius: 2px;
}
.egg-2 { background: radial-gradient(circle at 35% 30%, #fff7ed, #fde68a 70%, #b45309); }
.egg-3 { background: radial-gradient(circle at 35% 30%, #dbeafe, #60a5fa 60%, #1d4ed8); }
.egg-4 { background: radial-gradient(circle at 35% 30%, #dcfce7, #4ade80 60%, #15803d); }
.egg-5 { background: radial-gradient(circle at 35% 30%, #fee2e2, #f87171 60%, #b91c1c); }
.egg-6 { background: radial-gradient(circle at 35% 30%, #ffffff, #f3f4f6 70%, #9ca3af); }
.egg-7 { background: radial-gradient(circle at 35% 30%, #f1f5f9, #cbd5e1 50%, #475569 100%); }
.egg-7::after {
  content: "";
  position: absolute;
  inset: 12% 30% 60% 25%;
  background: linear-gradient(120deg, rgba(255,255,255,0.7), transparent 60%);
  border-radius: 50%;
}
.egg-8 {
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.9), transparent 40%),
    radial-gradient(circle at 35% 30%, #e0f2fe, #7dd3fc 50%, #0284c7);
}
.egg-8::after {
  content: "✦";
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 22px;
  text-shadow: 0 0 6px rgba(255,255,255,0.9);
}
.egg-9 {
  background: radial-gradient(circle at 35% 30%, #fef9c3 0%, #fde047 35%, #f59e0b 75%, #b45309 100%);
}
.egg-9::after {
  content: "★";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fbbf24;
  -webkit-text-stroke: 2px #b45309;
}

/* ---------- Egg list page ---------- */
.egg-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.egg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  border: 2px solid #fde68a;
}
.egg-row .prize-egg {
  width: 44px;
  height: 56px;
  margin: 0;
  flex-shrink: 0;
}
.egg-row .prize-egg::before { display: none; }
.egg-meta { flex: 1; min-width: 0; }
.egg-name {
  font-weight: 800;
  color: var(--ink);
  font-size: 15px;
}
.egg-date {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}
.egg-amount {
  font-weight: 900;
  color: var(--theme-dark);
  font-size: 18px;
  flex-shrink: 0;
}
