:root {
  --cream: #f7f3e9;
  --cream-deep: #eee7d7;
  --paper: rgba(255, 253, 247, 0.88);
  --sage: #6f7d5e;
  --sage-dark: #34422f;
  --sage-pale: #dfe6d5;
  --gold: #b69758;
  --gold-light: #d8c58f;
  --ink: #2f352c;
  --muted: #76796f;
  --rose: #a66f63;
  --white: #fffdf7;
  --shadow: 0 22px 70px rgba(55, 61, 45, 0.12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: Avenir, "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cream);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.92), transparent 38rem),
    linear-gradient(145deg, #faf7f0 0%, var(--cream) 58%, #f1eadc 100%);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

[hidden] {
  display: none !important;
}

.botanical {
  position: fixed;
  z-index: 0;
  width: min(34vw, 330px);
  color: var(--sage);
  opacity: 0.16;
  pointer-events: none;
}

.botanical svg {
  display: block;
  width: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.botanical-top {
  top: 0;
  left: 0;
  transform: translate(-14%, -8%);
}

.botanical-bottom {
  right: 0;
  bottom: 0;
  transform: rotate(180deg) translate(-14%, -8%);
}

.site-header {
  position: relative;
  z-index: 10;
  width: min(1120px, calc(100% - 40px));
  height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(104, 116, 88, 0.18);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 0;
  background: transparent;
  color: var(--sage-dark);
  cursor: pointer;
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.01em;
}

.wordmark-mark {
  color: var(--gold);
  font-size: 25px;
  line-height: 1;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--sage);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.live-dot,
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7d9664;
  box-shadow: 0 0 0 4px rgba(125, 150, 100, 0.14);
}

.live-status.offline {
  color: var(--muted);
}

.live-status.offline .live-dot {
  background: var(--muted);
  box-shadow: none;
}

main {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 56px 24px 90px;
}

main:focus {
  outline: none;
}

.screen {
  animation: screen-in 400ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--sage);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  line-height: 1.5;
  text-transform: uppercase;
}

.eyebrow span {
  width: 30px;
  height: 1px;
  background: var(--gold-light);
}

h1,
h2 {
  margin: 0;
  color: var(--sage-dark);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 0.96;
  text-wrap: balance;
}

h1 {
  margin-top: 20px;
  font-size: clamp(62px, 10vw, 98px);
  letter-spacing: -0.045em;
}

h1 em,
h2 em {
  color: var(--sage);
  font-weight: 400;
}

h1 em {
  display: inline-block;
  position: relative;
}

h1 em::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 7%;
  bottom: -12px;
  height: 9px;
  border-top: 1px solid var(--gold-light);
  border-radius: 50%;
  transform: rotate(-2deg);
}

h2 {
  margin-top: 18px;
  font-size: clamp(48px, 8vw, 68px);
  letter-spacing: -0.035em;
}

.lede,
.screen-copy {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.lede {
  margin: 32px auto 28px;
}

.screen-copy {
  max-width: 490px;
  margin: 22px auto 30px;
  text-align: center;
}

.welcome-card,
.form-card {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 28px;
  border: 1px solid rgba(171, 148, 94, 0.35);
  border-radius: 4px 28px 4px 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.mini-wreath {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 31px;
  line-height: 1;
}

.ready-message {
  min-height: 24px;
  margin: 13px 0 20px;
  color: var(--sage-dark);
  font-family: var(--serif);
  font-size: 17px;
}

.button {
  min-height: 52px;
  padding: 14px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

.button:active {
  transform: translateY(0);
}

.button-primary {
  background: var(--sage-dark);
  color: var(--white);
  box-shadow: 0 12px 28px rgba(52, 66, 47, 0.2);
}

.button-primary:hover {
  background: #263423;
  box-shadow: 0 15px 32px rgba(52, 66, 47, 0.27);
}

.button-secondary {
  border-color: rgba(69, 82, 60, 0.32);
  background: rgba(255, 255, 255, 0.46);
  color: var(--sage-dark);
}

.button-wide {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.text-button,
.quiet-button {
  border: 0;
  background: none;
  cursor: pointer;
}

.text-button {
  margin-top: 17px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-decoration-color: rgba(118, 121, 111, 0.35);
  text-underline-offset: 4px;
}

.leaderboard-peek {
  width: min(100%, 520px);
  margin: 18px auto 0;
  padding: 16px 21px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--sage-dark);
  cursor: pointer;
  text-align: left;
}

.leaderboard-peek strong,
.leaderboard-peek small {
  display: block;
}

.leaderboard-peek strong {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}

.leaderboard-peek small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.trophy {
  color: var(--gold);
  font-size: 24px;
}

.back-button {
  width: 42px;
  height: 42px;
  margin-bottom: 25px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(69, 82, 60, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  font-size: 18px;
}

.name-screen,
.bride-pin-screen,
.waiting-screen,
.bride-done-screen,
.result-screen,
.leaderboard-screen,
.review-screen {
  text-align: center;
}

.name-screen > .back-button,
.bride-pin-screen > .back-button,
.waiting-screen > .back-button,
.leaderboard-screen > .back-button,
.review-screen > .back-button {
  position: absolute;
  left: 24px;
  top: 45px;
}

.form-card {
  text-align: left;
}

.form-card label {
  display: block;
  margin: 0 0 8px 5px;
  color: var(--sage-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.form-card input {
  width: 100%;
  height: 58px;
  margin-bottom: 18px;
  padding: 0 18px;
  border: 1px solid rgba(77, 90, 65, 0.24);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
}

.form-card input::placeholder {
  color: #aaa99f;
}

.quiz-screen,
.bride-quiz-screen {
  width: min(100%, 680px);
  margin: 0 auto;
}

.quiz-topline {
  display: grid;
  grid-template-columns: 70px 1fr 70px;
  align-items: center;
  gap: 10px;
}

.back-inline {
  margin: 0;
}

.progress-label {
  display: flex;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quiet-button {
  padding: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 3px;
  margin: 18px 0 56px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(80, 96, 69, 0.13);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--sage));
  transition: width 360ms ease;
}

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

.quiz-intro h2 {
  font-size: clamp(41px, 7vw, 58px);
}

.choice-stack {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 14px;
  margin-top: 42px;
}

.choice-button {
  position: relative;
  min-height: 178px;
  padding: 25px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(90, 106, 75, 0.22);
  border-radius: 4px 24px 4px 24px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--sage-dark);
  cursor: pointer;
  font-family: var(--serif);
  font-size: clamp(22px, 4vw, 29px);
  line-height: 1.16;
  box-shadow: 0 10px 34px rgba(64, 75, 54, 0.06);
  transition: border 150ms ease, transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.choice-button::before {
  content: "❧";
  position: absolute;
  top: 16px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 16px;
  opacity: 0.65;
}

.choice-button:hover,
.choice-button.selected {
  border-color: var(--sage);
  background: rgba(229, 235, 219, 0.8);
  box-shadow: 0 16px 38px rgba(64, 75, 54, 0.12);
  transform: translateY(-3px);
}

.or {
  display: grid;
  place-items: center;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 17px;
  font-style: italic;
}

.tap-hint {
  margin: 25px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-align: center;
  text-transform: uppercase;
}

.waiting-illustration {
  width: 108px;
  height: 108px;
  margin: 10px auto 27px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  color: var(--sage);
  font-family: var(--serif);
  font-size: 45px;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.35);
}

.waiting-pill {
  width: fit-content;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 99px;
  background: var(--sage-pale);
  color: var(--sage-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pulse-dot {
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.42;
    transform: scale(0.78);
  }
}

.confetti {
  margin: 0 auto 20px;
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 0.12em;
}

.score-ring {
  width: 210px;
  height: 210px;
  margin: 25px auto 30px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 50px;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255,255,255,0.73) 0 58%, transparent 59%),
    conic-gradient(from 0deg, var(--sage-pale), #f5eddd, var(--sage-pale));
  box-shadow: 0 18px 55px rgba(52, 66, 47, 0.11);
}

.score-ring strong {
  color: var(--sage-dark);
  font-family: var(--serif);
  font-size: 88px;
  font-weight: 400;
  line-height: 1;
}

.score-ring span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 17px;
}

.result-screen h2 {
  font-size: clamp(43px, 7vw, 58px);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.podium {
  min-height: 200px;
  margin: 35px 0 28px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 9px;
}

.podium-card {
  width: min(31%, 150px);
  padding: 19px 10px;
  border: 1px solid rgba(182, 151, 88, 0.3);
  border-radius: 18px 18px 4px 4px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 11px 28px rgba(62, 73, 53, 0.08);
}

.podium-card.first {
  min-height: 180px;
  padding-top: 25px;
  background: linear-gradient(180deg, rgba(238, 225, 186, 0.72), rgba(255, 255, 255, 0.66));
}

.podium-card.second {
  min-height: 150px;
}

.podium-card.third {
  min-height: 128px;
}

.podium-rank {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 26px;
}

.podium-card strong,
.podium-card span {
  display: block;
}

.podium-card strong {
  margin: 9px 0 4px;
  overflow: hidden;
  color: var(--sage-dark);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.ranking-list,
.review-list {
  width: min(100%, 580px);
  margin: 0 auto;
  display: grid;
  gap: 9px;
}

.ranking-row {
  min-height: 66px;
  padding: 11px 18px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(80, 96, 69, 0.14);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.42);
  text-align: left;
}

.ranking-row.me {
  border-color: var(--gold);
  background: rgba(238, 225, 186, 0.35);
}

.ranking-number {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 18px;
}

.ranking-name {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-score {
  color: var(--sage);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  padding: 42px 20px;
  border: 1px dashed rgba(80, 96, 69, 0.25);
  border-radius: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.leaderboard-home {
  width: min(100%, 580px);
  margin-top: 18px;
}

.review-list {
  margin-top: 32px;
}

.review-row {
  padding: 18px;
  border: 1px solid rgba(80, 96, 69, 0.15);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  text-align: left;
}

.review-row.match {
  border-color: rgba(95, 122, 75, 0.43);
  background: rgba(223, 230, 213, 0.52);
}

.review-row.miss {
  border-color: rgba(166, 111, 99, 0.28);
  background: rgba(248, 237, 231, 0.46);
}

.review-question {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.review-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--sage-dark);
  font-family: var(--serif);
  font-size: 18px;
}

.review-choice span:last-child {
  flex: none;
  color: var(--sage);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
}

.review-correction {
  margin-top: 7px;
  color: var(--rose);
  font-size: 12px;
}

.done-mark {
  border-color: var(--sage);
  color: var(--sage-dark);
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 440px);
  padding: 14px 18px;
  border-radius: 12px;
  background: #293226;
  color: var(--white);
  box-shadow: 0 16px 45px rgba(24, 29, 21, 0.26);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 640px) {
  .botanical {
    width: 58vw;
    opacity: 0.1;
  }

  .site-header {
    width: calc(100% - 30px);
    height: 70px;
  }

  .wordmark {
    font-size: 16px;
  }

  main {
    padding: 42px 18px 70px;
  }

  .welcome-card,
  .form-card {
    padding: 23px 19px;
  }

  .choice-stack {
    grid-template-columns: 1fr;
    gap: 9px;
    margin-top: 30px;
  }

  .choice-button {
    min-height: 116px;
    padding: 28px 24px 18px;
    font-size: 24px;
  }

  .or {
    height: 24px;
  }

  .progress-track {
    margin-bottom: 40px;
  }

  .name-screen > .back-button,
  .bride-pin-screen > .back-button,
  .waiting-screen > .back-button,
  .leaderboard-screen > .back-button,
  .review-screen > .back-button {
    top: 30px;
    left: 18px;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions .button {
    width: 100%;
  }

  .leaderboard-copy {
    margin-bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
