/* KBC for VBN — shared theme. Dark "stage" look, VBN red + KBC gold. */
:root {
  --bg: #07040f; --bg2: #120a24; --panel: #1a1030; --panel2: #231640; --line: #3a2a5c;
  --text: #f4f1fa; --muted: #a99cc4; --red: #e0202e; --red2: #8f0f19; --gold: #f5c542; --gold2: #b8860b;
  --purple: #5b2bb5; --blue: #1f6feb; --green: #18b85a; --orange: #ff9a1f; --danger: #e5484d;
  --radius: 14px; --shadow: 0 10px 30px rgba(0,0,0,.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--text); font-size: 16px; line-height: 1.45;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(224,32,46,.28), transparent 60%),
              radial-gradient(900px 500px at 100% 100%, rgba(91,43,181,.35), transparent 60%), var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--gold); }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.hidden { display: none !important; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.gap { height: 14px; }

/* brand bar */
.brandbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: rgba(10,6,20,.75); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; letter-spacing: .3px; }
.brand img { height: 34px; background: #fff; border-radius: 8px; padding: 2px 6px; }
.brand-right { display: flex; align-items: center; gap: 10px; }
.rp-badge { height: 34px; width: auto; background: #fff; border-radius: 8px; padding: 2px 4px; }

/* buttons */
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel2); color: var(--text); padding: 10px 16px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; justify-content: center; text-decoration: none; transition: transform .08s, background .2s, border-color .2s; min-height: 42px; }
.btn:hover { border-color: var(--gold); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--red), var(--red2)); border-color: #ff4d5a; }
.btn.gold { background: linear-gradient(180deg, #ffd766, var(--gold2)); color: #1a1000; border-color: #ffe08a; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--danger); color: #ff8b8f; }
.btn.green { background: linear-gradient(180deg, #22d36b, #0f7d3c); border-color: #4be38b; }
.btn.sm { padding: 6px 12px; min-height: 32px; font-size: .88em; }
.btn.block { width: 100%; }
.icon-btn { background: none; border: 0; color: var(--text); font-size: 1.1em; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--panel2); }

/* forms */
label { display: block; font-size: .85em; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: #0d0819; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--red); transform: scale(1.15); }
input[type=color] { padding: 2px; height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; font-size: .95em; cursor: pointer; }

/* panels */
.card { background: linear-gradient(180deg, var(--panel), #140c26); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: 8px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78em; font-weight: 700; background: var(--panel2); border: 1px solid var(--line); }
.pill.live { background: var(--red); border-color: #ff5964; animation: pulse 1.6s infinite; }
.pill.green { background: #0f5f30; border-color: var(--green); }
.pill.gold { background: #4a3500; border-color: var(--gold); color: var(--gold); }
@keyframes pulse { 50% { opacity: .65; } }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .8em; text-transform: uppercase; letter-spacing: .5px; }
.table-wrap { overflow-x: auto; }

/* modal + toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); width: min(520px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px; overflow: auto; }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; width: min(420px, calc(100% - 32px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); box-shadow: var(--shadow); transition: opacity .3s, transform .3s; }
.toast.error { border-color: var(--danger); background: #3a0d12; }
.toast.success { border-color: var(--green); background: #0b3a1f; }
.toast.out { opacity: 0; transform: translateY(10px); }

/* ===== KBC components (stage + phone) ===== */
.kbc-q { position: relative; background: linear-gradient(180deg, #1b0f35, #0b0618); border: 2px solid var(--red); border-radius: 18px; padding: 18px 26px; text-align: center; font-weight: 700; box-shadow: 0 0 24px rgba(224,32,46,.35), inset 0 0 30px rgba(91,43,181,.25); }
.kbc-q::before, .kbc-q::after { content: ""; position: absolute; top: 50%; width: 6vw; max-width: 80px; height: 2px; background: var(--red); }
.kbc-q::before { right: 100%; } .kbc-q::after { left: 100%; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }
.opt { position: relative; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 26px; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer;
  background: linear-gradient(180deg, #1f1238, #0b0618); border: 0; clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 16px 100%, 0 50%);
  box-shadow: inset 0 0 0 2px var(--red); transition: background .25s, transform .1s; }
.opt::before { content: ""; position: absolute; inset: 0; clip-path: inherit; border: 2px solid var(--red); pointer-events: none; }
.opt .k { color: var(--gold); font-weight: 900; min-width: 1.4em; }
.opt .t { flex: 1; }
.opt img.opt-img { height: 54px; width: auto; border-radius: 6px; }
.opt.hidden-opt { color: transparent; }
.opt.sel { background: linear-gradient(180deg, #ffb347, #c76a00); color: #1a0d00; }
.opt.sel .k { color: #1a0d00; }
.opt.correct { background: linear-gradient(180deg, #2bdc74, #0c7a38); color: #fff; animation: flash .45s 3; }
.opt.correct .k { color: #fff; }
.opt.wrong { background: linear-gradient(180deg, #ff5a63, #8f0f19); }
.opt.removed { opacity: .15; pointer-events: none; }
.opt.dim { opacity: .55; }
.opt:disabled { cursor: default; }
@keyframes flash { 50% { filter: brightness(1.6); } }
.opt .bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--gold); transition: width .5s; }
.opt .pct { font-size: .85em; color: var(--gold); font-weight: 800; }
.opt.correct .pct, .opt.sel .pct { color: inherit; }

.timer-ring { --p: 1; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 1.9em;
  background: radial-gradient(closest-side, #12081f 78%, transparent 80% 100%), conic-gradient(var(--tc, var(--gold)) calc(var(--p) * 360deg), #2a1b47 0); box-shadow: 0 0 20px rgba(245,197,66,.35); }
.timer-ring.warn { --tc: var(--red); animation: pulse .5s infinite; }

.ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; gap: 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ladder li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 12px; border-radius: 999px; color: var(--muted); font-size: .9em; }
.ladder li.safe { color: #fff; }
.ladder li.done { color: var(--gold2); }
.ladder li.cur { background: linear-gradient(90deg, var(--orange), #ffcc66); color: #1a0d00; }

.lb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb li { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 12px; background: linear-gradient(90deg, #22143f, #120a24); border: 1px solid var(--line); }
.lb li .r { width: 2em; text-align: center; font-weight: 900; color: var(--gold); }
.lb li .n { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb li .s { font-weight: 900; font-variant-numeric: tabular-nums; }
.lb li.top1 { border-color: var(--gold); box-shadow: 0 0 18px rgba(245,197,66,.35); }
.team-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }

.rp-corner { pointer-events: none; position: fixed; right: 14px; bottom: 12px; display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 10px; padding: 4px 10px 4px 6px; color: #0a2a6b; font-size: .72em; font-weight: 700; z-index: 30; box-shadow: var(--shadow); }
.rp-corner img { height: 30px; }

.media { width: 100%; max-height: 42vh; border-radius: 12px; background: #000; display: block; border: 0; }
iframe.media { aspect-ratio: 16/9; height: auto; }
.media-audio { width: 100%; }

@media (max-width: 640px) {
  .opts { grid-template-columns: 1fr; gap: 10px; }
  .kbc-q { padding: 14px 16px; }
  .kbc-q::before, .kbc-q::after { display: none; }
  .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
