/* The Ultimate Pub Quiz
   A responsive, accessible, static quiz app. The CSS uses only original
   gradients, shapes, and animations: no copyrighted images or audio files. */

:root {
  --bg: #070018;
  --bg-deep: #020008;
  --panel: #10072a;
  --panel-strong: #19083e;
  --panel-soft: #f6fbff;
  --text: #f8fbff;
  --text-muted: #c8d2ff;
  --ink: #05010f;
  --gold: #faff00;
  --gold-dark: #d1ff00;
  --teal: #00f5ff;
  --mint: #39ff14;
  --rose: #ff2bd6;
  --red: #ff1744;
  --green: #39ff14;
  --blue: #7c4dff;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.48), 0 0 28px rgba(0, 245, 255, 0.16);
  --focus: #ffffff;
  --radius: 8px;
  --max-width: 1180px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(0, 245, 255, 0.16) 0 1px, transparent 1px 90px),
    linear-gradient(180deg, rgba(255, 43, 214, 0.12) 0 1px, transparent 1px 70px),
    radial-gradient(circle at 20% 8%, rgba(57, 255, 20, 0.25), transparent 26%),
    radial-gradient(circle at 84% 18%, rgba(255, 43, 214, 0.3), transparent 28%),
    radial-gradient(ellipse at top, #22005a 0%, var(--bg) 44%, var(--bg-deep) 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(115deg, transparent 0 27%, rgba(0, 245, 255, 0.18) 28% 35%, transparent 36%),
    linear-gradient(245deg, transparent 0 26%, rgba(255, 43, 214, 0.22) 27% 35%, transparent 36%),
    radial-gradient(circle at 50% 104%, rgba(250, 255, 0, 0.18), transparent 42%);
  pointer-events: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

img,
svg {
  max-width: 100%;
}

caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 0.8rem 1rem;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--mint));
  border-radius: var(--radius);
  transform: translateY(-150%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.stage-background {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.light-rig {
  position: absolute;
  top: 18px;
  left: 50%;
  display: grid;
  width: min(760px, 88vw);
  height: 32px;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(3, 0, 14, 0.72);
  box-shadow: 0 0 30px rgba(0, 245, 255, 0.2);
  border-radius: var(--radius);
  transform: translateX(-50%);
}

.light-rig span {
  display: block;
  min-width: 0;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(250, 255, 0, 0.98), 0 0 34px rgba(250, 255, 0, 0.42);
  animation: marqueePulse 2.4s ease-in-out infinite;
}

.light-rig span:nth-child(2n) {
  background: var(--teal);
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.98), 0 0 34px rgba(0, 245, 255, 0.42);
  animation-delay: 0.4s;
}

.light-rig span:nth-child(3n) {
  background: var(--rose);
  box-shadow: 0 0 16px rgba(255, 43, 214, 0.98), 0 0 34px rgba(255, 43, 214, 0.42);
  animation-delay: 0.8s;
}

.spotlight {
  position: absolute;
  top: 0;
  width: 34vw;
  height: 100vh;
  opacity: 0.42;
  background: linear-gradient(to bottom, rgba(250, 255, 0, 0.35), rgba(250, 255, 0, 0));
  filter: blur(1px);
  transform-origin: top center;
  animation: spotlightSweep 7s ease-in-out infinite alternate;
}

.spotlight-left {
  left: 8vw;
  clip-path: polygon(42% 0, 62% 0, 100% 100%, 0 100%);
  transform: rotate(-18deg);
}

.spotlight-right {
  right: 8vw;
  clip-path: polygon(38% 0, 58% 0, 100% 100%, 0 100%);
  background: linear-gradient(to bottom, rgba(0, 245, 255, 0.3), rgba(0, 245, 255, 0));
  transform: rotate(18deg);
  animation-delay: 1.5s;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0;
  backdrop-filter: blur(8px);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.brand-badge {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--mint));
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(250, 255, 0, 0.22), 0 0 24px rgba(57, 255, 20, 0.34), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.icon-button {
  min-height: 44px;
  padding: 0.65rem 0.9rem;
  color: var(--text);
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.35);
  border-radius: var(--radius);
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.12);
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button:hover {
  background: rgba(255, 43, 214, 0.18);
  transform: translateY(-1px);
}

main {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.screen {
  animation: screenIn 260ms ease both;
}

.screen[hidden] {
  display: none;
}

.hero-screen {
  min-height: calc(100vh - 98px);
  display: grid;
  align-content: center;
  gap: 2rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 2rem;
  align-items: center;
}

.hero-copy,
.screen-heading {
  max-width: 760px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.75rem;
  color: var(--teal);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 10ch;
  margin: 0;
  color: var(--white);
  font-size: 4.4rem;
  line-height: 0.98;
  letter-spacing: 0;
  text-shadow: 0 0 14px rgba(0, 245, 255, 0.82), 0 0 30px rgba(255, 43, 214, 0.6), 0 18px 42px rgba(0, 0, 0, 0.5);
}

h2 {
  margin: 0;
  font-size: 2.3rem;
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.hero-description,
.screen-heading p,
.form-hint,
.result-message {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.hero-actions,
.form-actions,
.result-actions,
.scoreboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.hero-actions {
  margin-top: 1.7rem;
}

.button {
  min-height: 48px;
  padding: 0.85rem 1.15rem;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  border: 0;
  border-radius: var(--radius);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--mint));
  box-shadow: 0 0 20px rgba(250, 255, 0, 0.35), 0 10px 24px rgba(57, 255, 20, 0.18);
}

.button-secondary {
  color: var(--ink);
  background: linear-gradient(135deg, var(--teal), #b8f7ff);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.34), 0 10px 24px rgba(0, 245, 255, 0.16);
}

.button-ghost {
  color: var(--text);
  background: rgba(124, 77, 255, 0.16);
  border: 1px solid rgba(255, 43, 214, 0.34);
  box-shadow: 0 0 16px rgba(255, 43, 214, 0.12);
}

.button-danger {
  color: var(--white);
  background: linear-gradient(135deg, #ff1744, #ff6b00);
  box-shadow: 0 0 20px rgba(255, 23, 68, 0.28);
}

.button:disabled {
  opacity: 0.5;
  transform: none;
}

.quiz-sign {
  position: relative;
  width: min(100%, 420px);
  margin-left: auto;
  padding: 1.2rem;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(5, 1, 15, 0.12) 0 2px, transparent 2px 26px),
    linear-gradient(135deg, var(--gold), var(--teal) 52%, var(--rose));
  border: 8px solid #05010f;
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 34px rgba(255, 43, 214, 0.36), inset 0 0 0 2px rgba(255, 255, 255, 0.55);
  text-align: center;
  transform: rotate(1.3deg);
}

.quiz-sign::before,
.quiz-sign::after {
  content: "";
  position: absolute;
  top: -26px;
  width: 58px;
  height: 18px;
  background: #05010f;
  border-radius: 4px;
}

.quiz-sign::before {
  left: 16%;
}

.quiz-sign::after {
  right: 16%;
}

.sign-top,
.sign-bottom {
  font-weight: 900;
  text-transform: uppercase;
}

.sign-main {
  margin: 0.2rem 0;
  color: #05010f;
  font-size: 6rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.42);
}

.sign-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
  color: var(--text);
}

.sign-row span {
  padding: 0.65rem;
  background: #05010f;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 245, 255, 0.48), 0 0 18px rgba(0, 245, 255, 0.22);
  font-size: 0.9rem;
  font-weight: 800;
}

.how-to {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 1.2rem;
  align-items: start;
  padding: 1.2rem 0 0;
}

.steps-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps-list li,
.form-panel,
.question-card,
.results-card,
.review-card,
.score-table-wrap,
.empty-state {
  background: rgba(9, 4, 32, 0.86);
  border: 1px solid rgba(0, 245, 255, 0.22);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32), 0 0 22px rgba(124, 77, 255, 0.16);
}

.steps-list li {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
}

.steps-list span:last-child {
  color: var(--text-muted);
  line-height: 1.5;
}

.step-number {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  background: linear-gradient(135deg, var(--teal), var(--mint));
  border-radius: 50%;
  font-weight: 900;
}

.setup-screen,
.review-screen,
.scoreboard-screen {
  padding-top: 2rem;
}

.screen-heading {
  margin-bottom: 1.25rem;
}

.setup-form {
  display: grid;
  gap: 1rem;
}

.form-panel {
  padding: 1rem;
}

.player-panel {
  display: grid;
  gap: 0.5rem;
  max-width: 540px;
}

label,
legend {
  font-weight: 800;
}

legend {
  padding: 0 0.4rem;
}

input[type="text"],
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 0.95rem;
  color: var(--text);
  background: rgba(0, 245, 255, 0.08);
  border: 1px solid rgba(0, 245, 255, 0.32);
  border-radius: var(--radius);
}

textarea {
  min-height: 126px;
  resize: vertical;
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: rgba(200, 210, 255, 0.72);
}

.form-hint,
.setup-message {
  margin: 0;
  font-size: 0.95rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.7rem;
}

.category-option input,
.segmented-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.category-option span {
  display: grid;
  min-height: 92px;
  align-content: center;
  gap: 0.5rem;
  padding: 0.9rem;
  color: var(--text);
  background: linear-gradient(145deg, rgba(0, 245, 255, 0.09), rgba(255, 43, 214, 0.1));
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: var(--radius);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.category-option span::before {
  content: attr(data-icon);
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--rose));
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(250, 255, 0, 0.28);
  font-size: 0.82rem;
  font-weight: 900;
}

.category-option:hover span,
.category-option input:focus-visible + span {
  transform: translateY(-2px);
  border-color: rgba(250, 255, 0, 0.82);
}

.category-option input:checked + span {
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--mint));
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(250, 255, 0, 0.38), 0 0 34px rgba(57, 255, 20, 0.16);
}

.setup-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.segmented-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.segmented-options span {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  padding: 0.65rem 0.9rem;
  color: var(--text);
  background: rgba(124, 77, 255, 0.16);
  border: 1px solid rgba(0, 245, 255, 0.22);
  border-radius: var(--radius);
  transition: background 160ms ease, transform 160ms ease;
}

.segmented-options label:hover span,
.segmented-options input:focus-visible + span {
  transform: translateY(-1px);
}

.segmented-options input:checked + span {
  color: var(--ink);
  background: linear-gradient(135deg, var(--teal), var(--mint));
  border-color: var(--teal);
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.28);
}

.toggle-panel {
  display: flex;
  align-items: center;
}

.toggle-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: center;
  width: 100%;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
}

.toggle-ui {
  position: relative;
  width: 58px;
  height: 32px;
  background: rgba(255, 43, 214, 0.18);
  border: 1px solid rgba(255, 43, 214, 0.36);
  border-radius: 999px;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 180ms ease, background 180ms ease;
}

.toggle-row input:checked + .toggle-ui {
  background: linear-gradient(135deg, var(--teal), var(--mint));
}

.toggle-row input:checked + .toggle-ui::after {
  background: var(--ink);
  transform: translateX(26px);
}

.toggle-row input:focus-visible + .toggle-ui {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.toggle-row small {
  display: block;
  margin-top: 0.18rem;
  color: var(--text-muted);
  font-weight: 500;
}

.setup-message {
  min-height: 1.4rem;
  color: var(--gold);
  font-weight: 800;
}

.quiz-shell {
  display: grid;
  gap: 1rem;
  max-width: 900px;
  margin: 1.5rem auto 0;
}

.quiz-status-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.85rem;
  align-items: stretch;
}

.quiz-status-bar > div,
.timer-box {
  min-width: 150px;
  padding: 0.85rem 1rem;
  background: rgba(9, 4, 32, 0.88);
  border: 1px solid rgba(0, 245, 255, 0.24);
  border-radius: var(--radius);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.12);
}

.status-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

#score-display.score-pop {
  animation: scorePop 420ms ease both;
}

.timer-box strong {
  font-size: 1.55rem;
}

.timer-box.timer-warning {
  color: var(--ink);
  background: var(--gold);
  box-shadow: 0 0 24px rgba(250, 255, 0, 0.48);
  animation: timerPulse 900ms ease-in-out infinite;
}

.timer-box.timer-expired {
  color: var(--white);
  background: linear-gradient(135deg, var(--red), var(--rose));
  box-shadow: 0 0 24px rgba(255, 23, 68, 0.44);
}

.progress-track {
  height: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.22);
  border-radius: 999px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--rose));
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.42);
  transition: width 260ms ease;
}

.live-scoreboard {
  padding: 1rem;
  background: rgba(9, 4, 32, 0.86);
  border: 1px solid rgba(0, 245, 255, 0.22);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32), 0 0 22px rgba(124, 77, 255, 0.16);
}

.live-scoreboard-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.live-scoreboard-heading p {
  margin: 0;
  color: var(--gold);
  font-weight: 900;
}

.live-scoreboard-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
}

.live-scoreboard-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 0.75rem;
  align-items: center;
  min-height: 72px;
  padding: 0.75rem;
  background: rgba(124, 77, 255, 0.16);
  border: 1px solid rgba(0, 245, 255, 0.2);
  border-radius: var(--radius);
}

.live-scoreboard-row.is-active {
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--mint));
  border-color: var(--gold);
  box-shadow: 0 0 22px rgba(250, 255, 0, 0.32);
}

.live-scoreboard-row.is-awarded {
  border-color: var(--mint);
  box-shadow: 0 0 22px rgba(57, 255, 20, 0.34);
}

.live-scoreboard-row span:first-child {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-scoreboard-row strong {
  grid-row: span 2;
  min-width: 42px;
  text-align: right;
  font-size: 1.75rem;
  line-height: 1;
}

.live-scoreboard-row .player-attempts {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.live-scoreboard-row.is-active .player-attempts {
  color: rgba(5, 1, 15, 0.72);
}

.award-point-button {
  grid-column: 1 / -1;
  min-height: 38px;
  padding: 0.5rem 0.7rem;
  color: var(--ink);
  background: linear-gradient(135deg, var(--teal), var(--mint));
  border: 0;
  border-radius: 6px;
  font-weight: 900;
}

.award-point-button:hover:not(:disabled) {
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.36);
  transform: translateY(-1px);
}

.award-point-button:disabled {
  opacity: 0.52;
}

.live-scoreboard-row.is-awarded .award-point-button {
  opacity: 1;
  background: linear-gradient(135deg, var(--gold), var(--mint));
}

.question-card {
  padding: 1.4rem;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.meta-pill {
  padding: 0.35rem 0.55rem;
  color: var(--ink);
  background: linear-gradient(135deg, var(--mint), var(--teal));
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(57, 255, 20, 0.24);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: capitalize;
}

#question-text {
  margin-bottom: 1rem;
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.answer-button {
  min-height: 74px;
  padding: 1rem;
  color: var(--text);
  background: linear-gradient(145deg, rgba(0, 245, 255, 0.1), rgba(124, 77, 255, 0.16));
  border: 2px solid rgba(0, 245, 255, 0.22);
  border-radius: var(--radius);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.answer-button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--gold);
}

.answer-button.is-selected {
  border-color: var(--gold);
  background: rgba(250, 255, 0, 0.16);
  box-shadow: 0 0 22px rgba(250, 255, 0, 0.2);
}

.answer-button.is-correct {
  color: var(--ink);
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 26px rgba(57, 255, 20, 0.44);
  animation: correctAnswer 500ms ease both;
}

.answer-button.is-wrong {
  color: var(--white);
  background: linear-gradient(135deg, #ff1744, #ff2bd6);
  border-color: var(--red);
  box-shadow: 0 0 24px rgba(255, 23, 68, 0.36);
  animation: wrongAnswer 420ms ease both;
}

.answer-button.reveal-correct {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(250, 255, 0, 0.36);
}

.feedback-message {
  min-height: 1.8rem;
  margin: 1rem 0 0;
  color: var(--text);
  font-weight: 800;
}

.next-button {
  margin-top: 0.9rem;
}

.results-screen {
  position: relative;
  display: grid;
  min-height: calc(100vh - 120px);
  place-items: center;
}

.results-screen[hidden] {
  display: none;
}

.results-card {
  width: min(720px, 100%);
  padding: 1.5rem;
  text-align: center;
}

.score-ring {
  display: grid;
  width: 170px;
  height: 170px;
  margin: 1.4rem auto 1rem;
  place-items: center;
  color: var(--ink);
  background:
    radial-gradient(circle at center, #f8fbff 0 48%, transparent 49%),
    conic-gradient(var(--teal) var(--score-angle, 0deg), rgba(255, 255, 255, 0.18) 0);
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.08), 0 0 34px rgba(0, 245, 255, 0.28);
}

.score-ring span {
  font-size: 2.2rem;
  font-weight: 950;
}

.result-message {
  margin: 0.2rem 0 1rem;
  color: var(--gold);
  font-size: 1.35rem;
  font-weight: 900;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1rem 0 1.2rem;
}

.results-stats div {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.results-stats dt {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.results-stats dd {
  margin: 0.25rem 0 0;
  font-weight: 900;
}

.result-actions {
  justify-content: center;
}

.confetti-container {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 18px;
  background: var(--gold);
  opacity: 0.95;
  animation: confettiFall 3.2s linear forwards;
}

.review-list {
  display: grid;
  gap: 1rem;
}

.review-card {
  padding: 1rem;
  border-left: 6px solid var(--red);
}

.review-card.is-correct {
  border-left-color: var(--green);
}

.review-card h3 {
  margin-bottom: 0.7rem;
}

.review-card dl {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}

.review-card dt {
  color: var(--text-muted);
  font-weight: 800;
}

.review-card dd {
  margin: 0;
}

.review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.answer-correct {
  color: var(--green);
  font-weight: 900;
}

.answer-wrong {
  color: var(--red);
  font-weight: 900;
}

.scoreboard-actions {
  margin-bottom: 1rem;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  color: var(--text-muted);
}

.empty-state[hidden],
#score-table-wrap[hidden] {
  display: none;
}

.score-table-wrap {
  overflow-x: auto;
}

.score-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.score-table th,
.score-table td {
  padding: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  text-align: left;
  vertical-align: top;
}

.score-table th {
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--teal));
  font-size: 0.85rem;
  text-transform: uppercase;
}

.score-table tr:nth-child(even) td {
  background: rgba(0, 245, 255, 0.06);
}

.rank-badge {
  display: inline-grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ink);
  background: linear-gradient(135deg, var(--teal), var(--mint));
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.28);
  font-weight: 950;
}

@keyframes marqueePulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scaleY(0.8);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes spotlightSweep {
  from {
    opacity: 0.24;
  }
  to {
    opacity: 0.46;
  }
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scorePop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.22);
    color: var(--gold);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes timerPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes correctAnswer {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wrongAnswer {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@keyframes confettiFall {
  to {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .hero-layout,
  .how-to,
  .setup-options {
    grid-template-columns: 1fr;
  }

  .quiz-sign {
    margin: 0;
  }

  .category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .results-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  main,
  .app-header {
    width: min(100% - 1rem, var(--max-width));
  }

  h1 {
    font-size: 3.15rem;
  }

  h2 {
    font-size: 1.85rem;
  }

  .app-header {
    align-items: flex-start;
  }

  .brand-mark {
    max-width: 62%;
  }

  .hero-screen {
    align-content: start;
    min-height: auto;
  }

  .steps-list,
  .category-grid,
  .answers-grid,
  .quiz-status-bar,
  .results-stats {
    grid-template-columns: 1fr;
  }

  .quiz-status-bar > div,
  .timer-box {
    min-width: 0;
  }

  .button,
  .icon-button,
  .answer-button {
    width: 100%;
  }

  .hero-actions,
  .form-actions,
  .result-actions,
  .scoreboard-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 2.45rem;
  }

  .sign-main {
    font-size: 4.7rem;
  }

  .segmented-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .segmented-options span {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .spotlight {
    opacity: 0.18;
  }
}
