/* Trivia Teach — dark, mobile-first */
:root {
  --bg: #0f1420;
  --bg-2: #161d2e;
  --card: #1b2336;
  --card-2: #212b42;
  --line: #2b3550;
  --text: #e8ecf4;
  --muted: #8b96ad;
  --accent: #6ea8ff;
  --good: #34c97b;
  --good-bg: rgba(52, 201, 123, .12);
  --bad: #ff6b6b;
  --bad-bg: rgba(255, 107, 107, .12);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[x-cloak] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px
           calc(env(safe-area-inset-bottom, 0px) + 28px) 16px;
  max-width: 860px;
  margin: 0 auto;
}

/* Header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 30px; }
.brand h1 { font-size: 22px; letter-spacing: .3px; }
.tagline { color: var(--muted); font-size: 13px; }

.tally { display: flex; align-items: center; gap: 8px; }
.pill {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--line);
}
.pill.good { color: var(--good); }
.pill.bad { color: var(--bad); }
.reset-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.reset-btn:hover { color: var(--text); border-color: var(--muted); }
.reset-btn.sure {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: var(--bad);
  width: auto;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 2px 12px;
}
.tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  touch-action: manipulation;
}
.tab:hover { color: var(--text); border-color: var(--muted); }
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #081120;
}
.tab-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--card-2);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--muted);
}
.tab.active .tab-count { background: rgba(8, 17, 32, .25); color: #081120; }

/* Quiz */
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 13px;
}
.progress { font-weight: 700; color: var(--accent); }
.blurb { text-align: right; }

.question {
  font-size: 21px;
  line-height: 1.35;
  margin-bottom: 18px;
}

.choices { display: grid; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: all .15s;
  touch-action: manipulation;
}
.choice:hover:not(:disabled) { border-color: var(--accent); background: var(--card-2); }
.choice:disabled { cursor: default; }
.key {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}
.choice-text { flex: 1; }
.choice.right {
  border-color: var(--good);
  background: var(--good-bg);
}
.choice.right .key { background: var(--good); color: #04150b; border-color: var(--good); }
.choice.wrong {
  border-color: var(--bad);
  background: var(--bad-bg);
}
.choice.wrong .key { background: var(--bad); color: #1a0505; border-color: var(--bad); }
.choice.dim { opacity: .45; }
.verdict { font-weight: 800; font-size: 17px; }
.verdict.ok { color: var(--good); }
.verdict.no { color: var(--bad); }

/* Teach panel */
.teach {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  animation: fadein .25s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.verdict-line { margin-bottom: 8px; }
.verdict-line.good { color: var(--good); }
.verdict-line.bad { color: var(--bad); }
.verdict-line .why { display: block; color: var(--muted); font-weight: 500; font-size: 13px; margin-top: 2px; }
.explain { color: var(--text); font-size: 15px; }
.ref {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.ref:hover { border-bottom-color: var(--accent); }
.next {
  display: block;
  width: 100%;
  margin-top: 14px;
  min-height: 50px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #081120;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.next:hover { filter: brightness(1.1); }

.foot { margin-top: 26px; text-align: center; color: var(--muted); font-size: 12px; }

@media (min-width: 640px) {
  .question { font-size: 24px; }
  .choices { grid-template-columns: 1fr 1fr; }
}
