/* Housie — Tambola night on the terrace: night sky, diya lights, a brass matka and a paper ticket. */
:root {
  --desk: #141721; --panel: #20253a; --panel-2: #2a3049; --line: #363d5c; --ink: #f5f3ff; --muted: #a9abc6;
  --orange: #ff9a3c; --pink: #f04fa8; --violet: #8b5cf6; --teal: #2fd4c8; --gold: #ffc23d;
  --grad: linear-gradient(100deg, var(--orange), var(--pink) 50%, var(--violet));
  --paper: #fbf0d8; --paper-2: #efd9ae; --paper-ink: #2a1a10;
  --display: "Outfit", "Trebuchet MS", system-ui, sans-serif; --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: radial-gradient(120% 60% at 80% 0%, #2a2244 0%, transparent 60%), var(--desk); background-attachment: fixed; color: var(--ink); font-family: var(--body); font-size: 16px; -webkit-tap-highlight-color: transparent; min-height: 100vh; -webkit-user-select: none; user-select: none; overflow-x: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 10px; }
button:disabled { cursor: default; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
p { margin: 0; }
svg { display: block; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: 999px; font-family: var(--display); font-weight: 800; font-size: 17px; color: var(--ink); white-space: nowrap; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(240, 79, 168, .28); }
.btn.teal { background: var(--teal); color: #08221f; }
.btn.ghost { border: 2px solid var(--line); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn.big { min-height: 56px; font-size: 20px; }
.btn:disabled { opacity: .45; }

/* ---------- play ---------- */
.play { max-width: 1180px; margin: 0 auto; padding: 0 12px 24px; display: flex; flex-direction: column; gap: 10px; }
.lights { height: 30px; margin: 0 -12px; overflow: hidden; }
.lights svg { width: 100%; height: 30px; }
.lights .bulb { animation: glow 3s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: -8px; }
.bar-t { display: flex; flex-direction: column; min-width: 0; }
.bar-t h1 { font-size: 24px; font-weight: 800; color: var(--orange); line-height: 1.1; }
.bar-t span { color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-n { display: flex; gap: 6px; flex: none; }
.pbtn svg, .cbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -4px; margin-right: 5px; }
.pbtn svg path:first-child { fill: currentColor; stroke: none; }
.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; }
.pbtn { min-height: 44px; }
.pbtn:not(:disabled):hover { border-color: var(--teal); }
.pbtn:disabled { opacity: 1; color: var(--muted); }
.layout { display: flex; flex-direction: column; gap: 10px; }
.col-a, .col-b { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* the caller */
.caller { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ball text" "ball btns"; gap: 8px 14px; align-items: center; background: linear-gradient(160deg, #2b2346, #20253a 60%); border: 1px solid var(--line); border-radius: 20px; padding: 12px 14px 16px; overflow: hidden; }
.matka { position: absolute; right: -14px; bottom: -18px; width: 120px; opacity: .22; pointer-events: none; }
.bigball { grid-area: ball; width: 96px; height: 96px; filter: drop-shadow(0 10px 18px rgba(0,0,0,.45)); }
.bigball svg { width: 100%; height: 100%; }
.bigball.pop { animation: pop .55s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes pop { 0% { transform: translateY(26px) scale(.4); opacity: 0; } 60% { transform: translateY(-4px) scale(1.08); opacity: 1; } 100% { transform: none; } }
.ctext { grid-area: text; min-width: 0; position: relative; }
.say { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.2; min-height: 2.4em; display: flex; align-items: center; }
.recent { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 6px; color: var(--muted); font-size: 12.5px; font-weight: 800; }
.recent span { margin-right: 2px; }
.recent b { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 999px; background: #fffaf0; color: #1d1730; font-family: var(--display); font-size: 14px; box-shadow: inset 0 0 0 3px var(--bc); }
.cbtns { grid-area: btns; display: flex; gap: 8px; position: relative; flex-wrap: wrap; }
.cbtn { min-height: 44px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); background: rgba(20,23,33,.55); font-weight: 800; font-size: 14.5px; }
.cbtn:hover { border-color: var(--teal); }
.cbtn[aria-pressed=false]#cVoice { color: var(--muted); }
.cbtn[aria-pressed=true]#cPause { background: var(--teal); color: #08221f; border-color: var(--teal); }
.cbar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255,255,255,.07); }
.cbar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .1s linear; }
.caller.paused .say { color: var(--muted); }

/* the ticket */
.tk-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 10px; }
.tk-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 8px; }
.tk-head h2 { font-size: 18px; }
.tog { min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--line); font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.tog[aria-pressed=true] { background: var(--teal); color: #08221f; border-color: var(--teal); }
.ticket { background: var(--paper); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; gap: 4px; box-shadow: inset 0 0 0 3px #e0b878, 0 10px 24px rgba(0,0,0,.35); position: relative; }
.ticket::before, .ticket::after { content: ""; position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); transform: translateY(-50%); }
.ticket::before { left: -7px; } .ticket::after { right: -7px; }
.trow { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.tc { position: relative; height: 46px; border-radius: 8px; background: #fffaf0; color: var(--paper-ink); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.tc b { position: relative; z-index: 1; }
.tc.blank { background: var(--paper-2); box-shadow: none; background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(160,110,40,.12) 6px 8px); }
.tc .stamp { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); animation: stampin .25s ease-out; }
@keyframes stampin { from { transform: scale(1.6); opacity: 0; } }
.tc.on b { color: #3a0d00; }
.tc.due { box-shadow: inset 0 0 0 3px var(--orange); animation: due 1.6s ease-in-out infinite; }
@keyframes due { 50% { box-shadow: inset 0 0 0 3px rgba(255,154,60,.35); } }
.tc.last { outline: 3px solid var(--pink); outline-offset: -1px; }
button.tc:active { transform: scale(.95); }
.tk-note { color: var(--muted); font-size: 13px; font-weight: 700; margin: 8px 2px 0; min-height: 1.2em; }
.tk-wait { color: var(--paper-ink); text-align: center; font-weight: 800; padding: 40px 10px; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* prizes */
.claims { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.claim { min-height: 64px; padding: 8px 12px; border-radius: 16px; background: var(--panel-2); border: 2px solid var(--line); text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px; transition: transform .1s, border-color .15s; }
.claim b { font-family: var(--display); font-size: 17px; font-weight: 800; }
.claim small { color: var(--muted); font-weight: 700; font-size: 12.5px; line-height: 1.25; }
.claim:not(:disabled):hover { border-color: var(--orange); }
.claim:not(:disabled):active { transform: scale(.97); }
.claim.full { grid-column: 1 / -1; background: linear-gradient(100deg, rgba(255,154,60,.22), rgba(240,79,168,.22) 50%, rgba(139,92,246,.22)); border-color: rgba(255,154,60,.55); }
.claim.full b { font-size: 20px; }
.claim.done { opacity: .62; background: var(--panel); }
.claim.done small { color: var(--ink); }
.claim.mine { opacity: 1; border-color: var(--teal); background: rgba(47,212,200,.12); }
.claim.pend { border-color: var(--gold); }
.claim.flash { animation: flash .9s; }
@keyframes flash { 30% { transform: scale(1.04); box-shadow: 0 0 0 6px rgba(255,194,61,.45); } }

/* players */
.players-wrap { display: flex; flex-direction: column; gap: 8px; }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.pl { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; background: var(--panel); border: 2px solid transparent; min-width: 0; }
.pl.me { border-color: var(--pc); }
.pl.lead b::after { content: " ★"; color: var(--gold); }
.pf { width: 30px; height: 30px; }
.pn { font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; line-height: 1.15; overflow-wrap: anywhere; }
.pl b { font-family: var(--display); font-size: 20px; }
.talkb { align-self: flex-start; }

/* the 1-90 board */
.board-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 6px 10px; }
.board-t { width: 100%; min-height: 44px; display: flex; justify-content: space-between; align-items: center; font-weight: 800; color: var(--ink); }
.board-t i { font-style: normal; color: var(--teal); font-size: 14px; }
.board { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; padding: 4px 0 8px; }
.board i { font-style: normal; display: grid; place-items: center; height: 30px; border-radius: 8px; background: rgba(255,255,255,.04); color: #6f7393; font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.board i.on { background: #fffaf0; color: #1d1730; box-shadow: inset 0 0 0 3px var(--bc); }
.board i.last { outline: 3px solid var(--pink); }

/* phone: the ticket and prizes come straight after the caller; the full board goes last */
@media (max-width: 899px) {
  .layout > .col-a, .layout > .col-b { display: contents; }
  .caller { order: 1; } .tk-wrap { order: 2; } .claims-sec { order: 3; } .players-wrap { order: 4; } .board-wrap { order: 5; }
  .claim .sh { display: none; }
  .claim { min-height: 54px; }
  .players { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .pl { flex-direction: row; justify-content: flex-start; gap: 8px; padding: 6px 10px; }
  .pl .pn { flex: 1; text-align: left; font-size: 13px; }
  .pl b { font-size: 18px; }
  .pf { width: 26px; height: 26px; flex: none; }
}
/* ---------- desktop ---------- */
@media (min-width: 900px) {
  .play { padding: 0 20px 30px; }
  .lights { margin: 0 -20px; height: 40px; } .lights svg { height: 40px; }
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
  .bar-t h1 { font-size: 30px; }
  .bigball { width: 132px; height: 132px; }
  .say { font-size: 25px; }
  .matka { width: 170px; opacity: .3; }
  .tc { height: 60px; font-size: 24px; }
  .claims { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .claim.full { grid-column: 1 / -1; }
  .board i { height: 34px; font-size: 14px; }
}
@media (max-width: 360px) {
  .play { padding: 0 8px 20px; } .lights { margin: 0 -8px; }
  .bigball { width: 78px; height: 78px; }
  .say { font-size: 17px; }
  .trow { gap: 3px; } .ticket { padding: 5px; gap: 3px; }
  .tc { height: 42px; font-size: 15px; border-radius: 6px; }
  .claim { padding: 8px 10px; } .claim b { font-size: 15.5px; }
  .bar-t h1 { font-size: 21px; }
  .pill { padding: 6px 10px; font-size: 13px; }
  .say { min-height: 0; }
  .cbtn { font-size: 13.5px; padding: 6px 10px; }
}

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 2147483000; background: rgba(8,10,18,.74); display: grid; place-items: center; padding: 14px; }
.box { width: min(480px, 100%); max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.box > * { flex-shrink: 0; }
.box.wide { width: min(600px, 100%); }
.box h2 { font-size: 25px; font-weight: 800; }
.box p { color: #d2d1e8; line-height: 1.5; }
.small { font-size: 13.5px; color: var(--muted) !important; }
.center { text-align: center; }
.kick { color: var(--orange) !important; font-weight: 800; font-size: 14px; }
.lab { font-weight: 800; font-size: 14px; color: var(--muted); margin-bottom: -4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); font-weight: 800; font-size: 14.5px; text-align: left; }
.chip[aria-pressed=true] { border-color: var(--teal); background: rgba(47,212,200,.14); }
.btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; }
.btns.col { flex-direction: column; align-items: stretch; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; color: #d2d1e8; line-height: 1.45; }
.steps li::marker { color: var(--orange); font-family: var(--display); font-weight: 800; }
.firsthow { background: var(--panel-2); border-radius: 14px; padding: 10px 14px; }
.firsthow summary { font-weight: 800; cursor: pointer; min-height: 32px; }
.firsthow .steps { margin-top: 8px; }
.phrases { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .phrases .btn { white-space: normal; text-align: center; min-height: 52px; font-size: 15px; }
.badges { display: grid; gap: 8px; }
.bdg { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--panel-2); opacity: .7; }
.bdg.on { opacity: 1; }
.bdg svg { width: 44px; height: 44px; flex: none; }
.bdg span { display: flex; flex-direction: column; }
.bdg small { color: var(--muted); font-weight: 700; }

/* win */
.box.win { text-align: center; }
.win-stars { display: flex; justify-content: center; gap: 8px; font-size: 52px; line-height: 1; }
.win-stars span { color: #3a4060; } .win-stars span.on { color: var(--gold); animation: starin .5s cubic-bezier(.2,1.6,.4,1) both; text-shadow: 0 0 20px rgba(255,194,61,.5); }
@keyframes starin { from { transform: scale(0) rotate(-40deg); } }
.win-line { font-weight: 800; color: var(--ink) !important; }
.podium { position: relative; max-width: 360px; width: 100%; margin: 0 auto; }
.podium svg { width: 100%; height: auto; }
.pnames { position: absolute; inset: auto 0 0 0; height: 0; }
.pnames span { position: absolute; width: 27.7%; font-weight: 800; font-size: 13px; line-height: 1.15; color: #1d1730; display: flex; flex-direction: column; align-items: center; overflow-wrap: anywhere; }
.pnames span b { font-family: var(--display); font-size: 16px; }
.pnames .p0 { left: 36.1%; bottom: 8px; } .pnames .p1 { left: 5.5%; bottom: 8px; } .pnames .p2 { left: 66.7%; bottom: 6px; }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.board-list li { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--panel-2); }
.board-list li.me { box-shadow: inset 0 0 0 2px var(--teal); }
.board-list .rk { font-family: var(--display); font-weight: 800; color: var(--orange); }
.board-list .nm { display: flex; flex-direction: column; font-weight: 800; min-width: 0; }
.board-list small { color: var(--muted); font-weight: 700; font-size: 12.5px; }
.board-list b { font-family: var(--display); font-size: 20px; }
.newb { display: flex; flex-direction: column; gap: 8px; text-align: left; }

.toast { position: fixed; left: 50%; bottom: calc(var(--kd-h, 70px) + 16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 2147483100; background: var(--ink); color: #141721; font-weight: 800; padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.45); max-width: calc(100vw - 28px); width: max-content; text-align: center; pointer-events: none; font-size: 15px; line-height: 1.3; }
.toast.good { background: var(--teal); }
.toast.bad { background: #ffb4c0; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 2147483200; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 105%; transform: translateX(40px) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .bigball.pop, .tc.due, .lights .bulb, .claim.flash { animation: none; } }
