:root {
  color-scheme: dark;
}
body {
  font-size: 13px;
  overflow: hidden;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.35;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #75b6df;
  outline-offset: 2px;
}
button,
input,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--bg);
}
input,
select {
  padding: 8px;
  min-width: 0;
}
input[type='number'] {
  width: 100%;
}
input[type='checkbox'] {
  accent-color: var(--accent);
}
input[type='range'] {
  accent-color: var(--accent);
  width: 100%;
  padding: 0;
}
input[type='color'] {
  height: 35px;
  width: 100%;
  padding: 3px;
}
a {
  color: #75b6df;
}
.btn {
  padding: 7px 11px;
  background: #2b323d;
  font-weight: 600;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: #39424f;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn.primary:hover:not(:disabled) {
  background: #ee5a5e;
}
.btn.small {
  font-size: 11px;
  padding: 6px 8px;
}
.btn.quiet {
  background: transparent;
}
.btn.square {
  min-width: 32px;
  padding: 5px 8px;
  font-size: 18px;
}
.btn.toggle[aria-pressed='true'] {
  background: #264038;
  border-color: #45735d;
  color: #a6e2bd;
}
.app-header {
  height: 66px;
  padding: 0 22px;
  gap: 28px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 210px;
}
.brand strong {
  font-size: 20px;
  letter-spacing: 0.3px;
}
.brand span {
  display: block;
  font-size: 9px;
  letter-spacing: 2.2px;
  color: var(--muted);
}
nav {
  align-self: stretch;
  align-items: center;
}
nav .tab {
  height: 100%;
  display: flex;
  align-items: center;
  text-decoration: none;
  font-size: 13px;
  border-radius: 0;
  white-space: nowrap;
}
.version {
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-left: auto;
}
.header-actions {
  display: flex;
  gap: 8px;
}
.projectbar {
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.title-label input {
  font-size: 18px;
  font-weight: 600;
  background: none;
  border-color: transparent;
  padding: 4px 0;
  width: 240px;
  box-shadow: none;
}
.title-label input:hover {
  border-bottom-color: var(--line);
}
.spacer {
  flex: 1;
}
.muted,
.fine {
  color: var(--muted);
}
.fine {
  font-size: 11px;
  line-height: 1.65;
}
.block {
  display: block;
}
.editor {
  display: grid;
  grid-template-columns: 274px minmax(350px, 1fr) 282px;
  height: calc(100dvh - 164px);
  max-height: calc(100dvh - 164px);
}
.catalogue-panel,
.inspector {
  background: var(--panel);
  min-height: 0;
  overflow: auto;
}
.catalogue-panel {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 0;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
h2 {
  font-size: 14px;
  margin: 0;
  font-weight: 650;
}
p {
  line-height: 1.6;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
}
.field input,
.field select {
  font-size: 13px;
  color: var(--ink);
  width: 100%;
}
.search input {
  width: 100%;
  font-size: 12px;
}
.catalogue-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  padding: 12px 0;
}
.piece-list {
  flex: 1;
  overflow: auto;
  min-height: 80px;
  margin: 0 -5px;
  padding: 0 5px;
}
.piece-card {
  width: 100%;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  text-align: left;
  background: #1c222a;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 10px;
  align-items: center;
  min-height: 82px;
}
.piece-card:hover {
  border-color: #77818e;
  background: #29323e;
}
.piece-card img,
.piece-card svg {
  width: 76px;
  height: 59px;
  object-fit: contain;
  pointer-events: none;
}
.piece-card strong {
  font-size: 12px;
  line-height: 1.35;
  display: block;
}
.piece-card small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
}
.piece-card .reference {
  color: #dcbb70;
}
.piece-card .add-symbol {
  color: var(--accent);
  font-size: 15px;
  float: right;
}
.pack-tools {
  display: flex;
  gap: 5px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.panel-foot {
  font-size: 10px;
  color: var(--muted);
  margin: 10px 0 14px;
}
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #20262e;
  flex-shrink: 0;
}
.tool-group {
  display: flex;
  gap: 4px;
}
.toolbar .btn {
  font-size: 11px;
}
.toolbar .square {
  font-size: 18px;
}
.canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #151a20;
  overflow: hidden;
}
#canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}
#canvas .piece {
  cursor: grab;
}
#canvas .piece:active {
  cursor: grabbing;
}
#canvas .selected-outline {
  pointer-events: none;
  stroke: #ee6468;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  fill: none;
}
#canvas .road-edge {
  stroke-width: 0.7;
  stroke: #7e858d;
}
.canvas-top {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.pill {
  font-size: 10px;
  padding: 5px 9px;
  border-radius: 5px;
  background: #273c34;
  color: #a4dfbc;
  border: 1px solid #3d6151;
}
.pill.open {
  background: #393124;
  color: #e6c47f;
  border-color: #635237;
}
.pill.subtle {
  background: #222933;
  color: #a2acb8;
  border-color: #343d49;
}
.canvas-bottom {
  position: absolute;
  bottom: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}
.canvas-bottom > span {
  color: #788492;
  font-size: 10px;
}
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  background: #202730;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px;
}
#zoom-level {
  min-width: 42px;
  text-align: center;
  font-size: 11px;
}
.zoom-controls .btn {
  background: transparent;
  border: 0;
  box-shadow: none;
}
.zoom-controls .btn:not(.square) {
  font-size: 11px;
}
.preview-bar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  flex-shrink: 0;
}
.preview-bar span,
.preview-bar label {
  font-size: 11px;
  color: var(--muted);
}
.preview-bar select {
  padding: 4px;
}
.preview-bar .btn {
  font-size: 12px;
}
.inspector {
  border-left: 1px solid var(--line);
}
.inspector-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 5px 8px;
}
.inspector-tabs .tab {
  font-size: 12px;
  border-radius: 0;
  padding: 12px;
}
.inspector-section {
  padding: 18px 17px;
  border-bottom: 1px solid var(--line);
}
.inspector-section h2 {
  margin-bottom: 16px;
}
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.metric-grid > div {
  padding: 12px;
  border-radius: 6px;
  background: #1a2027;
  border: 1px solid #303844;
}
.metric-grid strong {
  font-size: 23px;
  font-weight: 600;
  display: block;
}
.metric-grid span {
  font-size: 10px;
  color: var(--muted);
}
.measurements {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 18px 0;
}
.measurements dt {
  font-size: 11px;
  color: var(--muted);
}
.measurements dd {
  margin: 0 0 8px;
  font-size: 13px;
}
.lane-row {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  font-size: 12px;
}
.lane-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 7px;
  background: #e86165;
}
.lane-row:nth-child(2) .lane-dot {
  background: #65b0e5;
}
.position-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.position-grid label {
  font-size: 10px;
  color: var(--muted);
}
.position-grid input {
  display: block;
  margin-top: 5px;
  font-size: 12px;
}
#selection-code {
  font-size: 10px;
  margin-top: 5px;
}
.section-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.text-button {
  border: 0;
  background: none;
  color: #8cbdde;
  font-size: 11px;
}
.inventory-row {
  display: grid;
  grid-template-columns: 1fr 26px;
  gap: 10px;
  margin: 0 0 13px;
  font-size: 11px;
}
.inventory-row small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
}
.inventory-row b {
  text-align: right;
  font-size: 13px;
}
.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 22px;
  margin-bottom: 10px;
}
.slider-label output {
  color: #e7b0b2;
}
.statusbar {
  height: 26px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  font-size: 10px;
  color: var(--muted);
  background: var(--panel);
}
.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.empty-state h2 {
  font-size: 23px;
  font-weight: 500;
}
.empty-state p {
  text-align: center;
  color: var(--muted);
  margin: 10px 0 22px;
}
.empty-state .btn {
  pointer-events: auto;
}
[hidden] {
  display: none !important;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
dialog {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid #4a5361;
  border-radius: 12px;
  padding: 25px;
  width: min(780px, 92vw);
  max-height: 90dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #080c13b3;
  backdrop-filter: blur(3px);
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.dialog-heading h2 {
  font-size: 23px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  color: #dd9296;
  display: block;
  margin-bottom: 6px;
}
.custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}
.form-grid label {
  font-size: 11px;
  color: var(--muted);
}
.form-grid input,
.form-grid select {
  display: block;
  width: 100%;
  margin-top: 5px;
}
.custom-preview {
  background: #171c23;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.custom-preview svg {
  width: 100%;
  height: 230px;
}
.custom-preview p {
  font-size: 12px;
  color: var(--muted);
}
.custom-preview p.error {
  color: #ff9b9f;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}
#reference-dialog {
  width: min(550px, 90vw);
}
#reference-image {
  width: 100%;
  height: 230px;
  object-fit: contain;
}
#reference-notes {
  font-size: 12px;
  color: var(--muted);
}
#confirm-dialog {
  width: 430px;
}
#toast {
  position: fixed;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 18px;
  border: 1px solid #657184;
  background: #303b49;
  color: #f0eee9;
  border-radius: 8px;
  z-index: 30;
  max-width: 600px;
  box-shadow: 0 8px 28px #0008;
}
.no-results {
  padding: 20px 4px;
  color: var(--muted);
  line-height: 1.7;
}
.port {
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}
.car {
  pointer-events: none;
}
@media (max-width: 1180px) {
  .editor {
    grid-template-columns: 230px minmax(300px, 1fr) 245px;
  }
  .version {
    display: none;
  }
  .toolbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 54px;
    gap: 5px;
  }
  .toolbar .spacer {
    display: none;
  }
  .canvas-bottom > span {
    display: none;
  }
  .brand {
    min-width: 170px;
  }
  .app-header {
    gap: 10px;
  }
  .preview-bar #preview-message {
    display: none;
  }
  .piece-card {
    grid-template-columns: 60px 1fr;
    gap: 7px;
  }
  .piece-card img,
  .piece-card svg {
    width: 60px;
  }
}
@media (max-width: 900px) {
  .editor {
    grid-template-columns: 210px minmax(300px, 1fr);
  }
  .inspector {
    display: none;
  }
  .app-header nav,
  .projectbar #save-state {
    display: none;
  }
  .header-actions {
    margin-left: auto;
  }
  .title-label input {
    width: 200px;
  }
  .app-header {
    padding: 0 12px;
  }
  .custom-grid {
    grid-template-columns: 1fr;
  }
  .custom-preview svg {
    height: 150px;
  }
  .projectbar {
    padding: 0 12px;
  }
}

#canvas {
  cursor: crosshair;
}
#selection-box {
  fill: #e5484d20;
  stroke: #ee6468;
  stroke-width: 1;
  stroke-dasharray: 5 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.mirror-preference {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 12px;
}
/* Dedicated custom-library and export sections share the editor theme. */
.section-view {
  height: calc(100dvh - 92px);
  overflow: auto;
  padding: 32px max(24px, calc((100vw - 1200px) / 2));
  background: var(--bg);
}
.view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.view-heading h1 {
  font-size: 30px;
  margin-bottom: 8px;
}
.view-heading p {
  color: var(--muted);
  margin: 0;
  max-width: 650px;
}
.view-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.view-actions a,
.view-heading a {
  text-decoration: none;
}
.export-grid,
.custom-library {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 26px;
}
.export-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.export-card h2 {
  font-size: 19px;
}
.export-card p {
  color: var(--muted);
  margin: 14px 0 22px;
  line-height: 1.7;
}
.custom-piece svg {
  height: 150px;
  width: 100%;
  background: var(--bg);
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 18px;
}
.custom-empty {
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  grid-column: 1/-1;
}
.custom-empty h2 {
  font-size: 22px;
}
.custom-empty p {
  color: var(--muted);
}
@media (max-width: 640px) {
  .section-view {
    height: calc(100dvh - 92px);
    padding: 24px 16px;
  }
  .view-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .editor {
    height: calc(100dvh - 164px);
    max-height: calc(100dvh - 164px);
  }
}
#add-borders {
  margin: 0 6px 8px 0;
}
#borders-missing {
  color: #e6c47f;
  font-size: 12px;
  line-height: 1.7;
}
#borders-summary {
  font-weight: 600;
}
.custom-library {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.layer-control select {
  max-width: 130px;
  font-size: 12px;
  padding: 7px 8px;
}
.layer-control select:disabled {
  opacity: 0.45;
}

.pack-manager {
  max-width: 850px;
}
.pack-manager .field {
  margin-bottom: 14px;
}
.pack-manager input,
.pack-manager select {
  width: 100%;
}

.pack-manager > .field {
  display: inline-flex;
  flex-direction: column;
  width: calc(50% - 12px);
  vertical-align: top;
  margin: 12px 18px 0 0;
}
.pack-manager > .field:last-of-type {
  margin-right: 0;
}
.pack-manager p {
  margin: 10px 0;
}
.pack-manager .view-actions {
  margin: 12px 0 0;
}
.pack-contents-heading {
  margin: 16px 0 0;
}
@media (max-width: 640px) {
  .pack-manager > .field {
    width: 100%;
    margin-right: 0;
  }
  .pack-manager .section-row {
    align-items: flex-start;
    gap: 14px;
    flex-direction: column;
  }
}

#curve-helper {
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
}
#curve-family-preview {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 12px;
}
#curve-family-diagram {
  height: 150px;
}
#curve-family-table table {
  width: 100%;
  font-size: 11px;
  border-collapse: collapse;
}
#curve-family-table th,
#curve-family-table td {
  text-align: left;
  padding: 5px;
}
#curve-family-table .active {
  color: #ffb2b5;
  background: #472d34;
}
#piece-dialog {
  width: min(920px, 94vw);
}
#piece-dialog .custom-preview {
  justify-content: flex-start;
}
input[readonly] {
  color: #b2c6d7;
  background: #252d37;
}

.catalogue-folder {
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #1c222a;
}
.catalogue-folder > summary {
  cursor: pointer;
  padding: 11px 9px;
  font-weight: 650;
  font-size: 12px;
  user-select: none;
}
.catalogue-folder > summary > span {
  float: right;
  color: var(--muted);
  font-weight: 400;
}
.catalogue-folder[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.folder-pieces {
  padding: 0 6px;
}
.catalogue-folder .piece-card {
  grid-template-columns: 65px 1fr;
  gap: 7px;
}
.catalogue-folder .piece-card img,
.catalogue-folder .piece-card svg {
  width: 65px;
}
.design-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 20px;
  min-width: 0;
}
.design-card h2 {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.design-thumbnail {
  background: #171c23;
  border-radius: 6px;
  margin-bottom: 18px;
  padding: 15px;
}
.design-thumbnail svg {
  width: 100%;
  height: 180px;
  display: block;
}
.design-card .view-actions {
  gap: 8px;
  flex-wrap: wrap;
}
.design-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 22px;
}
.projectbar {
  gap: 10px;
}
.projectbar .btn {
  font-size: 12px;
}
.projectbar #save-state {
  font-size: 11px;
}
#save-design-dialog,
#delete-design-dialog {
  max-width: 540px;
}
#design-save-error {
  color: #ff9b9f;
}
.catalogue-folder > summary:focus-visible {
  outline: 2px solid #75b6df;
  outline-offset: 2px;
}
#library-view > .view-actions {
  align-items: flex-end;
  margin: 12px 0;
}
#library-view > .view-actions .field {
  margin: 0;
  min-width: 240px;
}
#library-view > .view-heading {
  margin-bottom: 16px;
}
#library-view > .fine {
  margin: 0 0 14px;
}
#library-view .design-library {
  margin-top: 16px;
}
.design-thumbnail svg {
  height: 150px;
}
.design-card .view-actions {
  margin: 12px 0 0;
}
.design-card .fine {
  margin: 10px 0;
}

/* Track identity and export actions remain visible together. */
.projectbar {
  height: 72px;
  gap: 8px;
  padding: 0 16px;
}
.title-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.track-name-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--ink);
}
.title-label input {
  width: 230px;
  font-size: 16px;
  padding: 7px 10px;
  background: #10161d;
  border: 1px solid #697889;
  border-radius: 6px;
}
.title-label input:hover {
  border-color: #a5b3c3;
}
.title-label input:focus {
  border-color: #75b6df;
  box-shadow: 0 0 0 2px #75b6df33;
}
.projectbar #save-state {
  font-size: 10px;
  max-width: 90px;
}
.projectbar > .btn {
  font-size: 12px;
}
.projectbar .spacer {
  min-width: 0;
}
.export-source-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: center;
}
.export-source-card .field {
  margin-top: 20px;
}
.export-source-card p {
  margin: 10px 0;
}
.export-source-card #export-summary {
  font-weight: 650;
  color: var(--ink);
}
.export-source-card .error {
  color: #ff9b9f;
}
.export-source-card .error:empty {
  display: none;
}
#export-track-preview {
  height: 160px;
  background: var(--bg);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
#export-track-preview svg {
  width: 100%;
  height: 100%;
}
.export-step {
  font-size: 21px;
  margin: 30px 0 8px;
}
.track-export-formats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}
.export-compatibility {
  margin-top: 18px;
  font-size: 11px;
  color: var(--muted);
}
.export-compatibility summary {
  cursor: pointer;
}
.export-compatibility p {
  margin: 10px 0;
}
@media (max-width: 1200px) {
  .projectbar #save-state {
    display: none;
  }
  .title-label input {
    width: 210px;
  }
}
@media (max-width: 960px) {
  .projectbar {
    overflow-x: auto;
  }
  .projectbar > .btn {
    padding: 7px 8px;
  }
  .title-label input {
    width: 180px;
  }
  .projectbar > .spacer {
    display: none;
  }
}
@media (max-width: 700px) {
  .export-source-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .track-export-formats {
    grid-template-columns: 1fr;
  }
  .export-source-card {
    padding: 18px;
  }
}

.canvas-top {
  flex-wrap: wrap;
  right: 16px;
  align-items: center;
}
.canvas-top .btn {
  pointer-events: auto;
  font-size: 10px;
  padding: 5px 8px;
}
.space-guide-area {
  fill: #75b6df0b;
  stroke: #75b6df;
  stroke-width: 1.5;
  stroke-dasharray: 9 5;
  vector-effect: non-scaling-stroke;
  cursor: move;
}
.space-guide-label {
  fill: #9ccbe9;
}
.space-guide-handle {
  fill: #75b6df;
  stroke: #17202a;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: nwse-resize;
}
#space-guide-layer.locked,
#space-guide-layer.locked * {
  pointer-events: none;
}
.space-guide-handle:hover {
  fill: #c4e7ff;
}
#space-guide-dialog {
  width: min(540px, 92vw);
}
.guide-scale-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 18px 0;
}
.guide-scale-row .field {
  margin: 0;
  flex: 1;
}
#pdf-dialog {
  width: min(560px, 92vw);
}
#pdf-track-name {
  font-size: 20px;
  overflow-wrap: anywhere;
  margin: 0 0 6px;
}
#pdf-preview {
  height: 210px;
  background: white;
  border-radius: 7px;
  margin: 18px 0;
  padding: 14px;
}
#pdf-preview svg {
  width: 100%;
  height: 100%;
}
#pdf-error:empty {
  display: none;
}

#storage-dialog {
  width: min(690px, 94vw);
}
#storage-directory {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
}
#storage-error {
  color: #e6c47f;
  overflow-wrap: anywhere;
}
.statusbar .text-button {
  font-size: 10px;
  padding: 0;
}

.metric-grid strong.unknown-length {
  font-size: 18px;
  line-height: 1.25;
}

/* Explicit track / pack choices keep their imports and selectors separate. */
.transfer-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 24px;
}
.transfer-choice {
  font: inherit;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 20px 22px;
  cursor: pointer;
}
.transfer-choice strong {
  display: block;
  font-size: 21px;
  margin-bottom: 7px;
}
.transfer-choice span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.transfer-choice[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.transfer-choice:hover {
  border-color: var(--accent);
}
.transfer-choice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.transfer-import {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin: 0 0 24px;
}
.transfer-import > div {
  max-width: 830px;
}
.transfer-import p {
  margin: 10px 0 0;
}
.transfer-import > .btn {
  flex-shrink: 0;
}
.transfer-pack-export .field {
  max-width: 720px;
  margin-top: 22px;
}
.transfer-help {
  margin: 20px 0;
  line-height: 1.7;
}
@media (max-width: 640px) {
  .transfer-choices {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .transfer-choice {
    padding: 16px;
  }
  .transfer-import {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }
}
#custom-piece-tools {
  align-items: center;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
#custom-piece-tools .check,
.custom-piece > .check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.custom-piece > .check {
  margin-bottom: 12px;
  cursor: pointer;
}
.custom-piece:has(> label > input:checked) {
  border-color: var(--accent);
}
#custom-selection-count {
  margin-right: auto;
}
#delete-pack-pieces-dialog {
  max-width: 540px;
}
#delete-pack-pieces-summary {
  overflow-wrap: anywhere;
}

#storage-upgrade {
  max-width: 560px;
}
#storage-upgrade h2 {
  font-size: 24px;
  line-height: 1.25;
  margin: 10px 0 16px;
}
#storage-upgrade progress {
  width: 100%;
  accent-color: var(--accent);
}
