:root {
  --ink: #061a24;
  --paper: #f4f7f5;
  --line: #d8e1df;
  --muted: #61747a;
  --sea: #006d77;
  --acid: #dff44a;
  --orange: #f5831f;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.topbar { height: 78px; padding: 0 max(24px, calc((100vw - 1480px) / 2)); display: flex; align-items: center; gap: 22px; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(244,247,245,.93); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 800; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid #d9e2e3; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand b { display: block; font-size: 16px; line-height: 1; }
.brand small { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; text-transform: uppercase; letter-spacing: .12em; }
.main-menu { display: flex; align-items: center; gap: 6px; margin-right: auto; }
.auth-actions { display: flex; align-items: center; gap: 6px; }
.main-menu a, .bottom-menu a, .auth-link { color: #31545a; text-decoration: none; border: 1px solid #bfd0cd; background: #fff; padding: 9px 12px; font-size: 11px; font-weight: 800; }
.main-menu a.active, .bottom-menu a.active, .auth-link:hover { border-color: var(--ink); background: var(--ink); color: var(--acid); }
.live-chip { display: flex; align-items: center; gap: 8px; border: 1px solid #bfd0cd; border-radius: 999px; padding: 8px 12px; font-size: 11px; font-weight: 700; color: #31545a; background: #fff; }
.live-chip i { width: 8px; height: 8px; border-radius: 50%; background: #24a66b; }

.buoy-page { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 52px 0 40px; }
.buoy-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 12px; color: var(--sea); font-size: 10px; letter-spacing: .18em; font-weight: 800; }
.buoy-hero h1 { margin: 0; font-size: clamp(38px, 6vw, 76px); letter-spacing: -.06em; line-height: .9; }
.buoy-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.buoy-actions button, .filters button { border: 1px solid #31525e; background: #fff; color: var(--ink); padding: 11px 13px; font-size: 11px; font-weight: 900; cursor: pointer; }
.buoy-actions button:last-child, .filters button.active { background: var(--acid); border-color: var(--acid); }

.buoy-layout { display: grid; grid-template-columns: minmax(520px, 1.45fr) minmax(360px, .8fr); background: var(--ink); color: #fff; box-shadow: 0 22px 70px rgba(5,32,43,.17); }
.earth-panel { min-width: 0; padding: 24px; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.filters { display: flex; gap: 5px; flex-wrap: wrap; }
.source-time { color: #82a2ad; text-align: right; font-size: 10px; }
.earth-map { position: relative; overflow: hidden; border: 1px solid #31515e; background: #061a24; min-height: 720px; }
#buoyMap { width: 100%; height: min(78vh, 820px); min-height: 720px; background: #062334; }
.leaflet-container { font-family: Arial, Helvetica, sans-serif; background: #062334; }
.leaflet-control-layers, .leaflet-control-zoom a { border-radius: 0 !important; border-color: rgba(6,26,36,.2) !important; }
.leaflet-control-layers { color: var(--ink); font-size: 11px; font-weight: 800; }
.leaflet-control-attribution { font-size: 9px; background: rgba(255,255,255,.78) !important; }

.map-key { position: absolute; right: 12px; bottom: 12px; z-index: 500; display: flex; gap: 10px; align-items: center; background: rgba(4,22,30,.82); padding: 8px 10px; color: #bdd1d7; font-size: 10px; }
.map-key span { display: flex; align-items: center; gap: 6px; }
.pole-dot, .sports-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pole-dot { background: var(--acid); }
.sports-dot { background: var(--orange); }

.fad-marker-wrap { background: transparent; border: 0; }
.fad-marker { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--acid); border: 3px solid #061a24; box-shadow: 0 0 0 3px rgba(255,255,255,.7), 0 10px 26px rgba(0,0,0,.34); transform: translateZ(0); }
.fad-marker i { font-style: normal; color: #061a24; font-size: 10px; font-weight: 900; }
.fad-marker.sports { background: var(--orange); }
.fad-marker.selected { width: 44px; height: 44px; border-color: #fff; box-shadow: 0 0 0 4px rgba(223,244,74,.55), 0 16px 34px rgba(0,0,0,.45); }

.fad-popup .leaflet-popup-content-wrapper { border-radius: 0; background: #061a24; color: white; box-shadow: 0 16px 44px rgba(0,0,0,.36); }
.fad-popup .leaflet-popup-tip { background: #061a24; }
.map-popup { min-width: 190px; display: grid; gap: 7px; }
.map-popup b { font-size: 14px; }
.map-popup span { color: var(--acid); font-size: 11px; font-weight: 900; }
.map-popup small { color: #bdd1d7; line-height: 1.45; }
.map-popup a { justify-self: start; text-decoration: none; background: var(--acid); color: var(--ink); padding: 8px 10px; font-size: 10px; font-weight: 900; }

.buoy-panel { border-left: 1px solid #31515e; display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.panel-heading { padding: 30px 28px 20px; border-bottom: 1px solid #274752; }
.panel-heading .eyebrow { color: var(--acid); }
.panel-heading h2 { margin: 0 0 10px; font-size: 38px; line-height: .95; letter-spacing: -.05em; }
.panel-heading p { margin: 0; color: #8fadb7; font-size: 12px; line-height: 1.5; }
.search-box { padding: 16px 22px; border-bottom: 1px solid #274752; display: flex; flex-direction: column; gap: 7px; }
.search-box span { color: #8fadb7; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.search-box input { border: 1px solid #31515e; background: #0b2631; color: #fff; padding: 11px 12px; font-size: 13px; }
.selected-buoy { padding: 18px 22px; border-bottom: 1px solid #274752; background: #0b2631; }
.selected-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.selected-head b { display: block; }
.selected-head small { display: block; color: #8fadb7; margin-top: 3px; }
.buoy-type { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 900; color: #061a24; }
.buoy-type.pole { background: var(--acid); }
.buoy-type.sports { background: var(--orange); }
dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 14px; }
dt { color: #8fadb7; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
dd { margin: 3px 0 0; font-size: 12px; color: #e9f2f4; }
.earth-link { display: inline-flex; text-decoration: none; background: var(--acid); color: var(--ink); padding: 10px 12px; font-size: 11px; font-weight: 900; }
.buoy-list { overflow: auto; }
.buoy-row { width: 100%; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; padding: 13px 18px; border: 0; border-bottom: 1px solid #274752; background: transparent; color: #fff; text-align: left; cursor: pointer; }
.buoy-row.active, .buoy-row:hover { background: #123440; }
.buoy-main b { display: block; font-size: 13px; }
.buoy-main small { display: block; color: #7899a4; margin-top: 5px; font-size: 10px; line-height: 1.35; }
.buoy-state { color: #8fadb7; font-size: 10px; font-weight: 800; }
.bottom-menu { display: none; }

@media (max-width: 1000px) {
  .main-menu, .auth-link, .auth-actions { display: none; }
  .buoy-layout { grid-template-columns: 1fr; }
  .buoy-panel { border-left: 0; border-top: 1px solid #31515e; max-height: none; }
  .buoy-page { padding-bottom: 92px; }
  .bottom-menu { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 900; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; background: rgba(244,247,245,.94); backdrop-filter: blur(14px); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(5,32,43,.2); }
  .bottom-menu a { text-align: center; border-radius: 0; }
}

@media (max-width: 620px) {
  .topbar { height: 67px; padding: 0 16px; }
  .live-chip { display: none; }
  .buoy-page { width: calc(100% - 24px); padding-top: 34px; }
  .buoy-hero { align-items: flex-start; flex-direction: column; }
  .buoy-actions { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .earth-panel { padding: 12px; }
  .map-toolbar { align-items: flex-start; flex-direction: column; }
  .filters { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .filters button { padding: 10px 6px; }
  .source-time { text-align: left; }
  .earth-map { min-height: 560px; }
  #buoyMap { height: 62vh; min-height: 560px; }
  .panel-heading { padding: 26px 20px 18px; }
  .search-box, .selected-buoy { padding-left: 18px; padding-right: 18px; }
  dl { grid-template-columns: 1fr; }
  .buoy-row { padding-left: 14px; padding-right: 14px; }
}
