/* ProductSquads Diwali Tambola - shared Diwali theme */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Yatra+One&display=swap');

:root {
  --bg: #140F2E;
  --bg-deep: #0B0820;
  --panel: #1F1842;
  --header: #1A1338;
  --line: #3A2F66;
  --line-strong: #5A4A8F;
  --gold: #F5B83D;
  --gold-light: #FFD27A;
  --gold-text: #FFE3A3;
  --on-gold: #2A1600;
  --saffron: #F07B1D;
  --on-saffron: #1A0E00;
  --maroon: #7A1E3A;
  --cream: #FFF7E6;
  --muted: #C4B8D9;
  --soft: #E6DDF5;
  --dim: #8F86B3;
  --ok: #7BE3A6;
  --ok-bg: #163D2C;
  --ok-on: #0D2A1B;
  --bad: #FFB3C1;
  --bad-strong: #FF8A8A;
  --bad-bg: #3A1426;
  --display: 'Yatra One', Georgia, serif;
  --body: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--cream); font-family: var(--body); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--gold); }
a:hover { color: var(--gold-light); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; color: var(--gold); margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }

/* ---------- header + toran ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 12px 24px; background: var(--header); }
.brand { display: flex; align-items: center; gap: 12px; }
.logo-badge { background: var(--cream); border-radius: 10px; padding: 6px 12px; display: flex; }
.logo-badge img { height: 28px; width: auto; display: block; }
.brand-title { font-family: var(--display); font-size: 22px; color: var(--gold); }
.toran {
  height: 12px;
  background:
    radial-gradient(circle at 10px 0, var(--saffron) 7px, transparent 8px) 0 0 / 40px 12px repeat-x,
    radial-gradient(circle at 30px 0, var(--gold) 7px, transparent 8px) 0 0 / 40px 12px repeat-x;
}

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 20px; }
.panel-body { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }

/* ---------- buttons + inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent; font: 600 14px var(--body); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-gold { background: var(--gold); color: var(--on-gold); }
.btn-saffron { background: var(--saffron); color: var(--on-saffron); }
.btn-ok { background: var(--ok); color: var(--ok-on); }
.btn-bad { background: var(--bad-strong); color: #3A0A0A; }
.btn-ghost { background: transparent; color: var(--gold); border-color: var(--gold); }
.btn-quiet { background: transparent; color: var(--cream); border-color: var(--line-strong); font-weight: 500; }
.btn-sm { min-height: 36px; padding: 0 10px; font-size: 12px; }
.btn-xl { min-height: 64px; font-size: 20px; border-radius: 10px; width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.input, select.input { min-height: 44px; background: var(--bg); color: var(--cream); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; font: 14px var(--body); width: 100%; }
textarea.input { padding: 10px 12px; min-height: 120px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }

/* ---------- chips + badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-gold { background: #4A2A08; color: var(--gold-light); }
.badge-quiet { border: 1px solid var(--line-strong); color: var(--soft); }
.num-chip { min-width: 32px; height: 32px; padding: 0 4px; border-radius: 50%; background: var(--gold); color: var(--on-gold); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }

/* ---------- number circle + coin ---------- */
.num-circle { border-radius: 50%; border: 4px solid var(--gold); background: var(--bg); display: flex; align-items: center; justify-content: center; font-family: var(--display); color: var(--gold); line-height: 1; box-shadow: 0 0 24px 4px rgba(245,184,61,.35); }
.coin-stage { position: relative; perspective: 1000px; }
.coin {
  position: absolute; inset: 0; z-index: 30; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF1B8 0%, #F5C451 38%, #D99A1E 72%, #A8700F 100%);
  box-shadow: inset 0 0 0 calc(var(--coin-size, 240px) * .04) rgba(138,90,11,.45), inset 0 0 0 calc(var(--coin-size, 240px) * .062) #FFE08A, 0 0 60px 16px rgba(245,184,61,.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: #4A2504;
  pointer-events: none;
}
.coin .coin-num { font-family: var(--display); line-height: 1; font-size: calc(var(--coin-size, 240px) * .46); }
.coin .coin-word { font-size: calc(var(--coin-size, 240px) * .05); letter-spacing: .24em; font-weight: 700; }
.coin-fly { animation: coinFly var(--coin-ms, 2600ms) cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes coinFly {
  0%   { transform: translate(0, var(--from-y, -640px)) scale(.5) rotateY(0deg); opacity: 0; }
  8%   { opacity: 1; }
  40%  { transform: translate(0, var(--hover-y, -30px)) scale(var(--peak, 1.7)) rotateY(1440deg); }
  78%  { transform: translate(0, var(--hover-y, -30px)) scale(calc(var(--peak, 1.7) - .08)) rotateY(1440deg); }
  100% { transform: translate(0, 0) scale(1) rotateY(1440deg); opacity: 1; }
}
.coin-flip { animation: coinFlip 1.4s cubic-bezier(.2,.8,.2,1); }
@keyframes coinFlip {
  0%   { transform: translateY(-120px) scale(.4) rotateY(0deg); opacity: 0; }
  15%  { opacity: 1; }
  65%  { transform: translateY(0) scale(1.25) rotateY(1080deg); }
  100% { transform: translateY(0) scale(1) rotateY(1080deg); }
}
.burst { position: absolute; inset: 0; border-radius: 50%; border: 4px solid var(--gold-light); z-index: 29; opacity: 0; animation: burst 1.1s ease-out .9s forwards; pointer-events: none; }
@keyframes burst { 0% { opacity: 1; transform: translateY(var(--hover-y, -30px)) scale(.4); } 100% { opacity: 0; transform: translateY(var(--hover-y, -30px)) scale(2.6); } }
.settle { animation: settle .7s ease-out; }
@keyframes settle {
  0% { transform: scale(.7); box-shadow: 0 0 0 0 rgba(245,184,61,.9); }
  55% { transform: scale(1.12); box-shadow: 0 0 70px 24px rgba(245,184,61,.6); }
  100% { transform: scale(1); box-shadow: 0 0 24px 4px rgba(245,184,61,.35); }
}
.dim-overlay { position: fixed; inset: 0; z-index: 20; background: rgba(10,6,25,.62); pointer-events: none; animation: dim var(--coin-ms, 2600ms) ease forwards; }
@keyframes dim { 0% { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
.lit { animation: lit .9s ease-out; }
@keyframes lit { 0% { transform: scale(1.6); box-shadow: 0 0 30px 10px rgba(255,210,122,.9); } 100% { transform: scale(1); } }
.pop { animation: pop .8s ease-out; }
@keyframes pop { 0% { transform: scale(1.5); box-shadow: 0 0 18px 6px rgba(255,210,122,.9); } 100% { transform: scale(1); } }
.shake { animation: shake .5s ease-in-out 2; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------- sparkles + rangoli ---------- */
.spark { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--gold-light); box-shadow: 0 0 10px 3px rgba(255,210,122,.7); animation: twinkle 3.2s ease-in-out infinite; pointer-events: none; }
@keyframes twinkle { 0%,100% { opacity: .15; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.25); } }
.rangoli { position: absolute; pointer-events: none; }

/* ---------- tickets ---------- */
.ticket { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.ticket-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 12px; }
.ticket-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; }
.cell { height: 34px; border-radius: 6px; border: 1px solid var(--line); color: var(--soft); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; background: transparent; font-family: var(--body); padding: 0; }
button.cell { cursor: pointer; }
.cell.blank { background: var(--bg); border-color: transparent; }
.cell.marked { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; box-shadow: 0 0 6px rgba(245,184,61,.5); }
.cell.called:not(.marked) { border-color: var(--gold-light); color: var(--gold-light); }
.ticket-hint { margin-top: 8px; font-size: 12px; color: var(--muted); }
.ticket-hint.near { color: var(--gold-light); }
.ticket-hint.done { color: var(--ok); }

/* ---------- toasts + modal ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 480px); }
.toast { background: var(--panel); border: 1px solid var(--gold); color: var(--cream); padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 14px; }
.toast.bad { border-color: var(--bad-strong); }
.toast.ok { border-color: var(--ok); }
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(5,3,15,.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px; padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }

canvas.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }

@media (prefers-reduced-motion: reduce) {
  .coin-fly, .coin-flip, .burst, .settle, .lit, .pop, .dim-overlay, .shake { animation-duration: .01ms !important; animation-delay: 0s !important; }
  .spark { animation: none; opacity: .5; }
}
