:root {
  color-scheme: light dark;
  --cell-size: 40px;
  --gap: 3px;
  --x-color: #2f6fed;
  --o-color: #e0483e;
  --win-color: #35b06b;
  --draw-color: #e0b83e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f4f5f7;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #1b1d22;
    color: #eee;
  }
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

h1 {
  margin: 0;
  font-size: 1.4rem;
}

.status {
  margin: 0;
  min-height: 1.4em;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 600;
}

.status.x-wins {
  background: var(--x-color);
  color: #fff;
}

.status.o-wins {
  background: var(--o-color);
  color: #fff;
}

.status.draw {
  background: var(--draw-color);
  color: #1b1d22;
}

.board {
  display: grid;
  grid-template-columns: repeat(var(--board-size), var(--cell-size));
  grid-template-rows: repeat(var(--board-size), var(--cell-size));
  gap: var(--gap);
  background: #ccc;
  padding: var(--gap);
  border-radius: 6px;
}

@media (prefers-color-scheme: dark) {
  .board {
    background: #444;
  }
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: none;
  border-radius: 3px;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  color: inherit;
}

@media (prefers-color-scheme: dark) {
  .cell {
    background: #2a2c33;
  }
}

.cell:disabled {
  cursor: default;
}

@keyframes cell-appear {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(2); }
}

.cell-appear /*.mark*/ /* <-- uncomment this to hilight text only */
{
  animation: cell-appear 1s ease-in-out 1;
}

.cell.x {
  color: var(--x-color);
}

.cell.o {
  color: var(--o-color);
}

.cell.win {
  background: color-mix(in srgb, var(--win-color) 30%, transparent);
}

@keyframes hint-opacity-blink {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0; }
}

.cell.hint .mark {
  animation: hint-opacity-blink 1s ease-in-out infinite;
}

.cell.useless {
  background: #ddd;
}

@media (prefers-color-scheme: dark) {
  .cell.useless {
    background: #1c1e24;
  }
}

.restart {
  padding: 8px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: var(--x-color);
  color: #fff;
  cursor: pointer;
}

.restart:hover {
  filter: brightness(1.1);
}

.hint-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.hint-toggle input {
  cursor: pointer;
}
