:root {
  color-scheme: dark;
  --bg: #07100d;
  --panel: rgba(7, 16, 13, 0.91);
  --panel-solid: #0a1511;
  --line: rgba(218, 255, 228, 0.14);
  --muted: #91a19a;
  --text: #eef8f1;
  --green: #adff2f;
  --green-soft: rgba(173, 255, 47, 0.18);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, sans-serif;
  --drawer-width: min(450px, 94vw);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); }
button, select, input { font: inherit; }
button { color: inherit; }

.app-shell { height: 100%; display: grid; grid-template-rows: 72px 1fr; }
.topbar {
  position: relative; z-index: 30; display: grid; grid-template-columns: 1fr auto;
  align-items: center; height: 72px; padding: 0 22px 0 46px; background: #07100d;
  border-bottom: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.26);
}
.workspace-title { display: flex; align-items: center; gap: 14px; line-height: 1.15; text-align: left; }
.workspace-logo { display: block; height: 40px; width: auto; flex: none; }
.workspace-title-copy { min-width: 0; }
.workspace-title strong { display: block; margin-top: 0; font-size: 15px; font-weight: 500; }
.eyebrow { font-family: var(--mono); color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 14px; font-family: var(--mono); font-size: 11px; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #f0b84c; box-shadow: 0 0 10px currentColor; }
.connection.is-live .status-dot { background: var(--green); }
.connection.is-fallback .status-dot { background: #f0b84c; }
.demo-badge { padding: 7px 10px; border: 1px solid rgba(173,255,47,.35); color: var(--green); background: rgba(173,255,47,.06); letter-spacing: .12em; }

.map-stage { position: relative; min-height: 0; overflow: hidden; background: #102019; }
#map, #fallbackMap { position: absolute; inset: 0; width: 100%; height: 100%; }
#map { z-index: 1; }
#fallbackMap { z-index: 2; display: none; cursor: crosshair; background: radial-gradient(circle at 72% 22%, #264338 0, #14261f 34%, #09130f 72%); }
#fallbackMap.is-dragging { cursor: grabbing; }
.fallback-zoom { position: absolute; z-index: 12; right: 22px; top: 58px; display: none; flex-direction: column; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(0,0,0,.28); transition: right .32s; }
.fallback-zoom button { width: 38px; height: 38px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: #eef8f1; cursor: pointer; font: 22px var(--mono); }
.fallback-zoom button:last-child { border-bottom: 0; }
.fallback-zoom button:hover { color: var(--green); background: rgba(173,255,47,.08); }
.map-stage:has(.detail-drawer.is-open) .fallback-zoom { right: calc(var(--drawer-width) + 18px); }
.map-stage::after { content: ""; position: absolute; z-index: 3; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(173,255,47,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(173,255,47,.025) 1px, transparent 1px); background-size: 54px 54px; mix-blend-mode: screen; }

.mineral-scan-layer { position: absolute; z-index: 8; inset: 0; pointer-events: none; opacity: 1; visibility: visible; transition: opacity .3s ease, visibility 0s linear 0s; }
.mineral-scan-layer.is-hidden { opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s linear .3s; }
.mineral-halo { position: absolute; left: 0; top: 0; width: 58px; height: 58px; margin: -29px 0 0 -29px; border: 0; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.98) 0 3px, rgba(224,255,183,.78) 4px, rgba(173,255,47,.22) 15%, rgba(173,255,47,.07) 40%, transparent 72%); box-shadow: 0 0 12px rgba(255,255,255,.72), 0 0 28px rgba(173,255,47,.36); transition: left .08s linear, top .08s linear, opacity .16s ease; animation: mineral-halo-bloom 1.65s ease-in-out infinite; }
.mineral-halo::before { content: ""; position: absolute; inset: 0; border: 0; border-radius: 50%; background: radial-gradient(circle, transparent 34%, rgba(224,255,183,.2) 36%, transparent 66%); animation: mineral-halo-diffuse 1.8s ease-out infinite; }
.mineral-halo::after { content: ""; position: absolute; inset: 14px; border: 0; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.92), rgba(255,255,255,.18) 35%, transparent 72%); filter: blur(1px); animation: mineral-halo-core 1.2s ease-in-out infinite; }
.mineral-scan-layer.is-locked .mineral-halo { box-shadow: 0 0 15px rgba(255,255,255,.8), 0 0 32px rgba(173,255,47,.52); animation-duration: 1.45s; }
@keyframes mineral-halo-bloom { 0%,100% { opacity: .78; transform: scale(.88); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes mineral-halo-diffuse { 0% { opacity: .55; transform: scale(.45); } 80%,100% { opacity: 0; transform: scale(1.22); } }
@keyframes mineral-halo-core { 0%,100% { opacity: .62; } 50% { opacity: 1; } }
.mineral-prospect-cards { position: absolute; left: 0; top: 0; width: 0; height: 0; transition: opacity .2s ease, transform .2s ease; }
.mineral-prospect-cards.is-refreshing { opacity: 0; transform: translateY(5px); }
.mineral-prospect-card { position: absolute; left: var(--card-x, -86px); top: var(--card-y, -56px); width: 172px; min-height: 44px; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 8px; pointer-events: auto; cursor: pointer; color: #dce9df; text-align: left; background: rgba(7,16,13,.96); border: 1px solid rgba(173,255,47,.28); box-shadow: 0 8px 20px rgba(0,0,0,.42); opacity: 0; transform: translateY(5px) scale(.97); transition: opacity .34s cubic-bezier(.22,.61,.36,1), transform .34s cubic-bezier(.22,.61,.36,1), border-color .28s ease, background .28s ease, filter .34s ease, box-shadow .28s ease; }
.mineral-scan-layer:not(.is-hidden) .mineral-prospect-card { opacity: 1; transform: none; transition-delay: var(--card-delay, 0ms); }
.mineral-prospect-card:hover, .mineral-prospect-card:focus-visible, .mineral-prospect-card.is-selected { border-color: transparent; border-left: 3px solid var(--green); background: rgba(16,31,24,.98); outline: none; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.42); }
.mineral-prospect-card.is-dimmed { opacity: .34 !important; filter: grayscale(.82); transform: scale(.97); }
.mineral-prospect-cards:has(.mineral-prospect-card:hover) .mineral-prospect-card:not(:hover) { opacity: .32 !important; filter: grayscale(1) contrast(.7) saturate(.38); }
.mineral-prospect-thumb { width: 30px; height: 30px; display: block; border: 1px solid rgba(255,255,255,.18); background-image: linear-gradient(145deg, rgba(5,10,8,.05), rgba(5,10,8,.42)), var(--thumb-image, linear-gradient(135deg, #8f6c3c, #3f3325 52%, #bd9a54)); background-position: center, center; background-size: cover, cover; background-repeat: no-repeat; box-shadow: inset 0 0 10px rgba(0,0,0,.34); }
.mineral-prospect-copy { min-width: 0; display: grid; gap: 3px; }
.mineral-prospect-copy strong { overflow: hidden; color: #eff8f1; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.mineral-prospect-copy small { overflow: hidden; color: #a7b7ad; font-size: 10px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.mineral-prospect-card::after { content: "↗"; position: absolute; right: 6px; top: 4px; color: var(--green); font: 10px var(--mono); opacity: .72; }
.mineral-detail-popover { position: absolute; z-index: 16; left: 12px; top: 12px; width: 292px; display: grid; background: rgba(7,16,13,.97); border: 1px solid rgba(173,255,47,.4); box-shadow: 0 18px 44px rgba(0,0,0,.48); opacity: 0; pointer-events: none; transform: translateY(8px) scale(.98); visibility: hidden; transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s; }
.mineral-detail-popover.is-open { opacity: 1; pointer-events: auto; transform: none; visibility: visible; transition: opacity .2s ease, transform .2s ease, visibility 0s; }
.mineral-popover-accent { position: absolute; left: -1px; top: 0; width: 2px; height: 72px; background: var(--green); box-shadow: 0 0 16px rgba(173,255,47,.72); }
.mineral-popover-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 18px; border-bottom: 1px solid var(--line); }
.mineral-popover-header h3 { margin: 5px 0 0; color: #eff8f1; font-size: 18px; line-height: 1.15; }
.mineral-popover-body { display: grid; gap: 12px; padding: 14px 18px 16px; }
.mineral-popover-code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mineral-popover-code-row > span:first-child { color: var(--green); font: 600 18px var(--mono); }
.mineral-popover-specimen { position: relative; height: 108px; margin: 0; overflow: hidden; border: 1px solid rgba(173,255,47,.26); background: #101b16; box-shadow: inset 0 0 24px rgba(0,0,0,.46); }
.mineral-popover-specimen img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; filter: saturate(.92) contrast(1.04) brightness(.86); }
.mineral-popover-specimen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 45%, rgba(3,8,6,.78)); }
.mineral-popover-specimen figcaption { position: absolute; right: 9px; bottom: 7px; left: 9px; z-index: 1; color: rgba(239,248,241,.9); font: 10px var(--mono); letter-spacing: .04em; text-shadow: 0 1px 5px rgba(0,0,0,.86); }
.mineral-popover-media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mineral-popover-media { position: relative; min-width: 0; height: 78px; margin: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.14); background: #111d18; }
.mineral-popover-texture { display: grid; place-items: center; color: rgba(255,255,255,.9); background-size: 16px 16px, 100% 100%; box-shadow: inset 0 0 24px rgba(0,0,0,.4); }
.mineral-popover-texture::before { content: ""; position: absolute; inset: -12%; opacity: .52; background: repeating-linear-gradient(118deg, transparent 0 7px, rgba(255,255,255,.16) 8px 10px, transparent 11px 18px); transform: rotate(-7deg); }
.mineral-popover-texture.copper { background-image: radial-gradient(circle at 25% 30%, #efbd86 0 4%, transparent 5%), linear-gradient(135deg, #c97948, #493025 52%, #7cbeb0); }
.mineral-popover-texture.gold { background-image: radial-gradient(circle at 65% 28%, #fff0a6 0 6%, transparent 7%), linear-gradient(135deg, #d6b342, #55421d 56%, #9b7830); }
.mineral-popover-texture.chromite { background-image: radial-gradient(circle at 30% 28%, #cfddd6 0 5%, transparent 6%), linear-gradient(135deg, #64756c, #1f2a27 60%, #9caea0); }
.mineral-popover-texture.nickel { background-image: radial-gradient(circle at 70% 28%, #e0d7c0 0 5%, transparent 6%), linear-gradient(135deg, #aaa692, #394139 58%, #789487); }
.mineral-popover-texture.gypsum { background-image: radial-gradient(circle at 32% 26%, #fff 0 6%, transparent 7%), linear-gradient(135deg, #e6dec8, #8d9d92 58%, #d3bd81); }
.mineral-popover-texture-code { display: none; }
.mineral-popover-media figcaption { position: absolute; right: 5px; bottom: 4px; left: 5px; z-index: 2; overflow: hidden; color: rgba(239,248,241,.86); font: 9px var(--mono); letter-spacing: .03em; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
.mineral-popover-map img { display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(.72) contrast(.92) brightness(.72); }
.mineral-popover-spec-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.09); }
.mineral-popover-spec-grid > div { min-width: 0; display: grid; gap: 5px; padding: 9px 8px; background: rgba(9,20,15,.82); }
.mineral-popover-spec-grid span { color: #718279; font: 9px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.mineral-popover-spec-grid strong { overflow: hidden; color: #dce9df; font-size: 10px; font-weight: 600; line-height: 1.4; text-overflow: ellipsis; }
.mineral-popover-section { display: grid; gap: 5px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.mineral-popover-section > span { color: #718279; font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.mineral-popover-section strong { color: #dce9df; font-size: 12px; font-weight: 600; text-align: left; }
.mineral-popover-section p { margin: 0; color: #a7b7ad; font-size: 12px; line-height: 1.6; text-align: left; }
.mineral-popover-footnote { color: #6f8177; font-size: 10px; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { .mineral-halo, .mineral-halo::before, .mineral-halo::after { animation: none; } .mineral-scan-layer, .mineral-halo, .mineral-prospect-card { transition-duration: .01ms; } }

.floating-card { position: absolute; z-index: 10; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(16px); box-shadow: 0 18px 55px rgba(0,0,0,.27); }
.intro-card { left: 28px; top: 28px; width: 352px; padding: 28px; transition: opacity .25s, transform .25s, visibility .25s; }
.intro-card.is-hidden { opacity: 0; transform: translateY(-14px); visibility: hidden; }
.intro-close { position: absolute; top: 14px; right: 14px; }
.intro-card h1 { margin: 12px 0 14px; font-size: 30px; line-height: 1.16; letter-spacing: -.045em; }
.intro-card > p { margin: 0; color: #b6c3bd; font-size: 14px; line-height: 1.75; }
.intro-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; margin: 22px 0; background: var(--line); }
.intro-stats div { padding: 12px 10px; background: rgba(7,16,13,.95); }
.intro-stats strong { display: block; color: var(--green); font: 600 18px var(--mono); }
.intro-stats span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.primary-button, .secondary-button { width: 100%; border: 0; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 13px 15px; font: 600 12px var(--mono); letter-spacing: .06em; }
.primary-button { background: var(--green); color: #0a140d; }
.secondary-button { background: transparent; color: var(--text); border: 1px solid var(--line); }
.primary-button:hover, .secondary-button:hover { filter: brightness(1.08); }

.layer-card { left: 28px; top: 28px; width: 315px; padding: 18px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .25s; }
.intro-card.is-hidden + .layer-card { opacity: 1; transform: none; pointer-events: auto; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 4px 0 0; font-size: 16px; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line); background: rgba(255,255,255,.025); cursor: pointer; font-size: 18px; display: grid; place-items: center; }
.icon-button:hover { border-color: rgba(173,255,47,.55); color: var(--green); }
.layer-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 11px; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.07); cursor: pointer; }
.layer-copy strong, .layer-copy small { display: block; }
.layer-copy strong { font-size: 12px; font-weight: 600; transition: color .22s ease, opacity .22s ease; }
.layer-copy small { color: var(--muted); margin-top: 4px; font: 10px var(--mono); transition: color .22s ease, opacity .22s ease; }
.layer-swatch { width: 23px; height: 23px; border: 1px solid rgba(255,255,255,.19); transition: filter .22s ease, opacity .22s ease, border-color .22s ease; }
.layer-swatch.satellite { background: linear-gradient(135deg,#435b41,#15241e 55%,#627151); }
.layer-swatch.national { background: linear-gradient(135deg,#f2d34c,#ec674e 48%,#49699d 74%,#1a413a); }
.layer-swatch.cesium { border-radius: 50%; background: radial-gradient(circle at 65% 30%,#9bd8c1 0 8%,#2c776b 9% 34%,#143d37 35% 60%,#0a1d18 61%); box-shadow: inset -5px -5px 9px rgba(0,0,0,.45); }
.layer-swatch.regional { background: linear-gradient(145deg,#ffebbe 0 25%,#b0c28c 26% 50%,#b5e2eb 51% 74%,#e0c38d 75%); box-shadow: inset 0 -5px 0 rgba(0,0,0,.3); }
.layer-swatch.geology-labels { background: #14231c; position: relative; }
.layer-swatch.geology-labels::after { content: "K"; position: absolute; inset: 0; display: grid; place-items: center; color: #eef8f1; font: 600 11px var(--mono); }
.layer-swatch.provinces { background: repeating-linear-gradient(135deg,rgba(244,176,72,.92) 0 2px,transparent 2px 6px),#17211c; }
.layer-swatch.mineral-sites { border-radius: 50%; background: radial-gradient(circle,#f4b048 0 28%,#17211c 31% 52%,#f4b048 55% 61%,#17211c 64%); }
.layer-swatch.mineral-scan { border-radius: 50%; background: radial-gradient(circle,#fff 0 12%,#dfffb7 14% 28%,transparent 31%), radial-gradient(circle,rgba(173,255,47,.45),#17211c 68%); box-shadow: 0 0 10px rgba(173,255,47,.28); }
.layer-row select { width: 68px; color: #dce8e0; background: #0c1914; border: 1px solid var(--line); padding: 5px; font: 10px var(--mono); }
.layer-tag { padding: 5px 7px; border: 1px solid rgba(173,255,47,.32); color: var(--green); font: 10px var(--mono); }
input[type="checkbox"] { appearance: none; width: 30px; height: 16px; border-radius: 20px; background: #233229; position: relative; cursor: pointer; transition: background-color .22s ease, box-shadow .22s ease; }
input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: #819087; transition: left .22s ease, background-color .22s ease; }
input[type="checkbox"]:checked { background: rgba(173,255,47,.28); }
input[type="checkbox"]:checked::after { left: 17px; background: var(--green); }
.layer-row:has(input[type="checkbox"]:not(:checked)) .layer-swatch { filter: grayscale(.72) saturate(.42) brightness(.78); opacity: .8; border-color: rgba(255,255,255,.12); }
.layer-row:has(input[type="checkbox"]:not(:checked)) .layer-copy strong { color: #a7b2ac; opacity: .9; }
.layer-row:has(input[type="checkbox"]:not(:checked)) .layer-copy small { color: #748078; opacity: .86; }
.layer-row:has(input[type="checkbox"]:checked) .layer-swatch { filter: none; opacity: 1; }
.opacity-row { display: grid; grid-template-columns: 58px 1fr 32px; align-items: center; gap: 8px; padding: 10px 0 2px; font: 10px var(--mono); color: var(--muted); }
input[type="range"] { accent-color: var(--green); height: 2px; }
.opacity-row output { text-align: right; color: var(--green); }

.coordinate-card { left: 28px; bottom: 42px; min-width: 420px; padding: 11px 12px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.coordinate-status { display: flex; align-items: center; gap: 10px; }
.coordinate-status strong { display: block; margin-top: 4px; font: 500 12px var(--mono); }
.crosshair { color: var(--green); font: 22px var(--mono); }
.text-button { border: 0; padding: 0; background: transparent; color: var(--green); cursor: pointer; font: 11px var(--mono); letter-spacing: .05em; }
.text-button:disabled { color: #56635d; cursor: default; }

.language-switch { left: 28px; bottom: 108px; display: flex; padding: 4px; direction: ltr; }
.language-switch button { min-height: 30px; padding: 0 11px; border: 0; border-right: 1px solid var(--line); color: #83928a; background: transparent; cursor: pointer; font: 500 11px var(--mono); }
.language-switch button:last-child { border-right: 0; }
.language-switch button:hover { color: var(--text); }
.language-switch button.is-active { color: var(--green); background: rgba(173,255,47,.09); }
.language-switch button:focus-visible { outline: 1px solid var(--green); outline-offset: -1px; }

body[data-locale="ar"] .intro-card,
body[data-locale="ar"] .layer-card,
body[data-locale="ar"] .coordinate-card,
body[data-locale="ar"] .legend-card,
body[data-locale="ar"] .agent-panel,
body[data-locale="ar"] .detail-drawer,
body[data-locale="ar"] .map-key-dialog { direction: rtl; text-align: right; }
body[data-locale="ar"] .intro-close { right: auto; left: 14px; }
body[data-locale="ar"] .geology-readout::after { right: auto; left: 0; }
body[data-locale="ar"] .ai-message.assistant { border-left: 0; border-right: 2px solid var(--green); }
body[data-locale="ar"] .ai-form button { border-left: 0; border-right: 1px solid var(--line); }
body[data-locale="ar"] .agent-launcher { text-align: right; }
body[data-locale="ar"] .agent-result-grid div { border-right: 0; border-left: 1px solid var(--line); }
body[data-locale="ar"] .agent-result-grid div:last-child { border-left: 0; }

.legend-card {
  left: 28px; top: var(--legend-top, 560px); width: 315px; padding: 15px 18px;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: top .25s, opacity .25s, transform .25s;
}
.intro-card.is-hidden + .layer-card + .legend-card { opacity: 1; transform: none; pointer-events: auto; }
.detail-drawer.is-open ~ .map-attribution { right: calc(var(--drawer-width) + 18px); }
.map-stage:has(.detail-drawer.is-open) .agent-panel { right: calc(var(--drawer-width) + 18px); }
.legend-header { display: flex; justify-content: space-between; align-items: center; }
.legend-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px 8px; max-height: 0; overflow: hidden; margin-top: 0; transition: .25s; }
.legend-card.is-expanded .legend-list { max-height: 200px; margin-top: 12px; overflow: visible; }
.legend-item { position: relative; display: flex; align-items: center; gap: 6px; color: #c8d3cd; font: 10px var(--mono); cursor: default; outline: none; }
.legend-item i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.legend-item::after {
  content: attr(data-tooltip); position: absolute; z-index: 30; left: 0; bottom: calc(100% + 7px);
  width: max-content; max-width: 210px; padding: 7px 9px; color: #eef8f1; background: #101c17;
  border: 1px solid rgba(173,255,47,.32); box-shadow: 0 8px 22px rgba(0,0,0,.42);
  font: 11px/1.4 var(--sans); white-space: normal; opacity: 0; transform: translateY(3px);
  visibility: hidden; pointer-events: none; transition: opacity .14s, transform .14s, visibility .14s;
}
.legend-item:nth-child(4n+3)::after, .legend-item:nth-child(4n+4)::after { left: auto; right: 0; }
.legend-item:hover::after, .legend-item:focus-visible::after { opacity: 1; transform: none; visibility: visible; }
body[data-locale="ar"] .legend-item::after { direction: rtl; text-align: right; }
.legend-cursor-hint { position: fixed; z-index: 200; width: 12px; height: 12px; display: grid; place-items: center; border: 1px solid rgba(173,255,47,.45); border-radius: 50%; color: var(--green); background: rgba(7,16,13,.94); box-shadow: 0 3px 8px rgba(0,0,0,.35); font: 700 8px/1 var(--mono); opacity: 0; transform: translate(18px, 14px) scale(.8); visibility: hidden; pointer-events: none; transition: opacity .16s, transform .16s, visibility 0s linear .16s; }
.legend-cursor-hint.is-visible { opacity: .9; transform: translate(18px, 14px) scale(1); visibility: visible; transition: opacity .12s, transform .12s, visibility 0s; }
.legend-card p { margin: 10px 0 0; color: #77867e; font-size: 10px; line-height: 1.5; }
.map-attribution { position: absolute; z-index: 9; right: 22px; top: 14px; display: flex; gap: 10px; transition: right .32s; }
.map-attribution span { padding: 5px 7px; background: rgba(5,11,9,.7); color: #95a29b; font: 10px var(--mono); }

.detail-drawer { position: absolute; z-index: 20; top: 0; right: 0; bottom: 0; width: var(--drawer-width); display: grid; grid-template-rows: auto 1fr auto; background: rgba(8,18,14,.97); border-left: 1px solid var(--line); box-shadow: -22px 0 60px rgba(0,0,0,.4); transform: translateX(102%); transition: transform .32s cubic-bezier(.2,.8,.2,1); }
.detail-drawer.is-open { transform: translateX(0); }
.drawer-accent { position: absolute; top: 0; left: -1px; width: 2px; height: 92px; background: var(--green); box-shadow: 0 0 16px rgba(173,255,47,.7); }
.detail-drawer .drawer-header > div, .detail-drawer .drawer-body, .detail-drawer .drawer-footer { transition: opacity .12s ease, transform .12s ease; }
.detail-drawer.is-content-leaving .drawer-header > div, .detail-drawer.is-content-leaving .drawer-body, .detail-drawer.is-content-leaving .drawer-footer { opacity: 0; transform: translateY(-6px); }
.detail-drawer.is-content-entering .drawer-header > div { animation: drawer-content-enter .24s cubic-bezier(.2,.8,.2,1) both; }
.detail-drawer.is-content-entering .target-hero { animation: drawer-content-enter .24s .035s cubic-bezier(.2,.8,.2,1) both; }
.detail-drawer.is-content-entering .target-summary { animation: drawer-content-enter .24s .065s cubic-bezier(.2,.8,.2,1) both; }
.detail-drawer.is-content-entering .metric-grid { animation: drawer-content-enter .24s .09s cubic-bezier(.2,.8,.2,1) both; }
.detail-drawer.is-content-entering .drawer-section:nth-of-type(1) { animation: drawer-content-enter .24s .125s cubic-bezier(.2,.8,.2,1) both; }
.detail-drawer.is-content-entering .drawer-section:nth-of-type(2) { animation: drawer-content-enter .24s .16s cubic-bezier(.2,.8,.2,1) both; }
.detail-drawer.is-content-entering .drawer-section:nth-of-type(3) { animation: drawer-content-enter .24s .195s cubic-bezier(.2,.8,.2,1) both; }
.detail-drawer.is-content-entering .drawer-footer-actions { animation: drawer-content-enter .24s .23s cubic-bezier(.2,.8,.2,1) both; }
.detail-drawer.is-content-entering .drawer-accent { animation: drawer-accent-pulse .42s ease-out both; }
.detail-drawer.is-content-entering .national-geology-strip > div { animation: geology-profile-reveal .34s .13s cubic-bezier(.2,.8,.2,1) both; }
.geology-readout::after { transition: border-color .26s, background-color .26s, transform .26s; }
@keyframes drawer-content-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes drawer-accent-pulse { 0% { filter: brightness(2.1); box-shadow: 0 0 28px rgba(173,255,47,.95); } 100% { filter: none; box-shadow: 0 0 16px rgba(173,255,47,.7); } }
@keyframes geology-profile-reveal { from { clip-path: inset(0 100% 0 0); opacity: .35; } to { clip-path: inset(0); opacity: 1; } }
.drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 23px 25px 19px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 5px 0 0; font-size: 18px; }
.drawer-body { min-height: 0; overflow-y: auto; padding: 23px 25px; scrollbar-width: thin; scrollbar-color: #415248 transparent; }
.target-hero { display: flex; align-items: center; justify-content: space-between; }
.target-code { font: 600 28px var(--mono); letter-spacing: -.04em; }
.confidence-pill { padding: 6px 8px; border: 1px solid rgba(173,255,47,.35); color: var(--green); background: var(--green-soft); font: 10px var(--mono); }
.target-summary { margin: 14px 0 20px; color: #aebbb4; line-height: 1.65; font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); }
.metric-grid div { padding: 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-grid div:nth-child(2n) { border-right: 0; }
.metric-grid div:nth-last-child(-n+2) { border-bottom: 0; }
.metric-grid span { display: block; color: var(--muted); font: 10px var(--mono); letter-spacing: .08em; }
.metric-grid strong { display: block; margin-top: 6px; font: 500 13px var(--mono); }
.drawer-section { display: grid; grid-template-columns: 28px 1fr; gap: 11px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.section-index { color: var(--green); font: 11px var(--mono); }
.drawer-section h3 { margin: 7px 0 7px; font-size: 16px; }
.drawer-section p { margin: 0; color: #91a098; font-size: 12px; line-height: 1.65; }
.geology-readout { position: relative; }
.geology-readout::after { content: ""; position: absolute; right: 0; top: 21px; width: 34px; height: 34px; border: 1px solid var(--unit-color, #a4b895); background: color-mix(in srgb, var(--unit-color, #a4b895) 35%, transparent); }
.national-geology-guide { display: grid; gap: 9px; margin-top: 14px; }
.national-geology-guide[hidden] { display: none; }
.national-geology-strip { margin: 0; border: 1px solid rgba(255,255,255,.12); background: #07100d; overflow: hidden; }
.national-geology-strip > div { position: relative; height: 66px; overflow: hidden; background: linear-gradient(115deg, color-mix(in srgb, var(--profile-color, #8aa078) 24%, #07100d), #101c17 72%); }
.national-geology-strip i { position: absolute; left: -5%; width: 110%; border-top: 1px solid color-mix(in srgb, var(--profile-color, #8aa078) 72%, white); transform: rotate(-3deg); }
.national-geology-strip i:nth-child(1) { bottom: -7px; height: 27px; background: color-mix(in srgb, var(--profile-color, #8aa078) 66%, #07100d); }
.national-geology-strip i:nth-child(2) { bottom: 15px; height: 14px; background: color-mix(in srgb, var(--profile-color, #8aa078) 44%, #15221c); transform: rotate(2deg); }
.national-geology-strip i:nth-child(3) { bottom: 32px; height: 9px; background: color-mix(in srgb, var(--profile-color, #8aa078) 74%, #cbd8d0); transform: rotate(-1deg); }
.national-geology-strip i:nth-child(4) { bottom: 45px; height: 7px; background: color-mix(in srgb, var(--profile-color, #8aa078) 35%, #07100d); transform: rotate(1deg); }
.national-geology-strip[data-family="surficial"] > div { background: radial-gradient(ellipse at 18% 110%, color-mix(in srgb, var(--profile-color) 76%, #ead9aa) 0 27%, transparent 28%), radial-gradient(ellipse at 60% 115%, color-mix(in srgb, var(--profile-color) 62%, #d7c18f) 0 35%, transparent 36%), #122019; }
.national-geology-strip[data-family="evaporite"] > div { background: repeating-linear-gradient(0deg, color-mix(in srgb, var(--profile-color) 65%, #d9ddd8) 0 7px, #1a2721 8px 13px); }
.national-geology-strip[data-family="basement"] > div { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--profile-color) 70%, #111b17) 0 16px, #111b17 17px 27px, color-mix(in srgb, var(--profile-color) 35%, #526058) 28px 31px); }
.national-geology-strip[data-family="ophiolite"] > div { background: linear-gradient(125deg, #16261e 0 22%, color-mix(in srgb, var(--profile-color) 70%, #344f3f) 23% 40%, #402f24 41% 53%, color-mix(in srgb, var(--profile-color) 50%, #101b16) 54% 74%, #182720 75%); }
.national-geology-strip[data-family="surficial"] i, .national-geology-strip[data-family="evaporite"] i, .national-geology-strip[data-family="basement"] i, .national-geology-strip[data-family="ophiolite"] i { display: none; }
.national-geology-strip figcaption { display: flex; justify-content: space-between; gap: 10px; padding: 7px 9px; color: #7f8e86; background: rgba(255,255,255,.025); font: 9px var(--mono); }
.national-geology-strip figcaption span { color: var(--green); }
.national-geology-strip figcaption b { font-weight: 400; text-align: right; }
.national-geology-guide article { padding: 10px 11px; border-left: 2px solid rgba(173,255,47,.55); background: rgba(173,255,47,.035); }
.national-geology-guide article > span { display: block; margin-bottom: 5px; color: var(--green); font: 10px var(--mono); letter-spacing: .06em; }
.national-geology-guide article p { color: #a8b5ae; font-size: 11px; line-height: 1.62; }
.national-guide-caution { padding: 8px 10px; border: 1px solid rgba(244,176,72,.22); color: #b6a98d !important; background: rgba(244,176,72,.045); font-size: 10px !important; }
.national-guide-source { color: #6f7f76 !important; font: 9px/1.55 var(--mono) !important; }
.national-guide-source a { color: #9fb891; text-decoration: none; border-bottom: 1px solid rgba(159,184,145,.35); }
.national-guide-source a:hover { color: var(--green); border-color: var(--green); }
body[data-locale="ar"] .national-geology-guide article { border-left: 0; border-right: 2px solid rgba(173,255,47,.55); }
.evidence-list { margin-top: 10px; display: grid; gap: 9px; }
.evidence-list div { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; color: #c8d2cc; font-size: 11px; }
.evidence-list b { color: #78867e; font: 10px var(--mono); font-weight: 400; }
.evidence-dot { width: 5px; height: 5px; border-radius: 50%; background: #506057; }
.evidence-dot.active { background: var(--green); box-shadow: 0 0 8px rgba(173,255,47,.65); }
.drawer-footer { padding: 15px 25px 20px; border-top: 1px solid var(--line); }
.drawer-footer-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-footer-actions p { margin: 0; color: #6f7f76; font-size: 10px; line-height: 1.4; }

.agent-panel {
  z-index: 16; right: 22px; bottom: 42px; width: 212px; max-height: 52px; overflow: hidden;
  border-color: rgba(173,255,47,.28); transition: right .32s cubic-bezier(.2,.8,.2,1), width .28s cubic-bezier(.2,.8,.2,1), max-height .34s cubic-bezier(.2,.8,.2,1);
}
.agent-panel.is-open { width: 398px; max-height: var(--agent-open-height, 580px); }
.agent-launcher { width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 0; background: rgba(7,16,13,.96); cursor: pointer; text-align: left; }
.agent-launcher:hover { background: rgba(16,31,24,.98); }
.agent-launcher-main { min-width: 0; display: flex; align-items: center; gap: 10px; }
.agent-launcher-main > i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(173,255,47,.78); }
.agent-launcher-main > span { min-width: 0; display: grid; gap: 3px; }
.agent-launcher strong { font: 600 12px var(--mono); letter-spacing: .02em; }
.agent-launcher small { overflow: hidden; color: var(--muted); font: 10px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.agent-launcher-arrow { color: var(--green); font: 16px var(--mono); }
.agent-panel.is-open .agent-launcher { display: none; }
.agent-expanded { display: none; background: rgba(7,16,13,.98); }
.agent-panel.is-open .agent-expanded { display: block; }
.agent-header { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.agent-header h2 { margin: 4px 0 0; font: 600 15px var(--mono); letter-spacing: .02em; }
.agent-header-actions { display: flex; align-items: center; gap: 9px; }
.agent-header-actions > span { color: #e4aa51; font: 10px var(--mono); white-space: nowrap; }
.agent-header .icon-button { width: 30px; height: 30px; font-size: 15px; }
.agent-context { padding: 11px 14px 12px; border-bottom: 1px solid var(--line); background: rgba(173,255,47,.025); }
.agent-context > div { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin-top: 8px; align-items: baseline; }
.agent-context > div span { color: #73827a; font: 10px var(--mono); }
.agent-context > div strong { overflow: hidden; color: #c9d5ce; font: 500 11px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.agent-view { display: none; }
.agent-view.is-active { display: block; }
.ai-messages { max-height: 190px; min-height: 112px; overflow-y: auto; padding: 12px; display: grid; align-content: start; gap: 9px; scrollbar-width: thin; }
.ai-message { width: fit-content; max-width: 88%; padding: 7px 9px; font-size: 12px; line-height: 1.55; }
.ai-message.assistant { color: #b8c7bf; background: #101e18; border-left: 2px solid var(--green); }
.ai-message.user { justify-self: end; color: #07100d; background: var(--green); }
.ai-message.typing { color: #829087; }
.ai-message.error { color: #e0a89b; background: #1e1210; border-left: 2px solid #c86f4b; }
/* 案例报告卡片 */
.ai-message.report-card { display: flex; align-items: center; gap: 10px; cursor: pointer; border: 1px solid var(--line); background: linear-gradient(135deg, rgba(143,191,111,.08), rgba(143,191,111,.02)); transition: border-color .18s ease, background .18s ease; }
.ai-message.report-card:hover, .ai-message.report-card:focus-visible { border-color: var(--green); background: linear-gradient(135deg, rgba(143,191,111,.14), rgba(143,191,111,.04)); outline: none; }
.report-card-icon { font-size: 18px; color: var(--green); flex: none; }
.report-card-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.report-card-body strong { font-size: 12.5px; color: #dbe6df; }
.report-card-body small { font-size: 10.5px; color: #829087; }
.report-card-open { flex: none; font-size: 10.5px; color: var(--green); border: 1px solid var(--line); padding: 4px 10px; font-family: var(--mono); letter-spacing: .04em; }

/* 报告预览 lightbox */
.report-lightbox { position: fixed; inset: 0; z-index: 500; background: rgba(4,8,6,.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; }
.report-lightbox[hidden] { display: none; }
.report-lightbox-frame { width: min(880px, 92vw); height: min(640px, 86vh); background: #0c1410; border: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,.5); }
.report-lightbox-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.report-lightbox-bar button { background: none; border: 1px solid var(--line); color: var(--ink); font: 11px var(--mono); padding: 5px 14px; cursor: pointer; }
.report-lightbox-bar button:hover { border-color: var(--green); color: var(--green); }
#reportFrame { flex: 1; border: 0; width: 100%; }

/* 模型回答的 Markdown 渲染元素 */
.ai-message .md-p { margin: 0 0 6px; }
.ai-message .md-p:last-child { margin-bottom: 0; }
.ai-message .md-h { margin: 8px 0 4px; color: #dbe6df; font-weight: 600; }
.ai-message .md-list { margin: 2px 0 8px; padding-inline-start: 18px; }
.ai-message .md-list li { margin: 2px 0; }
.ai-message .md-pre { margin: 6px 0; padding: 8px; overflow-x: auto; background: rgba(0,0,0,.35); border: 1px solid var(--line); font: 11px var(--mono); direction: ltr; text-align: left; }
.ai-message .md-code { padding: 1px 4px; background: rgba(0,0,0,.35); font-family: var(--mono); font-size: 11px; }
.ai-message .md-link { color: var(--green); text-decoration: underline; }
.ai-message strong { color: #dbe6df; }
body[data-locale="ar"] .ai-message { direction: rtl; text-align: right; }
.ai-suggestions { display: flex; gap: 6px; padding: 0 10px 8px; }
.ai-suggestions button { border: 1px solid var(--line); background: transparent; color: #94a39b; padding: 5px 7px; cursor: pointer; font: 11px var(--mono); }
.ai-suggestions button:hover { color: var(--green); border-color: rgba(173,255,47,.4); }
.ai-form { display: grid; grid-template-columns: 1fr 38px; border-top: 1px solid var(--line); }
.ai-form input { min-width: 0; border: 0; outline: 0; padding: 10px 11px; color: #edf7f0; background: transparent; font-size: 12px; }
.ai-form input::placeholder { color: #64736b; }
.ai-form button { border: 0; border-left: 1px solid var(--line); background: rgba(173,255,47,.09); color: var(--green); cursor: pointer; font-size: 17px; }
.agent-thinking-view { padding: 18px 14px 16px; }
.agent-thinking-heading { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; }
.agent-thinking-heading > div { display: grid; gap: 5px; }
.agent-thinking-heading strong { font-size: 13px; font-weight: 600; }
.agent-thinking-heading small { color: #78877f; font: 10px var(--mono); }
.agent-spinner { width: 24px; height: 24px; flex: none; border: 2px solid rgba(173,255,47,.18); border-top-color: var(--green); border-radius: 50%; animation: agent-spin .8s linear infinite; }
@keyframes agent-spin { to { transform: rotate(360deg); } }
.agent-steps { display: grid; border: 1px solid var(--line); max-height: 224px; overflow-y: auto; scrollbar-width: thin; }
.agent-step { display: grid; grid-template-columns: 26px 1fr 9px; align-items: center; gap: 10px; min-height: 54px; padding: 9px 11px; border-bottom: 1px solid var(--line); }
.agent-step:last-child { border-bottom: 0; }
.agent-step > span { color: #64736b; font: 10px var(--mono); }
.agent-step > div { display: grid; gap: 4px; }
.agent-step strong { color: #a8b6ae; font-size: 11px; font-weight: 500; }
.agent-step small { color: #5d6c64; font: 10px var(--mono); }
.agent-step > i { width: 7px; height: 7px; border: 1px solid #4e5d55; border-radius: 50%; }
.agent-step.is-running { background: rgba(173,255,47,.035); }
.agent-step.is-running strong, .agent-step.is-running small { color: var(--green); }
.agent-step.is-running > i { border-color: var(--green); box-shadow: 0 0 9px rgba(173,255,47,.55); animation: agent-pulse 1s ease-in-out infinite; }
.agent-step.is-complete > i { border-color: var(--green); background: var(--green); }
.agent-step.is-complete small { color: #8ca276; }
@keyframes agent-pulse { 50% { opacity: .35; } }
.agent-result-view { padding: 16px 14px; max-height: min(520px, calc(100vh - 210px)); overflow-y: auto; scrollbar-width: thin; }
.agent-result-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 7px 0 9px; }
.agent-result-title h3 { margin: 0; font-size: 17px; }
.agent-result-title span { padding: 4px 6px; border: 1px solid rgba(173,255,47,.3); color: var(--green); font: 9px var(--mono); }
.agent-result-summary { margin: 0 0 13px; color: #a9b7af; font-size: 12px; line-height: 1.6; }
.agent-result-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); }
.agent-result-grid div { min-width: 0; padding: 10px; border-right: 1px solid var(--line); }
.agent-result-grid div:last-child { border-right: 0; }
.agent-result-grid span, .agent-result-grid strong { display: block; }
.agent-result-grid span { color: #6f7f76; font: 9px var(--mono); }
.agent-result-grid strong { overflow: hidden; margin-top: 6px; color: #dbe6df; font: 500 11px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.agent-result-block { display: grid; grid-template-columns: 25px 1fr; gap: 9px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.agent-result-block > span { color: var(--green); font: 10px var(--mono); }
.agent-result-block strong { font-size: 11px; }
.agent-result-block p { margin: 5px 0 0; color: #87968e; font-size: 11px; line-height: 1.55; }
.agent-result-disclaimer { margin: 12px 0; color: #65736b; font-size: 10px; line-height: 1.5; }
.agent-result-view .secondary-button { justify-content: center; padding: 10px 12px; }

.cesium-viewer, .cesium-viewer-cesiumWidgetContainer, .cesium-widget, .cesium-widget canvas { width: 100%; height: 100%; }
.cesium-viewer-bottom { right: 8px; left: auto; }
.cesium-credit-logoContainer { display: none !important; }
.cesium-widget-credits { display: none !important; }
.cesium-viewer-toolbar { top: 14px; right: 16px; }

.dm-marker { width: 24px; height: 24px; border: 1px solid var(--green); background: rgba(8,18,14,.85); border-radius: 50%; position: relative; box-shadow: 0 0 0 5px rgba(173,255,47,.08); cursor: pointer; }
.dm-marker::after { content: ""; position: absolute; inset: 7px; background: var(--green); border-radius: 50%; }
.dm-marker span { position: absolute; left: 29px; top: 3px; white-space: nowrap; background: rgba(7,16,13,.82); padding: 3px 5px; color: white; font: 10px var(--mono); }

.gm-style .gm-style-iw-c, .gm-style .gm-style-iw-tc::after { background: #0b1712; color: #fff; }
.gm-style-cc { opacity: .75; }

.map-key-modal { position: fixed; z-index: 1000; inset: 0; display: none; place-items: center; padding: 24px; background: rgba(2,8,6,.78); backdrop-filter: blur(10px); }
.map-key-modal.is-open { display: grid; }
.map-key-dialog { width: min(520px, 100%); padding: 28px; border: 1px solid rgba(173,255,47,.34); background: #09130f; box-shadow: 0 24px 90px rgba(0,0,0,.65); }
.map-key-dialog h2 { margin: 9px 0 8px; font-size: 25px; }
.map-key-dialog p { margin: 0 0 22px; color: #93a299; font-size: 13px; line-height: 1.65; }
.map-key-dialog code { color: var(--green); font-family: var(--mono); }
.map-key-dialog label { display: block; margin-bottom: 7px; color: #bcc9c2; font: 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.map-key-dialog input { width: 100%; height: 45px; padding: 0 12px; border: 1px solid var(--line); outline: 0; color: #edf7f0; background: #050d09; font: 13px var(--mono); }
.map-key-dialog input:focus { border-color: rgba(173,255,47,.62); box-shadow: 0 0 0 3px rgba(173,255,47,.08); }
.map-key-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.map-key-actions button { min-height: 38px; padding: 0 14px; cursor: pointer; font: 11px var(--mono); }
.map-key-skip { border: 1px solid var(--line); color: #9baaa2; background: transparent; }
.map-key-save { border: 1px solid var(--green); color: #07100d; background: var(--green); font-weight: 700; }

@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; height: 64px; padding: 0 14px 0 30px; }
  .app-shell { grid-template-rows: 64px 1fr; }
  .connection { display: none; }
  .intro-card { left: 12px; top: 12px; width: min(350px, calc(100vw - 24px)); }
  .layer-card { left: 12px; top: 12px; width: min(315px, calc(100vw - 24px)); }
  .language-switch { left: 12px; bottom: 78px; }
  .coordinate-card { left: 12px; right: 12px; bottom: 12px; min-width: 0; }
  .legend-card, .map-attribution { display: none; }
  .agent-panel, .map-stage:has(.detail-drawer.is-open) .agent-panel { right: 12px; bottom: 78px; width: min(212px, calc(100vw - 24px)); }
  .agent-panel.is-open { width: min(398px, calc(100vw - 24px)); }
  .fallback-zoom { right: 12px; top: 12px; }
  .map-stage:has(.detail-drawer.is-open) .fallback-zoom { right: calc(var(--drawer-width) + 8px); }
}

@media (prefers-reduced-motion: reduce) {
  .detail-drawer, .detail-drawer *, .legend-cursor-hint, .layer-swatch, .layer-copy strong, .layer-copy small { animation: none !important; transition-duration: .01ms !important; }
  .agent-spinner, .agent-step.is-running > i { animation: none !important; }
}

@media (max-height: 720px) {
  .intro-card { padding: 21px; }
  .intro-card h1 { font-size: 25px; margin: 9px 0; }
  .intro-stats { margin: 14px 0; }
  .drawer-section { padding: 14px 0; }
}
