:root {
  --bg: #15161a;
  --panel: #1c1e24;
  --panel-2: #23262e;
  --line: #2e323c;
  --text: #eceef2;
  --muted: #8d93a1;
  --accent: #e85641;
  --accent-soft: rgba(232, 86, 65, 0.15);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Nunito, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-columns: 340px 1fr;
}

/* ---------- Giris ekrani ---------- */

.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--bg);
}
.gate-form { position: relative; width: 100%; max-width: 300px; }
.gate-form[hidden], .gate-msg[hidden] { display: none; }
/* 16px: iPhone odaklaninca sayfayi yakinlastirmasin */
.gate .gate-form input { font-size: 16px; text-align: center; }
/* Hata yazisi kutuyu kaydirmasin */
.gate-form .hint { position: absolute; top: 100%; left: 0; right: 0; margin-top: 10px; text-align: center; }
.gate-msg { text-align: center; }

/* ---------- Panel ---------- */

.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 20px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 30px; height: 38px; fill: var(--accent); flex: none; }
.brand h1 { margin: 0; font-size: 19px; font-weight: 900; letter-spacing: -0.02em; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); font-weight: 600; }

.group { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field[hidden] { display: none; }
.field > span {
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 3px 10px;
}
.field > span b { color: var(--text); font-weight: 800; letter-spacing: 0; text-transform: none; font-size: 13px; }

.row { display: flex; gap: 8px; align-items: center; }
.row input[type=range] { flex: 1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 600;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, input[type=password]:focus, input[type=number]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.num { width: 72px; flex: none; text-align: center; }

.sub-input { font-size: 13px; padding: 7px 11px; opacity: .85; }
.sub-input:focus { opacity: 1; }
.sub-input::placeholder { font-weight: 600; color: #5c616d; }

.field > span i {
  font-style: normal; text-transform: none; letter-spacing: 0;
  font-size: 11px; font-weight: 600; color: #5c616d;
  margin-left: auto; text-align: right; /* dar panelde alt satira kayar */
}
select { appearance: none; cursor: pointer; background-image: none; }

input[type=range] {
  appearance: none; height: 4px; border-radius: 3px;
  background: var(--line); outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel); cursor: grab;
}

.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; color: var(--muted); }
.check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.check:hover { color: var(--text); }

.btn {
  border: 0; border-radius: 10px; padding: 11px 14px;
  font: inherit; font-weight: 800; cursor: pointer;
  transition: filter .15s, opacity .15s, background .15s;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(1.12); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }

.actions { gap: 10px; }

.hint { margin: 0; font-size: 12.5px; color: var(--muted); font-weight: 600; line-height: 1.5; min-height: 1em; }
.hint.err { color: #ff8b76; }
.hint b { color: var(--text); }

.status {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
}
.status .bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.status .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.result {
  background: var(--accent-soft); border: 1px solid rgba(232,86,65,.35);
  border-radius: 10px; padding: 12px; font-size: 12.5px; font-weight: 700;
  display: flex; flex-direction: column; gap: 8px;
}
.result a { color: var(--accent); text-decoration: none; }
.result a:hover { text-decoration: underline; }
.result code { font-size: 11px; color: var(--muted); font-weight: 600; word-break: break-all; }

.credits { margin-top: auto; font-size: 11px; color: #5c616d; font-weight: 600; line-height: 1.6; }

/* ---------- Otomatik tamamlama ---------- */

.ac { position: relative; }
.ac-list {
  position: absolute; z-index: 40; top: calc(100% + 5px); left: 0; right: 0;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; max-height: 260px; overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
.ac-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.on { background: var(--accent-soft); }
.ac-item b { display: block; font-weight: 800; font-size: 13px; }
.ac-item span { display: block; font-size: 11px; color: var(--muted); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Önizleme ---------- */

.viewport {
  position: relative; overflow: hidden;
  background:
    linear-gradient(45deg, #1a1c21 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(-45deg, #1a1c21 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(45deg, transparent 75%, #1a1c21 75%) 0 0/20px 20px,
    linear-gradient(-45deg, transparent 75%, #1a1c21 75%) 0 0/20px 20px,
    #141519;
  display: flex; align-items: center; justify-content: center;
}

.stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
#map { position: absolute; inset: 0; }
#out { position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  border-radius: 2px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }

.vp-badge {
  position: absolute; bottom: 14px; left: 14px; z-index: 5;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  padding: 5px 10px; border-radius: 7px;
  font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .04em;
  pointer-events: none;
}

.maplibregl-ctrl-attrib, .maplibregl-ctrl-logo { display: none !important; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow: auto; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .viewport { min-height: 60vh; }
}

.ac-note {
  padding: 11px 13px;
  font-size: 13px;
  color: #8b919d;
}
.ac-note a { color: #fff; font-weight: 700; }
