:root {
  color-scheme: dark;
  --background: #05070a;
  --surface: #101013;
  --surface-raised: #17171a;
  --gold: #e8b75c;
  --ink: #f4f5f8;
  --muted: rgb(232 236 244 / 64%);
  --line: rgb(244 245 248 / 12%);
  --green: #88b98c;
  --red: #d28178;
  --sans: "Work Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html { background: var(--background); }

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(ellipse 88% 34% at 50% 0%, rgb(197 160 89 / 18%) 0%, rgb(197 160 89 / 8%) 48%, transparent 100%),
    var(--background);
  color: var(--ink);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.play-header {
  display: grid;
  width: min(980px, calc(100% - 40px));
  height: 80px;
  margin: 0 auto;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
}

.round-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(5 7 10 / 76%);
  color: var(--gold);
  text-decoration: none;
}

.round-button:hover {
  border-color: rgb(232 183 92 / 55%);
  transform: translateY(-2px);
}

.round-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.wordmark {
  margin: 0;
  color: var(--ink);
  font: 500 clamp(1.15rem, 2.4vw, 1.55rem)/1 var(--serif);
  letter-spacing: -0.02em;
  text-align: center;
}

.play-shell {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 8px 0 max(96px, calc(68px + env(safe-area-inset-bottom)));
}

.game-intro { text-align: center; }

.game-kicker {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.game-intro h1 {
  margin: 0;
  font: 500 clamp(2.4rem, 5vw, 4rem) / 0.96 var(--serif);
  letter-spacing: -0.055em;
}

.game-intro > p:last-child {
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(0.9rem, 2vw, 1.05rem);
}

.game {
  margin-top: clamp(24px, 3.5vw, 36px);
}

.game-status {
  display: flex;
  margin-bottom: 20px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-status p { margin: 0; }
.game-status span { color: var(--gold); }

.pope-choices {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr);
  align-items: center;
}

.pope-choice {
  display: grid;
  min-width: 0;
  padding: clamp(26px, 4vw, 42px) 20px 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(155deg, rgb(255 255 255 / 5%), rgb(255 255 255 / 1.5%));
  color: var(--ink);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.pope-choice:not(:disabled):hover {
  border-color: rgb(232 183 92 / 55%);
  background: linear-gradient(155deg, rgb(232 183 92 / 10%), rgb(255 255 255 / 2%));
  transform: translateY(-3px);
}

.choice-medallion {
  display: block;
  width: clamp(128px, 19vw, 190px);
  height: clamp(128px, 19vw, 190px);
  overflow: hidden;
  border-radius: 50%;
  filter: drop-shadow(0 16px 28px rgb(0 0 0 / 30%));
}

.choice-medallion img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.choice-name {
  margin-top: 24px;
  font: 500 clamp(1.5rem, 3.5vw, 2.35rem) / 1 var(--serif);
  letter-spacing: -0.03em;
  text-align: center;
}

.choice-years {
  min-height: 1.3em;
  margin-top: 10px;
  color: var(--muted);
  font: italic 0.9rem/1.3 var(--serif);
  opacity: 0;
  transition: opacity 180ms ease;
}

.is-answered .choice-years { opacity: 1; }

.pope-choice.is-correct {
  border-color: rgb(136 185 140 / 66%);
  background: rgb(136 185 140 / 9%);
}

.pope-choice.is-wrong {
  border-color: rgb(210 129 120 / 52%);
  opacity: 0.66;
}

.versus {
  color: var(--gold);
  font: italic 1rem/1 var(--serif);
  text-align: center;
}

.answer-panel {
  max-width: 520px;
  margin: 30px auto 0;
  text-align: center;
}

.answer-mark {
  margin: 0;
  color: var(--ink);
  font: 500 1.45rem/1 var(--serif);
}

.answer-mark.is-correct { color: var(--green); }
.answer-mark.is-wrong { color: var(--red); }
.answer-mark.is-result { color: var(--gold); font-size: clamp(2.2rem, 6vw, 3.5rem); }

.answer-copy {
  margin: 12px 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

.results-screen {
  text-align: center;
}

.result-actions {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.result-button-row { display: flex; justify-content: center; align-items: center; gap: 12px; }
.result-link { color: var(--muted); font-size: 0.78rem; text-underline-offset: 4px; }
.result-link:hover { color: var(--gold); }

.secondary-button {
  display: inline-flex;
  min-height: 46px;
  padding: 0 20px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: rgb(232 183 92 / 52%);
  color: var(--gold);
  transform: translateY(-2px);
}

.round-button,
.primary-button,
.secondary-button {
  transition: transform 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out, filter 160ms ease-out;
}

.result-keys {
  display: flex;
  margin: 0 0 clamp(20px, 3vw, 30px);
  justify-content: center;
  gap: 8px;
}

.result-key {
  width: clamp(25px, 3vw, 32px);
  height: clamp(25px, 3vw, 32px);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.result-key.is-earned {
  color: var(--gold);
  filter: drop-shadow(0 4px 12px rgb(232 183 92 / 24%));
}

.result-key.is-missed { color: rgb(232 236 244 / 20%); }

.result-matchups {
  display: grid;
  max-width: 800px;
  margin: 0 auto 24px;
}

.result-matchup {
  display: grid;
  min-height: 78px;
  padding: 8px 0;
  grid-template-columns: minmax(0, 1fr) 56px 38px 56px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.result-matchup:first-child { border-top: 1px solid var(--line); }

.result-medallion {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 50%;
  opacity: 0.58;
}

.result-medallion.is-picked {
  opacity: 1;
  filter: drop-shadow(0 7px 16px rgb(0 0 0 / 30%));
}

.result-pope-info {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.result-pope-info.is-left { text-align: right; }
.result-pope-info.is-right { text-align: left; }

.result-pope-info strong {
  overflow: hidden;
  color: rgb(244 245 248 / 62%);
  font: 500 clamp(1rem, 2.5vw, 1.35rem) / 1 var(--serif);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-pope-info.is-picked strong { color: var(--ink); }

.result-pope-info span {
  color: var(--muted);
  font: italic 0.76rem/1.2 var(--serif);
}

.result-mark {
  display: grid;
  width: 32px;
  height: 32px;
  margin: auto;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
}

.result-mark.is-correct { color: var(--green); }
.result-mark.is-wrong { color: var(--red); }

.primary-button {
  min-height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--background);
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.loading-message {
  margin: 60px 0;
  color: var(--muted);
  text-align: center;
}

[hidden] { display: none !important; }

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

@media (max-width: 640px) {
  .play-header { width: calc(100% - 24px); height: 70px; }
  .play-shell { width: calc(100% - 24px); padding-top: 4px; padding-bottom: max(120px, calc(88px + env(safe-area-inset-bottom))); }
  .game-intro h1 { font-size: clamp(2.25rem, 10vw, 3.1rem); }
  .game-intro > p:last-child { margin-top: 0; }
  .game { margin-top: 24px; }
  .game-status { padding: 0 4px; }
  .pope-choices { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); }
  .pope-choice { min-height: 236px; padding: 22px 8px 18px; border-radius: 18px; }
  .choice-medallion { width: min(34vw, 138px); height: min(34vw, 138px); }
  .choice-name { margin-top: 18px; font-size: clamp(1.18rem, 5.6vw, 1.55rem); }
  .choice-years { font-size: 0.76rem; }
  .versus { font-size: 0.8rem; }
  .result-matchup {
    min-height: 68px;
    grid-template-columns: minmax(0, 1fr) 42px 28px 42px minmax(0, 1fr);
    gap: 6px;
  }
  .result-medallion { width: 42px; height: 42px; }
  .result-mark { width: 26px; height: 26px; font-size: 1rem; }
  .result-pope-info strong { font-size: clamp(0.82rem, 4vw, 1.05rem); }
  .result-pope-info span { font-size: 0.64rem; }
}

@media (max-width: 370px) {
  .pope-choices { grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); }
  .pope-choice { min-height: 224px; padding-inline: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}

@media (hover: none) {
  .round-button:hover { border-color: var(--line); transform: none; }
  .pope-choice:not(:disabled):hover {
    border-color: var(--line);
    background: linear-gradient(155deg, rgb(255 255 255 / 5%), rgb(255 255 255 / 1.5%));
    transform: none;
  }
  .secondary-button:hover { border-color: var(--line); color: var(--ink); transform: none; }
  .result-link:hover { color: var(--muted); }
  .primary-button:hover { filter: none; transform: none; }
}
