* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: #ffffff;
  color: #000000;
  overflow: hidden;
}

/* Screens */
.screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.screen.hidden {
  display: none;
}

/* Menu Screen */
.menu-screen {
  background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
}

.menu-container {
  text-align: center;
}

.menu-header {
  margin-bottom: 60px;
}

.repo-btn {
  display: inline-block;
  margin-bottom: 24px;
  padding: 10px 18px;
  border: 2px solid #000000;
  color: #000000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.repo-btn:hover,
.repo-btn:focus-visible {
  background: #000000;
  color: #ffffff;
}

.main-title {
  font-size: 72px;
  font-weight: 800;
  letter-spacing: 4px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.tagline {
  font-size: 14px;
  letter-spacing: 2px;
  color: #666666;
  text-transform: uppercase;
  font-weight: 500;
}

.mode-buttons {
  display: flex;
  gap: 30px;
  justify-content: center;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 50px;
  background: #000000;
  color: #ffffff;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
}

.mode-btn:hover {
  background: #222222;
  transform: scale(1.05);
}

.mode-btn:active {
  transform: scale(0.98);
}

.btn-icon {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 2px;
}

.btn-text {
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Game Screen */
.game-screen {
  background: #ffffff;
  flex-direction: column;
  gap: 40px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  max-width: 800px;
  width: 100%;
  padding: 0 20px;
}

.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
  padding: 24px;
  background: #f0f0f0;
  border-radius: 0;
}

.player-card.p1 {
  background: #f0f0f0;
}

.player-card.p2 {
  background: #f0f0f0;
}

.player-icon {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 2px;
}

.player-title {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #666666;
  font-weight: 600;
}

.player-wins {
  font-size: 32px;
  font-weight: 700;
  font-family: "Courier New", monospace;
}

.game-status {
  flex: 1;
  text-align: center;
}

.status-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: inline-block;
  padding: 20px 40px;
  background: #000000;
  color: #ffffff;
  border-radius: 0;
}

/* Game Board */
.game-board {
  display: grid;
  grid-template-columns: repeat(3, 120px);
  gap: 12px;
  background: #ffffff;
  padding: 20px;
  border: 2px solid #000000;
}

.cell {
  width: 120px;
  height: 120px;
  background: #ffffff;
  border: 2px solid #000000;
  font-size: 48px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 2px;
}

.cell:hover:not(.taken) {
  background: #f0f0f0;
}

.cell.taken {
  cursor: not-allowed;
}

.cell.winner {
  background: #000000;
  color: #ffffff;
  animation: pulse 0.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

/* Game Footer */
.game-footer {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.footer-btn {
  padding: 16px 40px;
  font-size: 13px;
  letter-spacing: 1px;
  font-weight: 700;
  text-transform: uppercase;
  border: 2px solid #000000;
  background: #ffffff;
  color: #000000;
  cursor: pointer;
  transition: all 0.3s ease;
}

.footer-btn:hover {
  background: #000000;
  color: #ffffff;
}

.footer-btn:active {
  transform: scale(0.95);
}

.new-game-btn {
  background: #000000;
  color: #ffffff;
}

.new-game-btn:hover {
  background: #ffffff;
  color: #000000;
}

.back-btn {
  background: #ffffff;
  color: #000000;
}

.back-btn:hover {
  background: #000000;
  color: #ffffff;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background: #ffffff;
  padding: 60px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  border: 2px solid #000000;
}

.result-icon {
  font-size: 64px;
  margin-bottom: 24px;
}

.modal-content h2 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.modal-content p {
  font-size: 14px;
  color: #666666;
  letter-spacing: 1px;
  margin-bottom: 32px;
  text-transform: uppercase;
}

.modal-btn {
  padding: 14px 40px;
  font-size: 13px;
  letter-spacing: 1px;
  font-weight: 700;
  text-transform: uppercase;
  background: #000000;
  color: #ffffff;
  border: 2px solid #000000;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-btn:hover {
  background: #ffffff;
  color: #000000;
}

.modal-btn:active {
  transform: scale(0.95);
}

/* Responsive */
.screen {
  min-height: 100dvh;
  height: auto;
  padding: clamp(20px, 4vh, 48px) 16px;
}

.game-screen {
  gap: clamp(16px, 3vh, 40px);
}

.game-board {
  width: min(90vw, 428px);
  aspect-ratio: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1vw, 12px);
  padding: clamp(10px, 2vw, 20px);
}

.cell {
  width: auto;
  height: auto;
  aspect-ratio: 1;
  font-size: clamp(32px, 6vw, 48px);
}

@media (max-width: 768px) {
  .main-title {
    font-size: clamp(36px, 10vw, 48px);
    letter-spacing: 2px;
  }

  .menu-header {
    margin-bottom: 36px;
  }

  .mode-buttons {
    width: min(100%, 320px);
    flex-direction: column;
    gap: 16px;
    padding: 0;
    margin: 0 auto;
  }

  .mode-btn {
    width: 100%;
    min-width: 0;
    padding: 28px 24px;
  }

  .game-header {
    gap: 12px;
    padding: 0;
  }

  .player-card {
    padding: 16px 12px;
  }

  .status-text {
    font-size: clamp(13px, 3.5vw, 16px);
    padding: 14px 20px;
  }

  .footer-btn {
    padding: 13px 22px;
  }
}

@media (max-width: 600px) {
  .screen {
    padding: 24px 12px;
  }

  .game-screen {
    justify-content: flex-start;
  }

  .game-header {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 430px);
  }

  .game-header .p1 {
    grid-column: 1;
    grid-row: 1;
  }

  .game-header .p2 {
    grid-column: 2;
    grid-row: 1;
  }

  .game-status {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .player-icon {
    font-size: clamp(30px, 9vw, 42px);
  }

  .player-title {
    font-size: clamp(10px, 2.8vw, 12px);
    text-align: center;
  }

  .player-wins {
    font-size: clamp(24px, 7vw, 32px);
  }

  .game-board {
    width: min(92vw, 360px);
  }

  .game-footer {
    width: min(100%, 360px);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0;
  }

  .footer-btn {
    width: 100%;
    padding: 13px 8px;
    font-size: 11px;
  }

  .modal-content {
    width: calc(100% - 24px);
    padding: 40px 24px;
  }

  .modal-content h2 {
    font-size: clamp(26px, 8vw, 34px);
  }
}

@media (max-width: 380px), (max-height: 700px) and (max-width: 600px) {
  .screen {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .game-screen {
    gap: 12px;
  }

  .game-board {
    width: min(88vw, 300px);
  }

  .player-card {
    padding: 10px 8px;
    gap: 4px;
  }

  .status-text {
    padding: 11px 16px;
  }
}
