/* Bindu Ghar — a chalk slate in the courtyard on a Diwali night. */
:root {
  --desk: #141721; --panel: #20253a; --panel-2: #2a3049; --line: #363d5c; --ink: #f5f3ff; --muted: #a9abc6;
  --orange: #ff9a3c; --pink: #f04fa8; --violet: #8b5cf6; --teal: #2fd4c8; --acc: #f04fa8;
  --grad: linear-gradient(100deg, var(--orange), var(--pink) 50%, var(--violet));
  --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(90% 50% at 50% 0%, rgba(240, 79, 168, .1), transparent 70%), var(--desk); 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; }
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:disabled { opacity: .45; cursor: default; }

/* ---------- playing ---------- */
.play { max-width: 760px; margin: 0 auto; padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bar-t { display: flex; flex-direction: column; min-width: 0; }
.bar-t b { font-family: var(--display); font-size: 22px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bar-t span { color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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; }
.scores { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 8px; }
.sc { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 8px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); min-width: 0; transition: border-color .2s, box-shadow .2s, transform .2s; }
.sc svg { flex: none; }
.sc .nm { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.sc .nm b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc .nm small { font-size: 11.5px; color: var(--muted); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc .pts { margin-left: auto; font-family: var(--display); font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.sc.turn { border-color: var(--pc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 35%, transparent), 0 8px 22px -10px var(--pc); transform: translateY(-1px); }
.sc.turn .nm small { color: var(--pc); }
.scores.many .sc { flex-direction: column; align-items: center; padding: 6px 4px; gap: 2px; text-align: center; }
.scores.many .sc .pts { margin: 0; font-size: 22px; }
.scores.many .sc .nm { align-items: center; width: 100%; }
.scores.many .sc .nm b { white-space: normal; font-size: 13px; line-height: 1.1; min-height: 2.2em; display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere; }
.arena { display: flex; flex-direction: column; gap: 10px; }
.side { display: contents; }
.scores { order: 1; } .board-wrap { order: 2; } .msg { order: 3; }
.board-wrap { display: flex; justify-content: center; }
.board { width: min(100%, 640px, calc(100svh - 250px)); min-width: min(100%, 280px); height: auto; touch-action: manipulation; }
.board .trk { stroke: rgba(245, 243, 255, .16); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 1 13; }
.board .ln { stroke-width: 11; stroke-linecap: round; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); animation: draw .28s ease-out; }
.board .ln.last { stroke-width: 13; animation: draw .28s ease-out, lastglow 1.6s ease-in-out .3s infinite; }
@keyframes draw { from { stroke-dasharray: 0 200; } to { stroke-dasharray: 200 0; } }
@keyframes lastglow { 50% { filter: drop-shadow(0 0 8px rgba(255,255,255,.85)); } }
.board .ghost { stroke-width: 11; stroke-linecap: round; opacity: .45; pointer-events: none; }
.board .hit { fill: rgba(0, 0, 0, 0); cursor: pointer; }
.board .hit:focus { outline: none; }
.board .hit:focus-visible { fill: rgba(47, 212, 200, .14); }
.board .dot, .board .house, .board .ln, .board .trk { pointer-events: none; }
.board .house.fresh { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.2); opacity: 0; } }
.board.wait .hit { cursor: default; }
.msg { text-align: center; color: #d2d1e8; font-weight: 800; min-height: 24px; }
.msg b { color: var(--pc, var(--ink)); }

/* ---------- sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 2147483000; background: rgba(8,10,18,.72); display: grid; place-items: center; padding: 14px; }
.box { width: min(480px, 100%); max-height: calc(100vh - 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,.5); }
.box h2 { font-size: 25px; font-weight: 800; }
.box p { color: #d2d1e8; line-height: 1.5; }
.small { font-size: 13px; color: var(--muted); }
.kick { color: var(--acc); font-weight: 800; font-size: 14px; }
.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; line-height: 1.45; color: #d2d1e8; }
.lab { font-weight: 800; font-size: 14px; color: var(--muted); margin-top: 4px; }
.chips { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 8px; }
.chip { min-height: 52px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel-2); font-weight: 800; font-size: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; padding: 4px; }
.chip small { font-size: 11.5px; color: var(--muted); font-weight: 800; }
.chip small.st { color: #ffc23d; letter-spacing: 1px; }
.chip[aria-pressed="true"] { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 18%, var(--panel-2)); box-shadow: 0 0 0 3px rgba(240, 79, 168, .25); }
.win-stars { display: flex; justify-content: center; gap: 8px; font-size: 54px; line-height: 1; }
.win-stars span { color: #3a3f5e; }
.win-stars span.on { color: #ffc23d; animation: star .5s cubic-bezier(.3, 1.6, .5, 1) both; text-shadow: 0 0 18px rgba(255, 194, 61, .6); }
@keyframes star { from { transform: scale(.2) rotate(-40deg); opacity: 0; } }
.final { display: flex; flex-direction: column; gap: 6px; }
.final div { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: var(--panel-2); font-weight: 800; }
.final div b { margin-left: auto; font-family: var(--display); font-size: 22px; }
.final div.top { box-shadow: 0 0 0 2px #ffc23d inset; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 10px 8px; border-radius: 16px; background: var(--panel-2); border: 2px solid var(--line); }
.badge svg { width: 46px; height: 46px; }
.badge b { font-size: 14px; line-height: 1.2; }
.badge small { font-size: 12px; color: var(--muted); font-weight: 700; line-height: 1.3; }
.badge.off { opacity: .45; filter: grayscale(1); }
.badge.new { border-color: #ffc23d; animation: star .5s both; }
.starrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.starrow div { background: var(--panel-2); border-radius: 14px; padding: 8px; text-align: center; font-weight: 800; }
.starrow div span { display: block; color: #ffc23d; letter-spacing: 2px; font-size: 18px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 2147483100; background: #f5f3ff; color: #141721; font-weight: 800; padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: calc(100vw - 32px); text-align: center; pointer-events: none; }
body.won .board { animation: cheer .8s ease-in-out 2; }
@keyframes cheer { 50% { transform: scale(1.02); filter: drop-shadow(0 0 22px rgba(255, 194, 61, .5)); } }
@media (max-width: 380px) { .play { padding: 6px 8px 12px; gap: 8px; } .sc { padding: 5px 8px 5px 6px; } .sc .pts { font-size: 22px; } .chip { font-size: 14px; } }
@media (min-width: 900px) {
  .play { max-width: 1100px; padding-top: 16px; } .bar-t b { font-size: 26px; }
  .arena { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
  .side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 12px; }
  .scores, .scores.many { grid-template-columns: 1fr; }
  .scores.many .sc { flex-direction: row; padding: 8px 12px 8px 10px; gap: 8px; text-align: left; }
  .scores.many .sc .pts { margin-left: auto; font-size: 26px; }
  .scores.many .sc .nm { align-items: flex-start; width: auto; }
  .scores.many .sc .nm b { min-height: 0; font-size: 14px; justify-content: flex-start; }
  .msg { text-align: left; font-size: 17px; }
  .board { width: min(100%, 680px, calc(100svh - 170px)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
.sc.me .nm small { color: var(--teal); }
