:root{
  --bg:#0a0c12;
  --panel:#12151f;
  --panel-edge:#232838;
  --ink:#e8eaf1;
  --muted:#828aa0;
  --gold:#e8b85c;
  --gold-dim:#8a723f;
  --violet:#8b7ef0;
  --line:#2a2f42;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{height:100%; margin:0; background:var(--bg); overscroll-behavior:none;}
body{font-family:var(--sans); color:var(--ink);}
#map{position:fixed; inset:0; z-index:0; background:#000;}
.leaflet-control-attribution{background:rgba(10,12,18,.6)!important; color:var(--muted)!important; font-size:9px!important;}
.leaflet-control-attribution a{color:var(--muted)!important;}
.leaflet-control-zoom{display:none;}

/* pin */
.core-pin{
  width:16px; height:16px; border-radius:50%;
  background:var(--gold); box-shadow:0 0 0 3px rgba(232,184,92,.25), 0 0 10px rgba(232,184,92,.7);
  border:2px solid #16131a;
}

/* top bar */
.topbar{
  position:fixed; top:0; left:0; right:0; z-index:20;
  padding:calc(env(safe-area-inset-top) + 10px) 10px 10px;
  background:linear-gradient(180deg, rgba(10,12,18,.92), rgba(10,12,18,0));
  display:flex; gap:8px;
}
.search-wrap{flex:1; position:relative;}
#search{
  width:100%; padding:11px 14px; border-radius:12px; border:1px solid var(--panel-edge);
  background:var(--panel); color:var(--ink); font-size:15px; outline:none;
}
#search::placeholder{color:var(--muted);}
#searchResults{
  position:absolute; top:calc(100% + 6px); left:0; right:0;
  background:var(--panel); border:1px solid var(--panel-edge); border-radius:12px;
  overflow:hidden; display:none; max-height:200px; overflow-y:auto;
}
#searchResults div{padding:10px 14px; font-size:13.5px; border-bottom:1px solid var(--line); color:var(--ink);}
#searchResults div:last-child{border-bottom:none;}
#searchResults div:active{background:var(--line);}
.iconbtn{
  width:42px; height:42px; flex:none; border-radius:12px; border:1px solid var(--panel-edge);
  background:var(--panel); color:var(--ink); font-size:18px; display:flex; align-items:center; justify-content:center;
}

/* bottom sheet */
/* Height-capped + scrollable so long status text can never push the whole
   panel taller than the screen and swallow the map behind it (the failure
   mode on narrow/mobile viewports, where every status line wraps onto many
   more lines than it does on desktop). The handle lets you collapse it
   further to see the full map. */
.sheet{
  position:fixed; left:0; right:0; bottom:0; z-index:20;
  background:linear-gradient(180deg, rgba(18,21,31,.0), rgba(10,12,18,.97) 20%);
  padding:0 12px calc(env(safe-area-inset-bottom) + 12px);
  max-height:60vh;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  transition:max-height .2s ease;
}
.sheet.collapsed{
  max-height:112px;
  overflow:hidden;
}
.sheet-handle{
  display:block; width:100%; height:22px; margin:6px 0 2px; padding:0;
  background:transparent; border:none;
}
.sheet-handle::before{
  content:''; display:block; width:38px; height:4px; margin:0 auto; border-radius:2px;
  background:var(--line);
}
.sheet-handle:active::before{ background:var(--muted); }
.card{
  background:var(--panel); border:1px solid var(--panel-edge); border-radius:16px;
  padding:12px 14px; margin-bottom:8px;
}
.sky-row{display:flex; gap:14px; align-items:flex-start;}
@media (max-width:480px){
  .sky-row{flex-direction:column; align-items:center;}
}
.row{display:flex; align-items:center; justify-content:space-between; gap:8px;}
.label{font-size:10.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--muted);}
.bignum{font-family:var(--mono); font-size:15px; color:var(--ink);}
.coords{font-family:var(--mono); font-size:12.5px; color:var(--muted);}

.status-line{font-size:13.5px; margin-top:6px; line-height:1.4;}
.status-up{color:var(--gold);}
.status-down{color:var(--muted);}

.timerow{display:flex; align-items:center; gap:8px; margin-top:10px;}
input[type=date]{
  flex:1; background:#0d0f17; border:1px solid var(--line); border-radius:10px;
  color:var(--ink); font-family:var(--mono); font-size:13px; padding:8px 8px; min-width:0;
}
.stepbtn{
  width:34px; height:34px; border-radius:9px; border:1px solid var(--line); background:#0d0f17;
  color:var(--ink); font-size:15px; flex:none;
}
.nowbtn{
  border-radius:9px; border:1px solid var(--line); background:#0d0f17; color:var(--gold);
  font-size:12px; padding:0 10px; height:34px; flex:none;
}

.modebar{
  display:flex; gap:6px; margin-bottom:10px;
}
.modebtn{
  flex:1; border-radius:10px; border:1px solid var(--line); background:#0d0f17;
  color:var(--muted); font-size:12.5px; font-weight:600; padding:8px 4px;
}
.modebtn.active{
  color:#16131a; border-color:transparent;
}
.modebtn[data-mode="sunrise"].active{ background:#ff8fa3; }
.modebtn[data-mode="sunset"].active{ background:#ff5f4d; }
.modebtn[data-mode="core"].active{ background:var(--gold); }

/* compass */
#skywrap{position:relative; margin:0 auto;}
#sky{display:block;}
.tip{font-size:11px; color:var(--muted); text-align:center; margin-top:6px; line-height:1.4;}

.hidden{display:none!important;}
