:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #1b2024;
  --panel-strong: #222a2f;
  --line: rgba(222, 230, 226, 0.15);
  --text: #f1f4ef;
  --muted: #aeb9b4;
  --accent: #e85d3f;
  --accent-2: #f2bd5c;
  --blue: #58a6c9;
  --green: #58b878;
  --purple: #9b6bd3;
  --danger: #ef7474;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #273038;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  min-height: 38px;
  padding: 8px 12px;
}

button:hover {
  border-color: rgba(242, 189, 92, 0.55);
}

button:disabled {
  cursor: default;
  opacity: 0.42;
}

button.primary {
  background: var(--accent);
  border-color: transparent;
  font-weight: 700;
}

button.primary.is-calculating,
button.primary.is-calculating:disabled {
  background: #7b473b;
  border-color: rgba(242, 189, 92, 0.18);
  box-shadow: none;
  color: rgba(241, 244, 239, 0.72);
  cursor: wait;
  opacity: 0.68;
}

button.danger-action {
  white-space: pre-line;
}

button.danger-action.is-confirm-delete {
  background: #a83232;
  border-color: rgba(255, 119, 96, 0.9);
  box-shadow: 0 0 0 2px rgba(232, 93, 63, 0.2);
  color: #fff6f2;
  font-weight: 800;
}

.editor-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  overflow: hidden;
}

.track-rail {
  border-right: 1px solid var(--line);
  background: #171b1f;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100vh;
  min-height: 0;
  padding: 18px;
  gap: 14px;
}

.rail-head h1,
.workbench-bar h2 {
  margin: 0;
}

.rail-head h1 {
  font-size: 1.45rem;
}

.status-line,
.eyebrow {
  color: var(--muted);
  margin: 6px 0 0;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.track-browser {
  display: grid;
  gap: 8px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.track-list {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.track-item {
  flex: 0 0 76px;
  min-height: 76px;
  text-align: left;
  background: #20262b;
}

.track-item.is-local {
  background: #232c29;
}

.track-item.is-draft {
  background: #2d2720;
}

.track-nav {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-height: 30px;
  padding: 4px 10px;
}

.track-nav:disabled {
  cursor: default;
  opacity: 0.35;
}

.track-nav-icon {
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  display: block;
  height: 0;
  width: 0;
}

.track-nav-icon-up {
  border-bottom: 9px solid var(--muted);
}

.track-nav-icon-down {
  border-top: 9px solid var(--muted);
}

.track-item.is-active {
  border-color: var(--accent-2);
  background: #2d332f;
}

.track-name {
  display: block;
  font-weight: 800;
}

.track-name-block {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.track-proposal-hint {
  color: #f5d487;
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.15;
}

.track-item-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.track-kind {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  min-height: 24px;
  padding: 4px 8px;
}

.track-kind.is-official {
  background: rgba(255, 255, 255, 0.05);
}

.track-kind.is-local {
  background: rgba(88, 184, 120, 0.16);
  border-color: rgba(88, 184, 120, 0.34);
  color: #d6f2df;
}

.track-kind.is-proposal-action {
  border-color: rgba(242, 189, 92, 0.62);
  box-shadow: inset 0 0 0 1px rgba(242, 189, 92, 0.18);
  color: #fff1c8;
  cursor: pointer;
}

.track-kind.is-proposal-action:focus-visible,
.track-kind.is-proposal-action:hover {
  background: rgba(242, 189, 92, 0.22);
  outline: 2px solid rgba(242, 189, 92, 0.32);
  outline-offset: 2px;
}

.track-kind.is-draft {
  background: rgba(242, 189, 92, 0.14);
  border-color: rgba(242, 189, 92, 0.34);
  color: #ffe6b0;
}

.track-record {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.app-signature {
  border-top: 1px solid var(--line);
  color: rgba(174, 185, 180, 0.72);
  display: flex;
  font-size: 0.76rem;
  justify-content: space-between;
  padding-top: 10px;
}

.app-signature a {
  color: inherit;
  text-decoration: none;
}

.app-signature a:hover {
  color: #f2bd5c;
}

.workbench {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
}

.workbench-bar {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: start;
  column-gap: 18px;
  row-gap: 5px;
  padding: 12px 18px 9px;
}

.track-title-block {
  align-items: start;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 5px;
}

.track-title-block .eyebrow {
  grid-column: 1 / -1;
}

.track-title-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.track-title-row h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.fullscreen-btn {
  background: rgba(255, 255, 255, 0.04);
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 10px;
  white-space: nowrap;
}

.fullscreen-btn.is-active,
.fullscreen-btn:hover {
  border-color: rgba(242, 189, 92, 0.55);
  box-shadow: inset 0 0 0 1px rgba(242, 189, 92, 0.28);
}

.fullscreen-install-callout {
  align-items: center;
  background: rgba(17, 22, 25, 0.97);
  border: 1px solid rgba(242, 189, 92, 0.72);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  color: #edf3ef;
  display: flex;
  font-size: 0.86rem;
  font-weight: 700;
  gap: 10px;
  line-height: 1.35;
  max-width: min(430px, calc(100vw - 20px));
  padding: 10px 12px;
  pointer-events: auto;
  position: fixed;
  text-align: left;
  z-index: 260;
}

.fullscreen-install-callout-text {
  min-width: 0;
}

.fullscreen-install-share-icon {
  align-items: center;
  color: var(--accent-2);
  display: inline-flex;
  height: 1.12em;
  justify-content: center;
  margin: 0 0.14em;
  position: relative;
  top: 0.16em;
  vertical-align: baseline;
  width: 1.12em;
}

.fullscreen-install-share-icon svg {
  display: block;
  fill: none;
  height: 100%;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.15;
  width: 100%;
}

.fullscreen-install-callout-close {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(242, 189, 92, 0.58);
  border-radius: 7px;
  color: var(--accent-2);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  line-height: 1;
  margin-left: 4px;
  padding: 0;
  text-transform: uppercase;
  width: 26px;
}

.fullscreen-install-callout-close:hover,
.fullscreen-install-callout-close:focus-visible {
  background: rgba(242, 189, 92, 0.16);
  outline: none;
}

.editor-dialog-overlay {
  align-items: center;
  background: rgba(7, 9, 10, 0.72);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 80;
}

.editor-dialog {
  background: #1c2328;
  border: 1px solid rgba(242, 189, 92, 0.42);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.48);
  color: var(--text);
  display: grid;
  gap: 14px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 20px;
  width: 100%;
}

.editor-dialog-wide {
  max-width: min(760px, calc(100vw - 32px));
}

.editor-dialog h3 {
  color: var(--accent-2);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  margin: 0;
  text-transform: uppercase;
}

.editor-dialog-body {
  display: grid;
  gap: 12px;
}

.editor-dialog-message {
  color: #e6eee9;
  line-height: 1.45;
  margin: 0;
  white-space: pre-line;
}

.editor-dialog-input {
  background: #080b0c;
  border: 1px solid rgba(222, 230, 226, 0.18);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  min-height: 44px;
  padding: 9px 12px;
  width: 100%;
}

.editor-dialog-input:focus {
  border-color: rgba(242, 189, 92, 0.72);
  outline: 2px solid rgba(242, 189, 92, 0.22);
}

.editor-dialog-textarea {
  background: #080b0c;
  border: 1px solid rgba(222, 230, 226, 0.18);
  border-radius: 8px;
  color: var(--text);
  font: 0.9rem Consolas, "Courier New", monospace;
  min-height: 180px;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}

.editor-dialog-textarea-export {
  min-height: 300px;
}

.editor-dialog-textarea:focus {
  border-color: rgba(242, 189, 92, 0.72);
  outline: 2px solid rgba(242, 189, 92, 0.22);
}

.editor-drop-zone {
  align-items: center;
  background: rgba(88, 166, 201, 0.08);
  border: 1px dashed rgba(88, 166, 201, 0.64);
  border-radius: 8px;
  color: #dce7e2;
  display: grid;
  gap: 6px;
  justify-items: center;
  min-height: 132px;
  padding: 20px;
  text-align: center;
}

.editor-drop-zone strong {
  color: var(--accent-2);
  font-size: 1rem;
}

.editor-drop-zone span {
  color: var(--muted);
  line-height: 1.35;
  max-width: 560px;
}

.editor-drop-zone:focus,
.editor-drop-zone.is-dragover {
  background: rgba(88, 166, 201, 0.16);
  border-color: rgba(242, 189, 92, 0.82);
  outline: 2px solid rgba(242, 189, 92, 0.18);
}

.editor-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.editor-print-options-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-print-option {
  align-items: center;
  background: rgba(8, 11, 12, 0.48);
  border: 1px solid rgba(222, 230, 226, 0.14);
  border-radius: 8px;
  color: #e6eee9;
  cursor: pointer;
  display: flex;
  gap: 9px;
  min-height: 40px;
  padding: 8px 10px;
}

.editor-print-option input {
  accent-color: var(--accent-2);
  height: 16px;
  width: 16px;
}

.editor-print-option:has(input:disabled) {
  color: rgba(230, 238, 233, 0.42);
  cursor: not-allowed;
}

.editor-print-section-title {
  color: var(--accent-2);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  margin: 4px 0 -4px;
  text-transform: uppercase;
}

.editor-print-destination-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-print-muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.editor-print-preview-panel {
  max-height: calc(100vh - 32px);
  max-width: min(1120px, calc(100vw - 32px));
}

.editor-print-preview-image {
  background: #ffffff;
  border: 1px solid rgba(222, 230, 226, 0.18);
  border-radius: 6px;
  display: block;
  height: auto;
  max-height: min(70vh, 720px);
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

.editor-print-frame {
  border: 0;
  bottom: 0;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  right: 0;
  width: 1px;
}

.check-status {
  color: var(--accent-2);
  font-size: 0.88rem;
  grid-column: 1 / -1;
  margin: 0 0 3px;
  min-height: 0;
}

.check-status.has-result {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  line-height: 1.2;
}

.legend-metric {
  color: #dfe8e1;
  white-space: nowrap;
}

.legend-metric strong {
  color: var(--accent-2);
}

.evaluation-summary {
  align-items: center;
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.track-quality-score {
  font-weight: 800;
  white-space: nowrap;
}

.track-quality-score strong {
  color: inherit;
}

.track-quality-detail-btn,
.track-trajectory-toggle-btn {
  background: rgba(242, 189, 92, 0.14);
  border: 1px solid rgba(242, 189, 92, 0.72);
  border-radius: 999px;
  color: #ffe0a3;
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  min-height: 23px;
  padding: 2px 9px;
  text-transform: uppercase;
  white-space: nowrap;
}

.track-quality-detail-btn {
  animation: score-detail-blink 0.75s ease-in-out 0.2s 3;
}

.track-quality-detail-btn:hover,
.track-quality-detail-btn:focus-visible,
.track-trajectory-toggle-btn:hover,
.track-trajectory-toggle-btn:focus-visible {
  background: rgba(242, 189, 92, 0.24);
  box-shadow: 0 0 0 3px rgba(242, 189, 92, 0.16);
  outline: none;
}

@keyframes score-detail-blink {
  0%,
  100% {
    border-color: rgba(242, 189, 92, 0.72);
    box-shadow: none;
  }

  45% {
    border-color: rgba(255, 235, 160, 1);
    box-shadow: 0 0 0 4px rgba(242, 189, 92, 0.2), 0 0 18px rgba(242, 189, 92, 0.5);
  }
}

.track-score-high {
  color: #63d483;
}

.track-score-medium {
  color: #f2bd5c;
}

.track-score-low {
  color: #ff8a75;
}

.lap-status {
  font-weight: 800;
}

.lap-status-ok {
  color: var(--purple);
}

.lap-status-error {
  color: #ff8a75;
}

.legend-item {
  align-items: center;
  display: inline-flex;
  gap: 5px;
  white-space: nowrap;
}

.trajectory-play-button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  margin: -3px -6px;
  padding: 3px 6px;
}

.trajectory-play-button:hover,
.trajectory-play-button:focus-visible {
  border-color: rgba(242, 189, 92, 0.55);
  color: #f1f4ef;
}

.trajectory-play-button.is-active {
  background: rgba(242, 189, 92, 0.1);
  border-color: rgba(242, 189, 92, 0.92);
  box-shadow: 0 0 14px rgba(242, 189, 92, 0.2);
}

.trajectory-dot {
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}

.trajectory-dot-red {
  background: #e53935;
  height: 6px;
  width: 6px;
}

.trajectory-dot-green {
  background: #20b84d;
  height: 10px;
  width: 10px;
}

.trajectory-dot-yellow {
  background: #ffd84d;
  height: 14px;
  width: 14px;
}

.trajectory-dot-blue {
  background: #1385e5;
  height: 12px;
  width: 12px;
}

.title-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  justify-content: flex-end;
}

.title-actions button {
  padding-left: 10px;
  padding-right: 10px;
  white-space: nowrap;
}

.language-switch {
  display: inline-flex;
  gap: 6px;
}

.lang-btn {
  background: rgba(255, 255, 255, 0.04);
  min-height: 38px;
  min-width: 48px;
  padding: 8px 11px;
}

.lang-btn.is-active,
.lang-btn:hover {
  background: rgba(232, 93, 63, 0.18);
  border-color: rgba(232, 93, 63, 0.55);
}

.check-btn {
  min-width: 150px;
}

.check-btn.is-calculating {
  filter: saturate(0.65);
}

.header-action-btn {
  min-width: 118px;
}

.save-header-btn {
  min-width: 124px;
}

.tool-btn.is-active {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(242, 189, 92, 0.45);
}

.tool-btn.needs-attention {
  animation: toolAttentionPulse 0.32s ease-in-out infinite alternate;
  border-color: rgba(255, 216, 77, 0.95);
}

@keyframes toolAttentionPulse {
  from {
    box-shadow: inset 0 0 0 1px rgba(255, 216, 77, 0.3), 0 0 0 rgba(255, 216, 77, 0);
  }

  to {
    box-shadow: inset 0 0 0 1px rgba(255, 216, 77, 0.8), 0 0 16px rgba(255, 216, 77, 0.34);
  }
}

.tool-callout {
  background: #1c2328;
  border: 1px solid rgba(255, 216, 77, 0.78);
  border-radius: 8px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.38);
  color: #fff1bb;
  font-size: 0.82rem;
  font-weight: 800;
  left: 0;
  line-height: 1.15;
  max-width: 180px;
  padding: 8px 10px;
  pointer-events: none;
  position: fixed;
  text-align: center;
  top: 0;
  z-index: 95;
}

.tool-callout::after {
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid rgba(255, 216, 77, 0.78);
  bottom: -7px;
  content: "";
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
}

.tool-btn {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 8px 9px;
  text-align: center;
}

.tool-btn span:not(.tool-icon) {
  line-height: 1.05;
  min-width: 0;
  overflow-wrap: anywhere;
}

.direction-tool-btn span:not(.tool-icon) {
  font-size: 0.76rem;
  max-width: 80px;
  overflow-wrap: normal;
  word-break: normal;
}

.tool-btn[data-tool="car"] span:not(.tool-icon) {
  font-size: 0.76rem;
  max-width: 58px;
  overflow-wrap: normal;
  word-break: normal;
}

.tool-hint {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  font-size: 0.68rem;
  line-height: 1.15;
  min-height: 38px;
  padding: 6px 8px;
  text-align: left;
}

.track-tool-hint {
  background: rgba(39, 48, 56, 0.26);
}

.tool-icon {
  display: inline-block;
  flex: 0 0 auto;
  height: 18px;
  position: relative;
  width: 18px;
}

.icon-track {
  background: #f1f4ef;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.icon-elevated {
  background: rgba(143, 99, 246, 0.58);
  border: 1px solid rgba(224, 204, 255, 0.86);
  box-shadow: inset 0 0 0 3px rgba(143, 99, 246, 0.28);
}

.icon-elevated::before {
  background: rgba(255, 255, 255, 0.5);
  content: "";
  display: block;
  height: 2px;
  left: 3px;
  position: absolute;
  top: 8px;
  transform: rotate(-35deg);
  width: 12px;
}

.icon-connection {
  background: rgba(45, 212, 191, 0.88);
  border: 1px solid rgba(204, 251, 241, 0.92);
  box-shadow: inset 0 0 0 3px rgba(5, 6, 6, 0.28);
}

.icon-connection::before {
  background: rgba(5, 6, 6, 0.72);
  border-radius: 50%;
  content: "";
  height: 6px;
  left: 6px;
  position: absolute;
  top: 6px;
  width: 6px;
}

.icon-erase {
  background: #030405;
  border: 1px solid rgba(241, 244, 239, 0.35);
  box-shadow: inset 0 0 0 4px #14191d;
}

.icon-start {
  background: var(--purple);
}

.icon-finish {
  background: var(--green);
}

.icon-car {
  height: 22px;
  width: 30px;
}

.icon-car::before {
  background: #ef3f3c;
  border: 1px solid rgba(5, 6, 6, 0.72);
  clip-path: polygon(0 28%, 64% 28%, 100% 50%, 64% 72%, 0 72%);
  content: "";
  display: block;
  height: 12px;
  left: 6px;
  position: absolute;
  top: 5px;
  width: 20px;
}

.icon-car::after {
  background:
    radial-gradient(circle, #f1d6a8 0 38%, #14191d 42% 68%, transparent 72%) 13px 8px / 7px 7px no-repeat,
    radial-gradient(circle, transparent 0 44%, #11171b 48% 67%, transparent 70%) 18px 8px / 7px 7px no-repeat,
    linear-gradient(#11171b 0 0) 5px 3px / 5px 5px no-repeat,
    linear-gradient(#11171b 0 0) 20px 3px / 5px 5px no-repeat,
    linear-gradient(#11171b 0 0) 5px 14px / 5px 5px no-repeat,
    linear-gradient(#11171b 0 0) 20px 14px / 5px 5px no-repeat;
  content: "";
  display: block;
  height: 22px;
  left: 0;
  position: absolute;
  top: 0;
  width: 30px;
}

.icon-direction {
  background: transparent;
  color: #176d3a;
  font-family: "Segoe UI Symbol", "Arial", sans-serif;
  font-size: 18px;
  font-weight: 800;
  height: 20px;
  line-height: 20px;
  text-align: center;
  width: 20px;
}

.icon-direction::before {
  content: "\2194";
  display: block;
  left: 0;
  position: absolute;
  top: 0;
  width: 20px;
}

.icon-direction::after {
  content: "\2195";
  display: block;
  left: 0;
  position: absolute;
  top: 0;
  width: 20px;
}

.score-details-panel {
  max-width: min(760px, calc(100vw - 36px));
}

.score-details-summary {
  display: grid;
  gap: 14px;
}

.score-details-summary p {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  margin: 0;
}

.score-details-summary .score-details-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.score-details-total {
  align-items: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
}

.score-details-total span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-details-total strong {
  font-size: 1.6rem;
}

.score-detail-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.score-detail-row {
  background: rgba(5, 6, 6, 0.24);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

.score-detail-row-main {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.score-detail-row-main span {
  color: var(--text);
  font-weight: 800;
}

.score-detail-row-main strong {
  color: var(--accent-2);
  white-space: nowrap;
}

.score-detail-bar {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  height: 7px;
  margin: 10px 0 8px;
  overflow: hidden;
}

.score-detail-bar span {
  background: linear-gradient(90deg, #e85d3f, #f2bd5c, #63d483);
  display: block;
  height: 100%;
}

.score-detail-row p,
.score-details-balance p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  margin: 0;
}

.score-details-balance,
.score-details-recommendations {
  margin-top: 16px;
}

.score-details-balance {
  display: grid;
  gap: 6px;
}

.score-details-balance h4,
.score-details-recommendations h4 {
  color: var(--accent-2);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.score-details-recommendations ul {
  color: var(--text);
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.icon-triangle {
  height: 24px;
  width: 24px;
}

.icon-triangle::before {
  border-style: solid;
  content: "";
  display: block;
  height: 0;
  width: 0;
}

.icon-triangle-a::before {
  border-color: #f1f4ef transparent transparent #f1f4ef;
  border-width: 12px;
}

.icon-triangle-b::before {
  border-color: #f1f4ef #f1f4ef transparent transparent;
  border-width: 12px;
}

.icon-triangle-c::before {
  border-color: transparent transparent #f1f4ef #f1f4ef;
  border-width: 12px;
}

.icon-triangle-d::before {
  border-color: transparent #f1f4ef #f1f4ef transparent;
  border-width: 12px;
}

.workbench-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  min-height: 0;
}

.track-stage {
  min-width: 0;
  min-height: 0;
}

.canvas-zone {
  align-items: flex-start;
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 22px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #0d0f11;
  background-size: 32px 32px;
}

.canvas-stack {
  display: grid;
  gap: 8px;
  width: min(100%, 900px, calc((100vh - 230px) * 1.5));
}

#trackCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  image-rendering: pixelated;
  border: 1px solid rgba(241, 244, 239, 0.28);
  background: #050606;
}

.under-canvas-bar {
  background: transparent;
  display: grid;
  gap: 8px;
  padding: 0;
}

.meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-pill {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: inline-flex;
  font-weight: 800;
  gap: 7px;
  letter-spacing: 0.02em;
  min-height: 38px;
  padding: 8px 12px;
}

.meta-pill::before {
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 10px;
  width: 10px;
}

.meta-pill-ok {
  background: rgba(42, 166, 82, 0.28);
  border-color: rgba(95, 226, 133, 0.78);
  box-shadow: inset 0 0 0 1px rgba(95, 226, 133, 0.18), 0 0 10px rgba(42, 166, 82, 0.12);
  color: #effff3;
}

.meta-pill-ok::before {
  background: #46df74;
  box-shadow: 0 0 8px rgba(70, 223, 116, 0.72);
}

.meta-pill-error {
  background: rgba(184, 50, 38, 0.34);
  border-color: rgba(255, 126, 99, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 126, 99, 0.18), 0 0 10px rgba(184, 50, 38, 0.14);
  color: #fff2ed;
}

.meta-pill-error::before {
  background: #ff5f46;
  box-shadow: 0 0 8px rgba(255, 95, 70, 0.68);
}

.meta-pill-disabled {
  background: rgba(126, 137, 137, 0.16);
  border-color: rgba(176, 190, 190, 0.28);
  color: rgba(213, 223, 223, 0.58);
}

.meta-pill-disabled::before {
  background: rgba(176, 190, 190, 0.5);
}

.meta-pill-neutral::before {
  background: var(--muted);
}

.canvas-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.canvas-actions button.is-active,
#fillBtn.is-active,
#moveSelectionBtn.is-active {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(242, 189, 92, 0.45);
}

#showTemplateBtn.is-template-ready:not(:disabled) {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(242, 189, 92, 0.55), 0 0 0 1px rgba(242, 189, 92, 0.18);
}

#showTemplateBtn.is-template-ready:not(:disabled):not(.is-active) {
  background: #2f332b;
  color: #ffe3a3;
}

#randomDesignBtn:not(:disabled) {
  border-color: rgba(242, 189, 92, 0.56);
  box-shadow: inset 0 0 0 1px rgba(242, 189, 92, 0.34);
}

#randomDesignBtn:not(:disabled):hover {
  background: #2f332b;
  color: #ffe3a3;
}

#lineToolBtn.is-active,
#arcToolBtn.is-active {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(242, 189, 92, 0.45), 0 0 0 1px rgba(242, 189, 92, 0.16);
}

.mirror-tool {
  align-items: stretch;
  background: #273038;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  grid-template-rows: auto 1fr;
  min-height: 38px;
  overflow: hidden;
  padding: 4px 6px 5px;
}

.mirror-label {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.mirror-actions {
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr 1fr;
  min-height: 17px;
}

.mirror-mini-btn {
  align-items: center;
  border-radius: 5px;
  display: inline-flex;
  font-size: 0.86rem;
  font-weight: 900;
  justify-content: center;
  line-height: 1;
  min-height: 0;
  min-width: 0;
  padding: 0 2px;
}

.tool-dock {
  border-left: 1px solid var(--line);
  background: #15191d;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.dock-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(39, 48, 56, 0.42);
  padding: 12px;
}

.dock-section h3 {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.dock-section h3[data-i18n="adjustTools"] {
  font-size: 0.72rem;
  letter-spacing: 0.045em;
  white-space: nowrap;
}

.dock-title-row {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 0 0 10px;
}

.dock-title-row h3 {
  margin: 0;
}

.auto-shoulders-btn {
  border-radius: 999px;
  color: #dceef8;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  min-height: 28px;
  padding: 6px 10px;
  text-transform: uppercase;
  white-space: nowrap;
}

.auto-shoulders-btn:hover {
  border-color: rgba(88, 166, 201, 0.74);
  box-shadow: inset 0 0 0 1px rgba(88, 166, 201, 0.22);
}

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

.drawing-tool-grid .tool-btn {
  min-height: 46px;
  padding: 6px 7px;
}

.drawing-tool-grid .tool-btn span:not(.tool-icon) {
  font-size: 0.82rem;
  line-height: 1;
}

.drawing-tool-grid .tool-icon {
  height: 16px;
  width: 16px;
}

.drawing-tool-grid .tool-hint {
  font-size: 0.62rem;
  min-height: 34px;
  padding: 5px 7px;
}

.accessory-select-btn {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  padding-left: 6px;
  padding-right: 6px;
  white-space: pre-line;
}

.remove-shoulders-btn {
  font-size: 0.68rem;
  font-weight: 500;
}

.print-canvas-btn {
  font-size: 0.68rem;
  font-weight: 700;
}

.triangle-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.triangle-btn {
  min-width: 0;
  padding: 7px;
}

@media (max-width: 860px) {
  .editor-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .track-rail {
    height: auto;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .track-list {
    max-height: 220px;
  }

  .workbench {
    height: auto;
    min-height: 100vh;
  }

  .workbench-bar,
  .track-title-block,
  .workbench-main {
    grid-template-columns: 1fr;
  }

  .track-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .title-actions,
  .canvas-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .canvas-zone {
    overflow: auto;
  }

  .canvas-stack {
    width: min(100%, 900px);
  }

  .tool-dock {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
