/* Box Office styles. */
:root {
  --bg: #f6f5f8;
  --surface: #ffffff;
  --surface-2: #ebe9f0;
  --ink: #1a1140;
  --muted: #5e5486;
  --line: #dcd8e6;
  --brand: #c2410c;
  --on-brand: #ffffff;
  --gold: #f2a900;
  --ok: #17824f;
  --miss: #d8402c;
  --shadow: none;
  --display: 'Poppins', system-ui, sans-serif;
  --body: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #130c2e; --surface: #1e1546; --surface-2: #2a1f5c; --ink: #f5f0ff; --muted: #b0a4da; --line: #3a2d75;
    --brand: #ff9a3d; --on-brand: #1a0b2e; --gold: #ffc529; --ok: #3dd68c; --miss: #ff7461;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #130c2e; --surface: #1e1546; --surface-2: #2a1f5c; --ink: #f5f0ff; --muted: #b0a4da; --line: #3a2d75;
  --brand: #ff9a3d; --on-brand: #1a0b2e; --gold: #ffc529; --ok: #3dd68c; --miss: #ff7461;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: auto; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  padding-block: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background-image: url(bg-light.svg);
  background-size: 260px 260px;
  background-attachment: fixed;
}
:root[data-theme="dark"] body { background-image: url(bg-dark.svg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { background-image: url(bg-dark.svg); } }
/* cinema glow: a soft spotlight from the top plus a warm vignette at the bottom */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 38% at 50% -6%, color-mix(in srgb, var(--gold) 26%, transparent), transparent 70%),
    radial-gradient(ellipse 90% 40% at 50% 112%, color-mix(in srgb, var(--brand) 20%, transparent), transparent 70%);
}

body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
button, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; text-wrap: balance; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.app { display: flex; min-height: 100dvh; gap: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; max-width: 680px; margin-inline: auto; width: 100%; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(300px, 86vw);
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 18px calc(18px + env(safe-area-inset-left, 0px));
  background: var(--surface); border-right: 1.5px solid var(--line);
  display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
  transform: translateX(-102%); transition: transform .25s ease;
}
body.drawer .sidebar { transform: none; box-shadow: var(--shadow); }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(10, 5, 30, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.drawer .scrim { opacity: 1; pointer-events: auto; }
.brand { display: flex; flex-direction: column; gap: 2px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.brand .name { font: 26px/1 var(--display); color: var(--brand); }
.brand .hindi { font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button, .nav .navlink {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 12px;
  background: none; cursor: pointer; font-weight: 600; text-align: left;
}
.nav button:hover, .nav .navlink:hover { background: var(--surface-2); }
.nav button.active { background: var(--brand); color: var(--on-brand); }
.nav .ico { width: 24px; text-align: center; }
.side-about { margin-top: auto; padding: 14px; border-radius: var(--r); background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.side-about .tag { font-weight: 700; line-height: 1.35; }
.side-about small { color: var(--muted); line-height: 1.4; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 700; cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.side-foot { display: flex; gap: 8px; }

@media (min-width: 960px) {
  body { padding-left: calc(300px + 16px); }
  .sidebar { transform: none; box-shadow: none; }
  .scrim { display: none; }
  #menuBtn { display: none; }
  body::before { left: 0; right: 0; }
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
}
.iconbtn { width: 42px; height: 42px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 20px; line-height: 1; }
.topbar .title { flex: 1; min-width: 0; font: 22px/1 var(--display); color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { padding: 6px 11px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.toran { display: flex; height: 16px; overflow: hidden; margin-bottom: 14px; border-radius: 0 0 6px 6px; }
.toran i { flex: 0 0 22px; height: 16px; clip-path: polygon(0 0, 100% 0, 50% 100%); background: var(--brand); }
.toran i:nth-child(4n+2) { background: var(--gold); }
.toran i:nth-child(4n+3) { background: var(--ok); }
.toran i:nth-child(4n) { background: var(--ink); }

#view { flex: 1; padding-bottom: 28px; }
body.has-bar #view { padding-bottom: 12px; }

/* ---------- game ---------- */
.game { display: flex; flex-direction: column; gap: 14px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge { background: var(--ink); color: var(--bg); padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 14px; }
.date { color: var(--muted); font-size: 14px; }
.chip { margin-left: auto; font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip.open { border-style: solid; border-color: var(--gold); color: var(--ink); background: color-mix(in srgb, var(--gold) 20%, transparent); font-weight: 600; }

.hud { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.cell { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.cell .lab { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.clock, .pts { font: 28px/1 var(--display); font-variant-numeric: tabular-nums; }
.clock.low { color: var(--miss); animation: pulse 1s infinite; }
.pts { color: var(--brand); }
.pips { display: flex; gap: 5px; height: 28px; align-items: center; }
.pip { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line); }
.pip.miss { background: var(--miss); border-color: var(--miss); }
.pip.skip { background: var(--gold); border-color: var(--gold); }
.pip.win { background: var(--ok); border-color: var(--ok); transform: scale(1.2); }

.tickets { display: flex; flex-direction: column; gap: 10px; }
.ticket { display: grid; grid-template-columns: 58px 1fr; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.ticket .stub { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 0; background: var(--brand); color: var(--on-brand); border-right: 2px dashed color-mix(in srgb, var(--on-brand) 55%, transparent); }
.ticket .stub b { font: 22px/1 var(--display); }
.ticket .body { padding: 11px 14px 12px; min-width: 0; }
.ticket .kind { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); font-weight: 700; margin-bottom: 2px; }
.ticket p { font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.ticket.locked { box-shadow: none; background: transparent; border-style: dashed; opacity: .75; }
.ticket.locked .stub { background: var(--surface-2); color: var(--muted); border-right-color: var(--line); }
.ticket.locked .body { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.bar { height: 10px; border-radius: 6px; background: var(--surface-2); width: 90%; }
.bar.short { width: 55%; }
.ticket.fresh { animation: ticketIn .5s cubic-bezier(.2, .9, .3, 1.2); }

.tried { display: flex; flex-wrap: wrap; gap: 6px; }
.try { font-size: 13px; padding: 4px 10px; border-radius: 999px; font-weight: 600; }
.try.miss { background: color-mix(in srgb, var(--miss) 16%, transparent); color: var(--miss); }
.try.skip { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--ink); }

.startcard { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.startcard h2 { font: 26px/1.1 var(--display); }
.startcard p { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.big { min-height: 52px; font-size: 18px; }
.btn:active { transform: translateY(1px); }

/* ---------- guess bar ---------- */
.guessbar { position: sticky; bottom: 0; z-index: 15; padding: 10px 0 12px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
#guessform { position: relative; display: flex; gap: 8px; }
#guess { flex: 1; min-width: 0; height: 50px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--ink); background: var(--surface); font-size: 17px; }
#guess:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
#guessform .btn { height: 50px; padding: 0 16px; }
#guessform .nextclue { border-style: dashed; white-space: nowrap; }
#guessform .nextclue:disabled { opacity: .5; cursor: not-allowed; border-color: var(--line); }
.barnote { margin: 6px 2px 0; font-size: 13px; color: var(--muted); text-align: center; }
#guessform.shake { animation: shake .35s; }
.sugg { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow); max-height: 42vh; overflow-y: auto; }
.sugg li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px; border-radius: 8px; cursor: pointer; }
.sugg li span { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.sugg li small { color: var(--muted); white-space: nowrap; }
.sugg li:hover, .sugg li.on { background: var(--surface-2); }

/* ---------- results ---------- */
.result { position: relative; text-align: center; padding: 26px 18px 20px; border-radius: 20px; background: var(--ink); color: var(--bg); display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: var(--shadow); overflow: hidden; }
.rline { font: 22px/1.2 var(--display); color: var(--gold); }
.result.lost .rline { color: var(--miss); }
.rlabel { font-size: 14px; opacity: .85; }
.poster { font: clamp(28px, 8vw, 42px)/1.05 var(--display); text-wrap: balance; overflow-wrap: anywhere; animation: pop .6s cubic-bezier(.2, .9, .3, 1.3); }
.rmeta { font-size: 14px; opacity: .8; }
.bd { display: flex; gap: 8px; margin-top: 6px; width: 100%; }
.bd div { flex: 1; background: color-mix(in srgb, var(--bg) 14%, transparent); border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; }
.bd b { font: 22px/1.1 var(--display); }
.bd span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.bd .tot { background: var(--gold); color: #1a1140; }
.grid { margin: 8px 0 2px; font: 26px/1.2 var(--body); letter-spacing: 3px; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; position: relative; }
.result .btn:not(.primary) { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 50%, transparent); }

.panel { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.mini { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }
.panel .mini:first-child { margin-top: 0; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.statgrid b, .pts-panel b { display: block; font: 26px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.statgrid span, .pts-panel span { font-size: 11px; color: var(--muted); }
.dist { display: flex; flex-direction: column; gap: 5px; }
.drow { display: flex; align-items: center; gap: 8px; }
.dn { width: 14px; font-weight: 700; font-size: 14px; }
.dbar { display: block; min-width: 26px; background: var(--surface-2); border-radius: 6px; padding: 2px 8px; text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dbar i { font-style: normal; }
.drow.hl .dbar { background: var(--ok); color: #fff; }
.next { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; padding: 14px; border: 2px dashed var(--line); border-radius: var(--r); }
.next b { font: 26px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--brand); }
.next span { color: var(--muted); }
.recap { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 4px 12px 12px; }
.recap summary { cursor: pointer; font-weight: 700; padding: 10px 0; }
.game > .result, .game > .panel, .game > .next, .game > .recap { margin: 0; }

/* ---------- other pages ---------- */
.page { display: flex; flex-direction: column; gap: 14px; }
.page h1 { font: 30px/1.1 var(--display); }
.note { color: var(--muted); font-size: 15px; }
.pts-panel { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 6px; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.atile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; }
.atile b { font: 20px/1 var(--display); }
.atile span { font-size: 12px; color: var(--muted); }
.atile i { position: absolute; top: 8px; right: 10px; font-style: normal; font-size: 14px; }
.atile em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--ok); }
.atile.won { border-color: var(--ok); }
.atile.lost { border-color: var(--miss); }
.atile:hover { border-color: var(--brand); }
.empty p { color: var(--muted); }
.how { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.aboutline { font: 26px/1.2 var(--display); color: var(--brand); text-wrap: balance; }
.prose { display: flex; flex-direction: column; gap: 12px; }
.prose p { max-width: 62ch; }
.sel { user-select: all; font-weight: 700; }

/* ---------- overlays ---------- */
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 12px); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 5, 30, .6); }
.modal .card { width: min(440px, 100%); background: var(--surface); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.modal h2 { font: 24px/1.1 var(--display); }
.modal textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); color: var(--ink); font: 16px/1.4 var(--body); }
.confetti { position: fixed; inset: 0; z-index: 80; pointer-events: none; overflow: hidden; }
.confetti span { position: absolute; top: -40px; animation: fall linear forwards; }

@keyframes ticketIn { from { opacity: 0; transform: translateY(14px) rotate(-1.2deg) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 380px) {
  .clock, .pts { font-size: 24px; }
  #guessform .btn { padding: 0 12px; }
}

/* ---------- industry toggle + per-industry accent ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; }
.seg button { height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: 700 16px var(--body); cursor: pointer; }
.seg button.on { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow); }
html[data-ind="tollywood"] { --brand: #0a7a80; }
@media (prefers-color-scheme: dark) {
  html[data-ind="tollywood"]:not([data-theme="light"]) { --brand: #38d3cc; }
}
html[data-theme="dark"][data-ind="tollywood"] { --brand: #38d3cc; }

.btn.wa{background:#1fa855;border-color:#1fa855;color:#fff}
.nextclue.giveup{border-style:solid;color:var(--brand)}
.nav .navlink { text-decoration: none; color: var(--ink); }

/* daily-puzzle start card + points panel */
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.startcard p b { color: var(--ink); }
.formula .eq { font: 600 17px/1.5 var(--body); padding: 10px 12px; border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; }
.formula .eq i, .how2 i { font-style: italic; font-weight: 600; }
.how2 { margin: 10px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.ptable { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-variant-numeric: tabular-nums; font-size: 15px; }
.ptable th, .ptable td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); }
.ptable th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.chip.open { margin-left: auto; }
.nav .sndico { width: 24px; text-align: center; }
