html,
body {
  height: 100%;
}

body {
  overflow: hidden;
}

[x-cloak] {
  display: none !important;
}

:root:root {
  --ror-pink: #db2777;
  --ror-violet: #9333ea;
  --ror-cyan: #0891b2;
  --ror-surface: #ffffff;
  --ror-border: rgba(20, 24, 29, 0.12);
  --ror-gradient: linear-gradient(90deg, var(--ror-pink), var(--ror-violet), var(--ror-cyan));
  --pico-primary: #9333ea;
  --pico-primary-background: #9333ea;
  --pico-primary-hover: #7e22ce;
  --pico-primary-hover-background: #7e22ce;
  --pico-primary-focus: rgba(147, 51, 234, 0.2);
  --pico-primary-inverse: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:root {
    --ror-pink: #ff6ec7;
    --ror-violet: #a855f7;
    --ror-cyan: #22d3ee;
    --ror-surface: #11191f;
    --ror-border: rgba(255, 255, 255, 0.16);
    --pico-primary: #a855f7;
    --pico-primary-background: #a855f7;
    --pico-primary-hover: #c084fc;
    --pico-primary-hover-background: #c084fc;
    --pico-primary-focus: rgba(168, 85, 247, 0.25);
  }
}

main.container {
  --gap: clamp(0.4rem, 1.2vh, 1rem);
  --pad-x: clamp(0.75rem, 2.5vw, 1.5rem);
  --pad-y: clamp(0.5rem, 2vh, 1.25rem);
  --cols: 2;
  --rows: 3;
  --chrome: clamp(4.25rem, 14vh, 6.5rem);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--pad-y) var(--pad-x) clamp(0.75rem, 3vh, 1.75rem);
  overflow: hidden;
}

@media (min-width: 900px) {
  main.container {
    --cols: 3;
    --rows: 2;
  }
}

.grid {
  --cell: min(
    calc((100vw - 2 * var(--pad-x) - (var(--cols) - 1) * var(--gap)) / var(--cols)),
    calc((100dvh - 2 * var(--pad-y) - var(--chrome) - (var(--rows) - 1) * var(--gap)) / var(--rows))
  );
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: repeat(var(--cols), var(--cell));
  grid-auto-rows: var(--cell);
  gap: var(--gap);
  justify-content: center;
  align-content: center;
  margin: 0 auto;
  max-width: 100%;
}

.card {
  position: relative;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  aspect-ratio: 1 / 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.card:hover img {
  transform: scale(1.03);
}

.card.dim img {
  opacity: 0.4;
}

.card.lost {
  outline: 4px solid #b00020;
  outline-offset: -4px;
  cursor: not-allowed;
}

.card.eliminated {
  outline: 3px solid #4caf50;
  outline-offset: -3px;
  cursor: not-allowed;
}

.card.eliminated:hover img,
.card.lost:hover img {
  transform: none;
}

.grid.done {
  cursor: default;
}

.grid.done .card {
  cursor: zoom-in;
}

.grid.done .card.eliminated,
.grid.done .card.lost {
  cursor: zoom-in;
}

.grid.done .card:hover img {
  transform: none;
}

.answer-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.answer-overlay.red {
  background: rgba(220, 38, 38, 0.35);
}

.answer-overlay.green {
  background: rgba(34, 197, 94, 0.35);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  max-height: 92dvh;
  object-fit: contain;
  cursor: crosshair;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-img.cursor-zoom-in {
  cursor: zoom-in;
}

.lightbox-img.cursor-grab {
  cursor: grab;
}

.lightbox-img.cursor-grabbing {
  cursor: grabbing;
}

.zoom-toggle {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 3;
  display: inline-flex;
  gap: 2px;
  width: auto;
  max-width: calc(100vw - 5.5rem);
  padding: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
}

.zoom-toggle button {
  width: auto;
  margin: 0;
  padding: 0.25rem 0.6rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
}

.zoom-toggle button.active {
  background-image: var(--ror-gradient);
  color: #fff;
}

.zoom-hint {
  position: absolute;
  top: 2.8rem;
  left: 0.6rem;
  z-index: 3;
  max-width: 17rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.68rem;
  line-height: 1.3;
  pointer-events: none;
}

@media (max-height: 560px) {
  .zoom-hint {
    display: none;
  }
}

.loupe {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
}

.loupe:active {
  cursor: grabbing;
}

.loupe-img {
  position: absolute;
  display: block;
  max-width: none;
  max-height: none;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.loupe-close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
}

.loupe-close svg {
  width: 1.1rem;
  height: 1.1rem;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close svg {
  width: 1.5rem;
  height: 1.5rem;
}

.nav-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-button svg {
  width: 1.75rem;
  height: 1.75rem;
}

.nav-prev {
  left: 1rem;
}

.nav-next {
  right: 1rem;
}

.guess-button {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-image: var(--ror-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(147, 51, 234, 0.35);
}

.guess-button:disabled {
  opacity: 0.6;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.model-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.3rem 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

.model-label a {
  color: #fff;
  text-decoration: underline;
  pointer-events: auto;
}

.error {
  color: var(--ror-pink);
}

.logo {
  margin: 0 0 clamp(0.25rem, 1vh, 0.5rem);
  text-align: left;
}

.logo-svg {
  display: block;
  width: clamp(6rem, 16vw, 10rem);
  height: auto;
  margin: 0;
  color: inherit;
}

main.container > p {
  margin: 0 0 clamp(0.25rem, 1vh, 0.5rem);
  font-size: clamp(0.8rem, 1.5vh, 1rem);
  line-height: 1.3;
}

@media (max-height: 600px) {
  .logo-svg {
    width: clamp(4.5rem, 12vw, 7rem);
  }
}

.help-button {
  position: absolute;
  top: var(--pad-y);
  right: var(--pad-x);
  z-index: 20;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--ror-border);
  border-radius: 50%;
  background: var(--ror-surface);
  color: var(--ror-violet);
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.help-button:hover,
.help-button:focus-visible {
  background-image: var(--ror-gradient);
  color: #fff;
  border-color: transparent;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-x);
  background: rgba(0, 0, 0, 0.55);
}

.modal-card {
  position: relative;
  width: min(94vw, 38rem);
  max-height: min(90dvh, 46rem);
  overflow: auto;
  padding: clamp(1rem, 2.5vh, 1.5rem) clamp(1.1rem, 3.5vw, 2rem);
  border: 1px solid var(--pico-card-border-color, rgba(0, 0, 0, 0.1));
  border-radius: 14px;
  background: var(--pico-card-background-color, #fff);
  color: var(--pico-color, #14181d);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
  text-align: left;
}

.modal-card h2 {
  margin: 0 1.75rem 0.75rem 0;
  font-size: clamp(1.1rem, 2.6vh, 1.5rem);
  background-image: var(--ror-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.result-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.6rem;
  margin: 0 1.75rem 0.7rem 0;
}

.modal-card .result-head h2 {
  margin: 0;
}

.result-head .verdict {
  margin: 0;
}

.modal-card ol {
  margin: 0 0 0.9rem;
  padding-left: 1.25rem;
}

.modal-card li {
  margin: 0 0 0.35rem;
}

.modal-card p {
  margin: 0;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-close svg {
  width: 1.1rem;
  height: 1.1rem;
}

.top-actions {
  position: absolute;
  top: var(--pad-y);
  right: var(--pad-x);
  z-index: 20;
  display: flex;
  gap: 0.4rem;
}

.top-actions .help-button {
  position: static;
  top: auto;
  right: auto;
}

.help-button svg {
  width: 1.1rem;
  height: 1.1rem;
}

.stats-section {
  margin-top: 0.85rem;
}

.stats-section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
}

.stats-summary {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
}

.stats-note {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  opacity: 0.7;
}

.dist {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.4rem 0 0;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dist-label {
  flex: 0 0 1rem;
  text-align: right;
  font-size: 0.72rem;
  opacity: 0.7;
}

.dist-track {
  flex: 1 1 auto;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--ror-border);
  overflow: hidden;
}

.dist-bar {
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  background-image: var(--ror-gradient);
}

.dist-pct {
  flex: 0 0 2.5rem;
  text-align: right;
  font-size: 0.7rem;
}

.stats-skeleton .skel-track,
.stats-skeleton .skel-line {
  background: var(--ror-border);
  animation: ror-skeleton 1.2s ease-in-out infinite;
}

.stats-skeleton .skel-line {
  display: inline-block;
  width: 70%;
  height: 0.8rem;
  border-radius: 999px;
}

.stats-skeleton .skel-line-short {
  width: 40%;
}

@keyframes ror-skeleton {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
}

.scope-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: var(--ror-border);
}

.scope-toggle button {
  width: auto;
  margin: 0;
  padding: 0.2rem 0.55rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-size: 0.68rem;
  line-height: 1.1;
  cursor: pointer;
}

.scope-toggle button.active {
  background-image: var(--ror-gradient);
  color: #fff;
}

.stats-table {
  width: 100%;
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
}

.stats-table th,
.stats-table td {
  padding: 0.25rem 0.4rem;
  text-align: right;
}

.stats-table th:first-child,
.stats-table td:first-child {
  text-align: left;
}

.stats-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.6;
}

@media (min-width: 620px) {
  .stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1.5rem;
    align-items: start;
  }

  .stats .stats-section {
    margin-top: 0;
  }
}

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

.consent-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

.consent-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0 0;
}

.consent-option {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
  cursor: pointer;
}

.consent-option input {
  margin: 0.15rem 0 0;
  flex-shrink: 0;
}

.consent-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin: 1.25rem 0 0;
}

.consent-actions button {
  width: auto;
  margin: 0;
}

.site-legal {
  position: fixed;
  right: clamp(0.5rem, 2vw, 1rem);
  bottom: 0.3rem;
  z-index: 50;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.68rem;
}

.site-legal a,
.site-legal button,
.linklike {
  width: auto;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--pico-muted-color);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.site-legal a:hover,
.site-legal button:hover,
.linklike:hover {
  color: var(--pico-primary);
}

.help-legal {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
}

.help-legal a,
.help-legal .linklike {
  color: var(--pico-primary);
}

.verdict-banner {
  position: absolute;
  top: var(--pad-y);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 70vw;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.verdict-banner.win {
  background: #16a34a;
}

.verdict-banner.lose {
  background: #dc2626;
}

.verdict-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.verdict.win {
  background: #16a34a;
}

.verdict.lose {
  background: #dc2626;
}

.modal-card.result-win {
  border-top: 3px solid #16a34a;
}

.modal-card.result-lose {
  border-top: 3px solid #dc2626;
}

.modal-card.result-win h2,
.modal-card.result-lose h2 {
  background-image: none;
  -webkit-text-fill-color: currentColor;
  color: inherit;
}

.modal-card.result-win h2 {
  color: #16a34a;
}

.modal-card.result-lose h2 {
  color: #dc2626;
}

@media (prefers-color-scheme: dark) {
  .verdict-banner.win,
  .verdict.win {
    background: #22c55e;
  }

  .verdict-banner.lose,
  .verdict.lose {
    background: #f87171;
  }

  .modal-card.result-win {
    border-top-color: #22c55e;
  }

  .modal-card.result-lose {
    border-top-color: #f87171;
  }

  .modal-card.result-win h2 {
    color: #22c55e;
  }

  .modal-card.result-lose h2 {
    color: #f87171;
  }
}

