:root {
  --bg: #fdf6ee;
  --bg-deep: #15181d;
  --text: #16181d;
  --muted: #5f6570;
  --line: rgba(20, 24, 30, 0.16);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255, 143, 26, 0.16), transparent 70%),
    linear-gradient(180deg, var(--bg), #f4ece2);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(253, 246, 238, 0.86), rgba(253, 246, 238, 0.86)), var(--sport-bg-image, none);
  background-position: center;
  background-size: cover;
  opacity: 0;
  transition: opacity 420ms ease;
}

a {
  -webkit-tap-highlight-color: transparent;
}

.site-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 28px 0 max(40px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 30px;
}

.topbar {
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--bg-deep);
  font-size: 1.34rem;
  font-weight: 900;
  line-height: 1;
}

h1 {
  margin: 22px 0 0;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.01em;
}

.intro {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.14rem);
}

.quiz-grid {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: clamp(14px, 2.4vw, 26px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.quiz-card {
  display: block;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

.quiz-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  display: block;
  border-radius: 8px;
  object-fit: cover;
  object-position: right center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.quiz-card:hover img {
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.3);
}

.cover-visual {
  display: block;
  position: relative;
}
.owned-badge {
  position: absolute;
  bottom: 10px;
  left: 8px;
  right: 8px;
  padding: 9px 6px;
  border-radius: 6px;
  background: #145638;
  color: white;
  text-align: center;
  font-size: .875rem;
  font-weight: 650;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.is-owned .quiz-card img {
  outline: 3px solid #145638;
  outline-offset: 3px;
}
.quiz-title {
  display: block;
  margin-top: 14px;
  font-size: .98rem;
  font-weight: 800;
  text-align: center;
}
.ownership {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  margin-top: 6px;
  color: #55565c;
  font-size: .875rem;
  line-height: 1.4;
  cursor: pointer;
}
.ownership input {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #145638;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  body:has(.quiz-card:hover)::before {
    opacity: 1;
  }

  body:has(.quiz-card-tennis:hover) {
    --sport-bg-image: url("https://images.unsplash.com/photo-1752606304345-ea31a4ed89fd?auto=format&fit=crop&q=58&w=1800");
  }

  body:has(.quiz-card-f1:hover) {
    --sport-bg-image: url("https://images.unsplash.com/photo-1758742250570-fd039e3aafa6?auto=format&fit=crop&q=58&w=1800");
  }

  body:has(.quiz-card-basket:hover) {
    --sport-bg-image: url("https://images.unsplash.com/photo-1616353352910-15d970ac020b?auto=format&fit=crop&q=58&w=1800");
  }

  body:has(.quiz-card-foot:hover) {
    --sport-bg-image: url("https://images.unsplash.com/photo-1637203724929-5a5b60d5d09c?auto=format&fit=crop&q=58&w=1800");
  }

  body:has(.quiz-card-rugby:hover) {
    --sport-bg-image: url("https://images.unsplash.com/photo-1698679222251-ca884650d001?auto=format&fit=crop&q=58&w=1800");
  }
}

@media not all and (hover: hover) and (pointer: fine) {
  body::before {
    display: none;
  }
}

.site-footer {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.review-trigger, .review-close, .review-actions button, .review-back {
  font: inherit;
  cursor: pointer;
}
.review-trigger {
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}
html:has(.review-dialog[open]) { overflow: hidden; }
.review-dialog {
  --quiz-colors: linear-gradient(90deg, #ff8f1a 0% 20%, #e40002 20% 40%, #634191 40% 60%, #008430 60% 80%, #232dbb 80% 100%);
  position: fixed;
  width: min(420px, calc(100% - 32px));
  max-height: calc(100svh - 32px);
  margin: auto;
  padding: 42px 28px 18px;
  overflow-y: auto;
  border: 1px solid #eee7df;
  border-radius: 22px;
  background: radial-gradient(ellipse at 100% 0%, #fff1dd, transparent 65%), #fffdf9;
  color: #202126;
  box-shadow: 0 24px 80px rgba(25, 27, 36, .2), 0 2px 8px rgba(25, 27, 36, .06);
  text-align: center;
}
.review-dialog::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--quiz-colors);
}
.review-dialog[open] { animation: review-enter 240ms cubic-bezier(.2,.8,.2,1); }
@keyframes review-enter {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.review-dialog::backdrop { background: rgba(20, 24, 30, .25); }
.review-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #77716b;
  font-size: 1.6rem;
  line-height: 1;
}
.review-close:hover { background: #f1efea; color: #202126; }
.review-hero { margin: -6px 0 10px; }
.review-stars { display: inline-flex; gap: 6px; font-size: 2.1rem; line-height: 1; }
.review-stars i {
  font-style: normal;
  color: #e6dfd6;
  animation: review-star 420ms cubic-bezier(.2,1.6,.4,1) forwards;
}
.review-stars i:nth-child(1) { animation-delay: 250ms; }
.review-stars i:nth-child(2) { animation-delay: 370ms; }
.review-stars i:nth-child(3) { animation-delay: 490ms; }
.review-stars i:nth-child(4) { animation-delay: 610ms; }
.review-stars i:nth-child(5) { animation-delay: 730ms; }
@keyframes review-star {
  0% { color: #e6dfd6; transform: scale(.6); }
  60% { color: #ffb020; transform: scale(1.3) rotate(-8deg); }
  100% { color: #ffa514; transform: scale(1); text-shadow: 0 3px 10px rgba(255, 165, 20, .35); }
}
.review-title {
  margin: 0 0 10px;
  color: #202126;
  font-size: clamp(1.5rem, 5.5vw, 1.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.035em;
}
.is-choosing .review-hero, .is-choosing .review-title { display: none; }
#review-description {
  margin: 0 0 24px;
  color: #37332f;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -.02em;
  text-wrap: pretty;
}
#review-description strong {
  font-weight: 750;
  background: linear-gradient(transparent 68%, #ffe1b5 68%);
}
.review-thanks {
  display: block;
  margin-top: 14px;
  color: #74695e;
  font-size: .875rem;
  font-weight: 400;
  letter-spacing: 0;
}
[hidden] { display: none !important; }
.review-actions { display: grid; gap: 5px; }
.review-actions button {
  min-height: 48px;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 1rem;
}
.review-confirm {
  grid-row: 1;
  border: 1px solid #ed9e38;
  background: #ffb451;
  color: #30200e;
  box-shadow: 0 3px 0 #de922e, 0 5px 12px rgba(205, 131, 35, .12);
  font-weight: 750 !important;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.review-confirm:hover {
  background: #ffc16b;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #de922e, 0 8px 14px rgba(205, 131, 35, .18);
}
.review-confirm:active { transform: translateY(2px); box-shadow: 0 1px 0 #de922e; }
.review-confirm:focus-visible { outline: 2px solid #8e4700; outline-offset: 4px; }
.review-later { border: 0; background: transparent; color: #626269; }
.review-later:hover { background: #f1efea; color: #202126; }
.review-covers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding-top: 8px;
}
.review-covers a {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 10px 5px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #202126;
  text-align: center;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 650;
  transition: background 160ms ease, border-color 160ms ease;
}
.review-covers img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: right center;
  border-radius: 2px 5px 5px 2px;
  box-shadow: -2px 0 0 #d5cfc6, 0 6px 10px rgba(30, 28, 25, .18);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.review-covers a:nth-child(1) { --book-tint: #fff0df; --book-color: #ff8f1a; }
.review-covers a:nth-child(2) { --book-tint: #ffe7e7; --book-color: #e40002; }
.review-covers a:nth-child(3) { --book-tint: #eee7f6; --book-color: #634191; }
.review-covers a:nth-child(4) { --book-tint: #e1f3e8; --book-color: #008430; }
.review-covers a:nth-child(5) { --book-tint: #e8e9fc; --book-color: #232dbb; }
.review-covers a:hover { background: var(--book-tint); border-color: var(--book-color); }
.review-covers a:hover img {
  transform: translateY(-5px) rotate(-3deg);
  box-shadow: -2px 0 0 #d5cfc6, 2px 10px 12px rgba(30, 28, 25, .2);
}
.review-back {
  min-height: 44px;
  margin-top: 20px;
  padding: 8px 16px;
  border: 1px solid #e0ddd7;
  border-radius: 10px;
  background: transparent;
  color: #626269;
  font-size: .875rem;
}
.review-back:hover { background: #f1efea; }
.is-choosing { width: min(500px, calc(100% - 32px)); padding-top: 54px; }
.is-choosing #review-description {
  max-width: 100%;
  margin-top: 0;
  margin-bottom: 16px;
  color: #202126;
  font-size: clamp(1.45rem, 5vw, 1.85rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.035em;
}
@media (max-width: 480px) {
  .review-covers a { padding: 6px 0; }
}
@media (max-width: 380px) {
  .review-dialog { padding: 42px 22px 16px; }
  .review-dialog.is-choosing { padding-top: 54px; }
  .review-covers { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .review-covers a { padding: 8px; }
}

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

@media (max-width: 620px) {
  .site-shell {
    width: min(100% - 24px, 560px);
    padding-top: 18px;
    gap: 22px;
  }

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

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