:root {
  --bg: #05080d;
  --panel: rgba(9, 14, 22, 0.86);
  --panel-solid: #0a1018;
  --line: rgba(120, 160, 200, 0.14);
  --line-strong: rgba(120, 160, 200, 0.28);
  --text: #d6e2ee;
  --dim: #7d8ea1;
  --accent: #34e0a1;
  --warn: #ffb547;
  --danger: #ff5d5d;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--sans); overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.dim { color: var(--dim); }
#map { position: fixed; inset: 0; }

/* ── üst çubuk ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 48px; z-index: 5;
  display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: linear-gradient(180deg, rgba(5,8,13,.95), rgba(5,8,13,.6) 70%, transparent);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--accent); }
.logo { width: 26px; height: 26px; }
.brand-name { font: 700 17px/1 var(--mono); letter-spacing: .32em; color: var(--text); }
.brand-sub { font: 11px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .14em; }
.stats { display: flex; gap: 14px; margin-left: auto; font: 11px var(--mono); color: var(--dim); white-space: nowrap; overflow: hidden; }
.stats b { color: var(--text); font-weight: 600; }
.clock { display: flex; align-items: baseline; gap: 5px; font: 600 14px var(--mono); font-variant-numeric: tabular-nums; }
.clock small { font-size: 9px; color: var(--dim); margin-right: 6px; letter-spacing: .1em; }
.icon-btn { background: var(--panel); border: 1px solid var(--line-strong); color: var(--text); width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.only-mobile { display: none; }

/* ── katman paneli ── */
.panel {
  position: fixed; top: 60px; left: 12px; bottom: 12px; width: 268px; z-index: 4;
  background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden;
}
#layer-list { overflow-y: auto; padding: 6px 0 10px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.group-title { font: 600 10px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--dim); padding: 14px 16px 6px; }
.layer { display: grid; grid-template-columns: 10px 1fr auto 30px; align-items: center; gap: 10px; padding: 6px 14px 6px 16px; cursor: pointer; user-select: none; }
.layer:hover { background: rgba(255,255,255,.03); }
.layer.child { padding-left: 34px; }
.layer .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; background: currentColor; opacity: .35; transition: opacity .15s; }
.layer.on .dot { opacity: 1; }
.layer .name { color: var(--dim); transition: color .15s; }
.layer.on .name { color: var(--text); }
.layer .note { display: block; font-size: 10.5px; color: var(--dim); opacity: .8; }
.layer .count { font: 11px var(--mono); color: var(--dim); font-variant-numeric: tabular-nums; }
.layer .count.err { color: var(--warn); }
.switch { width: 30px; height: 17px; border-radius: 9px; background: rgba(255,255,255,.1); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #9aa9b8; transition: transform .15s, background .15s; }
.layer.on .switch { background: rgba(52,224,161,.35); }
.layer.on .switch::after { transform: translateX(13px); background: var(--accent); }
.layer:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 14px 8px 34px; }
.chip { font: 10.5px var(--sans); border: 1px solid var(--line-strong); border-radius: 20px; padding: 2px 8px 2px 6px; color: var(--dim); background: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.chip.on { color: var(--text); border-color: currentColor; }
.panel-foot { border-top: 1px solid var(--line); padding: 10px 16px; display: flex; justify-content: space-between; font-size: 11px; gap: 8px; }

/* ── ayrıntı paneli ── */
.detail {
  position: fixed; top: 60px; right: 12px; width: 360px; max-height: calc(100% - 72px); z-index: 4; overflow-y: auto;
  background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 14px;
}
.detail .close { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--dim); font-size: 22px; cursor: pointer; line-height: 1; }
.detail .close:hover { color: var(--text); }
.kicker { font: 600 10px var(--mono); letter-spacing: .18em; text-transform: uppercase; margin-bottom: 4px; }
.detail h3 { margin: 0 24px 10px 0; font-size: 16px; line-height: 1.3; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-word; }
.detail .media { margin: 4px -4px 10px; border-radius: 8px; overflow: hidden; background: #000; aspect-ratio: 16/9; display: grid; place-items: center; }
.detail .media img, .detail .media iframe { width: 100%; height: 100%; object-fit: contain; border: 0; display: block; }
.detail .actions { margin-top: 12px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.badge { display: inline-block; font: 600 10px var(--mono); padding: 2px 6px; border-radius: 4px; letter-spacing: .06em; }

/* ── kamera önizlemeleri ── */
.previews {
  position: fixed; left: 292px; right: 12px; bottom: 12px; z-index: 3; max-width: 980px;
  background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 10px;
}
.previews-head { display: flex; justify-content: space-between; font: 600 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-bottom: 7px; }
.previews-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.thumb { position: relative; aspect-ratio: 16/10; border-radius: 6px; overflow: hidden; background: #000; cursor: pointer; border: 1px solid var(--line); padding: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 6px 4px; font-size: 10px; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0,0,0,.85)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb:hover { border-color: var(--accent); }
.previews .empty { grid-column: 1 / -1; color: var(--dim); font-size: 12px; padding: 6px 2px; }

/* ── diyalog ── */
dialog { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px; max-width: 560px; width: calc(100% - 32px); padding: 20px 22px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 6px; font-size: 16px; }
dialog ul { padding-left: 18px; line-height: 1.7; }
dialog button { background: none; border: 1px solid var(--line-strong); color: var(--text); padding: 6px 14px; border-radius: 6px; cursor: pointer; }

/* ── MapLibre ── */
.maplibregl-ctrl-attrib { background: rgba(5,8,13,.6) !important; color: var(--dim); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--dim) !important; }
.maplibregl-ctrl-group { background: var(--panel) !important; border: 1px solid var(--line); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) opacity(.75); }
.maplibregl-popup-content { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; font-size: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-bottom-right { right: 4px; }

/* ── mobil ── */
@media (max-width: 760px) {
  .only-mobile { display: grid; }
  .brand-sub, .stats { display: none; }
  .clock { margin-left: auto; font-size: 12px; }
  .panel { top: 56px; left: 8px; right: 8px; bottom: auto; width: auto; max-height: 62vh; transform: translateY(-120%); transition: transform .2s; }
  .panel.open { transform: none; }
  .detail { top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; max-height: 55vh; }
  .previews { left: 8px; right: 8px; bottom: 8px; }
  .previews-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .previews-grid .thumb:nth-child(n+4) { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
