:root {
  --bg: #0c0b0e;
  --panel: rgba(23, 21, 26, 0.94);
  --panel-2: #211d22;
  --cream: #f5efe3;
  --muted: #aaa097;
  --gold: #dfb766;
  --gold-light: #f0d38f;
  --red: #b64758;
  --red-dark: #812f42;
  --line: #3a333b;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% -10%, rgba(81, 39, 52, 0.75), transparent 38%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.2;
  background: url("./between-us-bg.webp") center / cover no-repeat;
  pointer-events: none;
}

button, input { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 3px;
}

.shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--safe-top) 20px calc(28px + var(--safe-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 78px;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.logo, .icon-button {
  border: 0;
  color: var(--cream);
  background: transparent;
  cursor: pointer;
}

.logo {
  padding: 10px 0;
  letter-spacing: 0.14em;
  font-size: 13px;
  font-weight: 900;
}

.logo i {
  color: var(--gold);
  letter-spacing: 0;
  font: italic 25px Georgia, serif;
}

.icon-button {
  display: grid;
  min-width: 42px;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 18px;
}

.scorebar {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  min-width: 0;
  gap: 5px;
  text-align: center;
}

.scorebar b { font-size: 17px; }
.scorebar span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}
.scorebar em {
  color: var(--red);
  white-space: nowrap;
  font-size: 12px;
  font-style: normal;
}

.screen {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding-top: 38px;
  animation: screen-in 420ms cubic-bezier(.2, .8, .2, 1) both;
}

.screen.center {
  align-items: center;
  justify-content: center;
  padding-bottom: 40px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 800;
}

h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1, h2 {
  margin: 17px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}
h1 { font-size: clamp(42px, 11vw, 58px); line-height: 0.99; }
h2 { font-size: clamp(31px, 8vw, 43px); line-height: 1.06; }
h1 i, h2 i { color: var(--gold); }
h3 { margin: 22px 0 10px; font: 24px Georgia, serif; }
h4 { margin: 18px 0 8px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; font-size: 11px; }

.lead {
  margin: 0;
  color: #c6bdb4;
  line-height: 1.65;
}

.hero { padding-top: 54px; }
.hero-art {
  position: relative;
  height: 112px;
  margin: 26px 0 12px;
}
.hero-heart {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--red);
  text-shadow: 0 0 40px rgba(182, 71, 88, .55);
  font-size: 82px;
  animation: breathe 3.2s ease-in-out infinite;
}
.orbit {
  position: absolute;
  inset: 6px 50%;
  width: 110px;
  margin-left: -55px;
  border: 1px solid rgba(223, 183, 102, .45);
  border-radius: 50%;
  animation: orbit 8s linear infinite;
}
.orbit::after {
  content: "✦";
  position: absolute;
  top: 4px;
  left: 12px;
  color: var(--gold);
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 22px 0 4px;
}
.feature-row div {
  padding: 10px 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(23, 21, 26, .74);
  text-align: center;
}
.feature-row b, .feature-row small { display: block; }
.feature-row b { color: var(--gold); font: 19px Georgia, serif; }
.feature-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.panel {
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-body { padding: 22px; }

.card-image {
  position: relative;
  height: 168px;
  overflow: hidden;
  background: #17151a;
}
.card-image::after {
  content: "";
  position: absolute;
  inset: 40% 0 0;
  background: linear-gradient(transparent, rgba(23, 21, 26, .98));
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-image .level-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
}

.level-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(240, 211, 143, .45);
  border-radius: 999px;
  color: #251a0d;
  background: rgba(240, 211, 143, .92);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 900;
}

.question {
  margin: 13px 0 18px;
  font: clamp(25px, 7vw, 34px)/1.25 Georgia, serif;
}
.question i { color: var(--gold); }

.note {
  margin: 14px 0;
  padding: 13px 14px;
  border-left: 3px solid var(--gold);
  color: #cec4ba;
  background: var(--panel-2);
  line-height: 1.5;
  text-align: left;
  font-size: 13px;
}

.choices { display: grid; gap: 9px; }
.choice {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--cream);
  background: #17151a;
  text-align: left;
  cursor: pointer;
}
.choice-mark {
  display: grid;
  flex: 0 0 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #625a63;
  border-radius: 50%;
  color: #21160b;
  font-weight: 900;
}
.choice.selected {
  border-color: var(--gold);
  background: #2b251e;
  transform: translateX(3px);
}
.choice.selected .choice-mark { border-color: var(--gold); background: var(--gold); }

.hint { margin: 12px 0 0; color: var(--muted); font-size: 11px; }

.primary, .secondary, .text-button, .mode, .rating, .timer-button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.primary, .secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 57px;
  margin-top: 14px;
  padding: 14px 17px;
  border-radius: 8px;
  font-weight: 850;
}
.primary {
  border: 0;
  color: #1b130b;
  background: linear-gradient(135deg, #d1a454, var(--gold-light));
  box-shadow: 0 8px 28px rgba(223, 183, 102, .14);
}
.primary:disabled { opacity: .35; cursor: not-allowed; }
.secondary {
  justify-content: center;
  border: 1px solid var(--line);
  color: var(--cream);
  background: rgba(23, 21, 26, .76);
}
.text-button {
  min-height: 44px;
  margin-top: 8px;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-decoration: underline;
}

.fields { display: grid; gap: 12px; }
label { color: var(--muted); font-size: 11px; }
input[type="text"] {
  width: 100%;
  min-height: 52px;
  margin-top: 6px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: var(--panel);
}
.modes { display: grid; gap: 7px; }
.mode {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 55px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: var(--panel);
  text-align: left;
}
.mode small { color: var(--muted); }
.mode.selected { border-color: var(--gold); box-shadow: inset 4px 0 var(--gold); }

.sound-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(23, 21, 26, .72);
  font-size: 12px;
}
.toggle {
  min-width: 72px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cream);
  background: #17151a;
  cursor: pointer;
}
.toggle.on { border-color: var(--gold); color: #20160b; background: var(--gold); }

.pass-art {
  width: min(78vw, 300px);
  aspect-ratio: 1;
  margin: 10px auto 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .4);
}
.pass-arrow { color: var(--gold); font-size: 44px; animation: float 1.8s ease-in-out infinite; }

.flip-in { animation: flip-in 680ms cubic-bezier(.2, .75, .18, 1) both; transform-style: preserve-3d; }

.compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 8px;
  margin: 18px 0;
}
.compare-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 118px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #17151a;
}
.compare-card small { color: var(--muted); }
.compare-card b { margin-top: 8px; font: 16px/1.3 Georgia, serif; }
.versus { align-self: center; color: var(--gold); font-size: 10px; font-weight: 900; }

.ratings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rating {
  min-height: 72px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--cream);
  background: #17151a;
}
.rating b, .rating span { display: block; }
.rating b { color: var(--gold); font: 27px Georgia, serif; }
.rating span { margin-top: 3px; font-size: 11px; }

.burst {
  display: grid;
  width: 115px;
  height: 115px;
  margin: 2px auto 16px;
  place-items: center;
  clip-path: polygon(50% 0,61% 17%,80% 8%,82% 29%,100% 34%,87% 50%,100% 66%,81% 72%,79% 93%,60% 84%,49% 100%,38% 83%,19% 92%,17% 71%,0 65%,13% 49%,0 34%,19% 28%,21% 7%,40% 17%);
  color: white;
  background: var(--red-dark);
  font-weight: 950;
  line-height: .9;
  animation: burst-in 620ms cubic-bezier(.2, 1.4, .3, 1) both;
}
.challenge-title { color: var(--cream); font: 27px/1.3 Georgia, serif; }
.challenge-rules { color: var(--gold); font-size: 12px; line-height: 1.5; }
.timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 16px 0;
}
.timer-button {
  min-height: 43px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  background: #17151a;
}
.timer-time { min-width: 76px; font: 31px Georgia, serif; }

.heart-pop { color: var(--red); text-shadow: 0 0 35px rgba(182,71,88,.45); font-size: 76px; animation: heart-pop 800ms cubic-bezier(.2,1.5,.3,1) both; }
.boards { display: grid; grid-template-columns: 1fr 1.2fr 1fr; width: 100%; gap: 7px; margin: 20px 0; }
.boards div { padding: 13px 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.boards small, .boards b { display: block; }
.boards small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.boards b { margin-top: 7px; font: 24px Georgia, serif; }
.boards div:nth-child(2) b { color: var(--red); font-size: 16px; }

.final-score { display: flex; align-items: center; justify-content: center; gap: 30px; margin: 10px 0; }
.final-score b { color: var(--gold); font: 58px Georgia, serif; }
.final-score span { color: var(--red); font-size: 34px; }

.achievement-grid { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; gap: 8px; margin: 18px 0; }
.achievement {
  min-height: 110px;
  padding: 10px 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(23, 21, 26, .88);
}
.achievement.locked { opacity: .28; filter: grayscale(1); }
.badge-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 8px;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold-light);
  background: radial-gradient(circle at 35% 30%, #4b3033, #17151a 68%);
  box-shadow: inset 0 0 0 3px #17151a, 0 0 22px rgba(223,183,102,.14);
  font: 23px Georgia, serif;
}
.achievement b, .achievement small { display: block; }
.achievement b { font-size: 10px; }
.achievement small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.3; }

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
}
.celebration-message {
  z-index: 2;
  max-width: min(88vw, 430px);
  padding: 16px 24px;
  border: 1px solid rgba(240, 211, 143, .65);
  border-radius: 999px;
  color: #24170b;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  box-shadow: 0 20px 80px rgba(0,0,0,.55);
  text-align: center;
  font: 700 27px Georgia, serif;
  animation: hooray 1.8s cubic-bezier(.2,1.2,.3,1) both;
}
.confetti {
  position: absolute;
  top: -10vh;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: confetti-fall var(--fall, 1.8s) linear var(--delay, 0s) forwards;
}

.achievement-toast {
  position: fixed;
  right: 14px;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  width: min(390px, calc(100vw - 28px));
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--gold);
  border-radius: 14px;
  background: #17151af5;
  box-shadow: var(--shadow);
  animation: toast-in 3.4s ease both;
}
.achievement-toast .badge-icon { margin: 0; }
.achievement-toast b, .achievement-toast small { display: block; }
.achievement-toast small { margin-top: 3px; color: var(--muted); }

footer {
  margin-top: auto;
  padding-top: 30px;
  color: #6e646d;
  letter-spacing: .13em;
  text-align: center;
  font-size: 8px;
}

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

@keyframes screen-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes flip-in { 0% { opacity: 0; transform: perspective(900px) rotateY(-84deg) scale(.92); } 100% { opacity: 1; transform: perspective(900px) rotateY(0) scale(1); } }
@keyframes breathe { 0%,100% { transform: scale(.96); } 50% { transform: scale(1.06); } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes float { 0%,100% { transform: translateY(-3px); } 50% { transform: translateY(7px); } }
@keyframes burst-in { from { opacity: 0; transform: rotate(-18deg) scale(.25); } to { opacity: 1; transform: rotate(0) scale(1); } }
@keyframes heart-pop { 0% { opacity: 0; transform: scale(.2); } 55% { transform: scale(1.22); } 100% { opacity: 1; transform: scale(1); } }
@keyframes hooray { 0% { opacity: 0; transform: scale(.2) rotate(-5deg); } 18%,72% { opacity: 1; transform: scale(1) rotate(0); } 100% { opacity: 0; transform: scale(1.15); } }
@keyframes confetti-fall { to { transform: translate3d(var(--drift, 0), 115vh, 0) rotate(840deg); opacity: .1; } }
@keyframes toast-in { 0%,100% { opacity: 0; transform: translateY(20px); } 10%,82% { opacity: 1; transform: none; } }

@media (max-width: 380px) {
  .shell { padding-left: 14px; padding-right: 14px; }
  .scorebar span { display: none; }
  .scorebar { grid-template-columns: auto 1fr auto; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .question { font-size: 24px; }
  .panel-body { padding: 18px; }
  .card-image { height: 145px; }
  .achievement-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 700px) {
  .shell { padding-left: 0; padding-right: 0; }
}

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