:root{
  --bg:#07110c;
  --card:rgba(12,18,14,.72);
  --line:rgba(122,255,181,.14);
  --line-strong:rgba(122,255,181,.32);
  --text:#f5f7f3;
  --muted:rgba(245,247,243,.72);
  --shadow:0 10px 26px rgba(0,0,0,.30);
}

*{ box-sizing:border-box; }

html, body{
  margin:0;
  width:100%;
  height:100%;
  overflow:hidden;
  background:#07110c;
  color:var(--text);
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

body{
  position:relative;
}

#app{
  position:fixed;
  inset:0;
  overflow:hidden;
  background:#07110c;
}

#map{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  z-index:1;
  background:#07110c;
}

/* overlays */
.topbar,
.control-band,
.map-info-box,
.map-actions,
.install-hint,
.toast,
.fab-pin{
  position:absolute;
  z-index:1200;
}

.topbar{
  top:8px;
  left:8px;
  right:8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-radius:22px;
  border:1px solid var(--line);
  background:
    radial-gradient(circle at top right, rgba(48,217,138,.10), transparent 35%),
    var(--card);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  box-shadow:var(--shadow);
}

.brand-wrap{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.brand-mark{
  width:44px;
  height:44px;
  flex:0 0 auto;
  border-radius:16px;
  display:grid;
  place-items:center;
  font-size:20px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
}

.brand{
  font-size:16px;
  font-weight:900;
  line-height:1.05;
}

.brand-sub{
  margin-top:2px;
  color:var(--muted);
  font-size:11px;
  font-weight:700;
}

.header-pills{
  display:flex;
  gap:6px;
  flex-wrap:nowrap;
  align-items:center;
}

.pill{
  min-height:36px;
  padding:0 10px;
  border-radius:15px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);
  color:var(--text);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:800;
  white-space:nowrap;
}

.pill-button{
  appearance:none;
  cursor:pointer;
  font-family:inherit;
}

.pill-installed{
  border-color:rgba(48,217,138,.32);
  background:linear-gradient(180deg, rgba(48,217,138,.22), rgba(48,217,138,.12));
}

.pill-icon{
  width:38px;
  min-width:38px;
  padding:0;
  justify-content:center;
  font-size:16px;
}

.control-band{
  top:80px;
  left:8px;
  right:8px;
  display:block;
  padding:7px;
  border-radius:20px;
  border:1px solid var(--line);
  background:rgba(12,18,14,.56);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  box-shadow:var(--shadow);
}

.control-group{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:7px;
}

.control-group[hidden]{
  display:none !important;
}

.ctl{
  min-height:38px;
  padding:4px 6px;
  border:none;
  border-radius:14px;
  background:rgba(7,11,9,.66);
  color:var(--text);
  font-size:12px;
  font-weight:900;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
}

.ctl.active{
  border:1px solid var(--line-strong);
  background:linear-gradient(180deg, rgba(48,217,138,.22), rgba(48,217,138,.10));
  box-shadow:0 0 0 2px rgba(48,217,138,.12);
}

.map-actions{
  right:8px;
  bottom:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.action-btn{
  min-width:118px;
  min-height:46px;
  padding:0 14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(12,18,14,.82);
  color:var(--text);
  text-decoration:none;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:15px;
  font-weight:900;
  box-shadow:var(--shadow);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}

.action-btn-primary{
  background:linear-gradient(180deg, rgba(48,217,138,.22), rgba(48,217,138,.12));
}

.map-info-box{
  left:8px;
  bottom:12px;
  max-width:min(185px, calc(100% - 140px));
  padding:12px 13px;
  border-radius:18px;
  border:1px solid var(--line);
  background:rgba(12,18,14,.82);
  color:var(--text);
  font-size:14px;
  line-height:1.35;
  pointer-events:none;
  box-shadow:var(--shadow);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}

.map-info-box b{
  display:block;
  margin-bottom:4px;
  font-size:15px;
}

.map-info-box small{
  display:block;
  color:var(--muted);
  font-size:13px;
}

.fab-pin{
  z-index:1400;
  width:46px;
  height:46px;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(12,18,14,.86);
  color:#fff;
  font-size:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:var(--shadow);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}

.fab-pin[hidden]{
  display:none !important;
}

.toast{
  left:12px;
  right:12px;
  bottom:88px;
  z-index:5000;
  pointer-events:none;
}

.toast .box{
  position:absolute;
  left:50%;
  bottom:96px;
  transform:translateX(-50%);
  background:rgba(0,0,0,.78);
  color:#fff;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.08);
  font-size:14px;
  font-weight:700;
  opacity:0;
  transition:opacity .35s ease;
}

.app-hidden{
  position:absolute;
  width:0;
  height:0;
  overflow:hidden;
  opacity:0;
  pointer-events:none;
}

.leaflet-container{
  background:#07110c !important;
}

.leaflet-control-container{
  z-index:900;
}

.leaflet-top.leaflet-left{
  top:188px;
}

.leaflet-control-zoom{
  border:none !important;
  box-shadow:none !important;
}

.leaflet-control-zoom a{
  width:42px !important;
  height:42px !important;
  line-height:42px !important;
  border-radius:14px !important;
  margin-bottom:8px;
  background:rgba(12,18,14,.84) !important;
  color:#fff !important;
  border:1px solid var(--line) !important;
  box-shadow:var(--shadow) !important;
}

.leaflet-control-attribution{
  background:rgba(12,18,14,.68) !important;
  color:rgba(255,255,255,.82) !important;
  padding:2px 6px !important;
  border-radius:10px 0 0 0 !important;
}

.leaflet-control-attribution a{
  color:#fff !important;
}

.shot-drag-icon{
  background:transparent !important;
  border:none !important;
}

.shot-dot{
  width:22px;
  height:22px;
  border-radius:50%;
  background:#ff9800 !important;
  border:2px solid #fff !important;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  font-size:11px;
  font-weight:700;
  line-height:1;
  box-shadow:0 2px 8px rgba(0,0,0,.42);
}

.fab-map-toggle{
  position:absolute;
  right:8px;
  left:auto;
  top:188px;
  z-index:1300;
  width:46px;
  height:46px;
  padding:0;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(12,18,14,.86);
  color:var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  font-weight:900;
  line-height:1;
  box-shadow:var(--shadow);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  appearance:none;
  cursor:pointer;
}

.fab-map-toggle:active{
  transform:scale(.95);
}

.field-vilt-icon{
  background:transparent;
  border:0;
}

.field-vilt-dot{
  width:14px;
  height:14px;
  border-radius:50%;
  background:#ffd400;
  border:2px solid #000;
  box-shadow:0 0 0 2px rgba(255,255,255,0.15);
}

/* =========================
   iPhone Install Modal
========================= */

.ios-install-modal[hidden]{
  display:none;
}

.ios-install-modal{
  position:fixed;
  inset:0;
  z-index:99999;
}

.ios-install-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.42);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}

.ios-install-card{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(92vw, 380px);
  padding:18px;
  border-radius:22px;
  border:1px solid var(--line);
  background:rgba(12,18,14,.92);
  box-shadow:var(--shadow);
  color:var(--text);
}

.ios-install-close{
  position:absolute;
  top:10px;
  right:10px;
  width:34px;
  height:34px;
  border:none;
  border-radius:50%;
  background:rgba(255,255,255,.08);
  color:#fff;
  font-size:16px;
  font-weight:700;
}

.ios-install-head{
  display:flex;
  align-items:center;
  gap:12px;
  padding-right:34px;
  margin-bottom:16px;
}

.ios-install-appicon{
  width:48px;
  height:48px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  background:rgba(255,255,255,.05);
  border:1px solid var(--line);
}

.ios-install-head h3{
  margin:0 0 4px;
  font-size:18px;
  font-weight:900;
}

.ios-install-head p{
  margin:0;
  font-size:13px;
  color:var(--muted);
}

.ios-install-steps{
  display:grid;
  gap:8px;
  margin-bottom:14px;
}

.ios-step{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line);
  font-size:13px;
  line-height:1.35;
}

.ios-step-num{
  width:24px;
  height:24px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(48,217,138,.9);
  color:#07110c;
  font-weight:900;
  font-size:12px;
  flex:0 0 24px;
}

.ios-install-ok{
  width:100%;
  min-height:44px;
  border:none;
  border-radius:14px;
  background:linear-gradient(180deg, rgba(48,217,138,.3), rgba(48,217,138,.15));
  border:1px solid var(--line-strong);
  color:#fff;
  font-size:14px;
  font-weight:900;
  box-shadow:var(--shadow);
}

.fab-readonly-reset{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  z-index:9999;
  border:0;
  border-radius:14px;
  padding:14px 18px;
  font:inherit;
  font-weight:700;
  background:#ffffff;
  color:#111;
  box-shadow:0 10px 30px rgba(0,0,0,.28);
}

.fab-gps-mark{
  position:fixed;
  left:16px;
  right:16px;
  bottom:90px;
  z-index:5000;
  border:0;
  border-radius:16px;
  padding:16px 18px;
  font-size:16px;
  font-weight:700;
  background:#1f6f43;
  color:#fff;
  box-shadow:0 10px 24px rgba(0,0,0,.28);
}

.mark-modal{
  position:fixed;
  inset:0;
  z-index:6000;
  background:rgba(0,0,0,.45);
  display:flex;
  align-items:flex-end;
  justify-content:center;
}

.mark-modal.hidden{
  display:none;
}

.mark-modal-card{
  width:min(720px,100%);
  background:#101514;
  color:#eef3ef;
  border-radius:18px 18px 0 0;
  padding:16px;
  box-shadow:0 -10px 30px rgba(0,0,0,.35);
}

.mark-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
}

.mark-modal-head button{
  border:0;
  background:transparent;
  color:#eef3ef;
  font-size:20px;
  cursor:pointer;
}

.mark-type-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:10px;
}

.mark-type-grid button{
  border:1px solid rgba(255,255,255,.08);
  background:#18201d;
  color:#eef3ef;
  border-radius:14px;
  padding:14px 12px;
  font-weight:700;
  text-align:left;
  cursor:pointer;
}

/* =========================
   Kompakt läge för iPhone SE / små skärmar
========================= */
@media (max-width: 390px), (max-height: 740px){
  .topbar{
    top:6px;
    left:6px;
    right:6px;
    gap:8px;
    padding:8px 10px;
    border-radius:18px;
  }

  .brand-wrap{
    gap:8px;
  }

  .brand-mark{
    width:38px;
    height:38px;
    border-radius:12px;
    font-size:18px;
  }

  .brand{
    font-size:14px;
    line-height:1;
  }

  .brand-sub{
    margin-top:1px;
    font-size:10px;
    line-height:1.1;
  }

  .header-pills{
    gap:5px;
  }

  .pill{
    min-height:32px;
    padding:0 8px;
    border-radius:13px;
    font-size:11px;
  }

  .pill-icon{
    width:32px;
    min-width:32px;
    font-size:14px;
  }

  .control-band{
    top:64px;
    left:6px;
    right:6px;
    padding:6px;
    border-radius:16px;
  }

  .control-group{
    gap:6px;
  }

  .ctl{
    min-height:34px;
    padding:4px 5px;
    border-radius:12px;
    font-size:11px;
    line-height:1.05;
  }

  .leaflet-top.leaflet-left{
    top:138px;
  }

  .fab-map-toggle{
    left:6px;
    top:138px;
    width:40px;
    height:40px;
    font-size:18px;
  }

  .map-actions{
    right:6px;
    bottom:8px;
    gap:6px;
  }

  .action-btn{
    min-width:104px;
    min-height:40px;
    padding:0 10px;
    border-radius:14px;
    font-size:13px;
  }

  .map-info-box{
    left:6px;
    bottom:8px;
    max-width:min(150px, calc(100% - 122px));
    padding:10px 11px;
    border-radius:14px;
    font-size:12px;
    line-height:1.25;
  }

  .map-info-box b{
    margin-bottom:3px;
    font-size:13px;
  }

  .map-info-box small{
    font-size:11px;
  }

  .fab-pin{
    width:40px;
    height:40px;
    font-size:17px;
  }

  #installBtn{
    min-height:32px;
    padding:0 9px;
    font-size:11px;
    border-radius:13px;
  }
}

@media (max-height: 670px){
  .topbar{
    top:4px;
    left:4px;
    right:4px;
    padding:7px 9px;
  }

  .brand-mark{
    width:34px;
    height:34px;
    font-size:16px;
  }

  .brand{
    font-size:13px;
  }

  .brand-sub{
    font-size:9px;
  }

  .pill{
    min-height:30px;
    padding:0 7px;
    font-size:10px;
  }

  .control-band{
    top:58px;
    left:4px;
    right:4px;
    padding:5px;
  }

  .control-group{
    gap:5px;
  }

  .ctl{
    min-height:32px;
    font-size:10px;
    border-radius:11px;
  }

  .leaflet-top.leaflet-left{
    top:128px;
  }

  .fab-map-toggle{
  right:10px;
  left:auto;
  top:160px;
  width:50px;
  height:50px;
  font-size:22px;
}
}

@media (min-width: 861px){
  .topbar{
    top:10px;
    left:10px;
    right:10px;
  }

  .brand{
    font-size:18px;
  }

  .brand-sub{
    font-size:12px;
  }

  .pill{
    min-height:40px;
    font-size:13px;
    padding:0 12px;
  }

  .control-band{
    top:88px;
    left:10px;
    right:10px;
    padding:8px;
  }

  .control-group{
    gap:8px;
  }

  .ctl{
    min-height:48px;
    font-size:14px;
  }

  .install-hint{
    top:146px;
    left:10px;
    right:10px;
  }

  .leaflet-top.leaflet-left{
    top:160px;
  }

  .fab-map-toggle{
  right:10px;
  left:auto;
  top:160px;
  width:50px;
  height:50px;
  font-size:22px;
}

  .map-actions{
    right:10px;
    bottom:14px;
  }

  .action-btn{
    min-width:130px;
    min-height:50px;
    font-size:16px;
  }

  .map-info-box{
    left:10px;
    bottom:14px;
    max-width:min(220px, calc(100% - 160px));
    padding:14px 15px;
  }
}

@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui){
  #installBtn{
    display:none !important;
  }
}