/* Akdeniz Airsoft — Saha Haritaları. Koyu taktik tema (akdenizairsoft-web tokenları). */

:root {
  --c-primary: #10b981;
  --c-primary-light: #6ee7b7;
  --c-bg: #030712;
  --c-surface: #111827;
  --c-surface-light: #1f2937;
  --c-text: #f9fafb;
  --c-text-secondary: #9ca3af;
  --c-text-muted: #6b7280;
  --c-border: #374151;
  --c-border-light: #4b5563;
  --c-error: #ef4444;
  --c-warning: #f59e0b;
  --font-display: "Chakra Petch", "Arial Narrow", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --r-md: 4px;
  --chamfer: 14px;
  --chamfer-sm: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.24s;
  --panel-w: 360px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.muted {
  color: var(--c-text-secondary);
  margin: 0;
}
.small {
  font-size: 0.82rem;
}
.warning {
  color: var(--c-warning);
  margin: 0;
}

.kicker {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-primary);
}

.chamfer {
  clip-path: polygon(
    var(--chamfer) 0,
    100% 0,
    100% calc(100% - var(--chamfer)),
    calc(100% - var(--chamfer)) 100%,
    0 100%,
    0 var(--chamfer)
  );
}

.brand-logo {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

/* --- Düğmeler ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--c-text);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
  clip-path: polygon(
    var(--chamfer-sm) 0,
    100% 0,
    100% calc(100% - var(--chamfer-sm)),
    calc(100% - var(--chamfer-sm)) 100%,
    0 100%,
    0 var(--chamfer-sm)
  );
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--c-primary);
  color: #04140d;
}
.btn--primary:not(:disabled):hover {
  background: var(--c-primary-light);
}
.btn--ghost {
  border-color: var(--c-border-light);
}
.btn--ghost:not(:disabled):hover {
  border-color: var(--c-primary);
  color: var(--c-primary-light);
}
.btn--danger {
  border-color: rgba(239, 68, 68, 0.55);
  color: #fca5a5;
}
.btn--danger:not(:disabled):hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--c-error);
}
.btn--sm {
  padding: 8px 14px;
  font-size: 0.76rem;
}
.btn--block {
  width: 100%;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--c-surface-light);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
}
.icon-btn--danger:hover {
  color: var(--c-error);
  border-color: var(--c-error);
}

/* --- Form ---------------------------------------------------------------- */

.input {
  width: 100%;
  min-width: 0;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
}
.input:focus,
.area-label-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}
.textarea {
  resize: vertical;
  line-height: 1.5;
  min-height: 120px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field-label,
.panel-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-text-secondary);
}
.panel-title {
  margin: 18px 0 10px;
}
.panel-title:first-child {
  margin-top: 0;
}
.form-error {
  color: #fca5a5;
  font-size: 0.88rem;
  margin: 0;
  min-height: 1.2em;
}

.count {
  font-family: var(--font-display);
  color: var(--c-primary);
}

.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-muted);
}
.badge--live {
  color: var(--c-primary-light);
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.08);
}

/* --- Bildirimler --------------------------------------------------------- */

.toast-stack {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
.toast {
  background: var(--c-surface-light);
  border: 1px solid var(--c-border-light);
  border-left: 3px solid var(--c-primary);
  padding: 10px 16px;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}
.toast--error {
  border-left-color: var(--c-error);
}

/* --- Giriş / ortalanmış ekranlar ------------------------------------------ */

.login-screen,
.center-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px 28px;
  background: var(--c-surface);
  border-top: 2px solid var(--c-primary);
}
.login-card h1 {
  font-size: 1.7rem;
}

/* --- Admin liste --------------------------------------------------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(3, 7, 18, 0.92);
  border-bottom: 1px solid var(--c-border);
  backdrop-filter: blur(8px);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.container {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.map-card {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-left: 3px solid var(--c-primary);
}
.map-card-main {
  /* Aynı satırdaki kartlarda düğme satırı hep altta hizalı kalsın (açıklama olsun olmasın). */
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 18px 12px;
  text-decoration: none;
}
.map-card-main h2 {
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}
.map-card-meta {
  margin: 0;
  color: var(--c-text-secondary);
  font-size: 0.85rem;
}
.map-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--c-border);
}
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 32px;
  background: var(--c-surface);
}
/* saha.…/ herkese açık liste: bütün kart bağlantı. */
.field-card {
  color: inherit;
  text-decoration: none;
  transition: background var(--dur) var(--ease);
}
.field-card:hover,
.field-card:focus-visible {
  background: var(--c-surface-light);
}
/* Kart başı mini harita: Esri uydu görüntüsü + alanlar (SVG, aynı kutu). */
.field-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--c-surface-light);
}
.field-preview img,
.field-preview svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.field-preview img {
  object-fit: cover;
}
.field-attribution {
  margin-top: 16px;
  font-size: 0.72rem;
}

/* --- Editör -------------------------------------------------------------- */

.editor {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.editor-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}
.editor-name {
  flex: 1;
  font-weight: 600;
}
.editor-status {
  font-size: 0.78rem;
  color: var(--c-text-muted);
  white-space: nowrap;
}
.editor-status.is-dirty {
  color: var(--c-warning);
}
.editor-body {
  flex: 1;
  display: flex;
  min-height: 0;
}
.editor-map-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.editor-map {
  position: absolute;
  inset: 0;
}
.editor-overlay {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 24px);
  pointer-events: none;
}
.editor-hint {
  background: rgba(3, 7, 18, 0.85);
  border: 1px solid var(--c-border);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  text-align: center;
}
.editor-draft-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  background: rgba(3, 7, 18, 0.85);
  border: 1px solid var(--c-border);
  pointer-events: auto;
}
.editor-panel {
  width: var(--panel-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--c-surface);
  border-left: 1px solid var(--c-border);
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.tab {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--c-text-secondary);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.tab.is-active {
  color: var(--c-text);
  border-bottom-color: var(--c-primary);
}
.tab-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.tool-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tool-chip.is-active {
  border-color: var(--chip);
  background: color-mix(in srgb, var(--chip) 18%, var(--c-bg));
  color: var(--c-text);
}
.tool-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--chip);
  flex-shrink: 0;
}
.tool-label {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.15;
}
.tool-kind {
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.area-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.area-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.area-item.is-selected {
  border-color: var(--c-primary);
}
.area-swatch {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--chip);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--chip) 30%, transparent);
  font-size: 0.85rem;
  cursor: pointer;
}
/* Nokta: haritadaki işaretin küçültülmüş aynısı (şekil + ikon). */
.area-swatch--marker {
  border: none;
  background: none;
  overflow: visible;
}
.marker-preview {
  display: inline-flex;
  transform: scale(0.72);
}
.legend-marker {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.area-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.area-label-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--c-text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 2px 4px;
}
.area-label-input:hover {
  border-color: var(--c-border);
}
.area-meta {
  font-size: 0.7rem;
  color: var(--c-text-muted);
  padding-left: 5px;
}
.grid-select {
  align-self: flex-start;
  margin: 4px 0 0 4px;
  padding: 2px 4px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-secondary);
  font: inherit;
  font-size: 0.72rem;
}

.share-view {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
}
.share-view p {
  margin: 0;
}
.share-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.share-url {
  font-size: 0.82rem;
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.share-actions--secondary {
  padding-top: 12px;
  border-top: 1px solid var(--c-border);
}

/* --- Paylaşım görüntüleyici ------------------------------------------------ */

.page-viewer {
  overflow: hidden;
}
.viewer {
  position: fixed;
  inset: 0;
  display: flex;
}
.viewer-map {
  position: relative;
  flex: 1;
  min-width: 0;
}
.viewer-panel {
  width: var(--panel-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-left: 1px solid var(--c-border);
}
.viewer-handle {
  display: none;
}
.viewer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.viewer-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--c-border);
}
.viewer-head h1 {
  font-size: 1.45rem;
  margin: 2px 0 4px;
  overflow-wrap: anywhere;
}
.brief-section + .brief-section {
  margin-top: 20px;
}
.brief-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}
.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.legend-swatch {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--chip);
  color: var(--chip);
  font-size: 0.78rem;
}
.legend-swatch--area {
  border-radius: 4px;
  border: 2px solid var(--chip);
  background: color-mix(in srgb, var(--chip) 30%, transparent);
}
.legend--points {
  grid-template-columns: 1fr;
  gap: 2px;
}
.legend-point {
  width: 100%;
  padding: 5px 6px;
  background: none;
  border: none;
  border-radius: var(--r-md);
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}
.legend-point:hover,
.legend-point:focus-visible {
  background: var(--c-surface-light);
  outline: none;
}

/* --- Leaflet: koyu tema, pinler, etiketler ---------------------------------- */

.leaflet-container {
  background: var(--c-bg);
  font-family: var(--font-body);
}
.leaflet-bar,
.leaflet-control-layers {
  border: 1px solid var(--c-border) !important;
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.6) !important;
}
.leaflet-bar a,
.leaflet-control-layers {
  background: var(--c-surface);
  color: var(--c-text);
}
.leaflet-bar a {
  border-bottom-color: var(--c-border);
}
.leaflet-bar a:hover,
.leaflet-bar a:focus {
  background: var(--c-surface-light);
  color: var(--c-text);
}
.leaflet-control-layers-toggle {
  filter: invert(1) brightness(1.4);
}
.leaflet-control-layers-expanded {
  padding: 8px 12px;
  color: var(--c-text);
}
.leaflet-control-attribution {
  background: rgba(3, 7, 18, 0.7) !important;
  color: var(--c-text-muted);
}
.leaflet-control-attribution a {
  color: var(--c-text-secondary);
}
.editor-map.is-drawing,
.editor-map.is-drawing.leaflet-grab {
  cursor: crosshair;
}

.map-locate-btn {
  width: 34px;
  height: 34px;
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.map-locate-btn.is-active {
  color: #fff;
  background: #2563eb;
}
/* Konum açık ama takip duraklatıldı (haritayı elle kaydırdın): dokununca takibe döner. */
.map-locate-btn.is-paused {
  color: #60a5fa;
  background: var(--c-surface-light);
}

.map-pin-body {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--pin);
  border: 2.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
}
.map-pin-body.is-selected {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.9), 0 3px 8px rgba(0, 0, 0, 0.55);
}
/* Beyaz iç disk: emoji her pin renginde okunur; ✚ gibi metin ikonlar pin rengini alır. */
.map-pin-glyph {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--pin);
  transform: rotate(45deg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
/* İğne dışındaki şekiller: SVG dolgu tip rengi, beyaz kenar; ikon ortada beyaz diskte. */
.map-shape {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
}
.map-shape svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--pin);
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2.5;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
}
.map-shape.is-selected svg {
  stroke: var(--c-primary);
  stroke-width: 3.5;
}
.map-shape-glyph {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 21px;
  height: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--pin);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
/* Üçgenin ağırlık merkezi aşağıda ve içi dar. */
.map-shape--triangle .map-shape-glyph {
  top: 64%;
  width: 17px;
  height: 17px;
  font-size: 10px;
}
/* Köşe tutamacı: 24px dokunma alanı, içinde 16px daire; seçili köşe kırmızı. */
.map-vertex span {
  display: block;
  width: 16px;
  height: 16px;
  margin: 4px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--vertex);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.map-vertex.is-active span {
  background: var(--c-error);
  border-color: #fff;
  transform: scale(1.3);
}
/* Kenar ortası "+": dokun ya da sürükle → yeni köşe. */
.map-midpoint {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.35);
  color: #111827;
  font: 700 14px/1 var(--font-body);
}

/* Izgara: hücre etiketleri (A1, B2…) ve yakınlaştırmaya göre gizleme. */
.grid-label {
  color: #fff;
  font: 700 10px/14px var(--font-display);
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 0 2px #000, 0 0 3px #000, 0 1px 2px #000;
}
.grid-hide-labels-50 .grid-label--50,
.grid-hide-labels-75 .grid-label--75,
.grid-hide-labels-100 .grid-label--100,
.grid-hide-lines-50 .grid-line--50,
.grid-hide-lines-75 .grid-line--75,
.grid-hide-lines-100 .grid-line--100 {
  display: none;
}

.leaflet-tooltip.map-label {
  padding: 1px 6px;
  background: rgba(3, 7, 18, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  box-shadow: none;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.leaflet-tooltip.map-label::before {
  display: none;
}
.leaflet-tooltip.map-label--area {
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px #000, 0 0 6px #000;
}

/* Nokta "isim + ikon" penceresi (editör, Leaflet popup). */
.point-popup .leaflet-popup-content-wrapper {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border-light);
  border-radius: 6px;
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.85);
}
.point-popup .leaflet-popup-tip {
  background: var(--c-surface);
}
.point-popup .leaflet-popup-content {
  margin: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.point-popup a.leaflet-popup-close-button {
  color: var(--c-text-secondary);
}
.point-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.point-editor-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shape-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.shape-choice {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  cursor: pointer;
}
.shape-choice:hover {
  border-color: var(--c-border-light);
}
.shape-choice.is-active {
  border-color: var(--c-primary);
  background: rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 0 1px var(--c-primary);
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.icon-choice {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.icon-choice:hover {
  border-color: var(--c-border-light);
}
.icon-choice.is-active {
  border-color: var(--c-primary);
  background: rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 0 1px var(--c-primary);
}
.point-editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

/* Yer arama kutusu (editör): sol zoom ile sağ katman düğmesi arasında. */
.map-search {
  position: absolute;
  top: 10px;
  left: 58px;
  right: 64px;
  max-width: 440px;
  z-index: 1001;
  display: flex;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.7);
}
.map-search-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border-light);
  border-right: none;
  border-radius: var(--r-md) 0 0 var(--r-md);
  color: var(--c-text);
  font: inherit;
  font-size: 0.9rem;
}
.map-search-input:focus {
  outline: none;
  border-color: var(--c-primary);
}
.map-search-submit {
  height: 40px;
  padding: 0 14px;
  background: var(--c-primary);
  border: none;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: #04140d;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.map-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(360px, 50vh);
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--c-surface);
  border: 1px solid var(--c-border-light);
  border-radius: var(--r-md);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.8);
}
.map-search-result {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: var(--r-md);
  color: var(--c-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.map-search-result:hover,
.map-search-result:focus-visible {
  background: var(--c-surface-light);
  outline: none;
}
.map-search-result strong {
  font-size: 0.9rem;
}
.map-search-result span {
  font-size: 0.75rem;
  color: var(--c-text-secondary);
}
.map-search-message {
  padding: 10px;
  font-size: 0.85rem;
  color: var(--c-text-secondary);
}
.map-search-attribution {
  padding: 6px 10px 4px;
  font-size: 0.68rem;
  color: var(--c-text-muted);
  border-top: 1px solid var(--c-border);
  margin-top: 4px;
}

/* --- Canlı konum ---------------------------------------------------------- */

.person-marker {
  background: none;
  border: none;
}
.person-dot {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--person);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  color: #0b1120;
  font: 700 11px/1 var(--font-display);
  letter-spacing: 0.02em;
}
.person-dot.is-self {
  border-width: 4px;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.85), 0 2px 6px rgba(0, 0, 0, 0.6);
}
.person-dot.is-captain {
  border-color: #facc15;
}
.leaflet-tooltip.person-label {
  font-size: 10px;
}
/* Kayıt oynatma: kişi o an konum göndermiyordu (son noktasında soluk). */
.person-marker.is-stale {
  opacity: 0.45;
}
.live-recording {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--c-error);
  background: rgba(239, 68, 68, 0.12);
  font-size: 0.82rem;
  color: var(--c-text);
}
.live-record-button,
.live-reset-button {
  align-self: flex-start;
}
/* Editör haritasının altında kayıt oynatma çubuğu (çizim ipucu bu sırada gizlenir). */
.is-replaying .editor-overlay {
  display: none;
}
.replay-bar {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(560px, calc(100% - 24px));
  padding: 10px 12px;
  background: rgba(3, 7, 18, 0.92);
  border: 1px solid var(--c-border-light);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.9);
}
.replay-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.replay-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 0.85rem/1.2 var(--font-display);
  letter-spacing: 0.04em;
}
.replay-play {
  min-width: 44px;
  padding-left: 12px;
  padding-right: 12px;
}
.replay-slider {
  flex: 1;
  min-width: 0;
  accent-color: var(--c-primary);
}
.replay-time {
  font: 600 0.78rem/1.2 var(--font-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--c-text-secondary);
}
.replay-person {
  flex: 1;
  min-width: 0;
}
.replay-stops {
  margin: 0;
}

.live-section {
  padding: 14px;
  margin-bottom: 20px;
  background: var(--c-surface-light);
  border-left: 3px solid var(--c-primary);
}
.live-section > * + * {
  margin-top: 10px;
}
.live-status {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
}
.live-status--open {
  color: var(--c-primary-light);
}
.live-status--connecting,
.live-status--closed {
  color: var(--c-warning);
}
.live-share-status {
  font-size: 0.8rem;
  color: var(--c-text-secondary);
}
.live-share-status:empty {
  display: none;
}
.live-join,
.live-team-form {
  display: flex;
  gap: 8px;
}
.live-team-form .input {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.85rem;
}
.live-color-select {
  flex: 0 0 96px !important;
}
.live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.team-button {
  border-color: var(--team);
}
.team-button::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--team);
}
.live-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.live-row,
.live-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.live-row {
  padding: 6px 8px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.live-row--button,
.live-row-main {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.live-row-main {
  flex: 1;
  background: none;
  border: none;
  padding: 0;
}
.live-row--button:disabled,
.live-row-main:disabled {
  cursor: default;
}
.live-row--participant {
  flex-wrap: wrap;
}
.live-row-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.live-row-controls .grid-select {
  margin: 0;
}
.live-row-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.live-row-meta {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--c-text-muted);
}
.live-dot {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--person);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.live-dot.is-offline {
  opacity: 0.35;
}
.live-captain {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--c-text-secondary);
}
.live-leave {
  align-self: flex-start;
}
.live-admin {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.live-admin .panel-title {
  margin: 10px 0 2px;
}
/* Harita üstü hap düğmeler: "Sahaya git" ve canlı konum (sol alt / sol üst). */
.map-pill,
.live-map-button {
  display: block;
  padding: 9px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border-light);
  border-radius: 999px;
  color: var(--c-text);
  font: 600 0.82rem/1 var(--font-body);
  white-space: nowrap;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.8);
  cursor: pointer;
}
.live-map-button.is-on {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #04140d;
}
/* Sol alt düğmeler harita atıf satırının üstünde kalsın. */
.leaflet-bottom.leaflet-left {
  margin-bottom: 16px;
}
.tab {
  padding-left: 4px;
  padding-right: 4px;
  font-size: 0.76rem;
}
.tab-badge {
  display: inline-block;
  min-width: 18px;
  margin-left: 5px;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--c-warning);
  color: #1c1306;
  font-size: 0.68rem;
  line-height: 14px;
  letter-spacing: 0;
}
.live-note {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--c-warning);
  background: rgba(245, 158, 11, 0.1);
  font-size: 0.82rem;
  color: var(--c-text);
}
.install-box {
  margin-bottom: 16px;
}
.install-steps {
  margin: 10px 0 0;
  padding: 10px 12px 10px 30px;
  background: var(--c-surface-light);
  border-radius: var(--r-md);
  font-size: 0.85rem;
  line-height: 1.5;
}
.install-steps li + li {
  margin-top: 4px;
}
/* Alt güvenli alan ölçümü (iPhone ev çizgisi), çekmece kaydırması için. */
.safe-bottom-probe {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 0;
  height: env(safe-area-inset-bottom, 0px);
  visibility: hidden;
  pointer-events: none;
}
/* Ana ekran uygulamasında (iPhone) harita kontrolleri çentiğin/durum çubuğunun altında. */
.page-viewer .leaflet-top {
  top: env(safe-area-inset-top, 0px);
}
.viewer-handle-hint .hint-open,
.viewer.is-open .viewer-handle-hint .hint-closed {
  display: none;
}
.viewer.is-open .viewer-handle-hint .hint-open {
  display: inline;
}


/* Harita üstündeki paylaşım + kilit düğmeleri yan yana. */
.live-map-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Cep kilidi: harita görünür; şeffaf katman bütün dokunuşları yutar --- */
.pocket-lock {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 12px calc(18px + env(safe-area-inset-bottom, 0px));
  background: transparent;
  /* Kilitli olduğu bir bakışta anlaşılsın: ince yeşil çerçeve. */
  box-shadow: inset 0 0 0 3px rgba(16, 185, 129, 0.7);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
.pocket-lock-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  max-width: 100%;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(3, 7, 18, 0.82);
  border: 1px solid rgba(16, 185, 129, 0.6);
  color: var(--c-text);
  font-size: 0.8rem;
  line-height: 1.3;
  text-align: center;
}
.pocket-lock-bar strong {
  color: var(--c-primary-light);
}
.pocket-lock-status {
  color: var(--c-text-secondary);
}
.pocket-lock-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pocket-lock-button {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid rgba(16, 185, 129, 0.7);
  background: rgba(3, 7, 18, 0.85);
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  touch-action: none;
}
.pocket-lock-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.55);
  transform: scale(0);
  transition: transform 0.15s;
}
/* Basılı tutulurken 2 sn'de dolar (pocket-lock.ts UNLOCK_HOLD_MS ile aynı). */
.pocket-lock-button.is-holding .pocket-lock-ring {
  transform: scale(1);
  transition: transform 2s linear;
}
.pocket-lock-icon {
  position: relative;
  font-size: 26px;
  line-height: 1;
}
.pocket-lock-hint {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(3, 7, 18, 0.82);
  color: var(--c-text);
  font-size: 0.75rem;
}
/* Kilitliyken dokunulamayan harita düğmeleri ve brifing çekmecesi gizlenir; harita tam ekran. */
.is-pocket-locked .leaflet-control-container,
.is-pocket-locked .viewer-panel {
  visibility: hidden;
}
.is-pocket-locked .viewer-map {
  bottom: 0 !important;
}

/* --- Mobil -------------------------------------------------------------- */

@media (max-width: 760px) {
  .editor-topbar {
    flex-wrap: wrap;
  }
  .editor-name {
    order: 3;
    flex-basis: 100%;
  }
  .editor-status {
    margin-left: auto;
  }
  .editor-body {
    flex-direction: column;
  }
  .editor-map-wrap {
    min-height: 0;
    flex: 1 1 55%;
  }
  .editor-panel {
    width: 100%;
    flex: 0 0 45%;
    border-left: none;
    border-top: 1px solid var(--c-border);
  }
  .editor-overlay {
    bottom: 12px;
  }

  /* Görüntüleyici: harita tam ekran, brifing alttan açılan çekmece. */
  .viewer {
    display: block;
    /* Kapalı çekmeceden görünen kısım: tutamaç + alt güvenli alan. */
    --peek: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  .viewer-map {
    position: absolute;
    inset: 0 0 var(--peek) 0;
  }
  .viewer-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 78dvh;
    border-left: none;
    border-top: 1px solid var(--c-border);
    box-shadow: 0 -12px 30px -12px rgba(0, 0, 0, 0.8);
    transform: translateY(calc(100% - var(--peek)));
    transition: transform 0.32s var(--ease);
    z-index: 1000;
  }
  .viewer-panel.is-dragging {
    transition: none;
  }
  .viewer.is-open .viewer-panel {
    transform: none;
  }
  .viewer-content {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .viewer-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    height: 64px;
    flex-shrink: 0;
    padding: 8px 16px 10px;
    background: var(--c-surface);
    border: none;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text);
    font: inherit;
    cursor: grab;
    /* Parmakla kaydırma sayfayı değil çekmeceyi hareket ettirir. */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
  .viewer-handle-bar {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--c-border-light);
    margin-bottom: 4px;
  }
  .viewer-handle-title {
    max-width: 100%;
    font-family: var(--font-display);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .viewer-handle-hint {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-primary);
    pointer-events: none;
  }
}
