:root {
  --bg: #f3f4f6;
  --bg-strong: #e2e5ea;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --accent: #2b7a78;
  --accent-soft: #d9f1ef;
  --line: #cdd6e1;
  --shadow: 0 22px 50px rgba(18, 25, 38, 0.12);
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Futura", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, #ffffff 0%, #f2f4f8 40%, #e1e6ec 100%),
    linear-gradient(135deg, #fafafa 0%, #f3f4f6 60%, #e7ecf2 100%);
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px 48px;
  position: relative;
  overflow: hidden;
}

.page::before,
.page::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(43, 122, 120, 0.08);
  filter: blur(2px);
  z-index: 0;
}

.page::before {
  top: -60px;
  right: -60px;
}

.page::after {
  bottom: -80px;
  left: -80px;
}

.card {
  width: min(92vw, 520px);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  align-self: flex-start;
}

.home-link:hover {
  color: var(--ink);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.hero h1 {
  font-size: 40px;
  margin: 0;
  letter-spacing: 0.12em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #f0f3f7;
  border-radius: 999px;
  padding: 4px;
  gap: 6px;
}

.seg {
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.seg.active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(27, 35, 49, 0.12);
}

.cpu-settings,
.realtime-settings {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #ecf0f6;
  border-radius: 14px;
  background: #f9fbfd;
}

.cpu-settings[data-visible="false"],
.realtime-settings[data-visible="false"] {
  display: none;
}

.control {
  display: grid;
  gap: 6px;
}

.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #556070;
}

.toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #1f2a44;
}

.choices.choices-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice {
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.choice.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.status {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  min-height: 20px;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cell {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f8fb;
  font-size: 36px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cell:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

@media (hover: hover) {
  .cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(27, 35, 49, 0.12);
    border-color: var(--accent);
  }
}

.cell:active {
  transform: scale(0.97);
}

.cell.win {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  animation: winPulse 1s ease-in-out infinite;
}

@keyframes winPulse {
  0% {
    box-shadow: 0 0 0 rgba(43, 122, 120, 0.1);
  }
  50% {
    box-shadow: 0 0 18px rgba(43, 122, 120, 0.4);
  }
  100% {
    box-shadow: 0 0 0 rgba(43, 122, 120, 0.1);
  }
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.actions button,
.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--ink);
  color: #ffffff;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.actions button:hover,
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(27, 35, 49, 0.18);
}

.actions button.ghost,
.btn.ghost {
  background: #f0f3f7;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.small {
  padding: 6px 8px;
  font-size: 11px;
  border-radius: 10px;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
  background: #ffffff;
  color: var(--ink);
}

.rt-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f6;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

.rt-meta {
  font-size: 11px;
  color: var(--muted);
}

.divider {
  height: 1px;
  background: #eef2f6;
}

.chat-list {
  min-height: 72px;
  max-height: 130px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 6px;
  display: grid;
  gap: 4px;
}

.chat-msg {
  font-size: 11px;
  color: var(--ink);
}

.chat-meta {
  font-weight: 600;
  color: var(--muted);
}

.chat-meta.x {
  color: #b45309;
}

.chat-meta.o {
  color: #0f766e;
}

.chat-row {
  display: flex;
  gap: 6px;
}

.chat-note {
  font-size: 11px;
  color: var(--muted);
  min-height: 16px;
}

@media (max-width: 480px) {
  .card {
    padding: 22px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .cell {
    font-size: 32px;
  }

  .seg {
    font-size: 11px;
    padding: 8px 8px;
  }
}
