/* Mapbelt design system: warm paper surfaces, deep-ink rail, automatic dark mode.
   System fonts only (no remote requests). Text never drops below 12px. */
:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Consolas, Menlo, monospace;
  --bg: #f5f3ee;
  --surface: #fff;
  --surface-2: #f0ede5;
  --ink: #1b2420;
  --muted: #56625b;
  --line: #dcd8cb;
  --line-strong: #bdb8a8;
  --accent: #1f7a4d;
  --accent-hover: #17623d;
  --accent-ink: #fff;
  --accent-soft: #e0f0e5;
  --focus: #1156cc;
  --code-bg: #f1eee6;
  --info-bg: #e6f0f9;
  --info-line: #a9c7e4;
  --info-ink: #17415f;
  --warn-bg: #fff3d1;
  --warn-line: #e3c264;
  --warn-ink: #5e4300;
  --err-bg: #fde9e4;
  --err-line: #e6a898;
  --err-ink: #81200d;
  --rail: #15231b;
  --rail-ink: #dbe6de;
  --rail-muted: #93a79a;
  --rail-hover: #1f3328;
  --rail-active: #2a4533;
  --rail-accent: #b8ec6a;
  --shadow: 0 1px 2px rgba(20, 30, 24, .06), 0 6px 20px rgba(20, 30, 24, .05);
  --radius: 12px;
  --radius-sm: 8px;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  color-scheme: light dark;
  font-synthesis: none;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1411;
    --surface: #151f19;
    --surface-2: #1c2922;
    --ink: #e9efe9;
    --muted: #a5b4aa;
    --line: #2b3b32;
    --line-strong: #41564a;
    --accent: #b8ec6a;
    --accent-hover: #cdf58b;
    --accent-ink: #0f1d09;
    --accent-soft: #223421;
    --focus: #8db5ff;
    --code-bg: #0f1814;
    --info-bg: #14263a;
    --info-line: #2f5378;
    --info-ink: #bcd9f5;
    --warn-bg: #30280f;
    --warn-line: #6e5a1c;
    --warn-ink: #f0dc9a;
    --err-bg: #36201a;
    --err-line: #7d4636;
    --err-ink: #ffcdb9;
    --rail: #0a110d;
    --rail-hover: #16231b;
    --rail-active: #203529;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); text-underline-offset: 2px; }
[hidden] { display: none !important; }

/* Shell: fixed rail + content */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
aside { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; padding: 24px 16px; background: var(--rail); color: var(--rail-ink); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #f3f8f4; text-decoration: none; font-size: 22px; font-weight: 750; letter-spacing: -.03em; }
.brand-mark { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px; background: #f5f3ee; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
.brand-mark .logo { display: block; }
.brand-name { font-weight: 700; letter-spacing: -.04em; }
.version { margin-left: auto; padding: 2px 7px; border: 1px solid #36503f; border-radius: 99px; color: var(--rail-muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
nav { display: grid; gap: 18px; }
.nav-group { display: grid; gap: 2px; }
.nav-label { margin: 0 8px 4px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--rail-muted); }
nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--rail-ink); font-size: 14px; font-weight: 500; text-decoration: none; }
nav a:hover { background: var(--rail-hover); }
nav a.active { background: var(--rail-active); color: #fff; box-shadow: inset 3px 0 0 var(--rail-accent); }
nav a .ico { flex: none; color: var(--rail-muted); }
nav a.active .ico { color: var(--rail-accent); }
.aside-note { margin-top: auto; padding: 14px; border: 1px solid #2b4234; border-radius: var(--radius-sm); font-size: 13px; color: var(--rail-muted); }
.aside-note p { margin: 0 0 8px; }
.aside-note a { color: var(--rail-accent); }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.aside-note .dot { background: var(--rail-accent); }

main { width: 100%; max-width: 1180px; padding: 0 40px 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.privacy-chip { display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 13px; }
.intro { padding: 12px 0 24px; }
h1 { margin: 0 0 8px; font-size: clamp(28px, 3.4vw, 40px); font-weight: 700; letter-spacing: -.03em; line-height: 1.12; }
.intro p { margin: 0; max-width: 62ch; color: var(--muted); font-size: 16px; }
h1:focus { outline: none; }

/* Cards */
.panel { margin-bottom: 20px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
h2 { margin: 0 0 8px; font-size: 20px; font-weight: 650; letter-spacing: -.015em; line-height: 1.3; }
h3 { margin: 22px 0 8px; font-size: 14px; font-weight: 650; letter-spacing: .01em; }
.tag { flex: none; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.panel p { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.hint, .panel p.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.tool:not([hidden]) { animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Forms */
label { display: block; margin: 18px 0 6px; color: var(--ink); font-size: 14px; font-weight: 600; }
input, select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
select { text-overflow: ellipsis; }
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 0; border-color: var(--focus); }
input::placeholder { color: var(--muted); opacity: .8; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 16px; margin-bottom: 18px; }
.fields.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fields > div > label:first-child { margin-top: 0; }
.row { display: flex; align-items: flex-end; gap: 12px; }
.row > div { width: 200px; }
.row label { margin-top: 0; }
.checkbox-label { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.checkbox-label input, .slippy-toggle input { flex: none; width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }

/* Buttons */
button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .12s, border-color .12s; }
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
button.secondary:hover { border-color: var(--accent); background: var(--accent-soft); }
.link-button, .file-link { display: inline; min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 500; text-decoration: underline; }
.link-button:hover { background: none; color: var(--accent-hover); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0; }
.actions.stack { flex-direction: column; align-items: stretch; margin-top: 8px; }
.file-link { position: relative; cursor: pointer; }
.file-link input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; clip-path: inset(50%); }
:is(button, a, summary):focus-visible, .file-link:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Dropzone */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 16px 0; padding: 32px 20px; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); font-size: 17px; font-weight: 600; text-align: center; cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.dropzone::before { content: ''; width: 36px; height: 36px; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4m0 0-4 4m4-4 4 4M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4m0 0-4 4m4-4 4 4M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E") center / contain no-repeat; }
.dropzone input { max-width: 420px; margin: 8px 0 2px; font-size: 13px; font-weight: 400; }
.dropzone span { color: var(--muted); font-size: 13px; font-weight: 400; }

/* Feedback */
.notice { position: relative; margin: 14px 0; padding: 12px 16px 12px 44px; border: 1px solid var(--info-line); border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info-ink); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.notice::before { content: 'i'; position: absolute; left: 14px; top: 12px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--info-ink); color: var(--info-bg); font-size: 12px; font-weight: 700; font-style: italic; }
.notice.error { border-color: var(--err-line); background: var(--err-bg); color: var(--err-ink); }
.notice.warning { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }
.notice.error::before { content: '!'; background: var(--err-ink); color: var(--err-bg); font-style: normal; }
.notice.warning::before { content: '!'; background: var(--warn-ink); color: var(--warn-bg); font-style: normal; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }

/* Results */
.result-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 24px; align-items: start; margin-top: 8px; }
.result-main, .result-side { min-width: 0; }
.result-side > h3:first-child, .result-side > label:first-child { margin-top: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.stat { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.stat strong { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.stat small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
pre { max-height: 360px; margin: 0 0 12px; padding: 14px 16px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--code-bg); color: var(--ink); font-family: var(--mono); font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
details { margin-top: 18px; font-size: 14px; }
summary { cursor: pointer; padding: 6px 0; color: var(--accent); font-weight: 600; }
details[open] > summary { margin-bottom: 8px; }
.preview-options { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.preview-options .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 10px; }
.preview-options summary { margin-bottom: 12px; color: var(--ink); }
.file-detail { margin-top: 20px; border-color: var(--accent); }
.table-scroll { max-height: 480px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; padding: 10px 12px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.table-scroll table { min-width: 620px; }
th { white-space: nowrap; }
td, th { border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
td { padding: 10px 12px; }
tbody tr:hover { background: var(--accent-soft); }
td:nth-child(2) { min-width: 140px; }
td:last-child { min-width: 200px; }
td button { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.layer-layout { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2.3fr); gap: 24px; margin-top: 20px; }
.layer-list { max-height: 650px; overflow: auto; }
.layer-button { display: block; width: 100%; margin-bottom: 6px; padding: 10px 12px; border-color: var(--line); background: var(--surface); color: var(--ink); text-align: left; font-weight: 600; overflow-wrap: anywhere; }
.layer-button:hover { background: var(--accent-soft); }
.layer-button.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.layer-button small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 400; }
#image-stage img { width: 100%; max-height: 440px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius-sm); background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 20px 20px; }
#preview-status { font-size: 13px; }
.help-links p { margin: 0; }
footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer span { margin-left: auto; }

/* Maps: diagram surface stays dark in both themes; interactive map sits on tiles */
.map { margin: 12px 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #101d17; }
.map svg { display: block; width: 100%; max-height: 300px; }
.map-caption { padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.map-views { display: inline-flex; gap: 2px; margin-top: 12px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.map-views button { min-height: 34px; padding: 4px 14px; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; }
.map-views button:hover { background: var(--surface); }
.map-views button[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.map-views + .slippy-wrap, .map-views + .map { margin-top: 10px; }
.slippy-wrap { margin: 12px 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.slippy { position: relative; height: min(440px, 62vh); overflow: hidden; background: #cfd8dc; cursor: grab; touch-action: none; user-select: none; }
.slippy:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.slippy.dragging { cursor: grabbing; }
.slippy-tiles, .slippy-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.slippy-tile { position: absolute; left: 0; top: 0; width: 256px; height: 256px; max-width: none; pointer-events: none; }
.slippy-overlay { pointer-events: none; }
.slippy-attribution { position: absolute; right: 0; bottom: 0; padding: 2px 8px; background: rgba(255, 255, 255, .85); color: #333; font-size: 11px; }
.slippy-attribution a { color: #0b5cad; }
.slippy-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 13px; }
.slippy-controls { display: flex; gap: 6px; }
.slippy-controls button { min-width: 40px; min-height: 36px; padding: 4px 12px; border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.slippy-controls button:hover { border-color: var(--accent); background: var(--accent-soft); }
.slippy-toggle { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink); font-size: 13px; font-weight: 500; cursor: pointer; }
.slippy-zoom { margin-left: auto; font-variant-numeric: tabular-nums; }
.slippy-status:not(:empty) { padding: 8px 12px; border-top: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; }

.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; padding: 12px 18px; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Tablet */
@media (max-width: 1000px) {
  .shell { grid-template-columns: 244px minmax(0, 1fr); }
  .version { display: none; }
  nav a { padding: 10px; font-size: 13.5px; }
  main { padding: 0 24px 40px; }
  .fields.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layer-layout, .result-grid { grid-template-columns: 1fr; }
  .layer-list { max-height: 240px; }
  .tag { display: none; }
}
/* Phone: rail becomes a sticky top bar with scrolling tool pills */
@media (max-width: 760px) {
  .shell { display: block; }
  aside { position: sticky; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; overflow: visible; }
  .brand { flex: none; padding: 0; font-size: 18px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  .brand-mark .logo { width: 31px; height: 31px; }
  .version, .aside-note, .nav-label { display: none; }
  nav { display: flex; flex: 1; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; mask: linear-gradient(90deg, #000 90%, transparent); }
  .nav-group { display: flex; gap: 6px; }
  nav a { flex: none; gap: 7px; padding: 8px 12px; border: 1px solid #2b4234; border-radius: 99px; font-size: 13px; white-space: nowrap; }
  nav a.active { box-shadow: none; }
  main { padding: 0 16px 32px; }
  .topbar { min-height: 56px; }
  .privacy-chip { font-size: 12px; }
  .panel { padding: 18px; }
  .fields, .fields.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { flex-wrap: wrap; }
  .row > div { width: 100%; }
  .slippy { height: min(340px, 55vh); }
  .slippy-zoom { margin-left: 0; width: 100%; }
  footer span { width: 100%; margin-left: 0; }
}
@media (max-width: 420px) {
  .fields, .preview-options .fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  button, nav a.active, .panel, input, select, .notice, .stat { border: 1px solid CanvasText; }
  button { forced-color-adjust: auto; }
}

/* Motion GIF tool */
code { padding: 1px 6px; border-radius: 4px; background: var(--code-bg); font-family: var(--mono); font-size: .9em; }
.scene-row { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-weight: 500; cursor: pointer; }
.scene-row:hover { background: var(--accent-soft); }
.scene-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.scene-row input, .band-check input { flex: none; width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.scene-thumb { width: 64px; height: 64px; flex: none; border-radius: 6px; background: var(--surface-2); object-fit: cover; }
#motion-bands { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.band-check { display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 0; font-weight: 500; cursor: pointer; }
.band-check small { color: var(--muted); font-weight: 400; }
.motion-frame { display: inline-block; max-width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #000; }
.motion-frame img { display: block; max-width: 100%; height: auto; }
.slippy.drawing { cursor: crosshair; }
.place-row { align-items: stretch; }
.place-row > div { flex: 1; width: auto; }
.place-row button { margin: 0; }
#motion-place-results { display: grid; gap: 6px; margin: 8px 0; }
#motion-place-results .place-result { justify-content: flex-start; text-align: left; font-weight: 500; }
#motion-map .slippy { height: min(340px, 55vh); }
.motion-map-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 14px 0 4px; }
.motion-map-controls .checkbox-label { margin: 0; }
.motion-opacity { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 500; }
.motion-opacity input { width: 160px; min-height: 0; padding: 0; accent-color: var(--accent); }

/* Easy Crop */
.crop-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin: 8px 0 12px; }
.crop-toolbar > div { min-width: 220px; }
.crop-toolbar label { margin-top: 0; }
#crop-stage { display: flex; justify-content: center; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #0c1511; overflow: auto; }
.cropper { position: relative; display: inline-block; max-width: 100%; line-height: 0; background: repeating-conic-gradient(#2a3a30 0% 25%, #1b2a20 0% 50%) 50% / 16px 16px; }
.cropper canvas { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
.cropper-overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; image-rendering: auto; }
.cropper-overlay:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Bounding box toolkit: draw on map */
#bbox-draw-map .slippy { height: min(340px, 55vh); }
.bbox-draw-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 4px 0 0; }
.bbox-draw-bar .hint { margin: 0; }

nav a.external .ext { margin-left: auto; }

.slippy-layer { width: auto; min-height: 36px; padding: 4px 28px 4px 10px; font-size: 13px; }

.xyz-stage { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.xyz-stage img { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); max-width: 100%; height: auto; }

/* Service inspector: aligned controls, results header and layer column */
.panel-title h2 { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.panel-title .actions { flex: none; margin: 0; justify-content: flex-end; }
.service-controls { display: grid; grid-template-columns: minmax(150px, 200px) auto 1fr; gap: 12px 24px; align-items: end; margin-top: 12px; }
.service-controls label { margin-top: 0; }
.service-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mode-switch { margin: 0; padding: 0; border: 0; min-width: 0; }
.mode-switch legend { margin: 0 0 6px; padding: 0; color: var(--ink); font-size: 14px; font-weight: 600; }
.mode-switch .seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.mode-switch .seg label { display: flex; align-items: center; margin: 0; min-height: 42px; padding: 0 18px; background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; }
.mode-switch .seg label + label { border-left: 1px solid var(--line-strong); }
.mode-switch .seg input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; clip-path: inset(50%); }
.mode-switch .seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.mode-switch .seg label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }
.quick-links { gap: 8px 22px; margin: 14px 0 6px; }
.layer-col { min-width: 0; }
.layer-col > label:first-child { margin-top: 0; }
.layer-col .layer-list { margin-top: 10px; }
.layer-detail { min-width: 0; }
.layer-detail > h3:first-child { margin-top: 0; }
.layer-detail pre { max-height: 260px; }
.view-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 28px; }
.view-controls > div { flex: 1 1 280px; max-width: 520px; }
.view-controls label { margin-top: 0; }
.view-opacity { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-weight: 500; }
.view-opacity input { width: 160px; min-height: 0; padding: 0; accent-color: var(--accent); }
#service-view-map .slippy { height: min(520px, 65vh); }
@media (max-width: 900px) {
  .service-controls { grid-template-columns: 1fr; }
  .panel-title { flex-wrap: wrap; }
  .panel-title .actions { justify-content: flex-start; }
}
.quick-links { align-items: baseline; }
.quick-links .link-button, .quick-links .file-link { margin: 0; line-height: 1.5; }

/* Reproject */
.crs-picker { position: relative; }
.crs-picker ul { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; margin: 0; padding: 4px; overflow: auto; list-style: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
.crs-picker li { padding: 8px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.crs-picker li[role="option"]:hover, .crs-picker li.active { background: var(--accent-soft); }
.crs-picker li[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.crs-picker .crs-group { padding: 8px 10px 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; cursor: default; }
.crs-picker .crs-empty { color: var(--muted); cursor: default; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.row .suffix { align-self: center; color: var(--muted); font-size: 14px; }
.rp-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 12px 0; }
.rp-previews figure { margin: 0; }
.rp-previews canvas { display: block; width: 100%; height: auto; max-height: 420px; object-fit: contain; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.rp-previews figcaption { margin-top: 6px; color: var(--muted); font-size: 13px; }
#rp-progress { width: 180px; height: 10px; accent-color: var(--accent); }
#rp-name { min-width: 0; }
#rp-name + .suffix { flex: none; }

.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rp-name-row { display: flex; align-items: center; gap: 10px; max-width: 560px; margin-bottom: 18px; }
.rp-name-row input { flex: 1 1 auto; }
.rp-name-row .suffix { flex: none; color: var(--muted); font-size: 14px; }
@media (max-width: 700px) { .fields.two { grid-template-columns: 1fr; } }
#rp-stats .stat strong { font-size: 18px; }
#rp-stats .stat:last-child:nth-child(n+3) { grid-column: 1 / -1; }

/* Raster Compressor */
.rc-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 22px; margin: 0 0 10px; }
.rc-facts dt { color: var(--muted); font-size: 13px; }
.rc-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.rc-range { display: flex; gap: 8px; align-items: center; }
.rc-range input { flex: 1 1 0; }
.rc-range button { flex: none; min-height: 44px; }
#rc-quality { padding: 0; min-height: 0; accent-color: var(--accent); }
#rc-quality-val { font-weight: 600; color: var(--accent); }
.rc-headline { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.rc-headline small { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; font-weight: 400; letter-spacing: 0; }
.rc-bar { height: 10px; margin: 12px 0 4px; overflow: hidden; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); }
.rc-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.rc-bar i.warn { background: var(--warn-line); }
.rc-sizes { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.rc-checks { margin: 16px 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rc-checks li { position: relative; padding-left: 26px; font-size: 14px; }
.rc-checks li::before { content: '✓'; position: absolute; left: 0; top: 0; color: var(--accent); font-weight: 700; }
.rc-checks li.info::before { content: 'i'; color: var(--info-ink); font-style: italic; }
.rc-checks li.bad { color: var(--err-ink); }
.rc-checks li.bad::before { content: '!'; color: var(--err-ink); }
