:root {
  color-scheme: dark;
  --page: #0c2965;
  --panel: rgba(4, 35, 58, 0.78);
  --board: rgba(3, 31, 52, 0.42);
  --board-raised: rgba(8, 47, 75, 0.9);
  --ink: #e4f2ff;
  --muted: #668dd6;
  --line: rgba(222, 243, 255, 0.74);
  --soft-line: rgba(222, 243, 255, 0.22);
  --cell: rgba(10, 44, 118, 0.38);
  --cell-hover: rgba(16, 58, 152, 0.52);
  --accent: #61aaf8;
  --accent-strong: #e3f5ff;
  --add: #69b8ff;
  --add-dark: rgba(30, 96, 210, 0.82);
  --subtract: #ffc18e;
  --subtract-dark: rgba(198, 110, 67, 0.82);
  --path-blue-core: #1591DC;
  --path-blue-glow: #1591DC;
  --path-red-core: #810B38;
  --path-red-glow: #810B38;
  --path: rgba(47, 134, 240, 0.22);
  --path-strong: rgba(138, 194, 255, 0.9);
  --accent-glow: rgba(68, 150, 255, 0.36);
  --danger: #ffb199;
  --shadow: 0 24px 60px rgba(0, 10, 20, 0.34);
}

body.lite-mode .title-block {
  border-color: rgba(14, 35, 64, 0.45);
  background: transparent;
}

body.lite-mode .title-row + .title-row,
body.lite-mode .title-grid,
body.lite-mode .title-cell:nth-child(odd),
body.lite-mode .title-row .title-key,
body.lite-mode .title-cell:nth-child(n + 3) {
  border-color: rgba(14, 35, 64, 0.32);
}

body.lite-mode .dimension-track::before,
body.lite-mode .dimension-track::after,
body.lite-mode .door-track::before,
body.lite-mode .dimension-right .dimension-track-total,
body.lite-mode .dimension-bottom .dimension-track-total,
body.lite-mode .door-track-horizontal,
body.lite-mode .door-track-vertical {
  color: rgba(14, 35, 64, 0.78);
}

body.lite-mode .dimension-track::before,
body.lite-mode .dimension-track::after,
body.lite-mode .door-track::before {
  background: rgba(14, 35, 64, 0.78);
}

body.lite-mode .dimension-label,
body.lite-mode .door-label {
  background: #ffffff;
}

body.lite-mode .dimension-right .dimension-track-total {
  background:
    linear-gradient(
      90deg,
      transparent calc(50% - 7px),
      rgba(14, 35, 64, 0.78) calc(50% - 7px),
      rgba(14, 35, 64, 0.78) calc(50% + 7px),
      transparent calc(50% + 7px)
    ) top center / 100% 2px no-repeat,
    linear-gradient(
      90deg,
      transparent calc(50% - 7px),
      rgba(14, 35, 64, 0.78) calc(50% - 7px),
      rgba(14, 35, 64, 0.78) calc(50% + 7px),
      transparent calc(50% + 7px)
    ) bottom center / 100% 2px no-repeat,
    linear-gradient(
      90deg,
      transparent calc(50% - 1px),
      rgba(14, 35, 64, 0.78) calc(50% - 1px),
      rgba(14, 35, 64, 0.78) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

body.lite-mode .dimension-right .dimension-track-total::before {
  border-bottom-color: rgba(14, 35, 64, 0.78);
}

body.lite-mode .dimension-right .dimension-track-total::after {
  border-top-color: rgba(14, 35, 64, 0.78);
}

body.lite-mode .dimension-bottom .dimension-track-total {
  background:
    linear-gradient(
      180deg,
      transparent calc(50% - 7px),
      rgba(14, 35, 64, 0.78) calc(50% - 7px),
      rgba(14, 35, 64, 0.78) calc(50% + 7px),
      transparent calc(50% + 7px)
    ) left center / 2px 100% no-repeat,
    linear-gradient(
      180deg,
      transparent calc(50% - 7px),
      rgba(14, 35, 64, 0.78) calc(50% - 7px),
      rgba(14, 35, 64, 0.78) calc(50% + 7px),
      transparent calc(50% + 7px)
    ) right center / 2px 100% no-repeat,
    linear-gradient(
      180deg,
      transparent calc(50% - 1px),
      rgba(14, 35, 64, 0.78) calc(50% - 1px),
      rgba(14, 35, 64, 0.78) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

body.lite-mode .dimension-bottom .dimension-track-total::before {
  border-right-color: rgba(14, 35, 64, 0.78);
}

body.lite-mode .dimension-bottom .dimension-track-total::after {
  border-left-color: rgba(14, 35, 64, 0.78);
}

body.lite-mode .door-track-horizontal {
  background:
    linear-gradient(
      180deg,
      transparent calc(50% - 6px),
      rgba(14, 35, 64, 0.78) calc(50% - 6px),
      rgba(14, 35, 64, 0.78) calc(50% + 6px),
      transparent calc(50% + 6px)
    ) left center / 1px 100% no-repeat,
    linear-gradient(
      180deg,
      transparent calc(50% - 6px),
      rgba(14, 35, 64, 0.78) calc(50% - 6px),
      rgba(14, 35, 64, 0.78) calc(50% + 6px),
      transparent calc(50% + 6px)
    ) right center / 1px 100% no-repeat,
    linear-gradient(
      180deg,
      transparent calc(50% - 1px),
      rgba(14, 35, 64, 0.78) calc(50% - 1px),
      rgba(14, 35, 64, 0.78) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

body.lite-mode .door-track-vertical {
  background:
    linear-gradient(
      90deg,
      transparent calc(50% - 6px),
      rgba(14, 35, 64, 0.78) calc(50% - 6px),
      rgba(14, 35, 64, 0.78) calc(50% + 6px),
      transparent calc(50% + 6px)
    ) top center / 100% 1px no-repeat,
    linear-gradient(
      90deg,
      transparent calc(50% - 6px),
      rgba(14, 35, 64, 0.78) calc(50% - 6px),
      rgba(14, 35, 64, 0.78) calc(50% + 6px),
      transparent calc(50% + 6px)
    ) bottom center / 100% 1px no-repeat,
    linear-gradient(
      90deg,
      transparent calc(50% - 1px),
      rgba(14, 35, 64, 0.78) calc(50% - 1px),
      rgba(14, 35, 64, 0.78) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

body.lite-mode .wall-cut,
body.lite-mode .wall-cut-in {
  background: #ffffff;
  background-color: #ffffff;
}

body.lite-mode .wall-cut-top,
body.lite-mode .wall-cut-bottom {
  background-image: radial-gradient(circle, rgba(14, 35, 64, 0.52) 0 1px, transparent 1.3px);
}

body.lite-mode .wall-cut-left,
body.lite-mode .wall-cut-right {
  background-image: radial-gradient(circle, rgba(14, 35, 64, 0.52) 0 1px, transparent 1.3px);
}

body.lite-mode .wall-cut-in.wall-cut-top,
body.lite-mode .wall-cut-in.wall-cut-bottom,
body.lite-mode .wall-cut-out.wall-cut-top,
body.lite-mode .wall-cut-out.wall-cut-bottom {
  background-image:
    radial-gradient(circle, rgba(14, 35, 64, 0.3) 0 2.2px, transparent 3px),
    radial-gradient(circle, rgba(14, 35, 64, 0.72) 0 1px, transparent 1.3px);
  background-repeat: repeat-x, repeat-x;
  background-size: 8px 5px, 8px 3px;
  background-position: center center, center center;
}

body.lite-mode .wall-cut-in.wall-cut-left,
body.lite-mode .wall-cut-in.wall-cut-right,
body.lite-mode .wall-cut-out.wall-cut-left,
body.lite-mode .wall-cut-out.wall-cut-right {
  background-image:
    radial-gradient(circle, rgba(14, 35, 64, 0.3) 0 2.2px, transparent 3px),
    radial-gradient(circle, rgba(14, 35, 64, 0.72) 0 1px, transparent 1.3px);
  background-repeat: repeat-y, repeat-y;
  background-size: 5px 8px, 3px 8px;
  background-position: center center, center center;
}

body.lite-mode .wall-run,
body.lite-mode .wall-post {
  border-color: rgba(14, 35, 64, 0.72);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(102, 126, 158, 0.22) 0 1px,
      rgba(102, 126, 158, 0.22) 1px 1.5px,
      transparent 1.5px 5px
    ),
    #ffffff;
  box-shadow:
    inset 0 0 0 3px rgba(14, 35, 64, 0.05),
    0 0 6px rgba(14, 35, 64, 0.06);
}

body.lite-mode .wall-corner {
  border-color: rgba(14, 35, 64, 0.72);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(102, 126, 158, 0.18) 0 1px,
      transparent 1px 4px
    ),
    #ffffff;
  box-shadow:
    inset 0 0 0 3px rgba(14, 35, 64, 0.06),
    0 0 6px rgba(14, 35, 64, 0.08);
}

body.lite-mode .marker-in::after,
body.lite-mode .marker-out::after {
  border-color: transparent;
}

body.lite-mode .marker-in.marker-top::after,
body.lite-mode .marker-out.marker-bottom::after {
  border-top-color: rgba(14, 35, 64, 0.82);
}

body.lite-mode .marker-in.marker-left::after,
body.lite-mode .marker-out.marker-right::after {
  border-left-color: rgba(14, 35, 64, 0.82);
}

body.lite-mode .in-backing::before,
body.lite-mode .in-backing::after,
body.lite-mode .out-backing::before,
body.lite-mode .out-backing::after {
  background: rgba(14, 35, 64, 0.82);
  box-shadow: 0 0 4px rgba(14, 35, 64, 0.12);
}

body.lite-mode .door-track-horizontal .door-arrow-start {
  border-right-color: rgba(14, 35, 64, 0.78);
}

body.lite-mode .door-track-horizontal .door-arrow-end {
  border-left-color: rgba(14, 35, 64, 0.78);
}

body.lite-mode .door-track-vertical .door-arrow-start {
  border-bottom-color: rgba(14, 35, 64, 0.78);
}

body.lite-mode .door-track-vertical .door-arrow-end {
  border-top-color: rgba(14, 35, 64, 0.78);
}

body.lite-mode .cell {
  color: #0d2238;
  box-shadow:
    inset 0 0 0 1px rgba(14, 35, 64, 0.12),
    inset 0 0 14px rgba(14, 35, 64, 0.03);
}

body.lite-mode .cell-value {
  -webkit-text-stroke: var(--cell-value-stroke, 3.45px) #ffffff;
}

body.lite-mode .cell-loot-icon {
  filter:
    brightness(0)
    saturate(100%)
    invert(12%)
    sepia(29%)
    saturate(1180%)
    hue-rotate(181deg)
    brightness(91%)
    contrast(94%);
}

body.lite-mode .cell.current {
  z-index: 10;
  box-shadow: inset 0 0 0 2px rgba(14, 35, 64, 0.3), 0 0 18px rgba(78, 143, 224, 0.18);
}

body.lite-mode .path-line-halo,
body.lite-mode .path-line-core,
body.lite-mode .path-line-inner {
  mix-blend-mode: normal;
}

body.lite-mode .path-lines {
  opacity: 0.6;
}

body.lite-mode .path-line-halo {
  opacity: 0.1;
}

body.lite-mode .path-line-core {
  opacity: 0.1;
}

body.lite-mode .path-line-inner {
  opacity: 0.34;
}

body.lite-mode .path-line-halo.complete,
body.lite-mode .path-line-core.complete,
body.lite-mode .path-line-inner.complete {
  stroke: rgba(14, 35, 64, 0.86);
}

body.lite-mode .cell.valid-next:not(.current):not(.required-cell) {
  background: rgba(21, 145, 220, 0.12);
  border-color: rgba(78, 143, 224, 0.42);
}

body.lite-mode .cell.valid-next:not(.current):not(.required-cell)::before {
  box-shadow:
    inset 0 0 0 1px rgba(78, 143, 224, 0.14),
    inset 0 0 14px rgba(78, 143, 224, 0.05);
}

body.lite-mode .cell.required-cell:not(.required-met) {
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(204, 160, 0, 0.34) 0 1px,
      rgba(204, 160, 0, 0.34) 1px 1.5px,
      transparent 1.5px 5px
    ),
    rgba(216, 231, 234, 0.1);
  border-color: #CCA000;
  box-shadow:
    inset 0 0 0 1px rgba(216, 231, 234, 0.08);
}

body.lite-mode .cell.required-cell:not(.required-met) .cell-value {
  color: #d8e7ea;
  opacity: 1;
}

body.lite-mode .current-step-indicator.zero.complete {
  --indicator-ring: rgba(14, 35, 64, 0.88);
  background: rgba(14, 35, 64, 0.88);
  color: #ffffff;
  box-shadow:
    0 0 0 2px rgba(14, 35, 64, 0.88),
    0 0 14px rgba(14, 35, 64, 0.14),
    0 0 28px rgba(14, 35, 64, 0.1);
}

body.lite-mode .reset-action button,
body.lite-mode #new-puzzle,
body.lite-mode .actions button,
body.lite-mode .debug-panel {
  border-color: rgba(14, 35, 64, 0.18);
  background: rgba(232, 239, 247, 0.96);
  color: #153255;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

body.lite-mode .reset-action button:hover,
body.lite-mode .actions button:hover {
  background: rgba(220, 231, 243, 0.98);
  color: #0d2747;
}

body.lite-mode .message.win {
  color: #173255;
}

body.lite-mode .message.win::before {
  background: rgba(14, 35, 64, 0.86);
  color: #ffffff;
}

body.lite-mode .message strong {
  color: #0d2747;
}

* {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #0c2965 0%, #0c2965 100%);
  color: var(--ink);
  font-family: inherit;
}

body.lite-mode {
  --page: #ffffff;
  --panel: rgba(255, 255, 255, 0.96);
  --board: rgba(255, 255, 255, 0.9);
  --board-raised: rgba(245, 248, 252, 0.96);
  --ink: #0e2340;
  --muted: #486581;
  --line: rgba(14, 35, 64, 0.62);
  --soft-line: rgba(14, 35, 64, 0.18);
  --cell: rgba(224, 233, 243, 0.82);
  --cell-hover: rgba(214, 226, 241, 0.96);
  --accent: #4b8ee6;
  --accent-strong: #12345c;
  --path-blue-core: #4e8fe0;
  --path-blue-glow: #76aef4;
  --path: rgba(78, 143, 224, 0.2);
  --path-strong: rgba(78, 143, 224, 0.9);
  --accent-glow: rgba(78, 143, 224, 0.22);
  background: #ffffff;
  color: var(--ink);
}

body.lite-mode .board-wrap.is-loading::after {
  color: rgba(14, 35, 64, 0.92);
}

body.app-loading .message,
body.app-loading .reset-action,
body.app-loading .plan-header,
body.app-loading .mission-note,
body.app-loading .actions,
body.app-loading .debug-panel {
  display: none;
}

body.app-loading .board-wrap {
  margin-bottom: 10px;
}

body.app-loading .footer-text {
  margin-top: 0;
}

body.lite-mode .masthead-logo {
  filter: none;
}

body.lite-mode .mission-note .mission-subline,
body.lite-mode .footer-text,
body.lite-mode .debug-control,
body.lite-mode .debug-panel,
body.lite-mode .debug-panel strong,
body.lite-mode .debug-panel pre,
body.lite-mode .title-key,
body.lite-mode .title-value,
body.lite-mode .marker,
body.lite-mode .marker-in,
body.lite-mode .marker-out,
body.lite-mode .dimension-stack,
body.lite-mode .door-dimension {
  color: var(--ink);
  text-shadow: none;
}

body.lite-mode .footer-text a {
  color: #173f73;
  text-decoration-color: rgba(23, 63, 115, 0.45);
}

body.lite-mode .footer-text a:hover {
  color: #0d2747;
  text-decoration-color: rgba(13, 39, 71, 0.8);
}

button,
input {
  font: inherit;
}

.app {
  width: min(100% - 48px, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 0 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.masthead {
  width: 100%;
  display: flex;
  justify-content: center;
  text-align: center;
  margin-bottom: 2px;
}

.masthead-logo {
  display: block;
  width: min(100%, 390px);
  height: auto;
  margin: 0 auto;
}

.plan-header {
  width: min(100%, 560px);
}

.mission-note {
  width: min(100%, 560px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  text-align: center;
}

.mission-note .mission-subline {
  margin: 0;
  max-width: 34rem;
  color: #f8fdff;
  font-size: 0.86rem;
  line-height: 1.45;
  letter-spacing: 0.02em;
  white-space: pre-line;
}

.instruction-gold {
  color: #CCA000;
}

.board-wrap {
  --board-border: 0px;
  --board-padding: 19px;
  --board-gap: 10px;
  --tab-height: 39px;
  --tab-overlap: 13px;
  --tab-reveal: var(--tab-height);
  --dimension-gap: 24px;
  --dimension-right-width: 52px;
  --dimension-bottom-height: 32px;
  --door-dimension-size: 42px;
  --board-side-left: 0px;
  --board-side-right: 0px;
  --board-side-top: 0px;
  --board-side-bottom: 0px;
  --board-bottom-clearance: calc(var(--dimension-gap) + var(--dimension-bottom-height));
  position: relative;
  width: min(100%, var(--board-wrap-width, 560px));
  padding:
    calc(var(--tab-reveal) + var(--board-side-top))
    calc(var(--tab-reveal) + var(--board-side-right))
    calc(var(--tab-reveal) + var(--board-side-bottom))
    calc(var(--tab-reveal) + var(--board-side-left));
  overflow: visible;
  margin: 6px 0 var(--board-bottom-clearance);
}

.board-wrap.is-loading {
  min-height: min(72vw, 560px);
}

.board-wrap.is-loading::after {
  content: attr(data-loading-text);
  position: absolute;
  inset: calc(var(--tab-reveal) + 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: min(100% - 32px, 34rem);
  height: fit-content;
  margin: auto;
  padding: 14px 24px;
  color: rgba(255, 255, 255, 0.84);
  text-align: center;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  line-height: 1.4;
  letter-spacing: 0.02em;
  z-index: 20;
}

.board-wrap.is-loading .grid,
.board-wrap.is-loading .marker-row,
.board-wrap.is-loading .dimension-stack,
.board-wrap.is-loading .door-dimension {
  visibility: hidden;
}

.board-wrap.board-wrap-shake {
  animation: board-wrap-shake 220ms ease;
}

.board-wrap.board-wrap-celebrate {
  animation: board-wrap-celebrate 420ms ease-out;
}

.particle-burst {
  position: absolute;
  z-index: 12;
  width: 0;
  height: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--particle-size);
  height: var(--particle-size);
  margin-left: calc(var(--particle-size) / -2);
  margin-top: calc(var(--particle-size) / -2);
  border-radius: 50%;
  background: rgba(248, 253, 255, 0.96);
  box-shadow:
    0 0 10px rgba(248, 253, 255, 0.58),
    0 0 20px rgba(248, 253, 255, 0.2);
  animation: particle-burst var(--particle-duration) ease-out forwards;
  will-change: transform, opacity;
}

body.lite-mode .particle {
  background: rgba(14, 35, 64, 0.92);
  box-shadow:
    0 0 10px rgba(14, 35, 64, 0.24),
    0 0 20px rgba(14, 35, 64, 0.1);
}

@keyframes particle-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(0.4);
  }

  70% {
    opacity: 0.88;
    transform: translate(var(--dx), var(--dy)) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(calc(var(--dx) * 1.14), calc(var(--dy) * 1.14)) scale(0.2);
  }
}

@keyframes board-wrap-shake {
  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-7px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(3px);
  }
}

@keyframes board-wrap-celebrate {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  18% {
    transform: translate3d(0, -14px, 0) scale(1.01);
  }

  36% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  56% {
    transform: translate3d(0, -8px, 0) scale(1.006);
  }

  74% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.footer-text {
  margin: 18px 0 0;
  max-width: 36rem;
  color: color-mix(in srgb, var(--path-blue-core) 82%, white);
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.45;
  letter-spacing: 0.02em;
  white-space: pre-line;
}

.footer-text a {
  color: #ecf8ff;
  text-decoration-color: rgba(236, 248, 255, 0.5);
  text-underline-offset: 0.14em;
}

.footer-text a:hover {
  color: #ffffff;
  text-decoration-color: rgba(255, 255, 255, 0.8);
}

.board-wrap::before {
  content: none;
  position: absolute;
  inset: calc(var(--tab-reveal) - 10px);
  border: 14px solid transparent;
  border-image: repeating-linear-gradient(
      -45deg,
      rgba(226, 246, 255, 0.6) 0 1px,
      rgba(226, 246, 255, 0.14) 1px 4px,
      transparent 4px 7px
    )
    14;
  box-shadow:
    inset 0 0 0 2px rgba(226, 246, 255, 0.86),
    0 0 0 2px rgba(226, 246, 255, 0.86),
    0 0 26px rgba(82, 156, 255, 0.12);
  pointer-events: none;
  z-index: 1;
}

.board-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dimension-stack,
.door-dimension {
  position: absolute;
  color: rgba(236, 248, 255, 0.94);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-shadow: 0 0 8px rgba(82, 156, 255, 0.24);
  pointer-events: none;
  z-index: 0;
}

.dimension-right {
  top: calc(var(--tab-reveal) + 6px);
  left: calc(100% + var(--dimension-gap));
  width: var(--dimension-right-width);
  height: calc(100% - (var(--tab-reveal) * 2) - 6px);
}

.dimension-bottom {
  left: calc(var(--tab-reveal) + 6px);
  right: calc(var(--tab-reveal) + 6px);
  top: calc(100% + var(--dimension-gap));
  height: var(--dimension-bottom-height);
}

.dimension-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dimension-track::before,
.dimension-track::after {
  content: "";
  position: absolute;
  background: rgba(236, 248, 255, 0.95);
}

.dimension-right .dimension-track::before,
.dimension-right .dimension-track::after {
  left: 50%;
  width: 2px;
  height: 14px;
  transform: translateX(-50%);
}

.dimension-right .dimension-track::before {
  top: 0;
  transform: translate(-50%, -50%);
}

.dimension-right .dimension-track::after {
  bottom: 0;
  transform: translate(-50%, 50%);
}

.dimension-bottom .dimension-track::before,
.dimension-bottom .dimension-track::after {
  top: 50%;
  width: 14px;
  height: 2px;
  transform: translateY(-50%);
}

.dimension-bottom .dimension-track::before {
  left: 0;
  transform: translate(-50%, -50%);
}

.dimension-bottom .dimension-track::after {
  right: 0;
  transform: translate(50%, -50%);
}

.door-track::before {
  content: "";
  position: absolute;
  background: rgba(236, 248, 255, 0.95);
}

.dimension-track-total,
.door-track {
  overflow: visible;
}

.dimension-label,
.door-label {
  position: relative;
  z-index: 1;
  background: var(--page);
  padding: 0 6px;
}

.dimension-label-total {
  font-size: 1rem;
}

.dimension-right .dimension-track-total {
  background:
    linear-gradient(
      90deg,
      transparent calc(50% - 7px),
      rgba(236, 248, 255, 0.95) calc(50% - 7px),
      rgba(236, 248, 255, 0.95) calc(50% + 7px),
      transparent calc(50% + 7px)
    ) top center / 100% 2px no-repeat,
    linear-gradient(
      90deg,
      transparent calc(50% - 7px),
      rgba(236, 248, 255, 0.95) calc(50% - 7px),
      rgba(236, 248, 255, 0.95) calc(50% + 7px),
      transparent calc(50% + 7px)
    ) bottom center / 100% 2px no-repeat,
    linear-gradient(
      90deg,
      transparent calc(50% - 1px),
      rgba(236, 248, 255, 0.95) calc(50% - 1px),
      rgba(236, 248, 255, 0.95) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

.dimension-right .dimension-track-total::before,
.dimension-right .dimension-track-total::after {
  left: 50%;
  width: 0;
  height: 0;
  background: transparent;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.dimension-right .dimension-track-total::before {
  top: -1px;
  transform: translateX(-50%);
  border-bottom: 10px solid rgba(236, 248, 255, 0.95);
}

.dimension-right .dimension-track-total::after {
  bottom: -1px;
  transform: translateX(-50%);
  border-top: 10px solid rgba(236, 248, 255, 0.95);
}

.dimension-bottom .dimension-track-total {
  background:
    linear-gradient(
      180deg,
      transparent calc(50% - 7px),
      rgba(236, 248, 255, 0.95) calc(50% - 7px),
      rgba(236, 248, 255, 0.95) calc(50% + 7px),
      transparent calc(50% + 7px)
    ) left center / 2px 100% no-repeat,
    linear-gradient(
      180deg,
      transparent calc(50% - 7px),
      rgba(236, 248, 255, 0.95) calc(50% - 7px),
      rgba(236, 248, 255, 0.95) calc(50% + 7px),
      transparent calc(50% + 7px)
    ) right center / 2px 100% no-repeat,
    linear-gradient(
      180deg,
      transparent calc(50% - 1px),
      rgba(236, 248, 255, 0.95) calc(50% - 1px),
      rgba(236, 248, 255, 0.95) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

.dimension-bottom .dimension-track-total::before,
.dimension-bottom .dimension-track-total::after {
  top: 50%;
  width: 0;
  height: 0;
  background: transparent;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.dimension-bottom .dimension-track-total::before {
  left: -1px;
  transform: translateY(-50%);
  border-right: 10px solid rgba(236, 248, 255, 0.95);
}

.dimension-bottom .dimension-track-total::after {
  right: -1px;
  transform: translateY(-50%);
  border-left: 10px solid rgba(236, 248, 255, 0.95);
}

.dimension-right .dimension-label,
.door-dimension-right .door-label,
.door-dimension-left .door-label {
  transform: rotate(90deg);
}

.door-dimension {
  display: none;
}

.door-dimension-top,
.door-dimension-bottom {
  left: calc(var(--tab-reveal) + 6px);
  height: 42px;
  width: 120px;
}

.door-dimension-top {
  top: calc(var(--tab-reveal) - 64px);
}

.door-dimension-bottom {
  top: calc(100% + var(--dimension-gap) + var(--dimension-bottom-height) + var(--dimension-gap));
}

.door-dimension-right,
.door-dimension-left {
  width: var(--door-dimension-size);
  height: 120px;
}

.door-dimension-right {
  left: calc(100% + var(--dimension-gap) + var(--dimension-right-width) + var(--dimension-gap));
}

.door-dimension-left {
  left: calc(var(--tab-reveal) - 62px);
}

.door-track {
  position: relative;
  width: 42px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.door-track-horizontal {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(
      180deg,
      transparent calc(50% - 6px),
      rgba(236, 248, 255, 0.95) calc(50% - 6px),
      rgba(236, 248, 255, 0.95) calc(50% + 6px),
      transparent calc(50% + 6px)
    ) left center / 1px 100% no-repeat,
    linear-gradient(
      180deg,
      transparent calc(50% - 6px),
      rgba(236, 248, 255, 0.95) calc(50% - 6px),
      rgba(236, 248, 255, 0.95) calc(50% + 6px),
      transparent calc(50% + 6px)
    ) right center / 1px 100% no-repeat,
    linear-gradient(
      180deg,
      transparent calc(50% - 1px),
      rgba(236, 248, 255, 0.95) calc(50% - 1px),
      rgba(236, 248, 255, 0.95) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

.door-track-horizontal::before,
.door-track-horizontal::after {
  content: "";
  position: absolute;
}

.door-track-vertical {
  width: 100%;
  background:
    linear-gradient(
      90deg,
      transparent calc(50% - 6px),
      rgba(236, 248, 255, 0.95) calc(50% - 6px),
      rgba(236, 248, 255, 0.95) calc(50% + 6px),
      transparent calc(50% + 6px)
    ) top center / 100% 1px no-repeat,
    linear-gradient(
      90deg,
      transparent calc(50% - 6px),
      rgba(236, 248, 255, 0.95) calc(50% - 6px),
      rgba(236, 248, 255, 0.95) calc(50% + 6px),
      transparent calc(50% + 6px)
    ) bottom center / 100% 1px no-repeat,
    linear-gradient(
      90deg,
      transparent calc(50% - 1px),
      rgba(236, 248, 255, 0.95) calc(50% - 1px),
      rgba(236, 248, 255, 0.95) calc(50% + 1px),
      transparent calc(50% + 1px)
    );
}

.door-track::after,
.door-track > .door-arrow-start,
.door-track > .door-arrow-end {
  content: "";
  position: absolute;
}

.door-track-horizontal .door-arrow-start,
.door-track-horizontal .door-arrow-end {
  top: 50%;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.door-track-horizontal .door-arrow-start {
  left: -1px;
  transform: translateY(-50%);
  border-right: 10px solid rgba(236, 248, 255, 0.95);
}

.door-track-horizontal .door-arrow-end {
  right: -1px;
  transform: translateY(-50%);
  border-left: 10px solid rgba(236, 248, 255, 0.95);
}

.door-track-vertical .door-arrow-start,
.door-track-vertical .door-arrow-end {
  left: 50%;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.door-track-vertical .door-arrow-start {
  top: -1px;
  transform: translateX(-50%);
  border-bottom: 10px solid rgba(236, 248, 255, 0.95);
}

.door-track-vertical .door-arrow-end {
  bottom: -1px;
  transform: translateX(-50%);
  border-top: 10px solid rgba(236, 248, 255, 0.95);
}

.title-block {
  width: min(100%, 480px);
  border: 2px solid rgba(236, 248, 255, 0.92);
  background: transparent;
}

.title-block-top {
  width: 100%;
}

.title-row,
.title-grid {
  display: grid;
}

.title-row {
  grid-template-columns: 94px 1fr;
}

.title-row + .title-row,
.title-grid {
  border-top: 1px solid rgba(236, 248, 255, 0.82);
}

.title-grid {
  grid-template-columns: 0.9fr 1.1fr;
}

.title-cell {
  display: grid;
  grid-template-columns: 94px 1fr;
}

.title-cell-compact {
  grid-template-columns: 76px 1fr;
}

.title-cell-wide {
  grid-template-columns: 88px 1fr;
}

.title-cell:nth-child(odd),
.title-row .title-key {
  border-right: 1px solid rgba(236, 248, 255, 0.82);
}

.title-cell:nth-child(n + 3) {
  border-top: 1px solid rgba(236, 248, 255, 0.82);
}

.title-key,
.title-value {
  padding: 10px 12px;
  color: rgba(236, 248, 255, 0.95);
  font-size: 0.84rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.title-cell-wide .title-value {
  white-space: nowrap;
}

.marker-row {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.marker {
  position: absolute;
  height: var(--tab-height);
  min-height: var(--tab-height);
  border: 0;
  outline: 0;
  border-radius: 0;
  background: transparent;
  color: #c8d2eb;
  text-align: center;
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: none;
  text-transform: uppercase;
  text-shadow: none;
}

.marker-in,
.marker-out {
  z-index: 8;
  background: transparent;
  color: #ecf8ff;
  text-shadow: 0 0 10px rgba(82, 156, 255, 0.36);
}

.marker-out {
  pointer-events: auto;
  cursor: pointer;
}

.marker-in::after,
.marker-out::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 0;
}

.marker-in.marker-top::after {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid rgba(236, 248, 255, 0.9);
}

.marker-out.marker-bottom::after {
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid rgba(236, 248, 255, 0.9);
}

.marker-in.marker-left::after {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid rgba(236, 248, 255, 0.9);
}

.marker-out.marker-right::after {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid rgba(236, 248, 255, 0.9);
}

.marker-left,
.marker-right {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.marker-left {
  transform: none;
}

.grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--board-gap);
  padding: var(--board-padding);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  touch-action: auto;
}

.cell-void {
  min-width: 0;
  width: 100%;
  aspect-ratio: 1;
  pointer-events: none;
}

.path-lines {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: visible;
  pointer-events: none;
  isolation: isolate;
}

.path-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.path-line-halo {
  stroke-width: var(--path-line-halo-width, 28);
  opacity: 0.15;
  filter: blur(var(--path-line-halo-blur, 7px));
  mix-blend-mode: screen;
}

.path-line-core {
  stroke-width: var(--path-line-core-width, 14);
  opacity: 0.15;
  filter: blur(var(--path-line-core-blur, 2px));
  mix-blend-mode: screen;
}

.path-line-inner {
  stroke-width: var(--path-line-inner-width, 6);
  opacity: 0.5;
}

.path-lines-complete .path-line-halo {
  animation: path-line-halo-complete var(--solve-step-duration, 520ms) ease both;
  animation-delay: var(--segment-delay, 0ms);
}

.path-lines-complete .path-line-core {
  animation: path-line-core-complete var(--solve-step-duration, 520ms) ease both;
  animation-delay: var(--segment-delay, 0ms);
}

.path-lines-complete .path-line-inner {
  animation: path-line-inner-complete var(--solve-step-duration, 520ms) ease both;
  animation-delay: var(--segment-delay, 0ms);
}

.path-line-halo.add,
.path-line-core.add {
  stroke: var(--path-blue-glow);
}

.path-line-inner.add {
  stroke: var(--path-blue-core);
}

.path-line-halo.subtract,
.path-line-core.subtract {
  stroke: var(--path-red-glow);
}

.path-line-inner.subtract {
  stroke: var(--path-red-core);
}

.path-line-halo.complete,
.path-line-core.complete {
  stroke: #f8fdff;
}

.path-line-inner.complete {
  stroke: #f8fdff;
}

@keyframes path-line-halo-complete {
  0%,
  18% {
    opacity: 0.15;
  }

  55%,
  100% {
    opacity: 0.32;
  }
}

@keyframes path-line-core-complete {
  0%,
  18% {
    opacity: 0.15;
  }

  55%,
  100% {
    opacity: 0.62;
  }
}

@keyframes path-line-inner-complete {
  0%,
  18% {
    opacity: 0.5;
  }

  55%,
  100% {
    opacity: 0.9;
  }
}

.in-backing,
.out-backing {
  position: absolute;
  z-index: -2;
  background: transparent;
  border: 0;
  border-radius: 0;
  pointer-events: none;
}

.wall-cut {
  position: absolute;
  z-index: -2;
  background: var(--page);
  background-repeat: no-repeat;
  pointer-events: none;
}

.wall-cut-in {
  background-color: var(--page);
  box-shadow: none;
}

.wall-cut-top,
.wall-cut-bottom {
  background-image: radial-gradient(circle, rgba(236, 248, 255, 0.62) 0 1px, transparent 1.3px);
  background-repeat: repeat-x;
  background-size: 8px 3px;
  background-position: center center;
}

.wall-cut-left,
.wall-cut-right {
  background-image: radial-gradient(circle, rgba(236, 248, 255, 0.62) 0 1px, transparent 1.3px);
  background-repeat: repeat-y;
  background-size: 3px 8px;
  background-position: center center;
}

.wall-cut-in.wall-cut-top,
.wall-cut-in.wall-cut-bottom {
  background-image:
    radial-gradient(circle, rgba(47, 134, 240, 0.34) 0 2.2px, transparent 3px),
    radial-gradient(circle, rgba(102, 180, 255, 0.92) 0 1px, transparent 1.3px);
  background-repeat: repeat-x, repeat-x;
  background-size: 8px 5px, 8px 3px;
  background-position: center center, center center;
}

.wall-cut-in.wall-cut-left,
.wall-cut-in.wall-cut-right {
  background-image:
    radial-gradient(circle, rgba(47, 134, 240, 0.34) 0 2.2px, transparent 3px),
    radial-gradient(circle, rgba(102, 180, 255, 0.92) 0 1px, transparent 1.3px);
  background-repeat: repeat-y, repeat-y;
  background-size: 5px 8px, 3px 8px;
  background-position: center center, center center;
}

.wall-cut-out.wall-cut-top,
.wall-cut-out.wall-cut-bottom {
  background-image:
    radial-gradient(circle, rgba(47, 134, 240, 0.34) 0 2.2px, transparent 3px),
    radial-gradient(circle, rgba(102, 180, 255, 0.92) 0 1px, transparent 1.3px);
  background-repeat: repeat-x, repeat-x;
  background-size: 8px 5px, 8px 3px;
  background-position: center center, center center;
}

.wall-cut-out.wall-cut-left,
.wall-cut-out.wall-cut-right {
  background-image:
    radial-gradient(circle, rgba(47, 134, 240, 0.34) 0 2.2px, transparent 3px),
    radial-gradient(circle, rgba(102, 180, 255, 0.92) 0 1px, transparent 1.3px);
  background-repeat: repeat-y, repeat-y;
  background-size: 5px 8px, 3px 8px;
  background-position: center center, center center;
}

.wall-corner {
  position: absolute;
  z-index: -2;
  width: 30px;
  height: 30px;
  border: 1.5px solid rgba(236, 248, 255, 0.95);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(218, 228, 242, 0.28) 0 1px,
      transparent 1px 4px
    ),
    #05263f;
  box-shadow:
    inset 0 0 0 4px rgba(4, 35, 58, 0.7),
    0 0 10px rgba(82, 156, 255, 0.16);
  pointer-events: none;
}

.wall-corner-tl {
  left: -22px;
  top: -22px;
}

.wall-corner-tr {
  right: -22px;
  top: -22px;
}

.wall-corner-br {
  right: -22px;
  bottom: -22px;
}

.wall-corner-bl {
  left: -22px;
  bottom: -22px;
}

.in-backing::before,
.in-backing::after,
.out-backing::before,
.out-backing::after {
  content: "";
  position: absolute;
  background: rgba(236, 248, 255, 0.95);
  box-shadow: 0 0 8px rgba(126, 218, 255, 0.22);
}

.wall-layer {
  position: absolute;
  inset: 0;
  z-index: -3;
  pointer-events: none;
}

.wall-run,
.wall-post {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px solid rgba(236, 248, 255, 0.95);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(198, 216, 238, 0.42) 0 1px,
      rgba(198, 216, 238, 0.42) 1px 1.5px,
      transparent 1.5px 5px
    ),
    var(--page);
  box-shadow:
    inset 0 0 0 4px rgba(7, 39, 65, 0.16),
    0 0 10px rgba(82, 156, 255, 0.14);
}

.wall-run {
  z-index: -2;
}

.wall-post {
  z-index: -1;
}

.in-backing::before,
.in-backing::after,
.out-backing::before,
.out-backing::after {
  width: 4px;
  height: 100%;
}

.in-backing::before,
.out-backing::before {
  left: 0;
  top: 0;
}

.in-backing::after,
.out-backing::after {
  right: 0;
  top: 0;
}

.doorway-left::before,
.doorway-left::after,
.doorway-right::before,
.doorway-right::after {
  width: 100%;
  height: 4px;
}

.doorway-left::before,
.doorway-right::before {
  left: 0;
  top: 0;
}

.doorway-left::after,
.doorway-right::after {
  left: 0;
  right: auto;
  top: auto;
  bottom: 0;
}

.cell {
  position: relative;
  z-index: auto;
  min-width: 0;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid transparent;
  outline: 0;
  border-radius: 0;
  padding: 0;
  background: var(--cell);
  color: #eaf8ff;
  cursor: pointer;
  font-size: calc(var(--cell-size, 72px) * 0.39);
  font-weight: 220;
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 0 0 1px rgba(226, 246, 255, 0.18),
    inset 0 0 18px rgba(126, 218, 255, 0.04);
  text-shadow: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, color 140ms ease;
  user-select: none;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.cell-value {
  position: relative;
  z-index: 20;
  -webkit-text-stroke: var(--cell-value-stroke, 3.45px) var(--page);
  paint-order: stroke fill;
  transition: transform 220ms ease, font-size 220ms ease;
}

.cell-value-loot {
  position: absolute;
  inset: 5%;
  z-index: 20;
  -webkit-text-stroke: 0 transparent;
  pointer-events: none;
}

.cell-loot-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 10px rgba(82, 156, 255, 0.12));
  pointer-events: none;
}

.cell::before {
  content: none;
  position: absolute;
  inset: 22%;
  pointer-events: none;
}

.cell::after {
  content: none;
  position: absolute;
  inset: 50% 8px auto;
  border-top: 1px dashed rgba(226, 246, 255, 0.18);
  pointer-events: none;
}

.cell-value::before,
.cell-value::after {
  content: none;
  position: absolute;
  background: rgba(226, 246, 255, 0.34);
  pointer-events: none;
}

.cell-value::before {
  left: 50%;
  top: -0.55em;
  width: 1px;
  height: 0.24em;
}

.cell-value::after {
  left: -0.55em;
  top: 50%;
  width: 0.24em;
  height: 1px;
}

.cell:hover:not(:disabled) {
  background: var(--cell-hover);
  transform: translateY(-1px);
}

.cell.valid-next:not(.current):not(.required-cell) {
  background: rgba(21, 145, 220, 0.2);
  border-color: transparent;
  border-style: solid;
}

.cell.valid-next:not(.current):not(.required-cell) {
  box-shadow:
    inset 0 0 0 1px rgba(21, 145, 220, 0.22),
    inset 0 0 18px rgba(21, 145, 220, 0.12);
}

.cell:not(.valid-next):not(.current):not(.required-cell) {
  background: var(--cell);
}

.cell:not(.valid-next):not(.current):not(.required-cell) .cell-value {
  opacity: 0.3;
}

.cell:disabled {
  cursor: default;
}

.cell:focus-visible,
.actions button:focus-visible,
.debug-control input:focus-visible {
  outline: 2px solid rgba(184, 198, 243, 0.82);
  outline-offset: 3px;
}

.cell.current {
  z-index: 10;
  box-shadow: inset 0 0 0 2px rgba(226, 246, 255, 0.8), 0 0 22px rgba(82, 156, 255, 0.28);
}

.cell.flip-solve {
  animation-duration: 520ms;
  animation-timing-function: ease-in-out;
  animation-fill-mode: both;
  background: var(--solve-fill-final, rgba(248, 253, 255, 0.2));
  box-shadow:
    inset 0 0 0 1px rgba(248, 253, 255, 0.48),
    inset 0 0 18px rgba(248, 253, 255, 0.08),
    0 0 14px rgba(248, 253, 255, 0.1);
}

.cell.flip-solve .cell-value {
  color: #000000;
  opacity: 1 !important;
  -webkit-text-stroke: 0 transparent;
  text-shadow: none;
  filter: none;
}

.cell.flip-solve.flip-east {
  animation-name: tile-complete-pulse;
}

.cell.flip-solve.flip-west {
  animation-name: tile-complete-pulse;
}

.cell.flip-solve.flip-north {
  animation-name: tile-complete-pulse;
}

.cell.flip-solve.flip-south {
  animation-name: tile-complete-pulse;
}

.cell.current .cell-value {
  z-index: 8;
  opacity: 1;
  transform: none;
}

.current-step-indicator {
  --indicator-ring: #f8fdff;
  position: absolute;
  width: 64.4%;
  height: 64.4%;
  left: 50%;
  top: 50%;
  transform: translate(var(--indicator-translate-x, -50%), var(--indicator-translate-y, -50%));
  z-index: 9;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(248, 253, 255, 0.7);
  color: #0a2f4a;
  font-size: clamp(0.92rem, 2.55vw, 1.08rem);
  font-weight: 750;
  line-height: 1;
  text-shadow: none;
  -webkit-text-stroke: var(--indicator-text-stroke, 2.6px) var(--indicator-ring);
  paint-order: stroke fill;
  box-shadow:
    0 0 0 2px #f8fdff,
    0 0 18px rgba(248, 253, 255, 0.38),
    0 0 42px rgba(248, 253, 255, 0.24);
  animation: current-indicator-pulse 1800ms ease-in-out infinite;
  pointer-events: none;
}

.current-step-value {
  position: relative;
  z-index: 10;
}

.current-step-loot-icon {
  position: absolute;
  inset: 18%;
  z-index: 9;
  opacity: 0.88;
}

.current-step-indicator.celebrate {
  animation: current-indicator-celebrate 260ms ease-in-out 1 both;
}

.current-step-indicator.positive {
  --indicator-ring: var(--path-blue-core);
  background: color-mix(in srgb, var(--path-blue-core) 70%, transparent);
  color: #083248;
  box-shadow:
    0 0 0 2px var(--path-blue-core),
    0 0 20px color-mix(in srgb, var(--path-blue-glow) 58%, transparent),
    0 0 46px color-mix(in srgb, var(--path-blue-glow) 34%, transparent);
}

.current-step-indicator.negative {
  --indicator-ring: var(--path-red-core);
  background: color-mix(in srgb, var(--path-red-core) 70%, transparent);
  color: #ffffff;
  box-shadow:
    0 0 0 2px var(--path-red-core),
    0 0 20px color-mix(in srgb, var(--path-red-glow) 58%, transparent),
    0 0 46px color-mix(in srgb, var(--path-red-glow) 34%, transparent);
}

.current-step-indicator.zero {
  background: rgba(248, 253, 255, 0.7);
  color: #0a2f4a;
  box-shadow:
    0 0 0 2px #f8fdff,
    0 0 18px rgba(248, 253, 255, 0.38),
    0 0 42px rgba(248, 253, 255, 0.24);
}

.current-step-indicator.zero.complete {
  background: #f8fdff;
}

body.lite-mode .current-step-indicator.zero.complete {
  --indicator-ring: rgba(14, 35, 64, 0.88);
  background: rgba(14, 35, 64, 0.88) !important;
  color: #ffffff !important;
  box-shadow:
    0 0 0 2px rgba(14, 35, 64, 0.88),
    0 0 14px rgba(14, 35, 64, 0.14),
    0 0 28px rgba(14, 35, 64, 0.1) !important;
}

body.lite-mode .path-line-halo.complete,
body.lite-mode .path-line-core.complete,
body.lite-mode .path-line-inner.complete {
  stroke: rgba(14, 35, 64, 0.86) !important;
}

@keyframes current-indicator-pulse {
  0%,
  100% {
    transform: translate(var(--indicator-translate-x, -50%), var(--indicator-translate-y, -50%)) scale(1);
    border-radius: 50%;
  }

  50% {
    transform: translate(var(--indicator-translate-x, -50%), var(--indicator-translate-y, -50%)) scale(1.08, 1.03);
    border-radius: 46%;
  }
}

@keyframes current-indicator-celebrate {
  0% {
    transform: translate(var(--indicator-translate-x, -50%), var(--indicator-translate-y, -50%)) scale(1);
    border-radius: 50%;
  }

  45% {
    transform: translate(var(--indicator-translate-x, -50%), var(--indicator-translate-y, -50%)) scale(1.22, 1.12);
    border-radius: 42%;
  }

  100% {
    transform: translate(var(--indicator-translate-x, -50%), var(--indicator-translate-y, -50%)) scale(1);
    border-radius: 50%;
  }
}

@keyframes tile-complete-pulse {
  0% {
    transform: scale(1);
    background: var(--path);
  }

  20% {
    transform: scale(0.9);
    background: var(--solve-fill-low, rgba(248, 253, 255, 0.2));
  }

  50% {
    transform: scale(1.16);
    background: var(--solve-fill-mid, rgba(248, 253, 255, 0.2));
  }

  80% {
    transform: scale(0.97);
    background: var(--solve-fill-final, rgba(248, 253, 255, 0.2));
  }

  100% {
    transform: scale(1);
    background: var(--solve-fill-final, rgba(248, 253, 255, 0.2));
  }
}

.cell.required-cell:not(.required-met) {
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(204, 160, 0, 0.34) 0 1px,
      rgba(204, 160, 0, 0.34) 1px 1.5px,
      transparent 1.5px 5px
    ),
    rgba(0, 0, 0, 0.1);
  border-color: #CCA000;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.cell.required-cell:not(.required-met) .cell-value {
  opacity: 1;
}

.cell.required-cell.required-met {
  color: #fff8e7;
}

.cell.required-cell.required-met::before {
  background: rgba(242, 207, 114, 0.24);
  border-color: rgba(242, 207, 114, 0.96);
  box-shadow:
    inset 0 0 0 1px rgba(242, 207, 114, 0.52),
    inset 0 0 26px rgba(242, 207, 114, 0.16),
    0 0 18px rgba(242, 207, 114, 0.16);
}

.cell.visited {
  color: #f0fbff;
}

.cell.visited::before {
  background: var(--path);
  color: #f0fbff;
  box-shadow: inset 0 0 0 1px rgba(226, 246, 255, 0.62), 0 0 20px rgba(82, 156, 255, 0.24);
}

.path-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(10px, calc(var(--cell-size, 72px) * 0.18), 17px);
  height: clamp(10px, calc(var(--cell-size, 72px) * 0.18), 17px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(226, 246, 255, 0.86);
  box-shadow: 0 0 12px rgba(82, 156, 255, 0.28);
  z-index: -1;
}

body.lite-mode .path-badge {
  opacity: 0.74;
}

.path-badge.add {
  background: var(--path-blue-core);
  border-color: var(--path-blue-core);
  color: #083248;
  box-shadow: 0 0 10px color-mix(in srgb, var(--path-blue-glow) 40%, transparent);
}

.path-badge.subtract {
  background: var(--path-red-core);
  border-color: var(--path-red-core);
  color: #3f0c17;
  box-shadow: 0 0 10px color-mix(in srgb, var(--path-red-glow) 40%, transparent);
}

.cell.invalid {
  animation: bump 220ms ease;
}

.cell.invalid::before {
  border-color: rgba(199, 121, 111, 0.78);
  box-shadow: 0 0 0 1px rgba(199, 121, 111, 0.42), 0 0 22px rgba(199, 121, 111, 0.18);
}

.message {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.55;
}

.message:empty {
  display: none;
}

.message.win {
  color: #d9f2ff;
  text-shadow: none;
}

.message.win + .reset-action {
  margin-top: 10px;
}

.message.win::before {
  content: "✓";
  width: 19px;
  height: 19px;
  margin-right: 9px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--page);
  display: inline-grid;
  place-items: center;
  font-size: 0.78rem;
  vertical-align: -2px;
}

.message strong {
  color: #edf2ff;
  font-weight: 700;
}

.message.win .streak-line {
  color: color-mix(in srgb, var(--path-blue-core) 82%, white);
}

.reset-action {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 8px;
  margin-bottom: 8px;
}

.reset-action button {
  border: 1px solid var(--soft-line);
  border-radius: 0;
  background: #ffffff;
  color: var(--page);
  min-width: 88px;
  padding: 13px 14px;
  font-weight: 450;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.reset-action button:hover {
  background: rgba(255, 255, 255, 0.92);
  color: var(--page);
  transform: translateY(-1px);
}

.reset-action button::before {
  display: inline-block;
  margin-right: 8px;
  color: inherit;
  content: "↻";
}

.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  width: 100%;
}

.actions button {
  border: 1px solid var(--soft-line);
  border-radius: 0;
  background: rgba(12, 41, 101, 0.34);
  color: #cde9f8;
  min-width: 88px;
  padding: 13px 14px;
  font-weight: 450;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.actions button:hover {
  background: rgba(12, 41, 101, 0.5);
  color: #f0f4ff;
  transform: translateY(-1px);
}

.actions button::before,
.debug-control::before {
  display: inline-block;
  margin-right: 8px;
  color: inherit;
}

#reset::before {
  content: "↻";
}

.actions-secondary {
  margin-top: 4px;
}

#new-puzzle {
  min-width: 146px;
  background: rgba(12, 41, 101, 0.42);
  color: #f5fcff;
}

#new-puzzle::before {
  content: "✦";
}

.debug-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: color-mix(in srgb, var(--path-blue-core) 82%, white);
  min-width: 84px;
  font-weight: 450;
}

.debug-control::before {
  content: "☷";
  margin-right: 2px;
}

.mode-control::before {
  content: "◐";
}

.debug-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.debug-panel {
  width: 100%;
  border: 1px solid var(--soft-line);
  border-radius: 0;
  background: rgba(4, 35, 58, 0.5);
  padding: 14px 18px;
  color: #c5ccdb;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.debug-panel strong {
  color: #c5ccdb;
  font-size: 0.9rem;
  font-weight: 450;
}

.debug-panel pre {
  margin: 8px 0 0;
  overflow: auto;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: pre-wrap;
}

@keyframes bump {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(4px);
  }
}

@media (max-width: 420px) {
  .app {
    justify-content: flex-start;
    padding-top: 12px;
    width: min(100% - 20px, 760px);
    gap: 16px;
  }

  .plan-header,
  .mission-note {
    width: 100%;
  }

  .masthead-logo {
    width: min(100%, 300px);
  }

  .title-row {
    grid-template-columns: 72px 1fr;
  }

  .title-cell {
    grid-template-columns: 72px 1fr;
  }

  .title-cell-compact {
    grid-template-columns: 56px 1fr;
  }

  .title-cell-wide {
    grid-template-columns: 68px 1fr;
  }

  .title-key,
  .title-value {
    padding: 8px 9px;
    font-size: 0.68rem;
    line-height: 1.15;
    letter-spacing: 0.02em;
  }

  .title-cell-wide .title-value {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .board-wrap {
    --board-padding: 14px;
    --board-gap: 8px;
    --tab-height: 32px;
    --dimension-gap: 14px;
    --dimension-right-width: 36px;
    --dimension-bottom-height: 22px;
    --door-dimension-size: 28px;
    width: 100%;
    margin-top: 4px;
    margin-bottom: var(--board-bottom-clearance);
  }

  .reset-action {
    margin-top: -24px;
  }

  .wall-run,
  .wall-post {
    border-width: 1.5px;
    box-shadow:
      inset 0 0 0 2px rgba(7, 39, 65, 0.16),
      0 0 7px rgba(82, 156, 255, 0.1);
  }

  .marker {
    border-radius: 0;
    font-size: 0.88rem;
  }

  .path-badge {
    box-shadow: 0 0 9px rgba(82, 156, 255, 0.22);
  }

  .current-step-indicator {
    font-size: 0.82rem;
    -webkit-text-stroke: 2.1px var(--indicator-ring);
  }

  .path-badge.corner-br {
    right: 5px;
    bottom: 5px;
  }

  .path-badge.corner-bl {
    left: 5px;
    bottom: 5px;
  }

  .path-badge.corner-tl {
    left: 5px;
    top: 5px;
  }

  .path-badge.corner-tr {
    right: 5px;
    top: 5px;
  }

  .dimension-right {
    width: var(--dimension-right-width);
  }

  .dimension-bottom {
    right: 38px;
  }

  .door-dimension-right {
    right: 12px;
  }

  .dimension-label-total,
  .door-label {
    font-size: 0.78rem;
    padding: 0 4px;
  }

  .blueprint-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .compass {
    width: 100%;
  }

  .title-block {
    width: 100%;
  }
}
