/* ===== Jain Dharma Live Quiz — black & gold theme, flat colours (no gradients) ===== */
:root {
  /* surfaces */
  --bg: #0c0c0c;           /* page black */
  --bg-soft: #161616;      /* raised black */
  --surface: #1e1c18;      /* dark panel */
  --gold-card: #e3c069;    /* flat gold card, like the app's news cards */
  --gold-card-edge: #c9a04a;

  /* accents */
  --gold: #e3c069;
  --gold-soft: #f2dda6;
  --gold-deep: #b8912f;

  /* text */
  --ink: #241a06;          /* text on gold */
  --ink-soft: #5c4a20;     /* secondary text on gold */
  --on-dark: #f2e3c0;      /* text on black */
  --muted: #9a8c72;        /* secondary text on black */

  /* answer colours (flat) */
  --ans-red: #b23a35;
  --ans-blue: #2f5aa8;
  --ans-amber: #c8901c;
  --ans-green: #2e7d4f;

  --ok: #3f9c68;
  --bad: #c0453f;

  --radius: 14px;
  --shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  --font: 'Segoe UI', 'Noto Sans Devanagari', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--on-dark);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;      /* avoids the mobile browser-bar jump */
  overflow-x: hidden;      /* nothing should ever scroll sideways */
}

/* long Hindi words and unbroken option text must wrap, not overflow */
h1, h2, h3, p, span, div, button, li, td { overflow-wrap: break-word; }

a { color: var(--gold); }

/* ---------- layout ---------- */
.wrap {
  max-width: 980px; margin: 0 auto;
  padding: clamp(14px, 4vw, 24px) clamp(12px, 4vw, 18px) 64px;
}
.wrap-wide { max-width: 1240px; }
.center-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 4vw, 20px);
}

.card {
  background: var(--gold-card);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 4.5vw, 24px);
  border: 1px solid var(--gold-card-edge);
}
.card + .card { margin-top: 16px; }

/* ---------- brand / header ---------- */
.brand { text-align: center; margin-bottom: 18px; }
.brand .om { font-size: clamp(34px, 10vw, 44px); line-height: 1; }
.brand h1 {
  margin: 8px 0 4px; font-size: clamp(21px, 6vw, 28px); letter-spacing: .5px; font-weight: 700;
  color: var(--gold);
}
.brand p { margin: 0; color: var(--muted); font-size: clamp(12.5px, 3.4vw, 14px); }

h2 { margin: 0 0 14px; font-size: clamp(18px, 5vw, 21px); color: var(--ink); }
h3 { margin: 0 0 10px; font-size: 16px; color: var(--ink); }
.muted { color: var(--ink-soft); font-size: 13px; }
.footer-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 20px; }

/* ---------- forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; padding: 13px 14px; font-size: 16px; font-family: var(--font);
  border: 1px solid #b99a52; border-radius: 10px;
  background: #fdf6e6; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(184, 145, 47, .25);
}
.pin-input {
  text-align: center; font-weight: 700; padding: 16px 8px;
  font-size: clamp(22px, 7.5vw, 30px);
  letter-spacing: clamp(4px, 3vw, 12px);
  text-indent: clamp(4px, 3vw, 12px);   /* re-centres text that letter-spacing pushes left */
}

/* Primary action: a black pill with gold text — strong on the gold cards,
   outlined and legible on the black page. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 18px; margin-top: 16px;
  font-size: 16px; font-weight: 700; font-family: var(--font);
  color: var(--gold); background: var(--bg-soft);
  border: 1px solid var(--gold-deep); border-radius: 10px; cursor: pointer;
  transition: background .15s, opacity .15s, transform .08s;
}
.btn:hover:not(:disabled) { background: #262320; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Secondary: outline. Adapts to whichever surface it sits on. */
.btn-ghost { background: transparent; color: var(--gold); border-color: #4a4335; }
.btn-ghost:hover:not(:disabled) { background: #1c1a17; }
.card .btn-ghost,
.question-box .btn-ghost,
.pin-display .btn-ghost { color: var(--ink); border-color: rgba(36, 26, 6, .45); }
.card .btn-ghost:hover:not(:disabled),
.question-box .btn-ghost:hover:not(:disabled) { background: rgba(36, 26, 6, .1); }

/* Solid gold: the one loud call to action on a black screen. */
.btn-dark { background: var(--gold); color: var(--ink); border-color: var(--gold-deep); }
.btn-dark:hover:not(:disabled) { background: var(--gold-soft); }

.btn-sm { width: auto; padding: 8px 14px; font-size: 13.5px; margin-top: 0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

.alert {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;
  background: #f6dcd9; color: #8e2b26; border: 1px solid #d9a29d;
}
.alert.ok { background: #dcefe2; color: #1f6b45; border-color: #a5cdb6; }
.alert:empty { display: none; }

/* ---------- home tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 6px; }
.tile {
  display: block; text-decoration: none; color: var(--ink);
  background: #eed296; border: 1px solid var(--gold-card-edge); border-radius: 12px; padding: 16px;
  transition: background .15s, transform .1s;
}
.tile:hover { background: #f5e2b8; transform: translateY(-2px); }
.tile .icon { font-size: 24px; }
.tile b { display: block; margin: 6px 0 3px; color: var(--ink); }
.tile span { font-size: 12.5px; color: var(--ink-soft); }

/* ---------- game chrome ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.chip {
  background: var(--bg-soft); border: 1px solid #3a3428;
  color: var(--on-dark); padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.chip.gold { background: var(--gold); color: var(--ink); border-color: var(--gold-deep); }

.timer-bar { height: 9px; background: #241f18; border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.timer-fill { height: 100%; width: 100%; background: var(--gold); transition: width 1s linear; }
.timer-fill.low { background: var(--bad); }

.question-box {
  background: var(--gold-card); color: var(--ink);
  border: 1px solid var(--gold-card-edge);
  border-radius: var(--radius); padding: clamp(16px, 4.5vw, 24px);
  box-shadow: var(--shadow); text-align: center;
}
.question-box .qtext { font-size: clamp(17px, 4.6vw, 23px); font-weight: 700; line-height: 1.4; }
.question-box .qhi { margin-top: 8px; font-size: clamp(14px, 3.8vw, 17px); color: var(--ink-soft); }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 2.5vw, 12px); margin-top: 16px; }
@media (max-width: 640px) { .options { grid-template-columns: 1fr; } }

.opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: clamp(13px, 3.6vw, 17px); font-size: clamp(14.5px, 3.9vw, 16.5px);
  font-weight: 600; font-family: var(--font); min-height: 52px;   /* comfortable tap target */
  color: #fff; border: 1px solid rgba(0, 0, 0, .35); border-radius: 12px; cursor: pointer;
  transition: transform .08s, opacity .15s, filter .15s;
}
.opt:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.1); }
.opt:disabled { cursor: default; }
.opt .badge {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px;
  background: rgba(0, 0, 0, .28); display: grid; place-items: center; font-size: 16px;
}
.opt-0 { background: var(--ans-red); }
.opt-1 { background: var(--ans-blue); }
.opt-2 { background: var(--ans-amber); }
.opt-3 { background: var(--ans-green); }
.opt.dimmed { opacity: .3; }
.opt.is-correct { outline: 3px solid var(--gold); opacity: 1; }
.opt.is-wrong { outline: 3px solid var(--bad); opacity: .5; }
.opt .count { margin-left: auto; font-size: 13.5px; background: rgba(0, 0, 0, .3); padding: 3px 10px; border-radius: 999px; }

.result-banner {
  text-align: center; padding: 20px; border-radius: var(--radius); color: #fff; font-weight: 800;
  font-size: 24px; box-shadow: var(--shadow);
}
.result-banner.good { background: var(--ok); }
.result-banner.bad { background: var(--bad); }
.result-banner .sub { display: block; font-size: 14.5px; font-weight: 600; margin-top: 6px; opacity: .95; }

.explain {
  background: #f3dfae; border-left: 4px solid var(--gold-deep);
  padding: 13px; border-radius: 8px; font-size: 14.5px; color: var(--ink);
}

/* ---------- lists / leaderboard ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 10px; background: #eed296; margin-bottom: 8px;
  border: 1px solid var(--gold-card-edge); font-weight: 600; color: var(--ink);
}
.list li .rank {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  background: var(--bg-soft); color: var(--gold); display: grid; place-items: center; font-size: 13px;
}
.list li.top1 .rank { background: var(--gold-deep); color: #1a1204; }
.list li.top2 .rank { background: #8f8f8f; color: #141414; }
.list li.top3 .rank { background: #9d6b3a; color: #191008; }
.list li .score { margin-left: auto; font-weight: 800; }
.list li.me { border-color: var(--bg-soft); border-width: 2px; }

.player-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  background: #eed296; border: 1px solid var(--gold-card-edge); border-radius: 999px;
  padding: 7px 14px; font-weight: 600; font-size: 13.5px; color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.pill .x { cursor: pointer; color: var(--bad); font-weight: 800; }

.pin-display {
  text-align: center; background: var(--gold-card); color: var(--ink);
  border: 1px solid var(--gold-card-edge);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.pin-display .label { font-size: clamp(11px, 3vw, 13px); color: var(--ink-soft); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; margin: 0; }
.pin-display .pin {
  font-size: clamp(32px, 11vw, 56px); font-weight: 800; line-height: 1.15;
  letter-spacing: clamp(3px, 2.4vw, 12px); text-indent: clamp(3px, 2.4vw, 12px);
}
.pin-display .muted { word-break: break-all; }

.big-count { font-size: clamp(60px, 22vw, 88px); font-weight: 800; color: var(--gold); text-align: center; }

.hidden { display: none !important; }

.spinner {
  width: 22px; height: 22px; border: 3px solid rgba(227, 192, 105, .25);
  border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pop { 0% { transform: scale(.94); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.pop { animation: pop .22s ease-out; }

/* ---------- small utilities (so no styles live inside the markup) ---------- */
.w-narrow { width: 100%; max-width: 460px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.max-420 { max-width: 420px; }
.max-440 { max-width: 440px; }
.max-520 { max-width: 520px; }
.max-560 { max-width: 560px; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.mt-8 { margin-top: 8px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.gap-18 { height: 18px; }
.icon-xl { font-size: 44px; }
.icon-lg { font-size: 50px; }
.spinner-dark { border-color: rgba(36, 26, 6, .2); border-top-color: var(--ink); margin: 22px auto; }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-weight: 500; color: var(--ink); }
.checkbox-row input { width: auto; }

/* ---------- Floating Audio Toggle ---------- */
.sound-toggle-btn {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 9999;
  background: var(--gold-card);
  color: var(--ink);
  border: 1px solid var(--gold-card-edge);
  border-radius: 50%;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: transform .2s, background-color .2s;
}
.sound-toggle-btn:hover {
  transform: scale(1.08);
  background: var(--gold-soft);
}

/* ---------- KBC Audience Poll Bar Chart ---------- */
.kbc-poll-card {
  background: #181612;
  border: 2px solid var(--gold-deep);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 16px;
  color: var(--on-dark);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75);
}
.kbc-poll-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #332d20; padding-bottom: 10px; margin-bottom: 16px;
}
.kbc-poll-title { font-size: 16.5px; font-weight: 700; color: var(--gold); margin: 0; }
.kbc-poll-total { font-size: 13px; color: var(--muted); font-weight: 600; }

.kbc-poll-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  height: 200px; align-items: end; padding: 10px 0;
}
.kbc-bar-col {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%;
}
.kbc-bar-pct { font-size: 15px; font-weight: 800; color: var(--gold-soft); margin-bottom: 6px; }
.kbc-bar-track {
  width: 100%; max-width: 60px; height: 130px; background: #26231c; border-radius: 8px 8px 0 0;
  display: flex; align-items: flex-end; overflow: hidden; border: 1px solid #3d3628;
  position: relative;
}
.kbc-bar-fill {
  width: 100%; background: #e3c069;
  border-radius: 6px 6px 0 0; transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.kbc-bar-col.is-correct .kbc-bar-fill {
  background: #3f9c68;
  box-shadow: 0 0 12px rgba(63, 156, 104, 0.6);
}
.kbc-bar-col.is-correct .kbc-bar-pct { color: #79c996; font-size: 17px; }
.kbc-bar-col.dimmed { opacity: 0.65; }
.kbc-bar-label {
  margin-top: 8px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold-card); color: var(--ink); font-weight: 800; font-size: 15px;
  display: grid; place-items: center; border: 2px solid var(--gold-deep);
}
.kbc-bar-col.is-correct .kbc-bar-label {
  background: #2e7d4f; color: #fff; border-color: #79c996;
}
.kbc-bar-votes { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 600; }

/* ================= responsive ================= */

/* tablets and small laptops */
@media (max-width: 900px) {
  .topbar { gap: 8px; }
  .chip { font-size: 12.5px; padding: 6px 11px; }
}

/* phones */
@media (max-width: 640px) {
  .topbar { justify-content: center; }
  .chip { flex: 0 1 auto; }

  /* stacked, full-width buttons are easier to hit than a cramped row */
  .btn-row { flex-direction: column; }
  .btn-row .btn { width: 100%; }

  .result-banner { font-size: 20px; padding: 16px; }
  .result-banner .sub { font-size: 13.5px; }

  .tiles { grid-template-columns: 1fr; }

  .list li { padding: 10px 11px; font-size: 14px; gap: 10px; }
  .list li .rank { width: 26px; height: 26px; flex-basis: 26px; font-size: 12px; }

  .explain { font-size: 13.5px; }
  .footer-note { font-size: 12px; }
}

/* very small phones (320–360px) */
@media (max-width: 380px) {
  .chip { font-size: 11.5px; padding: 5px 9px; }
  .opt { gap: 9px; }
  .opt .badge { width: 26px; height: 26px; flex-basis: 26px; font-size: 14px; }
  .opt .count { font-size: 12px; padding: 2px 8px; }
  .pill { font-size: 12.5px; padding: 6px 11px; }
}

/* phones held sideways — keep the question and answers on one screen */
@media (max-height: 480px) and (orientation: landscape) {
  .brand { margin-bottom: 10px; }
  .brand .om { display: none; }
  .wrap { padding-top: 10px; padding-bottom: 24px; }
  .question-box { padding: 14px; }
  .options { grid-template-columns: 1fr 1fr; }
  .opt { min-height: 44px; padding: 10px 12px; }
  .big-count { font-size: 54px; }
}

/* respect a reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
