/* ============ Slapy Navigátor — mobile-first ============ */
:root {
  --bg: #0b1d2a;
  --bg2: #10283a;
  --panel: #122c40;
  --line: #1e425c;
  --text: #eaf3f9;
  --muted: #8fb0c4;
  --accent: #2fb4ff;
  --accent2: #ffb02f;
  --danger: #ff4d4d;
  --ok: #35d07f;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --statusbar-h: 58px;
  --tabbar-h: 60px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  user-select: none;
}

/* ============ stavový pruh ============ */
#statusbar {
  height: calc(var(--statusbar-h) + var(--sat));
  padding: var(--sat) 8px 0 8px;
  background: linear-gradient(180deg, #0a1926, var(--bg2));
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 1200;
  flex-shrink: 0;
}
.stat { flex: 1; text-align: center; min-width: 0; }
.stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}
.stat-unit { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
#stat-speed .stat-value { color: var(--accent); }
#stat-speed.overspeed .stat-value { color: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }
#gps-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  border-radius: 10px;
  padding: 10px 12px;
  flex-shrink: 0;
}
#gps-btn.gps-on { color: #06251a; background: var(--ok); border-color: var(--ok); }
#gps-btn.gps-wait { color: #332400; background: var(--accent2); border-color: var(--accent2); animation: blink 1.2s infinite; }

/* ============ varování ============ */
#alertbar {
  position: absolute;
  top: calc(var(--statusbar-h) + var(--sat) + 6px);
  left: 8px; right: 8px;
  z-index: 1300;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  text-align: center;
}
#alertbar.warn { background: var(--accent2); color: #241a00; }

/* ============ mapa ============ */
#map { flex: 1; background: #0d2233; z-index: 1; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution {
  background: rgba(11,29,42,.75) !important;
  color: var(--muted) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-bar a { background: var(--panel); color: var(--text); border-bottom-color: var(--line); }

/* plovoucí tlačítka */
#map-fabs {
  position: absolute;
  right: 10px;
  bottom: calc(var(--tabbar-h) + var(--sab) + 14px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1100;
}
#map-fabs button {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0,0,0,.45);
}
#fab-locate.active { color: var(--accent); border-color: var(--accent); }
#fab-north.course-up { color: var(--accent); border-color: var(--accent); }
#fab-mob { background: #7a1420; border-color: #a02030; font-size: 12px; }

/* cíl / měření */
#target-info {
  position: absolute;
  left: 10px; right: 68px;
  bottom: calc(var(--tabbar-h) + var(--sab) + 14px);
  z-index: 1100;
  background: rgba(18,44,64,.94);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
#target-text { flex: 1; }
#target-text small { color: var(--muted); font-weight: 400; }
#target-clear { background: none; border: none; color: var(--muted); font-size: 18px; padding: 4px; }

/* ============ vysouvací panel ============ */
#panel {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--sab));
  top: calc(var(--statusbar-h) + var(--sat) + 46px);
  z-index: 1150;
  background: var(--bg2);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 30px rgba(0,0,0,.5);
}
#panel[hidden] { display: none; }
#target-info[hidden] { display: none; }
#panel-handle { padding: 8px 0 4px; display: flex; justify-content: center; flex-shrink: 0; }
#panel-handle span { width: 44px; height: 4px; border-radius: 2px; background: var(--line); display: block; }
#panel-content { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 14px calc(16px + var(--sab)); user-select: text; }

#panel-content h2 { font-size: 19px; margin: 10px 0 8px; }
#panel-content h3 { font-size: 15px; margin: 16px 0 6px; color: var(--accent); }
#panel-content p, #panel-content li { font-size: 14px; line-height: 1.5; color: var(--text); }
#panel-content ul, #panel-content ol { padding-left: 20px; margin: 6px 0; }
#panel-content small, .muted { color: var(--muted); }
#panel-content a { color: var(--accent); }

/* karty míst */
.poi-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.poi-filters button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 20px;
  font-size: 12.5px;
  padding: 7px 12px;
}
.poi-filters button.on { color: #04121c; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.poi-card {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.poi-ico { font-size: 22px; width: 34px; text-align: center; flex-shrink: 0; }
.poi-body { flex: 1; min-width: 0; }
.poi-name { font-weight: 700; font-size: 14.5px; }
.poi-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.poi-dist { font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* karty pravidel / info */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 10px 0;
}
.card h3 { margin-top: 0 !important; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 700; }
.badge.ok { background: rgba(53,208,127,.18); color: var(--ok); }
.badge.no { background: rgba(255,77,77,.18); color: var(--danger); }
.badge.warn { background: rgba(255,176,47,.18); color: var(--accent2); }

.bigbtn {
  display: block;
  width: 100%;
  padding: 13px;
  margin: 8px 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
.bigbtn.primary { background: var(--accent); border-color: var(--accent); color: #04121c; }
.bigbtn.danger { background: #7a1420; border-color: #a02030; color: #fff; }

/* počasí */
.wx-now { display: flex; align-items: center; gap: 14px; }
.wx-temp { font-size: 34px; font-weight: 700; }
.wx-wind { font-size: 14px; color: var(--muted); line-height: 1.5; }
.wx-hours { display: flex; gap: 4px; overflow-x: auto; padding: 8px 0 2px; }
.wx-h { min-width: 52px; text-align: center; background: var(--bg); border-radius: 10px; padding: 8px 4px; font-size: 12px; }
.wx-h .t { font-weight: 700; font-size: 13px; }
.wx-h .w { color: var(--muted); font-size: 11px; }
.wx-h.gusty .w { color: var(--accent2); font-weight: 700; }

/* ============ spodní lišta ============ */
#tabbar {
  height: calc(var(--tabbar-h) + var(--sab));
  padding-bottom: var(--sab);
  background: linear-gradient(0deg, #081521, var(--bg2));
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 1250;
  flex-shrink: 0;
}
#tabbar button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
#tabbar button .ico { font-size: 20px; line-height: 1; }
#tabbar button.active { color: var(--accent); }

/* ============ mapové prvky ============ */
.boat-marker { filter: drop-shadow(0 2px 5px rgba(0,0,0,.6)); }
.poi-label div {
  background: rgba(11,29,42,.88);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transform: translate(-50%, 6px);
  width: max-content;
}
.poi-pin div {
  font-size: 19px;
  line-height: 1;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  width: max-content;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.85));
}
.km-label div {
  color: #fdfdfd;
  text-shadow: 0 0 3px #000, 0 0 6px #000;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.leaflet-popup-content-wrapper { background: var(--panel); color: var(--text); border-radius: 12px; }
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { margin: 12px 14px; font-size: 13.5px; line-height: 1.45; }
.leaflet-popup-content b { font-size: 14.5px; }
.leaflet-popup-content .muted { color: var(--muted); font-size: 12.5px; }
.leaflet-popup-content a { color: var(--accent); }
.popup-actions { margin-top: 8px; display: flex; gap: 6px; }
.popup-actions button {
  flex: 1;
  border: 1px solid var(--accent);
  background: none;
  color: var(--accent);
  border-radius: 8px;
  padding: 6px;
  font-size: 12.5px;
  font-weight: 700;
}

/* vrstvy přepínač */
#layer-menu {
  position: absolute;
  right: 68px;
  bottom: calc(var(--tabbar-h) + var(--sab) + 72px);
  z-index: 1100;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
#layer-menu button {
  border: none;
  background: none;
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  text-align: left;
  border-radius: 8px;
}
#layer-menu button.on { background: var(--accent); color: #04121c; font-weight: 700; }
#layer-menu label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; padding: 8px 12px; color: var(--text);
  border-top: 1px solid var(--line); margin-top: 4px;
}

@media (min-width: 700px) {
  .stat-value { font-size: 26px; }
  #panel { left: auto; width: 420px; right: 0; border-radius: 18px 0 0 0; }
}
