:root {
  --bg: #0d1b2a;
  --panel: #1b263b;
  --panel-2: #243049;
  --text: #e6edf3;
  --muted: #9aa6b2;
  --accent: #4ea1ff;
  --correct: #2ecc71;
  --wrong: #e74c3c;
  --border: #2d3a55;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.banner {
  position: relative;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 7;
  background: #74b9ff;
}
.banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(13, 27, 42, 0) 55%, rgba(13, 27, 42, 0.55) 100%);
  pointer-events: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.topbar h1 {
  font-size: 1.5rem;
  margin: 0;
}

.pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
/* Streak and plays are read-only badges — flatter, no border, slightly
   smaller — so the About button to their right reads as the only control. */
.streak, .plays {
  background: var(--panel-2);
  border: 1px solid transparent;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
}
.plays {
  color: var(--muted);
  font-weight: 500;
}
.plays:empty { display: none; }

/* About is a control: accent outline at rest, hover lift, info glyph. */
.about-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.about-btn:hover {
  background: rgba(78, 161, 255, 0.12);
  transform: translateY(-1px);
}
.about-btn:active { transform: translateY(0); }
.about-icon { font-size: 1.05em; line-height: 1; }

.about-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  max-width: 32rem;
  width: calc(100% - 2rem);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.about-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.about-content { padding: 1.5rem; margin: 0; }
.about-content p { line-height: 1.5; margin: 0 0 1.25rem; }
.about-content a { color: var(--accent); }
.about-content menu {
  display: flex;
  justify-content: flex-end;
  padding: 0;
  margin: 0;
}

.game, .gameover, .board {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.photo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

#photo {
  width: 240px;
  height: 300px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.choice {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.1s ease, border-color 0.1s ease;
  text-align: left;
}

.choice:hover:not(:disabled) {
  border-color: var(--accent);
}
.choice:active:not(:disabled) {
  transform: scale(0.98);
}
.choice:disabled { cursor: default; opacity: 0.85; }
.choice.correct { background: rgba(46, 204, 113, 0.18); border-color: var(--correct); }
.choice.wrong { background: rgba(231, 76, 60, 0.18); border-color: var(--wrong); }

.feedback {
  min-height: 1.4em;
  margin: 0.75rem 0 0;
  color: var(--muted);
  text-align: center;
}

/* Party colour swatches used in the feedback line. */
.party {
  font-weight: 700;
  padding: 0.05rem 0.45rem;
  border-radius: 6px;
  color: #0b1422;
  white-space: nowrap;
}
.party-snp        { background: #FDF38E; }                /* SNP yellow */
.party-labour     { background: #DC241F; color: #fff; }   /* Labour red */
.party-conservative { background: #0087DC; color: #fff; } /* Tory blue */
.party-libdem     { background: #FAA61A; }                /* Lib Dem orange */
.party-green      { background: #5FB44A; color: #fff; }   /* Greens green */
.party-reform     { background: #12B6CF; color: #0b1422; }/* Reform turquoise */
.party-alba       { background: #005EB8; color: #fff; }   /* Alba blue */
.party-other      { background: var(--panel-2); color: var(--text);
                    border: 1px solid var(--border); font-weight: 600; }

.gameover h2 { margin-top: 0; }

.perfect {
  background: linear-gradient(135deg, #2b1d52, #1b263b);
  border: 1px solid #6a4ed1;
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  box-shadow: 0 8px 30px rgba(106, 78, 209, 0.35);
  margin-bottom: 1.25rem;
  text-align: center;
}
.perfect-title {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #ffd166, #ef476f, #06d6a0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.perfect .submit-form { justify-content: center; }
.perfect .contact-line { text-align: center; }

.submit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin: 1rem 0;
}
.submit-form label {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.submit-form input {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 1rem;
}

button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  color: #0b1422;
  border-color: var(--accent);
  font-weight: 600;
}
button:hover { border-color: var(--accent); }

.leaderboard {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: rank;
}
.leaderboard li {
  display: flex;
  justify-content: space-between;
  padding: 0.55rem 0.25rem;
  border-bottom: 1px solid var(--border);
  counter-increment: rank;
}
.leaderboard li:last-child { border-bottom: none; }
.leaderboard li::before {
  content: counter(rank) ".";
  color: var(--muted);
  margin-right: 0.5rem;
  min-width: 1.6em;
}
.leaderboard .name { flex: 1; min-width: 0; }
.leaderboard .date {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0.75rem;
  white-space: nowrap;
}
.leaderboard .score { font-weight: 600; }
.leaderboard .loading { color: var(--muted); justify-content: center; }
.leaderboard .empty { color: var(--muted); justify-content: center; }

.show-more {
  display: block;
  margin: 0.75rem auto 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
}
.show-more:hover { color: var(--text); border-color: var(--muted); }

.footer {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.footer a { color: var(--accent); }
.footer p { margin: 0.25rem 0; }
.scraped-line { font-style: italic; opacity: 0.8; }

.contact-line {
  margin: 0.25rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.contact-line a { color: var(--accent); }

@media (max-width: 460px) {
  .choices { grid-template-columns: 1fr; }
  #photo { width: 200px; height: 250px; }
}
