/* Saltmouth Bay grey-box. Functional palette from the design pack §8. */
:root { --bg:#F6F1E3; --surf:#E4D7B9; --act:#126E83; --alert:#B04228; --ink:#182D38; --mira:#E3A93B; --clay:#C98A68;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden;
  font-family: Assistant, "Segoe UI", Arial, sans-serif; font-size: 17px; -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent; }
canvas#cv { position: fixed; inset: 0; touch-action: none; display: block; }

#hud { position: fixed; inset: 0; pointer-events: none; }
.hb { position: absolute; top: calc(10px + var(--safe-t)); width: 54px; height: 54px; border-radius: 14px; pointer-events: auto;
  border: 2px solid var(--ink); background: #FBF8EF; color: var(--ink); font: 800 24px/1 Assistant, "Segoe UI", Arial, sans-serif;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
#btnPause { inset-inline-start: calc(10px + var(--safe-l)); }
#btnUndo { inset-inline-end: calc(10px + var(--safe-r)); }
#btnPause .ii { letter-spacing: 1px; font-size: 20px; }
.hb .dot { position: absolute; top: -5px; inset-inline-end: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--act); border: 2px solid #FBF8EF; }
.hb.framed { box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--act); }
.hb:focus-visible { outline: 3px solid var(--act); outline-offset: 3px; }
#lvl { position: absolute; top: calc(18px + var(--safe-t)); left: 50%; transform: translateX(-50%); font-weight: 800; font-size: 19px;
  background: #FBF8EFdd; padding: 4px 12px; border-radius: 10px; }

.ov { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #F6F1E3e6; padding: 12px; overflow: auto; }
.ov.sheet { background: transparent; align-items: flex-end; pointer-events: none; }
.ov.sheet .panel { pointer-events: auto; box-shadow: 0 -2px 0 var(--ink); }
.ov[hidden] { display: none; }
.panel { background: #FBF8EF; border: 2px solid var(--ink); border-radius: 18px; padding: 16px 18px; width: min(560px, 100%);
  max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 9px; }
.panel.narrow { width: min(380px, 100%); }
.panel.wide { width: min(780px, 100%); }
h1 { margin: 0; font-size: 28px; } h2 { margin: 0 0 2px; font-size: 22px; }
.sub { margin: 0; opacity: .75; }
.small { margin: 0; font-size: 15px; opacity: .8; }
.row { display: flex; gap: 9px; flex-wrap: wrap; } .row > .btn { flex: 1; }
.btn { min-height: 50px; border-radius: 12px; border: 2px solid var(--ink); background: #FBF8EF; color: var(--ink);
  font: 700 18px/1.15 Assistant, "Segoe UI", Arial, sans-serif; padding: 8px 14px; cursor: pointer; text-align: center; }
.btn.primary { background: var(--act); color: #F6F1E3; border-color: var(--act); }
.btn.danger { border-color: var(--alert); color: var(--alert); }
.btn.set { text-align: start; }
.btn.toggle[aria-pressed="true"] { background: var(--act); color: #F6F1E3; border-color: var(--act); }
.btn:focus, .lv:focus { outline: 4px solid var(--act); outline-offset: 3px; }
.btn:disabled, .lv:disabled { opacity: .4; cursor: default; }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.lv { position: relative; aspect-ratio: 1; min-height: 56px; border-radius: 14px; border: 2px solid var(--ink); background: var(--surf);
  color: var(--ink); font: 800 18px Assistant, "Segoe UI", Arial, sans-serif; cursor: pointer; padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lv canvas { width: 34px; height: 34px; }
.lv .n { position: absolute; top: 3px; inset-inline-start: 7px; font-size: 15px; }
.lv .ok { position: absolute; bottom: 3px; inset-inline-end: 6px; font-size: 15px; color: var(--act); }
.lv .mark { position: absolute; bottom: 6px; inset-inline-start: 7px; width: 16px; height: 8px; border-radius: 2px; background: var(--clay); border: 1px solid #6E4A30; }
.lv.cur { background: #FBF8EF; border-color: var(--act); border-width: 3px; }
.doneHead { display: flex; gap: 12px; align-items: center; } .doneHead p { margin: 2px 0 0; }
.tableWrap { overflow: auto; max-height: 38vh; border: 1px solid #0002; border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 5px 7px; border-bottom: 1px solid #0001; text-align: center; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--surf); }
td.planned { color: var(--act); font-weight: 800; } td.wiggle { color: var(--alert); font-weight: 800; }
.question p { margin: 4px 0 6px; font-weight: 700; }
.verdict { border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; font-weight: 700; }
.verdict.pass { border-color: var(--act); color: var(--act); } .verdict.stop { border-color: var(--alert); color: var(--alert); }
.verdict .shape { font-size: 20px; margin-inline-end: 6px; }
textarea { width: 100%; font: 12px/1.3 Consolas, monospace; direction: ltr; border-radius: 8px; border: 1px solid #0003; background: #fff; color: var(--ink); }
body.big { font-size: 20px; }
@media (max-height: 560px) { .panel { padding: 10px 14px; gap: 6px; } .btn { min-height: 44px; } .tableWrap { max-height: 30vh; } }
