@font-face {
  font-family: "Sumika Display";
  src: url("assets/display.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Sumika Numbers";
  src: url("assets/numbers.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
:root {
  --ink: #101544;
  --paper: #faf7eb;
  --lime: #c6fc03;
  --coral: #fc5853;
  --muted: #555873;
  --mint: #cfeaa0;
  --violet: #c8baf3;
  --apricot: #ffb8a5;
  --aqua: #98dbdf;
  --gold: #ffe093;
  --focus-ink: #16152c;
  --focus-halo: #fffdf5;
  --board-hatch: color-mix(in srgb, var(--ink) 72%, transparent);
  --heart-fill: color-mix(in srgb, var(--coral) 60%, var(--ink));
  --display: "Sumika Display", "Noto Sans JP", "Yu Gothic", sans-serif;
  --body: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  --number: "Sumika Numbers", "Barlow Condensed", "Arial Narrow", var(--body);
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; min-width: 0; min-height: 100vh; }
button { color: inherit; font: inherit; background: none; cursor: pointer; }
button, .board, .poster-cut { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, .setting input:focus-visible {
  outline: 2px solid var(--focus-ink);
  outline-offset: -4px;
  box-shadow: inset 0 0 0 4px var(--focus-halo);
}
[hidden] { display: none !important; }
.symbol-bank { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon { display: block; flex: none; width: 21px; height: 21px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: square; stroke-linejoin: miter; fill: none; }
.icon.filled { stroke: none; fill: currentColor; }
.masthead { background: var(--ink); color: var(--paper); }
.mast-inner {
  width: min(1160px, calc(100% - 88px)); min-height: 74px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 13px; font: 400 clamp(24px,2.5vw,37px)/1.28 var(--display); letter-spacing: -.055em; white-space: nowrap; }
.brand-mark { display: block; position: relative; width: 42px; height: 36px; background: var(--lime); clip-path: polygon(0 14%, 60% 14%, 78% 0, 100% 0, 92% 85%, 26% 85%, 26% 100%, 9% 100%, 9% 85%, 0 85%); }
.brand > span:last-child { letter-spacing:.015em; }
.brand-mark i { position: absolute; width: 10px; height: 6px; border-radius: 0 0 6px 6px; background: var(--ink); top: 14px; transform: rotate(-10deg); }
.brand-mark i:first-child { left: 8px; }
.brand-mark i:last-child { right: 8px; }
.wallet { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; white-space: nowrap; color: #ffe093; font-weight: 750; font-size: 14px; }
.wallet b { font: 800 27px/1 var(--number); font-variant-numeric: tabular-nums; }
.coin { display: inline-grid; place-items: center; flex: none; width: 24px; aspect-ratio: 1; background: #ffdd73; color: var(--ink); clip-path: polygon(28% 0,72% 0,100% 28%,100% 72%,72% 100%,28% 100%,0 72%,0 28%); }
.coin::before { content: ""; width: 36%; height: 36%; transform: rotate(45deg); border: 2px solid currentColor; }
.help-button { display: inline-flex; gap: 8px; align-items: center; border: 1.5px solid #a1a2b4; padding: 7px 14px; min-height: 44px; font-size: 14px; font-weight: 800; }
.help-button > span { display: grid; place-items: center; width: 17px; height: 17px; border: 1.6px solid currentColor; border-radius: 50%; font: 800 12px/1 Arial,sans-serif; }
.game-layout {
  --play-width: clamp(395px, 60vh, 532px);
  --poster-width: clamp(288px, 27vw, 366px);
  --gap: clamp(44px, 6.4vw, 86px);
  width: min(calc(100% - 76px), calc(var(--play-width) + var(--poster-width) + var(--gap)));
  margin: clamp(22px,4.6vh,54px) auto 26px;
  display: grid; grid-template-columns: minmax(0,var(--play-width)) minmax(0,var(--poster-width));
  grid-template-areas: "play partner"; gap: var(--gap); align-items: start;
}
.play { grid-area: play; min-width: 0; }
.board-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.board-heading h1 { display: flex; gap: 13px; align-items: baseline; margin: 0; line-height: 1; }
.board-heading h1 > span { font: 400 clamp(26px,2.5vw,36px)/1.2 var(--display); letter-spacing: -.07em; }
.board-heading h1 > b { color: var(--ink); font: 900 clamp(48px,4.8vw,69px)/.88 var(--number); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.counter { display: inline-flex; gap: 7px; align-items: baseline; padding: 3px 10px 4px; border: 1.5px solid var(--ink); background: #fffdf4; font-variant-numeric: tabular-nums; }
.counter .icon { align-self: center; width: 18px; height: 18px; }
.counter b { font: 800 27px/1.05 var(--number); }
.fraction-line { opacity: .5; }
.counter-limit { white-space: nowrap; font-size: 13px; font-weight: 800; }
.board-notes { display:grid; grid-template-columns:minmax(0,1fr) auto; column-gap:12px; margin:7px 0 11px; align-items:center; }
.board-caption { position:relative; display:grid; align-items:center; align-self:stretch; min-width:0; }
.board-caption .feedback { position:absolute; inset:0; align-content:safe center; overflow:auto; }
.board-caption .feedback.has-message { pointer-events:auto; }
.hint-button { display:inline-flex; align-items:center; justify-content:center; gap:5px; min-height:44px; padding:4px 10px; border:1.5px solid var(--ink); background:var(--paper); color:var(--ink); font-size:14px; font-weight:800; white-space:nowrap; }
.hint-button .icon { width:17px; height:17px; stroke-width:2; }
.hint-button[aria-expanded="true"] { background:var(--lime); }
#hint-remaining {
  display:inline-grid; place-items:center; min-width:1.42em; height:1.42em;
  background:var(--ink); color:var(--paper); font:800 13px/1 var(--number);
  font-variant-numeric:tabular-nums;
}
.hint-note { margin:0; color:var(--ink); font-size:13px; line-height:1.5; }
.hint-note strong { display:block; font-size:14px; }
.hint-note:focus-visible { outline:2px solid var(--focus-ink); outline-offset:2px; box-shadow:0 0 0 2px var(--focus-halo); }
.hint-frame { position:absolute; z-index:4; inset:8%; border:2px solid var(--ink); box-shadow:0 0 0 1.5px var(--paper),inset 0 0 0 1.5px var(--paper); pointer-events:none; }
.hint-frame::after { content:""; position:absolute; top:-2px; right:-2px; width:23%; aspect-ratio:1; background:var(--ink); clip-path:polygon(0 0,100% 0,100% 100%); }
.hint-dot { position:absolute; z-index:3; top:12%; right:12%; width:clamp(5px,13%,8px); aspect-ratio:1; border-radius:50%; background:var(--ink); box-shadow:0 0 0 1.5px var(--paper); pointer-events:none; }
.board-notes:has(.has-error) .rule-line { visibility:hidden; }
.rule-line { margin: 0; color: #343853; font-size: clamp(12px,1.15vw,15px); line-height: 1.7; font-weight: 600; }
.rule-line span { display:inline-block; }
.board-frame { position: relative; border: 4px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); background: var(--ink); }
.board { display: flex; flex-direction: column; width: 100%; aspect-ratio: 1; user-select: none; -webkit-user-select: none; }
.board-row { display: grid; grid-template-columns: repeat(var(--side,5),minmax(0,1fr)); flex: 1 1 0; min-height: 0; }
.area-A { --region: var(--mint); }
.area-B { --region: var(--violet); }
.area-C { --region: var(--apricot); }
.area-D { --region: var(--aqua); }
.area-E { --region: var(--gold); }
.area-F { --region: #9bbaf8; }
.area-G { --region: #75c79f; }
.area-H { --region: #e3c5ab; }
#clear-splash { position: absolute; z-index: 6; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cell {
  display: grid; place-items: center; position: relative; isolation: isolate;
  padding: 0; margin: 0; border: 0; border-radius: 0; min-width: 0; min-height: 0;
  background: var(--region);
  touch-action: pinch-zoom; -webkit-touch-callout: none;
}
.board.piece-tool .cell { touch-action: pan-x pan-y pinch-zoom; }
.hold-track { position: absolute; z-index: 5; left: 17%; right: 17%; bottom: 10%; height: 5px; overflow: hidden; background: var(--paper); border: 1px solid var(--ink); border-radius: 3px; pointer-events: none; animation: show-track var(--hold-time) both; }
.hold-track::after { content: ""; display: block; height: 100%; background: var(--ink); transform-origin: left; animation: fill-track var(--hold-time) linear both; }
@keyframes show-track { 0%,20% { opacity: 0; } 23%,100% { opacity: 1; } }
@keyframes fill-track { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.cell.line-top::before, .cell.line-left::after { content: ""; display: block; position: absolute; background: rgba(16,21,68,.24); z-index: 3; pointer-events: none; }
.cell.line-top::before { inset: 0 0 auto; height: 1px; }
.cell.line-left::after { inset: 0 auto 0 0; width: 1px; }
.cell.heavy-top::before { height: 3px; background: var(--ink); }
.cell.heavy-left::after { width: 3px; background: var(--ink); }
.cell:focus-visible { z-index: 4; }
.piece { width: 84%; height: 78%; object-fit: contain; display: block; pointer-events: none; }
.board-mark { display: block; width: clamp(17px,2.4vw,29px); aspect-ratio: 1; position: relative; opacity: .78; }
.board-mark::before, .board-mark::after { content: ""; position: absolute; left: 45%; top: 0; width: 12%; height: 100%; border-radius: 2px; background: var(--ink); transform: rotate(45deg); }
.board-mark::after { transform: rotate(-45deg); }
.conflict-outline { position: absolute; inset: 5px; z-index: 2; border: 2px dashed var(--ink); pointer-events: none; }
.conflict-sign { position: absolute; right: -1px; top: -1px; width: 16px; height: 16px; background: var(--ink); color: var(--paper); font: 900 13px/16px Arial,sans-serif; text-align:center; }
.cell.entered .piece, .cell.entered .board-mark { animation: stamp .20s ease-out; }
@keyframes stamp { from { transform: translateY(-3px) scale(.85); } to { transform: none; } }
.controls { display: flex; gap: 12px; align-items: stretch; margin-top: 20px; }
.gesture-guide { display: flex; flex: 1; flex-wrap: wrap; align-content: center; align-items: center; gap: 4px 18px; font-size: 14px; font-weight: 750; }
.gesture-guide > span { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.gesture-guide .icon { width: 17px; height: 17px; }
.undo, .action, .choose-button, .close { display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 850; }
.undo { min-height: 46px; font-size: 15px; white-space: nowrap; }
.undo { border: 2px solid var(--ink); min-width: 91px; padding: 7px 14px; }
.music-button {
  flex: none; min-width: 44px; min-height: 44px; padding: 4px;
  border: 2px solid var(--ink); background: var(--ink); color: var(--paper);
  font: 800 12px/1 var(--body);
}
.music-button[aria-pressed="false"] {
  background: var(--paper); color: var(--ink); text-decoration: line-through;
}
.feedback { pointer-events:none; font-size: 13px; line-height: 1.5; font-weight: 700; }
.feedback.has-error::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 6px; font: 900 12px/1 sans-serif; background: var(--ink); color: var(--paper); }
.finish-actions { margin-top: 12px; }
.companion { grid-area: partner; align-self: start; padding-top: clamp(44px,8.6vh,89px); min-width: 0; }
.poster-wrap { filter: drop-shadow(5px 5px 0 var(--ink)); }
.poster-cut { --cut: 26px; position: relative; padding: 2px; clip-path: polygon(0 0,calc(100% - var(--cut)) 0,100% var(--cut),100% 100%,0 100%); background: var(--ink); }
.poster-face { position: relative; background: var(--lime); clip-path: polygon(0 0,calc(100% - var(--cut) + 1px) 0,100% calc(var(--cut) - 1px),100% 100%,0 100%); }
.poster-info { padding: 23px 22px 0; }
.poster-eyebrow { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 820; letter-spacing: .075em; }
.specimen-dot { width: 10px; height: 10px; background: var(--coral); border: 1.5px solid var(--ink); }
.poster-eyebrow .specimen-dot { flex: none; }
#companion-progress { min-width:0; line-height:1.3; letter-spacing:0; overflow-wrap:anywhere; }
#companion-progress-amount { display:inline-block; margin-inline-start:.3em; white-space:nowrap; }
.poster-info h2 { margin: 13px 0 0; font: 400 clamp(27px,2.95vw,40px)/1.26 var(--display); letter-spacing: -.065em; text-wrap: balance; }
.poster-info h2.long-name { font-size: clamp(22px,2.3vw,31px); }
.poster-index { position: absolute; top: 18px; right: 27px; display: inline-flex; gap: 4px; align-items: baseline; font: 800 22px/1.2 var(--number); font-variant-numeric: tabular-nums; }
.poster-index span { font-size: 14px; font-weight: 600; }
.poster-art { height: clamp(183px,26vh,257px); margin: 24px 16px 22px; display: grid; place-items: center; }
.poster-art img { display: block; width: 100%; height: 100%; max-height: 100%; min-height: 0; min-width: 0; object-fit: contain; pointer-events: none; }
.choose-button { width: 100%; border: 0; border-top: 2px solid var(--ink); background: var(--ink); color: var(--paper); min-height: 53px; padding: 12px 18px; font-size: 16px; justify-content: flex-start; white-space:nowrap; }
.choose-button .choose-arrow { margin-left: auto; color: var(--lime); }
dialog { width: min(440px,calc(100% - 34px)); padding: 0; border: 3px solid var(--ink); background: var(--paper); color: var(--ink); box-shadow: 6px 6px 0 var(--ink); max-height: 88vh; max-height: 88dvh; overflow: auto; overscroll-behavior: contain; }
dialog::backdrop { background: rgba(13,18,55,.60); }
body:has(dialog[open]) { overflow: hidden; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 17px; border-bottom: 2px solid var(--ink); }
.dialog-head h2, .result-body h2 { margin: 0; font: 400 25px/1.3 var(--display); letter-spacing: -.05em; }
.close { border: 0; min-width: 44px; min-height: 44px; padding: 6px; }
.help-body { padding: 6px 20px 20px; }
.help-rule { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid #d5d4c8; }
.help-rule p { margin: 0; flex: 1; font-size: 15px; line-height: 1.65; }
.rule-example { flex: 0 0 60px; display: grid; width: 60px; grid-template-columns: repeat(2,1fr); }
.rule-example i { display: grid; place-items: center; border: 1px solid var(--ink); margin: -.5px; height: 25px; background: var(--aqua); font: 800 17px/1 sans-serif; }
.rule-example img { width: 85%; height: 85%; object-fit: contain; }
.example-row { grid-template-columns: repeat(3,1fr); }
.example-row i:nth-child(2) { background: var(--gold); }
.example-row i:nth-child(3) { background: var(--apricot); }
.example-region i { background: var(--violet); }
.example-region i:last-child { background: var(--gold); border-left: 2px solid var(--ink); border-top: 2px solid var(--ink); }
.example-touch i { background: var(--mint); }
.help-controls { font-size: 14px; line-height: 1.65; }
.action { min-height: 46px; padding: 9px 17px; border: 2px solid var(--ink); font-size: 15px; }
.action-dark { background: var(--ink); color: var(--paper); }
.action-dark .icon { color: var(--lime); margin-left: 5px; }
#picker { width: min(665px,calc(100% - 30px)); }
#picker .dialog-head { position: sticky; top: 0; background: var(--paper); z-index: 2; }
.roster { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; padding: 16px; }
.roster-option { position: relative; padding: 0; border: 2px solid var(--ink); text-align:left; background: var(--paper); display: grid; grid-template-rows: auto 1fr; }
.roster-img { display: grid; place-items: center; aspect-ratio: 1.35; background: var(--lime); padding: 9px 8px; }
.roster-img img { display:block; width: 100%; height: 100%; object-fit: contain; min-width:0; min-height:0; }
.roster-name { display:flex; align-items:center; padding: 5px 6px; border-top: 1px solid var(--ink); font-size: 12px; font-weight: 800; line-height: 1.4; }
.roster-option[aria-pressed="true"]:not(:focus-visible) { box-shadow: 2px 2px 0 var(--ink); }
.roster-option:focus-visible { outline-offset:0; box-shadow:0 0 0 4px var(--focus-halo); }
.roster-option[aria-pressed="true"] .roster-name { background:var(--ink); color:var(--paper); }
.chosen-tick { display:none; position:absolute; top:3px; right:3px; background:var(--ink); color:var(--lime); padding:2px; }
.chosen-tick .icon { width:14px; height:14px; }
.roster-option[aria-pressed="true"] .chosen-tick { display:block; }
#result { width: min(355px,calc(100% - 38px)); }
#result .dialog-head { padding: 3px 8px 3px 17px; font-weight: 850; font-size: 14px; }
.result-body { text-align:center; background:var(--lime); padding:20px 20px 24px; }
.result-body h2 { font-size:clamp(38px,6.5vw,55px); line-height:1.2; }
.result-art { position: relative; isolation: isolate; height: 115px; margin: 12px 0 16px; }
.result-art::before { content: ""; position: absolute; z-index: -1; bottom: 3%; left: 16%; width: 68%; height: 16%; border-radius: 50%; background: #a6cf12; }
.result-art img { width:100%; height:100%; object-fit:contain; }
.reward-ticket { display: flex; align-items: center; gap: 12px; margin: 0 0 15px; padding: 10px 13px; color: var(--paper); background: var(--ink); text-align: left; }
.reward-ticket .coin { width: 30px; }
.reward-text { display: grid; gap: 3px; font-size: 14px; font-weight: 800; }
.reward-total { font-size: 12px; font-weight: 600; color: #c9cbe1; }
.reward-ticket strong { margin-inline-start: auto; padding-inline-start: 12px; border-left: 1px dashed #85869e; color: #ffe093; white-space: nowrap; }
.reward-ticket strong b { font: 800 38px/1 var(--number); font-variant-numeric: tabular-nums; }
.reward-ticket small { font: 750 14px var(--body); }
#result[open] .result-art img { animation: result-stamp .36s cubic-bezier(.22,.70,.30,1.08) both; }
@keyframes result-stamp { from { opacity: .5; transform: translateY(5px) scale(.90); } to { opacity: 1; transform: none; } }
.result-body .action { width:100%; }
@media (hover:hover) {
  .hint-button:not(:disabled):hover { background:var(--lime); }
  .help-button:hover { background: var(--paper); color: var(--ink); }
  .cell[aria-disabled="false"]:hover { background: color-mix(in srgb, var(--region) 84%, white); }
  .undo:not(:disabled):hover, .close:hover { background: var(--lime); }
  .music-button:hover { background: var(--lime); color: var(--ink); }
  .choose-button:hover, .action-dark:hover { color: var(--lime); }
  .roster-option:hover .roster-name { text-decoration: underline; }
}
@media (min-width: 771px) and (max-height: 690px) {
  .mast-inner { min-height: 58px; }
  .game-layout { --play-width: clamp(330px,59vh,405px); margin-top: 15px; }
  .board-heading h1 > b { font-size:48px; }
  .board-notes { margin:7px 0 10px; }
  .controls { margin-top:12px; }
}
@media (max-width: 770px) {
  .mast-inner { min-height:58px; width:min(540px,calc(100% - 32px)); }
  .brand { gap:8px; font-size:24px; }
  .brand-mark { width:32px; height:29px; }
  .brand-mark i { top:12px; width:8px; height:5px; }
  .brand-mark i:first-child { left:5px; }
  .brand-mark i:last-child { right:6px; }
  .help-button { min-height:44px; padding:5px 9px; font-size:12px; gap:5px; }
  .wallet { gap: 4px; }
  .wallet b { font-size: 23px; }
  .wallet .coin { width: 20px; }
  .game-layout { width:min(516px,calc(100% - 38px)); margin:19px auto 18px; display:flex; flex-direction:column; gap:18px; }
  .companion { order:-1; padding:0; width:100%; }
  .poster-wrap { filter:drop-shadow(3px 3px 0 var(--ink)); }
  .poster-cut { --cut:15px; }
  .poster-face { display:grid; grid-template-columns:78px minmax(0,1fr) auto; align-items:center; min-height:75px; padding:8px 13px 8px 9px; gap:10px; }
  .poster-art { grid-column:1; grid-row:1; height:57px; margin:0; }
  .poster-info { grid-column:2; grid-row:1; padding:0; }
  .poster-eyebrow { font-size:10px; gap:4px; letter-spacing:.02em; }
  .specimen-dot { width:7px; height:7px; border-width:1px; }
  .poster-info h2, .poster-info h2.long-name { font-size:clamp(16px,4.15vw,24px); line-height:1.26; margin:4px 0 0; }
  .poster-index { display:none; }
  .choose-button { grid-column:3; grid-row:1; display:flex; flex-direction:column; justify-content:center; gap:3px; min-height:46px; width:54px; padding:4px; border:0; font-size:12px; }
  .choose-prefix { display:none; }
  .choose-button .icon { width:16px; height:16px; }
  .choose-button .choose-arrow { display:none; }
  .play { width:100%; }
  .board-heading h1 { gap:9px; }
  .board-heading h1 > span { font-size:24px; }
  .board-heading h1 > b { font-size:44px; }
  .board-notes { gap:8px; margin:5px 0 8px; }
  .hint-button { padding-inline:8px; }
  .rule-line { font-size:12px; line-height:1.55; }
  .board-frame { border-width:3px; box-shadow:3px 3px 0 var(--ink); }
  .controls { margin-top:15px; gap:9px; }
  .gesture-guide { gap: 4px 11px; font-size: 13px; }
  .gesture-guide .icon { width: 15px; height: 15px; }
  .undo { min-height:44px; font-size:14px; }
  .undo { min-width:74px; padding:6px 9px; }
  .counter { padding:2px 8px 3px; gap:5px; }
  .counter b { font-size:24px; }
  .roster { grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; padding:12px; }
}
@media (max-width: 440px) {
  .mast-inner { gap: 9px; }
  .help-button { width: 44px; padding: 4px; justify-content: center; }
  .help-button b { display: none; }
}
@media (pointer: coarse) { .keyboard-help { display: none; } }
@media (max-width: 355px) {
  .mast-inner { width:calc(100% - 24px); }
  .brand { font-size:21px; gap:6px; }
  .game-layout { width:calc(100% - 30px); gap:15px; }
  .poster-face { grid-template-columns:61px minmax(0,1fr) 49px; gap:7px; }
  .choose-button { width:49px; }
  .poster-info h2 { font-size:16px; }
  .rule-line { font-size:11.5px; }
  .roster { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 770px) and (max-height: 650px) {
  .mast-inner { min-height:48px; }
  .game-layout { margin:6px auto 12px; gap:7px; }
  .poster-face { min-height:52px; padding-block:4px; }
  .poster-art { height:42px; }
  .choose-button { min-height:44px; }
  .board-heading h1 > b { font-size:34px; }
  .board-heading h1 > span { font-size:21px; }
  .board-notes { margin:4px 0 5px; }
  .controls { margin-top:8px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}

.brand-mark { display:grid; place-items:center; background:none; clip-path:none; color:var(--lime); }
.pet-emblem { display:block; width:100%; height:100%; fill:currentColor; pointer-events:none; }
.board-heading h1 small { font:700 clamp(13px,1.6vw,18px)/1 var(--number); letter-spacing:0; opacity:.66; white-space:nowrap; }
.lives { align-self:center; display:flex; gap:3px; margin-inline-start:auto; }
.lives i { display:block; position:relative; width:clamp(13px,1.7vw,19px); aspect-ratio:1.06; background:var(--heart-fill); clip-path:polygon(50% 95%,7% 54%,0 32%,3% 17%,15% 5%,32% 4%,50% 18%,68% 4%,85% 5%,97% 17%,100% 32%,93% 54%); }
.lives i.spent { background:var(--ink); }
.lives i.spent::after { content:""; position:absolute; inset:2px; clip-path:inherit; background:var(--paper); }
.board-notes:has(.has-message) .rule-line { visibility:hidden; }
.feedback.has-message { color:var(--ink); }
.board-window { position:relative; min-width:0; }
.area-I { --region:#bfc3d1; }
.area-J { --region:#e997ce; }
.cell { background:color-mix(in srgb,var(--region) 93%,var(--lime)); }
.hold-track::after { background:var(--coral); }
.poster-art { position:relative; isolation:isolate; }
.poster-art img { z-index:1; }
#poster-emblem { position:absolute; right:-2%; bottom:4%; width:65%; height:88%; color:var(--ink); opacity:.105; transform:rotate(-12deg); pointer-events:none; }
.result-art::before { background:color-mix(in srgb,var(--lime) 65%,var(--ink)); }
.cell-response { position:absolute; inset:0; pointer-events:none; z-index:5; display:grid; place-items:center; }
.cell-response .hit-sign { display:grid; place-items:center; position:absolute; z-index:2; right:3%; bottom:4%; width:35%; aspect-ratio:1; border-radius:50%; font:900 clamp(11px,2vw,21px)/1 Arial,sans-serif; color:var(--ink); background:var(--lime); box-shadow:inset 0 0 0 1.5px var(--ink); }
.cell-response.wrong { box-shadow:inset 0 0 0 3px var(--ink); background:color-mix(in srgb,var(--coral) 32%,transparent); }
.cell-response.wrong .hit-sign { color:var(--paper); background:var(--ink); right:auto; bottom:auto; width:51%; border-radius:10%; }
.cell-response .hit-drop { position:absolute; left:46%; top:68%; aspect-ratio:1; border-radius:50%; background:var(--lime); }
.ink-puddle { position:absolute; inset:8% 3% 0; width:94%; height:92%; z-index:1; fill:var(--lime); pointer-events:none; }
.cell .piece, .cell .board-mark { position:relative; z-index:2; }
.shop-preview { display:grid; grid-template-columns:minmax(90px,34%) 1fr; background:var(--lime); color:var(--ink); border-bottom:2px solid var(--ink); }
#picker[open] { display:flex; flex-direction:column; overflow:hidden; }
#picker .dialog-head, #picker .shop-preview { position:static; flex:none; }
#picker .roster { overflow-y:auto; min-height:0; overscroll-behavior:contain; scrollbar-gutter:stable; }
.shop-portrait { position:relative; display:grid; place-items:center; min-height:124px; padding:11px 16px; overflow:hidden; isolation:isolate; }
#shop-emblem { position:absolute; width:82%; height:94%; opacity:.16; transform:rotate(-15deg); }
#shop-art { position:relative; display:block; width:100%; height:100px; object-fit:contain; }
.shop-offer { align-self:center; padding:12px 14px 13px 0; min-width:0; }
.shop-offer h3 { margin:3px 0 8px; font:400 clamp(19px,3.6vw,27px)/1.25 var(--display); }
.shop-balance { font-size:12px; font-weight:700; }
#shop-action { min-height:42px; padding:6px 14px; }
#shop-action:disabled { opacity:1; color:var(--ink); background:transparent; border-color:color-mix(in srgb,var(--ink) 35%,transparent); }
.roster-option { grid-template-rows:auto 1fr auto; color:var(--ink); border-color:var(--ink); }
.roster-name { font-weight:750; }
.shop-price { display:block; padding:0 6px 5px; font:750 11px/1.35 var(--body); }
.roster-option[aria-pressed="true"] .shop-price { background:var(--ink); color:var(--paper); }
.roster-option[aria-pressed="true"]:not(.equipped) .chosen-tick { display:none; }
.roster-option.equipped .chosen-tick { display:block; }
#shop-notice:not(:empty) { position:sticky; bottom:0; padding:8px 13px; background:var(--ink); color:var(--paper); font-weight:700; }
#retry { width:min(365px,calc(100% - 30px)); }
.retry-card { text-align:center; padding:24px 18px 19px; background:var(--paper); }
#retry-emblem { display:block; margin:0 auto 10px; width:60px; height:55px; color:var(--ink); background:var(--lime); border-radius:35%; }
.retry-card h2 { font:400 clamp(20px,4vw,27px)/1.35 var(--display); margin:0; }
.retry-card p { font-size:14px; margin:8px 0 17px; }
.retry-card button { width:100%; }
@media (max-width:770px) {
  #poster-emblem { right:0; bottom:0; height:85%; width:72%; }
  .shop-portrait { min-height:94px; padding:7px; }
  #shop-art { height:80px; }
  .shop-offer { padding-block:7px; }
  .shop-offer h3 { margin:0 0 4px; }
}
@media (max-width:355px) {
  .board-heading { gap:6px; }
  .board-heading h1 { gap:6px; }
  .board-heading h1 small { font-size:12px; }
  .controls { gap:5px; }
  .controls .undo { min-width:54px; }
  .gesture-guide { font-size:12px; gap:3px 8px; }
}

#save-warning { margin:0; padding:8px 14px; text-align:center; background:#ffdf8c; color:#34260e; font-size:14px; }
.cell.region-selected {
  background-image:repeating-linear-gradient(45deg,transparent 0 8px,var(--board-hatch) 8px 10px);
}
@media (forced-colors: active) {
  :root { --focus-ink: Highlight; --focus-halo: Canvas; }
  button:focus-visible, .setting input:focus-visible { outline-color: Highlight; }
  .board, .lives {
    --ink: CanvasText;
    --paper: Canvas;
    --board-hatch: CanvasText;
    --heart-fill: CanvasText;
  }
  .lives i, .cell, .cell::before, .cell::after { forced-color-adjust:none; }
  .board .cell { background-color:Canvas; color:CanvasText; }
  .board .cell.line-top::before, .board .cell.line-left::after { background:CanvasText; opacity:.45; }
  .board .cell.heavy-top::before, .board .cell.heavy-left::after { background:CanvasText; opacity:1; }
}
.cell.conflicting:not(:focus-visible) { outline:3px dashed var(--ink); outline-offset:-5px; z-index:3; }
.fixed-mark .board-mark { opacity:1; }
.hint-tools {
  display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:4px 8px;
  margin-top:12px; padding:8px 10px 6px; border:1.5px solid var(--ink); background:var(--paper);
}
.hint-actions { grid-column:1 / -1; display:flex; flex-wrap:wrap; gap:4px; }
#hint-overview { grid-area:1 / 2; }
.hint-tools button, #tap-tools button, .secondary-action {
  border:1.5px solid var(--ink); min-height:44px; padding:5px 11px; font-size:13px; font-weight:750;
}
#hint-close { border-color:transparent; text-decoration:underline; text-underline-offset:3px; }
#hint-apply { background:var(--lime); }
#hint-overview { margin:0; display:flex; gap:6px; align-items:center; }
#hint-overview figcaption { font-size:10px; max-width:5em; }
#hint-mini { display:grid; width:63px; aspect-ratio:1; grid-template-columns:repeat(var(--side),1fr); border:1px solid var(--ink); }
#hint-mini i { position:relative; background:var(--region); }
#hint-mini .mini-target { box-shadow:inset 0 0 0 1px var(--ink); }
#hint-mini .mini-source::after { content:""; position:absolute; inset:24%; border-radius:50%; background:var(--ink); }
.setting { display:flex; align-items:center; gap:9px; min-height:44px; font-weight:700; font-size:14px; }
.setting input { flex:none; width:20px; height:20px; accent-color:var(--ink); }
.setting input:focus-visible { outline-offset:2px; box-shadow:0 0 0 2px var(--focus-halo); }
#tap-tools { display:flex; flex:1; gap:0; }
#tap-tools button+button { margin-inline-start:-1.5px; }
#tap-tools button[aria-pressed="true"] { background:var(--ink); color:var(--paper); }
.owned-count { margin-inline-start:auto; white-space:nowrap; font-size:13px; font-weight:750; }
#preview-button { border:0; background:color-mix(in srgb,var(--paper) 50%,var(--lime)); }
.preview-icon { position:absolute; bottom:6px; right:6px; z-index:2; display:grid; place-items:center;
  width:24px; height:24px; border-radius:50%; color:var(--paper); background:var(--ink); font-size:11px; }
#preview-ink { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.shop-offer { padding-inline-start:12px; }
.secondary-action { display:block; width:100%; margin-bottom:8px; background:var(--paper); }
#result-badges { margin:8px 0 12px; font-weight:750; font-size:13px; }
.library-body { padding:12px 16px 18px; }
.library-body > p { margin:0 0 4px; font-weight:750; }
.record-legend { display:flex; gap:14px; font-size:13px; }
#stage-list { display:grid; grid-template-columns:repeat(5,1fr); gap:6px; margin:14px 0; }
#stage-list button { display:grid; place-items:center; gap:3px; min-height:54px; padding:4px; border:1.5px solid var(--ink); }
#stage-list b { font:800 23px/1 var(--number); }
#stage-list span { font-size:12px; }
#stage-list button:not(:disabled):hover, #stage-list button:focus-visible { background:var(--lime); }
#library-button { width:auto; }
@media (min-width:771px) and (min-height:521px) {
  .game-layout { --play-width:clamp(310px,calc(100dvh - 342px),532px); margin-block-start:clamp(12px,2.7vh,32px); }
  .controls { margin-top:14px; }
}
@media (max-width:770px) {
  .game-layout { width:min(516px,calc(100% - 16px - env(safe-area-inset-left) - env(safe-area-inset-right))); }
  .hint-tools { margin-top:8px; padding:5px 7px 4px; }
  .hint-note { font-size:12px; line-height:1.4; }
  .hint-note strong { font-size:13px; }
}
@media (max-width:440px) {
  #library-button { font-size:11px; padding:4px; }
  .mast-inner:has(#library-button:not([hidden])) { gap:5px; width:calc(100% - 12px); }
  .mast-inner:has(#library-button:not([hidden])) .brand { font-size:18px; gap:3px; }
}
@media (orientation:landscape) and (max-height:520px) and (min-width:510px) {
  body {
    --land-board:min(calc(100dvh - 20px),calc(100vw - 264px));
    width:min(calc(100% - 22px),calc(var(--land-board) + 360px));
    margin:0 auto; padding:7px 0; display:grid; align-content:start; align-items:center;
    grid-template-columns:var(--land-board) minmax(0,1fr);
    grid-template-areas:"board mast" "board heading" "board notes" "board controls" "board hints" "board partner" "board finish";
    gap:3px clamp(12px,2vw,24px);
  }
  body:has(#save-warning:not([hidden])) { padding-top:44px; }
  #save-warning:not([hidden]) { position:fixed; top:0; inset-inline:0; z-index:8; }
  .game-layout, .play { display:contents; }
  .masthead { grid-area:mast; }
  .mast-inner { min-height:40px; width:100%; padding:0 6px; gap:5px; }
  .mast-inner .brand { min-width:0; font-size:clamp(14px,2.4vw,22px); gap:4px; }
  .masthead { min-width:0; }
  .mast-inner { justify-content:flex-start; }
  .mast-inner .help-button { flex:none; width:auto; }
  .mast-inner .wallet { flex:none; }
  @media (max-width:640px) {
    .mast-inner .brand { font-size:14px; }
    .mast-inner .brand-mark { display:none; }
    .mast-inner .help-button { min-width:30px; padding:2px; }
    .mast-inner:has(#library-button:not([hidden])) .brand { font-size:12px; }
  }
  .brand-mark { width:22px; height:22px; }
  .help-button { min-height:38px; min-width:34px; padding:4px; justify-content:center; }
  .help-button b { display:none; }
  .wallet { gap:3px; font-size:11px; }
  .wallet b { font-size:19px; }
  .wallet .coin { width:15px; }
  .board-heading { grid-area:heading; gap:6px; align-items:center; }
  .board-heading h1 { gap:5px; }
  .board-heading h1 > b { font-size:32px; }
  .board-heading h1 > span { font-size:18px; }
  .board-heading h1 small { font-size:12px; }
  .counter { padding:3px 4px; gap:3px; }
  .counter b { font-size:19px; }
  .counter-limit { font-size:11px; }
  .lives i { width:12px; }
  .board-notes { grid-area:notes; margin:0; column-gap:4px; }
  .rule-line, .feedback, .hint-note { font-size:12px; }
  .hint-note strong { font-size:13px; }
  .hint-note { max-height:clamp(66px,calc(100dvh - 250px),136px); overflow-y:auto; overscroll-behavior:contain; }
  .hint-tools { grid-area:hints; margin:0; gap:3px 6px; padding:5px 6px 3px; }
  .hint-tools button { padding-inline:6px; }
  .board-window { grid-area:board; width:var(--land-board); align-self:start; }
  .board-frame { border-width:3px; box-shadow:3px 3px 0 var(--ink); }
  .controls { grid-area:controls; margin:0; gap:4px; }
  .gesture-guide { font-size:12px; gap:2px 7px; }
  .undo { min-width:58px; padding:4px; }
  .finish-actions { grid-area:finish; margin:0; }
  .companion { grid-area:partner; width:100%; padding:0; align-self:center; }
  .poster-cut { --cut:10px; }
  .poster-face { display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; min-height:44px; padding:1px 6px; gap:5px; }
  .poster-info { grid-column:2; grid-row:1; padding:0; }
  .poster-info h2, .poster-info h2.long-name { font-size:15px; margin:0; }
  .poster-eyebrow { font-size:10px; }
  .poster-eyebrow .specimen-dot, .poster-index, .choose-arrow, .choose-prefix { display:none; }
  .poster-art { grid-column:1; grid-row:1; height:38px; margin:0; }
  .choose-button { grid-column:3; grid-row:1; flex-flow:row; min-height:42px; width:auto; padding:4px 6px; border:0; font-size:11px; }
  .choose-button .choose-arrow { display:none; }
}
