* {
  box-sizing: border-box;
}

:root {
  --pink: #ff37f5;
  --pink-soft: #ff8cff;
  --violet: #7d00ff;
  --acid: #a6ff00;
  --ink: #030006;
  --panel: rgba(9, 2, 14, 0.92);
  --line: rgba(255, 55, 245, 0.72);
}

body {
  margin: 0;
  min-height: 100vh;
  color: #ffe8ff;
  font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 55, 245, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(166, 255, 0, 0.08) 0 1px, transparent 1px 32px),
    radial-gradient(circle at 100% 100%, rgba(125, 0, 255, 0.35), transparent 34%),
    #050008;
  display: grid;
  place-items: center;
  overflow-x: hidden;
}

.game-shell {
  width: min(98vw, 1220px);
  min-height: min(90vh, 660px);
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.12fr);
  gap: clamp(16px, 2.4vw, 28px);
  align-items: center;
  padding: clamp(18px, 3vw, 34px);
  position: relative;
  background:
    linear-gradient(90deg, rgba(255, 55, 245, 0.16), transparent 18% 82%, rgba(255, 55, 245, 0.16)),
    var(--panel);
  border: 2px solid var(--line);
  clip-path: polygon(5% 0, 95% 0, 100% 9%, 100% 91%, 95% 100%, 5% 100%, 0 91%, 0 9%);
  box-shadow:
    0 0 22px rgba(255, 55, 245, 0.72),
    inset 0 0 48px rgba(255, 55, 245, 0.18),
    inset 0 0 90px rgba(0, 0, 0, 0.94);
}

.game-shell::before,
.game-shell::after {
  content: '';
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border: 1px solid rgba(166, 255, 0, 0.36);
  clip-path: polygon(8% 0, 92% 0, 100% 12%, 100% 88%, 92% 100%, 8% 100%, 0 88%, 0 12%);
}

.game-shell::after {
  inset: 34px 50%;
  width: 1px;
  border: 0;
  background: linear-gradient(transparent, var(--acid), transparent);
  box-shadow: 0 0 14px var(--acid);
}

.intro-panel,
.board-panel {
  position: relative;
  z-index: 1;
}

.intro-panel {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: clamp(14px, 3vw, 28px);
}

.hud-crown {
  width: min(30vw, 285px);
  height: 82px;
  background:
    linear-gradient(135deg, transparent 16%, rgba(255, 55, 245, 0.9) 17% 20%, transparent 21%),
    linear-gradient(225deg, transparent 16%, rgba(255, 55, 245, 0.9) 17% 20%, transparent 21%),
    linear-gradient(90deg, transparent 10%, rgba(255, 55, 245, 0.72), transparent 90%);
  clip-path: polygon(50% 0, 62% 58%, 94% 48%, 78% 78%, 100% 100%, 0 100%, 22% 78%, 6% 48%, 38% 58%);
  filter: drop-shadow(0 0 12px var(--pink)) drop-shadow(0 0 22px var(--violet));
}

.eyebrow {
  margin: 0;
  color: var(--acid);
  font-family: Consolas, 'Courier New', monospace;
  font-size: clamp(10px, 1.4vw, 14px);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(166, 255, 0, 0.9);
}

h1 {
  margin: 0;
  font-size: clamp(48px, 6.6vw, 86px);
  line-height: 0.86;
  letter-spacing: 0;
  color: #ffe8ff;
  text-shadow:
    0 0 5px white,
    0 0 14px var(--pink),
    0 0 32px var(--pink),
    6px 6px 0 rgba(125, 0, 255, 0.7);
}

.player-row {
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.player-card {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--line);
  clip-path: polygon(14% 0, 100% 0, 100% 72%, 86% 100%, 0 100%, 0 28%);
  box-shadow: 0 0 16px rgba(255, 55, 245, 0.45), inset 0 0 24px rgba(255, 55, 245, 0.12);
}

.player-card strong,
.player-card small,
.score-line {
  display: block;
  font-family: Consolas, 'Courier New', monospace;
  text-transform: uppercase;
  text-align: left;
}

.player-o strong,
.player-o small,
.player-o .score-line {
  text-align: right;
}

.player-card strong {
  color: var(--acid);
  font-size: clamp(10px, 1.4vw, 13px);
}

.player-card small {
  color: rgba(166, 255, 0, 0.7);
  font-size: 9px;
}

.player-mark,
.versus {
  color: #ffe8ff;
  text-shadow: 0 0 8px var(--pink), 0 0 20px var(--pink);
}

.player-mark {
  font-size: 34px;
}

.versus {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--acid);
  border: 1px solid rgba(166, 255, 0, 0.55);
  border-radius: 50%;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 0 14px rgba(166, 255, 0, 0.55);
}

.board-panel {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.status-bar {
  width: min(100%, 560px);
  min-height: 36px;
  display: grid;
  place-items: center;
  color: var(--acid);
  font-family: Consolas, 'Courier New', monospace;
  font-size: clamp(12px, 1.5vw, 15px);
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.76);
  border: 1px solid rgba(166, 255, 0, 0.5);
  box-shadow: 0 0 12px rgba(166, 255, 0, 0.42), inset 0 0 20px rgba(166, 255, 0, 0.08);
}

#container {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(10px, 1.8vw, 18px);
  background: rgba(0, 0, 0, 0.88);
  border: 3px solid var(--pink);
  box-shadow:
    0 0 10px #fff,
    0 0 24px var(--pink),
    0 0 46px var(--violet),
    inset 0 0 30px rgba(255, 55, 245, 0.28);
}

table {
  border-collapse: collapse;
}

td {
  width: clamp(104px, 13vw, 166px);
  height: clamp(104px, 13vw, 166px);
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  background: rgba(24, 6, 28, 0.82);
  border-color: rgba(255, 140, 255, 0.78);
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

td:not(:last-child) {
  border-right: 4px solid rgba(255, 140, 255, 0.78);
}

tr:not(:last-child) td {
  border-bottom: 4px solid rgba(255, 140, 255, 0.78);
}

td:hover {
  background: rgba(255, 55, 245, 0.14);
  box-shadow: inset 0 0 28px rgba(255, 55, 245, 0.26);
}

.mark-image {
  width: clamp(86px, 10.5vw, 136px);
  height: clamp(86px, 10.5vw, 136px);
  object-fit: contain;
  display: block;
  margin: auto;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 0 8px var(--pink)) drop-shadow(0 0 18px var(--pink));
  animation: mark-pop 0.18s ease-out both;
}

@keyframes mark-pop {
  from {
    opacity: 0;
    transform: scale(0.58) rotate(-5deg);
  }

  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.win-line {
  position: absolute;
  inset: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 18px var(--pink));
}

#restartBtn {
  min-height: 44px;
  padding: 0 28px;
  color: var(--acid);
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid var(--line);
  clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
  cursor: pointer;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 0 16px rgba(255, 55, 245, 0.42), inset 0 0 22px rgba(255, 55, 245, 0.12);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

#restartBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(255, 55, 245, 0.72), inset 0 0 26px rgba(255, 55, 245, 0.2);
}

#restartBtn:active {
  transform: translateY(1px);
}

@media (max-width: 860px) {
  body {
    padding: 18px 0;
  }

  .game-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .game-shell::after {
    display: none;
  }

  .hud-crown {
    width: min(78vw, 280px);
    height: 76px;
  }

  .player-row {
    grid-template-columns: 1fr;
    width: min(100%, 360px);
  }

  .versus {
    justify-self: center;
  }
}