:root {
  color-scheme: dark;
  --paper: #181720; --shell: #25232f; --hairline: #3b3848; --ink: #f9f6ef; --muted: #c1bdcc;
  --lime: #dafa77; --lilac: #b9a6fa; --night: #282236;
  --floor: #31224a; --glow: #422b64; --wall: #b199f5; --wall-shade: #6c50a0; --speck: #9176b8;
  font-family: ui-rounded, "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  font-synthesis: none; -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(ellipse at 57% 32%, #24202e60, transparent 66%), radial-gradient(#beb1dc13 .8px, transparent 1px);
  background-size: auto, 16px 16px;
}
button { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button:focus-visible, [role="button"]:focus-visible { outline: 3px solid #ffe999; outline-offset: 4px; }
button { -webkit-user-select: none; user-select: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.masthead { border-bottom: 1px solid #35323f; background: #1b1a23; }
.mast-inner, .shell { width: min(1184px, calc(100% - clamp(40px, 9.4vw, 156px))); margin: 0 auto; }
.mast-inner { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-pad { width: 31px; height: 30px; flex: none; transform: rotate(-9deg); color: var(--lilac); }
.brand h1 { min-width: 0; line-height: 0; }
.title-art { display: block; width: 168px; max-width: 100%; height: auto; }
.tools { display: flex; align-items: center; gap: 8px; flex: none; }
.plain-button { color: #dcd8e5; border: 0; border-radius: 8px; padding: 10px 5px; background: transparent; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; min-height: 42px; }
.plain-button .icon { width: 18px; height: 18px; color: #bdb6cd; }
.plain-button:hover, .plain-button:hover .icon { color: white; }
.plain-button[aria-pressed="true"] .icon { color: var(--lime); }

.shell { padding-bottom: 30px; }

.small-label, .maze-index, .drawing-label, .gate-label {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  text-transform: uppercase; font-weight: 700;
}

h1, h2, p { margin: 0; }

.primary-button { color: #202313; background: var(--lime); border: 1.5px solid #171918; border-radius: 13px; font-weight: 800; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 11px; min-height: 47px; padding: 9px 20px; box-shadow: 0 3px 0 #788c39; transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease; }
.primary-button:hover { background: #e3ff91; transform: translateY(-1px); box-shadow: 0 4px 0 #788c39; }
.primary-button:active { transform: translateY(3px); box-shadow: 0 0 0 #788c39; }
.shuffle-button { white-space: nowrap; }
.primary-button .icon { width: 20px; height: 20px; stroke-width: 2.3; }
.console { padding: 1px; }
.board-toolbar, .board-meta, .maze-index, .palette, .run-stats, .move-counter, .duration, .console-foot, .explorer, .guidance, .controls-guide { display: flex; align-items: center; }
.board-toolbar { justify-content: space-between; min-height: 50px; padding: 0 21px; gap: 8px; }
.board-meta { gap: 14px; min-width: 0; }
.maze-index { gap: 9px; letter-spacing: 1.3px; font-size: 12px; white-space: nowrap; }
.maze-index .icon { color: var(--lilac); height: 20px; width: 20px; stroke-width: 2; }
.meta-rule { height: 14px; width: 1px; background: #534e5d; }
.palette-picker { position: relative; min-width: 0; }
.palette { width: 100%; min-width: 41px; gap: 5px; min-height: 26px; padding: 0 3px; border: 0; border-radius: 5px; background: transparent; font-size: 13px; white-space: nowrap; color: #d3cedd; }
.palette span { overflow: hidden; text-overflow: ellipsis; }
.palette:hover { background: #ffffff12; color: var(--ink); }
.palette:focus-visible, .palette[aria-expanded="true"] { outline: 2px solid var(--lime); outline-offset: 1px; }
.palette-swatch { flex: none; width: 17px; height: 17px; border-radius: 5px; background: var(--swatch-fill, var(--wall)); border: 1px solid #ffffff52; }
.palette .icon { flex: none; width: 13px; height: 13px; color: var(--lilac); }
.palette-options { position: absolute; z-index: 2; inset-block-start: calc(100% + 6px); inset-inline-start: 0; width: max-content; max-height: calc(100dvh - 110px); overflow-y: auto; padding: 5px; border: 1px solid #645a70; border-radius: 10px; background: #302b3a; box-shadow: 0 7px 24px #0b071989; }
.palette-options button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); text-align: left; white-space: nowrap; }
.palette-options button[aria-checked="true"] { background: #dafa771a; }
.palette-options button:hover, .palette-options button:focus-visible { background: #494054; }
.palette-options button:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; }
.run-stats { flex: none; gap: 14px; }
.move-counter, .duration { gap: 7px; color: #d2cddc; font-size: 13px; }
.move-counter .icon { width: 17px; height: 17px; color: #c4bcd9; transform: rotate(3deg); }
.duration .icon { width: 17px; height: 17px; color: #c4bcd9; }
.run-stats strong { min-width: 23px; height: 23px; display: grid; place-content: center; padding: 0 5px; color: var(--ink); background: #383541; border-radius: 6px; font: bold 13px/1 Consolas, monospace; font-variant-numeric: tabular-nums; }
.stage { margin: 0 8px; isolation: isolate; position: relative; overflow: hidden; border: 1px solid #ffffff18; border-radius: 16px; background-color: var(--floor); background-image: radial-gradient(ellipse at 52% 44%, var(--glow), transparent 80%); }
.stage { aspect-ratio: 1; box-shadow: 0 5px 0 #100f17, 0 13px 35px #0c091528; }
#board { display: block; width: 100%; height: 100%; aspect-ratio: 1; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.ink-layer { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 15.6; }
.under-ink { stroke: var(--wall-shade); stroke-width: 16.4; }
.top-ink { stroke: var(--wall); }
.stage[data-phase="drawing"] .wall-line { stroke-dasharray: 1.001 1.001; stroke-dashoffset: 1.001; animation: draw-wall var(--draw-time) cubic-bezier(.25,.58,.35,1) var(--draw-delay) forwards; }
@keyframes draw-wall { to { stroke-dashoffset: 0; } }
.drawing-label { position: absolute; left: 50%; bottom: 9px; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; white-space: nowrap; background: #23212eea; border: 1px solid #797284; color: var(--ink); border-radius: 20px; padding: 6px 10px; letter-spacing: .65px; font-size: 10px; pointer-events: none; }
.drawing-label i { width: 6px; height: 6px; background: var(--lime); border-radius: 50%; }
.stage:not([data-phase="drawing"]):not([data-phase="preparing"]) .drawing-label { display: none; }
.gate-label { font-size: 13px; letter-spacing: .7px; }
.board-arrow { cursor: pointer; outline: none; }
.board-arrow .arrow-disc { fill: #e1fc86; stroke: #252533; stroke-width: 2.7; transition: fill 100ms; }
.board-arrow .arrow-mark { stroke: #24252f; fill: none; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.board-arrow:hover .arrow-disc, .board-arrow:focus-visible .arrow-disc { fill: #fff9db; stroke: white; stroke-width: 3.6; }
.runner { pointer-events: none; }
.console-foot { min-height: 62px; gap: 12px; padding: 8px 16px; }
.explorer { gap: 10px; min-width: 0; margin-inline-end: auto; }
.explorer-copy { min-width: 0; }
.explorer-copy strong { display: block; }
.explorer-copy p { font-size: 13px; color: var(--muted); line-height: 1.3; }
.portrait { flex: none; height: 45px; width: 45px; position: relative; display: grid; place-items: center; background: #44364a; border: 1px solid #655064; border-radius: 14px; }
.portrait img { width: 48px; height: 48px; transform: translateY(-2px) rotate(-6deg); }
.small-label { display: block; font-size: 9.5px; line-height: 1.2; font-weight: 700; letter-spacing: 1.3px; color: #c2b9d1; }
.explorer strong { font-size: 18px; letter-spacing: -.5px; line-height: 1.3; }
.controls-guide { flex: none; gap: 14px; color: #dbd6e4; font-size: 13px; font-weight: 700; }
.guidance { gap: 9px; }
.or { color: #a69faf; font-size: 12px; font-weight: 400; }
.key-cluster { display: grid; grid-template-columns: repeat(3, 15px); grid-template-rows: repeat(2, 13px); gap: 2px; }
kbd { display: grid; place-content: center; border: 1px solid #837b91; border-bottom-width: 2px; border-radius: 3px; background: #393543; color: #ece7f6; font: bold 11px/1 "Segoe UI Symbol", sans-serif; }
kbd:first-child { grid-column: 2; }
kbd:nth-child(2) { grid-column: 1; }
.pointer-icon { color: #c4b9d9; width: 20px; height: 20px; }
.touch-controls, .touch-guide { display: none; }
.solution-button {
  display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 5px 9px; border: 1px solid #666075; border-radius: 9px;
  background: #34303f; color: var(--ink); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.solution-button .icon { width: 16px; height: 16px; color: var(--lilac); }
.solution-button:hover, .solution-button[aria-pressed="true"] { border-color: var(--lilac); background: #494153; }
.solution-button:disabled { opacity: .55; }
dialog { width: min(380px, calc(100% - 32px)); padding: 29px; border: 1px solid #5d5669; border-radius: 24px; background: #292633; color: var(--ink); box-shadow: 0 8px 0 #15121a, 0 23px 85px #06040c83; text-align: center; max-height: calc(100dvh - 32px); overflow: auto; }
dialog::backdrop { background: #14101fbe; }
dialog[open] { animation: appear .18s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(7px); } }
.dialog-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #565060; border-radius: 50%; background: #373340; color: #eee9f4; }
.dialog-art, .win-art { position: relative; display: inline-flex; align-items: center; margin-bottom: 6px; }
.dialog-art img { transform: rotate(-8deg); }
.dialog-art svg { position: absolute; width: 20px; height: 20px; right: -12px; top: 8px; color: var(--lime); }
dialog h2 { font-size: 33px; line-height: 1.15; letter-spacing: -1.5px; margin: 7px 0 15px; }
.help-steps { list-style: none; padding: 0; text-align: left; margin: 17px 0 25px; }
.help-steps li { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; font-size: 15px; line-height: 1.45; color: #e0dae7; }
.help-steps li > span { display: grid; place-items: center; flex: 0 0 23px; height: 23px; font: bold 13px/1 Consolas,monospace; color: var(--lilac); border: 1px solid #665575; border-radius: 7px; background: #373140; }
.help-steps b { color: #fcf5e9; }
.dialog-action { width: 100%; }
.win-art { width: 140px; height: 91px; justify-content: center; }
.win-art img { z-index: 1; transform: translate(-9px, 3px) rotate(-5deg); }
.win-flag { position: absolute; right: -1px; top: 0; width: 54px; height: 54px; transform: rotate(9deg); }
.win-spark { position: absolute; width: 19px; height: 19px; color: var(--lime); top: 5px; left: 0; }
#win-copy { line-height: 1.5; color: #e0dae7; font-size: 16px; margin-bottom: 22px; }
.text-button { background: none; border: 0; border-radius: 6px; color: #d2c8e2; margin-top: 13px; font-size: 14px; padding: 7px; }
.confetti { position: absolute; top: -12px; z-index: 2; border-radius: 3px; pointer-events: none; animation: fall var(--duration) ease-in forwards; }
@keyframes fall { to { top: 103%; transform: translateX(var(--drift)) rotate(var(--spin)); } }
@media (min-width: 1500px) { .mast-inner, .shell { max-width: 1240px; } }

@media (max-width: 850px) {
  .mast-inner, .shell { width: calc(100% - 40px); }

  .board-meta { gap: 10px; }
}
@media (max-width: 620px) {
  .mast-inner, .shell { width: calc(100% - 24px); }
  .mast-inner { min-height: 50px; width: calc(100% - 16px); gap: 6px; }
  .brand { gap: 5px; }
  .brand-pad { width: 24px; height: 24px; }
  .title-art { width: 138px; }

  .tools { gap: 4px; }
  .tools .plain-button { justify-content: center; width: 36px; min-height: 40px; padding: 0; }
  .tools .plain-button span { display: none; }
  .plain-button .icon { width: 16px; height: 16px; }

  .shuffle-button { font-size: 13px; gap: 7px; min-height: 40px; padding: 7px 12px; border-radius: 11px; }
  .shuffle-button .icon { width: 16px; height: 16px; }
  .board-toolbar { min-height: 41px; padding: 0 12px; }
  .maze-index { font-size: 10px; gap: 6px; letter-spacing: .65px; }
  .maze-index .icon { width: 16px; height: 16px; } .meta-rule { height: 12px; }
  .palette { font-size: 11.5px; gap: 5px; }
  .move-counter { font-size: 11.5px; } .move-counter .icon { display: none; }
  .stage { margin: 0 5px; border-radius: 12px; }
  .console-foot { padding: 6px 12px; min-height: 55px; } .portrait { width: 34px; height: 34px; border-radius: 10px; }
  .portrait img { width: 38px; height: 38px; } .explorer { gap: 7px; } .small-label { font-size: 8px; }
  .explorer strong { font-size: 15px; } .controls-guide { display: none; } .touch-guide { display: block; font-size: 12px; color: #d6cfdf; }
}
@media (max-width: 620px), (pointer: coarse) {
  .touch-controls { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 14px; }
  .touch-controls button { display: grid; place-items: center; width: 48px; height: 44px; color: #272337; border-radius: 11px; border: 1px solid #f3ffbd; background: var(--lime); box-shadow: 0 2px 0 #778a42; }
  .touch-controls button:active { transform: translateY(2px); }
  .touch-controls button:disabled { color: #86808e; border-color: #494552; background: #2b2934; box-shadow: 0 2px 0 #13121a; }
  .touch-controls .icon { width: 22px; height: 22px; stroke-width: 2.5; }
  [data-pad="0"] { order: 1; } [data-pad="3"] { order: 0; } [data-pad="2"] { order: 2; } [data-pad="1"] { order: 3; }
  [data-pad="3"] .icon { transform: rotate(-90deg); } [data-pad="2"] .icon { transform: rotate(180deg); } [data-pad="1"] .icon { transform: rotate(90deg); }
  .touch-controls button:enabled .icon { transform: rotate(var(--passage-angle, 0deg)); }
}
@media (max-width: 350px) {
  .board-meta { gap: 6px; } .palette { font-size: 10px; } .shuffle-button { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}

.print-button { background: var(--lilac); border: 1px solid #17151f; color: #252035; border-radius: 13px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; font-size: 16px; font-weight: 750; min-height: 47px; padding: 8px 17px; box-shadow: 0 3px 0 #76659f; }
.print-button:hover { background: #cabbff; }
.print-button:active { transform: translateY(2px); }
.new-group { position: relative; z-index: 3; }
.split-button { display: flex; align-items: stretch; border: 1px solid #171918; background: var(--lime); border-radius: 13px; box-shadow: 0 3px 0 #788c39; }
.split-button .shuffle-button { margin: 0; border: 0; border-radius: 12px 0 0 12px; min-height: 45px; box-shadow: none; padding-right: 13px; }
.split-button .shuffle-button:hover, .split-button .shuffle-button:active { transform: none; box-shadow: none; }
.style-toggle { width: 36px; border: 0; border-radius: 0 12px 12px 0; background: transparent; color: #30361c; display: grid; place-items: center; position: relative; }
.style-toggle::before { content:""; position: absolute; left: 0; height: 19px; width: 1px; background: #9bb34c; }
.style-toggle:hover, .style-toggle[aria-expanded="true"] { background: #ebffa8; }
.style-toggle .icon { width: 16px; height: 16px; }
.style-options { position: absolute; right: 0; top: calc(100% + 9px); min-width: 179px; padding: 8px; background: #302b3a; border: 1px solid #645a70; border-radius: 13px; box-shadow: 0 7px 24px #0b071989; }
.style-options .small-label { padding: 6px 9px 7px; }
.style-options button { width: 100%; background: transparent; border: 0; border-radius: 7px; padding: 9px; color: var(--ink); display: flex; align-items: center; gap: 9px; font-weight: 700; text-align: left; }
.style-options button:hover, .style-options button:focus-visible { background: #494054; }
.style-options .icon { width: 18px; height: 18px; color: var(--lilac); }
.stage[data-kind="straight"] .ink-layer { stroke-linecap: square; stroke-linejoin: miter; stroke-width: 12.5; }
.stage[data-kind="circular"] .ink-layer { stroke-width: 11.5; stroke-linecap: round; }
.print-emblem { margin: 4px auto 14px; width: 54px; height: 54px; border-radius: 16px; background: #494055; color: var(--lilac); display: grid; place-items: center; }
.print-emblem .icon { width: 30px; height: 30px; }
#print-explainer { color: #d4cddd; line-height: 1.5; margin: -5px 0 22px; }
.print-choice { width: 100%; margin-top: 8px; min-height: 49px; display: flex; align-items: center; gap: 15px; padding: 10px 14px; border-radius: 11px; border: 1px solid #6a6079; color: var(--ink); background: #393342; font-weight: 700; }
.print-choice:hover { background: #4b4257; border-color: var(--lilac); }
.print-samples { display: inline-flex; padding-right: 3px; }
.print-samples i { width: 15px; height: 15px; border: 1px solid #302b37; border-radius: 50%; background: #bb9cfa; margin-right: -4px; }
.print-samples i:nth-child(2) { background:#ff9c74; } .print-samples i:nth-child(3) { background:var(--lime); }
.ink-samples i { background:#161417; border-color:#aaa1ad; } .ink-samples i:nth-child(2) { background:#8b8790; } .ink-samples i:nth-child(3) { background:#fff; }
#print-sheet { display: none; }
.print-option { display: flex; align-items: center; gap: 9px; padding: 5px; cursor: pointer; }
.print-option input { width: 18px; height: 18px; accent-color: var(--lilac); }
@media (min-width: 621px) {
  .tools .print-button { min-height: 38px; padding: 6px 12px; font-size: 14px; }
  .tools .shuffle-button { min-height: 36px; padding: 6px 11px; gap: 7px; font-size: 14px; }
  .tools .style-toggle { width: 30px; }
}
@media (max-width: 620px) {

  .print-button { font-size: 13px; min-height: 40px; border-radius: 11px; padding: 6px 12px; gap: 6px; } .print-button .icon { width: 16px; height: 16px; }
  .split-button .shuffle-button { min-height: 38px; padding-inline: 12px 8px; } .style-toggle { width: 33px; }
  .stage[data-kind="circular"] { border-radius: 12px; }
  .board-meta { gap: 8px; }
}

@media (max-width: 440px) {
  .brand { gap: 3px; }
  .brand-pad { width: 21px; height: 21px; }
  .tools { gap: 3px; }
  .tools .plain-button { width: 32px; }
  .print-button, .split-button .shuffle-button { padding-inline: 7px; }
  .print-button .icon, .shuffle-button .icon { display: none; }
  .style-toggle { width: 28px; }
}
@media (min-width: 535px) and (max-width: 620px) {
  .tools .plain-button { width: auto; gap: 4px; padding-inline: 3px; font-size: 12px; }
  .tools .plain-button span { display: inline; }
}
@media (max-width: 350px) {
  .mast-inner { width: calc(100% - 8px); gap: 3px; }
  .tools { gap: 2px; }
  .tools .plain-button { width: 28px; }
  .print-button, .split-button .shuffle-button { padding-inline: 5px; font-size: 12px; }
  .style-toggle { width: 25px; }
}
@media screen {
  body {
    min-height: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
             env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }
  .shell { padding-block: clamp(5px, 1dvh, 12px) clamp(8px, 1.5dvh, 18px); }
  .console { width: min(100%, var(--frame-width, 100%)); margin-inline: auto; container-type: inline-size; }
  .mast-inner { max-width: max(730px, var(--frame-width, 100%)); }
  @container (max-width: 760px) {
    .console-foot .key-cluster, .console-foot .pointer-icon { display: none; }
    .console-foot .controls-guide { gap: 6px; }
  }
  @container (max-width: 500px) {
    .console-foot .touch-guide, .console-foot .controls-guide { display: none; }
    .solution-button { min-height: 36px; padding-inline: 8px; }
  }

  @container (max-width: 530px) {
    .board-toolbar, .console-foot { padding-inline: 10px; gap: 6px; }
    .explorer-copy p { font-size: 12px; }
    .key-cluster, .pointer-icon { display: none; }
    .board-meta, .controls-guide { gap: 7px; }
    .controls-guide { font-size: 12px; }
  }
  @container (max-width: 450px) {
    .maze-index .icon, .move-counter .icon { display: none; }
    .run-stats { gap: 8px; }
    .move-counter, .duration { gap: 4px; }
    .run-stats strong { font-size: 12px; min-width: 20px; height: 20px; }
  }
  @container (max-width: 325px) {
    .console-foot .touch-guide, .console-foot .controls-guide { display: none; }
    .maze-index { font-size: 10px; letter-spacing: .4px; }
    .controls-guide { flex-wrap: wrap; justify-content: flex-end; gap: 3px; }
    .board-meta { gap: 5px; }
  }
  @container (max-width: 270px) {
    #palette-name { display: none; }
    .meta-rule, .maze-index .icon { display: none; }
    .maze-index { letter-spacing: 0; font-size: 10px; }
    .board-meta, .board-toolbar { gap: 4px; }
    .board-toolbar { padding-inline: 6px; }
  }
  @container (max-width: 252px) {
    .maze-index, .meta-rule { display: none; }
    .board-toolbar, .console-foot { padding-inline: 7px; }
    .explorer-copy p { font-size: 11px; line-height: 1.2; }
  }
  @container (max-width: 190px) {
    .move-counter span { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
    .run-stats strong { min-width: 16px; height: 17px; font-size: 10px; padding-inline: 3px; }
    .palette { gap: 3px; padding-inline: 2px; min-height: 24px; }
    .board-toolbar, .console-foot { padding-inline: 5px; }
  }
}
@media screen and (pointer: coarse) {
  .controls-guide { display: none; }
  .touch-guide { display: block; font-size: 12px; color: #d6cfdf; }
}

@media screen and (max-height: 900px) {
  .mast-inner { min-height: 48px; }

  .board-toolbar { min-height: 36px; }
  .console-foot { min-height: 48px; padding-block: 4px; }
  .portrait { width: 34px; height: 34px; }
  .portrait img { width: 37px; height: 37px; }
  .touch-controls { padding-top: 8px; }
}
@media screen and (max-height: 620px) {
  .mast-inner { min-height: 40px; }

  .board-toolbar { min-height: 31px; }
  .console-foot { min-height: 37px; padding-block: 2px; }

  .portrait { width: 27px; height: 27px; border-radius: 8px; }
  .portrait img { width: 30px; height: 30px; }
  .explorer strong { font-size: 14px; }
}
@media screen and (max-height: 500px) and (orientation: landscape) {
  .mast-inner { min-height: 32px; }

  .plain-button { min-height: 32px; padding-block: 4px; }

  .print-button, .split-button .shuffle-button { min-height: 34px; padding-block: 5px; font-size: 13px; }
  .board-toolbar { min-height: 25px; }
  .console-foot { min-height: 28px; }

  .portrait { width: 23px; height: 23px; }
  .portrait img { width: 25px; height: 25px; }
  @container (max-width: 275px) {
    /* Short landscape screens have room beside the square for the caption. */
    .console-foot {
      position: relative; left: 50%; transform: translateX(-50%);
      width: min(448px, 90vw); margin-top: 3px; padding: 3px 9px;
      justify-content: center;
    }
    .explorer-copy p { font-size: 12px; }
  }
  .stage { margin-inline: 4px; border-radius: 9px; }
  .touch-controls { padding-top: 5px; }
  .shell { padding-block: 4px 5px; }
  dialog { width: min(460px, calc(100% - 32px)); padding: 15px 24px; }
  .print-emblem, .dialog-art, .win-art { display: none; }
  dialog h2 { font-size: 24px; margin: 3px 22px 8px; }
  .help-steps { margin-block: 8px 12px; }
  .help-steps li { margin-block: 6px; font-size: 14px; }
  #print-explainer { margin: 0 0 9px; font-size: 14px; }
}
@media print {
  :root, html, body { color-scheme: light; background: white !important; color: black; padding: 0 !important; margin: 0 !important; width: 100%; min-height: 0 !important; height: auto !important; }
  body::before, body > :not(#print-sheet), dialog::backdrop { display: none !important; }
  #print-sheet { display: block !important; width: 100%; }
  #print-sheet > svg { display: block; width: 100%; height: 99vh; padding: 11mm; box-sizing: border-box; break-inside: avoid; }
  #print-sheet > svg + svg { break-before: page; }
  #print-sheet, #print-sheet * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
