:root {
  --navy: #173865; --navy2: #24508f; --orange: #E23F0E; --bg: #f3f5fa; --card: #fff; --ink: #1b2437;
  --muted: #6a7389; --line: #e2e6ef; --ok: #14833b; --bad: #c62828; --gold: #f5b301;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px 130px; }
.wide { max-width: 1040px; padding-bottom: 60px; }
.muted { color: var(--muted); } .center { text-align: center; }

/* top bar + hero */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 680px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar.wide-bar .in { max-width: 1040px; }
.logo { height: 40px; width: auto; display: block; }
.tag { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hero { margin: 16px 0 18px; padding: 26px 22px; border-radius: 20px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%); box-shadow: 0 10px 30px -12px rgba(23,56,101,.6); }
.hero::after { content: ""; position: absolute; right: -50px; top: -50px; width: 190px; height: 190px; border-radius: 50%; background: var(--orange); opacity: .9; }
.hero::before { content: ""; position: absolute; right: 70px; bottom: -70px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.1); }
.hero > * { position: relative; z-index: 1; max-width: 85%; }
.hero h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; }
.hero p { margin: 0; opacity: .85; font-size: 14px; }
.steps { display: inline-flex; gap: 8px; margin-top: 14px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.steps span { background: rgba(255,255,255,.16); padding: 4px 10px; border-radius: 99px; }

/* search + list */
.searchbox { position: sticky; top: 0; z-index: 5; padding: 8px 0 10px; background: linear-gradient(var(--bg) 85%, transparent); }
input[type=search], input[type=password], input[type=text] { width: 100%; padding: 14px 16px; font-size: 16px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); outline: none; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
input:focus { border-color: var(--navy2); box-shadow: 0 0 0 3px rgba(36,80,143,.15); }
.count { font-size: 13px; color: var(--muted); margin: 4px 4px 8px; }
.list { display: grid; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 14px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; transition: border-color .12s, background .12s; }
.person.sel { border-color: var(--orange); background: #fff4f0; }
.person.dis { opacity: .4; cursor: not-allowed; }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.person .nm { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 14px; flex: none; color: #fff; }
.sel .tick { background: var(--orange); border-color: var(--orange); }

/* bottom bar */
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -12px rgba(0,0,0,.15);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); z-index: 10; }
.bar .in { max-width: 680px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.bar .txt { flex: 1; min-width: 0; font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; min-height: 26px; align-items: center; }
.chip { background: #fff4f0; color: var(--orange); border: 1px solid #f6c4b3; padding: 2px 10px; border-radius: 99px; font-weight: 600; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button { font: inherit; font-weight: 600; border: 0; border-radius: 14px; padding: 14px 22px; background: var(--orange); color: #fff; cursor: pointer; white-space: nowrap; }
button:disabled { background: #c9cfdb; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px 14px; font-weight: 500; }
.msg { padding: 12px 14px; border-radius: 12px; margin: 10px 0; background: #fdecea; color: var(--bad); }
.done { text-align: center; padding: 70px 10px; }
.done .big { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 44px; }
.done h2 { font-size: 26px; margin: 0 0 6px; }

/* admin */
.login { max-width: 360px; margin: 70px auto; display: grid; gap: 12px; background: #fff; padding: 28px; border-radius: 18px; border: 1px solid var(--line); }
.head { display: flex; align-items: center; justify-content: space-between; padding: 20px 0 6px; gap: 10px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 26px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; }
.stat b { display: block; font-size: 30px; color: var(--navy); line-height: 1.1; }
.tabs { display: inline-flex; background: #e6eaf3; padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tabs button { background: transparent; color: var(--muted); padding: 8px 18px; border-radius: 9px; }
.tabs button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.top10 { display: grid; gap: 10px; }
.row { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.row .fill { position: absolute; inset: 0 auto 0 0; background: rgba(36,80,143,.12); z-index: 0; transition: width .6s; }
.row > *:not(.fill) { position: relative; z-index: 1; }
.rank { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #e6eaf3; color: var(--navy); flex: none; }
.r1 .rank { background: var(--gold); color: #3a2b00; } .r2 .rank { background: #c9ced9; color: #222; } .r3 .rank { background: #d99a6c; color: #2e1a09; }
.row .nm { flex: 1; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.row .ct { font-size: 22px; font-weight: 700; color: var(--navy); }
.row.big { padding: 22px 22px; border-color: #c9d4e8; } .row.big .nm { font-size: 22px; } .row.big .ct { font-size: 28px; }
h2.sec { margin: 28px 0 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); } tr:last-child td { border: 0; }
td:first-child { width: 56px; color: var(--muted); } td.v { text-align: right; font-weight: 600; width: 100px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } .hero > * { max-width: 100%; } }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.pill.p { background: #e3f5e9; color: var(--ok); } .pill.a { background: #fdecea; color: var(--bad); }
.note { background: #fff8e1; border: 1px solid #f3e0a0; color: #6b5300; padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; }

/* qr */
.qrpage { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; background: #fff; }
.qrpage img.qr { width: min(60vh, 80vw); padding: 12px; border-radius: 20px; border: 6px solid var(--navy); }
.qrpage h1 { font-size: clamp(26px, 4.5vw, 52px); margin: 18px 0 14px; color: var(--navy); }
.qrpage .url { font-size: clamp(16px, 2.4vw, 28px); color: var(--orange); font-weight: 700; margin-top: 12px; }

/* ---- Diwali theme ---- */
.logo { height: 60px; }
.topbar .in { padding: 10px 16px; }
.lights { display: flex; justify-content: space-between; padding: 0 10px; height: 30px; overflow: hidden;
  background: linear-gradient(#fff, var(--bg)); border-bottom: 1px solid var(--line); position: relative; }
.lights::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: #b9962f; }
.lights i { display: block; width: 10px; height: 15px; margin-top: 4px; border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  animation: twinkle 1.6s ease-in-out infinite; position: relative; top: 2px; }
.lights i:nth-child(4n+1) { background: #ffb703; box-shadow: 0 0 8px 2px #ffb703; animation-delay: 0s; }
.lights i:nth-child(4n+2) { background: #ff5d3a; box-shadow: 0 0 8px 2px #ff5d3a; animation-delay: .4s; }
.lights i:nth-child(4n+3) { background: #ffe066; box-shadow: 0 0 8px 2px #ffe066; animation-delay: .8s; }
.lights i:nth-child(4n)   { background: #f06595; box-shadow: 0 0 8px 2px #f06595; animation-delay: 1.2s; }
@keyframes twinkle { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.hero .diya { position: absolute; right: 16px; bottom: 10px; width: 92px; max-width: none; z-index: 2; }
.diya svg, .big-diya svg { width: 100%; height: auto; display: block; overflow: visible; }
.flame { transform-origin: 60px 46px; animation: flicker 1.1s ease-in-out infinite alternate; }
.glow { animation: glow 1.8s ease-in-out infinite alternate; }
@keyframes flicker { 0% { transform: scale(1, 1) rotate(-2deg); } 100% { transform: scale(.92, 1.08) rotate(2deg); } }
@keyframes glow { 0% { opacity: .5; } 100% { opacity: 1; } }
.spark { position: absolute; z-index: 1; color: #ffd166; animation: twinkle 2s ease-in-out infinite; pointer-events: none; max-width: none !important; }
.hero .greet { display: inline-block; margin-bottom: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #ffd166; }

.done { position: relative; padding: 36px 10px 60px; }
.done .big-diya { width: 150px; margin: 6px auto 8px; }
.done h2 { font-size: 28px; margin: 6px 0; }
.done .wish { font-size: 20px; font-weight: 700; color: var(--orange); margin: 10px 0 6px; }
.crackers { font-size: 38px; letter-spacing: 8px; animation: pop 1.8s ease-in-out infinite; }
@keyframes pop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.done .float { position: absolute; font-size: 26px; animation: rise 3.6s ease-in infinite; opacity: 0; }
@keyframes rise { 0% { transform: translateY(30px) scale(.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-80px) scale(1.2); opacity: 0; } }
@media (max-width: 700px) { .hero { padding-right: 100px; } .hero > *:not(.diya):not(.spark) { max-width: 100%; } .hero .diya { width: 74px; right: 12px; } }
@media (prefers-reduced-motion: reduce) { .lights i, .flame, .glow, .spark, .crackers, .done .float { animation: none; } }
