/* ============================================================
   Straßen-Skizze · design tokens
   Type + core colours follow the captured target:
   system sans stack, #0a0a0a ink, #737373 muted, white base.
   ============================================================ */
:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
    "Segoe UI Symbol", "Noto Color Emoji";
  --ink: #0a0a0a;
  --ink-soft: #2d2d2d;
  --muted: #737373;
  --muted-strong: #5f5b54;
  --bg: #ffffff;
  --surface: #faf9f7;
  --surface-2: #f3f1ec;
  --line: #e5e5e5;
  --line-strong: #d6d2c8;
  --line-warm: #eae6dd;
  --canvas: #e9e6df;
  --accent: #1d4ed8;
  --accent-soft: #eff4ff;
  --danger: #b42318;
  --danger-soft: #fdf1ef;
  --success: #2f7a4b;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(15, 13, 9, 0.05);
  --shadow-sm: 0 4px 14px rgba(24, 21, 15, 0.07);
  --shadow-md: 0 12px 34px rgba(24, 21, 15, 0.12);
  --shadow-lg: 0 30px 80px rgba(20, 17, 12, 0.22);
  --header-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

html,
body {
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.36;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

img,
svg {
  display: block;
}

::selection {
  background: var(--ink);
  color: #ffffff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #d5d0c6 transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: #d5d0c6;
  border-radius: 99px;
  border: 2px solid #ffffff;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

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

.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 560;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}

.btn--primary {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.btn--primary:hover:not(:disabled) {
  background: #262626;
  border-color: #262626;
}

.btn--ghost {
  background: #ffffff;
  border-color: var(--line-warm);
  color: var(--ink-soft);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.btn--danger:hover:not(:disabled) {
  background: #981b12;
}

.btn--danger-ghost {
  background: #ffffff;
  border-color: #f0d2cd;
  color: var(--danger);
}

.btn--danger-ghost:hover:not(:disabled) {
  background: var(--danger-soft);
}

.btn--sm {
  height: 30px;
  padding: 0 9px;
  font-size: 11.5px;
  border-radius: var(--radius-xs);
}

.btn--lg {
  height: 44px;
  font-size: 13px;
  border-radius: 9px;
}

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

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: #444444;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
  flex: none;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn--xs {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  color: #6b665e;
}

.icon-btn.is-active {
  background: var(--ink);
  color: #ffffff;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: var(--ink);
}

/* ---------- shell + top bar ---------- */

.app-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.appbar {
  height: var(--header-h);
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line-warm);
  position: relative;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand-mark {
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.brand-copy span {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
}

.appbar-project {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 14px;
  min-width: 0;
}

.project-title {
  width: clamp(150px, 22vw, 340px);
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 5px;
  margin-left: -6px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  max-width: 340px;
}

.project-title:hover {
  background: var(--surface);
}

.project-title:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.08);
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
  padding-left: 0;
}

.save-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}

.save-state--saving .save-dot {
  background: #c98a2e;
}

.save-state--error .save-dot {
  background: var(--danger);
}

.appbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

.history-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-warm);
  border-radius: var(--radius-sm);
  background: #ffffff;
  overflow: hidden;
  margin-right: 2px;
}

.history-group .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 0;
}

.history-group .icon-btn + .icon-btn {
  border-left: 1px solid var(--line-warm);
}

.tablet-settings {
  display: none;
}

/* ---------- main layout ---------- */

.app-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr) 312px;
  overflow: hidden;
}

.sidebar,
.inspector-pane {
  min-height: 0;
  overflow: hidden;
  background: #ffffff;
}

.sidebar {
  border-right: 1px solid var(--line-warm);
}

.inspector-pane {
  border-left: 1px solid var(--line-warm);
}

/* ---------- palette ---------- */

.palette {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #ffffff;
}

.palette-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 16px 12px;
}

.palette-head h2 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-top: 3px;
}

.segmented {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 9px;
}

.segmented button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 560;
  color: #6f6a62;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 17, 12, 0.1);
}

.palette-tabs {
  margin: 0 16px 10px;
}

.tab-count {
  font-size: 9px;
  color: var(--muted);
  background: rgba(10, 10, 10, 0.05);
  border-radius: 99px;
  padding: 1px 5px;
  line-height: 1.5;
}

.segmented button.is-active .tab-count {
  background: var(--surface-2);
}

.palette-search {
  margin: 0 16px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-warm);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #8d887f;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.palette-search:focus-within {
  border-color: #bdb7aa;
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.04);
}

.palette-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
  outline: none;
}

.palette-search input::placeholder {
  color: #a19c93;
}

.palette-search button {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #8d887f;
}

.palette-search button:hover {
  background: var(--surface-2);
}

.palette-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 14px;
}

.palette-group + .palette-group {
  margin-top: 2px;
}

.palette-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 1px 8px;
  color: #857f75;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.palette-group-head > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.palette-group-head .count {
  font-size: 8.5px;
  letter-spacing: 0;
  background: var(--surface-2);
  border-radius: 99px;
  padding: 1px 5px;
  color: #8d887f;
}

.palette-group-head:hover {
  color: var(--ink);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.palette-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-height: 92px;
  padding: 9px 5px 8px;
  border: 1px solid var(--line-warm);
  border-radius: 9px;
  background: #ffffff;
  text-align: center;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease,
    box-shadow 0.14s ease;
}

.palette-card:hover {
  border-color: #c7c1b4;
  background: #fdfcfa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 21, 15, 0.07);
}

.palette-card:active {
  transform: translateY(0);
}

.palette-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  color: var(--ink);
}

.palette-symbol svg {
  width: 100%;
  height: 100%;
  max-height: 44px;
}

.palette-symbol--marking {
  height: 38px;
}

.palette-symbol--marking svg {
  max-height: 38px;
  width: 66%;
}

.palette-name {
  font-size: 11px;
  font-weight: 520;
  line-height: 1.22;
  color: #3d3a34;
  display: flex;
  align-items: center;
  min-height: 25px;
  word-break: break-word;
}

.palette-add {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #ffffff;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.palette-card:hover .palette-add {
  opacity: 1;
  transform: scale(1);
}

.palette-text-icon {
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  color: #4c4842;
}

.palette-measure-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4c4842;
}

.palette-none {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--muted);
  padding: 14px 4px;
  text-align: center;
}

.palette-foot {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-warm);
  color: #8a857c;
  font-size: 10.5px;
  line-height: 1.45;
}

.palette-foot svg {
  flex: none;
  margin-top: 1px;
  color: #a39c90;
}

/* ---------- inspector ---------- */

.inspector {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #ffffff;
}

.inspector-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 17px 16px 13px;
  border-bottom: 1px solid var(--line-warm);
}

.inspector-head h2 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-top: 3px;
}

.inspector-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.section {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line-warm);
}

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

.section-head h3 {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7c766b;
}

.section-desc {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.45;
  color: #8b857b;
}

.section-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 11px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-label {
  font-size: 11px;
  font-weight: 550;
  color: #5f5a52;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.field-hint {
  font-size: 9px;
  color: #a19c93;
  font-weight: 400;
  text-align: right;
}

.field input,
.field select {
  width: 100%;
  height: 33px;
  padding: 0 9px;
  border: 1px solid var(--line-warm);
  border-radius: 7px;
  background: #ffffff;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.field input:hover {
  border-color: #d2ccc0;
}

.field input:focus {
  border-color: #b9b2a5;
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.04);
}

.field input::placeholder {
  color: #aea89e;
}

.input-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-suffix input {
  padding-right: 26px;
}

.input-suffix > span {
  position: absolute;
  right: 9px;
  font-size: 10px;
  color: #989288;
  pointer-events: none;
}

.slider-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 10.5px;
  color: #5f5a52;
  font-weight: 550;
}

.slider-value {
  font-size: 10.5px;
  color: #7c766b;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.slider-field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  background: transparent;
  cursor: pointer;
}

.slider-field input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: #e8e4db;
  border-radius: 99px;
}

.slider-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  margin-top: -5px;
}

.slider-field input[type="range"]::-moz-range-track {
  height: 4px;
  background: #e8e4db;
  border-radius: 99px;
}

.slider-field input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.transform-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.transform-buttons .btn {
  padding: 0 3px;
  gap: 3px;
}

.mirror-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mirror-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line-warm);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
  font-size: 10.5px;
  color: #44403a;
  line-height: 1.25;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.mirror-btn:hover {
  border-color: #c7c1b4;
  background: var(--surface);
}

.mirror-btn > svg {
  flex: none;
  color: #55504a;
}

.mirror-btn > span:not(.active-flag) {
  flex: 1;
}

.mirror-btn.is-active {
  border-color: #b3c5f5;
  background: var(--accent-soft);
}

.mirror-btn.is-active > svg {
  color: var(--accent);
}

.active-flag {
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  background: #ffffff;
  border: 1px solid #ccd9f8;
  border-radius: 99px;
  padding: 1px 5px;
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(10, 10, 10, 0.18);
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.color-swatch:hover {
  transform: scale(1.08);
}

.color-swatch.is-active {
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--ink);
}

.color-custom {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px dashed #b9b2a5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7c766b;
  cursor: pointer;
  overflow: hidden;
}

.color-custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.toggle-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  cursor: pointer;
}

.toggle-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.toggle-label {
  font-size: 11px;
  font-weight: 520;
  color: #44403a;
}

.toggle-desc {
  font-size: 9.5px;
  color: #969086;
  line-height: 1.35;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.toggle-track {
  flex: none;
  width: 32px;
  height: 19px;
  border-radius: 99px;
  background: #e4dfd5;
  position: relative;
  transition: background 0.16s ease;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  transition: transform 0.16s ease;
}

.toggle-row input:checked + .toggle-track {
  background: var(--ink);
}

.toggle-row input:checked + .toggle-track .toggle-thumb {
  transform: translateX(13px);
}

.toggle-row input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.layer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.inspector-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
}

.selection-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-warm);
}

.selection-symbol {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid var(--line-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4d4841;
  flex: none;
}

.selection-dot {
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
}

.selection-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.selection-meta strong {
  font-size: 11.5px;
  font-weight: 600;
}

.selection-meta span {
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 1px;
}

.background-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.background-thumb {
  width: 62px;
  height: 46px;
  border-radius: 7px;
  border: 1px solid var(--line-warm);
  background: var(--surface-2);
  overflow: hidden;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.background-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.background-thumb-placeholder {
  color: #9a9388;
}

.background-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.background-meta strong {
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.background-meta span {
  font-size: 9.5px;
  color: var(--muted);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-vehicles-btn {
  margin-top: 7px;
  justify-content: flex-start;
  gap: 7px;
}

.measure-readout {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line-warm);
}

.measure-readout strong {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.measure-readout span {
  font-size: 10px;
  color: var(--muted);
}

.layer-list {
  display: flex;
  flex-direction: column;
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid var(--line-warm);
  border-radius: 8px;
  background: #ffffff;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px 3px;
  border-bottom: 1px solid #f1eee8;
}

.layer-row:last-child {
  border-bottom: 0;
}

.layer-row.is-hidden {
  opacity: 0.5;
}

.layer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 3px;
  text-align: left;
  border-radius: 5px;
}

.layer-main:hover {
  background: var(--surface);
}

.layer-type-icon {
  width: 21px;
  height: 21px;
  border-radius: 5px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5e594f;
  flex: none;
}

.layer-letter {
  font-size: 9px;
  font-weight: 750;
  color: var(--ink);
}

.layer-name {
  font-size: 10.5px;
  color: #44403a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  gap: 4px;
  align-items: baseline;
}

.layer-name em {
  font-style: normal;
  font-size: 9px;
  color: var(--muted);
}

.inspector-empty {
  font-size: 11px;
  color: var(--muted);
  padding: 8px 0;
}

.inspector-tip {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 9.5px;
  color: #979187;
  line-height: 1.4;
}

.inspector-tip svg {
  flex: none;
  margin-top: 1px;
}

.inspector-footnote {
  font-size: 9.5px;
  color: #989288;
  line-height: 1.45;
}

/* ---------- canvas ---------- */

.canvas-column {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--canvas);
  overflow: hidden;
}

.canvas-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background-color: var(--canvas);
  overscroll-behavior: none;
}

.canvas-column.tool-pan .canvas-viewport {
  cursor: grab;
}

.canvas-column.tool-pan .canvas-viewport:active {
  cursor: grabbing;
}

.canvas-viewport.is-pan-ready {
  cursor: grab;
}

.stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 18px 48px rgba(38, 32, 22, 0.22),
    0 0 0 1px rgba(30, 26, 20, 0.08);
}

.stage-paper {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #fbfaf6;
}

.stage-map-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
}

.stage-map-placeholder,
.stage-map-placeholder .map-placeholder {
  width: 100%;
  height: 100%;
}

.map-placeholder {
  width: 100%;
  height: 100%;
}

.stage-map-dim {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stage-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, rgba(10, 10, 10, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(10, 10, 10, 0.08) 1px, transparent 1px);
}

.stage-items {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.stage-items--passive {
  pointer-events: none;
}

.stage-items--passive .scene-item {
  pointer-events: none;
}

.scene-item {
  position: absolute;
  transform-origin: 50% 50%;
  touch-action: none;
  cursor: grab;
  will-change: transform;
}

/* A vehicle on a fitted map can become very small. Keep a comfortable
   screen-sized tap target around it so it stays selectable. */
.scene-item::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, calc(30px * var(--inv, 1)));
  height: max(100%, calc(30px * var(--inv, 1)));
  transform: translate(-50%, -50%);
  border-radius: 999px;
}

.scene-item:active {
  cursor: grabbing;
}

.scene-item:hover {
  filter: drop-shadow(0 2px 5px rgba(20, 17, 12, 0.22));
}

.scene-item.is-locked {
  cursor: default;
}

.scene-item.is-locked:hover {
  filter: none;
}

.scene-item.is-selected::after {
  content: "";
  position: absolute;
  inset: calc(-4px * var(--inv, 1));
  border: calc(1.5px * var(--inv, 1)) solid var(--accent);
  border-radius: calc(5px * var(--inv, 1));
  box-shadow: 0 0 0 calc(1.5px * var(--inv, 1)) rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

.vehicle-svg,
.annotation-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.item-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  background: rgba(10, 10, 10, 0.86);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.02em;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24);
  z-index: 2;
}

.item-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.item-label {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.9);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.75);
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(20, 17, 12, 0.24);
  font-variant-numeric: tabular-nums;
}

.item-label.is-selected {
  background: var(--accent);
  border-color: #ffffff;
}

.marker-text {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #ffffff;
  font-weight: 750;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
}

.scene-item--text {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #d9d3c7;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(24, 21, 15, 0.1);
  padding: 4px 8px;
  white-space: nowrap;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  font-family: var(--font-sans);
}

.scene--arrow,
.scene--il {
  pointer-events: auto;
}

.scene-item--annotation.scene--marker,
.scene-item--annotation.scene--impact {
  cursor: grab;
}

.direction-arrows {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.direction-arrow {
  position: absolute;
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.8));
  opacity: 0.9;
}

.stage-measures {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.measure-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.measure-label {
  position: absolute;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-weight: 650;
  font-family: var(--font-sans);
  line-height: 1;
  box-shadow: 0 2px 6px rgba(20, 17, 12, 0.12);
  white-space: nowrap;
  z-index: 7;
}

.measure-label.is-preview {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.selection-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 8;
}

.rotate-handle {
  position: absolute;
  z-index: 9;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(20, 17, 12, 0.24);
  cursor: grab;
  touch-action: none;
  padding: 0;
}

.rotate-handle:hover {
  background: var(--accent-soft);
}

.rotate-handle:active {
  cursor: grabbing;
  background: var(--accent);
  color: #ffffff;
}

/* canvas floating controls */

.canvas-toolbar,
.zoom-pill {
  position: absolute;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(28, 24, 18, 0.09);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  z-index: 15;
}

.canvas-toolbar {
  left: 14px;
}

.zoom-pill {
  right: 14px;
}

.tool-btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 540;
  color: #56514a;
  transition: background 0.14s ease, color 0.14s ease;
}

.tool-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.tool-btn.is-active {
  background: var(--ink);
  color: #ffffff;
}

.tool-btn--icon {
  width: 32px;
  padding: 0;
  justify-content: center;
}

.toolbar-divider {
  width: 1px;
  height: 19px;
  background: var(--line-warm);
  margin: 0 3px;
  flex: none;
}

.zoom-pill > button {
  height: 32px;
  min-width: 30px;
  padding: 0 7px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #56514a;
  font-size: 11px;
}

.zoom-pill > button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.zoom-pill .zoom-value {
  min-width: 48px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.north-arrow {
  position: absolute;
  top: 72px;
  right: 20px;
  width: 48px;
  padding: 5px 0 3px;
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid rgba(28, 24, 18, 0.09);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-sm);
  z-index: 12;
  pointer-events: none;
}

.north-arrow span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #4c4740;
  margin-top: -1px;
}

.scale-bar {
  position: absolute;
  left: 18px;
  bottom: 18px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(28, 24, 18, 0.09);
  border-radius: 7px;
  padding: 7px 10px 6px;
  box-shadow: var(--shadow-sm);
  z-index: 12;
  pointer-events: none;
}

.scale-bar-line {
  height: 7px;
  position: relative;
  border-left: 1.5px solid var(--ink);
  border-right: 1.5px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.scale-bar-tick {
  position: absolute;
  bottom: 0;
  width: 1.5px;
  height: 7px;
  background: var(--ink);
}

.scale-bar-tick--start {
  left: 0;
}

.scale-bar-tick--end {
  right: 0;
}

.scale-bar-label {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 600;
  color: #4c4740;
  letter-spacing: 0.01em;
}

.canvas-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(340px, calc(100% - 32px));
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(28, 24, 18, 0.1);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  text-align: center;
  z-index: 11;
}

.canvas-empty-mark {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  border-radius: 12px;
  background: var(--ink);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-empty h3 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.canvas-empty p {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
}

.canvas-empty-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 13px;
  flex-wrap: wrap;
}

.canvas-empty-help {
  margin-top: 11px;
}

.drop-overlay {
  position: absolute;
  inset: 12px;
  z-index: 30;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--accent);
  pointer-events: none;
}

.drop-overlay strong {
  font-size: 15px;
  color: var(--ink);
}

.drop-overlay span {
  font-size: 11px;
  color: var(--muted);
}

.canvas-statusbar {
  flex: none;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  background: #ffffff;
  border-top: 1px solid var(--line-warm);
  font-size: 10px;
  color: #7d776e;
  white-space: nowrap;
}

.statusbar-left,
.statusbar-right {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.statusbar-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #bdb6aa;
}

.statusbar-hint {
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #938c81;
}

.statusbar-scale {
  font-variant-numeric: tabular-nums;
}

.statusbar-help {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #7d776e;
  border-left: 1px solid var(--line-warm);
  padding-left: 9px;
}

.statusbar-help:hover {
  color: var(--ink);
}

/* ---------- sheets ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(22, 19, 14, 0.38);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.16s ease;
}

.sheet-panel {
  background: #ffffff;
  width: 100%;
  max-height: 87dvh;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -18px 60px rgba(20, 17, 12, 0.24);
  animation: slide-up 0.22s cubic-bezier(0.24, 0.8, 0.3, 1);
}

.sheet-panel .palette,
.sheet-panel .inspector {
  height: 100%;
  max-height: 87dvh;
}

.sheet-panel .palette-head {
  padding-top: 16px;
}

/* ---------- selection bar + mobile nav ---------- */

.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  background: var(--ink);
  color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(15, 13, 9, 0.34);
  z-index: 2600;
  max-width: calc(100vw - 20px);
  animation: slide-up 0.18s ease;
}

.selection-bar-label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.selection-bar-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 750;
  flex: none;
}

.selection-bar-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.selection-bar-label > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.selection-bar-label strong {
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.selection-bar-label em {
  font-style: normal;
  font-size: 8.5px;
  color: #b8b3a9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.selection-bar-actions {
  display: flex;
  align-items: center;
  gap: 1px;
}

.selection-bar-actions > button {
  width: 31px;
  height: 31px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.82);
  transition: background 0.13s ease, color 0.13s ease;
}

.selection-bar-actions > button:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

.selection-bar-actions > button.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.selection-bar-actions > button.danger {
  color: #ffb4a2;
}

.selection-bar-actions > .selection-details {
  width: auto;
  gap: 5px;
  padding: 0 9px;
  background: #ffffff;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  margin-left: 3px;
}

.selection-bar-actions > .selection-details:hover {
  background: #f0ede7;
  color: var(--ink);
}

.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2500;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line-warm);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(20, 17, 12, 0.06);
}

.mobile-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 46px;
  border-radius: 9px;
  font-size: 9.5px;
  font-weight: 550;
  color: #635d55;
  transition: background 0.14s ease, color 0.14s ease;
}

.mobile-nav button:hover,
.mobile-nav button:active {
  background: var(--surface-2);
  color: var(--ink);
}

/* ---------- banners + toast ---------- */

.mode-banner {
  position: fixed;
  top: calc(var(--header-h) + 64px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2700;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100vw - 24px);
  padding: 8px 9px 8px 12px;
  border-radius: 9px;
  background: var(--ink);
  color: #ffffff;
  font-size: 11.5px;
  box-shadow: 0 12px 30px rgba(15, 13, 9, 0.3);
}

.mode-banner span {
  min-width: 0;
}

.mode-banner button {
  flex: none;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-size: 10px;
  font-weight: 550;
}

.mode-banner button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.toast {
  position: fixed;
  top: calc(var(--header-h) + 64px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2650;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px 9px 9px;
  border-radius: 9px;
  background: var(--ink);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 500;
  box-shadow: 0 14px 34px rgba(15, 13, 9, 0.3);
  max-width: calc(100vw - 24px);
  animation: toast-in 0.2s ease;
}

.toast-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* ---------- modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(22, 19, 14, 0.44);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  animation: fade-in 0.16s ease;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 0.2s cubic-bezier(0.24, 0.8, 0.3, 1);
}

.modal-card--wide {
  width: min(740px, 100%);
}

.modal-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 12px;
}

.modal-head h2 {
  font-size: 30px;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-top: 5px;
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 24px 22px;
}

.modal-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 24px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-warm);
  background: var(--surface);
}

.dialog-lead {
  font-size: 15px;
  line-height: 1.55;
  color: #44403a;
  margin-bottom: 14px;
}

.dialog-note {
  font-size: 11px;
  line-height: 1.5;
  color: #8b857b;
  margin-top: 10px;
}

.form-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 7px;
  line-height: 1.4;
}

/* help */

.help-intro p {
  font-size: 16px;
  line-height: 1.6;
  color: #4d4841;
  max-width: 62ch;
}

.help-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.help-step {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--line-warm);
  border-radius: 10px;
  background: var(--surface);
}

.help-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex: none;
  margin-top: 1px;
}

.help-step h3 {
  font-size: 12.5px;
  font-weight: 650;
  margin-bottom: 3px;
}

.help-step p {
  font-size: 11.5px;
  line-height: 1.5;
  color: #7b756b;
}

.help-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.help-feature {
  padding: 12px;
  border: 1px solid var(--line-warm);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-feature > svg {
  color: #6f6a62;
  margin-bottom: 2px;
}

.help-feature strong {
  font-size: 11.5px;
  font-weight: 650;
}

.help-feature p {
  font-size: 10.5px;
  line-height: 1.45;
  color: #8b857b;
}

.help-shortcuts {
  margin-top: 18px;
}

.help-shortcuts > h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7c766b;
  margin-bottom: 8px;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 14px;
}

.shortcut-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 4px 0;
  border-bottom: 1px solid #f3f0ea;
  min-width: 0;
}

.shortcut-row kbd {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid #e4dfd5;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 2px 4px;
  white-space: nowrap;
  color: #56514a;
  flex: none;
}

.shortcut-row span {
  font-size: 10px;
  color: #7b756b;
  line-height: 1.3;
}

.help-note {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fbf6ec;
  border: 1px solid #ede1c9;
  color: #7b6a4d;
}

.help-note svg {
  flex: none;
  margin-top: 1px;
}

.help-note p {
  font-size: 10.5px;
  line-height: 1.5;
}

/* export */

.export-preview {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line-warm);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 13px;
  align-items: center;
}

.export-preview-art {
  position: relative;
  width: 92px;
  height: 68px;
  flex: none;
  border-radius: 7px;
  overflow: hidden;
  background: #f1eee7;
  border: 1px solid #e3ddd1;
}

.export-preview-road {
  position: absolute;
  left: -10%;
  right: -10%;
  top: 38%;
  height: 28%;
  background: #ffffff;
  border-top: 1px solid #d9d3c6;
  border-bottom: 1px solid #d9d3c6;
  transform: rotate(-8deg);
}

.export-preview-pin {
  position: absolute;
  left: 46%;
  top: 26%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.export-preview-badge {
  position: absolute;
  right: 5px;
  bottom: 5px;
  font-size: 7px;
  font-weight: 700;
  background: #ffffff;
  padding: 2px 4px;
  border-radius: 3px;
  color: #5a554d;
  letter-spacing: 0.05em;
}

.export-preview h3 {
  font-size: 12.5px;
  font-weight: 650;
  margin-bottom: 2px;
}

.export-preview p {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 6px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 10.5px;
  color: #5f5a52;
  line-height: 1.4;
  cursor: pointer;
}

.check-row input {
  width: 14px;
  height: 14px;
  margin: 1px 0 0;
  accent-color: var(--ink);
  flex: none;
}

.export-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 11px;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9b958a;
}

.export-divider::before,
.export-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-warm);
}

.export-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.file-label {
  position: relative;
  overflow: hidden;
}

.file-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.export-note {
  margin-top: 10px;
  font-size: 10px;
  color: #948e84;
  line-height: 1.5;
}

.calibration-preview {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid #d7e1fb;
  color: #2b4a94;
  font-size: 11px;
}

/* ---------- animations ---------- */

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes modal-in {
  from {
    transform: translateY(10px) scale(0.99);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes toast-in {
  from {
    transform: translate(-50%, -6px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* ---------- responsive ---------- */

@media (max-width: 1240px) {
  .app-main {
    grid-template-columns: 276px minmax(0, 1fr);
  }

  .inspector-pane {
    display: none;
  }

  .selection-bar {
    display: flex;
  }

  .tablet-settings {
    display: inline-flex;
  }

  .sheet-backdrop {
    align-items: stretch;
    justify-content: flex-end;
  }

  .sheet-panel {
    width: min(360px, 100%);
    height: 100%;
    max-height: none;
    border-radius: 0;
    animation: sheet-in-right 0.22s cubic-bezier(0.24, 0.8, 0.3, 1);
  }

  .sheet-panel .palette,
  .sheet-panel .inspector {
    max-height: none;
  }

  @keyframes sheet-in-right {
    from {
      transform: translateX(24px);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
}

@media (min-width: 900px) and (max-width: 1240px) {
  .selection-bar {
    bottom: 44px;
  }
}

@media (max-width: 1099px) {
  .app-main {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .sidebar .palette-head {
    padding-top: 15px;
  }

  .brand-copy span {
    display: none;
  }

  .appbar-project {
    margin-left: 4px;
  }

  .project-title {
    width: clamp(120px, 17vw, 240px);
  }
}

@media (max-width: 899px) {
  :root {
    --header-h: 58px;
  }

  .appbar {
    padding: 0 12px;
    gap: 8px;
  }

  .brand-copy strong {
    font-size: 13.5px;
  }

  .appbar-project {
    display: none;
  }

  .appbar-actions {
    gap: 4px;
  }

  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .tablet-settings {
    display: none;
  }

  .selection-bar {
    display: flex;
    bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .mobile-nav {
    display: grid;
  }

  .canvas-statusbar {
    display: none;
  }

  .north-arrow {
    display: none;
  }

  .scale-bar {
    left: 12px;
    bottom: 12px;
    padding: 5px 8px 4px;
  }

  .canvas-toolbar {
    top: 10px;
    left: 10px;
  }

  .zoom-pill {
    top: 10px;
    right: 10px;
  }

  .tool-btn span {
    display: none;
  }

  .tool-btn {
    width: 32px;
    padding: 0;
    justify-content: center;
  }

  .canvas-empty {
    width: min(300px, calc(100% - 28px));
    padding: 18px;
  }

  .canvas-empty h3 {
    font-size: 15px;
  }

  .sheet-backdrop {
    align-items: flex-end;
    justify-content: center;
  }

  .sheet-panel {
    width: 100%;
    height: auto;
    max-height: 88dvh;
    border-radius: 18px 18px 0 0;
    animation: slide-up 0.22s cubic-bezier(0.24, 0.8, 0.3, 1);
  }

  .sheet-panel .palette,
  .sheet-panel .inspector {
    max-height: 88dvh;
  }

  .mode-banner {
    top: calc(var(--header-h) + 58px);
    font-size: 10.5px;
  }

  .toast {
    top: calc(var(--header-h) + 58px);
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card,
  .modal-card--wide {
    width: 100%;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    animation: slide-up 0.22s cubic-bezier(0.24, 0.8, 0.3, 1);
  }

  .modal-head {
    padding: 18px 18px 10px;
  }

  .modal-head h2 {
    font-size: 24px;
  }

  .modal-body {
    padding: 4px 18px 18px;
  }

  .modal-foot {
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  }

  .help-feature-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-copy strong {
    font-size: 13px;
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .appbar-upload span,
  .appbar-help span,
  .appbar-export span {
    display: none;
  }

  .appbar-upload,
  .appbar-help,
  .appbar-export {
    width: 36px;
    padding: 0;
  }

  .history-group .redo-btn {
    display: none;
  }

  .history-group {
    border: 0;
    background: transparent;
  }

  .history-group .icon-btn {
    border: 1px solid var(--line-warm) !important;
    border-radius: var(--radius-sm);
    background: #ffffff;
  }

  .selection-bar {
    gap: 4px;
    padding: 5px 5px 5px 8px;
    border-radius: 11px;
  }

  .selection-bar-label {
    max-width: 96px;
  }

  .selection-bar-label strong {
    max-width: 72px;
  }

  .selection-bar-label em {
    max-width: 72px;
  }

  .selection-bar-actions > button {
    width: 28px;
    height: 29px;
  }

  .selection-bar-actions > .selection-details {
    padding: 0 7px;
  }

  .selection-bar-actions > .selection-details span {
    display: none;
  }

  .canvas-toolbar .toolbar-divider,
  .zoom-pill .toolbar-divider {
    display: none;
  }

  .north-arrow {
    display: none;
  }

  .scale-bar {
    display: none;
  }

  .zoom-pill .zoom-value {
    min-width: 42px;
  }

  .canvas-empty {
    top: 46%;
    padding: 16px;
  }

  .canvas-empty-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    margin-bottom: 8px;
  }

  .canvas-empty-actions .btn {
    flex: 1;
  }

  .export-row {
    grid-template-columns: 1fr;
  }

  .export-preview {
    align-items: flex-start;
  }

  .help-intro p {
    font-size: 14px;
  }

  .help-step {
    padding: 10px 11px;
  }

  .help-step p {
    font-size: 11px;
  }

  .mode-banner {
    width: calc(100vw - 20px);
    justify-content: flex-start;
    font-size: 10px;
    gap: 6px;
    padding: 7px 7px 7px 9px;
  }

  .mode-banner span {
    flex: 1;
    line-height: 1.3;
  }

  .toast {
    font-size: 10.5px;
    padding: 8px 10px 8px 8px;
  }
}

@media (max-width: 380px) {
  .brand-copy {
    display: none;
  }

  .selection-bar-label {
    max-width: 82px;
  }

  .selection-bar-actions > button {
    width: 27px;
  }
}

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   First-run start screen
   Uses the captured reference's scale: 72 / 30 / 16 px,
   a 520 px column, white base, #0a0a0a ink and #737373 muted.
   ============================================================ */
.welcome {
  height: 100%;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #ffffff;
  color: var(--ink);
  text-align: center;
}

.welcome-inner {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.welcome-title {
  margin: 0;
  font-size: 72px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.welcome-subtitle {
  margin: 8px 0 0;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.welcome-copy {
  max-width: 440px;
  margin: 8px 0 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
}

.welcome-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.welcome-primary {
  height: 48px;
  padding: 0 26px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  transition: background 140ms ease, transform 140ms ease;
}

.welcome-primary:hover {
  background: var(--ink-soft);
}

.welcome-primary:active {
  transform: translateY(1px);
}

.welcome-primary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.welcome-secondary {
  padding: 8px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.welcome-secondary:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  .welcome-title {
    font-size: 56px;
    white-space: normal;
  }

  .welcome-subtitle {
    font-size: 24px;
  }

  .welcome-copy {
    max-width: 340px;
  }
}

@media (max-height: 560px) {
  .welcome {
    align-items: flex-start;
    padding-top: 32px;
    padding-bottom: 32px;
  }
}
