:root {
  --bg: #f4f6f1;
  --panel: #ffffff;
  --ink: #141611;
  --muted: #667064;
  --line: #dce3d7;
  --green: #245b45;
  --mint: #bfe7cf;
  --yellow: #f1c84b;
  --coral: #e76f51;
  --blue: #3167a7;
  --shadow: 0 24px 70px rgba(20, 22, 17, 0.12);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(191, 231, 207, 0.9), rgba(244, 246, 241, 0.55)),
    radial-gradient(circle at 85% 15%, rgba(241, 200, 75, 0.32), transparent 30%),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
}

.side-panel,
.quiz-panel {
  border: 1px solid rgba(20, 22, 17, 0.08);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  border-radius: 8px;
}

.quiz-panel {
  position: relative;
  display: grid;
  min-height: 620px;
  padding: clamp(24px, 4vw, 56px);
  border-radius: 8px;
  overflow: hidden;
}

.brand {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: 900;
}

.eyebrow,
.muted,
.metric span,
.mini-board-head,
.pill,
legend,
.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 12ch;
  font-size: 1.35rem;
  line-height: 1.05;
}

h2 {
  max-width: 18ch;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 0.98;
}

.intro {
  max-width: 56ch;
  margin-top: 16px;
  color: #3d443a;
  font-size: 1.05rem;
  line-height: 1.55;
}

.player-card {
  display: grid;
  grid-template-columns: 48px 1fr 40px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--yellow), var(--coral));
}

.avatar span {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 10px 8px 0 rgba(255, 255, 255, 0.65);
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--green);
  font-weight: 900;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
}

.mini-board {
  margin-top: auto;
  padding: 16px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

.mini-board-head {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.68);
}

.mini-board-head strong {
  color: white;
}

.progress-track {
  height: 10px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.progress-track div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--yellow);
  transition: width 280ms ease;
}

.view {
  display: none;
  align-content: center;
  gap: 28px;
}

.view.active {
  display: grid;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  gap: 24px;
  align-items: center;
}

.orbital {
  position: relative;
  aspect-ratio: 1;
}

.ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
}

.ring-one {
  animation: spin 14s linear infinite;
}

.ring-one::before,
.ring-two::before {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.ring-one::before {
  top: 12%;
  right: 16%;
}

.ring-two {
  inset: 32px;
  border-color: rgba(36, 91, 69, 0.35);
  animation: spin 9s linear infinite reverse;
}

.ring-two::before {
  bottom: 8%;
  left: 12%;
  background: var(--coral);
}

.center-pulse {
  position: absolute;
  inset: 28%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 900;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

.controls {
  display: grid;
  gap: 18px;
  max-width: 760px;
}

.field {
  display: grid;
  gap: 8px;
}

.field input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #394036;
  font-weight: 800;
}

.segmented input:checked + span {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #394036;
  font-weight: 750;
}

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

.toggle span {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #cfd8cb;
}

.toggle span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  content: "";
  transition: transform 180ms ease;
}

.toggle input:checked + span {
  background: var(--green);
}

.toggle input:checked + span::after {
  transform: translateX(20px);
}

.primary-action,
.ghost-action {
  min-height: 54px;
  padding: 0 22px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-action {
  border: 0;
  background: var(--ink);
  color: white;
}

.ghost-action {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.quiz-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--green);
}

.pill.subtle {
  background: #edf1e9;
  color: var(--muted);
}

.timer {
  position: absolute;
  top: clamp(20px, 4vw, 48px);
  right: clamp(20px, 4vw, 48px);
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
}

.timer svg,
.timer strong {
  grid-area: 1 / 1;
}

.timer svg {
  width: 96px;
  height: 96px;
  transform: rotate(-90deg);
}

.timer circle {
  fill: none;
  stroke-width: 9;
}

.timer-bg {
  stroke: #e1e8dc;
}

.timer-ring {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 250ms linear, stroke 200ms ease;
}

#questionText {
  max-width: 15ch;
  padding-right: 110px;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer {
  display: grid;
  min-height: 104px;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--ink);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--line);
}

.answer .key {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.answer.correct {
  border-color: var(--green);
  background: #e7f4eb;
}

.answer.wrong {
  border-color: var(--coral);
  background: #fff0eb;
}

.answer:disabled {
  cursor: default;
}

.feedback {
  min-height: 28px;
  color: #394036;
  font-weight: 850;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hidden {
  display: none;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 18px;
}

.result-score,
.review-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.result-score {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
}

.result-score span {
  font-size: clamp(4rem, 10vw, 7rem);
  font-weight: 950;
  line-height: 1;
}

.result-score small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.review-list {
  display: grid;
  gap: 10px;
}

.review-item {
  padding: 14px;
}

.review-item strong {
  display: block;
  margin-bottom: 4px;
}

.review-item p {
  color: var(--muted);
  line-height: 1.45;
}

.pulse {
  animation: pulse 260ms ease;
}

@keyframes pulse {
  50% {
    transform: scale(1.015);
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100vw - 20px, 720px);
    margin: 10px auto;
  }

  .quiz-panel {
    min-height: 620px;
  }

  .side-panel {
    gap: 14px;
  }

  .metric-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .metric {
    min-height: 72px;
    padding: 10px;
  }

  .metric strong {
    font-size: 1.35rem;
  }

  .setup-grid,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .orbital {
    max-width: 220px;
  }
}

@media (max-width: 620px) {
  .quiz-panel,
  .side-panel {
    padding: 18px;
  }

  .metric-grid,
  .answers,
  .segmented {
    grid-template-columns: 1fr;
  }

  .timer {
    position: relative;
    top: auto;
    right: auto;
    justify-self: end;
    width: 78px;
    height: 78px;
  }

  .timer svg {
    width: 78px;
    height: 78px;
  }

  #questionText {
    padding-right: 0;
  }

  h2 {
    font-size: 2.25rem;
  }
}
