:root {
  --bg: #0a1128;
  --bg2: #0d1533;
  --panel: #101a3c;
  --panel2: #172352;
  --line: #24325e;
  --line2: #33447c;
  --ink: #e8edf7;
  --muted: #8a97b8;
  --accent: #4cc9f0;
  --pink: #ff4d94;
  --amber: #f6a623;
  --green: #2ee6a6;
  --red: #ff6b6b;
  --shadow: 0 6px 24px rgba(3, 8, 24, 0.55);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; }
#app { display: grid; grid-template-rows: auto auto 1fr; grid-template-columns: 1fr 400px; height: 100vh; }
#app.panel-hidden { grid-template-columns: 1fr 0; }
#app.panel-hidden #panel { display: none; }

/* header */
#languages { display: flex; flex: none; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
#languages button { padding: 8px 10px; border: 0; background: var(--panel); color: var(--muted); font: inherit; cursor: pointer; }
#languages button + button { border-left: 1px solid var(--line2); }
#languages button.active { background: var(--panel2); color: var(--ink); box-shadow: inset 0 -2px var(--accent); }
#languages button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
#topbar { flex-wrap: wrap; }
#topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: linear-gradient(110deg, var(--bg) 0%, var(--bg2) 100%); border-bottom: 1px solid var(--line); }
.brand-mark { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border: 1px solid rgba(76, 201, 240, 0.45); border-radius: 10px; background: linear-gradient(145deg, rgba(76, 201, 240, 0.22), rgba(46, 230, 166, 0.08)); color: var(--accent); font-family: var(--mono); font-size: 17px; font-weight: 700; box-shadow: inset 0 0 18px rgba(76, 201, 240, 0.08); }
#title { flex: 1; min-width: 0; }
#title h1 { overflow: hidden; margin: 1px 0 0; font-size: 19px; font-weight: 650; line-height: 1.15; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }
#title .eyebrow { margin: 0; color: var(--muted); font-size: 9.5px; line-height: 1.2; letter-spacing: 0.14em; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); border-radius: 6px; width: 34px; height: 34px; padding: 0; font: inherit; cursor: pointer; flex: none; }
.hamburger { width: 16px; height: 12px; color: var(--ink); border-radius: 1px; background: linear-gradient(to bottom, currentColor 0 2px, transparent 2px 5px, currentColor 5px 7px, transparent 7px 10px, currentColor 10px 12px); }
#search-wrap { position: relative; width: 300px; flex: none; }
#search { width: 100%; height: 34px; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 0 10px; font: inherit; font-size: 13px; }
#search::placeholder { color: var(--muted); }
#search-results { position: absolute; top: 36px; left: 0; right: 0; margin: 0; padding: 4px 0; list-style: none; background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; box-shadow: var(--shadow); max-height: 320px; overflow: auto; z-index: 1300; }
#search-results li { padding: 6px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
#search-results li:hover { background: var(--line); }
#search-results .kind { color: var(--muted); font-size: 11px; font-family: var(--mono); text-transform: uppercase; }
#basemaps { display: flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; flex: none; height: 34px; }
#basemaps button { border: 0; background: var(--panel); color: var(--muted); padding: 0 10px; cursor: pointer; font: inherit; font-size: 12.5px; border-left: 1px solid var(--line2); }
#basemaps button:first-child { border-left: 0; }
#basemaps button.active { background: var(--panel2); color: var(--ink); }

/* layer chips */
#chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 20px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.chip-layer { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 8px; border-radius: 999px; border: 1px solid var(--line2); background: var(--panel); color: var(--muted); font: inherit; font-size: 12.5px; font-family: var(--mono); cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.chip-layer i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); opacity: 0.35; }
.chip-layer.on { color: var(--ink); border-color: var(--line2); background: var(--panel2); }
.chip-layer.on i { opacity: 1; box-shadow: 0 0 8px var(--c, var(--accent)); }
.chip-layer:hover { border-color: var(--accent); }
.chip-layer:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* map */
#mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--bg2); }
.leaflet-container { font: inherit; background: var(--bg2); }
.leaflet-control-zoom a { background: var(--panel) !important; color: var(--ink) !important; border-color: var(--line2) !important; }
.leaflet-bar { border: 1px solid var(--line2) !important; box-shadow: var(--shadow) !important; }
.leaflet-control-scale-line { background: rgba(16, 26, 60, 0.8); color: var(--ink); border-color: var(--line2); font-family: var(--mono); font-size: 10px; }
.leaflet-control-attribution { background: rgba(10, 17, 40, 0.75) !important; color: var(--muted) !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel2); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-content { font-size: 12.5px; line-height: 1.45; margin: 10px 12px; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: 13.5px; }
.leaflet-popup-content .kv { color: var(--muted); }
.leaflet-popup-close-button { color: var(--muted) !important; }
.leaflet-tooltip { background: var(--panel2); color: var(--ink); border: 1px solid var(--line2); box-shadow: none; font-size: 12px; }
.leaflet-tooltip-top::before { border-top-color: var(--line2); }
.aimag-label { font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: #6f7ea6; white-space: nowrap; pointer-events: none; transform: translate(-50%, -50%); text-shadow: 0 0 4px #0a1128, 0 0 4px #0a1128; }
.aimag-label.light { color: #6b7785; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.leaflet-tooltip.city-label { font-family: var(--mono); font-size: 11px; font-weight: 500; color: #dfe6f5; background: transparent; border: 0; box-shadow: none; padding: 0 0 0 7px; text-shadow: 0 0 4px #0a1128, 0 0 4px #0a1128, 0 0 6px #0a1128; white-space: nowrap; pointer-events: none; }
.leaflet-tooltip.city-label::before { display: none; }
.leaflet-tooltip.city-label.light { color: #1d232b; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.plant-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; font-family: var(--mono); border: 2px solid #0a1128; box-shadow: 0 0 0 1px rgba(255,255,255,0.25), 0 1px 6px rgba(0,0,0,0.6); }
.site-pin { width: 18px; height: 18px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 10px var(--accent); }
.zone-badge { position: relative; width: 30px; height: 30px; }
.zone-badge .ring { position: absolute; inset: -10px; border-radius: 50%; border: 2px solid var(--pink); opacity: 0.55; animation: ring 2.6s ease-out infinite; }
.zone-badge .ring.r2 { animation-delay: 1.3s; }
.zone-badge .core { position: absolute; inset: 0; border-radius: 50%; background: var(--pink); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 14px; border: 2px solid #fff; box-shadow: 0 0 14px var(--pink); cursor: pointer; }
.zone-badge.near .core { background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.zone-badge.near .ring { border-color: var(--amber); }
@keyframes ring { 0% { transform: scale(0.55); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .zone-badge .ring { animation: none; opacity: 0.35; } }

#zone-focus { position: absolute; top: 12px; left: 12px; z-index: 1000; width: min(310px, calc(100% - 76px)); padding: 10px; border: 1px solid var(--line2); border-radius: 8px; background: rgba(16, 26, 60, 0.94); box-shadow: var(--shadow); backdrop-filter: blur(5px); }
#zone-focus[hidden] { display: none; }
.zone-relief-shadow { filter: blur(5px); }
.zone-extrusion-walls { filter: brightness(0.48); stroke: none; pointer-events: none; }
.zone-focus-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.zone-focus-head strong { display: block; overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.zone-focus-head small { display: block; margin-top: 2px; color: var(--muted); font: 9px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.zone-focus-close { border: 1px solid var(--line2); border-radius: 5px; padding: 3px 7px; background: var(--panel2); color: var(--ink); cursor: pointer; font: 10.5px var(--font); }
.zone-focus-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 10px; margin-top: 9px; }
.zone-focus-item { display: grid; grid-template-columns: 8px minmax(0, 1fr); align-items: center; gap: 5px; min-width: 0; color: #c5cee3; font-size: 10.5px; }
.zone-focus-item i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 65%, transparent); }
.zone-focus-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone-focus-item b { color: var(--ink); font-family: var(--mono); font-weight: 500; }

#legend { position: absolute; left: 12px; bottom: 28px; background: rgba(16, 26, 60, 0.92); border: 1px solid var(--line2); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 11.5px; max-width: 240px; z-index: 1000; backdrop-filter: blur(4px); }
#legend:empty { display: none; }
#legend .lg-toggle { border: 0; background: transparent; color: var(--ink); font: inherit; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; padding: 2px 0; }
#legend .lg-body { max-height: 46vh; overflow-y: auto; margin-top: 4px; padding-right: 4px; }
#legend .lt { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 6px 0 3px; }
#legend .lt:first-child { margin-top: 0; }
#legend .li { display: flex; align-items: center; gap: 7px; margin: 2px 0; }
#legend .ramp { height: 8px; border-radius: 3px; }
#legend .ramp-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 10.5px; font-family: var(--mono); }
#toast { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--panel2); color: var(--ink); border: 1px solid var(--line2); padding: 8px 14px; border-radius: 6px; font-size: 12.5px; z-index: 1500; box-shadow: var(--shadow); max-width: 80vw; }

/* right panel */
#panel { background: var(--panel); border-left: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; z-index: 1100; }
#tabs { display: flex; border-bottom: 1px solid var(--line); }
#tabs button { flex: 1; border: 0; background: transparent; padding: 10px 2px; cursor: pointer; font: inherit; font-size: 12px; color: var(--muted); border-bottom: 2px solid transparent; }
#tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab { display: none; padding: 14px 16px; overflow: auto; flex: 1; }
.tab.active { display: block; }
.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; line-height: 1.45; }
.tab p, .tab li { line-height: 1.5; }
.tab ul { padding-left: 18px; }
.developer-credit { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel); color: var(--muted); font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; }
/* ⛔ Тэмдэг нь MURCH VISION гэсэн БҮТЭН нэр. Урьд нь «VISION» нь байхгүй
   тайруулсан зураг тавигдсан байв — компанийн нэр хагас байж болохгүй. */
.developer-credit img { display: block; width: 112px; height: auto; }
code { background: var(--panel2); padding: 1px 4px; border-radius: 3px; font-family: var(--mono); font-size: 11.5px; }

/* zone cards */
.zcard { border: 1px solid var(--line2); border-radius: 10px; background: var(--panel2); padding: 12px 12px 10px; margin-bottom: 10px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.zcard:hover { border-color: var(--accent); }
.zcard.top { border-color: var(--pink); box-shadow: 0 0 0 1px rgba(255,77,148,0.35), 0 0 18px rgba(255,77,148,0.25); }
.zcard.sel { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(76,201,240,0.5); }
.zcard .zh { display: flex; align-items: center; gap: 10px; }
.zcard .badge { width: 26px; height: 26px; border-radius: 50%; background: var(--pink); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 13px; flex: none; box-shadow: 0 0 10px rgba(255,77,148,0.5); }
.zcard.near .badge { background: var(--amber); box-shadow: 0 0 10px rgba(246,166,35,0.45); }
.zcard .zname { font-weight: 600; font-size: 14px; line-height: 1.2; flex: 1; }
.zcard .zname small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.zcard .rank { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; flex: none; }
.zcard .zdesc { font-size: 12.5px; color: #c5cee3; line-height: 1.45; margin: 8px 0; }
.zcard .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; color: #0a1128; background: var(--c, #ccc); font-weight: 600; }
.tag.off { background: var(--line); color: var(--muted); text-decoration: line-through; }
.zcard .zfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.zcard .zfoot b { color: var(--pink); }
.zcard.near .zfoot b { color: var(--amber); }
.zcard .zfoot .note { color: var(--accent); }
.takeaways { padding-left: 18px; margin: 0; font-size: 12.5px; color: #c5cee3; }
.takeaways li { margin-bottom: 6px; }
.takeaways b { color: var(--ink); }

/* layers list */
.lgroup { margin-bottom: 10px; }
.lgroup > .ghead { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; margin: 10px 0 4px; }
.litem { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; }
.litem:hover { background: var(--panel2); }
.litem input[type="checkbox"], .orow input[type="checkbox"], .chk input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.litem .sw { width: 22px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(255,255,255,0.12); }
.litem .sw.line { height: 4px; border-radius: 2px; border: 0; }
.litem .sw.dash { height: 0; border: 0; border-top: 3px dashed; background: none !important; }
.litem .sw.dot { width: 12px; height: 12px; border-radius: 50%; margin: 0 5px; }
.litem .sw.ramp { border: 0; }
.litem label { flex: 1; cursor: pointer; font-size: 13px; }
.litem .cnt { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.litem input[type="range"], .row input[type="range"] { width: 70px; accent-color: var(--accent); }
.sub-items { margin: 2px 0 6px 26px; padding-left: 8px; border-left: 1px solid var(--line); }
.sub-items .litem { display: grid; grid-template-columns: 15px 22px minmax(0, 1fr) auto; padding: 4px; }
.sub-items .litem label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-items .litem .cnt { min-width: 66px; text-align: right; }

/* overlap thresholds */
.orow { display: grid; grid-template-columns: 16px 1fr 64px auto; align-items: center; gap: 6px; padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.orow input[type="number"] { width: 64px; font: inherit; font-family: var(--mono); font-size: 12px; border: 1px solid var(--line2); background: var(--bg2); color: var(--ink); border-radius: 4px; padding: 2px 4px; text-align: right; }
.orow .unit { color: var(--muted); font-size: 11px; white-space: nowrap; }
.orow.disabled { opacity: 0.45; }
.orow label { cursor: pointer; }

/* site result */
#site-result.empty { color: var(--muted); font-style: italic; padding: 8px 0; }
.score-hero { display: flex; align-items: center; gap: 14px; margin: 8px 0 12px; }
.score-ring { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-family: var(--mono); font-size: 20px; color: #0a1128; flex: none; }
.score-hero .loc { font-size: 13px; line-height: 1.35; }
.score-hero .loc b { font-size: 15px; }
.score-hero .kv { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.metrics { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.metrics td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.metrics td:first-child { color: var(--muted); }
.metrics td:last-child { text-align: right; white-space: nowrap; font-family: var(--mono); }
.metrics .sub { color: var(--muted); font-size: 11px; display: block; font-family: var(--font); }
.bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.overlap-pass { font-size: 12.5px; margin: 0 0 10px; padding: 8px 10px; border-radius: 6px; background: var(--panel2); border-left: 3px solid var(--line2); }
.overlap-pass.near { border-left-color: var(--amber); }
.overlap-pass.all { border-left-color: var(--pink); }
.overlap-pass .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border-radius: 3px; background: var(--line); color: var(--muted); }
.chip.ok { background: rgba(46,230,166,0.18); color: var(--green); }
.chip.no { background: rgba(255,107,107,0.18); color: var(--red); }

#presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
#presets button, .small { border: 1px solid var(--line2); background: var(--panel2); color: var(--ink); border-radius: 14px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
#presets button.active { background: var(--accent); color: #0a1128; border-color: var(--accent); font-weight: 600; }
.wrow { display: grid; grid-template-columns: 1fr 90px 30px; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; }
.wrow .dmax { font-size: 11px; color: var(--muted); }
.wrow .dmax input { width: 48px; font: inherit; font-family: var(--mono); font-size: 11px; border: 1px solid var(--line2); background: var(--bg2); color: var(--ink); border-radius: 4px; padding: 1px 3px; }
.wrow input[type="range"] { width: 100%; accent-color: var(--accent); }
.wrow .wv { text-align: right; font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; font-size: 12.5px; }
.row select { font: inherit; font-size: 12.5px; border: 1px solid var(--line2); background: var(--bg2); color: var(--ink); border-radius: 4px; padding: 3px; }
.chk { display: flex; align-items: center; gap: 6px; cursor: pointer; }

#rank-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#rank-table th { text-align: left; color: var(--muted); font-weight: 500; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; padding: 4px; border-bottom: 1px solid var(--line2); }
#rank-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
#rank-table tbody tr { cursor: pointer; }
#rank-table tbody tr:hover { background: var(--panel2); }
#rank-table td.sc { font-weight: 600; text-align: right; font-family: var(--mono); }
#rank-table .kv { color: var(--muted); }

button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#feedback-open { flex: none; border: 1px solid #07598f; border-radius: 6px; padding: 8px 12px; background: var(--accent); color: #fff; cursor: pointer; font: 600 12.5px var(--font); }
#feedback-backdrop { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px; background: rgba(16, 24, 32, 0.48); }
#feedback-backdrop[hidden] { display: none; }
#feedback-dialog { width: min(440px, 100%); border: 1px solid var(--line2); border-radius: 10px; background: var(--panel); box-shadow: 0 18px 50px rgba(0,0,0,0.5); }
.feedback-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.feedback-head h2 { margin: 0; font-size: 16px; }
.feedback-head button { width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; font: inherit; }
#feedback-form { display: grid; gap: 8px; padding: 16px; }
#feedback-types { display: flex; margin-bottom: 4px; }
#feedback-types button { border: 1px solid var(--line); padding: 6px 14px; background: var(--panel); color: var(--muted); cursor: pointer; font: inherit; }
#feedback-types button:first-child { border-radius: 6px 0 0 6px; }
#feedback-types button:last-child { margin-left: -1px; border-radius: 0 6px 6px 0; }
#feedback-types button.active { position: relative; border-color: var(--accent); background: var(--accent); color: #fff; }
#feedback-form textarea { width: 100%; border: 1px solid var(--line2); border-radius: 6px; padding: 8px 10px; background: var(--bg2); color: var(--ink); font: inherit; }
#feedback-form textarea { resize: vertical; min-height: 110px; }
#feedback-form textarea:focus { outline: 2px solid rgba(11,111,184,0.22); border-color: var(--accent); }
#feedback-count { margin-top: -6px; color: var(--muted); text-align: right; font-size: 11.5px; }
#feedback-drop { display: grid; place-items: center; gap: 4px; min-height: 72px; border: 1px dashed var(--line2); border-radius: 6px; background: var(--bg2); color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; }
#feedback-drop.dragging { border-color: var(--accent); background: var(--panel2); color: var(--accent); }
.feedback-upload-icon { font-size: 22px; line-height: 1; }
#feedback-previews { display: flex; flex-wrap: wrap; gap: 12px; }
.feedback-preview { position: relative; width: 104px; height: 78px; }
.feedback-preview img { width: 100%; height: 100%; border-radius: 4px; object-fit: cover; }
.feedback-preview button { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border: 1px solid #fff; border-radius: 50%; background: var(--bad); color: #fff; cursor: pointer; }
#feedback-context { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
#feedback-context span { border-radius: 10px; padding: 2px 7px; background: var(--panel2); color: var(--muted); font-size: 11px; }
.feedback-note { margin: 0; color: var(--muted); font-size: 11.5px; }
#feedback-status { min-height: 18px; margin: 2px 0 0; color: var(--muted); font-size: 12px; }
#feedback-status.error { color: var(--bad); }
.feedback-actions { display: flex; justify-content: flex-end; gap: 8px; }
.feedback-actions button { border: 1px solid var(--line); border-radius: 6px; padding: 7px 14px; background: var(--panel); cursor: pointer; font: inherit; }
#feedback-submit { border-color: var(--accent); background: var(--accent); color: #fff; }
#feedback-submit:disabled { opacity: 0.6; cursor: wait; }

@media (max-width: 1200px) and (min-width: 961px) {
  #topbar { gap: 8px; }
  #title { flex: 1; min-width: 170px; overflow: hidden; }
  #search-wrap { width: 240px; margin-left: 0; }
  #basemaps button { padding-inline: 7px; }
  #feedback-open { padding-inline: 9px; }
}

@media (max-width: 960px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  #topbar { flex-wrap: wrap; height: auto; padding: 8px 10px; row-gap: 8px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 8px; }
  #title h1 { font-size: 16px; }
  #title .eyebrow { font-size: 8.5px; }
  #search-wrap { width: 100%; margin-left: 0; order: 3; }
  #panel { position: absolute; top: var(--panel-top, 0px); bottom: 0; right: 0; width: min(400px, 94vw); box-shadow: var(--shadow); }
  #app.panel-hidden #panel { display: none; }
  #legend { max-width: 200px; bottom: 30px; }
  #zone-focus { top: 8px; left: 8px; }
  #feedback-open { margin-left: auto; }
}
