:root {
  color-scheme: dark;
  --body: #111612;
  --panel: #19201a;
  --inner: #141a15;
  --line: #333e33;
  --subtle: #aab7a8;
  --strong: #f0f3e9;
  --lime: #ddf398;
  --earth: #a17b53;
  --forest: #659752;
  --rock: #aaa9a0;
  --water: #568da2;
  --route: #ed3d45;
  --frame: #dfe4dc;
  --lettering: #293630;
  font: 16px/1.5 'Inter', 'Avenir Next', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--body); color: var(--strong); }
[hidden] { display: none !important; }
button, input { font: inherit; }
button, a, summary, label[for='gpx'] { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
a { color: #bcc8b8; text-underline-offset: 4px; }
a:hover { color: var(--lime); }
.topbar { height: 72px; border-bottom: 1px solid #282f28; display: flex; align-items: center; justify-content: space-between; padding: 0 max(30px, calc((100vw - 1440px) / 2)); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 720; letter-spacing: -.035em; font-size: 1.12rem; white-space: nowrap; }
.brand-mark { position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--lime); }
.brand-mark i { position: absolute; width: 22px; height: 13px; background: #243124; clip-path: polygon(0 78%, 36% 21%, 47% 41%, 70% 0, 100% 78%, 100% 94%, 70% 24%, 48% 62%, 36% 43%, 0 99%); }
.brand-mark i:first-child { transform: translateY(-4px); }
.brand-mark i:last-child { transform: translateY(4px); }
.local { color: var(--subtle); font-size: .875rem; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.local i { width: 7px; height: 7px; border-radius: 50%; background: #a8c473; }
main { max-width: 1500px; padding: 29px 30px 24px; margin: 0 auto; }
h1, h2, p { margin: 0; }
.intro { margin-bottom: 24px; }
h1 { font-size: clamp(2.2rem, 4vw, 3.6rem); line-height: 1.08; font-weight: 690; letter-spacing: -.066em; }
.intro p { color: var(--subtle); margin-top: 9px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 17px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; min-width: 0; overflow: hidden; }
.preview-head { padding: 16px 19px; display: flex; justify-content: space-between; align-items: center; gap: 13px; }
h2 { font-size: 1rem; font-weight: 700; letter-spacing: -.023em; }
.preview-head p { font-size: .875rem; color: var(--subtle); margin-top: 1px; max-width: 42ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-modes { display: flex; gap: 2px; border: 1px solid var(--line); background: var(--inner); padding: 3px; border-radius: 8px; flex-shrink: 0; }
.view-modes button, .navigation button { border: 0; background: transparent; color: var(--subtle); border-radius: 5px; }
.view-modes button { padding: 5px 10px; font-size: .875rem; font-weight: 650; }
.view-modes button[aria-pressed='true'] { background: #364537; color: #f0f6d9; }
.view-modes button:hover, .navigation button:hover { color: var(--strong); }
.stage { position: relative; isolation: isolate; height: clamp(360px, 46vw, 545px); border-block: 1px solid var(--line); background: radial-gradient(ellipse at 52% 39%, #28352a 0%, #1d271f 46%, #141b16 83%); }
.stage::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: -1; background: radial-gradient(circle, #82948448 1px, transparent 1.6px) 0 0 / 19px 19px; mask-image: radial-gradient(ellipse at 54% 55%, #000b, #0003 72%, transparent); }
#terrain { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#terrain:active { cursor: grabbing; }
#terrain:focus-visible { outline-offset: -3px; }
.source-badge, .canvas-hint { position: absolute; color: #c4cfc0; background: #19231acb; border: 1px solid #52615179; border-radius: 6px; padding: 4px 8px; font-size: .8rem; pointer-events: none; }
.source-badge { left: 14px; top: 14px; }
.canvas-hint { left: 14px; bottom: 14px; }
.navigation { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; padding: 3px; border: 1px solid #526151a8; border-radius: 8px; background: #19231ae8; }
.navigation button { width: 34px; height: 34px; font-size: 1.25rem; }
.navigation button + button { border-top: 1px solid #40504095; }
.canvas-error { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 22px; pointer-events: none; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; }
.metrics > div { min-width: 0; padding: 12px 18px; }
.metrics > div + div { border-left: 1px solid var(--line); }
.metrics dt { font-size: .875rem; color: var(--subtle); }
.metrics dd { margin: 2px 0 0; font-size: clamp(.88rem, 1.6vw, 1.18rem); font-weight: 650; font-variant-numeric: tabular-nums; }
.legend { border-top: 1px solid var(--line); list-style: none; margin: 0; padding: 12px 18px; display: flex; flex-wrap: wrap; gap: 9px 19px; color: #c0ccbd; font-size: .875rem; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.earth { background: var(--earth); }
.forest { background: var(--forest); }
.rock { background: var(--rock); }
.water { background: var(--water); }
.route { background: var(--route); }
.frame { background: var(--frame); border: 1px solid #717b73; }
.lettering { background: var(--lettering); border: 1px solid #717b73; }
.mapped-paths { background: #ddb682; }
.grass { background: #a8a95a; }
.cropland { background: #bc9562; }
.urban-ground { background: #ada59d; }
.buildings { background: #dcd2c3; }
.control-section { padding: 16px 17px; }
.control-section + .control-section { border-top: 1px solid var(--line); }
.control-section h2 { margin-bottom: 11px; }
.dropzone { min-height: 108px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 11px 8px; position: relative; border: 1px dashed #64735e; border-radius: 9px; color: #d9e6d5; background: #151c16; cursor: pointer; }
.dropzone:hover, .dropzone.dragging, .dropzone:focus-within { border-color: var(--lime); background: #242f22; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone strong { font-size: .95rem; font-weight: 690; }
.dropzone > span:last-child { font-size: .875rem; color: var(--subtle); }
.upload-icon { width: 27px; height: 25px; color: var(--lime); position: relative; margin-bottom: 3px; }
.upload-icon::after { content: ''; position: absolute; left: 5px; bottom: 2px; width: 15px; height: 5px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.upload-icon i { position: absolute; top: 5px; left: 12px; width: 1.5px; height: 11px; background: currentColor; }
.upload-icon i::before { content: ''; position: absolute; top: -1px; left: -3px; width: 6px; height: 6px; border-left: 1.5px solid currentColor; border-top: 1.5px solid currentColor; transform: rotate(45deg); }
.upload-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; font-size: .875rem; }
.upload-footer > span { color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-button { background: none; border: 0; padding: 2px 0; color: var(--lime); font-size: .875rem; white-space: nowrap; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.status { border-radius: 7px; margin-top: 8px; padding: 8px 10px; background: #2a3827; font-size: .875rem; color: #d3e6c9; }
.status[data-kind='error'] { background: #462c23; color: #ffc8ae; }
.status-actions { display: flex; gap: 12px; }
.shape-field, .rotation-field { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; font-size: .875rem; }
.shape-field legend, .rotation-field legend { margin-bottom: 5px; padding: 0; }
.shape-options { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--inner); padding: 3px; }
.shape-options label { position: relative; cursor: pointer; }
.shape-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.shape-options span { display: block; text-align: center; padding: 5px 4px; border-radius: 5px; color: var(--subtle); }
.shape-options input:checked + span { background: #364537; color: #f0f6d9; font-weight: 650; }
.shape-options input:focus-visible + span { outline: 2px solid var(--lime); }
.rotation-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 7px; }
.rotation-buttons button { border: 1px solid var(--line); border-radius: 7px; padding: 5px 4px; background: var(--inner); color: var(--strong); }
.rotation-buttons button:hover { border-color: var(--lime); }
.rotation-field .text-button:disabled { opacity: .5; }
.text-field { margin-bottom: 13px; font-size: .875rem; }
.text-field label { display: block; margin-bottom: 4px; }
.text-field label span, .text-field p { color: var(--subtle); }
.text-field input { display: block; width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; background: var(--inner); color: var(--strong); font-variant-numeric: tabular-nums; }
.detail-field { margin-top: 9px; }
.detail-field select { appearance: none; width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 6px 28px 6px 8px; background: var(--inner); color: var(--strong); font: inherit; }
.detail-field label { position: relative; }
.detail-field label::after { content: ''; position: absolute; pointer-events: none; top: 36px; right: 11px; width: 7px; height: 7px; border-right: 1px solid var(--subtle); border-bottom: 1px solid var(--subtle); transform: rotate(45deg); }
.text-field input[aria-invalid='true'] { border-color: #f1827f; }
.text-field input[aria-invalid='true'] + p { color: #ffc1b6; }
.text-field p { margin-top: 3px; font-size: .82rem; }
.range-help { font-size: .82rem; color: var(--subtle); }
.route-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 9px; margin-bottom: 13px; }
.route-values .text-field { margin-bottom: 0; }
.route-values > .range-help { grid-column: 1 / -1; }
.layer-field { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; font-size: .875rem; }
.layer-field legend { padding: 0; margin-bottom: 4px; }
.layer-field label { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.layer-field input { margin: 0; width: 16px; height: 16px; accent-color: var(--lime); }
.layer-field label:has(:disabled) { color: var(--subtle); }
.layer-field .path-field { margin-bottom: 0; }
.layer-field .path-field label { display: block; min-height: 0; }
.layer-field .path-field p:empty { display: none; }
.range-field + .range-field { margin-top: 9px; }
.range-label { display: flex; justify-content: space-between; align-items: center; gap: 5px; font-size: .875rem; }
.range-label output { color: var(--lime); white-space: nowrap; font-variant-numeric: tabular-nums; }
input[type='range'] { display: block; appearance: none; width: 100%; height: 21px; margin: 2px 0 0; background: transparent; cursor: pointer; }
input[type='range']::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(to right, #afc676 var(--range-progress), #3a473a var(--range-progress)); }
input[type='range']::-moz-range-track { height: 4px; border-radius: 99px; background: linear-gradient(to right, #afc676 var(--range-progress), #3a473a var(--range-progress)); }
input[type='range']::-webkit-slider-thumb { appearance: none; margin-top: -5px; width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--lime); }
input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--lime); }
.details { font-size: .875rem; margin-top: 9px; border-top: 1px solid var(--line); padding-top: 9px; }
.details summary { color: #c5d0c3; cursor: pointer; }
.details[open] summary { margin-bottom: 10px; }
.exports { display: grid; gap: 7px; }
.exports h2 { margin: 0 0 3px; }
.filament-field { min-width: 0; margin: 3px 0 5px; padding: 7px 9px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: .875rem; }
.filament-field legend { padding-inline: 4px; }
.filament-mode { display: flex; align-items: center; gap: 8px; min-height: 27px; }
.filament-mode input { width: 16px; height: 16px; margin: 0; accent-color: var(--lime); }
.filament-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 7px 0; }
.filament-slots label { display: grid; gap: 3px; color: var(--subtle); text-align: center; font-size: .75rem; }
.filament-slots input { width: 100%; min-width: 0; height: 27px; padding: 2px; border: 1px solid #4a5749; border-radius: 5px; background: var(--inner); cursor: pointer; }
.filament-assignments { display: grid; gap: 5px; margin-top: 7px; }
.filament-assignment { display: grid; grid-template-columns: minmax(0, 1fr) 10px auto; align-items: center; gap: 7px; }
.filament-assignment i { width: 10px; height: 10px; border-radius: 2px; border: 1px solid #717b73; }
.filament-assignment select { padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: var(--inner); color: var(--strong); font: inherit; }
.exports button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 41px; border-radius: 8px; padding: 6px 11px; font-size: .925rem; font-weight: 720; border: 1px solid transparent; }
.exports .primary { background: var(--lime); color: #182116; justify-content: space-between; }
.exports .primary:hover:not(:disabled) { background: #edffb7; }
.exports .secondary { color: var(--strong); background: transparent; border-color: #4a5749; }
.exports .secondary:hover:not(:disabled) { background: #2a3829; }
.exports p { font-size: .82rem; color: var(--subtle); }
.assembly .text-field { margin: 9px 0; }
.assembly .text-field input { width: 100px; }
#assembly-status:not(:empty) { margin-top: 6px; }
.download-icon { width: 18px; height: 18px; position: relative; border-bottom: 1.5px solid currentColor; }
.download-icon::before { content: ''; position: absolute; top: 1px; left: 8px; width: 1.5px; height: 11px; background: currentColor; }
.download-icon::after { content: ''; position: absolute; top: 5px; left: 5px; width: 6px; height: 6px; border-bottom: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); }
.site-footer { padding: 15px 1px 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: .82rem; color: var(--subtle); }
.site-footer div { display: flex; flex-wrap: wrap; gap: 14px; }
@media (min-width: 931px) and (min-height: 640px) {
  .workspace:has(#filament-mode:checked) .preview { position: sticky; top: 12px; }
}
@media (max-width: 930px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 296px; }
  main { padding-inline: 19px; }
  .topbar { padding-inline: 19px; }
  .metrics > div { padding-inline: 11px; }
  .legend { padding-inline: 11px; gap: 7px 12px; }
}
@media (max-width: 740px) {
  .topbar { height: 61px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .stage { height: clamp(340px, 74vw, 470px); }
  .preview-head p { max-width: 32vw; }
  .metrics dd { font-size: .94rem; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; }
  .control-section + .control-section { border-top: 0; }
  .controls .settings { border-left: 1px solid var(--line); grid-row: span 2; }
  .controls .exports { border-top: 1px solid var(--line); }
}
@media (max-width: 480px) {
  main { padding: 23px 13px 18px; }
  .topbar { padding-inline: 13px; }
  .intro { margin-bottom: 17px; }
  .controls { display: block; }
  .controls .settings { border-left: 0; border-top: 1px solid var(--line); }
  .preview-head { padding-inline: 12px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics > div:nth-child(3) { border-left: 0; }
  .metrics > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
