:root {
  color-scheme: light dark;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f3f4f6;
  color: #111827;
}

main {
  max-width: 38rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header h1 {
  margin-bottom: 0.25rem;
  font-size: 1.75rem;
}

.lede {
  margin-top: 0;
  color: #4b5563;
}

.game,
.connection {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  background: #ffffff;
}

.game-label {
  margin: 0;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4b5563;
}

.game-status {
  margin: 0.25rem 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 4.5rem);
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  min-height: 0;
  padding: 0;
  border: 1px solid #9ca3af;
  border-radius: 0.5rem;
  background: #f9fafb;
  color: #111827;
  font-size: 2rem;
  font-weight: 700;
}

.cell:hover:not(:disabled) {
  background: #eef2ff;
}

.cell:disabled {
  opacity: 1;
  cursor: default;
}

.cell[data-mark="x"] {
  color: #1d4ed8;
}

.cell[data-mark="o"] {
  color: #b91c1c;
}

button {
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid #1f2937;
  border-radius: 0.5rem;
  background: #1f2937;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.field {
  display: grid;
  gap: 0.35rem;
}

input {
  min-height: 2.75rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid #9ca3af;
  border-radius: 0.5rem;
  font: inherit;
}

.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.status {
  margin-bottom: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  background: #f3f4f6;
}

.status[data-state="connected"] {
  background: #dcfce7;
  color: #14532d;
}

.status[data-state="error"] {
  background: #fee2e2;
  color: #7f1d1d;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}