/* ============================================
   Tic Tac Toe — Professional Stylesheet
   ============================================ */

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-gradient-1: #0f0c29;
  --bg-gradient-2: #302b63;
  --bg-gradient-3: #24243e;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --accent-x: #ff4d6d;
  --accent-o: #4dd0ff;
  --text-primary: #ffffff;
  --text-muted: #b8b8d1;
  --shadow-glow: 0 0 25px rgba(255, 255, 255, 0.15);
}

html,
body {
  min-height: 100%;
  font-family: "Segoe UI", "Poppins", system-ui, -apple-system, sans-serif;
  background: linear-gradient(
    135deg,
    var(--bg-gradient-1),
    var(--bg-gradient-2),
    var(--bg-gradient-3)
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
}

body {
  padding: 20px 0;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== Screens ===== */
.screen {
  display: none;
  width: 100%;
  justify-content: center;
  align-items: center;
}

.screen.active {
  display: flex;
}

/* ===== Glass Card ===== */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 40px 45px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-align: center;
  width: 100%;
  max-width: 440px;
  animation: floatIn 0.8s ease-out;
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Header ===== */
.title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, var(--accent-x), var(--accent-o));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 28px;
}

/* ===== Options (mode / symbol buttons) ===== */
.options {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.options-row {
  flex-direction: row;
  justify-content: center;
  margin-bottom: 20px;
}

/* ===== Buttons ===== */
.btn {
  padding: 14px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-primary);
  background: linear-gradient(
    135deg,
    rgba(255, 77, 109, 0.85),
    rgba(77, 208, 255, 0.85)
  );
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), var(--shadow-glow);
  filter: brightness(1.1);
}

.btn:active {
  transform: translateY(0);
}

.btn-option {
  justify-content: flex-start;
  padding: 16px 22px;
  font-size: 1rem;
  border-radius: 16px;
}

.btn-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.btn-label {
  flex: 1;
  text-align: left;
}

/* ===== Symbol Buttons ===== */
.btn-symbol {
  width: 110px;
  height: 110px;
  font-size: 3rem;
  font-weight: 800;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-symbol.symbol-x {
  color: var(--accent-x);
  text-shadow: 0 0 20px rgba(255, 77, 109, 0.5);
}

.btn-symbol.symbol-x:hover {
  background: rgba(255, 77, 109, 0.18);
  border-color: var(--accent-x);
}

.btn-symbol.symbol-o {
  color: var(--accent-o);
  text-shadow: 0 0 20px rgba(77, 208, 255, 0.5);
}

.btn-symbol.symbol-o:hover {
  background: rgba(77, 208, 255, 0.18);
  border-color: var(--accent-o);
}

/* ===== Back / Secondary Buttons ===== */
.btn-back,
.btn-secondary {
  margin-top: 10px;
  padding: 10px 24px;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  box-shadow: none;
}

.btn-back:hover,
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  box-shadow: none;
  filter: none;
}

/* ===== Status Bar ===== */
.status {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 22px;
  min-height: 28px;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.status .player-x { color: var(--accent-x); }
.status .player-o { color: var(--accent-o); }
.status.win  { animation: pop 0.5s ease; }
.status.draw { color: #ffd166; }

@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ===== Board ===== */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.cell {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.25s ease;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.15),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cell:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.cell:hover:not(.disabled)::before {
  opacity: 1;
}

.cell:active:not(.disabled) {
  transform: translateY(0);
}

.cell.disabled {
  cursor: not-allowed;
}

.cell.x {
  color: var(--accent-x);
  text-shadow: 0 0 20px rgba(255, 77, 109, 0.6);
}

.cell.o {
  color: var(--accent-o);
  text-shadow: 0 0 20px rgba(77, 208, 255, 0.6);
}

.cell.win {
  background: rgba(255, 255, 255, 0.18);
  animation: winPulse 0.8s ease infinite alternate;
  border-color: rgba(255, 255, 255, 0.4);
}

@keyframes winPulse {
  from { box-shadow: 0 0 10px rgba(255, 255, 255, 0.3); }
  to   { box-shadow: 0 0 25px rgba(255, 255, 255, 0.7); }
}

.cell .mark {
  animation: markIn 0.3s ease-out;
}

@keyframes markIn {
  from { opacity: 0; transform: scale(0.4) rotate(-45deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

/* ===== Scoreboard ===== */
.scoreboard {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 22px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
}

.score-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.score-label {
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.score-value {
  font-size: 1.3rem;
  font-weight: 700;
}

.score-x .score-label,
.score-x .score-value { color: var(--accent-x); }

.score-o .score-label,
.score-o .score-value { color: var(--accent-o); }

.score-draw .score-value { color: #ffd166; }

/* ===== Game Actions ===== */
.game-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .glass-card {
    padding: 30px 22px;
    border-radius: 20px;
  }

  .title { font-size: 1.6rem; }

  .cell {
    width: 78px;
    height: 78px;
    font-size: 2.2rem;
    border-radius: 12px;
  }

  .board { gap: 10px; }

  .btn-symbol {
    width: 90px;
    height: 90px;
    font-size: 2.4rem;
  }
}