/* =====================================================================
   THE PARLIAMENT CHALLENGE — STYLES
   Brand colours match the main Parla Domus app. To restyle the game,
   change the colour values in the :root block below.
   ===================================================================== */
:root {
  --green: #0F2E22;
  --green-2: #1A4436;
  --green-3: #235640;
  --gold: #C6A15B;
  --gold-light: #DCC48B;
  --ivory: #F7F4ED;
  --red: #7A1F32;
  --red-hover: #8E2540;
  --ok-line: #6CC391;
  --ok-fill: rgba(47, 122, 79, 0.38);
  --bad-line: #F0A0B0;
  --bad-fill: rgba(122, 31, 50, 0.5);
  --line: rgba(198, 161, 91, 0.32);
  --radius: 16px;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Libre Franklin', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--green);
  background-image: radial-gradient(1100px 520px at 50% -8%, #1f4e3b 0%, rgba(15, 46, 34, 0) 70%);
  background-repeat: no-repeat;
  color: var(--ivory);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }
a { color: var(--gold-light); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; margin: 0; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--gold); color: var(--green);
  padding: 10px 14px; border-radius: 8px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 3px; }

/* ---------- header / footer ---------- */
.site-header { padding: 14px 0 6px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-text, .game-brand { font-family: var(--font-display); letter-spacing: 0.06em; }
.brand-a { color: var(--ivory); font-weight: 700; }
.brand-b { color: var(--gold-light); font-style: italic; font-weight: 600; }
.brand-text { font-size: 1.25rem; }

.site-footer { margin-top: 36px; padding: 24px 0 calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(247, 244, 237, 0.1); }
.site-footer p { margin: 4px 0; font-size: 0.85rem; color: rgba(247, 244, 237, 0.65); }

/* ---------- stage (game area) ---------- */
.stage { margin-top: 10px; }
.screen { position: relative; text-align: center; }

.eyebrow {
  margin: 14px 0 6px; font-size: 0.75rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold);
}
.title { font-size: clamp(2rem, 8.6vw, 3.4rem); letter-spacing: 0.02em; }
.tagline { margin: 12px auto 0; max-width: 30em; font-size: clamp(1.05rem, 3.6vw, 1.3rem); color: var(--gold-light); font-family: var(--font-display); font-style: italic; font-weight: 600; }

.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; margin: 20px 0 24px; }
.chips li {
  border: 1px solid var(--line); background: rgba(247, 244, 237, 0.05); border-radius: 999px;
  padding: 6px 14px; font-size: 0.9rem; font-weight: 600;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border-radius: 12px; border: 1.5px solid var(--gold);
  font-family: var(--font-body); font-weight: 700; font-size: 1rem; letter-spacing: 0.06em;
  text-decoration: none; cursor: pointer; touch-action: manipulation; color: var(--ivory);
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--red); }
.btn-secondary { background: transparent; }
.btn-xl { width: 100%; max-width: 420px; min-height: 68px; font-size: 1.2rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: default; }
@media (hover: hover) {
  .btn-primary:hover { background: var(--red-hover); }
  .btn-secondary:hover { background: rgba(198, 161, 91, 0.14); }
}
.link-btn { background: none; border: 0; color: var(--gold-light); font: inherit; text-decoration: underline; cursor: pointer; margin-top: 10px; padding: 10px; min-height: 44px; }

.best-line { margin: 14px 0 0; font-weight: 700; letter-spacing: 0.08em; color: var(--gold-light); font-size: 0.95rem; }

.daily { margin: 26px auto 0; max-width: 420px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(247, 244, 237, 0.04); }
.daily-title { font-size: 1rem; letter-spacing: 0.14em; color: var(--gold); }
.daily-note { margin: 6px 0 12px; font-size: 0.92rem; color: rgba(247, 244, 237, 0.8); }
.kbd-hint { margin: 18px 0 0; font-size: 0.82rem; color: rgba(247, 244, 237, 0.55); }
@media (hover: none) { .kbd-hint { display: none; } }

/* ---------- game screen ---------- */
.game-brand { margin: 8px 0 12px; font-size: 0.78rem; letter-spacing: 0.18em; color: rgba(247, 244, 237, 0.7); }

.hud { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 8px; }
.hud-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 6px; background: var(--green-2); border: 1px solid var(--line); border-radius: 14px;
}
.hud-label { font-size: 0.68rem; letter-spacing: 0.2em; color: var(--gold-light); font-weight: 700; }
.hud-value { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 7.5vw, 2.4rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
.hud-time .hud-value { font-size: clamp(2.3rem, 11vw, 3.4rem); color: var(--ivory); }
.hud-time.is-low { border-color: var(--bad-line); }
.hud-time.is-low .hud-value { color: var(--bad-line); }
.hud-score .hud-value { color: var(--gold-light); }

.time-track { height: 6px; margin-top: 10px; background: rgba(247, 244, 237, 0.12); border-radius: 999px; overflow: hidden; }
.time-bar { height: 100%; width: 100%; background: var(--gold); border-radius: 999px; transition: width 0.1s linear; }

.q-wrap { position: relative; margin: 18px 0 14px; min-height: 5.4em; display: flex; align-items: center; justify-content: center; }
.question { font-size: clamp(1.2rem, 4.8vw, 1.7rem); font-weight: 700; line-height: 1.28; text-align: center; }

.answers { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) { .answers { grid-template-columns: 1fr 1fr; } }

.answer {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 14px;
  text-align: left; color: var(--ivory); font-family: var(--font-body); font-size: 1.05rem; line-height: 1.3;
  background: rgba(247, 244, 237, 0.06); border: 1.5px solid var(--line); border-radius: 14px;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}
.answer .key {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--gold); color: var(--gold-light); font-weight: 700; font-size: 0.95rem;
}
.answer .label { flex: 1 1 auto; }
.answer .mark { flex: 0 0 auto; min-width: 1.4rem; text-align: center; font-size: 1.5rem; font-weight: 700; }
@media (hover: hover) { .answer:not([aria-disabled="true"]):hover { background: rgba(198, 161, 91, 0.16); border-color: var(--gold); } }
.answer[aria-disabled="true"] { cursor: default; }
.answer.is-correct { background: var(--ok-fill); border-color: var(--ok-line); }
.answer.is-correct .mark { color: var(--ok-line); }
.answer.is-wrong { background: var(--bad-fill); border-color: var(--bad-line); }
.answer.is-wrong .mark { color: var(--bad-line); }
.answer.is-dim { opacity: 0.5; }

/* floating "+150" and streak bonus text */
.pop-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 3; }
.pop { position: absolute; left: 50%; font-weight: 800; white-space: nowrap; animation: floatUp 1s ease-out forwards; }
.pop-points { top: -2px; transform: translateX(-50%); color: var(--gold-light); font-size: 1.5rem; font-family: var(--font-display); }
.pop-streak { top: 30px; transform: translateX(-50%); color: var(--ivory); background: var(--red); border: 1px solid var(--gold); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; letter-spacing: 0.08em; }
@keyframes floatUp {
  0% { opacity: 0; margin-top: 12px; }
  15% { opacity: 1; }
  100% { opacity: 0; margin-top: -22px; }
}
.pb-chip {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%); z-index: 4;
  background: var(--gold); color: var(--green); font-weight: 800; font-size: 0.78rem; letter-spacing: 0.12em; padding: 5px 12px; border-radius: 999px;
}
.bump { animation: bump 0.28s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 45% { transform: scale(1.14); } 100% { transform: scale(1); } }

/* ---------- results screen ---------- */
.results-heading { font-size: clamp(2rem, 9vw, 3rem); letter-spacing: 0.04em; margin-top: 10px; }
.results-heading:focus { outline: none; }
.pb-banner { display: inline-block; margin: 12px 0 0; padding: 6px 16px; border-radius: 999px; background: var(--gold); color: var(--green); font-weight: 800; letter-spacing: 0.1em; }
.big-score { margin: 8px 0 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(3.6rem, 19vw, 6.4rem); line-height: 1; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.big-score-label { margin: 6px 0 0; color: rgba(247, 244, 237, 0.8); }
.res-label { margin: 10px 0 0; font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 1.25rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0 0; }
.stats div { background: var(--green-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; }
.stats dt { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-light); font-weight: 700; }
.stats dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }

.rank-line { margin: 22px 0 0; font-weight: 800; letter-spacing: 0.08em; }
.rank-msg { margin: 6px 0 0; font-size: 1.1rem; font-weight: 600; }
.rank-msg.tone-best, .rank-msg.tone-good { color: var(--gold-light); }
.section-title { font-size: 1.05rem; letter-spacing: 0.14em; color: var(--gold); margin: 22px 0 10px; }
.card .section-title { margin-top: 0; }

.card { margin: 22px 0 0; padding: 18px 16px; text-align: left; background: var(--green-2); border: 1px solid var(--line); border-radius: var(--radius); }
.card-intro { margin: 0 0 12px; color: rgba(247, 244, 237, 0.85); }
.fine { font-size: 0.8rem; color: rgba(247, 244, 237, 0.6); margin: 10px 0 0; }

/* ---------- form ---------- */
.field { margin: 0 0 12px; }
.field label { display: block; margin-bottom: 4px; font-size: 0.9rem; font-weight: 600; }
.opt { font-weight: 400; color: rgba(247, 244, 237, 0.6); }
.field input[type="text"], .field input[type="email"], .field select {
  width: 100%; min-height: 50px; padding: 10px 12px; font: inherit; font-size: 1rem; /* 16px stops iPhones zooming in */
  color: var(--ivory); background: rgba(247, 244, 237, 0.07); border: 1.5px solid rgba(247, 244, 237, 0.3); border-radius: 10px;
}
.field select option { color: #20242A; }
.field input[aria-invalid="true"] { border-color: var(--bad-line); }
.field-check { display: flex; align-items: flex-start; gap: 10px; }
.field-check input { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--gold); }
.field-check label { margin: 0; font-weight: 400; }
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.lead-status { min-height: 1.4em; margin: 10px 0 0; font-weight: 600; }
.lead-status.error { color: var(--bad-line); }
.lead-saved { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--ok-fill); border: 1px solid var(--ok-line); font-weight: 600; }

/* ---------- leaderboard ---------- */
.lb { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lb th { text-align: left; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-light); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.lb td { padding: 9px 8px; border-bottom: 1px solid rgba(247, 244, 237, 0.08); }
.lb .num { text-align: right; }
.lb tbody tr:nth-child(-n+3) td:first-child { color: var(--gold-light); font-weight: 800; }
.lb tr.is-you td { background: rgba(198, 161, 91, 0.2); font-weight: 800; border-bottom-color: var(--gold); }
.lb tr.is-you td:first-child { border-left: 4px solid var(--gold); }
.lb tr.is-local td { font-weight: 700; }
.lb tr.lb-gap td { text-align: center; color: rgba(247, 244, 237, 0.5); padding: 2px; letter-spacing: 0.3em; }
.lb-note { margin: 10px 0 0; font-size: 0.8rem; color: rgba(247, 244, 237, 0.6); }

/* ---------- share + CTA ---------- */
.share-text { margin: 0 0 12px; font-weight: 600; }
.share-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-buttons .btn { min-height: 48px; font-size: 0.9rem; }
.deeper-text { margin: 0 0 14px; font-family: var(--font-display); font-size: 1.15rem; line-height: 1.35; }

/* ---------- confetti (only on a personal best / #1) ---------- */
.confetti { position: absolute; inset: 0 0 auto 0; height: 0; pointer-events: none; overflow: visible; z-index: 5; }
.confetti span { position: absolute; top: 0; width: 8px; height: 14px; opacity: 0; animation: fall 2s ease-in forwards; }
@keyframes fall {
  0% { opacity: 0; translate: 0 0; }
  10% { opacity: 1; }
  100% { opacity: 0; translate: 0 320px; }
}

/* ---------- supporting text ---------- */
.about { margin: 38px 0 0; text-align: left; }
.about h2 { font-size: 1.5rem; margin-bottom: 10px; }
.about h3 { font-size: 1.1rem; margin: 22px 0 6px; color: var(--gold-light); }
.about p, .about li { color: rgba(247, 244, 237, 0.85); }
.about ul { padding-left: 1.2rem; margin: 6px 0; }
.about details { border-top: 1px solid rgba(247, 244, 237, 0.12); padding: 10px 0; }
.about details:last-of-type { border-bottom: 1px solid rgba(247, 244, 237, 0.12); }
.about summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.about details p { margin: 8px 0 0; }

/* ---------- small screens ---------- */
@media (max-width: 380px) {
  .wrap { padding: 0 12px; }
  .hud { gap: 6px; }
  .answer { font-size: 1rem; padding: 10px 12px; }
}

/* ---------- respect "reduce motion" settings ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
  .confetti { display: none; }
}
