/* SPDX-License-Identifier: AGPL-3.0-or-later */
:root {
  color-scheme: light dark;
  --paper: #fafaf7;
  --cell: #fff;
  --fixed: #e2e7e1;
  --ink: #19392e;
  --muted: #495d54;
  --line: #a3afa5;
  --accent: #f0c85b;
  --active: #fff1c4;
  --button: #193f30;
  --on-button: #fff;
  font: 100%/1.5 system-ui, sans-serif;
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #19251f;
    --cell: #23352b;
    --fixed: #39493f;
    --ink: #f1f5ef;
    --muted: #c8d2c9;
    --line: #809187;
    --active: #514221;
    --button: #d5e6d7;
    --on-button: #192c20;
  }
}
* { box-sizing: border-box; }
body { margin: 0; }
main {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
header, footer, .play-area { padding: clamp(14px, 3.8vw, 28px); }
header, footer, .actions, .keys { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
header, footer { justify-content: space-between; }
header {
  background: #123929;
  color: #fff;
  padding-block: 14px;
  border-bottom: 3px solid var(--accent);
}
button, select {
  color: inherit;
  font: inherit;
  cursor: pointer;
}
select {
  color-scheme: dark;
  color: #fff;
  background: #123929;
  max-width: 100%;
  min-height: 40px;
  border: 1px solid #91a799;
  border-radius: 6px;
  padding-inline: 8px;
}
#variant {
  border-color: transparent;
  font-weight: 650;
  font-size: clamp(1.2rem, 4vw, 1.7rem);
  padding-left: 0;
}
#level { font-size: .875rem; }
.play-area {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 32px);
  align-items: start;
}
table {
  --clue-width: 2.5em;
  width: 100%;
  max-width: 400px;
  margin-inline: auto;
  table-layout: fixed;
  border-spacing: 0;
  font-family: ui-monospace, monospace;
}
th {
  font-size: clamp(.72rem, 2vw, .92rem);
  color: var(--muted);
  line-height: 1.15;
}
thead th { vertical-align: bottom; padding: 0 1px 7px; }
table[data-variant=plus] { --clue-width: calc(6ch + 8px); }
th:first-child { width: var(--clue-width); }
th.current { color: var(--ink); background: var(--active); }
th[scope=row] { text-align: right; padding-right: 7px; }
th span { display: block; }
td {
  padding: 0;
  background: var(--cell);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
tbody tr:first-child td { border-top: 1px solid var(--line); }
td:nth-child(2) { border-left: 1px solid var(--line); }
td button {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: 600 clamp(1rem, 3vw, 1.6rem)/1 ui-monospace, monospace;
}
td button[aria-disabled=true] { background: var(--fixed); cursor: default; }
td button[aria-disabled=true]::after {
  content: "";
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--muted);
  position: absolute; top: 3px; right: 3px;
}
td button[aria-pressed=true] {
  background: var(--active);
  box-shadow: inset 0 0 0 2px var(--ink);
}
.block { display: inline-block; width: .8em; height: .8em; background: currentColor; border-radius: 2px; }
.notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; font-size: clamp(.62rem, 1.5vw, .8rem); }
.notes span { width: 1ch; }
.controls { min-width: 0; }
h2, p { margin: 0; }
h2 { font-size: 1.1rem; }
p { font-size: .91rem; line-height: 1.5; margin-top: .45rem; }
.keys { margin-block: 14px 8px; }
.controls button, footer button {
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 5px 10px;
  min-height: 36px;
  background: var(--cell);
  font-size: .85rem;
  font-weight: 550;
}
.keys button { min-width: 35px; font: 600 1.13rem ui-monospace, monospace; min-height: 40px; }
.actions button.icon { font: 1.2rem system-ui, sans-serif; }
button:disabled { opacity: .45; cursor: default; }
.controls button:not(:disabled):hover, footer button:hover { border-color: var(--ink); }
#pencil[aria-pressed=true] { background: var(--active); border: 2px solid var(--ink); padding: 4px 9px; }
.check-actions { margin-top: 14px; }
#check { background: var(--button); color: var(--on-button); border-color: var(--button); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
header :focus-visible { outline-color: var(--accent); }
td button:focus-visible { z-index: 1; outline-offset: 0; }
#status { font-weight: 600; }
#status:empty { margin: 0; }
footer { border-top: 1px solid var(--line); padding-block: 10px; }
#progress, details { color: var(--muted); font-size: .8rem; }
details { padding: 0 clamp(14px, 3.8vw, 28px) 12px; }
summary { cursor: pointer; width: fit-content; }
details p { font-size: inherit; }
a { color: inherit; text-underline-offset: 2px; }
@media (max-width: 595px) {
  .play-area { grid-template-columns: 1fr; }
  table { max-width: 340px; }
  .keys button { flex: 1; }
}
@media (forced-colors: active) {
  .block { background: CanvasText; forced-color-adjust: none; }
  td button[aria-pressed=true] { outline: 2px solid Highlight; outline-offset: -3px; }
}
