/* Candy and chocolate theme. Loaded last, so it restyles everything before it.
   Palette: dark chocolate, milk chocolate, caramel, strawberry, lemon, mint, blueberry, cream. */
:root {
  --night: #2a1309; --night2: #4b2412;
  --white: #fff6e6;               /* cream replaces white everywhere */
  --glass: rgba(255, 240, 215, 0.08);
  --line: rgba(255, 214, 160, 0.28);
  --choc: #3b1c0d; --choc2: #5e2f17; --caramel: #f2a13c;
  --lime: #b8ff3d; --sun: #ffd23f; --sun-d: #c48a00;
  --pink: #ff4f8b; --pink-d: #b81c5a;
  --mint: #3fe3b4; --mint-d: #12926f;
  --sky: #5cc8ff; --sky-d: #1b86bd;
  --violet: #a569ff; --violet-d: #6a35c4;
}
body { color: var(--white); background: var(--night); }

/* ---------- Chocolate world ---------- */
.space {
  background:
    radial-gradient(70vmax 50vmax at 12% -5%, rgba(255, 95, 150, 0.38), transparent 60%),
    radial-gradient(60vmax 45vmax at 98% 35%, rgba(255, 176, 70, 0.26), transparent 60%),
    radial-gradient(60vmax 45vmax at 5% 105%, rgba(70, 225, 185, 0.22), transparent 60%),
    linear-gradient(180deg, #5a2b15, #3a1b0c 45%, #25100a);
}
.space::before { opacity: 0.35; background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 90px 120px, #ffe9c0, transparent),
    radial-gradient(2px 2px at 160px 60px, #ffd6ec, transparent), radial-gradient(1px 1px at 230px 180px, #fff, transparent); }
.space::after { opacity: 0.4; }
.blob.b1 { background: #ff4f8b; opacity: 0.4; }
.blob.b2 { background: #ffb02e; opacity: 0.3; }
.blob.b3 { background: #3fe3b4; opacity: 0.25; }
.shoot { display: none; }

/* floating sprinkles and candies (built by candy.js) */
.sprinkle { position: absolute; top: -20px; width: 6px; height: 18px; border-radius: 6px; opacity: 0.7; animation: sprinkleFall linear infinite; }
@keyframes sprinkleFall { from { transform: translateY(-5vh) rotate(0deg); } to { transform: translateY(112vh) rotate(var(--spin, 540deg)); } }
.floaty { position: absolute; font-size: var(--s, 3rem); opacity: 0.4; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35)); animation: floaty var(--t, 14s) ease-in-out infinite alternate; animation-delay: var(--dl, 0s);
  transform: translate(calc(var(--mx, 0) * var(--d, 10) * 1px), calc(var(--my, 0) * var(--d, 10) * 1px)); transition: transform 0.4s ease-out; }
@keyframes floaty { from { translate: 0 0; rotate: -12deg; } to { translate: 24px -46px; rotate: 14deg; } }
.trail { position: fixed; z-index: 60; width: 7px; height: 16px; border-radius: 6px; pointer-events: none; animation: trail 0.9s ease-out forwards; }
@keyframes trail { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }

/* ---------- Chocolate drip hanging from the top bar ---------- */
.topbar { background: rgba(42, 19, 9, 0.92); border-bottom: 0; box-shadow: 0 3px 0 #8a4b22; }
.drip { position: absolute; left: 0; top: 100%; width: 100%; height: 66px; pointer-events: none; overflow: visible; margin-top: 3px; }
.dr rect { fill: #2a1309; }
.dr rect.gl { fill: rgba(255, 220, 170, 0.35); }
.dr { transform-box: fill-box; transform-origin: top center; animation: drip 5s ease-in-out infinite; }
.dr.d2 { animation-delay: -1s; } .dr.d3 { animation-delay: -2s; animation-duration: 6.5s; } .dr.d4 { animation-delay: -3s; }
.dr.d5 { animation-delay: -1.5s; animation-duration: 7s; } .dr.d6 { animation-delay: -4s; } .dr.d7 { animation-delay: -2.5s; animation-duration: 6s; }
@keyframes drip { 0%, 100% { transform: scaleY(0.78); } 50% { transform: scaleY(1.18); } }

/* ---------- Glossy candy buttons ---------- */
.btn, .test-card, .choice, .key, .step, .tool { box-shadow: 0 6px 0 var(--cd), 0 14px 20px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.45); }
.btn { border-radius: 999px; letter-spacing: 0.01em; }
.btn::before, .test-card::before, .choice::before { content: ""; position: absolute; left: 9%; right: 9%; top: 4px; height: 38%; border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.02)); pointer-events: none; }
.test-card, .choice { position: relative; overflow: hidden; }
.test-card > *, .choice > * { position: relative; }
@keyframes jelly { 0% { transform: scale(1); } 25% { transform: scale(1.1, 0.88); } 45% { transform: scale(0.93, 1.08); } 65% { transform: scale(1.04, 0.97); } 100% { transform: scale(1); } }
@media (hover: hover) {
  .btn:hover:not(:active):not(:disabled), .test-card:hover:not(:active), .cat:hover { animation: jelly 0.6s; transform: none; }
}
.chip-btn { background: rgba(255, 240, 215, 0.12); border-color: rgba(255, 214, 160, 0.35); }
.chip-btn.on { background: var(--a); color: #2a1309; box-shadow: 0 3px 0 var(--ad), inset 0 2px 0 rgba(255, 255, 255, 0.45); }

/* ---------- Chocolate-bar cards ---------- */
.card {
  position: relative; border: 2px solid rgba(255, 210, 150, 0.3);
  background: linear-gradient(150deg, #6c3619 0%, #4a2412 55%, #3b1c0d 100%);
  box-shadow: inset 0 2px 0 rgba(255, 235, 200, 0.2), inset 0 -10px 22px rgba(0, 0, 0, 0.28), 0 18px 36px rgba(0, 0, 0, 0.45);
  backdrop-filter: none;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0.55;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.16) 2px, transparent 2px) 0 0 / 76px 76px,
    linear-gradient(0deg, rgba(0, 0, 0, 0.16) 2px, transparent 2px) 0 0 / 76px 76px,
    linear-gradient(135deg, rgba(255, 235, 200, 0.12), transparent 35%);
}
.card > * { position: relative; }
.card h2, .card h3 { text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.tip { background: rgba(0, 0, 0, 0.22); }
.xpbar { background: rgba(0, 0, 0, 0.35); border-color: rgba(255, 214, 160, 0.3); }
.xpbar i { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.35) 0 8px, transparent 8px 16px), linear-gradient(90deg, var(--pink), var(--sun)); background-size: 22.6px 22.6px, 100% 100%; animation: stripes 0.9s linear infinite; }
@keyframes stripes { to { background-position: 22.6px 0, 0 0; } }
.pill, .iconbtn { background: rgba(255, 240, 215, 0.12); border-color: rgba(255, 214, 160, 0.3); }
.tabs a[aria-current="page"] { background: var(--white); color: #2a1309; }
.lvlbadge, .lc-badge, .lu-badge { background: linear-gradient(160deg, var(--sun), #ff9d2e); border-color: #2a1309; box-shadow: 0 3px 0 var(--sun-d); }

/* ---------- Candy "planets" ---------- */
.orb {
  --glow: rgba(255, 190, 120, 0.5);
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.95) 0 5%, rgba(255, 255, 255, 0) 17%),
    radial-gradient(circle at 70% 82%, rgba(255, 255, 255, 0.25), transparent 40%),
    radial-gradient(circle at 36% 32%, var(--a) 0 42%, var(--ad) 100%);
}
.pl-sun .orb, [data-accent="sun"] .banner .orb {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.95) 0 5%, rgba(255, 255, 255, 0) 17%),
    radial-gradient(circle, rgba(255, 255, 255, 0.5) 1.6px, transparent 2.2px) 0 0 / 15px 15px,
    radial-gradient(circle at 36% 32%, #ffe66b 0 40%, #f0a800 100%);
}
.pl-pink .orb, [data-accent="pink"] .banner .orb {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.95) 0 5%, rgba(255, 255, 255, 0) 17%),
    repeating-conic-gradient(from 20deg, #ff4f8b 0 20deg, #ffd3e4 20deg 40deg);
}
.pl-mint .orb, [data-accent="mint"] .banner .orb {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.95) 0 5%, rgba(255, 255, 255, 0) 17%),
    repeating-linear-gradient(45deg, #3fe3b4 0 16px, #d4fff2 16px 32px);
}
.pl-sky .orb, [data-accent="sky"] .banner .orb {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.95) 0 5%, rgba(255, 255, 255, 0) 17%),
    radial-gradient(circle at 36% 32%, #8fdcff 0 38%, #1b86bd 100%);
}
.orb b { color: var(--white); -webkit-text-stroke: 0.07em #2a1309; }
.orb.moon::before {
  width: 28px; height: 10px; margin: -5px 0 0 -14px; border-radius: 99px; box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
  background: linear-gradient(180deg, #fff, #ffd0e0); animation: orbit2 9s linear infinite;
}
.planet:nth-child(2) .orb::before { background: linear-gradient(180deg, #fff, #b8ffe9); }
.planet:nth-child(3) .orb::before { background: linear-gradient(180deg, #fff, #ffe9a0); }
.planet:nth-child(4) .orb::before { background: linear-gradient(180deg, #fff, #ffc2d9); }
@keyframes orbit2 { from { transform: rotate(0deg) translateX(var(--rad)) rotate(0deg); } to { transform: rotate(360deg) translateX(var(--rad)) rotate(720deg); } }
.planet strong { text-shadow: 0 3px 0 rgba(0, 0, 0, 0.4); }

/* ---------- Hero: spinning peppermint swirl, rolling name, candy ribbon ---------- */
.hero { position: relative; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; z-index: -1; left: -40px; top: -40px; width: min(430px, 80vw); aspect-ratio: 1; border-radius: 50%;
  background: repeating-conic-gradient(#ff4f8b 0 14deg, #fff3dc 14deg 28deg); opacity: 0.22; animation: spin 38s linear infinite;
  -webkit-mask: radial-gradient(circle, #000 52%, transparent 70%); mask: radial-gradient(circle, #000 52%, transparent 70%);
}
.letter { animation: letterIn 0.8s cubic-bezier(0.2, 1.4, 0.4, 1) both, wave 3.2s ease-in-out infinite; animation-delay: calc(var(--k, 0) * 70ms + 200ms), calc(var(--k, 0) * 160ms + 1.4s); -webkit-text-stroke-color: #2a1309; }
@keyframes wave { 0%, 100% { translate: 0 0; } 50% { translate: 0 -0.07em; } }
.letter.pop { animation: pop 0.55s cubic-bezier(0.3, 1.6, 0.5, 1); }
.hello { color: var(--sun); }
.ticker { overflow: hidden; border-radius: 999px; transform: rotate(-1.2deg); margin: 4px -10px; background: repeating-linear-gradient(135deg, #ff4f8b 0 22px, #ff7aa8 22px 44px); box-shadow: 0 6px 0 var(--pink-d), 0 14px 24px rgba(0, 0, 0, 0.4); border: 3px solid #2a1309; }
.ticker-in { display: flex; width: max-content; animation: marquee 28s linear infinite; padding: 6px 0; }
.ticker-in span { font-family: var(--display); font-size: 1.25rem; color: #fff6e6; -webkit-text-stroke: 0.1em #2a1309; paint-order: stroke fill; padding: 0 26px; white-space: nowrap; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Tests and games in candy colors ---------- */
.q-card, .flash, .lab-stage, .t-visual, .col-stage { background: var(--white); color: #2a1309; }
.q-card, .flash { box-shadow: 0 8px 0 #e3c9a3, 0 18px 30px rgba(0, 0, 0, 0.4); }
.num-display { background: rgba(0, 0, 0, 0.3); }
.dash-stage { background: #1f0e06; box-shadow: 0 0 0 4px var(--pink), 0 0 40px rgba(255, 79, 139, 0.4); }
.arena { background: #1f0e06; }
.toast { background: var(--sun); color: #2a1309; }
.segs i.cur { background: var(--sun); }
.get-ready, .levelup { background: rgba(30, 12, 5, 0.94); }
.stamp { background: rgba(0, 0, 0, 0.3); }
.results li { background: rgba(255, 79, 139, 0.2); }
footer .install { margin: 6px 0; }
.voice-note { margin: 4px 0 0; font-weight: 800; font-size: 0.95rem; opacity: 0.85; text-align: center; }
.voice-note b { color: var(--lime); }
.voice-note.warn b { color: var(--sun); }

@media (prefers-reduced-motion: reduce) {
  .sprinkle, .floaty, .trail, .dr, .hero::before, .ticker-in, .xpbar i, .planet .orb::before { animation: none !important; }
  .trail { display: none; }
  .ticker-in { flex-wrap: wrap; width: auto; justify-content: center; }
}
@media (max-width: 760px) {
  .topbar { background: #2a1309; }
  .drip { height: 44px; }
  .tabs { background: rgba(42, 19, 9, 0.97); }
  .ticker-in span { font-size: 1.05rem; padding: 0 18px; }
  .hero::before { left: 50%; margin-left: calc(min(430px, 80vw) / -2); }
}
