:root {
  color-scheme: dark;
  --comic-ink: #241839;
  --base: #fff0d6;
  --panel: #f2e3fb;
  --line: var(--comic-ink);
  --text: #301f44;
  --muted: #624875;
  --accent: #684090;
  --lavender: #e4caf8;
  --sun: #ffcf6b;
  --bright-yellow: #ffda13;
  --bright-magenta: #ff35b5;
  --bright-cyan: #02d6ed;
  --yellow-tip: #a16b02;
  --magenta-tip: #a72b78;
  --cyan-tip: #08768c;
  --paper: linear-gradient(145deg, #fffbec, #ffedcf 58%, #f3e0f5);
  --ink: var(--comic-ink);
  --radius: 23px;
  font-family: "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 290px;
  min-height: 100vh;
  color: var(--text);
  background: var(--map-stars, none) center top / 900px 1315px repeat #151329;
}
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible { outline: 2px solid #7644aa; outline-offset: 3px; }
h1, h2, p { margin: 0; }

.topbar { border-bottom: 1px solid transparent; }
.top-inner {
  max-width: 1112px;
  margin: auto;
  min-height: 70px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #fff3cb;
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: .04em;
  text-shadow: 2px 2px #201636;
}
.brand-mark {
  display: block;
  flex: none;
  width: 48px;
  height: auto;
  object-fit: contain;
}
.control, .primary {
  min-height: 42px;
  border-radius: 11px;
  padding: 0 16px;
  border: 2px solid var(--line);
  color: var(--text);
  background: var(--lavender);
  box-shadow: 0 2px var(--comic-ink);
  font-size: .875rem;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.control:hover:not(:disabled) { background: #f5d5ed; }
.control:disabled { color: #6c587d; background: #e7def0; box-shadow: none; }
.map-button { background: var(--base); }
.round-nav { display: none; }
.grid-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  background:
    linear-gradient(var(--accent) 0 0) top left,
    linear-gradient(var(--accent) 0 0) top right,
    linear-gradient(var(--accent) 0 0) bottom left,
    linear-gradient(var(--accent) 0 0) bottom right;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.shell { max-width: 1080px; margin: auto; padding: 28px 24px 32px; }
.play-area, #target-dialog {
  --target-legend-size: clamp(84px, 12vw, 108px);
  --target-legend-gap: 8px;
}
.shell.has-round .play-area {
  --reference-size: clamp(156px, min(57vw, 27svh), 224px);
  display: grid;
  max-width: 645px;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-inline: auto;
}
.round-reference {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 5px 0 8px;
  pointer-events: none;
}
.round-reference .target-card { pointer-events: auto; }
.target-reference {
  display: flex;
  align-items: center;
  gap: var(--target-legend-gap);
  min-width: 0;
  max-width: 100%;
}
.target-sidebar {
  flex: 0 0 var(--target-legend-size);
  display: grid;
  gap: 6px;
  min-width: 0;
  pointer-events: auto;
}
.target-sidebar:not(:has(> :not([hidden]))) { display: none; }
.target-recipes {
  display: grid;
  grid-template-columns: max-content;
  justify-content: center;
  gap: 7px;
  padding: 8px 7px;
  border: 2px solid var(--comic-ink);
  border-radius: 13px;
  background: #d4dcff;
}
.recipe-swatches {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--recipe-swatch-gap, 3px);
}
.recipe-swatches span {
  flex: none;
  width: var(--recipe-swatch-width, 12px);
  height: var(--recipe-swatch-height, 14px);
  border: 1px solid var(--comic-ink);
  border-radius: 4px;
  background: var(--ink-stick);
}
.recipe-swatches span:last-child {
  position: relative;
  margin-inline-start: var(--recipe-arrow-space, 9px);
}
.recipe-swatches span:last-child::before {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: var(--recipe-arrow-inset, -10px);
  width: var(--recipe-arrow-size, 4px);
  height: var(--recipe-arrow-size, 4px);
  border: solid var(--comic-ink);
  border-width: 1px 1px 0 0;
  transform: translateY(-50%) rotate(45deg);
}
h1 { font-size: clamp(2rem, 5vw, 3.12rem); font-weight: 780; letter-spacing: -.045em; line-height: 1.15; margin: 8px 0 11px; }

.ready-card, .target-card, .board-card { border-radius: var(--radius); overflow: hidden; }
.ready-card#ready-card {
  width: min(calc(100% - 32px), 460px);
  padding: clamp(26px, 7vw, 46px) 24px;
  text-align: center;
  overflow-y: auto;
  border: 3px solid var(--comic-ink);
  background: var(--base);
  box-shadow: 0 7px var(--comic-ink);
}
.ready-close {
  position: absolute;
  inset: 10px 10px auto auto;
  min-width: 40px;
  padding: 0;
  font-size: 1.35rem;
  background: #f2c9f3;
}
.ready-card h1 { margin: 0 0 10px; font-size: clamp(1.75rem, 5vw, 2.5rem); }
.ready-card p { color: var(--muted); line-height: 1.45; }
.ready-actions { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.ready-card .start-button { width: min(100%, 140px); min-height: 48px; font-size: 1rem; }
.ready-actions .control { min-height: 44px; }
#rule-tutorial {
  width: min(calc(100% - 28px), 440px);
  padding: clamp(14px, 4vw, 24px);
  border: 3px solid var(--comic-ink, #281a40);
  border-radius: 23px;
  background: #f4e2fb;
  box-shadow: 0 6px var(--comic-ink, #281a40);
  color: #2e2046;
  text-align: center;
}
#rule-tutorial::backdrop { background: #21142b92; }
.rule-tutorial h2 { margin-bottom: 12px; font-size: 1.27rem; }
#tutorial-topic:focus { outline: none; }
.tutorial-scene {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  aspect-ratio: 100 / 54;
  overflow: hidden;
  border: 1px solid #735287;
  border-radius: 10px;
  --tutorial-paper: #fff3de;
  background: var(--tutorial-paper);
}
.tutorial-object {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) rotate(var(--angle, 0deg));
  opacity: var(--opacity, 1);
  z-index: 2;
}
.tutorial-stick, .tutorial-ghost, .tutorial-ray { width: var(--size); }
.tutorial-stick, .tutorial-ghost { border-radius: 1em; }
.tutorial-stick { height: clamp(5px, 1.65cqw, 10px); background-color: var(--paint); }
.tutorial-tip {
  position: absolute;
  top: 50%;
  left: 0;
  width: clamp(8px, 2.8cqw, 17px);
  aspect-ratio: 1.15;
  transform: translate(-40%, -50%);
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--tip) 83%, var(--comic-ink));
  background-color: var(--tip);
}
.tutorial-ghost { height: clamp(5px, 1.4cqw, 8px); background: color-mix(in srgb, var(--paint) 28%, transparent); }
.tutorial-stick.is-lit, .tutorial-ghost.is-lit { box-shadow: 0 0 0 3px color-mix(in srgb, var(--paint) 24%, transparent); }
.tutorial-ray { z-index: 1; height: 0; border-top: 2px solid var(--paint); }
.tutorial-ray.is-dashed { border-top-style: dashed; opacity: .65; }
.tutorial-area {
  z-index: 0;
  width: var(--size);
  height: var(--height);
  background-color: color-mix(in srgb, var(--paint) 24%, transparent);
}
.tutorial-dot {
  z-index: 3;
  width: clamp(7px, 2.4cqw, 14px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paint);
}
.tutorial-dot.is-ring { width: clamp(15px, 4.5cqw, 26px); border: 2px solid var(--paint); background: transparent; }
.tutorial-label {
  z-index: 4;
  white-space: nowrap;
  padding-inline: .38em;
  border-radius: .4em;
  color: var(--tip);
  background: color-mix(in srgb, var(--paint) 13%, var(--tutorial-paper));
  font-size: .78rem;
  font-weight: 700;
}
.rule-tutorial > p { margin-block: 12px; font-size: .875rem; line-height: 1.55; }
.tutorial-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.tutorial-controls button { min-height: 44px; padding-inline: 12px; font-size: .83rem; }
.target-card {
  width: var(--reference-size);
  flex: none;
  aspect-ratio: 1;
  background: var(--base);
  color: var(--ink);
  border: 2px solid var(--comic-ink);
  box-shadow: 0 5px var(--comic-ink);
}
#board-title:focus { outline: none; }
.card-heading { min-height: 66px; padding: 0 21px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-heading h2 { display: flex; align-items: center; gap: 9px; font-size: 1rem; font-weight: 850; letter-spacing: .02em; }
.moves { font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.target-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 215px);
  padding: 7px 10px;
  border-radius: 999px;
  border: 2px solid var(--comic-ink);
  background: var(--sun);
  color: var(--comic-ink);
  box-shadow: 0 3px var(--comic-ink);
}
.timer-seconds { min-width: 3.2rem; text-align: right; white-space: nowrap; font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.target-timer.is-urgent { background: #ffa18f; }
.board-stats { display: flex; flex: none; align-items: center; gap: 7px; }
.board-timer {
  width: auto;
  gap: 5px;
  padding: 4px 7px;
  box-shadow: 0 2px var(--comic-ink);
}
.board-timer .timer-seconds { min-width: 4.4ch; text-align: center; }
.timer-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #50324c50;
}
.timer-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #643d8d;
  transform-origin: left center;
}
.is-urgent .timer-fill { background: #6c2748; }
.timer-clock {
  position: relative;
  flex: 0 0 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.timer-clock::before {
  content: "";
  position: absolute;
  top: 3px;
  left: calc(50% - 1px);
  width: 6px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}
.is-urgent .timer-clock { animation: timer-clock-shake 900ms ease-in-out infinite; }
@keyframes timer-clock-shake {
  0%, 42%, 100% { transform: rotate(0); }
  8%, 24% { transform: rotate(-19deg); }
  16%, 32% { transform: rotate(19deg); }
}
.target-display, .board-surface {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--paper);
}
.target-display {
  min-height: 0;
  overflow: hidden;
}
.target-display::before, .board-surface::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid #9f73604c;
  border-radius: 13px;
  pointer-events: none;
}
.target-display::after, .board-surface::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle, #8c538d18 1px, transparent 1.25px) 0 0 / 13px 13px;
}
.target-board { z-index: 1; }
.target-zoom {
  position: absolute;
  inset: 11px;
  z-index: 2;
  border: 0;
  border-radius: 11px;
  background: transparent;
  cursor: zoom-in;
}
.target-zoom:focus-visible { outline-color: #583880; outline-offset: 0; }

.board-card {
  background: var(--panel);
  border: 2px solid var(--comic-ink);
  box-shadow: 0 5px var(--comic-ink);
  padding-block: 8px 10px;
}
.board-info { display: contents; }
.board-heading { min-height: 62px; padding-inline: clamp(9px, 1.5vw, 21px); }
.board-dot {
  width: 16px;
  height: 16px;
  background: #a15b93;
  clip-path: polygon(50% 0, 64% 35%, 100% 50%, 64% 65%, 50% 100%, 36% 65%, 0 50%, 36% 35%);
}
.moves { display: flex; gap: 5px; color: var(--muted); align-items: center; }
.moves strong {
  padding: 6px 9px;
  border: 2px solid var(--comic-ink);
  border-radius: 9px;
  min-width: 55px;
  background: #bfebf5;
  color: var(--text);
  font-size: 1rem;
  text-align: center;
}
.color-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 7px;
  font-weight: 650;
  color: var(--comic-ink);
  border: 1px solid var(--comic-ink);
  border-radius: 7px;
  background: var(--token, var(--base));
  flex: 0 0 auto;
  white-space: nowrap;
}
.color-2 { --token: #dfcaff; --ink-stick: #6840a8; --ink-tip: #462975; }
.color-3, .mix-color-6 { --token: #9dedf5; --ink-stick: var(--bright-cyan); --ink-tip: var(--cyan-tip); }
.color-4 { --token: #ffc3b3; --ink-stick: #a74c3d; --ink-tip: #803528; }
.color-1 { --token: #ffdc9c; --ink-stick: #d69344; --ink-tip: #df545b; }
.mix-color-1 { --token: #ffacae; --ink-stick: #dd4a59; --ink-tip: #952941; }
.mix-color-2 { --token: #a8eabb; --ink-stick: #248d5e; --ink-tip: #115338; }
.mix-color-3 { --token: #fff29b; --ink-stick: var(--bright-yellow); --ink-tip: var(--yellow-tip); }
.mix-color-4 { --token: #b3ccff; --ink-stick: #475bd1; --ink-tip: #263587; }
.mix-color-5 { --token: #ffc8ec; --ink-stick: var(--bright-magenta); --ink-tip: var(--magenta-tip); }
.mix-color-7 { --token: #fff; --ink-stick: #fff; --ink-tip: #a392be; }
.board-surface {
  margin: 0 15px;
  border: 2px solid var(--comic-ink);
  border-radius: 16px;
}
.board-surface.is-won { border-color: #27745a; box-shadow: inset 0 0 26px #5fbf9b50; }
.board-viewport { position: relative; z-index: 1; width: 100%; overflow: hidden; border-radius: inherit; }
.board-surface.is-zoomed .board-viewport {
  height: min(56svh, 470px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #72648b transparent;
}
.geometry { position: relative; aspect-ratio: 1; width: 100%; container-type: inline-size; }
.game-board { max-width: clamp(280px, calc(100svh - 435px), 383px); touch-action: pan-y; }
.game-board { margin-inline: auto; }
.board-surface.is-zoomed .game-board { width: calc(64px * var(--grid-size)); max-width: none; touch-action: pan-x pan-y; }
.point {
  position: absolute;
  width: 5px;
  height: 5px;
  left: var(--x);
  top: var(--y);
  border-radius: 50%;
  background: #75578987;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.slot {
  position: absolute;
  appearance: none;
  display: grid;
  align-items: center;
  left: var(--x);
  top: var(--y);
  width: var(--length);
  height: clamp(6px, calc(44cqw / var(--grid-size)), 28px);
  transform: translate(-50%, -50%) rotate(var(--angle));
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 5px;
  color: inherit;
  touch-action: manipulation;
}
.game-board .slot:not(.occupied)::before {
  content: "";
  position: absolute;
  inset-inline: 2%;
  top: 50%;
  border-top: 2px dashed #8065907d;
  transform: translateY(-50%);
  pointer-events: none;
}
.slot.occupied { z-index: 1; }
.game-board .slot.occupied:not(:disabled) { touch-action: none; }
.board-surface.is-zoomed .game-board .slot { touch-action: pan-x pan-y; }
/* Slots stay identifiable as controls while only the match art changes. */
.slot .stick-shank {
  position: relative;
  height: clamp(2.5px, calc(12.4cqw / var(--grid-size)), 8px);
  width: 100%;
  background: linear-gradient(color-mix(in srgb, var(--ink-stick) 72%, white), var(--ink-stick) 65%);
  border-radius: 5px;
  outline: 1px solid var(--comic-ink);
  box-shadow: 0 2px #31223b35;
  pointer-events: none;
}
.stick-shank::before {
  content: "";
  position: absolute;
  left: -2%;
  top: 50%;
  height: 145%;
  width: 16%;
  background: var(--ink-tip);
  border-radius: 46% 53% 52% 44%;
  outline: 1px solid var(--comic-ink);
  box-shadow: inset 0 1px 0 #ffffff66;
  transform: translateY(-50%);
}
.slot.occupied.is-locked { opacity: .72; }
.game-board.has-hidden-order .slot.occupied.is-locked { opacity: .42; }
.game-board .slot.is-movable { z-index: 2; }
.game-board .slot.is-movable .stick-shank {
  filter: brightness(1.22) saturate(1.12);
  box-shadow: 0 0 3px #fff, 0 0 9px color-mix(in srgb, var(--ink-stick) 64%, transparent);
}
.game-board .slot:focus-visible { outline-color: #583880; }
.slot.occupied:hover:not(.is-locked):not(:disabled), .slot.is-selected { background: #6840a826; }
.game-board.has-hidden-order .slot.occupied:hover:not(.is-drop) { background: transparent; }
.game-board .slot.is-selected { outline: 2px solid #583880; outline-offset: 3px; z-index: 3; }
.game-board.has-hidden-order .slot.is-selected:not(:focus-visible) { outline: none; background: transparent; }
.game-board.has-hidden-order .slot.is-selected.is-movable .stick-shank { filter: brightness(1.36) saturate(1.16); }
.game-board .slot.is-hint { outline: 2px solid #855514; outline-offset: 2px; z-index: 3; }
.game-board .slot:not(.occupied):hover:not(:disabled), .game-board .slot.is-drop { background: #6840a826; }
.game-board.is-dragging { cursor: grabbing; }
.feedback {
  min-height: 54px;
  margin: 0 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: .875rem;
  color: var(--muted);
}
.feedback p { line-height: 1.45; }
.feedback p.good { color: #1b604a; font-weight: 800; }
.feedback p.warning { color: #8e334b; }
.primary { color: var(--comic-ink); background: var(--sun); flex: 0 0 auto; }
.primary:hover { background: #ffe29e; }
.toolbar { padding: 4px 15px 11px; display: flex; flex-wrap: wrap; gap: 10px; }
.next-move-colors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  margin: 0 15px 5px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 650;
}
.next-move-tokens { display: inline-flex; align-items: center; gap: 5px; }
.next-move-tokens .color-token { padding: 1px 6px; }
.toolbar .tool-button { min-height: 36px; padding-inline: 11px; }
.hint-button { background: #bfeaf1; margin-left: auto; }
.tool-icon {
  display: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hint-button .tool-icon { display: block; }
#zoom-board[aria-pressed="true"] .zoom-plus { display: none; }

dialog {
  width: min(92vw, 560px);
  max-height: min(84dvh, 680px);
  padding: 20px;
  border: 3px solid var(--comic-ink);
  border-radius: 18px;
  background: var(--base);
  color: var(--text);
  box-shadow: 0 6px var(--comic-ink);
}
dialog::backdrop { background: #0a0715b8; }
.gallery-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 17px; }
.gallery-head h2 { font-size: 1.3rem; margin-bottom: 5px; }
.gallery-head p { color: var(--muted); font-size: .875rem; }
.target-detail-head { margin-bottom: 12px; align-items: center; }
.target-detail-controls { display: flex; align-items: center; gap: 8px; }
.target-detail-controls .target-timer { width: clamp(108px, 33vw, 160px); }
#target-dialog { width: min(calc(100% - 16px), 640px); }
.target-detail-reference { justify-content: center; }
#target-detail {
  flex: 0 0 min(55svh, calc(100% - var(--target-legend-size) - var(--target-legend-gap)));
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 12px;
}
#target-detail-lamps { flex: 0 0 var(--target-legend-size); }
body.map-view {
  background-size: 720px 1052px;
}
.map-view .shell { max-width: none; padding-block: 0; overflow-x: clip; }
.level-map {
  --map-row-size: clamp(62px, 10dvh, 92px);
  --map-focus: .19;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  block-size: 100dvh;
}
.map-heading {
  display: grid;
  justify-items: center;
  gap: clamp(5px, .85dvh, 9px);
  padding: clamp(9px, 1.9dvh, 19px) 14px 5px;
  text-align: center;
}
.home-mark {
  display: block;
  inline-size: clamp(52px, 11dvh, 108px);
  block-size: auto;
  aspect-ratio: 1;
  object-fit: contain;
}
.map-heading h1 { inline-size: min(78vw, 370px); }
.map-heading h1 img {
  display: block;
  inline-size: 100%;
  block-size: auto;
  max-block-size: clamp(48px, 14dvh, 118px);
  object-fit: contain;
}
.map-stage {
  position: relative;
  isolation: isolate;
  container-type: size;
  overflow: clip;
}
.map-cast, .map-scroll { position: absolute; inset: 0; }
.map-cast { pointer-events: none; }
.map-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  overscroll-behavior-y: contain;
  mask-image: linear-gradient(transparent,
    #000 calc((var(--map-focus) - .11) * 100%) calc((var(--map-focus) + .13) * 100%),
    #0005 calc((var(--map-focus) + .44) * 100%), transparent);
}
.map-levels {
  inline-size: clamp(126px, 46vw, 490px);
  margin-inline: auto;
  padding-block-start: max(0px, calc(100cqh * var(--map-focus) - var(--map-row-size) / 2));
  padding-block-end: max(0px, calc(100cqh * (1 - var(--map-focus)) - var(--map-row-size) / 2));
}
@media (max-width: 740px) {
  .map-view .shell { padding-inline: 0; }
  .map-levels { inline-size: clamp(100px, 35vw, 278px); }
}
@media (max-height: 450px) {
  .level-map { --map-focus: .28; }
}
@media (max-width: 740px),
       (max-width: 950px) and (max-height: 520px) and (orientation: landscape) and (any-pointer: coarse) {
  .level-map { --map-focus: .5; --map-cast-stagger: .18; }
  .map-levels { translate: calc(50% - var(--map-current-x, 50%)); }
  .map-scroll { mask-image: linear-gradient(transparent, #000 36% 64%, transparent); }
}
#map-notice {
  position: fixed;
  z-index: 4;
  inset: auto 12px 12px;
  width: fit-content;
  margin-inline: auto;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--comic-ink);
  color: #f5d897;
  text-align: center;
}
.map-path {
  --map-page-height: calc(var(--map-row-size) * 10);
  position: relative;
  height: var(--map-page-height);
}
.map-path::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--map-trail) center / 100% 100% no-repeat;
  pointer-events: none;
}
.map-path.is-mirrored::before { transform: scaleX(-1); }
.map-pair {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}
.map-pair img {
  position: absolute;
  display: block;
  object-fit: contain;
  filter: drop-shadow(1px 3px #26183065);
  transform: translate(-50%, -50%);
  visibility: hidden;
}
.map-positioned img { visibility: visible; }
.map-story {
  position: absolute;
  inset-block-start: 0;
  display: none;
  pointer-events: none;
}
.scene-painted img { visibility: hidden; }
.scene-painted .map-story { display: block; }
.level {
  --level-glow: drop-shadow(0 3px #221735b8);
  --marker-size: clamp(44px, calc(var(--map-page-height) / 10 - 8px), 54px);
  --size-extra: calc(var(--size-bonus) * var(--size-scale, 1) * var(--shape-scale, 1));
  position: absolute;
  z-index: 2;
  inset: var(--level-y) auto auto var(--level-x);
  transform: translate(-50%, -50%);
  width: calc(var(--marker-size) + var(--size-extra) + var(--shape-width, 0px));
  height: calc(var(--marker-size) + var(--size-extra));
  padding: 0;
  border: 0;
  background: transparent;
  color: #280d36;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  opacity: .48;
}
.level-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  pointer-events: none;
  transition: transform .16s ease;
}
.level-face::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: var(--level-art) center / contain no-repeat;
  transform: rotate(var(--tilt));
  filter: var(--level-glow);
}
.level-number {
  position: relative;
  transform: translate(var(--number-x, 0), var(--number-y, 0));
  text-shadow: 0 1px var(--number-shadow, #fff0d690);
}
.level[data-shape="meteor"] { --number-x: -2px; --number-y: 2px; }
.level[data-shape="star"] { --number-y: 4px; }
.level:is([data-shape="planet"], [data-shape="ufo"], [data-shape="satellite"]) {
  --shape-scale: .65;
  --shape-width: 12px;
}
.level[data-shape="planet"] { --number-y: -2px; }
.level[data-shape="ufo"] { --number-y: 3px; }
.level[data-shape="rocket"] { --number-y: -3px; }
.level[data-shape="comet"] {
  --shape-scale: .65;
  --shape-width: 18px;
  --number-x: -11px;
  --number-y: 1px;
}
.level[data-shape="satellite"] { --number-y: 5px; }
.level[data-shape="astronaut"] { --number-y: -1px; }
.level[data-shape="black-hole"] {
  --number-shadow: #2d1240;
  color: #fff5ff;
}
.level:hover, .level:focus-visible { z-index: 3; opacity: .76; }
.level:hover .level-face { transform: translateY(-3px); }
.level:focus-visible { outline: none; }
.level:focus-visible .level-face { outline: 3px solid #fff4d9; outline-offset: 3px; }
.level.is-completed { --level-glow: drop-shadow(0 2px #16392d) drop-shadow(0 0 2px #a9efc6); }
.level[aria-current="true"] {
  z-index: 3;
  opacity: 1;
  --level-glow: drop-shadow(0 2px #221735b8) drop-shadow(0 0 3px #fff0a4) drop-shadow(0 0 2px #fff0a4);
}
.level.has-tutorial {
  z-index: 2;
  --level-glow: drop-shadow(0 2px #221735b8) drop-shadow(0 0 2px #ffd765) drop-shadow(0 0 4px #ffd765);
}
.level.is-completed::after {
  content: "✓";
  position: absolute;
  inset: auto -4px -3px auto;
  display: grid;
  place-items: center;
  width: 17px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--comic-ink);
  background: #216455;
  color: #e4fff7;
  font-size: 11px;
}
.tutorial-badge {
  position: absolute;
  inset: calc(100% - 7px) auto auto 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  min-height: 22px;
  padding: 0 6px;
  border: 2px solid var(--comic-ink);
  border-radius: 999px;
  background: #ffdc77;
  box-shadow: 0 2px var(--comic-ink);
  color: var(--comic-ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

@media (max-height: 600px) {
  .level-face { inset-block: max(0px, calc((100% - var(--map-page-height) / 10 + 4px) / 2)); }
}

@media (min-width: 741px) {
  .shell.has-round .play-area {
    --desktop-gap: 24px;
    --target-rail-offset: calc(var(--target-legend-size) + var(--target-legend-gap));
    --desktop-column-width: calc((100cqw - var(--desktop-gap) - var(--target-rail-offset)) / 2);
    --desktop-board-size: min(360px, calc(var(--desktop-column-width) - 24px));
    --desktop-target-size: min(392px, var(--desktop-column-width));
    container-type: inline-size;
    max-width: none;
    grid-template-columns: minmax(0, calc((100% - var(--desktop-gap) + var(--target-rail-offset)) / 2)) minmax(0, 1fr);
    gap: 10px var(--desktop-gap);
    align-items: start;
  }
  .shell.has-round .play-area:has(.board-surface.is-zoomed) {
    --desktop-board-size: min(425px, calc(var(--desktop-column-width) - 10px));
    --desktop-target-size: min(450px, var(--desktop-column-width));
  }
  .round-reference { display: contents; }
  .round-reference .target-reference {
    grid-area: 2 / 1;
    justify-self: center;
    align-self: start;
  }
  .target-reference .target-card {
    width: calc(var(--desktop-target-size) + 2px);
  }
  .board-card {
    display: grid;
    grid-column: 2;
    grid-row: 1 / span 2;
    grid-template-rows: subgrid;
    min-width: 0;
  }
  .board-surface {
    align-self: start;
    justify-self: center;
    width: calc(var(--desktop-board-size) + 2px);
    margin: 0;
  }
  .board-surface .game-board,
  .board-surface.is-zoomed .game-board { width: 100%; max-width: none; }
  .board-surface.is-zoomed .board-viewport { height: auto; overflow: hidden; }
}

@media (max-width: 740px) {
  .top-inner { min-height: 60px; padding-inline: 16px; }
  .brand { gap: 9px; font-size: 1.25rem; }
  .brand-mark { width: 44px; }
  .shell { padding: 16px 16px 21px; }
  .level {
    --marker-size: clamp(44px, calc(var(--map-page-height) / 10 - 8px), 52px);
    --size-scale: .62;
  }
  .board-heading { min-height: 47px; padding-inline: 14px; }
  .target-display::before, .board-surface::before { inset: 5px; border-radius: 8px; }
  .target-board .point { width: 3px; height: 3px; }
  .board-surface { margin-inline: 10px; }
  .game-board { max-width: 310px; }
  .feedback { margin-inline: 12px; min-height: 48px; }
  .toolbar { padding-inline: 12px; gap: clamp(6px, 2vw, 9px); }
  #target-dialog { padding: 12px; }
}
@media (max-width: 360px) {
  .top-inner, .shell { padding-inline: 12px; }
  .card-heading { padding-inline: 11px; }
  .control, .primary { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .is-urgent .timer-clock { animation: none; }
  .scene-painted img { visibility: visible; }
  .scene-painted .map-story { display: none; }
}

.variant-controls { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 15px; }
.board-controls > .variant-controls { gap: 8px; }
.round-ad-space { display: none; }
.variant-controls .control { min-height: 32px; padding: 3px 8px; font-size: .8rem; }
#target-options .control[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); opacity: 1; }
.lamp-legend {
  min-width: 0;
  padding: 5px;
  border: 2px solid var(--comic-ink);
  border-radius: 12px;
  background: #f7dff5;
  color: var(--ink);
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
}
.lamp-legend .variant-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin: 4px 0 0;
}
.lamp-legend .color-token { min-width: 0; padding: 2px 0; font-size: .68rem; font-variant-numeric: tabular-nums; }
.lamp-progress {
  --lamp-correct: #a0efcf;
  --lamp-adjust: #ffda9a;
  --lamp-empty: #d8c9ff;
  margin: 0 15px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--base);
  color: var(--text);
  font-size: .79rem;
  line-height: 1.35;
}
.lamp-progress-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  column-gap: 8px;
  font-weight: 650;
}
.lamp-progress-total, .lamp-progress-key strong { font-variant-numeric: tabular-nums; }
.lamp-progress-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 5px;
  margin-block: 6px;
}
.lamp-progress-track span {
  display: grid;
  place-items: center;
  min-height: 15px;
  border-radius: 999px;
  background: var(--lamp-status);
  color: #211a2d;
  font-size: .72rem;
  line-height: 1;
}
.lamp-progress [data-status="correct"] { --lamp-status: var(--lamp-correct); --lamp-status-ink: #246344; }
.lamp-progress [data-status="adjust"] { --lamp-status: var(--lamp-adjust); --lamp-status-ink: #884724; }
.lamp-progress [data-status="empty"] { --lamp-status: var(--lamp-empty); --lamp-status-ink: #5d4678; }
.lamp-progress-track [data-status="empty"] {
  border: 1px dashed #9488af;
  background: #ede1fb;
}
.lamp-progress-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  list-style: none;
}
.lamp-progress-key li { white-space: nowrap; }
.lamp-progress-key li span { color: var(--lamp-status-ink); margin-inline-end: 4px; font-weight: 750; }
.lamp-progress-key strong { color: var(--text); }
.lamp-progress-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.variant-layer { position: absolute; inset: 0; pointer-events: none; }
.variant-cell, .variant-triangle, .variant-point, .variant-axis { position: absolute; }
.variant-cell, .variant-triangle {
  width: calc(100% / var(--grid-size));
  height: calc(100% / var(--grid-size));
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: color-mix(in srgb, var(--token, #ac86e8) 56%, transparent);
  border: 1px solid var(--ink-stick, #74549d);
  color: #201635;
  font: 730 clamp(9px, 5cqw, 20px)/1 system-ui, sans-serif;
}
.variant-triangle {
  border: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--ink-stick, #9671cf) 56%, #e3d4fa);
}
.variant-triangle.variant-clue { background: #9669d452; }
.shared-edge-dots {
  position: absolute;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 50%;
  transform: translate(-50%, -50%);
}
.shared-edge-dots span {
  width: 32%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ink-stick);
  box-shadow: 0 0 0 1px #f8f1ff;
}
.variant-point {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--ink-stick, #8a4d12);
  clip-path: polygon(50% 0, 62% 35%, 100% 35%, 70% 57%, 82% 96%, 50% 72%, 18% 96%, 30% 57%, 0 35%, 38% 35%);
  z-index: 4;
}
.variant-axis { top: 5%; bottom: 5%; border-left: 2px dashed #5f3b89; z-index: 2; }
.slot.is-reversed .stick-shank::before { left: auto; right: -2%; }
.variant-marks {
  position: absolute;
  right: 0;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 2px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 3;
}
.variant-marks [data-mark] {
  position: relative;
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border: 1px solid white;
  border-radius: 50%;
  background: var(--ink-stick, #624390);
}
.variant-marks :is([data-mark="circle"], [data-mark="diamond"], [data-mark="gate"], [data-mark="zone"], [data-mark="head"]) {
  border: 2px solid #614194;
  background: #f7f0ff;
}
.variant-marks :is([data-mark="diamond"], [data-mark="neighbor"]) { border-radius: 1px; transform: rotate(45deg); }
.variant-marks :is([data-mark="lock"], [data-mark="locked"]) { border-radius: 2px; transform: rotate(calc(0deg - var(--angle))); }
.variant-marks :is([data-mark="lock"], [data-mark="locked"])::before {
  content: "";
  position: absolute;
  inset: -4px 1px auto;
  height: 4px;
  border: 1px solid #52406e;
  border-radius: 3px 3px 0 0;
}
.variant-marks [data-mark="locked"] { background: #287777; }
.variant-marks [data-mark="neighbor"][data-group] {
  background: #f7effd;
  border: 2px solid #563b78;
}
.variant-marks [data-mark="neighbor"][data-group="1"] { border-radius: 1px; }
.variant-marks [data-mark="neighbor"][data-group="2"] { border-radius: 50%; transform: none; }
.variant-marks [data-mark="neighbor"][data-group="3"] {
  border: 0;
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #563b78;
  transform: none;
}
.variant-marks [data-mark="stock-color"] { background: var(--ink-stick); }
.variant-marks [data-mark="excluded-color"] {
  display: grid;
  place-items: center;
  flex-basis: 13px;
  width: 13px;
  height: 13px;
  border: 1px solid #fff;
  box-shadow: 0 0 0 1px #38264d;
  background: var(--ink-stick);
}
.variant-marks [data-mark="excluded-color"]::after {
  content: "×";
  color: #fff;
  text-shadow: 0 0 1px #2e183b, 1px 0 1px #2e183b;
  font: 900 10px/1 system-ui, sans-serif;
}
.target-board .slot.variant-outline:has([data-mark="excluded-color"])::before { background: #6d6879; }
.target-board .slot.variant-outline:has([data-mark="neighbor"])::before { background: #6d6879; }
.target-board .slot.variant-outline::before { content: ""; height: 3px; border-radius: 2px; background: #9072b6; }
.target-board .slot:has([data-mark="lamp"])::before { background: #756d82; }
.target-board .variant-marks:has([data-mark="lamp"]) { right: 50%; transform: translate(50%, -50%); }
.variant-marks [data-mark="lamp"] { flex-basis: 9px; width: 9px; height: 9px; }
.level.has-bonus::after { content: "★"; color: #ffe182; }

@media (max-width: 740px),
       (max-width: 950px) and (max-height: 520px) and (orientation: landscape) and (any-pointer: coarse) {
  body:has(.shell.has-round) {
    --ad-slot-height: calc(50px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
    padding-bottom: calc(var(--ad-slot-height) + 8px);
    overflow: hidden;
  }
  .round-ad-space {
    display: block;
    position: fixed;
    inset: auto 0 0;
    height: var(--ad-slot-height);
    border-top: 1px solid #594a7270;
    background: #211b35;
  }
  .top-inner {
    min-height: 48px;
    padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(12px, env(safe-area-inset-right, 0px));
    padding-top: env(safe-area-inset-top, 0px);
  }
  .top-inner :is(.brand, .map-button) { display: none; }
  .round-nav {
    display: inline-flex;
    width: 44px;
    min-height: 40px;
    padding: 0;
    background: var(--base);
  }
  .round-settings:disabled { color: var(--text); background: var(--lavender); box-shadow: 0 2px var(--comic-ink); }

  .shell.has-round {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    width: 100%;
    min-height: 0;
    margin: 0 auto;
    padding: 3px max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px));
  }
  .shell.has-round .play-area {
    container-type: normal;
    width: 100%;
    min-height: 0;
    max-width: 645px;
    grid-template: minmax(0, .32fr) minmax(0, .68fr) / minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
  }
  .shell.has-round .round-reference {
    container: mobile-reference / inline-size;
    display: grid;
    min-height: 0;
    padding: 0 0 5px;
  }
  .round-reference .target-reference {
    display: grid;
    grid-area: auto;
    grid-template: auto minmax(0, 1fr) / minmax(0, 1fr);
    align-self: stretch;
    align-items: stretch;
    width: 100%;
    min-height: 0;
    gap: 0;
  }
  .round-reference .target-reference:has(#target-lamps:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) var(--target-legend-size);
  }
  .round-reference .target-stage {
    container-type: size;
    grid-area: 2 / 1;
    display: grid;
    place-items: center;
  }
  .round-reference .target-card { width: min(100cqw, 100cqh, 250px); }
  .round-reference .target-sidebar { display: contents; }
  .round-reference #target-lamps { grid-area: 2 / 2; align-self: center; }
  .round-reference .target-recipes {
    --recipe-gap: clamp(5px, 2.3vw, 14px);
    --recipe-swatch-width: clamp(11px, 3.9vw, 19px);
    --recipe-swatch-height: clamp(15px, 3.9vw, 20px);
    --recipe-swatch-gap: clamp(3px, .85vw, 5px);
    --recipe-arrow-space: 10px;
    --recipe-arrow-size: 5px;
    --recipe-arrow-inset: calc((var(--recipe-arrow-space) + var(--recipe-swatch-gap) + var(--recipe-arrow-size)) / -2);
    grid-area: 1 / 1 / 2 / -1;
    justify-self: center;
    width: min(100%, 500px);
    display: flex;
    justify-content: space-evenly;
    gap: var(--recipe-gap);
    padding: 4px 6px;
    margin-bottom: 6px;
  }
  .round-reference .target-recipes .recipe-swatches + .recipe-swatches { position: relative; }
  .round-reference .target-recipes .recipe-swatches + .recipe-swatches::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: calc((var(--recipe-gap) + 1px) / -2);
    width: 1px;
    background: #776790;
  }
  @container mobile-reference (max-width: 270px) {
    .round-reference .target-recipes {
      display: grid;
      grid-template-columns: repeat(2, max-content);
      row-gap: 4px;
    }
    .round-reference .target-recipes .recipe-swatches:nth-child(3)::before { display: none; }
  }
  .shell.has-round .board-card {
    grid-area: auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding-block: 4px 6px;
  }
  .board-controls { display: contents; }
  .board-heading { min-height: 34px; padding-inline: 9px; gap: 5px; }
  .board-heading h2 { gap: 5px; font-size: .9rem; white-space: nowrap; }
  .board-stats { gap: 5px; }
  .moves { gap: 4px; font-size: .75rem; }
  .moves strong { min-width: 45px; padding: 4px 6px; font-size: .9rem; }
  .board-timer { gap: 4px; padding: 3px 6px; }
  .board-timer .timer-seconds { font-size: .9rem; }
  .toolbar { justify-content: center; padding-block: 3px 5px; gap: clamp(4px, 1.5vw, 8px); }
  .toolbar .tool-button { flex: 0 1 clamp(37px, 12vw, 62px); min-width: 0; min-height: 34px; padding: 0; }
  .toolbar .hint-button { margin-inline-start: 0; }
  .toolbar #next { min-height: 34px; padding-inline: 7px; font-size: .76rem; }
  .tool-icon { display: block; }
  .tool-label {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
  }
  .board-card :is(#variant-actions, #target-options) { margin: 1px 9px 4px; }
  .board-card :is(#variant-actions, #target-options) .control { min-height: 34px; }
  #variant-actions:has([data-dye]:not([hidden])) {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }
  #variant-actions [data-dye] {
    padding-inline: 3px;
    font-size: .74rem;
    line-height: 1.15;
    white-space: normal;
  }
  .board-card .next-move-colors { margin: 0 9px 3px; }
  .shell.has-round .board-surface {
    container-type: size;
    flex: 1 1 0;
    min-height: 0;
    width: auto;
    margin: 3px 8px 0;
    align-self: stretch;
    justify-self: stretch;
  }
  .board-surface:not(.is-zoomed) .board-viewport {
    width: min(100cqw, 100cqh, 450px);
  }
  .board-surface .game-board { width: 100%; max-width: none; }
  .board-surface.is-zoomed .board-viewport {
    width: 100%;
    height: 100%;
    overflow: auto;
  }
  .board-surface.is-zoomed .game-board { min-width: 100%; width: calc(64px * var(--grid-size)); }
  .board-card :is(.feedback, .lamp-progress, #variant-clues) { order: 1; }
  .board-card .feedback { min-height: 21px; margin: 0 9px; padding-top: 3px; font-size: .75rem; }
  .board-card #variant-clues .variant-controls { margin: 4px 9px 0; gap: 4px; }
  .board-card #variant-clues .color-token { padding: 2px 5px; font-size: .76rem; }
  .board-card .lamp-progress {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 8px;
    align-items: center;
    padding: 3px 6px;
    margin: 3px 9px 0;
    font-size: .72rem;
  }
  .lamp-progress-heading { gap: 5px; white-space: nowrap; }
  .lamp-progress-track { margin: 0; }
  .lamp-progress-key { grid-column: 1 / -1; }
}

@media (max-width: 740px) and (orientation: landscape),
       (max-width: 950px) and (max-height: 520px) and (orientation: landscape) and (any-pointer: coarse) {
  .shell.has-round .play-area {
    max-width: none;
    grid-template: minmax(0, 1fr) / minmax(0, .43fr) minmax(0, .57fr);
  }
  .round-reference .target-recipes {
    --recipe-swatch-width: 12px;
    --recipe-swatch-height: 16px;
  }
  .shell.has-round .board-card {
    display: grid;
    grid-template: auto auto auto minmax(0, 1fr) / minmax(0, 1fr) clamp(106px, 37%, 160px);
  }
  .board-card .board-bar {
    grid-area: 1 / 1 / 2 / -1;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
  }
  .board-heading { padding-inline: 0 8px; }
  .board-heading h2, .moves span {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
  }
  .moves strong { min-width: 0; padding-inline: 4px; }
  .board-timer .timer-clock { flex-basis: 16px; height: 16px; }
  .board-card .toolbar { flex: 1; flex-wrap: nowrap; min-width: 0; gap: 4px; padding-inline: 7px 4px; }
  .board-card .toolbar .tool-button { flex: 1 1 24px; max-width: 44px; }
  .board-card .toolbar:has(#next:not([hidden])) { flex-wrap: wrap; }
  .board-card #target-options { grid-area: 2 / 1 / 3 / -1; }
  .board-card #variant-actions { grid-area: 3 / 1 / 4 / -1; }
  .board-card .board-surface { grid-area: 4 / 1; margin-block-end: 2px; }
  .board-card .board-info {
    grid-area: 4 / 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 0;
  }
  .board-info .next-move-colors { gap: 3px 4px; }
  .board-info .next-move-tokens { flex-wrap: wrap; gap: 3px; }
  .board-info .lamp-progress { grid-template-columns: minmax(0, 1fr); }
  .board-info .lamp-progress-key { gap: 2px 4px; }
}

@media (max-width: 630px) and (orientation: landscape) {
  .board-card #variant-clues .color-token { font-size: .7rem; padding: 1px 4px; }
  .board-card .board-info .feedback { line-height: 1.3; }
}
