*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.az-portal-back {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(6px);
  transition: background 0.2s;
}
.az-portal-back:hover { background: rgba(0,0,0,0.75); }

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #e0e0e0;
}

.container {
  text-align: center;
  padding: 2rem;
  position: relative;
}

h1 {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 2rem;
  background: linear-gradient(90deg, #e94560, #0f3460);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

/* Setup screen */
.setup p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: #aaa;
}

.side-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.difficulty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.difficulty label {
  color: #aaa;
  font-size: 0.95rem;
}

.difficulty select {
  background: #1a1a2e;
  border: 1px solid #e94560;
  color: #e0e0e0;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  outline: none;
}

/* Buttons */
.btn {
  background: #e94560;
  color: #fff;
  border: none;
  padding: 0.75rem 1.75rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.35);
}

.btn:hover {
  background: #c73652;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #0f3460;
  box-shadow: 0 4px 15px rgba(15, 52, 96, 0.4);
}

.btn-secondary:hover {
  background: #1a4a80;
  box-shadow: 0 6px 20px rgba(15, 52, 96, 0.6);
}

.btn-ghost {
  background: transparent;
  border: 1px solid #555;
  box-shadow: none;
  color: #aaa;
  font-size: 0.85rem;
  padding: 0.5rem 1.25rem;
}

.btn-ghost:hover {
  border-color: #e94560;
  color: #e94560;
  background: transparent;
  box-shadow: none;
}

.hint {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.75;
}

/* Board */
.game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.status {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e0e0e0;
  min-height: 1.5rem;
  letter-spacing: 0.5px;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 110px);
  grid-template-rows: repeat(3, 110px);
  gap: 8px;
}

.cell {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  user-select: none;
}

.cell:hover:not(.taken) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(233, 69, 96, 0.5);
  transform: scale(1.04);
}

.cell.x {
  color: #e94560;
}

.cell.o {
  color: #53d8fb;
}

.cell.winning {
  background: rgba(233, 69, 96, 0.2);
  border-color: #e94560;
  animation: pulse 0.6s ease-in-out infinite alternate;
}

.cell.o.winning {
  background: rgba(83, 216, 251, 0.2);
  border-color: #53d8fb;
}

@keyframes pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

.cell.taken {
  cursor: default;
}

/* Scores */
.scores {
  display: flex;
  gap: 1.5rem;
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
  min-width: 80px;
}

.score-label {
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #e0e0e0;
}

/* Win overlay */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.win-message {
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 30px rgba(233, 69, 96, 0.8);
}

.hidden {
  display: none !important;
}

/* Thinking indicator */
.thinking::after {
  content: '...';
  animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
  0%   { content: '.'; }
  33%  { content: '..'; }
  66%  { content: '...'; }
}
