html:has(.reversi-page),
.reversi-page {
  overflow-x: clip;
}

.reversi-page {
  --rv-felt: #165a3a;
  --rv-felt-dark: #0e3d28;
  --rv-line: #0a2a1b;
  --rv-ink: #f4efe4;
  --rv-muted: #c9d5cc;
  --rv-panel: #143528;
  --rv-gold: #e4c56b;
  background: #10241b;
  max-width: 100%;
}

.reversi-page .site-header,
.reversi-page .site-header.is-scrolled,
.reversi-page .site-header.is-open {
  border-bottom: 2px solid var(--foreground);
  background: color-mix(in oklch, var(--background) 90%, transparent);
  backdrop-filter: blur(12px);
}

.reversi-page .footer-nav a,
.reversi-page .site-footer p,
.reversi-page .footer-logo {
  color: var(--rv-muted);
}

.rv-skip {
  background: var(--rv-gold);
  color: #1a1408;
}

.rv-shell {
  padding: 5.75rem 0.6rem 3rem;
  max-width: 100%;
  min-width: 0;
}

.rv-layout {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  min-width: 0;
}

.rv-ad {
  display: flex;
  min-height: 5.5rem;
  align-items: center;
  justify-content: center;
  border: 1px dashed color-mix(in srgb, var(--rv-ink) 28%, transparent);
  border-radius: 0.75rem;
  background: color-mix(in srgb, #0c1c15 70%, transparent);
  color: var(--rv-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.rv-ad-side {
  display: none;
}

.rv-stage {
  border-radius: 1.25rem;
  background: linear-gradient(180deg, #1a4632, #123526);
  border: 1px solid color-mix(in srgb, var(--rv-gold) 28%, transparent);
  padding: 1.25rem 0.75rem 1.5rem;
  color: var(--rv-ink);
  min-width: 0;
  max-width: 100%;
  container-type: inline-size;
}

.rv-kicker {
  margin: 0;
  color: var(--rv-gold);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.rv-stage h1 {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 900;
}

.rv-lead {
  margin: 0.6rem 0 0;
  color: var(--rv-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.rv-screen[hidden],
#rv-resume[hidden],
#rv-continue[hidden] {
  display: none;
}

.rv-start-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.rv-levels {
  display: grid;
  gap: 0.6rem;
}

.rv-levels legend {
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.rv-levels label {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.75rem 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--rv-ink) 16%, transparent);
  background: var(--rv-panel);
  cursor: pointer;
}

.rv-levels input {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--rv-gold);
}

.rv-levels strong {
  display: block;
}

.rv-levels span {
  display: block;
  margin-top: 0.15rem;
  color: var(--rv-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.rv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.rv-btn {
  min-height: 2.75rem;
  padding: 0.6rem 1.15rem;
  border-radius: 999px;
  border: 0;
  background: var(--rv-gold);
  color: #1a1408;
  font-weight: 800;
  cursor: pointer;
}

.rv-btn-ghost {
  background: transparent;
  color: var(--rv-ink);
  border: 1px solid color-mix(in srgb, var(--rv-ink) 35%, transparent);
}

.rv-hud {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  min-width: 0;
}

.rv-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  margin: 0;
  font-size: 0.9rem;
}

.rv-turn,
.rv-status {
  margin: 0;
  min-height: 1.5em;
  font-size: 0.9rem;
}

.rv-status {
  color: var(--rv-gold);
  font-weight: 700;
}

.rv-board-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

.rv-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  flex: 0 0 auto;
  width: 100%;
  max-width: 32rem;
  width: min(32rem, 100cqw);
  aspect-ratio: 1;
  padding: 0.45rem;
  border-radius: 0.6rem;
  background: var(--rv-felt-dark);
  box-shadow: inset 0 0 0 3px #0a2418;
}

.rv-cell {
  position: relative;
  appearance: none;
  border: 1px solid var(--rv-line);
  background: var(--rv-felt);
  padding: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  cursor: default;
}

.rv-cell:disabled {
  cursor: default;
}

.rv-cell.is-legal {
  cursor: pointer;
}

.rv-cell.is-legal::after {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: color-mix(in srgb, #d7ffe8 55%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, #effff6 45%, transparent);
}

.rv-cell.is-black::before,
.rv-cell.is-white::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.35);
  backface-visibility: hidden;
  transform: translateZ(0);
}

.rv-cell.is-black::before {
  background: radial-gradient(circle at 32% 28%, #5a5a5a, #111);
}

.rv-cell.is-white::before {
  background: radial-gradient(circle at 32% 28%, #fff, #d8d8d8);
}

.rv-cell.is-flip::before {
  animation: rv-flip 0.22s ease;
}

@keyframes rv-flip {
  from {
    transform: translateZ(0) scaleX(0.2);
  }
  to {
    transform: translateZ(0) scaleX(1);
  }
}

.rv-result {
  text-align: center;
}

.rv-result h2 {
  margin: 0.4rem 0 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.rv-score {
  margin: 0.75rem 0 1.1rem;
  font-size: 1.05rem;
}

.rv-stats {
  margin: 1.2rem 0 0;
  color: var(--rv-muted);
  font-size: 0.82rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.rv-seo {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  color: #e8eee9;
  min-width: 0;
}

.rv-seo h2 {
  margin: 2rem 0 0.7rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.rv-seo p,
.rv-seo li {
  color: #c9d5cc;
  line-height: 1.85;
  font-size: 0.95rem;
}

.rv-seo ol,
.rv-seo ul {
  padding-left: 1.2rem;
}

@media (min-width: 960px) {
  .rv-layout {
    grid-template-columns: 9.5rem minmax(0, 1fr) 9.5rem;
    align-items: start;
  }

  .rv-ad-side {
    display: flex;
    min-height: 28rem;
    position: sticky;
    top: 5.5rem;
  }

  .rv-ad-mobile {
    display: none;
  }

  .rv-stage {
    padding: 1.75rem 1.5rem 2rem;
  }

  .rv-stage h1 {
    font-size: 2.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rv-cell.is-flip::before {
    animation: none;
  }
}
