:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #edf4fa;
  background: #142b38;
  --accent: #baf271;
  --border: #527381;
  --text-soft: #c5d9e3;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
.game { width: min(100%, 30rem); margin-inline: auto; padding: 1.1rem 1.15rem 0.55rem; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; }
#round { margin: 0; font-size: 0.97rem; font-weight: 740; }
.controls { display: flex; gap: 0.4rem; }
button { min-height: 2.6rem; border: 1px solid var(--border); border-radius: 0.5rem; background: #1b3b48; color: inherit; font: inherit; cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.62; cursor: default; }
.controls button, #next { padding: 0.35rem 0.65rem; font-size: 0.9rem; font-weight: 660; }
.legend { margin: 0.85rem 0 0.45rem; color: var(--text-soft); font-size: 0.91rem; }

#board { width: 100%; border-spacing: 0.36rem; table-layout: fixed; }
.target-column { width: 4.2rem; }
td { padding: 0; text-align: center; }
.tile { display: grid; width: 100%; aspect-ratio: 1; min-height: 0; place-items: center; padding: 0; background: #1e3e4a; font-size: clamp(1rem, 5vw, 1.8rem); font-weight: 770; }
.tile[aria-pressed="true"] { border-color: #d7ffae; background: var(--accent); color: #14291d; }
.tile[aria-pressed="true"]:focus-visible { outline-color: #edf4fa; }
.total { display: grid; min-height: 1.8rem; place-items: center; border: 1px solid #274953; border-radius: 0.34rem; background: #193842; color: var(--text-soft); font-size: clamp(0.65rem, 2.65vw, 0.86rem); line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total.match { border-color: #72a96a; color: var(--accent); font-weight: 760; }
#board tbody tr td:last-child { padding-inline-start: 0.18rem; }
#board tfoot td { padding-top: 0.18rem; }

.result { display: flex; min-height: 3.35rem; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.25rem; }
#status { margin: 0; color: var(--accent); font-size: 0.91rem; font-weight: 650; }
#next { flex: none; border-color: transparent; background: var(--accent); color: #14291d; }
#next:hover { background: #cdfa99; }

@media (max-width: 30rem) {
  .game { padding-inline: 0.75rem; }
  .target-column { width: 3.15rem; }
  #board { border-spacing: 0.25rem; }
}

@media (max-width: 20rem) {
  .game { padding-inline: 0.45rem; }
  #round { font-size: 0.87rem; }
  .target-column { width: 2.85rem; }
}
