:root {
  /* German flag: Schwarz · Rot · Gold */
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #141414;
  --muted: #6e6a62;
  --line: #e4dfd3;
  --black: #141414;
  --red: #dd0000;
  --gold: #ffce00;
  --gold-dark: #b38f00;
  --brand: #141414;        /* buttons, main text accents */
  --brand-2: #dd0000;      /* timers, live */
  --soft: #fff6cc;         /* light gold */
  --danger: #dd0000;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.ur { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif; line-height: 2.1; text-align: right; }
.de { color: var(--muted); font-size: .92em; }
.bi .ur { font-size: 1.08em; color: var(--ink); }

header.top {
  background: var(--black);
  color: #fff;
  padding: 18px 18px 14px;
  position: relative;
}
header.top::after {   /* flag stripe */
  content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 9px;
  background: linear-gradient(to bottom, var(--black) 0 33.3%, var(--red) 33.3% 66.6%, var(--gold) 66.6% 100%);
}
header.top h1 { color: #fff; }
header.top .sub { color: var(--gold); opacity: 1 !important; }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header.top h1 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: .2px; }
header.top .sub { font-size: .8rem; opacity: .8; }
header.top .who { font-size: .8rem; text-align: right; opacity: .95; }
header.top .who button { background: none; border: 0; color: #fff; opacity: .75; text-decoration: underline; font-size: .75rem; padding: 0; cursor: pointer; }

nav.tabs { display: flex; gap: 6px; padding: 20px 14px 0; max-width: 640px; margin: 0 auto; }
nav.tabs a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 12px 6px; font-size: .95rem; font-weight: 700;
}
nav.tabs a.on { background: var(--black); color: var(--gold); border-color: var(--black); }

main { max-width: 640px; margin: 0 auto; padding: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card h2 { margin: 0 0 4px; font-size: 1.05rem; }
.hint { color: var(--muted); font-size: .85rem; }
.center { text-align: center; }

label.f { display: block; margin: 14px 0 6px; font-weight: 600; font-size: .88rem; }
input.t, textarea.t, select.t {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input.t:focus, textarea.t:focus { outline: none; border-color: var(--gold-dark); box-shadow: 0 0 0 3px var(--soft); }
input.id { letter-spacing: .35em; font-variant-numeric: tabular-nums; text-align: center; font-size: 1.4rem; }

button.btn {
  display: block; width: 100%; margin-top: 16px; padding: 14px; font: inherit; font-weight: 700; font-size: 1rem;
  background: var(--brand); color: #fff; border: 0; border-radius: 12px; cursor: pointer;
}
button.btn:disabled { opacity: .5; cursor: default; }
button.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
button.btn.small { display: inline-block; width: auto; padding: 8px 14px; font-size: .85rem; margin-top: 0; }
.err { color: var(--danger); font-size: .9rem; margin-top: 10px; }
.ok { color: #1f7a3a; font-weight: 600; }

.big-time { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--red); margin: 6px 0; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--gold); color: var(--black); }
.pill.live { background: var(--red); color: #fff; }

/* Quiz */
.quizbar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0 8px; }
.quizbar .row { display: flex; align-items: center; justify-content: space-between; }
.timer { font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; color: var(--black); }
.timer.low { color: var(--danger); }
.dots { display: flex; gap: 5px; margin-top: 8px; }
.dots span { flex: 1; height: 28px; border-radius: 7px; background: #fff; border: 1.5px solid var(--line); cursor: pointer;
  display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.dots span.ans { background: var(--black); border-color: var(--black); color: var(--gold); }
.dots span.cur { outline: 2.5px solid var(--red); outline-offset: 1px; }
.qnum { font-size: .8rem; font-weight: 700; color: var(--red); letter-spacing: .05em; }
.qtext { margin: 6px 0 14px; }
.qtext .ur { font-size: 1.25rem; }
.qtext .de { font-size: 1rem; color: var(--ink); opacity: .8; margin-top: 2px; }
.opt {
  display: block; width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; cursor: pointer; font: inherit; color: inherit;
}
.opt .ur { font-size: 1.05rem; }
.opt .de { font-size: .9rem; }
.opt { position: relative; padding-left: 46px; }
.opt .tick { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff; }
.opt.sel { border-color: var(--black); background: var(--soft); box-shadow: inset 0 0 0 1.5px var(--black); }
.opt.sel .tick { background: var(--black); border-color: var(--black); color: var(--gold); }
.navrow { display: flex; gap: 10px; }
.navrow button { margin-top: 6px; }

/* Leaderboard */
table.lb { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.lb th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--line); }
table.lb td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
table.lb td.n { width: 34px; font-weight: 800; color: var(--muted); }
table.lb td.s { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
table.lb td.tm { text-align: right; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
table.lb tr.me td { background: var(--soft); }
.medal { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: .78rem; font-weight: 800; }
.m1 { background: #c9a227; } .m2 { background: #9aa3a8; } .m3 { background: #b07a4a; }
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: end; margin: 6px 0 14px; }
.podium > div { background: var(--soft); border-radius: 12px 12px 4px 4px; text-align: center; padding: 10px 6px; }
.podium > div { background: #f1eee7; }
.podium .p1 { padding-top: 22px; background: var(--soft); border-top: 4px solid var(--gold); }
.podium .nm { font-weight: 700; font-size: .85rem; word-break: break-word; }
.podium .sc { font-weight: 800; font-size: 1.2rem; color: var(--red); }
.weekchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.weekchips a { text-decoration: none; font-size: .82rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); background: #fff; }
.weekchips a.on { background: var(--black); color: var(--gold); border-color: var(--black); }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--black), var(--red), var(--gold)); }
footer { text-align: center; color: var(--muted); font-size: .75rem; padding: 18px 0 30px; }

.row2b { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2b .btn { margin-top: 12px; padding: 12px 8px; font-size: .92rem; }
.row2b .btn small { display: block; font-weight: 500; font-size: .75rem; opacity: .75; margin-top: 2px; }
.scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { min-width: 100%; }
table.grid th.c, table.grid td.c { text-align: center; padding: 8px 6px; font-variant-numeric: tabular-nums; }
table.grid td.miss { color: var(--line); }
table.grid .stick { position: sticky; left: 0; background: #fff; min-width: 110px; max-width: 150px; z-index: 1; }
table.grid tr.me .stick { background: var(--soft); }
.podium > div:empty { background: transparent; }

button.btn { background: var(--black); color: #fff; }
button.btn:not(.ghost):hover { background: #2a2a2a; }
button.btn.ghost { color: var(--black); border-color: var(--black); }
.navrow .btn:not(.ghost) { background: var(--red); }

header.top a.home { display: inline-block; color: #fff; opacity: .8; font-size: .75rem; text-decoration: none; margin-bottom: 4px; }
