/* Tic-Tac-Toe — tokens come from /assets/base.css */

html, body { height: 100%; overflow: hidden; }

body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 16px;
}

.app {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.top {
  width: 100%;
  text-align: center;
  padding-left: 52px;
  padding-right: 8px;
}
.top h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel {
  width: 100%;
  background: linear-gradient(145deg, rgba(16, 20, 38, 0.95), #090c18 50%, #05060f 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 26px;
  padding: 24px 22px 22px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.hidden { display: none !important; }

/* Menu */
.menu-panel { padding: 30px 22px 24px; }
.menu-title {
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.menu-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.menu-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  color: var(--muted);
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.status {
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
  min-height: 1.5em;
}
.status.win { color: var(--accent); font-weight: 600; }
.status.draw { color: var(--text); }

/* Board */
.board-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
}
.board {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  background: transparent;
}
.cell {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(2.5rem, 11vw, 3.8rem);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease, border-color 0.18s ease;
  user-select: none;
}
.cell:hover:not(.filled):not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--accent);
}
.cell:disabled { cursor: default; }
.cell.x { color: var(--accent); animation: pop 0.25s ease; }
.cell.o { color: #ff8eb3; animation: pop 0.25s ease; }
@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Winning line overlay */
.win-line {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.win-line.show {
  opacity: 1;
  filter: drop-shadow(0 0 8px var(--accent));
}
.win-line line {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
}
.win-line.show line { animation: drawLine 0.45s ease forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }

/* Scoreboard */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.score {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.score-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.score-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}

.game-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.primary-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 11px 24px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.primary-btn:hover {
  background: rgba(138, 124, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(138, 124, 255, 0.3);
}
.ghost-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--text);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.ghost-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 600px) {
  .panel { padding: 18px 16px 16px; border-radius: 22px; }
  .cell { font-size: clamp(2.2rem, 14vw, 3.2rem); }
}
