/* XO game page: aligns game chrome and ad layout with the newer standalone games. */
.xo-play-page {
  min-height: 100vh;
  padding: 0;
  color: #eef4ff;
  background:
    radial-gradient(
      ellipse at 12% 0%,
      rgba(59, 130, 246, 0.2),
      transparent 38rem
    ),
    radial-gradient(
      ellipse at 92% 70%,
      rgba(139, 92, 246, 0.18),
      transparent 36rem
    ),
    #080f24;
  font-family: Inter, "Segoe UI", sans-serif;
}

.xo-play-page .game-nav-header {
  position: sticky;
  z-index: 1000;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(11, 20, 42, 0.9);
  box-shadow: 0 8px 28px rgba(2, 6, 23, 0.2);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.xo-play-page .nav-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.xo-play-page .nav-btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #e8f2fb;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.xo-play-page .nav-btn:hover,
.xo-play-page .nav-btn:focus-visible {
  border-color: rgba(94, 234, 212, 0.5);
  background: rgba(94, 234, 212, 0.1);
  color: #fff;
}

.xo-play-page .game-title {
  color: #eaf5ff;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.xo-play-page .game-title i {
  margin-right: 0.4rem;
  color: #65d9f2;
}

.xo-skip-link {
  position: fixed;
  z-index: 1100;
  top: -5rem;
  left: 1rem;
  padding: 0.7rem 1rem;
  border-radius: 0.7rem;
  background: #fff;
  color: #101a31;
  font-weight: 800;
}

.xo-skip-link:focus {
  top: 0.75rem;
}

.xo-page-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 1.5rem auto 2rem;
}

.xo-game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  gap: 1.25rem;
}

.xo-play-page .game-container {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
}

.xo-play-page .header {
  margin: 0 0 1rem;
  padding: 0.25rem 0.5rem;
  color: #f7fbff;
  text-align: left;
  animation: none;
}

.xo-play-page .header h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: -0.035em;
  text-shadow: none;
}

.xo-play-page .header p {
  color: #aab8d1;
  font-size: 0.92rem;
}

.xo-play-page .game-area {
  margin: 0;
  padding: clamp(1rem, 2.5vw, 2rem);
  overflow: hidden;
  border: 1px solid rgba(195, 216, 255, 0.16);
  border-radius: 20px;
  background: linear-gradient(
    155deg,
    rgba(24, 39, 76, 0.96),
    rgba(13, 20, 47, 0.98)
  );
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
  color: #eef4ff;
  animation: none;
}

.xo-play-page .setup-screen h2,
.xo-play-page .difficulty-section h2,
.xo-play-page .objectives-section h2 {
  color: #f7fbff;
}

.xo-play-page .setup-section h3 {
  color: #8de5f4;
}

.xo-play-page .setup-btn {
  border: 1px solid rgba(195, 216, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #eaf2ff;
}

.xo-play-page .setup-btn:hover {
  border-color: rgba(101, 217, 242, 0.7);
  background: rgba(101, 217, 242, 0.1);
  box-shadow: 0 10px 25px rgba(41, 151, 189, 0.15);
}

.xo-play-page .setup-btn.selected {
  border-color: #65d9f2;
  background: linear-gradient(135deg, #167ba3, #5645ae);
  color: #fff;
  box-shadow: 0 10px 30px rgba(41, 151, 189, 0.24);
}

.xo-play-page .mode-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.xo-play-page .mode-buttons .setup-btn {
  min-height: 92px;
  line-height: 1.5;
}

.xo-play-page .mode-buttons .difficulty-label {
  display: inline-block;
  margin-top: 0.35rem;
}

.xo-play-page .difficulty-label {
  color: #b7c5df;
  opacity: 1;
}

.xo-play-page .game-info {
  border-color: rgba(195, 216, 255, 0.14);
}

.xo-play-page .info-box,
.xo-play-page .stat-item {
  border: 1px solid rgba(195, 216, 255, 0.16);
  background: rgba(255, 255, 255, 0.055);
}

.xo-play-page .info-box .label,
.xo-play-page .stat-label {
  color: #aab8d1;
}

.xo-play-page .info-box .value,
.xo-play-page .stat-value {
  color: #8de5f4;
}

.xo-play-page .info-box .difficulty-badge {
  background: linear-gradient(135deg, #167ba3, #5645ae);
}

.xo-play-page .game-status {
  border: 1px solid rgba(195, 216, 255, 0.18);
  background: rgba(4, 10, 28, 0.55);
  color: #dce8ff;
}

.xo-play-page .game-status.active {
  border-color: rgba(101, 217, 242, 0.48);
  background: rgba(22, 123, 163, 0.22);
  color: #baf3ff;
}

.xo-play-page .game-status.winner {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(16, 185, 129, 0.17);
  color: #a7f3d0;
}

.xo-play-page .game-status.loser {
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(239, 68, 68, 0.16);
  color: #fecdd3;
}

.xo-play-page .game-status.draw {
  border-color: rgba(251, 191, 36, 0.48);
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
}

.xo-play-page .question-section {
  border: 1px solid rgba(251, 191, 36, 0.26);
  border-left: 4px solid #f5ad4e;
  background: linear-gradient(
    145deg,
    rgba(59, 43, 29, 0.88),
    rgba(38, 31, 40, 0.9)
  );
}

.xo-play-page .question {
  color: #f8fafc;
}

.xo-play-page .board {
  width: min(100%, 470px);
  margin: 0 auto 2rem;
  gap: 0.7rem;
  padding: 1rem;
  border: 1px solid rgba(195, 216, 255, 0.14);
  background: rgba(4, 10, 28, 0.5);
}

.xo-play-page .cell {
  border: 1px solid rgba(101, 217, 242, 0.34);
  background: linear-gradient(145deg, #18274c, #101a38);
  color: #8de5f4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.xo-play-page .cell:hover:not(:disabled) {
  background: linear-gradient(145deg, #203b67, #18274c);
  box-shadow: 0 8px 25px rgba(41, 151, 189, 0.22);
}

.xo-play-page .cell.o {
  color: #fda4af;
}

.xo-play-page .cell.x {
  color: #6ee7d8;
}

.xo-play-page .option-btn {
  border-color: rgba(245, 173, 78, 0.55);
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.xo-play-page .option-btn:hover:not(:disabled) {
  border-color: #65d9f2;
  background: rgba(101, 217, 242, 0.12);
}

.xo-play-page .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #eaf2ff;
}

.xo-play-page .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.17);
}

.xo-play-page .back-link a {
  color: #a9def0;
}

.xo-ad-rail {
  position: sticky;
  top: 84px;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
  padding-top: 3.2rem;
}

.xo-ad-card {
  display: grid;
  min-height: 292px;
  align-content: start;
  justify-items: center;
  gap: 10px;
  padding: 14px 8px;
  border: 1px solid rgba(195, 216, 255, 0.16);
  border-radius: 16px;
  background: rgba(5, 10, 27, 0.48);
}

.xo-ad-label {
  color: rgba(226, 232, 240, 0.62);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.xo-ad-card .adsbygoogle {
  display: inline-block;
  width: 300px;
  height: 250px;
  max-width: 100%;
}

.xo-bottom-ad {
  display: grid;
  width: min(100%, 1200px);
  min-height: 110px;
  box-sizing: border-box;
  justify-items: center;
  gap: 8px;
  margin: 18px auto 0;
  padding: 12px;
  border: 1px solid rgba(195, 216, 255, 0.16);
  border-radius: 14px;
  background: rgba(7, 13, 32, 0.62);
}

.xo-bottom-ad .adsbygoogle {
  display: block;
  width: 100%;
  min-height: 90px;
}

.xo-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 20px auto 0;
  color: #8798b7;
  font-size: 0.76rem;
}

.xo-footer a {
  color: #a9def0;
  text-decoration: none;
}

.xo-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.xo-play-page :where(button, a):focus-visible {
  outline: 3px solid #65d9f2;
  outline-offset: 3px;
}

.xo-play-page .xo-fullscreen-toggle {
  position: fixed;
  z-index: 1200;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(101, 217, 242, 0.42);
  border-radius: 999px;
  background: linear-gradient(135deg, #167ba3, #5645ae);
  box-shadow: 0 8px 26px rgba(2, 6, 23, 0.38);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.xo-play-page .xo-fullscreen-toggle:hover {
  background: linear-gradient(135deg, #2098bd, #6956ca);
  transform: translateY(-2px);
}

.xo-play-page .xo-fullscreen-toggle:active {
  transform: translateY(0);
}

.xo-play-page .cell {
  font-family: inherit;
}

.xo-play-page .cell:disabled {
  cursor: not-allowed;
}

.xo-page-shell:fullscreen,
.xo-page-shell:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  overflow: auto;
  padding: 1rem clamp(0.75rem, 3vw, 2rem) 2rem;
  background:
    radial-gradient(
      ellipse at 12% 0%,
      rgba(59, 130, 246, 0.2),
      transparent 38rem
    ),
    radial-gradient(
      ellipse at 92% 70%,
      rgba(139, 92, 246, 0.18),
      transparent 36rem
    ),
    #080f24;
}

:fullscreen .xo-ad-rail,
:-webkit-full-screen .xo-ad-rail,
:fullscreen .xo-bottom-ad,
:-webkit-full-screen .xo-bottom-ad,
:fullscreen .xo-footer,
:-webkit-full-screen .xo-footer,
:fullscreen .xo-play-page .game-nav-header,
:-webkit-full-screen .xo-play-page .game-nav-header {
  display: none !important;
}

:fullscreen .xo-game-layout,
:-webkit-full-screen .xo-game-layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1120px;
  margin: 0 auto;
}

:fullscreen .xo-page-shell .game-container,
:-webkit-full-screen .xo-page-shell .game-container {
  max-width: 1120px;
  margin: 0 auto;
}

:fullscreen .xo-page-shell .header,
:-webkit-full-screen .xo-page-shell .header {
  padding-top: 0;
}

@media (max-width: 1000px) {
  .xo-game-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .xo-ad-rail {
    position: static;
    padding-top: 0;
  }

  .xo-ad-card {
    width: min(100%, 332px);
    margin: 0 auto;
  }
}

@media (max-width: 650px) {
  .xo-play-page .game-nav-header {
    min-height: 56px;
    padding: 0.5rem 0.65rem;
  }

  .xo-play-page .nav-btn {
    min-height: 38px;
    padding: 0.45rem 0.55rem;
    font-size: 0.78rem;
  }

  .xo-play-page .game-title {
    max-width: 42%;
    font-size: 0.76rem;
    text-align: right;
  }

  .xo-page-shell {
    width: calc(100% - 16px);
    margin: 0.75rem auto 1.5rem;
  }

  .xo-play-page .header {
    padding: 0.25rem 0.2rem;
  }

  .xo-play-page .header h1 {
    font-size: 1.85rem;
  }

  .xo-play-page .header p {
    font-size: 0.82rem;
  }

  .xo-play-page .game-area {
    padding: 1rem;
    border-radius: 16px;
  }

  .xo-play-page .setup-screen h2 {
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
  }

  .xo-play-page .setup-section {
    margin-bottom: 1.5rem;
  }

  .xo-play-page .setup-section h3 {
    margin-bottom: 0.85rem;
    font-size: 1rem;
  }

  .xo-play-page .setup-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .xo-play-page #markButtons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xo-play-page #modeButtons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xo-play-page .setup-btn {
    padding: 0.8rem 0.45rem;
    font-size: 0.85rem;
  }

  .xo-play-page .difficulty-label {
    font-size: 0.68rem;
  }

  .xo-play-page .game-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }

  .xo-play-page .info-box {
    padding: 0.7rem 0.35rem;
  }

  .xo-play-page .info-box .value {
    font-size: 1.35rem;
  }

  .xo-play-page .info-box .label {
    font-size: 0.66rem;
  }

  .xo-play-page .question-section {
    padding: 1rem;
  }

  .xo-play-page .question {
    font-size: 1rem;
  }

  .xo-play-page .options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .xo-play-page .option-btn {
    padding: 0.75rem 0.5rem;
    font-size: 0.82rem;
  }

  .xo-play-page .board {
    gap: 0.45rem;
    padding: 0.65rem;
  }

  .xo-play-page .cell {
    min-width: 0;
    font-size: clamp(1.6rem, 10vw, 2.25rem);
  }

  .xo-play-page .game-status {
    min-height: 54px;
    padding: 0.85rem;
    font-size: 1rem;
  }

  .xo-play-page .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
  }

  .xo-play-page .stat-item {
    padding: 0.75rem 0.4rem;
  }

  .xo-play-page .stat-value {
    font-size: 1.5rem;
  }

  .xo-play-page .controls {
    gap: 0.55rem;
  }

  .xo-play-page .controls .btn {
    flex: 1 1 130px;
    padding: 0.8rem 0.65rem;
    font-size: 0.82rem;
  }

  .xo-ad-card {
    width: 100%;
  }

  .xo-play-page .xo-fullscreen-toggle {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    min-height: 42px;
    padding: 0.6rem 0.8rem;
    font-size: 0.75rem;
  }

  .xo-footer {
    gap: 12px;
  }
}

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