:root {
  /* Burger King 2021 rebrand palette */
  --bk-red: #D62300;      /* Fiery Red */
  --bk-orange: #FF8732;   /* Flamin' Orange */
  --bk-yellow: #F5AA1C;   /* Melty Yellow */
  --bk-brown: #502314;    /* BBQ Brown */
  --bk-cream: #F5EBDC;    /* Mayo Egg White */
  --ok: #1c8a43; --bad: #c62828;
  --card: #ffffff; --ink: #502314; --muted: #97705b;
  --brand-font: "Baloo 2", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bk-cream); color: var(--ink);
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
h1, h2, .brand, button.primary, .navbtn, .seg button, .stat b, .timer-ring .num {
  font-family: var(--brand-font);
}
.hidden { display: none !important; }
header#topbar {
  position: sticky; top: 0; z-index: 10; display: flex;
  justify-content: space-between; align-items: center;
  background: var(--bk-red); color: #fff; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  font-weight: 700;
}
.top-actions { display: flex; gap: 8px; }
.chip {
  background: rgba(255,255,255,.18); color: #fff; border: 0;
  border-radius: 999px; padding: 6px 12px; font-weight: 700; cursor: pointer;
}
main { max-width: 720px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card); border-radius: 16px; padding: 20px;
  box-shadow: 0 2px 10px rgba(80,35,20,.08); margin-bottom: 14px;
}
h1 { font-size: 1.4rem; margin-bottom: 6px; }
h2 { font-size: 1.1rem; margin-bottom: 10px; }
.sub { color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
input, select, textarea {
  width: 100%; padding: 12px; border: 2px solid #e5d8c8; border-radius: 10px;
  font-size: 1rem; margin-bottom: 10px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--bk-orange); }
button.primary {
  width: 100%; padding: 14px; border: 0; border-radius: 999px;
  background: var(--bk-red); color: #fff; font-size: 1.05rem; font-weight: 800;
  cursor: pointer;
}
button.primary:disabled { opacity: .5; }
button.ghost {
  background: none; border: 2px solid var(--bk-red); color: var(--bk-red);
  border-radius: 999px; padding: 10px 14px; font-weight: 700; cursor: pointer;
}
.err { color: var(--bad); font-weight: 600; margin: 8px 0; }
.ok-msg { color: var(--ok); font-weight: 700; margin: 8px 0; }
/* login */
.login-wrap { min-height: 80vh; display: flex; align-items: center; }
.login-logo { font-size: 3rem; text-align: center; }
/* question */
.q-critical-banner {
  background: var(--bk-yellow); color: var(--bk-brown); border-radius: 14px;
  padding: 10px 12px; font-weight: 800; margin-bottom: 12px; font-size: .92rem;
}
.timer-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.timer-ring { position: relative; width: 74px; height: 74px; flex: none; }
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring .num {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 1.5rem; font-weight: 900;
}
.q-body { font-size: 1.15rem; font-weight: 700; line-height: 1.45; margin-bottom: 16px; }
.opt {
  display: block; width: 100%; text-align: left; padding: 14px 16px;
  border: 2px solid #e5d8c8; background: #fff; border-radius: 16px;
  font-size: 1rem; margin-bottom: 10px; cursor: pointer;
}
.opt.sel { border-color: var(--bk-red); background: #fdeae5; font-weight: 700; }
.result-big { text-align: center; padding: 26px 10px; }
.result-big .icon { font-size: 4rem; }
.result-big.good h1 { color: var(--ok); }
.result-big.bad h1 { color: var(--bad); }
.stat-row { display: flex; gap: 10px; }
.stat {
  flex: 1; background: #fff; border-radius: 14px; text-align: center;
  padding: 14px 6px; box-shadow: 0 2px 8px rgba(80,35,20,.07);
}
.stat b { display: block; font-size: 1.5rem; }
.stat small { color: var(--muted); }
/* tables */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 8px 6px; text-align: left; border-bottom: 1px solid #eee2d2; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
tr.me { background: #fdeee0; font-weight: 700; }
tr.top1 td:first-child::before { content: "🥇 "; }
tr.nq { opacity: .55; }
.badge { font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.badge.crit { background: #fde3c8; color: #a05a00; }
.badge.good { background: #d9f2e1; color: var(--ok); }
.badge.bad { background: #fbdcdc; color: var(--bad); }
.badge.off { background: #eee; color: #888; }
/* tabs */
.seg { display: flex; background: #ecdfcd; border-radius: 12px; padding: 4px; margin-bottom: 14px; overflow-x: auto; }
.seg button {
  flex: 1; border: 0; background: none; padding: 9px 10px; border-radius: 9px;
  font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
/* bottom nav */
nav#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: #fff; border-top: 1px solid #e8dccb; z-index: 10;
  padding-bottom: env(safe-area-inset-bottom);
}
nav#tabbar a {
  flex: 1; text-align: center; padding: 8px 0 6px; text-decoration: none;
  color: var(--muted); font-size: 1.25rem;
}
nav#tabbar a small { display: block; font-size: .62rem; font-weight: 700; }
nav#tabbar a.on { color: var(--bk-red); }
.offline {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99; text-align: center;
  background: var(--bad); color: #fff; font-weight: 700; padding: 8px; font-size: .85rem;
}
.spinner { text-align: center; padding: 40px; color: var(--muted); }
.row2 { display: flex; gap: 10px; } .row2 > * { flex: 1; }
.q-item { border: 1px solid #eee2d2; border-radius: 10px; padding: 10px; margin-bottom: 8px; font-size: .9rem; }
.q-item .meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.list-actions { display: flex; gap: 8px; margin-top: 8px; }
.list-actions button { font-size: .8rem; padding: 6px 10px; }
pre.rules { white-space: pre-wrap; font-family: inherit; line-height: 1.6; }

/* ---------- larger screens (laptop / desktop / tablet landscape) ---------- */
@media (min-width: 768px) {
  body { font-size: 1.05rem; }
  header#topbar { padding: 14px 24px; font-size: 1.1rem; }
  .chip { font-size: .95rem; padding: 8px 16px; }
  main { padding: 28px 24px; }
  h1 { font-size: 1.7rem; }
  .q-body { font-size: 1.3rem; }
  .opt { padding: 16px; font-size: 1.05rem; }
  .stat b { font-size: 1.9rem; }
  table { font-size: 1rem; }
  nav#tabbar {
    left: 50%; right: auto; transform: translateX(-50%);
    width: 100%; max-width: 720px;
    border: 1px solid #e8dccb; border-bottom: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 24px rgba(80,35,20,.10);
  }
  nav#tabbar a { padding: 12px 0 10px; font-size: 1.7rem; }
  nav#tabbar a small { font-size: .78rem; margin-top: 2px; }
  .login-wrap > div { max-width: 480px; margin: 0 auto; }
  .login-logo { font-size: 4rem; }
}

details.q-item summary { cursor: pointer; font-weight: 700; }
.hist-q { font-weight: 700; margin: 10px 0 8px; }
.hist-opt { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; border: 1px solid #eee2d2; font-size: .92rem; }
.hist-opt.mine-ok { border-color: var(--ok); background: #e9f7ee; font-weight: 700; }
.hist-opt.mine-bad { border-color: var(--bad); background: #fdecec; font-weight: 700; }

.btn-row { display: flex; gap: 10px; margin: 12px 0 16px; flex-wrap: wrap; }
.navbtn {
  display: inline-block; padding: 12px 20px; border-radius: 999px;
  background: #fff; border: 2px solid var(--bk-red); color: var(--bk-red);
  font-weight: 800; text-decoration: none; font-size: .95rem;
  box-shadow: 0 2px 8px rgba(80,35,20,.08);
}
.navbtn:active { background: #fdeae5; }

/* ---------- BK brand touches ---------- */
header#topbar { border-bottom: 4px solid var(--bk-yellow); }
.brand { letter-spacing: .5px; }
.card { border-radius: 20px; }
.stat { border-radius: 18px; border-bottom: 3px solid var(--bk-yellow); }
.stat b { color: var(--bk-red); }
.seg { background: #eadbc4; }
tr.top1 td { background: #fff7e8; }
.timer-ring circle:last-of-type { stroke: var(--bk-orange); }
input:focus, select:focus, textarea:focus { border-color: var(--bk-orange); }
button.primary:active { background: #b71d00; }
