:root {
  color: #1d2433;
  background: #f1f3f7;
  font-family: "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  font-synthesis: none;
  --panel: #ffffff;
  --line: #d9dee8;
  --muted: #687184;
  --accent: #29344f;
  --route: #e33f47;
  --goal: #158f63;
  --danger: #d9252d;
  --ignored: #a1a8b5;
  --shadow: 0 18px 50px rgba(35, 44, 66, 0.09);
}

* {
  box-sizing: border-box;
}

*:focus,
*:focus-visible,
*:focus-within {
  outline: none !important;
  outline-offset: 0 !important;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100dvh;
  overflow: hidden;
}

body.replay-page {
  height: auto;
  min-height: 100dvh;
  overflow-y: auto;
}

button,
select,
input {
  font: inherit;
}

button,
select,
input[type="number"] {
  min-height: 42px;
  border: 1px solid #cbd1dc;
  border-radius: 10px;
  color: #20283a;
  background: #fff;
}

button {
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled) {
  border-color: #8b95a8;
  background: #f5f7fa;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  height: 100dvh;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 6px;
  color: #657087;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1,
h2 {
  margin: 0;
  color: #172033;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
}

h2 {
  font-size: 1.1rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 20px;
  border: 1px solid rgba(206, 212, 224, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.app-shell > .site-header {
  grid-column: 1 / -1;
  grid-row: 1;
}

.site-brand {
  min-width: 0;
}

.site-brand-kicker {
  display: flex;
  margin-bottom: 6px;
  align-items: center;
  gap: 6px;
}

.site-brand-kicker .eyebrow {
  margin: 0;
}

.site-brand-title {
  display: block;
  text-decoration: none;
}

.site-brand h1 {
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
}

.site-brand-github {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 7px;
  color: #657087;
  transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.site-brand-github:hover {
  color: #26324d;
  background: #eef1f5;
}

.site-brand-github:focus-visible {
  box-shadow: 0 0 0 3px rgba(52, 66, 100, 0.24);
}

.site-brand-github svg {
  width: 16px;
  height: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.language-switch {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 3px;
  border: 1px solid #dfe3eb;
  border-radius: 10px;
  background: #f6f7f9;
}

.language-switch button {
  min-width: 34px;
  min-height: 34px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  color: #697287;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 800;
}

.language-switch button[aria-pressed="true"] {
  color: #fff;
  background: var(--accent);
}

.language-switch button:hover:not(:disabled):not([aria-pressed="true"]) {
  background: #fff;
}

.theme-toggle,
.export-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
}

.theme-toggle {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  border-color: #dfe3eb;
  color: #5f687a;
  background: #f6f7f9;
  font-size: 1.05rem;
}

.theme-toggle[aria-pressed="true"] {
  color: #f7d66d;
  background: #273249;
}

.export-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border-color: #d5dbe5;
  border-radius: 9px;
  color: #667186;
  background: #fff;
  font-size: 1rem;
}

.export-button svg {
  width: 20px;
  height: 20px;
}

.export-watermark {
  display: none;
  color: #8a93a4;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

[data-exporting="true"] .export-watermark {
  position: absolute;
  z-index: 5;
  top: 22px;
  right: 24px;
  font-size: 0.9rem;
  line-height: 1;
  text-align: right;
}

.export-status {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 36px));
  padding: 10px 13px;
  border: 1px solid #cfd6e1;
  border-radius: 10px;
  color: #27324a;
  background: #fff;
  box-shadow: 0 12px 32px rgba(25, 34, 54, 0.18);
  font-size: 0.78rem;
  font-weight: 750;
}

.export-status[data-status="error"] {
  border-color: #d88f94;
  color: #92242a;
  background: #fff0f1;
}

.site-nav {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
  padding: 4px;
  border: 1px solid #dfe3eb;
  border-radius: 12px;
  background: #f6f7f9;
}

.site-nav a {
  min-width: 88px;
  padding: 9px 14px;
  border-radius: 9px;
  color: #697287;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.site-nav a:hover {
  color: #26324d;
  background: #fff;
}

.site-nav a[aria-current="page"] {
  color: #fff;
  background: var(--accent);
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 16px 26px;
  color: var(--muted);
  text-align: center;
}

.site-footer-inner {
  display: flex;
  padding-top: 18px;
  align-items: center;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: inherit;
  text-decoration-color: currentColor;
  text-underline-offset: 3px;
  transition: color 140ms ease, box-shadow 140ms ease;
}

.site-footer a:hover {
  color: #26324d;
}

.site-footer a:focus-visible {
  border-radius: 4px;
  box-shadow: 0 0 0 3px rgba(52, 66, 100, 0.24);
}

.site-footer-github {
  display: inline-flex;
  padding: 3px 5px;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.site-footer-github svg {
  width: 19px;
  height: 19px;
}

.site-footer-copyright {
  font-size: 0.8rem;
}

.site-footer-note {
  color: #818a9b;
  font-size: 0.74rem;
}

.control-panel,
.replay-panel,
.log-panel {
  border: 1px solid rgba(206, 212, 224, 0.9);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel {
  display: flex;
  min-height: 0;
  padding: 18px;
  flex-direction: column;
  grid-column: 1;
  grid-row: 2 / -1;
  overflow: hidden;
}

.control-content {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.control-top {
  display: block;
}

.control-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
}

.panel-toggle {
  display: none;
}

.selector-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 11px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span,
.inline-field > span:first-child {
  color: #586175;
  font-size: 0.78rem;
  font-weight: 800;
}

.field select {
  width: 100%;
  padding: 0 36px 0 12px;
  text-overflow: ellipsis;
}

.model-picker {
  display: grid;
  min-height: 0;
  gap: 6px;
}

.model-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #586175;
  font-size: 0.78rem;
  font-weight: 800;
}

.model-search input {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid #d8dde7;
  border-radius: 9px;
  color: #263047;
  background: #fff;
}

.model-search input::placeholder {
  color: #9299a8;
}

.overlay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #586175;
  cursor: pointer;
  user-select: none;
}

.overlay-toggle input {
  width: 30px;
  height: 17px;
  min-height: 0;
  margin: 0;
  border: 0;
  accent-color: #397de8;
  cursor: pointer;
}

.overlay-toggle input:disabled {
  cursor: not-allowed;
}

.model-list {
  display: grid;
  max-height: 148px;
  min-height: 42px;
  gap: 5px;
  padding: 5px;
  border: 1px solid #e1e5ed;
  border-radius: 11px;
  overflow-y: auto;
  background: #f8f9fb;
  scrollbar-color: #c8ced9 transparent;
  scrollbar-width: thin;
}

.model-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
}

.model-row.is-active {
  border-color: #aeb8ca;
  background: #fff;
  box-shadow: 0 2px 8px rgba(35, 44, 66, 0.06);
}

.model-row.is-unavailable {
  opacity: 0.58;
}

.model-check {
  display: grid;
  place-items: center;
  cursor: pointer;
}

.model-check input {
  width: 15px;
  height: 15px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.model-activate {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  min-width: 0;
  min-height: 38px;
  gap: 8px;
  padding: 4px 7px;
  border: 0;
  border-radius: 7px;
  text-align: left;
  background: transparent;
}

.model-activate:hover:not(:disabled) {
  border-color: transparent;
  background: #eef1f6;
}

.model-color {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
}

.model-label {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.model-label strong,
.model-label small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-label strong {
  font-size: 0.76rem;
}

.model-label small {
  color: #788194;
  font-size: 0.67rem;
  font-weight: 600;
}

.model-list-empty {
  margin: auto;
  color: #858d9d;
  font-size: 0.75rem;
}

.model-bulk-controls {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 0 1px 7px;
}

.model-bulk-controls > button,
.developer-picker summary {
  min-width: 0;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  color: #667186;
  background: #fff;
  font-size: 0.65rem;
  white-space: nowrap;
}

.model-bulk-controls > button {
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-bulk-controls > button[aria-pressed="true"] {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.model-bulk-controls > button[aria-pressed="mixed"] {
  border-color: #8b95a8;
  color: #35415b;
  background: #e9edf4;
}

.developer-picker {
  position: static;
  min-width: 0;
}

.developer-picker[hidden] {
  display: none;
}

.developer-picker summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #cbd1dc;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.developer-picker summary::-webkit-details-marker {
  display: none;
}

.developer-picker summary::after {
  color: #818a9b;
  content: "▾";
  transition: transform 140ms ease;
}

.developer-picker[open] summary::after {
  transform: rotate(180deg);
}

.developer-picker-symbol {
  color: #7a8497;
  font-size: 0.85rem;
}

.developer-picker-popover {
  position: absolute;
  z-index: 8;
  top: calc(100% - 2px);
  right: 1px;
  left: 1px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 7px;
  border: 1px solid #d7dce6;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(35, 44, 66, 0.14);
}

.developer-picker:not([open]) .developer-picker-popover {
  display: none;
}

.developer-bulk-button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 40px;
  padding: 5px;
  place-items: center;
  border-radius: 7px;
  background: #f8f9fb;
}

.developer-bulk-button img {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}

.developer-bulk-button::after {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--developer-color, #64748b);
  content: "";
  font-size: 0.57rem;
  font-weight: 950;
  line-height: 1;
  opacity: 0;
}

.developer-bulk-button[aria-pressed="true"] {
  border-color: var(--developer-color, #64748b);
  background: #fff;
  box-shadow: inset 0 -3px var(--developer-color, #64748b);
}

.developer-bulk-button[aria-pressed="true"]::after,
.developer-bulk-button[aria-pressed="mixed"]::after {
  opacity: 1;
}

.developer-bulk-button[aria-pressed="true"]::after {
  content: "✓";
}

.developer-bulk-button[aria-pressed="mixed"] {
  border-color: #8b95a8;
  background: #e9edf4;
}

.developer-bulk-button[aria-pressed="mixed"]::after {
  background: #758096;
  content: "−";
}

.maze-stage {
  position: relative;
}

.maze-export-button,
.maze-export-watermark {
  position: absolute;
  z-index: 5;
  top: 10px;
  right: 10px;
}

.maze-export-watermark {
  top: 22px;
  right: 24px;
}

[data-exporting="true"] .maze-export-watermark {
  display: block;
}

[data-theme="dark"] {
  color: #e5e7eb;
  background: #0b1120;
  --panel: #151d2d;
  --line: #344054;
  --muted: #a7b0c0;
  --accent: #6577a5;
  --goal: #4ad6a0;
  --danger: #ff6670;
  --ignored: #778196;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

[data-theme="dark"] body {
  color: #e5e7eb;
  background: #0b1120;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] .site-brand h1 {
  color: #f3f4f6;
}

[data-theme="dark"] .eyebrow,
[data-theme="dark"] .field > span,
[data-theme="dark"] .inline-field > span,
[data-theme="dark"] .model-label small {
  color: #a7b0c0;
}

[data-theme="dark"] .site-brand-github {
  color: #a7b0c0;
}

[data-theme="dark"] .site-brand-github:hover {
  color: #f3f4f6;
  background: #273249;
}

[data-theme="dark"] .site-brand-github:focus-visible {
  box-shadow: 0 0 0 3px rgba(101, 119, 165, 0.48);
}

[data-theme="dark"] .site-header,
[data-theme="dark"] .control-panel,
[data-theme="dark"] .replay-panel,
[data-theme="dark"] .log-panel {
  border-color: #313c50;
  background: rgba(21, 29, 45, 0.96);
}

[data-theme="dark"] button,
[data-theme="dark"] select,
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="search"] {
  border-color: #465268;
  color: #e5e7eb;
  background: #1b2538;
}

[data-theme="dark"] button:hover:not(:disabled) {
  border-color: #71809a;
  background: #273249;
}

[data-theme="dark"] .language-switch,
[data-theme="dark"] .site-nav {
  border-color: #3b465b;
  background: #1b2538;
}

[data-theme="dark"] .language-switch button {
  color: #aeb7c7;
  background: transparent;
}

[data-theme="dark"] .language-switch button[aria-pressed="true"],
[data-theme="dark"] .site-nav a[aria-current="page"] {
  color: #fff;
  background: var(--accent);
}

[data-theme="dark"] .language-switch button:hover:not(:disabled):not([aria-pressed="true"]) {
  background: #273249;
}

[data-theme="dark"] .site-footer a:hover {
  color: #f3f4f6;
}

[data-theme="dark"] .site-footer a:focus-visible {
  box-shadow: 0 0 0 3px rgba(101, 119, 165, 0.48);
}

[data-theme="dark"] .site-footer-note {
  color: #8791a3;
}

[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .export-button {
  border-color: #465268;
  background: #1b2538;
}

[data-theme="dark"] .model-picker-popover,
[data-theme="dark"] .developer-picker-popover,
[data-theme="dark"] .model-list {
  border-color: #3a465a;
  background: #131c2c;
}

[data-theme="dark"] .developer-picker summary {
  border-color: #465268;
  color: #d8dee8;
  background: #1b2538;
}

[data-theme="dark"] .developer-picker-symbol,
[data-theme="dark"] .developer-picker summary::after {
  color: #a7b0c0;
}

[data-theme="dark"] .developer-bulk-button {
  border-color: #465268;
  background: #1b2538;
}

[data-theme="dark"] .developer-bulk-button[aria-pressed="true"] {
  border-color: var(--developer-color, #71809a);
  background: #202b40;
}

[data-theme="dark"] .developer-bulk-button[aria-pressed="mixed"] {
  border-color: #71809a;
  background: #2a3549;
}

[data-theme="dark"] .model-activate:hover:not(:disabled),
[data-theme="dark"] .model-row.is-active .model-activate {
  background: #263249;
}

[data-theme="dark"] .model-color {
  border: 1px solid rgba(255, 255, 255, 0.78);
}

[data-theme="dark"] .result-strip,
[data-theme="dark"] .command-log-frame {
  border-color: #354156;
  background: #111a2a;
}

[data-theme="dark"] .result-identity strong,
[data-theme="dark"] .command-pill {
  color: #e5e7eb;
}

[data-theme="dark"] .maze-stage {
  border-color: #354156;
  background: #111827;
}

[data-theme="dark"] .maze-background {
  fill: #111827;
}

[data-theme="dark"] .maze-wall {
  stroke: #d1d5db;
}

[data-theme="dark"] .maze-grid {
  stroke: #39455a;
}

[data-theme="dark"] .export-status {
  border-color: #465268;
  color: #e5e7eb;
  background: #1b2538;
}

[data-theme="dark"] .export-status[data-status="error"] {
  border-color: #a84d55;
  color: #fecaca;
  background: #3a1d24;
}

.result-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #e1e5ed;
  border-radius: 13px;
  background: #f8f9fb;
}

.result-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.result-identity strong {
  min-width: 0;
  overflow: hidden;
  color: #343d50;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
}

.badge-loading,
.badge-unfinished {
  color: #73510a;
  background: #fff0bd;
}

.badge-death,
.badge-error {
  color: #9d1d24;
  background: #ffe0e1;
}

.badge-success {
  color: #0b7650;
  background: #d9f6e9;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.result-stats div {
  display: grid;
  gap: 2px;
  text-align: center;
}

.result-stats dt {
  color: #7a8293;
  font-size: 0.7rem;
  font-weight: 700;
}

.result-stats dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
}

.transport {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  align-items: end;
  gap: 10px;
  min-width: 0;
  margin: 0;
}

.result-control-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-direction: column;
}

.button-group {
  display: grid;
  grid-template-columns: repeat(5, minmax(46px, 1fr));
  grid-template-areas: "first previous play next last";
  gap: 8px;
}

#firstButton {
  grid-area: first;
}

#previousButton {
  grid-area: previous;
}

#playButton {
  grid-area: play;
}

#nextButton {
  grid-area: next;
}

#lastButton {
  grid-area: last;
}

.button-primary {
  min-width: 0;
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.button-primary:hover:not(:disabled) {
  border-color: #172033;
  color: #fff;
  background: #172033;
}

.inline-field {
  display: flex;
  align-items: stretch;
  gap: 5px;
  margin-left: 0;
  flex-direction: column;
}

.inline-field select {
  padding: 0 30px 0 10px;
}

.step-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-left: 0;
}

.step-field > span:first-child {
  grid-column: 1 / -1;
}

.step-field input {
  width: 100%;
  padding: 0 9px;
  text-align: right;
}

#stepTotal {
  min-width: 40px;
  color: #70798b;
  font-size: 0.86rem;
  align-self: center;
}

.scrubber {
  display: block;
  height: 18px;
  margin-top: 7px;
}

.scrubber input {
  width: 100%;
  margin: 0;
  accent-color: var(--route);
}

.replay-panel {
  position: relative;
  display: grid;
  min-height: 0;
  padding: 12px;
  container-type: size;
  grid-column: 2;
  grid-row: 2;
  place-items: center;
  overflow: hidden;
  background-color: #e9ecf1;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.55) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.55) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.55) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.55) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.maze-stage {
  height: 100%;
  width: auto;
  max-height: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #fafafa;
  box-shadow: 0 12px 32px rgba(25, 33, 50, 0.12);
}

.maze-stage > svg {
  display: block;
  width: 100%;
  height: 100%;
}

.maze-background {
  fill: #fff;
}

.maze-wall {
  stroke: #17191e;
  stroke-width: 3.5;
  stroke-linecap: square;
  vector-effect: non-scaling-stroke;
}

.optimal-segment,
.model-route-halo,
.model-route-segment {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.model-route-halo {
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 8;
}

.optimal-segment {
  stroke: #397de8;
  stroke-width: 4;
  stroke-dasharray: 8 7;
  opacity: 0.72;
}

.model-route-segment {
  stroke: var(--model-route-color, var(--route));
  stroke-width: 4;
  opacity: 0.6;
}

.model-route.is-active .model-route-segment {
  stroke-width: 5.5;
}

.model-position-marker {
  fill: var(--model-route-color, var(--route));
  stroke: #fff;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.model-route.is-comparison .model-position-marker {
  opacity: 0.72;
}

.model-route {
  cursor: help;
}

.model-route-tooltip {
  position: absolute;
  z-index: 7;
  max-width: min(320px, calc(100% - 16px));
  padding: 7px 10px;
  border: 1.5px solid #bfc7d5;
  border-radius: 8px;
  color: #25314c;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(35, 44, 66, 0.16);
  font-size: 0.73rem;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.model-route-tooltip[hidden] {
  display: none;
}

[data-theme="dark"] .model-route-tooltip {
  border-color: #536078;
  color: #eef1f5;
  background: rgba(27, 37, 56, 0.97);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.collision-mark {
  stroke: var(--danger);
  stroke-width: 6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.start-arrow {
  fill: #397de8;
  stroke: #1f53ae;
}

.goal-arrow {
  fill: #ed5158;
  stroke: #a52930;
}

.maze-arrow {
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.message-box {
  position: absolute;
  z-index: 5;
  top: 18px;
  left: 50%;
  width: min(620px, calc(100% - 36px));
  padding: 13px 16px;
  border: 1px solid #e7a8aa;
  border-radius: 10px;
  color: #8d2026;
  background: rgba(255, 238, 239, 0.96);
  font-size: 0.9rem;
  line-height: 1.55;
  transform: translateX(-50%);
  box-shadow: 0 8px 22px rgba(78, 27, 30, 0.1);
}

.log-panel {
  padding: 12px 16px;
  grid-column: 2;
  grid-row: 3;
}

@media (min-width: 901px) and (min-height: 761px) {
  .model-list {
    height: clamp(220px, 28vh, 320px);
    max-height: none;
  }
}

.log-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
}

.log-heading .eyebrow {
  display: none;
}

.log-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: #71798a;
  font-size: 0.72rem;
}

.log-controls {
  min-width: 350px;
}

.log-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2a3347;
}

.legend-current {
  box-shadow: 0 0 0 2px #2a3347;
}

.legend-death {
  background: var(--danger);
}

.legend-goal {
  background: var(--goal);
}

.legend-ignored {
  background: var(--ignored);
}

.log-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.scroll-button {
  padding: 0;
  font-size: 1.5rem;
}

.command-log-frame {
  position: relative;
  min-width: 0;
  border: 1px solid #e1e5ed;
  border-radius: 10px;
  overflow: hidden;
  background: #f8f9fb;
}

.command-log-frame::before,
.command-log-frame::after {
  position: absolute;
  z-index: 2;
  top: 1px;
  bottom: 1px;
  width: 30px;
  opacity: 0;
  pointer-events: none;
  content: "";
  transition: opacity 140ms ease;
}

.command-log-frame::before {
  left: 1px;
  background: linear-gradient(90deg, #f8f9fb 20%, rgba(248, 249, 251, 0));
}

.command-log-frame::after {
  right: 1px;
  background: linear-gradient(270deg, #f8f9fb 20%, rgba(248, 249, 251, 0));
}

.command-log-frame.can-scroll-left::before,
.command-log-frame.can-scroll-right::after {
  opacity: 1;
}

.command-log {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 44px;
  padding: 3px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -ms-overflow-style: none;
}

.command-log::-webkit-scrollbar {
  display: none;
}

.command-log.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.command-token {
  flex: 0 0 auto;
  min-width: 18px;
  padding: 7px 2px;
  border-bottom: 3px solid transparent;
  color: #30394b;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
}

.command-token.is-current {
  border-bottom-color: #2f3a52;
  font-size: 1.12rem;
  font-weight: 900;
}

.command-token.is-death {
  color: var(--danger);
  font-weight: 900;
}

.command-token.is-goal {
  color: var(--goal);
  font-weight: 900;
}

.command-token.is-ignored {
  color: var(--ignored);
}

.command-tail {
  flex: 0 0 auto;
  color: var(--ignored);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 1rem;
  line-height: 1;
  white-space: pre;
}

.empty-log {
  margin: auto;
  color: #868e9e;
  font-size: 0.88rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 12px, 720px);
    padding: 10px 0;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 8px;
  }

  .control-top {
    display: block;
  }

  .control-panel-heading {
    padding-bottom: 10px;
  }

  .result-control-row {
    display: flex;
    gap: 8px;
  }

  .selector-grid {
    grid-template-columns: 1fr;
  }

  .model-list {
    max-height: 132px;
  }

  .transport {
    display: grid;
  }

  .button-group {
    width: 100%;
  }

  .button-group button {
    flex: 1 1 auto;
    min-width: 44px;
    padding: 0 8px;
  }

  .inline-field {
    margin-left: 0;
  }

  .replay-panel {
    min-height: 0;
    padding: 7px;
  }

  .log-heading {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .log-legend {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: calc(100% - 8px);
    padding: 4px 0;
    grid-template-columns: minmax(155px, 0.9fr) minmax(0, 1.1fr);
    gap: 4px;
  }

  .developer-picker-popover {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-panel,
  .log-panel {
    padding: 7px;
    border-radius: 10px;
  }

  .site-header {
    gap: 8px;
    padding: 9px 10px;
    border-radius: 11px;
  }

  .site-brand .eyebrow {
    display: none;
  }

  .site-brand {
    display: flex;
    align-items: center;
    gap: 3px;
  }

  .site-brand-kicker {
    margin: 0;
    order: 2;
  }

  .site-brand-title {
    min-width: 0;
    order: 1;
  }

  .site-brand h1 {
    overflow: hidden;
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-brand-github {
    width: 20px;
    height: 20px;
    border-radius: 6px;
  }

  .site-brand-github svg {
    width: 14px;
    height: 14px;
  }

  .site-nav {
    gap: 3px;
    padding: 3px;
    border-radius: 9px;
  }

  .header-actions {
    gap: 3px;
  }

  .language-switch {
    gap: 1px;
    padding: 2px;
    border-radius: 8px;
  }

  .language-switch button {
    min-width: 27px;
    min-height: 30px;
    padding: 0 4px;
    border-radius: 6px;
    font-size: 0.65rem;
  }

  .theme-toggle {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    border-radius: 8px;
    font-size: 0.9rem;
  }

  .site-nav a {
    min-width: 0;
    padding: 7px 9px;
    font-size: 0.74rem;
  }

  .control-panel-heading {
    padding-bottom: 6px;
  }

  .control-panel-heading h2 {
    font-size: 1rem;
  }

  .selector-grid {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .field {
    gap: 2px;
  }

  .field select {
    min-height: 34px;
    padding-left: 7px;
    font-size: 0.72rem;
  }

  .model-list {
    max-height: 108px;
    min-height: 34px;
    gap: 3px;
    padding: 3px;
  }

  .model-activate {
    min-height: 32px;
    padding-block: 2px;
  }

  .result-strip {
    gap: 8px;
    padding: 7px 9px;
  }

  .result-stats {
    gap: 12px;
  }

  .result-stats div {
    text-align: right;
  }

  .result-stats div:nth-child(3) {
    display: none;
  }

  .button-group {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
  }

  .button-group button {
    min-height: 36px;
    font-size: 0.78rem;
  }

  .button-primary {
    min-width: 0;
  }

  .log-row {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }

  .command-log {
    gap: 4px;
    min-height: 38px;
  }

  .transport {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .inline-field {
    font-size: 0.78rem;
  }

  .button-group button {
    padding-inline: 2px;
    white-space: nowrap;
  }

  .inline-field select,
  .step-field input {
    min-height: 36px;
  }
}

@media (max-height: 760px) {
  .eyebrow {
    margin-bottom: 2px;
  }

  .log-panel {
    padding-block: 8px;
  }

  .log-heading {
    gap: 12px;
  }
}

@media (max-height: 620px) and (min-width: 901px) {
  .control-panel {
    padding: 10px 14px;
  }

  .control-panel-heading {
    padding-bottom: 6px;
  }

  .control-panel-heading h2 {
    font-size: 1.15rem;
  }

  .selector-grid {
    gap: 5px;
  }

  .field {
    gap: 2px;
  }

  .field select {
    min-height: 34px;
  }

  .model-list {
    max-height: 72px;
    min-height: 34px;
    gap: 3px;
    padding: 3px;
  }

  .model-activate {
    min-height: 32px;
    padding-block: 2px;
  }

  .result-control-row {
    gap: 7px;
    margin-top: 7px;
  }

  .result-strip {
    gap: 5px;
    padding: 7px 10px;
  }

  .inline-field select,
  .step-field input {
    min-height: 36px;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .app-shell {
    width: calc(100% - 8px);
    padding: 4px 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 5px;
  }

  .control-panel {
    grid-column: 1;
    grid-row: 2;
    padding: 9px 10px;
    overflow: hidden;
  }

  .control-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
  }

  .control-panel-heading h2 {
    font-size: 1.08rem;
  }

  .panel-toggle {
    display: inline-flex;
    width: 36px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto;
    font-size: 1rem;
  }

  .control-content {
    margin-top: 9px;
    overflow-y: auto;
  }

  .control-panel.is-collapsed .control-content {
    display: none;
  }

  .selector-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .model-list {
    max-height: 116px;
  }

  .field {
    gap: 3px;
  }

  .result-control-row {
    gap: 7px;
    margin-top: 7px;
  }

  .result-strip {
    padding: 7px 9px;
  }

  .transport {
    grid-template-columns: 0.8fr 1.2fr;
    gap: 7px;
  }

  .button-group {
    grid-column: 1 / -1;
  }

  .replay-panel {
    grid-column: 1;
    grid-row: 3;
    padding: 6px;
  }

  .log-panel {
    grid-column: 1;
    grid-row: 4;
  }

  .log-heading {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
  }

  .log-legend {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .log-controls {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .site-footer {
    width: calc(100% - 8px);
    padding: 15px 8px 18px;
  }

  .site-footer-inner {
    padding-top: 14px;
    gap: 5px;
  }
}
