:root {
  --maroon: #5c0f22;
  --maroon-2: #3a0816;
  --plum: #1a0826;
  --gold: #ffcc4d;
  --gold-2: #ffb300;
  --saffron: #ff8f1f;
  --pink: #ff3d7f;
  --cream: #fff3d6;
  --muted: #e8cfa6;
  --glass: rgba(34, 8, 30, 0.72);
  --line: rgba(255, 204, 77, 0.45);
  --shop-w: 340px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #05030c; color: var(--cream);
  font-family: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.hi { font-family: 'Tiro Devanagari Hindi', 'Nirmala UI', serif; }
button { font: inherit; color: inherit; }

/* the cursor itself is a burning lighter (hotspot = flame tip) */
html, body, button, .card {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='40' viewBox='0 0 32 40'%3E%3Cpath d='M9 1c5 5 6 9 1 13-5-3-5-7-1-13z' fill='%23ffb300'/%3E%3Cpath d='M9 6c2 2 3 4 0 7-2-2-2-4 0-7z' fill='%23fff6c8'/%3E%3Crect x='5' y='14' width='12' height='5' rx='1' fill='%23cfd3d8' stroke='%23333' stroke-width='.8'/%3E%3Ccircle cx='14' cy='13.5' r='2.4' fill='%233a3a40'/%3E%3Crect x='5' y='19' width='12' height='19' rx='3' fill='%23e0115f' stroke='%23400' stroke-width='.8'/%3E%3C/svg%3E") 9 1, pointer;
}
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#scene.hand { cursor: none; }

/* ------------------------------------------------ aangan / chhat switch */
#where {
  position: fixed; left: 16px; bottom: 26px; z-index: 5; display: flex; gap: 6px; padding: 6px;
  border-radius: 18px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px);
}
#where button {
  display: flex; align-items: center; gap: 7px; border: 0; border-radius: 13px; padding: 7px 11px;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; transition: background .2s, color .2s;
}
#where button svg { width: 20px; height: 20px; flex: none; }
#where button span { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
#where button small { font-size: 10.5px; font-weight: 400; opacity: .85; }
#where button:hover { color: var(--cream); background: rgba(255, 255, 255, .06); }
#where button[aria-pressed="true"] { background: linear-gradient(180deg, #ffe27a, #ff9d1f); color: #3a0816; }
body.busy #where button { opacity: .5; pointer-events: none; }

/* ------------------------------------------------ jhalar along the top */
#jhalar {
  position: fixed; top: 0; left: 0; right: 0; height: 34px; pointer-events: none; z-index: 5;
}
#jhalar::before {
  content: ''; position: absolute; left: 0; right: 0; top: 3px; height: 2px;
  background: repeating-linear-gradient(90deg, #1e3a1e 0 6px, #0e1e0e 6px 9px);
}
#jhalar i {
  position: absolute; width: 9px; height: 13px; margin-left: -4.5px; border-radius: 50% 50% 45% 45%;
  background: var(--c); box-shadow: 0 0 6px 2px var(--c), 0 0 16px 4px var(--c);
  animation: twinkle 1.3s ease-in-out infinite alternate;
}
#jhalar i::before {
  content: ''; position: absolute; top: -4px; left: 2.5px; width: 4px; height: 5px; background: #2a3a20; border-radius: 1px;
}
@keyframes twinkle { 0% { opacity: 0.3; filter: saturate(0.6); } 100% { opacity: 1; } }

/* ------------------------------------------------ title */
.title {
  position: fixed; top: 22px; left: 0; right: var(--shop-w); text-align: center; pointer-events: none; z-index: 4;
}
.title h1 {
  margin: 0; font-family: 'Yatra One', 'Poppins', serif; font-weight: 400;
  font-size: clamp(34px, 5.2vw, 68px); line-height: 1.05; letter-spacing: 1px;
  background: linear-gradient(180deg, #fff6c8 0%, #ffd34d 45%, #ff9a1f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 170, 40, 0.55)) drop-shadow(0 3px 0 rgba(90, 15, 30, 0.9));
}
.title p { margin: 2px 0 0; font-size: 15px; color: var(--muted); text-shadow: 0 2px 8px #000; letter-spacing: 0.5px; }
.title p .hi { color: var(--gold); font-size: 18px; }

/* ------------------------------------------------ top buttons */
.topbar { position: fixed; top: 40px; left: 16px; display: flex; gap: 8px; z-index: 6; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass);
  display: grid; place-items: center; cursor: pointer; color: var(--gold); backdrop-filter: blur(6px);
  transition: transform .15s ease, background .2s;
}
.icon-btn:hover { transform: scale(1.08); background: rgba(92, 15, 34, 0.85); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn[aria-pressed="false"] { color: #8a7a6a; }
#sound-btn .off { display: none; }
#sound-btn[aria-pressed="false"] .on { display: none; }
#sound-btn[aria-pressed="false"] .off { display: block; }

/* ------------------------------------------------ money saved / pollution avoided */
#meter { position: fixed; left: 16px; top: 94px; z-index: 4; display: flex; flex-direction: column; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 22px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.chip svg { width: 22px; height: 22px; flex: none; }
.chip b { font-size: 17px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.chip.money { color: var(--gold); }
.chip.poll { color: #7dff9a; border-color: rgba(125, 255, 154, .45); }
.chip.bump { animation: bump .6s ease; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.12); filter: brightness(1.4); } 100% { transform: scale(1); } }

/* floating "+₹" over the burst */
#pops { position: fixed; inset: 0; pointer-events: none; z-index: 8; }
.pop {
  position: absolute; transform: translate(-50%, -50%); text-align: center; white-space: nowrap;
  font-weight: 800; font-size: 26px; color: #ffe14d; line-height: 1.15;
  text-shadow: 0 0 12px rgba(255, 170, 40, .9), 0 3px 0 #5c0f22;
  animation: popup 2.1s ease-out forwards;
}
.pop small { font-size: 15px; color: #7dff9a; text-shadow: 0 0 10px rgba(30, 160, 70, .9), 0 2px 0 #08301a; }
@keyframes popup {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}

/* ------------------------------------------------ shop */
#shop {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--shop-w); z-index: 4;
  padding: 44px 14px 14px; display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 150, 40, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(70, 10, 30, 0.92), rgba(26, 6, 30, 0.94));
  border-left: 2px solid var(--gold-2);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6), inset 4px 0 0 rgba(255, 204, 77, 0.15);
}
#shop::before { /* marigold toran across the stall */
  content: ''; position: absolute; left: 0; right: 0; top: 30px; height: 22px; pointer-events: none;
  background:
    radial-gradient(circle at 11px 6px, #ffb300 0 6px, transparent 7px) 0 0 / 22px 22px repeat-x,
    radial-gradient(circle at 11px 12px, #ff7a00 0 6px, transparent 7px) 11px 0 / 22px 22px repeat-x;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.5));
}
.shop-head { text-align: center; padding: 18px 4px 10px; }
.shop-head h2 { margin: 0; font-family: 'Yatra One', serif; font-weight: 400; font-size: 28px; color: var(--gold); text-shadow: 0 0 12px rgba(255, 160, 40, .5); }
.shop-head .hi { display: block; color: #ffd9a0; font-size: 17px; margin-top: -2px; }
.shop-head p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.shop-head p b { color: #7dff9a; }
#shop-list {
  flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 2px 10px;
  scrollbar-width: thin; scrollbar-color: var(--gold-2) transparent;
}
.card {
  position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: left;
  border-radius: 14px; padding: 8px; cursor: pointer; overflow: hidden;
  border: 1px solid rgba(255, 204, 77, 0.35);
  background: linear-gradient(160deg, rgba(120, 22, 48, 0.85), rgba(50, 10, 40, 0.9));
  transition: transform .15s ease, border-color .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 6px 18px rgba(255, 140, 30, .25); }
.card.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(255, 180, 40, .55); }
.card.active::after {
  content: 'IN HAND'; position: absolute; top: 8px; left: 8px; font-size: 9px; font-weight: 800; letter-spacing: 1px;
  background: var(--gold); color: var(--maroon-2); padding: 2px 6px; border-radius: 6px;
}
body.busy .card { opacity: .55; cursor: not-allowed; }
body.busy .card.active { opacity: 1; }
.thumb {
  aspect-ratio: 1.15; border-radius: 10px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 60%, rgba(255, 190, 90, .28), rgba(0, 0, 0, .1) 70%);
}
.thumb img { width: 92%; height: 92%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); }
.info { padding: 6px 2px 0; }
.nm { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.info .hi { font-size: 13px; color: #ffcf8a; }
.price { margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.price s { color: #d9a9a9; font-size: 13px; }
.free { font-weight: 800; font-size: 11px; color: #052a12; background: #6dff8f; padding: 1px 6px; border-radius: 6px; letter-spacing: .5px; }
.unit { font-size: 10.5px; color: var(--muted); opacity: .85; }

/* ------------------------------------------------ countdown */
#countdown {
  position: fixed; left: calc((100% - var(--shop-w)) / 2); top: 40%; transform: translate(-50%, -50%);
  z-index: 7; pointer-events: none; opacity: 0; white-space: nowrap;
  font-family: 'Yatra One', 'Poppins', serif; font-size: clamp(90px, 16vw, 200px); line-height: 1;
  color: #fff3c4; -webkit-text-stroke: 3px #b3121f;
  text-shadow: 0 0 30px rgba(255, 170, 40, .9), 0 6px 0 #5c0f22;
}
#countdown.show { animation: count 0.95s cubic-bezier(.2, 1.4, .4, 1) forwards; }
#countdown.boom {
  font-size: clamp(54px, 9vw, 130px); color: #ffe14d; -webkit-text-stroke: 3px #c2185b;
  animation: boom 1.4s ease-out forwards;
}
@keyframes count {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.8); }
}
@keyframes boom {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-8deg); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(3deg); }
  25% { transform: translate(-52%, -48%) scale(1.05) rotate(-2deg); }
  35% { transform: translate(-48%, -52%) scale(1.1) rotate(1deg); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.3); }
}

/* ------------------------------------------------ toasts */
#toasts {
  position: fixed; top: 120px; left: calc((100% - var(--shop-w)) / 2); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 6; pointer-events: none;
}
.toast {
  padding: 10px 18px; border-radius: 30px; font-size: 15px; font-weight: 600; text-align: center;
  background: linear-gradient(90deg, rgba(20, 90, 40, .9), rgba(40, 120, 50, .9)); border: 1px solid #7dff9a;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5); animation: tin .4s cubic-bezier(.2, 1.4, .4, 1);
  transition: opacity .5s, transform .5s;
}
.toast b { color: #fff59d; }
.toast.info { background: var(--glass); border-color: var(--line); }
.toast.out { opacity: 0; transform: translateY(-14px); }
@keyframes tin { from { opacity: 0; transform: translateY(16px) scale(.9); } }

.foot {
  position: fixed; left: 16px; bottom: 6px; font-size: 10.5px; color: rgba(232, 207, 166, .6); z-index: 3; pointer-events: none;
}

/* ------------------------------------------------ intro */
#intro {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(60% 50% at 50% 55%, rgba(255, 140, 30, .28), transparent 70%),
    radial-gradient(circle at 50% 50%, rgba(60, 8, 40, .9), rgba(5, 2, 12, .97));
  transition: opacity .9s ease, visibility .9s;
}
#intro.gone { opacity: 0; visibility: hidden; }
.intro-card { max-width: 560px; text-align: center; }
.intro-card h1 {
  margin: 10px 0 0; font-family: 'Yatra One', serif; font-weight: 400; font-size: clamp(48px, 10vw, 92px); line-height: 1;
  background: linear-gradient(180deg, #fff6c8, #ffd34d 45%, #ff9a1f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 170, 40, .6));
}
.intro-card .big { font-size: clamp(24px, 5vw, 34px); color: var(--gold); margin: 4px 0 12px; }
.intro-card .lead { font-size: 16px; line-height: 1.55; color: var(--cream); margin: 0 0 18px; }
.intro-card .lead b { color: #7dff9a; }
.points { list-style: none; display: flex; justify-content: center; gap: 12px; padding: 0; margin: 0 0 22px; }
.points li {
  display: flex; flex-direction: column; padding: 10px 16px; border-radius: 14px; min-width: 92px;
  background: rgba(92, 15, 34, .6); border: 1px solid var(--line);
}
.points b { font-size: 24px; color: var(--gold); }
.points span { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
#enter-btn {
  border: 0; cursor: pointer; padding: 15px 30px; border-radius: 40px; font-weight: 800; font-size: 18px;
  color: #3a0816; background: linear-gradient(180deg, #ffe27a, #ff9d1f);
  box-shadow: 0 0 34px rgba(255, 150, 30, .7); transition: transform .15s;
}
#enter-btn:hover:not(:disabled) { transform: scale(1.05); }
#enter-btn:disabled { opacity: .7; cursor: progress; box-shadow: none; }
.note { font-size: 13px; color: var(--muted); margin-top: 14px; }

.diya-anim { position: relative; width: 90px; height: 90px; margin: 0 auto; }
.diya-anim .bowl {
  position: absolute; left: 10px; right: 10px; bottom: 6px; height: 34px;
  background: radial-gradient(ellipse at 50% 0%, #e07a40, #9c3d18 60%, #5e220c);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.diya-anim .flame {
  position: absolute; left: 50%; bottom: 36px; width: 22px; height: 44px; margin-left: -11px;
  background: radial-gradient(ellipse at 50% 75%, #fff 0 18%, #ffe066 35%, #ff9d1f 60%, rgba(255, 80, 0, 0) 72%);
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  filter: drop-shadow(0 0 16px #ffae33) drop-shadow(0 0 40px #ff7b00);
  transform-origin: 50% 90%; animation: flame 0.16s ease-in-out infinite alternate;
}
@keyframes flame { from { transform: scale(1, 1) rotate(-2deg); } to { transform: scale(.92, 1.08) rotate(2deg); } }

/* ------------------------------------------------ mobile */
@media (max-width: 820px) {
  :root { --shop-w: 0px; }
  .title { top: 26px; right: 0; }
  .title h1 { font-size: 36px; }
  .title p { font-size: 12px; }
  .topbar { top: auto; bottom: 252px; left: auto; right: 12px; flex-direction: column; }
  .icon-btn { width: 38px; height: 38px; }
  #meter { top: 96px; left: 8px; gap: 6px; }
  .chip { padding: 4px 10px 4px 6px; }
  .chip svg { width: 18px; height: 18px; }
  .chip b { font-size: 14px; }
  .pop { font-size: 20px; }
  #where { left: auto; right: 8px; bottom: auto; top: 96px; flex-direction: column; padding: 4px; }
  #where button { padding: 6px 8px; font-size: 11px; }
  #where button small { display: none; }
  #shop {
    top: auto; left: 0; width: 100%; height: 160px; padding: 6px 10px 10px;
    border-left: 0; border-top: 2px solid var(--gold-2);
  }
  #shop::before { top: -2px; }
  .shop-head { display: none; }
  #shop-list { display: flex; overflow-x: auto; overflow-y: hidden; gap: 8px; padding-top: 16px; }
  .card { flex: 0 0 112px; padding: 6px; }
  .thumb { aspect-ratio: 1.4; }
  .nm { font-size: 12px; }
  .info .hi { font-size: 11px; }
  .unit { display: none; }
  #countdown { left: 50%; top: 36%; }
  #toasts { left: 50%; top: 104px; width: calc(100% - 140px); }
  .toast { font-size: 13px; }
  .foot { display: none; }
}
@media (max-width: 820px) and (max-height: 640px) {
}

@media (prefers-reduced-motion: reduce) {
  #jhalar i, .diya-anim .flame { animation: none; }
}
