:root {
  --bg-color: #0d1117;
  --card-bg: #161b22;
  --card-border: #30363d;
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --color-x: #58a6ff;
  --color-o: #f0883e;
  --color-win: #238636;
  --color-win-bg: rgba(35, 134, 54, 0.2);
  --cell-bg: #21262d;
  --cell-hover: #292e36;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

#app {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.game-header {
  text-align: center;
}

.game-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem;
}

.mode-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.mode-select select {
  background: var(--cell-bg);
  color: var(--text-main);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--cell-bg);
  padding: 0.5rem 0.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.score-card.active {
  border-color: var(--color-x);
  transform: translateY(-1px);
}

.score-card.player-o.active {
  border-color: var(--color-o);
}

.score-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-card .score {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.score-card.player-x .score {
  color: var(--color-x);
}

.score-card.player-o .score {
  color: var(--color-o);
}

.board-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-banner {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: var(--card-bg);
  padding: 0.5rem;
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.cell {
  aspect-ratio: 1 / 1;
  background: var(--cell-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.1s ease;
  user-select: none;
}

.cell:hover:not(:disabled) {
  background: var(--cell-hover);
  transform: scale(0.98);
}

.cell:disabled {
  cursor: default;
}

.cell.x {
  color: var(--color-x);
}

.cell.o {
  color: var(--color-o);
}

.cell.winning {
  background: var(--color-win-bg);
  border-color: var(--color-win);
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.03); }
}

.actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  flex: 1;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.btn-secondary {
  background: #238636;
  color: #fff;
  border-color: #2ea043;
}

.btn-secondary:hover {
  background: #2ea043;
}

.btn-tertiary {
  background: var(--cell-bg);
  color: var(--text-muted);
}

.btn-tertiary:hover {
  background: var(--cell-hover);
  color: var(--text-main);
}

/* WARDEN_PATCH:LOBBY_BOOTSTRAP */
.warden-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #161b22;
  border: 1px solid #c6a66455;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
}
.warden-logo-lockup {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: #e5c158;
}
.warden-season-pill {
  background: rgba(229, 193, 88, 0.15);
  border: 1px solid rgba(229, 193, 88, 0.4);
  color: #e5c158;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.65rem;
}
.warden-lobby-status {
  font-size: 0.7rem;
  color: #3fb950;
  font-family: monospace;
}
.warden-lobby-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1.5rem;
}
.warden-lobby-card {
  width: 100%;
  max-width: 380px;
  background: #161b22;
  border: 1px solid #c6a66466;
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.warden-emblem-lg {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.warden-loader-sub {
  color: #8b949e;
  font-size: 0.85rem;
  margin: 0.35rem 0 1rem;
}
.warden-loader-track {
  height: 8px;
  width: 100%;
  background: #21262d;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #30363d;
}
.warden-loader-fill {
  height: 100%;
  width: 15%;
  background: linear-gradient(90deg, #c6a664, #3fb950);
  transition: width 0.35s ease;
}
.warden-play-cta {
  width: 100%;
  font-size: 1rem;
  padding: 0.8rem 1.2rem;
  margin-top: 0.5rem;
}

/* WARDEN_PATCH:TROPHY_ASSETS */
.warden-trophy-ladder {
  background: linear-gradient(135deg, #161b22 0%, #1c2128 100%);
  border: 1px solid #e5c15866;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 0 18px rgba(229, 193, 88, 0.12);
}
.warden-trophy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
}
.warden-league-badge {
  color: #58a6ff;
  letter-spacing: 0.04em;
}
.warden-trophy-count {
  color: #e5c158;
  font-family: monospace;
  font-size: 0.85rem;
}
.warden-sprite-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
}
.warden-sprite-pill {
  text-align: center;
  font-size: 0.68rem;
  padding: 0.3rem 0.2rem;
  border-radius: 6px;
  background: #21262d;
  border: 1px solid #30363d;
  color: #8b949e;
}
.warden-sprite-pill.unlocked {
  color: #f0f6fc;
  border-color: #3fb95066;
}
.warden-sprite-pill.active {
  color: #e5c158;
  border-color: #e5c158;
  background: rgba(229, 193, 88, 0.14);
  font-weight: 700;
}

/* WARDEN_PATCH:CRASH_HOTFIX */
.warden-hotfix-badge {
  text-align: center;
  font-size: 0.72rem;
  font-family: monospace;
  color: #3fb950;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.35);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
}
