/* === GAME SHELL === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body.game-page {
  background: #0a0f1e;
  color: #e2e8f0;
  font-family: "JetBrains Mono", monospace;
  cursor: default;
  overflow-x: hidden;
}

/* NAV */
.game-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  background: rgba(10, 15, 30, 0.9);
  border-bottom: 1px solid rgba(0, 245, 255, 0.15);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.5px;
}
.brand i {
  font-size: 18px;
  color: #00f5ff;
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.4);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 8px;
  color: #00f5ff;
  background: rgba(0, 245, 255, 0.05);
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: rgba(0, 245, 255, 0.12);
  border-color: #00f5ff;
}

/* CONTAINER */
.game-area {
  max-width: 600px;
  margin: 48px auto 80px;
  padding: 0 20px;
}

/* DETAILED DECK */
.game-deck {
  border-radius: 16px;
  border: 1px solid rgba(0, 245, 255, 0.2);
  background: rgba(0, 245, 255, 0.02);
  padding: 40px 24px;
  box-shadow:
    0 0 40px rgba(0, 245, 255, 0.05),
    inset 0 0 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

/* Corner ticks */
.game-deck::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-top: 2px solid #00f5ff;
  border-right: 2px solid #00f5ff;
  top: 12px;
  right: 12px;
}
.game-deck::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-bottom: 2px solid #00f5ff;
  border-left: 2px solid #00f5ff;
  bottom: 12px;
  left: 12px;
}

/* HEADER */
.game-header {
  text-align: center;
  margin-bottom: 30px;
}
.game-kicker {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #00f5ff;
  margin-bottom: 8px;
  font-family: "Orbitron", sans-serif;
  display: block;
}
.game-title {
  font-family: "Orbitron", sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: 1px;
}
.game-desc {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  line-height: 1.6;
  max-width: 460px;
  margin: 0 auto;
}

/* === LOBBY BOX === */
.ttt-lobby {
  border-radius: 12px;
  border: 1px solid rgba(0, 245, 255, 0.2);
  background: rgba(0, 245, 255, 0.02);
  padding: 30px 20px;
  text-align: center;
  max-width: 440px;
  margin: 0 auto;
  position: relative;
}
.ttt-lobby::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-top: 2px solid #00f5ff;
  border-right: 2px solid #00f5ff;
  top: 8px;
  right: 8px;
}
.ttt-lobby::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-bottom: 2px solid #00f5ff;
  border-left: 2px solid #00f5ff;
  bottom: 8px;
  left: 8px;
}
.ttt-lobby h3 {
  font-family: "Orbitron", sans-serif;
  color: #fff;
  font-size: 16px;
  margin-bottom: 20px;
  letter-spacing: 1px;
}
.lobby-modes {
  display: flex;
  gap: 10px;
  max-width: 320px;
  margin: 0 auto 24px;
  border: 1px solid rgba(0, 245, 255, 0.25);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}
.lobby-btn {
  flex: 1;
  padding: 10px 6px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 1px;
}
.lobby-btn.active {
  background: rgba(0, 245, 255, 0.12);
  color: #00f5ff;
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.4);
}
.lobby-action-box {
  display: none;
}
.lobby-action-box.active {
  display: block;
}

.matiks-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: 8px;
  color: #fff;
  padding: 10px 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  width: 110px;
  text-align: center;
  outline: none;
  transition: all 0.2s;
}
.matiks-input:focus {
  border-color: #00f5ff;
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
}
.matiks-status-log {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 14px;
  font-family: "JetBrains Mono", monospace;
}
.room-code-display {
  font-family: "Orbitron", sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: #00f5ff;
  letter-spacing: 4px;
  text-shadow: 0 0 14px rgba(0, 245, 255, 0.6);
  margin: 14px 0;
}
.start-btn {
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid rgba(0, 245, 255, 0.4);
  background: rgba(0, 245, 255, 0.1);
  color: #00f5ff;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.start-btn:hover {
  background: rgba(0, 245, 255, 0.2);
  box-shadow: 0 0 14px rgba(0, 245, 255, 0.3);
}

/* === AI TIC-TAC-TOE LAYOUT === */
.ttt-layout {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.ttt-layout.active {
  display: flex;
}
.ttt-status {
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  color: #00f5ff;
  letter-spacing: 1px;
  min-height: 22px;
  text-align: center;
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.3);
}
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 300px;
  width: 100%;
  margin: 10px 0;
}
.ttt-cell {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 2px solid rgba(0, 245, 255, 0.15);
  background: rgba(0, 245, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Orbitron", sans-serif;
  font-size: 36px;
  font-weight: 900;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.15s;
  user-select: none;
}
.ttt-cell:hover:not(.taken) {
  background: rgba(0, 245, 255, 0.08);
  border-color: rgba(0, 245, 255, 0.5);
  transform: scale(1.04);
}
.ttt-cell.taken {
  cursor: not-allowed;
}
.ttt-cell.x-mark {
  color: #00f5ff;
  text-shadow: 0 0 14px rgba(0, 245, 255, 0.7);
}
.ttt-cell.o-mark {
  color: #f59e0b;
  text-shadow: 0 0 14px rgba(245, 158, 11, 0.7);
}
.ttt-cell.winner-cell {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  animation: winPulse 0.6s ease infinite alternate;
}
@keyframes winPulse {
  from {
    box-shadow: 0 0 0 rgba(34, 197, 94, 0.2);
  }
  to {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
  }
}

.ttt-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin-top: 10px;
}
.ttt-score {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 1px;
  font-weight: 700;
}
.restart-btn {
  padding: 12px 32px;
  border-radius: 8px;
  border: 1px solid rgba(0, 245, 255, 0.3);
  background: rgba(0, 245, 255, 0.06);
  color: #00f5ff;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.restart-btn:hover {
  background: rgba(0, 245, 255, 0.16);
  box-shadow: 0 0 16px rgba(0, 245, 255, 0.25);
  border-color: #00f5ff;
}

/* Scanline overlay */
.arcade-scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.02) 2px,
    rgba(0, 0, 0, 0.02) 4px
  );
}
