/* Tic Tac Toe Game Styles */

:root {
  --bg-dark: hsl(240, 10%, 3.9%);
  --board-dark: hsl(240, 5%, 7%);
  --text: hsl(0, 0%, 100%);
  --muted: hsl(240, 5%, 64.9%);
  --hover: hsl(240, 5%, 84.9%);
  
  --player-x: #ffffff;
  --player-x-light: #ffffff;
  --player-o: #ffffff;
  --player-o-light: #ffffff;
  
  --success: hsl(142, 71%, 45%);
  --success-light: hsl(142, 71%, 60%);
  
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  padding: 1rem;
}

main#app {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Header */
.header {
  text-align: center;
  padding: 1rem 0;
}

.header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, var(--player-x), var(--player-o));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.status {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.status.player-x-turn {
  background: #ff6b6b;
  color: white;
}

.status.player-o-turn {
  background: #4dabf7;
  color: white;
}

.status.default {
  color: var(--muted);
  background: transparent;
}

/* Board Container */
.board-container {
  background: var(--board-dark);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-lg);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto;
}

.cell {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  font-size: 6rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell:hover:not(:disabled):not(.filled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.cell:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.cell.x {
  color: #ff6b6b !important;
  opacity: 1 !important;
  filter: none !important;
}

.cell.o {
  color: #4dabf7 !important;
  opacity: 1 !important;
  filter: none !important;
}

.cell.winner {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--success);
  animation: pulse 0.5s ease;
}

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

/* Controls */
.controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn.destructive {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.action-btn.destructive:hover:not(:disabled) {
  background: var(--success-light);
  border-color: var(--success-light);
}

.btn-icon {
  font-size: 1.2rem;
}

/* Mode Selector */
.mode-selector {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.mode-btn {
  flex: 1;
  max-width: 200px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.mode-btn.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--success);
  border-width: 2px;
  color: var(--text);
}

/* Settings */
.settings {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: nowrap;
  justify-content: center;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.setting-group label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.setting-group {
  position: relative;
}

.setting-group select {
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
}

.setting-group::after {
  content: '▼';
  position: absolute;
  right: 1rem;
  bottom: 0.5rem;
  pointer-events: none;
  color: var(--text);
  font-size: 0.75rem;
  opacity: 0.7;
}

.setting-group select:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.setting-group select:focus {
  outline: none;
  border-color: var(--success);
}

.setting-group select option {
  background: var(--board-dark);
  color: var(--text);
  padding: 0.5rem;
}

.setting-group select option:hover,
.setting-group select option:checked {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

/* More Games */
.more-games {
  margin-top: 16px;
  padding: 2px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.more-games-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.more-games-left {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.more-games-line1 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.more-games-title {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.more-games-links {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.more-games-link {
  color: var(--player-x);
  text-decoration: none;
  font-size: 0.75rem;
  transition: color 0.2s ease;
  white-space: nowrap;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.more-games-link:hover {
  color: var(--player-x-light);
  text-decoration: underline;
}

.more-games-right {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-link {
  display: inline-block;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.logo-link:hover {
  opacity: 0.8;
}

.logo-link .logo {
  height: 40px;
  width: auto;
  max-height: 40px;
  max-width: 100px;
  opacity: 0.7;
  display: block;
  object-fit: contain;
}

.more-games-line2 {
  display: inline-flex;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.more-games-line2 .feedback-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.more-games-line2 .feedback-link:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 0.5rem;
  }
  
  main#app {
    gap: 0.75rem;
  }
  
  .header {
    padding: 0.75rem 0;
  }
  
  .header h1 {
    font-size: 1.75rem;
  }
  
  .status {
    font-size: 1rem;
  }
  
  .board-container {
    padding: 0.75rem;
  }
  
  .board {
    gap: 0.5rem;
  }
  
  .cell {
    font-size: 4rem;
  }
  
  .action-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
  
  .mode-btn {
    max-width: none;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
  
  .settings {
    padding: 0.75rem;
    gap: 0.5rem;
  }
  
  .setting-group label {
    font-size: 0.75rem;
  }
  
  .setting-group select {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
  }
  
  .more-games-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .more-games-left {
    width: 100%;
  }
  
  .more-games-right {
    align-self: flex-end;
  }
  
  .logo-link .logo {
    height: 32px;
    max-height: 32px;
    max-width: 70px;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.75rem;
  }
  
  .board-container {
    padding: 1rem;
  }
  
  .board {
    gap: 0.5rem;
  }
  
  .cell {
    font-size: 4rem;
  }
  
  .action-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
  
  .more-games-content {
    flex-direction: column;
  }
}

/* Safe area for iOS notch */
@supports (padding: max(0px)) {
  main#app {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

