/* GeoSpy — bahasa visual sama dengan prototypes/joy (GOD'S EYE: HUD gelap, hijau matrix/amber). */
:root {
  --bg: #020604;
  --panel: rgba(3, 14, 8, 0.78);
  --panel-solid: #04120a;
  --line: rgba(34, 197, 94, 0.18);
  --line-strong: rgba(34, 197, 94, 0.42);
  --text: #d2f5df;
  --muted: #5f8a72;
  --cyan: #2bff88;
  --amber: #fbbf24;
  --red: #f87171;
  --green: #34d399;
  --violet: #a78bfa;
  --accent: var(--cyan);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --hud: "Rajdhani", "JetBrains Mono", system-ui, sans-serif;
  --left: 340px;
  --right: 380px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font: 13px/1.5 var(--mono); }
body[data-state="analyzing"] { --accent: var(--amber); }
body[data-state="error"] { --accent: var(--red); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
button:disabled { cursor: not-allowed; opacity: .4; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
kbd { font: 600 10px var(--mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }
input {
  width: 100%; font: inherit; color: var(--text);
  background: rgba(2, 6, 4, .7); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
}
input::placeholder { color: var(--muted); }

/* ---------- globe ---------- */
#globe { position: fixed; inset: 0; background: radial-gradient(ellipse at 50% 50%, #04140b 0%, var(--bg) 70%); }
.fx-vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,.7) 100%); }
.globe-fallback { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--muted); max-width: 320px; text-align: center; }
.maplibregl-ctrl-attrib { background: rgba(2,6,4,.6) !important; color: var(--muted); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }

/* pins */
.pin { position: relative; width: 18px; height: 18px; cursor: pointer; }
.pin::before, .pin::after { content: ""; position: absolute; border-radius: 50%; }
.pin::before { inset: 5px; background: var(--c, var(--cyan)); box-shadow: 0 0 12px var(--c, var(--cyan)); }
.pin::after { inset: 0; border: 1.5px solid var(--c, var(--cyan)); animation: ping 1.8s ease-out infinite; }
.pin.rank-1 { --c: var(--amber); width: 26px; height: 26px; }
.pin.rank-1::before { inset: 8px; }
.pin.exif { --c: var(--green); }
.pin.active::after { animation-duration: .9s; }
.pin-label {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  white-space: nowrap; font: 600 12px/1 var(--hud); letter-spacing: .08em; color: var(--c, var(--cyan));
  background: rgba(2,6,4,.8); border: 1px solid currentColor; padding: 3px 6px; border-radius: 3px; pointer-events: none;
}
@keyframes ping { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }

/* ---------- topbar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px;
  background: linear-gradient(180deg, rgba(2,6,4,.92), transparent);
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 18px/1 var(--hud); letter-spacing: .22em; white-space: nowrap; }
.brand-mark { width: 18px; height: 18px; border: 2px solid var(--accent); border-radius: 50%; box-shadow: 0 0 12px var(--accent); position: relative; transition: .3s; }
.brand-mark::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent); }
body[data-state="analyzing"] .brand-mark { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 22px var(--accent); transform: scale(1.1); } }
.brand-sep { color: var(--muted); }
.brand-sub { color: var(--accent); font-weight: 500; transition: color .3s; }
.topbar-controls { display: flex; align-items: center; gap: 12px; }
.engines { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.engines li {
  font: 600 11px/1 var(--hud); letter-spacing: .12em; padding: 5px 8px; border-radius: 3px;
  border: 1px solid var(--line); color: var(--muted); display: flex; align-items: center; gap: 6px;
}
.engines li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.engines li[data-state="ready"] { color: var(--text); }
.engines li[data-state="ready"]::before { background: var(--green); box-shadow: 0 0 6px var(--green); }
.engines li[data-state="demo"]::before { background: var(--amber); }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.seg button { font: 700 12px/1 var(--hud); letter-spacing: .14em; padding: 6px 10px; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--accent); color: #02140a; }

/* ---------- panels ---------- */
.ui { position: fixed; inset: 64px 16px 16px; pointer-events: none; z-index: 2; }
.panel {
  pointer-events: auto; position: absolute; top: 0; bottom: 76px; overflow-y: auto;
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 18px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.panel-left { left: 0; width: var(--left); }
.panel-right { right: 0; width: var(--right); }
.panel-title {
  margin: 14px 0 10px; font: 700 12px/1 var(--hud); letter-spacing: .24em; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.panel-title:first-child { margin-top: 0; }
.panel-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.badge-est { font-size: 10px; letter-spacing: .14em; color: var(--amber); border: 1px solid rgba(251,191,36,.4); padding: 2px 5px; border-radius: 3px; }

/* dropzone */
.drop {
  display: block; position: relative; aspect-ratio: 4 / 3; border-radius: 8px; cursor: pointer; overflow: hidden;
  border: 1.5px dashed var(--line-strong); background: rgba(2,6,4,.55); transition: border-color .2s, background .2s;
}
.drop:hover, .drop.over { border-color: var(--cyan); background: rgba(43,255,136,.06); }
.drop-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 4px; color: var(--muted); }
.drop-empty strong { color: var(--text); font: 600 16px var(--hud); letter-spacing: .08em; }
.drop-icon { font-size: 34px; color: var(--cyan); line-height: 1; text-shadow: 0 0 14px var(--cyan); }
.preview { position: absolute; inset: 0; }
.preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-tag {
  position: absolute; left: 8px; bottom: 8px; font: 600 11px/1 var(--hud); letter-spacing: .12em;
  background: rgba(2,6,4,.8); padding: 4px 6px; border-radius: 3px; color: var(--muted);
}
.preview-tag:empty { display: none; }
.corner { position: absolute; width: 16px; height: 16px; border: 2px solid var(--accent); transition: border-color .3s; }
.corner.tl { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.corner.tr { top: 6px; right: 6px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 6px; left: 6px; border-right: 0; border-top: 0; }
.corner.br { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }
.scan { position: absolute; inset: 0; opacity: 0; transition: opacity .3s; pointer-events: none;
  background-image: linear-gradient(rgba(251,191,36,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(251,191,36,.12) 1px, transparent 1px);
  background-size: 24px 24px; }
.scan i { position: absolute; left: 0; right: 0; height: 30%; top: -30%;
  background: linear-gradient(180deg, transparent, rgba(251,191,36,.35) 85%, var(--amber) 100%);
  animation: sweep 1.6s linear infinite; }
body[data-state="analyzing"] .scan { opacity: 1; }
@keyframes sweep { to { top: 100%; } }

.url-form { margin-top: 8px; }
.hints { margin-top: 8px; color: var(--muted); }
.hints summary { cursor: pointer; font-size: 12px; padding: 4px 0; }
.hints input { margin-top: 6px; }

.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn {
  font: 700 12px/1 var(--hud); letter-spacing: .16em; padding: 10px 12px; border-radius: 5px;
  border: 1px solid var(--line-strong); color: var(--text); background: rgba(2,6,4,.5); transition: .15s;
}
.btn:not(:disabled):hover { border-color: var(--cyan); color: var(--cyan); }
.btn.primary { flex: 1; background: var(--cyan); color: #02140a; border-color: var(--cyan); box-shadow: 0 0 18px rgba(43,255,136,.35); }
.btn.primary:not(:disabled):hover { color: #02140a; box-shadow: 0 0 26px rgba(43,255,136,.6); }
.btn.ghost { border-color: transparent; color: var(--muted); }

/* pipeline */
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.stages li {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 5px; color: var(--muted);
  border-left: 2px solid transparent; transition: .25s;
}
.stages li b { font: 700 11px var(--hud); letter-spacing: .1em; color: var(--muted); }
.stages li .ms { margin-left: auto; font-size: 11px; }
.stages li[data-status="start"] { color: var(--text); border-left-color: var(--amber); background: rgba(251,191,36,.07); }
.stages li[data-status="start"] .ms::after { content: "…"; animation: blink 1s steps(2) infinite; }
.stages li[data-status="done"] { color: var(--text); border-left-color: var(--green); }
.stages li[data-status="done"] b { color: var(--green); }
.stages li[data-status="skipped"] { opacity: .5; text-decoration: line-through; }
.stages li[data-status="error"] { color: var(--red); border-left-color: var(--red); }
@keyframes blink { 50% { opacity: 0; } }

/* candidates */
.candidates, .evidence { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.empty { color: var(--muted); font-size: 12px; padding: 6px 0; }
.cand {
  --c: var(--cyan);
  position: relative; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 10px 44px; cursor: pointer;
  background: rgba(2,6,4,.45); transition: border-color .2s, transform .2s;
}
.cand.fresh { animation: rise .35s ease-out both; }
.cand:hover, .cand.active { border-color: var(--c); }
.cand.active { box-shadow: inset 0 0 0 1px var(--c); }
.cand[data-rank="1"] { --c: var(--amber); }
.cand.exif { --c: var(--green); }
.cand-rank { position: absolute; left: 12px; top: 10px; font: 700 22px/1 var(--hud); color: var(--c); }
.cand-label { font: 600 16px/1.2 var(--hud); letter-spacing: .04em; }
.cand-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.cand-bar { height: 4px; border-radius: 2px; background: var(--line); margin: 8px 0 6px; overflow: hidden; }
.cand-bar i { display: block; height: 100%; background: var(--c); box-shadow: 0 0 8px var(--c); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.cand-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.cand-meta .pct { color: var(--c); font-weight: 600; margin-right: auto; }
.eng { font: 600 10px/1 var(--hud); letter-spacing: .1em; padding: 3px 5px; border-radius: 3px; border: 1px solid var(--line); }
.eng.exif { color: var(--green); border-color: rgba(52,211,153,.4); }
.eng.llm { color: var(--violet); border-color: rgba(167,139,250,.4); }
.eng.geoclip { color: var(--cyan); border-color: rgba(43,255,136,.4); }
.cand-why { margin: 8px 0 0; font-size: 12px; color: var(--text); opacity: .85; display: none; }
.cand.active .cand-why { display: block; }
.copy { font-size: 11px; color: var(--muted); text-decoration: underline dotted; }
.copy:hover { color: var(--cyan); }

/* exif card */
.exif-card { margin-top: 10px; border: 1px solid rgba(52,211,153,.35); border-radius: 8px; padding: 10px 12px; background: rgba(52,211,153,.05); font-size: 12px; }
.exif-card h3 { margin: 0 0 6px; font: 700 12px var(--hud); letter-spacing: .2em; color: var(--green); }
.exif-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.exif-card dt { color: var(--muted); }
.exif-card dd { margin: 0; overflow-wrap: anywhere; }

/* evidence */
.ev {
  display: grid; grid-template-columns: 26px 1fr; gap: 2px 8px; padding: 8px 10px; border-radius: 6px;
  background: rgba(2,6,4,.45); border: 1px solid var(--line); animation: rise .35s ease-out both;
}
.ev-icon { grid-row: span 2; font-size: 16px; line-height: 26px; text-align: center; border-radius: 5px; background: rgba(167,139,250,.12); }
.ev-head { display: flex; justify-content: space-between; gap: 8px; font: 600 11px/1.4 var(--hud); letter-spacing: .14em; color: var(--violet); }
.ev-w { display: inline-flex; gap: 2px; align-items: center; }
.ev-w i { width: 4px; height: 8px; background: var(--line); border-radius: 1px; }
.ev-w i.on { background: var(--violet); }
.ev-obs { font-size: 12px; }
.ev-imp { grid-column: 2; font-size: 11px; color: var(--muted); }
.ev-imp::before { content: "→ "; color: var(--violet); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* dock */
.dock {
  pointer-events: auto; position: absolute; left: calc(var(--left) + 16px); right: calc(var(--right) + 16px); bottom: 0;
  min-height: 60px; display: flex; align-items: center; gap: 14px; padding: 10px 14px;
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 10px;
}
.panel ~ .dock { }
.summary { margin: 0; flex: 1; font-size: 12px; color: var(--text); }
.summary .demo-flag { color: var(--amber); font-weight: 600; }
.dock-actions { display: flex; gap: 6px; }

/* toast */
.toast {
  position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 12px; max-width: min(560px, calc(100vw - 32px));
  background: var(--panel-solid); border: 1px solid var(--red); border-radius: 8px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast-close { font-size: 18px; color: var(--muted); padding: 0 4px; }

/* ---------- layar sedang: dock pindah ke bawah panel ---------- */
@media (max-width: 1180px) {
  :root { --left: 300px; --right: 330px; }
  .dock { flex-direction: column; align-items: stretch; }
}

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  html, body { overflow: auto; height: auto; }
  #globe { position: relative; inset: auto; height: 46vh; margin-top: 56px; }
  .fx-vignette { display: none; }
  .topbar { position: fixed; padding: 10px 16px; background: rgba(2,6,4,.95); flex-wrap: wrap; gap: 8px; }
  .brand { font-size: 15px; letter-spacing: .16em; }
  .engines { display: none; }
  .ui { position: static; inset: auto; padding: 12px 16px 24px; display: grid; gap: 12px; }
  .panel, .dock { position: static; width: auto; bottom: auto; top: auto; left: auto; right: auto; overflow: visible; }
  .dock { order: -1; flex-direction: column; align-items: stretch; }
  .dock-actions { flex-wrap: wrap; }
  .dock-actions .btn { flex: 1; }
  .drop { aspect-ratio: 16 / 10; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* T-058: bounded panels and a full-width summary/action dock. */
.topbar { flex-wrap: wrap; gap: 8px 16px; padding-top: max(14px, env(safe-area-inset-top)); }
.brand { min-width: 0; white-space: normal; flex-wrap: wrap; }
.brand-mark { flex: none; }
.surface-nav, .topbar-controls, .engines { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.surface-nav a, #open-login { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 10px; color: var(--cyan); text-decoration: none; border: 1px solid var(--line); border-radius: 5px; }
.surface-nav a[aria-current] { border-color: var(--cyan); }
.ui { top: 124px; bottom: max(16px, env(safe-area-inset-bottom)); }
.panel { min-width: 0; bottom: 142px; overflow-wrap: anywhere; overscroll-behavior-y: contain; }
.panel-title { flex-wrap: wrap; line-height: 1.5; }
input, .btn, .copy, summary, .toast-close { min-height: 44px; }
input, .summary, .ev > *, .exif-card dl > *, .stages li > * { min-width: 0; }
.ev { grid-template-columns: 26px minmax(0, 1fr); }
.ev-head { flex-wrap: wrap; }
.exif-card dl { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
.dock { left: 0; right: 0; flex-direction: row; flex-wrap: wrap; max-height: 126px; overflow-y: auto; overscroll-behavior-y: contain; }
.summary { flex: 1 1 220px; overflow-wrap: anywhere; }
.dock-actions { flex-wrap: wrap; }
.toast { top: max(16px, env(safe-area-inset-top)); flex-wrap: wrap; max-height: calc(100dvh - 32px); overflow: auto; overflow-wrap: anywhere; }
.toast > span { min-width: 0; flex: 1 1 160px; }
.globe-fallback { width: calc(100% - 32px); overflow-wrap: anywhere; }
@media (max-width: 860px) {
  html, body { overflow: auto; height: auto; min-height: 100dvh; }
  body { display: flex; flex-direction: column; }
  .topbar { order: -1; position: sticky; top: 0; padding: max(10px, env(safe-area-inset-top)) 12px 10px; }
  .brand { flex-basis: 100%; }
  .engines { display: flex; }
  #globe { margin-top: 0; height: 38vh; height: 38dvh; flex: none; }
  .ui { min-width: 0; padding: 12px max(12px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); grid-template-columns: minmax(0, 1fr); }
  .panel, .dock { min-width: 0; max-height: none; overflow: visible; }
  .dock { flex-direction: column; }
  .panel-title { letter-spacing: .16em; }
}
