/* Khel ON Daily — a calm evening table: navy room, one bright puzzle. */
:root {
  --desk: #141721; --desk-2: #1b1f2c; --panel: #20253a; --panel-2: #2a3049; --line: #363d5c;
  --ink: #f5f3ff; --muted: #a9abc6; --orange: #ff9a3c; --pink: #f04fa8; --violet: #8b5cf6; --teal: #2fd4c8;
  --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;
  --acc: var(--orange);
  color-scheme: dark;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--desk); color: var(--ink); font-family: var(--body); font-size: 16px; -webkit-tap-highlight-color: transparent; min-height: 100vh; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:focus-visible, a: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; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px; border-radius: 999px; font-family: var(--display); font-weight: 800; font-size: 17px; text-decoration: none; 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 { background: transparent; border: 2px solid var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.btn.wa { background: #1fae54; color: #fff; }

/* ---------- front door ---------- */
.home { max-width: 1120px; margin: 0 auto; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 30px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand img { display: block; height: 34px; width: auto; }
.top .tag { font-size: 13px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.today { display: flex; flex-direction: column; gap: 14px; }
.today-head { display: flex; flex-direction: column; gap: 6px; }
.kicker { font-weight: 800; color: var(--orange); letter-spacing: .02em; }
.today-head h1 { font-size: clamp(34px, 6vw, 56px); font-weight: 800; line-height: 1.02; }
.next { color: var(--muted); font-weight: 700; font-size: 15px; }
.tcard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-radius: 22px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 20px 50px rgba(0,0,0,.35); }
.tart { position: relative; min-height: 240px; background: #10131f; }
.tart svg { width: 100%; height: 100%; object-fit: cover; }
.tart::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 60px rgba(0,0,0,.35); pointer-events: none; }
.tbody { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 12px; }
.tline { font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--acc); }
.thow { color: var(--muted); line-height: 1.5; }
.size-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.size-l { display: flex; flex-direction: column; }
.size-l b { font-family: var(--display); font-size: 20px; }
.size-l span { color: var(--muted); font-size: 14px; font-weight: 700; }
.size-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.size-r .btn:not(.small) { min-width: 140px; }
.done { display: flex; flex-direction: column; align-items: flex-end; font-weight: 800; font-size: 14px; color: var(--muted); margin-right: 4px; }
.stars { color: #ffc23d; letter-spacing: 2px; font-size: 18px; }

.streak { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sbox { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.sbox b { font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1; }
.sbox span { color: var(--muted); font-weight: 700; font-size: 14px; }
.sbox.big { background: linear-gradient(160deg, rgba(255,154,60,.18), rgba(240,79,168,.12)), var(--panel); }
.sbox .flame { font-size: 22px; }

.week h2, .badges h2, .how h2 { font-size: 24px; font-weight: 800; }
.week .sub { color: var(--muted); margin: 6px 0 12px; }
.week-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); text-align: center; min-height: 140px; }
.day:hover { border-color: var(--muted); }
.day.is-today { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange) inset; }
.dname { font-weight: 800; font-size: 13px; color: var(--muted); }
.dicon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: color-mix(in srgb, var(--acc) 22%, transparent); font-size: 22px; }
.dtype { font-weight: 800; font-size: 13px; line-height: 1.15; }
.ticks { display: flex; gap: 5px; margin-top: auto; }
.ticks i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); }
.ticks i.on { background: var(--teal); border-color: var(--teal); }

.badges h2 span { color: var(--muted); font-size: 16px; font-weight: 700; margin-left: 6px; }
.badge-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 8px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); opacity: .5; }
.badge .bi { font-size: 28px; filter: grayscale(1); }
.badge b { font-size: 14px; }
.badge span:last-child { font-size: 12px; color: var(--muted); font-weight: 700; }
.badge.got { opacity: 1; border-color: rgba(255,194,61,.5); }
.badge.got .bi { filter: none; }

.how-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.hcard { display: flex; flex-direction: column; gap: 8px; padding: 0 0 14px; border-radius: 16px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.hcard .hart { aspect-ratio: 16 / 9; overflow: hidden; }
.hcard .hart svg { width: 100%; height: 100%; }
.hcard b, .hcard span { padding: 0 14px; }
.hcard b { font-family: var(--display); font-size: 18px; color: var(--acc); }
.hcard span { color: var(--muted); font-size: 14px; line-height: 1.45; }
.hcard.text { padding-top: 14px; }
.hcard.text b { color: var(--ink); }
.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 18px; }

/* ---------- playing ---------- */
#play { max-width: 760px; margin: 0 auto; padding: 10px 16px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: calc(100vh - 90px); }
.bar { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bar-t { display: flex; flex-direction: column; }
.bar-t b { font-family: var(--display); font-size: 24px; font-weight: 800; color: var(--acc); }
.bar-t span { color: var(--muted); font-weight: 700; font-size: 14px; }
.bar-n { display: flex; gap: 8px; }
.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; }
.goal { width: 100%; color: var(--muted); font-weight: 700; font-size: 15px; }
.stage { --bs: 340px; display: flex; justify-content: center; width: 100%; }
.grid { width: var(--bs); height: var(--bs); display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: repeat(var(--n), minmax(0, 1fr)); }
.cell { position: relative; display: grid; place-items: center; touch-action: manipulation; }
.cell svg { width: 100%; height: 100%; }
.cell.hint { animation: hintpulse .6s ease-in-out 4; z-index: 2; }
@keyframes hintpulse { 50% { box-shadow: 0 0 0 4px var(--teal), 0 0 26px var(--teal); } }

/* Diya Lights */
.diya-grid { gap: 8px; padding: 12px; border-radius: 22px; background: radial-gradient(circle at 50% 30%, #262c55, #12152a 75%); border: 1px solid var(--line); }
.cell.diya { border-radius: 16px; background: rgba(255,255,255,.04); transition: background .25s; }
.cell.diya.lit { background: radial-gradient(circle at 50% 55%, rgba(255,179,71,.28), rgba(255,179,71,.05) 70%); }
.cell.diya svg { width: 88%; height: 88%; }
.cell.diya.pop svg { animation: pop .28s ease-out; }
@keyframes pop { 40% { transform: scale(1.12); } }
.diya-svg.lit .flame { transform-origin: 50px 46px; animation: flicker 1.6s ease-in-out infinite; }
.diya-svg.lit .halo { animation: glow 2.4s ease-in-out infinite; }
@keyframes flicker { 0%,100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.04, .97) rotate(-2deg); } 60% { transform: scale(.97, 1.05) rotate(2deg); } }
@keyframes glow { 50% { opacity: .34; } }

/* Kolam Trail */
.trail-board { width: var(--bs); height: var(--bs); touch-action: none; user-select: none; -webkit-user-select: none; }
.trail-board svg { width: 100%; height: 100%; }
.trail-board .floor { fill: #7a3b2e; stroke: #5b2a20; stroke-width: 4; }
.trail-board .dot { fill: #e8c9ad; transition: fill .2s; }
.trail-board .dot.on { fill: #fff; }
.trail-board .dot.bad { fill: #ff5d5d; animation: shake .3s; }
.trail-board .line { fill: none; stroke: #fffaf0; stroke-width: 26; stroke-linecap: round; stroke-linejoin: round; opacity: .96; filter: drop-shadow(0 0 6px rgba(255,255,255,.25)); }
.trail-board .walls line { stroke: #2a0f0a; stroke-width: 13; stroke-linecap: round; }
.trail-board .num circle { fill: var(--pink); stroke: #fff; stroke-width: 4; }
.trail-board .num text { font-family: var(--display); font-weight: 800; font-size: 32px; fill: #fff; pointer-events: none; }
.trail-board .num.on circle { fill: #9e2f6c; }
.trail-board .num.next circle { animation: nextpulse 1.2s ease-in-out infinite; }
@keyframes nextpulse { 50% { stroke: #ffd27a; stroke-width: 8; } }
.trail-board .head { fill: #ffd27a; opacity: .9; pointer-events: none; }
.trail-board .ghost path { fill: none; stroke: #2fd4c8; stroke-width: 14; stroke-dasharray: 2 26; stroke-linecap: round; }
.trail-board .num, .trail-board .dot { pointer-events: none; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Thali Square */
.thali-grid { padding: 14px; border-radius: 50%/14%; border-radius: 26px; background: radial-gradient(circle at 50% 40%, #e9be5c, #b8892f 80%); box-shadow: inset 0 0 0 6px #9c7426, 0 14px 34px rgba(0,0,0,.4); gap: 3px; }
.tcell { background: #fbf2dc; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(120,80,20,.25); transition: background .15s; }
.tcell svg { width: 82%; height: 82%; }
.tcell.given { background: #f0d9a3; }
.tcell.given::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 7px; border-radius: 50%; background: #9c7426; }
.tcell.near { background: #fff8e8; }
.tcell.given.near { background: #f3dfaf; }
.tcell.same { box-shadow: inset 0 0 0 3px rgba(47,212,200,.75); }
.tcell.sel { box-shadow: inset 0 0 0 4px var(--teal); background: #fffbef; }
.tcell.bad { box-shadow: inset 0 0 0 4px #e5484d; background: #ffe3e0; }
.tcell.bl { margin-left: 5px; }
.tcell.bt { margin-top: 5px; }
.tray { width: 100%; display: flex; justify-content: center; }
.dishes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 620px; }
.dishbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 74px; padding: 6px 4px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); font-weight: 800; font-size: 12px; }
.dishbtn svg { width: 44px; height: 44px; }
.dishbtn.on { border-color: var(--teal); background: rgba(47,212,200,.14); }
.dishbtn.clear svg { width: 28px; height: 28px; margin: 8px 0; color: var(--muted); }

/* Nahar */
.nahar-grid { gap: 0; border-radius: 18px; overflow: hidden; border: 4px solid #6d5233; box-shadow: 0 14px 34px rgba(0,0,0,.4); }
.ncell { overflow: hidden; }
.ncell svg { width: 101%; height: 101%; }
.tile-svg .water line { transition: stroke .3s; }

/* sheets */
.scrim { position: fixed; inset: 0; z-index: 1000; background: rgba(8,10,18,.7); display: grid; place-items: center; padding: 16px; }
.box { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.box h2 { font-size: 26px; font-weight: 800; }
.box p { color: var(--muted); line-height: 1.5; }
.box .small, .small { font-size: 13px; color: var(--muted); }
.box .kick { color: var(--orange); font-weight: 800; font-size: 14px; }
.box .btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; }
.box .btns.col { flex-direction: column; align-items: stretch; }
.how-art { border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; }
.how-art svg { width: 100%; height: 100%; }
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 16px; background: var(--panel-2); border: 2px solid var(--line); text-align: left; }
.pick:hover { border-color: var(--teal); }
.pick b { font-family: var(--display); font-size: 18px; }
.pick span { color: var(--muted); font-weight: 700; font-size: 14px; }
.card-text { white-space: pre-wrap; background: var(--desk); border: 1px solid var(--line); border-radius: 14px; padding: 14px; font-family: var(--body); font-weight: 700; font-size: 15px; line-height: 1.5; margin: 0; }
.box.win { text-align: center; align-items: stretch; }
.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: #ffc23d; 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; }
.win-streak { font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--orange) !important; }
.newb { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: center; }
.newb b { width: 100%; font-size: 14px; color: var(--muted); }
.nb { background: rgba(255,194,61,.14); border: 1px solid rgba(255,194,61,.5); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 1100; 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; }
body.won .stage { animation: wonglow 1.4s ease-out; }
@keyframes wonglow { 30% { filter: brightness(1.25) drop-shadow(0 0 30px var(--acc)); } }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .tcard { grid-template-columns: 1fr; }
  .tart { min-height: 0; aspect-ratio: 16 / 9; }
  .streak { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-row { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 112px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
  .day { scroll-snap-align: start; }
  .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .size-r .btn:not(.small) { min-width: 0; flex: 1; }
  .size-row { flex-direction: column; align-items: stretch; }
  .size-r { justify-content: flex-start; }
  .done { align-items: flex-start; }
  .bar-t b { font-size: 20px; }
  .dishes { gap: 5px; flex-wrap: nowrap; }
  .dishbtn { width: calc((100vw - 32px - 30px) / 7); min-width: 0; font-size: 10px; padding: 5px 2px; border-radius: 12px; }
  .dishbtn svg { width: 34px; height: 34px; }
  .dishbtn.clear svg { width: 22px; height: 22px; margin: 6px 0; }
  .picks { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
