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

:root {
  --cell-size: 72px;
  --gap: 6px;
  --color-off: #1a1a2e;
  --color-on: #f5c518;
  --color-bg: #0d0d1a;
  --color-surface: #16213e;
  --color-text: #e0e0e0;
  --color-accent: #e94560;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Courier New', monospace;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 24px;
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

h1 {
  font-size: 2rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-on);
  text-shadow: 0 0 20px var(--color-on);
}

#hud {
  display: flex;
  gap: 32px;
  font-size: 0.9rem;
  color: #aaa;
  letter-spacing: 0.1em;
}

#hud span span {
  color: var(--color-text);
  font-weight: bold;
}

#grid {
  display: grid;
  grid-template-columns: repeat(5, var(--cell-size));
  grid-template-rows: repeat(5, var(--cell-size));
  gap: var(--gap);
  background: var(--color-surface);
  padding: var(--gap);
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: 6px;
  background: var(--color-off);
  border: none;
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease;
  outline: none;
}

.cell:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.cell.on {
  background: var(--color-on);
  box-shadow: 0 0 12px var(--color-on), 0 0 30px rgba(245, 197, 24, 0.4);
}

.cell:hover {
  filter: brightness(1.2);
}

footer {
  display: flex;
  gap: 16px;
}

button {
  padding: 10px 24px;
  border: 2px solid var(--color-accent);
  background: transparent;
  color: var(--color-accent);
  font-family: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

button:hover:not(:disabled) {
  background: var(--color-accent);
  color: #fff;
}

button:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Win overlay */
#win-banner {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

#win-banner[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#win-box {
  background: var(--color-surface);
  border: 2px solid var(--color-on);
  border-radius: 12px;
  padding: 40px 56px;
  text-align: center;
  box-shadow: 0 0 60px rgba(245, 197, 24, 0.3);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#win-box p {
  font-size: 2.5rem;
  color: var(--color-on);
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px var(--color-on);
}

/* Responsive */
@media (max-width: 420px) {
  :root {
    --cell-size: 58px;
    --gap: 5px;
  }

  h1 {
    font-size: 1.5rem;
  }
}
