:root {
  --tk-bg: #020617;
  --tk-surface: #0f172a;
  --tk-accent: #38bdf8;
  --tk-accent-2: #a855f7;
  --tk-line: #1e293b;
  --tk-text: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1d283a, #020617 60%);
  color: var(--tk-text);
  display: flex;
  flex-direction: column;
}

.tk-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.16), rgba(168, 85, 247, 0.16));
  backdrop-filter: blur(10px);
}

.tk-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--tk-text);
}

.tk-title {
  margin: 0.5rem 0 0;
  font-size: 1.8rem;
}

.tk-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: #cbd5f5;
}

.tk-main {
  flex: 1;
  padding: 1.5rem 1.25rem 2.5rem;
  max-width: 960px;
  margin: 0 auto;
}

.tk-scoreboard {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.tk-score {
  min-width: 90px;
  padding: 0.6rem 0.9rem;
  border-radius: 0.8rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
  text-align: center;
}

.tk-score-label {
  display: block;
  font-size: 0.8rem;
  color: #9ca3af;
}

.tk-score-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.tk-board-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.tk-status {
  min-height: 2.2rem;
  font-size: 1rem;
  text-align: center;
}

.tk-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 120px));
  gap: 0.3rem;
  padding: 0.5rem;
  border-radius: 1rem;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.1), rgba(15, 23, 42, 0.95));
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.8);
}

.tk-cell {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 0.9rem;
  border: 2px solid var(--tk-line);
  background: rgba(15, 23, 42, 0.95);
  color: var(--tk-accent);
  font-size: clamp(3rem, 6vw, 3.8rem);
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.08s ease, border-color 0.15s ease, color 0.15s ease;
}

.tk-cell:hover {
  background: rgba(30, 64, 175, 0.75);
  transform: translateY(-1px);
}

.tk-cell:disabled {
  cursor: default;
  opacity: 0.9;
}

.tk-cell[data-mark="X"] {
  color: var(--tk-accent);
}

.tk-cell[data-mark="O"] {
  color: var(--tk-accent-2);
}

.tk-cell.tk-win {
  border-color: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.9);
}

.tk-controls {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.tk-btn {
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--tk-accent), var(--tk-accent-2));
  color: #0b1120;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}

.tk-btn-secondary {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: var(--tk-text);
}

.tk-help {
  margin-top: 2rem;
  padding: 1.25rem 1rem;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.tk-help h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.tk-help ul {
  margin: 0;
  padding-left: 1.2rem;
}

.tk-help li {
  margin-bottom: 0.35rem;
}

@media (max-width: 600px) {
  .tk-main {
    padding-inline: 0.75rem;
  }

  .tk-board {
    grid-template-columns: repeat(3, minmax(80px, 1fr));
  }
}
