:root {
  --bg: #f7f5f0;
  --fg: #1e1e1e;
  --cell-bg: #ffffff;
  --cell-border: #d8d3c7;
  --marked-bg: #2a9d8f;
  --marked-fg: #ffffff;
  --accent: #e76f51;
  --bingo-outline: #f4a261;
  --muted: #8a8578;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--cell-border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: 0.02em;
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

button {
  font: inherit;
  padding: 0.4rem 0.8rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }

.status {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}
.status--live { background: #2a9d8f; }
.status--connecting { background: #e9c46a; }
.status--dead { background: #e63946; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.cell {
  aspect-ratio: 1 / 1;
  background: var(--cell-bg);
  border: 1px solid var(--cell-border);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  font-size: clamp(0.65rem, 1.6vw, 0.95rem);
  line-height: 1.15;
  overflow: hidden;
  word-break: break-word;
  transition: background 0.15s, color 0.15s, transform 0.05s;
}
.cell:hover { border-color: var(--accent); }
.cell:active { transform: scale(0.98); }

.cell.marked {
  background: var(--marked-bg);
  color: var(--marked-fg);
  border-color: var(--marked-bg);
  text-decoration: line-through;
}

.cell.bingo {
  outline: 3px solid var(--bingo-outline);
  outline-offset: -3px;
}

@media (max-width: 480px) {
  header h1 { font-size: 1.05rem; }
  button { padding: 0.35rem 0.6rem; }
  main { padding: 0.5rem; }
  .grid { gap: 4px; }
}
