:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #edf4f7;
  --panel: rgba(8, 25, 35, .93);
  --border: rgba(163, 201, 218, .18);
  --muted: #a5bac5;
  --cyan: #70d3f1;
  --header-height: 72px;
}
* { box-sizing: border-box; }
html, body, #map { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; background: #122430; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible + .switch { outline: 3px solid var(--cyan); outline-offset: 3px; }
button { cursor: pointer; }
.glass { background: var(--panel); border: 1px solid var(--border); backdrop-filter: blur(14px); box-shadow: 0 8px 24px #0004; }
.topbar { position: absolute; inset: 0 0 auto; height: var(--header-height); z-index: 3; display: flex; align-items: center; gap: 18px; padding: 0 20px; border-width: 0 0 1px; }
.icon-button { width: 44px; height: 44px; flex: 0 0 44px; padding: 0; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: #ffffff08; font-size: 25px; line-height: 1; }
.icon-button:hover { background: #ffffff15; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; color: var(--cyan); }
.brand h1 { font-size: 21px; letter-spacing: .4px; margin: 0; line-height: 1.2; }
.brand h1 span { color: var(--cyan); }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.pilot-region { margin-left: auto; font-size: 10px; letter-spacing: 1.4px; color: var(--muted); }
.pilot-region span { display: block; color: #edf4f7; font-size: 12px; letter-spacing: .5px; margin-top: 4px; }
.pilot-badge { font-size: 10px; letter-spacing: .7px; border: 1px solid #69b9ce40; border-radius: 20px; padding: 8px 12px; color: #d0e8ef; white-space: nowrap; }
.pilot-badge i { display: inline-block; width: 6px; height: 6px; background: var(--cyan); border-radius: 50%; margin-right: 5px; }
#test-notice { position: absolute; top: calc(var(--header-height) + 10px); left: 50%; transform: translateX(-50%); z-index: 2; margin: 0; max-width: calc(100% - 120px); padding: 7px 12px; border: 1px solid #e5be6a66; border-radius: 7px; color: #f5e1b4; background: rgba(26, 29, 26, .94); font-size: 11px; line-height: 1.35; text-align: center; pointer-events: none; }
#test-notice > span { font-weight: 800; margin-right: 4px; }
#layer-menu { position: absolute; left: 16px; top: 118px; bottom: 36px; width: 268px; z-index: 3; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; }
.menu-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.eyebrow { font-size: 10px; letter-spacing: 1.5px; color: var(--muted); }
h2 { font-size: 20px; margin: 5px 0 0; font-weight: 650; }
.menu-heading .icon-button { background: transparent; border: 0; font-size: 25px; }
.menu-scroll { overflow-y: auto; padding: 0 14px 16px; scrollbar-width: thin; scrollbar-color: #546a78 transparent; }
.region-card { margin-top: 14px; padding: 13px; border-radius: 8px; background: #ffffff07; border: 1px solid var(--border); display: grid; gap: 6px; }
.region-card strong { font-size: 13px; font-weight: 600; }
.region-card > span:last-child { font-size: 11px; color: var(--muted); }
.menu-scroll h3 { font-size: 12px; font-weight: 600; margin: 20px 0 8px; }
.section-tag { color: #dfc080; border: 1px solid #dfc08044; font-size: 9px; padding: 2px 5px; border-radius: 4px; letter-spacing: .4px; vertical-align: middle; }
.menu-scroll h3 .section-tag { float: right; }
.layer-row { position: relative; display: flex; align-items: center; gap: 9px; min-height: 50px; padding: 5px 2px; cursor: pointer; font-size: 13px; }
.layer-row > span:not(.switch):not(.layer-symbol) { flex: 1; }
.layer-row small { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.layer-symbol { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border-radius: 8px; background: currentColor; font-weight: 700; font-size: 17px; }
.layer-symbol { background: #ffffff07; border: 1px solid currentColor; }
.green { color: #4ade80; } .red { color: #fb7185; } .orange { color: #fbbf24; } .cyan { color: #67e8f9; } .blue { color: #60a5fa; } .gray { color: #b6c0cc; } .aerial { color: #a1c4a8; }
.purple { color: #c084fc; }
.nsg-blue { color: #7db7e8; }
.section-tag.real-tag { color: #d7b8ff; border-color: #c084fc66; }
.layer-row input { position: absolute; right: 0; width: 44px; height: 44px; opacity: 0; margin: 0; cursor: pointer; }
.switch { width: 34px; height: 20px; flex: 0 0 34px; border-radius: 20px; background: #415460; border: 1px solid #8295a44d; pointer-events: none; }
.switch::after { content: ""; display: block; width: 14px; height: 14px; margin: 2px; border-radius: 50%; background: #dbe6ed; }
input:checked + .switch { background: #429db7; }
input:checked + .switch::after { margin-left: 16px; background: white; }
input:disabled + .switch { opacity: .4; }
.unavailable { color: #8196a2; cursor: not-allowed; min-height: 44px; border-bottom: 1px solid #ffffff05; }
.unavailable input { cursor: not-allowed; }
.unavailable small { font-size: 10px; border: 1px solid #71889a33; padding: 3px 5px; border-radius: 4px; margin: 0; }
.legend { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 4px; font-size: 11px; color: #c4d3dc; }
.legend > div { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.dot { width: 8px; height: 8px; flex: 0 0 8px; background: currentColor; border-radius: 50%; }
.legend p, .menu-note { font-size: 10px; color: var(--muted); line-height: 1.5; }
#object-details { position: absolute; top: 118px; right: 74px; bottom: 36px; width: 342px; z-index: 3; border-radius: 14px; overflow: auto; scrollbar-width: thin; scrollbar-color: #546a78 transparent; }
.detail-toolbar { position: sticky; top: 0; z-index: 1; background: #0a202b; display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 7px 14px; border-bottom: 1px solid var(--border); }
.detail-toolbar .icon-button { border: 0; background: transparent; }
.detail-toolbar .section-tag { margin-left: 6px; }
#detail-content { padding: 18px; font-size: 12px; line-height: 1.5; }
#detail-content h2 { font-size: 20px; line-height: 1.25; margin: 0 0 8px; overflow-wrap: anywhere; }
#detail-content h3 { margin: 24px 0 10px; padding-top: 15px; border-top: 1px solid var(--border); font-size: 12px; color: #e7f0f5; font-weight: 650; }
.detail-row { display: grid; gap: 3px; margin-bottom: 13px; overflow-wrap: anywhere; }
.detail-label { color: var(--muted); font-size: 10px; letter-spacing: .3px; }
.detail-value { color: #e8f1f5; }
.detail-row[data-field="object_type"] { color: var(--cyan); margin-bottom: 18px; }
.detail-row[data-field="object_id"], .detail-row[data-field="test_notice"] { font-size: 10px; color: var(--muted); }
.status { border: 1px solid #ffffff16; border-left: 4px solid; background: #ffffff05; padding: 11px 12px; border-radius: 7px; }
.status[data-status="ALLOWED"] { background: #22c55e12; }
.status[data-status="RESTRICTED"] { background: #f59e0b12; }
.status[data-status="PROHIBITED"] { background: #ef444412; }
.status[data-status="UNKNOWN"] { background: #9ca3af12; }
.detail-row[data-field="access_status"] { border: 1px solid var(--border); padding: 11px 12px; border-radius: 7px; background: #ffffff03; }
.detail-row[data-field^="Test-"] { padding: 10px 12px; border: 1px solid #70d3f129; border-radius: 7px; background: #70d3f106; }
#detail-content ul { list-style: none; margin: 0; padding: 0; }
#detail-content li { background: #ffffff04; border-radius: 8px; border: 1px solid var(--border); padding: 12px; color: #c4d4de; }
#detail-content li p { margin: 6px 0; }
.source-title { color: #edf4f7; font-weight: 600; }
.source-check { font-size: 11px; color: var(--muted); }
.detail-note { font-size: 10px; color: var(--muted); margin-top: 16px; }
.groyne-technical { margin-top: 20px; border-top: 1px solid var(--border); }
.groyne-technical > summary { min-height: 44px; padding: 12px 4px; cursor: pointer; font-weight: 650; color: #e7f0f5; }
.groyne-technical > summary:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
.groyne-technical-content { padding-top: 10px; }
.maplibregl-ctrl-top-right { top: 118px; right: 16px; }
.maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 0; }
.maplibregl-ctrl-group { background: #0a202bee; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 20px #0004; overflow: hidden; }
.maplibregl-ctrl-group button { width: 44px; height: 44px; }
.maplibregl-ctrl-group button + button { border-color: var(--border); }
.maplibregl-ctrl-group button:hover { background: #ffffff18; }
.maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { color: #c6d6e1; background: #0a202be8 !important; font-size: 10px; }
.maplibregl-ctrl-attrib a { color: #c6d6e1; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
#map-error { position: absolute; left: 50%; top: 115px; transform: translateX(-50%); z-index: 5; width: min(460px, 90%); margin: 0; padding: 12px; border: 1px solid #fb7185; border-radius: 8px; background: #411923; color: #ffe0e6; font-size: 13px; }
@media (max-width: 1023px) {
  :root { --header-height: 64px; }
  .topbar { padding: 0 12px; gap: 12px; }
  .brand h1 { font-size: 18px; }
  .brand-mark { width: 32px; height: 32px; }
  .pilot-region { display: none; }
  .pilot-badge { margin-left: auto; font-size: 9px; padding: 6px 8px; }
  #layer-menu { top: 106px; left: 12px; bottom: 36px; }
  #object-details { top: 106px; right: 70px; width: 320px; }
  .maplibregl-ctrl-top-right { top: 110px; right: 12px; }
}
@media (max-width: 600px) {
  :root { --header-height: 62px; }
  .topbar { gap: 10px; padding: 0 10px; }
  .brand { gap: 7px; }
  .brand-mark { display: none; }
  .brand h1 { font-size: 17px; }
  .brand p { font-size: 10px; }
  .pilot-badge { font-size: 8px; padding: 6px; max-width: 78px; white-space: normal; text-align: center; letter-spacing: .2px; line-height: 1.3; }
  .pilot-badge i { display: none; }
  #test-notice { top: 70px; max-width: calc(100% - 20px); width: max-content; font-size: 10px; padding: 6px 8px; }
  #layer-menu { width: min(290px, calc(100% - 70px)); top: 110px; bottom: 30px; left: 10px; }
  .maplibregl-ctrl-top-right { top: 112px; right: 10px; }
  #object-details { top: auto; bottom: 25px; left: 8px; right: 8px; width: auto; max-height: 42dvh; border-radius: 16px 16px 10px 10px; }
  .detail-toolbar { min-height: 54px; }
  #detail-content { padding: 14px 16px 20px; }
  #detail-content h2 { font-size: 18px; }
}
@media (max-height: 500px) {
  #object-details { max-height: calc(100dvh - 128px); }
  #layer-menu { top: 110px; bottom: 28px; }
}
.brand-area { display: none; }
@media (max-width: 1023px) {
  .brand-context { display: none; }
  .brand-area { display: inline; }
}
.maplibregl-map .maplibregl-ctrl-attrib { color: #c6d6e1; }
#rfg-rule-list h4 { margin: 14px 0 5px; font-size: 11px; color: #c4d3dc; }
.rfg-rule-button { display: block; width: 100%; min-height: 48px; margin: 5px 0; padding: 9px 10px; text-align: left; font: inherit; font-size: 12px; line-height: 1.4; color: #e8f1f5; background: #ffffff06; border: 1px solid #ffffff20; border-radius: 7px; cursor: pointer; }
.rfg-rule-button small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.rfg-rule-button[aria-pressed="true"] { border-color: #fde047; }
.rfg-rule-button:focus-visible { outline: 2px solid #fde047; outline-offset: 2px; }

.exception-warning {border-left:3px solid #fbbf24;background:rgba(251,191,36,.12);padding:10px;}

#shore-notice {position:fixed;left:10px;bottom:32px;z-index:2;max-width:calc(100vw - 80px);padding:5px 9px;font-size:11px;color:#fcd34d;pointer-events:none;}

/* Footer rows reserve their actual wrapped height, also above mobile details. */
#shore-notice {bottom:var(--source-clearance,36px);}
#layer-menu,#object-details {bottom:var(--footer-clearance,72px);}
