:root {
  color-scheme: light;
  --green: #0e4d34;
  --green-2: #0b3a28;
  --parrot: #3fa34d;
  --gold: #ffd166;
  --red: #c0392b;
  --maroon: #7b1e3a;
  --paper: #fff8e8;
  --ink: #2b1d16;
  --ink-soft: #7a5f50;
  --cream: #fff4d6;
  --wa: #1fa855;
  --font: 'Hind Siliguri', 'Nunito', system-ui, sans-serif;
  --display: 'Baloo Da 2', 'Hind Siliguri', sans-serif;
  --title: 'Galada', 'Baloo Da 2', cursive;
}
html[lang="en"] { --font: 'Nunito', system-ui, sans-serif; --display: 'Fraunces', Georgia, serif; --title: 'Fraunces', Georgia, serif; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: #0b3a28; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 18px; line-height: 1.5; color: var(--cream);
  background:
    radial-gradient(700px 420px at 50% 0%, rgba(255, 209, 102, .18), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 18px),
    linear-gradient(180deg, var(--green) 0%, var(--green-2) 70%, #3a1018 100%);
}
a { color: var(--gold); }
button { font: inherit; }
svg { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 10px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--gold); text-decoration: none; font-family: var(--title); font-size: 24px; }
.lang-btn { background: rgba(255, 255, 255, .1); color: var(--cream); border: 2px solid rgba(255, 255, 255, .25); border-radius: 999px; padding: 8px 16px; min-height: 44px; font-weight: 700; cursor: pointer; }

/* Home */
.home { text-align: center; }
.invited { background: rgba(255, 209, 102, .15); border: 1px dashed var(--gold); border-radius: 14px; padding: 10px 14px; margin: 0 0 10px; font-weight: 600; }
.scene { margin: 0 -8px; }
.title { font-family: var(--title); color: var(--gold); font-size: clamp(38px, 10vw, 54px); line-height: 1.1; margin: 4px 0 6px; font-weight: 400; }
html[lang="en"] .title { font-weight: 700; }
.tagline { margin: 0 auto 18px; max-width: 32ch; color: #e9f2df; }
.name-form { display: grid; gap: 10px; text-align: left; }
.name-form label { font-weight: 700; }
.name-form input {
  font: inherit; font-size: 22px; padding: 14px 18px; min-height: 60px; border-radius: 16px; border: 3px solid rgba(255, 209, 102, .5);
  background: var(--paper); color: var(--ink);
}
.name-form input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 209, 102, .25); }
.err { color: #ffb3a7; font-weight: 700; margin: 0; }
.status { min-height: 1.5em; font-weight: 700; font-size: 20px; color: var(--gold); margin: 14px 0 6px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 60px; padding: 0 22px; border-radius: 999px; border: 0;
  font-size: 20px; font-weight: 800; cursor: pointer; text-decoration: none; transition: transform .12s;
}
.btn:active { transform: scale(.97); }
.btn-go { background: linear-gradient(180deg, #ff9f43, #e8590c); color: #fff; box-shadow: 0 10px 24px -10px rgba(232, 89, 12, .9); width: 100%; font-family: var(--display); font-size: 22px; }
.btn-status { background: linear-gradient(180deg, #2ec266, #168a45); color: #fff; box-shadow: 0 10px 24px -10px rgba(22, 138, 69, .9); }
.btn-friend { background: var(--gold); color: #4a2a00; }
.btn-ghost { background: rgba(255, 255, 255, .08); color: var(--cream); border: 2px solid rgba(255, 255, 255, .25); }
.btn-wide { width: 100%; }

/* Scene animation */
.cage-door { transform-box: fill-box; transform-origin: left center; transition: transform .45s ease; }
.door-open .cage-door { transform: scaleX(.12) skewY(-8deg); }
.env { transition: transform .4s ease; }

/* Envelope picking */
.pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 6px 0 26px; }
.envelope { background: none; border: 0; padding: 0; cursor: pointer; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .35)); animation: deal .5s ease both; }
.envelope:nth-child(2) { animation-delay: .1s; transform: translateY(-8px); }
.envelope:nth-child(3) { animation-delay: .2s; }
.envelope:hover, .envelope:focus-visible { transform: translateY(-10px) rotate(-2deg); }
@keyframes deal { from { opacity: 0; transform: translateY(30px) rotate(8deg); } }
.envelope .flap { transform-box: fill-box; transform-origin: top center; transition: transform .5s ease; }
.envelope.opening { transform: scale(1.1); }
.envelope.opening .flap { transform: scaleY(-1); }
.envelope.fade-away { opacity: .25; transform: scale(.9); transition: .4s; }

/* Reading card */
.reading { padding-bottom: 10px; }
.card {
  position: relative; background: var(--paper); color: var(--ink); border-radius: 26px; padding: 22px 20px 20px;
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .6); border: 3px solid var(--red); outline: 2px solid rgba(192, 57, 43, .35); outline-offset: -11px;
}
.card-head { display: flex; align-items: center; gap: 12px; }
.mini-parrot { width: 74px; flex: none; margin: -10px 0 -6px -6px; }
.card-head h2 { margin: 0; font-family: var(--display); color: var(--maroon); font-size: 26px; line-height: 1.2; }
.date { margin: 2px 0 0; color: var(--ink-soft); font-size: 15px; }
.meter { margin: 14px 0 6px; }
.meter-top { display: flex; justify-content: space-between; font-weight: 700; color: #5a3a2a; }
.meter-top b { color: #2e8f3e; font-family: var(--display); font-size: 22px; }
.bar { height: 12px; background: #efe2c8; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #f2b705, #3fa34d); border-radius: 99px; animation: fill 1.2s .3s ease both; }
@keyframes fill { from { width: 0 !important; } }
.fortune { font-family: var(--display); font-weight: 600; font-size: 23px; line-height: 1.45; margin: 16px 2px 14px; text-align: center; }
html[lang="en"] .fortune { font-size: 22px; }
.secret { background: #fdeee2; border-radius: 16px; padding: 12px 14px; text-align: center; }
.secret h3, .lucky h3 { margin: 0 0 4px; font-size: 15px; color: var(--red); font-weight: 800; }
.secret p { margin: 0; font-size: 18px; }
.lucky { margin: 14px 0 6px; }
.lucky h3 { text-align: center; }
.lucky ul { list-style: none; padding: 0; margin: 6px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lucky li { background: #fff; border: 1px solid #f0e2c4; border-radius: 14px; padding: 8px 10px; text-align: center; }
.lucky span { display: block; font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.lucky b { font-size: 17px; display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 16px; height: 16px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, .2); }
.line { margin: 10px 0 0; font-size: 17px; }
.line b { color: var(--maroon); }

.actions { display: grid; gap: 12px; margin: 20px 0 16px; }
.countdown { text-align: center; background: rgba(0, 0, 0, .18); border-radius: 18px; padding: 12px; margin-bottom: 14px; }
.countdown p { margin: 0; }
.countdown b { font-family: var(--display); font-size: 30px; color: var(--gold); letter-spacing: 1px; }
.countdown .small { font-size: 15px; color: #d7e6cf; }

footer { text-align: center; padding: 30px 0 40px; color: #cfe0c8; font-size: 15px; }
footer p { max-width: 40ch; margin: 10px auto; }
.promo { display: inline-block; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .25); color: var(--cream); padding: 10px 16px; border-radius: 999px; text-decoration: none; font-weight: 700; }
.ad-slot:empty { display: none; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; transition: .3s; z-index: 50; pointer-events: none;
  background: #1c1410; color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 700; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fade-in { animation: fadeIn .4s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

.page { background: var(--paper); color: var(--ink); border-radius: 22px; padding: 20px 22px 8px; }
.page h1 { font-family: var(--display); color: var(--maroon); margin-top: 0; }
.page a { color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
