:root {
  --bg: #070d16; --panel: #0e1724; --panel2: #132033; --stroke: rgba(255,255,255,.10);
  --text: #e8eef6; --muted: #93a4b8; --accent: #3cf0a0; --spot: #ff4fd8; --warn: #ffb020;
  --glass: rgba(10,16,26,.82);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); height: 100dvh; overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--stroke); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: rgba(255,255,255,.25); }
button:disabled, select:disabled, input:disabled { opacity: .45; cursor: not-allowed; }
button.icon { width: 32px; padding: 5px 0; font-size: 17px; line-height: 1; }
button.link { background: none; border: 0; color: var(--accent); padding: 2px 0; }
select, input { background: #0a1320; border: 1px solid var(--stroke); border-radius: 7px; padding: 5px 7px; }
input[type=range] { padding: 0; width: 100%; }
input[type=color] { padding: 0 2px; width: 56px; height: 26px; cursor: pointer; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--stroke); flex-wrap: wrap; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand b { font-size: 16px; letter-spacing: .2px; }
.logo { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--accent); background: radial-gradient(circle at 35% 35%, #1b4a6e, #0b2540); }
.badge { font-size: 11px; color: var(--bg); background: var(--accent); border-radius: 6px; padding: 1px 6px; font-weight: 600; }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tools.right { margin-left: auto; }
.tog[aria-pressed=true] { background: #17405a; border-color: #2f88b5; color: #fff; }
.sel { display: flex; align-items: center; gap: 6px; color: var(--muted); }

/* Map */
#mapWrap { position: relative; overflow: hidden; touch-action: none; background: #000; }
#map, #top { position: absolute; inset: 0; width: 100%; height: 100%; }
#top { pointer-events: none; }
#mapWrap.grabbing { cursor: grabbing; }
.hover { position: absolute; top: 10px; left: 10px; display: flex; gap: 8px; align-items: flex-start; pointer-events: none; max-width: calc(100% - 20px); flex-wrap: wrap; }
.hover .box { background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.hover .box:not(.wheelbox) { max-width: min(420px, 100%); white-space: normal; overflow-wrap: anywhere; }
.hover .title { font-weight: 600; font-size: 13px; }
.hover hr { border: 0; border-top: 1px solid var(--stroke); margin: 5px 0; }
.hover .muted, .muted { color: var(--muted); }
.hover table { border-collapse: collapse; }
.hover td { padding: 0 8px 0 0; white-space: nowrap; }
.hover td.cmt { max-width: 200px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.hover .spothead { color: var(--spot); font-weight: 600; }
.wheelbox h4 { margin: 0; font-size: 13px; } .wheelbox .sub { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.wheelbox .err { color: var(--warn); width: 250px; height: 250px; display: grid; place-items: center; text-align: center; padding: 20px; }
.wheelbox canvas { display: block; }
.legends { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 8px; align-items: flex-end; pointer-events: none; flex-wrap: wrap; }
.legend { background: var(--glass); border: 1px solid var(--stroke); border-radius: 8px; padding: 6px 8px; font-size: 11px; }
.legend .bar { height: 8px; border-radius: 4px; width: 170px; margin: 3px 0; }
.legend .ends { display: flex; justify-content: space-between; color: var(--muted); width: 170px; }
.legend.right { margin-left: auto; }
.legend .chips { display: flex; gap: 2px; margin-top: 3px; }
.legend .chips span { padding: 1px 4px; border-radius: 3px; color: #111; font-weight: 600; }
.badgebox { position: absolute; left: 50%; transform: translateX(-50%); bottom: 10px; background: var(--glass); border: 1px solid var(--stroke); border-radius: 20px; padding: 4px 12px; font-size: 12px; pointer-events: none; white-space: nowrap; }
.badgebox .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.zoombadge { position: absolute; top: 10px; right: 10px; background: var(--glass); border: 1px solid var(--stroke); border-radius: 8px; padding: 4px 6px 4px 10px; font-size: 12px; }
.zoombadge button { padding: 2px 8px; font-size: 12px; }
.toast { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: var(--glass); border: 1px solid var(--stroke); padding: 6px 12px; border-radius: 8px; font-size: 12px; }

/* Info bar */
.infobar { display: grid; grid-template-columns: minmax(0, 2.4fr) 1fr 1fr 1.3fr; gap: 10px; padding: 10px 12px; background: var(--panel); border-top: 1px solid var(--stroke); }
.card { background: rgba(255,255,255,.035); border: 1px solid var(--stroke); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.card h2 { margin: 0 0 6px; font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card h2 span { text-transform: none; letter-spacing: 0; font-weight: 400; }
.clock .time { font-size: 34px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.clock .sub, .sun { color: var(--muted); font-size: 12px; }
.sun b { color: var(--text); font-weight: 600; }
.sun .suntimes { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; margin: 2px 0 4px; }
.sun .suntime { color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.tile { background: rgba(255,255,255,.03); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.tile .k { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.tile .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .r { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Settings drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%); background: var(--panel); border-left: 1px solid var(--stroke); z-index: 20; display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,.4); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--stroke); }
.drawer-head h2 { margin: 0; font-size: 16px; }
.tabs { display: flex; gap: 4px; padding: 8px 14px 0; flex-wrap: wrap; }
.tabs button { border-radius: 8px 8px 0 0; border-bottom: 0; }
.tabs button.on { background: #17405a; }
.tab { padding: 6px 14px 20px; overflow-y: auto; flex: 1; }
.tab h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.tab h4 { font-size: 12px; margin: 12px 0 6px; display: flex; align-items: center; gap: 8px; color: var(--text, #e8eef6); }
.tab label { display: block; margin: 8px 0; color: var(--muted); font-size: 12.5px; }
.tab label input:not([type=checkbox]):not([type=range]), .tab label select { display: block; width: 100%; margin-top: 3px; color: var(--text); }
.tab label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
.tab .row { display: flex; gap: 8px; align-items: flex-end; }
.tab .row label { flex: 1; }
.tab .row > button { margin-bottom: 8px; }
.note { color: var(--muted); font-size: 12px; margin: 6px 0; }
.bands { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 8px; }
.bands label { margin: 2px 0; display: flex; gap: 6px; align-items: center; color: var(--text); }
.locked { position: relative; border: 1px dashed rgba(255,255,255,.18); border-radius: 10px; padding: 2px 12px 10px; margin-top: 14px; background: rgba(255,255,255,.02); }
.locked > *:not(h3):not(.lockmsg) { opacity: .5; }
.lock { font-size: 10px; letter-spacing: .5px; color: var(--bg); background: var(--warn); border-radius: 5px; padding: 1px 6px; text-transform: none; }
.lockmsg { color: var(--warn); font-size: 12.5px; margin: 10px 0 0; }

/* Help */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; display: grid; place-items: center; padding: 16px; }
.modal-body { background: var(--panel); border: 1px solid var(--stroke); border-radius: 14px; width: min(760px, 100%); max-height: 90dvh; display: flex; flex-direction: column; }
.helptext { padding: 4px 20px 20px; overflow-y: auto; line-height: 1.5; }
.helptext h1 { font-size: 20px; } .helptext h2 { font-size: 16px; margin-top: 22px; } .helptext code { background: #0a1320; padding: 1px 4px; border-radius: 4px; }
.helptext li { margin: 2px 0; }

[hidden] { display: none !important; }

/* The toolbar always stays on one line (TVs and laptops with Windows scaling wrapped it onto two):
   the layer buttons shrink first, then scroll sideways if there is still not enough room. */
@media (min-width: 701px) {
  .toolbar { flex-wrap: nowrap; }
  .toolbar .tools:not(.right) { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
  .tools.right { flex-wrap: nowrap; flex: 0 0 auto; }
  .tools button, .tools .sel, .tools .sel span { white-space: nowrap; }
}
@media (max-width: 2000px) {
  .toolbar { gap: 6px; padding: 6px 8px; }
  .tools button { padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
  .brand .badge { display: none; }
  #enterKey { display: none; } /* the trial badge opens the same licence window */
}
@media (max-width: 1350px) {
  .brand b { display: none; }
  .tools button { font-size: 12.5px; }
}
@media (max-width: 1100px) {
  .infobar { grid-template-columns: 1fr 1fr; }
  .infobar .sw { grid-column: 1 / -1; }
  .infobar .sun { display: none; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .toolbar { padding: 6px 8px; gap: 6px; flex-wrap: wrap; }
  .brand .badge { display: none; }
  .tools.right { margin-left: auto; flex-wrap: nowrap; }
  .toolbar .tools:not(.right) { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tools button { padding: 4px 7px; font-size: 12.5px; white-space: nowrap; }
  .infobar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 6px 8px; gap: 6px; }
  .infobar .sw { grid-column: 1 / -1; }
  .infobar .sun { display: none; }
  .infobar .card { padding: 6px 10px; }
  .clock .time { font-size: 20px; }
  .clock .sub { display: none; }
  .card h2 { margin-bottom: 3px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .tile { padding: 3px 6px; }
  .tile .v { font-size: 15px; }
  .tile .r { display: none; }
  .legend:not(.cov) { display: none; }
  .legend .chips span { padding: 1px 2px; font-size: 9px; }
  .hover { top: 6px; left: 6px; }
  .hover .box { font-size: 11px; }
  .zoombadge { top: auto; bottom: 64px; }
  .badgebox { bottom: auto; top: 6px; font-size: 11px; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; }
}

/* Windows desktop: watched spots strip */
.watchstrip { position: absolute; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px; max-width: 60%; pointer-events: none; }
.watchstrip span { background: var(--glass); border: 1px solid #3cf0a0; color: #3cf0a0; border-radius: 14px; padding: 3px 10px; font-size: 12px; white-space: nowrap; }
.watchstrip span b { color: #fff; }
.hneed { color: #FFC233; font-weight: 600; } .hwatch { color: #3cf0a0; font-weight: 600; }
.trialbadge { background: #3cf0a0; color: #06261a; border-color: #3cf0a0; font-weight: 600; }
.modal[hidden] { display: none; }
.welcome { width: min(440px, 100%); padding: 0 18px 18px; gap: 10px; }
.welcome p { margin: 4px 0 6px; line-height: 1.45; }
.welcome label { display: flex; flex-direction: column; gap: 4px; }
.welcome-buttons { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.welcome .primary { background: #2f8f6a; color: #fff; border: 0; border-radius: 8px; padding: 8px 18px; font-weight: 600; cursor: pointer; }
.mufcolors { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.mufcolors label.mufc { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.mufcolors input[type=color] { width: 40px; height: 22px; }
label input[type=color] { width: 56px !important; flex: none; display: block; }
.mufcolors label.mufc input[type=color] { width: 40px !important; }
.mufcolors label.mufc { white-space: nowrap; }
.rotstrip { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; z-index: 5; }
.rotbadge { background: var(--glass); border: 1px solid var(--rc, #FFD23F); border-radius: 12px; padding: 5px 8px 5px 10px; display: flex; gap: 8px; align-items: center; font-size: 12px; }
.rotbadge .rname { color: var(--rc, #FFD23F); font-weight: 600; }
.rotbadge .rdeg { font-size: 20px; font-weight: 600; min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.rotbadge .rto { opacity: .8; font-variant-numeric: tabular-nums; }
.rotbadge .rerr { color: #ff8a80; max-width: 220px; }
.rotbadge input { width: 56px; padding: 3px 5px; }
.rotbadge button { padding: 3px 8px; }
.rotbadge button.stop { background: #c0392b; color: #fff; border: 0; border-radius: 6px; font-weight: 700; }
.rotmenu { position: absolute; z-index: 20; background: var(--panel); border: 1px solid var(--stroke); border-radius: 10px; padding: 4px; min-width: 230px; box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.rotmenu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; color: inherit; cursor: pointer; }
.rotmenu button:hover { background: rgba(255,255,255,.08); }
.rotmenu .rmhead { padding: 6px 10px 4px; font-size: 12px; opacity: .7; }
.rotcard { border: 1px solid var(--stroke); border-radius: 10px; padding: 10px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.rotcard .rothead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rotcard .rothead { align-items: flex-end; }
.rotcard .rothead .rotname { flex: 1; }
.rotcard .rothead .rotname input { width: 100%; font-weight: 600; }
.rotmenu .rmant { border-left: 4px solid var(--rc, #FFD23F); margin: 4px 0; padding-left: 4px; }
.rotmenu .rmname { display: block; padding: 4px 10px 2px; color: var(--rc, #FFD23F); font-weight: 700; }
.rotcard .rothead input[type=color] { flex: none; width: 40px !important; height: 28px; padding: 0 2px; }

.legend.rotkey .rkrow { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.legend.rotkey .rksw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend.rotkey .rkoff { color: var(--warn, #ffa726); }

.drawer-grip { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2; }
.drawer-grip:hover { background: rgba(255,255,255,.08); }
#settings.wide { overflow-y: auto; }
#settings.wide .drawer-head, #settings.wide .tabs { position: sticky; top: 0; background: var(--panel); z-index: 1; }
#settings.wide .tabs { top: 49px; }
#settings.wide .tab { overflow: visible; flex: none; columns: 330px; column-gap: 28px; }
#settings.wide .tab > * { break-inside: avoid; }
#settings.wide .tab h3 { break-after: avoid; }

.anttable { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 6px; }
.anttable th { text-align: left; color: var(--muted); font-weight: 500; padding: 2px 3px; }
.anttable td { padding: 2px 3px; white-space: nowrap; }
.anttable select { width: 100%; min-width: 0; }
.anttable input { width: 72px; }
.anttable input:disabled { opacity: .45; }
.anttable td.note { white-space: normal; font-size: 11px; }
#settings.wide .anttable { break-inside: avoid; }

.toolbar .home { color: var(--muted); text-decoration: none; font-size: 13px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.toolbar .home:hover { color: inherit; background: rgba(255,255,255,.08); }
.beaconstrip { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: var(--glass); border: 1px solid var(--stroke); border-radius: 8px; padding: 4px 10px; font-size: 12px; color: #FFB020; pointer-events: none; white-space: nowrap; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; }
.beaconstrip b { color: inherit; }
.tabintro { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.ptag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; font-size: 10px; font-weight: 600; letter-spacing: .03em; color: #06261a; background: var(--acc, #3cf0a0); vertical-align: middle; }
.checklist { display: flex; flex-wrap: wrap; gap: 2px 14px; }
/* Online map */
.lockmsg a { color: var(--accent, #3cf0a0); font-weight: 600; }
.helptext .help-version { margin-top: 22px; opacity: .7; font-size: 13px; }
.beacontable { position: absolute; top: 44px; right: 10px; z-index: 5; width: 430px; max-width: calc(100% - 20px); max-height: calc(100% - 60px); overflow: auto; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.beacontable .bt-head { display: flex; justify-content: space-between; align-items: center; color: #FFB020; }
.beacontable .muted { margin: 2px 0 6px; }
.beacontable table { border-collapse: collapse; width: 100%; }
.beacontable th { font-weight: 600; font-size: 11px; text-align: center; padding: 2px 3px; }
.beacontable th span { font-weight: 400; color: var(--muted); }
.beacontable td { text-align: center; padding: 1px 3px; color: var(--muted); }
.beacontable td.c { text-align: left; font-weight: 600; color: inherit; }
.beacontable td.p { text-align: left; color: var(--muted); }
.beacontable .sel { background: rgba(255,176,32,.08); }
.beacontable td.on { color: #000; background: #FFB020; font-weight: 700; border-radius: 4px; }
.beacontable tr.now td.c, .beacontable tr.now td.p { color: #FFB020; }
.beacontable td, .beacontable th { white-space: nowrap; }
.beacontable td.p { max-width: 86px; overflow: hidden; text-overflow: ellipsis; }
.beacontable td.on { font-size: 10.5px; padding: 1px 2px; }
.helptoc { padding: 6px 0 8px; border-bottom: 1px solid var(--stroke); margin-bottom: 8px; font-size: 12px; line-height: 1.7; }
.helptoc a { color: var(--acc, #3cf0a0); text-decoration: none; white-space: nowrap; }
.helptable { border-collapse: collapse; margin: 6px 0 10px; font-size: 12px; }
.helptable th, .helptable td { border: 1px solid var(--stroke); padding: 3px 6px; text-align: left; vertical-align: top; }
.helptoc ~ h2, .helptoc ~ h1 { scroll-margin-top: 8px; }
.helpup { font-size: 12px; color: var(--muted); text-decoration: none; margin-left: 6px; }
.beacontable .bt-head { gap: 8px; cursor: move; user-select: none; touch-action: none; }
.beacontable .bt-head b { flex: 1; }
.bt-hint { font-size: 11px; margin: 0; }
/* Toolbar buttons plainly on or off */
.tog { position: relative; padding-left: 22px; background: transparent; color: var(--muted); }
.tog::before { content: ''; position: absolute; left: 8px; top: 50%; width: 8px; height: 8px; margin-top: -4px; box-sizing: border-box; border-radius: 50%; border: 1.5px solid #5d6778; }
.tog[aria-pressed=true] { background: rgba(60,240,160,.16); border-color: #3cf0a0; box-shadow: inset 0 0 0 1px rgba(60,240,160,.35); color: #fff; font-weight: 700; }
.tog[aria-pressed=true]::before { background: #3cf0a0; border-color: #3cf0a0; box-shadow: 0 0 6px #3cf0a0; }
.covpick.on span { color: #3cf0a0; font-weight: 600; }
.covpick.on select { border-color: #3cf0a0; box-shadow: inset 0 0 0 1px rgba(60,240,160,.35); }
#tip { position: fixed; z-index: 1000; max-width: 300px; padding: 5px 8px; background: #0b1119; border: 1px solid var(--stroke); border-radius: 6px; font-size: 12px; line-height: 1.35; color: #e6edf5; pointer-events: none; }
#tip .ton { color: #3cf0a0; font-weight: 600; } #tip .toff { color: #FFB020; font-weight: 600; }
.legends a { pointer-events: auto; color: inherit; }

/* 2.1: the toolbar never hides a button. When the layer buttons don't fit, they get tighter first
   (toolbar.tight), and if they still don't fit they go onto a second row (toolbar.tworows), instead of scrolling. */
.toolbar.tight .tools { gap: 3px; }
.toolbar.tight .tools button { padding-left: 6px; padding-right: 6px; font-size: 12px; }
.toolbar.tight .tools .tog { padding-left: 16px; }
.toolbar.tight .tog::before { left: 5px; width: 6px; height: 6px; margin-top: -3px; }
.toolbar.tworows { flex-wrap: wrap !important; }
.toolbar.tworows .tools:not(.right) { order: 3; flex: 1 0 100% !important; flex-wrap: wrap !important; overflow: visible !important; }

/* 2.1: clickable map keys (band chips, Reset) */
.legend.interactive { pointer-events: auto; }
.legend .bandchips { flex-wrap: wrap; }
.legend .bchip { cursor: pointer; background: var(--bc); color: #000 !important; user-select: none; }
.legend .bchip.off { background: transparent; color: var(--bc) !important; box-shadow: inset 0 0 0 1px var(--bc); opacity: .7; text-decoration: line-through; }
.legend .bchip small { font-weight: 500; opacity: .75; }
.legend .lbtns { display: inline-flex; gap: 4px; margin: 4px 6px 2px 0; }
.legend .lbtns button { padding: 1px 8px; font-size: 11px; border-radius: 6px; }
.legend a { pointer-events: auto; }
.bandchips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.bandchip { padding: 2px 8px; font-size: 12px; border-radius: 6px; border: 1px solid var(--bc); background: transparent; color: var(--bc); opacity: .6; }
.bandchip.on { background: var(--bc); color: #000; opacity: 1; font-weight: 600; }

/* 2.1: radio control */
.radiostrip { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5; background: var(--glass); border: 1px solid var(--stroke); border-radius: 10px; padding: 4px 12px; font-size: 13px; white-space: nowrap; pointer-events: auto; }
.radiostrip .rlabel { color: var(--muted); margin-right: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.radiostrip .rfreq { font: 700 18px/1.1 ui-monospace, Consolas, monospace; color: #3cf0a0; }
.radiostrip .rmode { color: #fff; font-weight: 600; }
.radiostrip .rband { color: var(--muted); }
.radiostrip .rerr { color: var(--warn); }
.tunemenu button b { display: inline-block; min-width: 62px; }
.lotwstatus .dot { background: #5d6778; }
.lotwstatus .dot.ok { background: #3cf0a0; box-shadow: 0 0 6px #3cf0a0; }
.lotwstatus .dot.bad { background: #ff5a5a; }
.rotcard .rval { display: inline-block; min-width: 2em; text-align: right; color: var(--muted); }
/* The info box is always on top of legends, strips and tables (they use z-index 5), below menus, Settings and dialogs (20-30). */
.hover { z-index: 15; }
.hover .box { background: rgba(11,17,25,.92); }

/* 2.1.1: movable panels (Settings › Map › Panels on the map) */
[data-panel].moved { right: auto !important; bottom: auto !important; transform: none !important; }
#legends.moved { width: max-content; max-width: 70%; }
#mapWrap.moving [data-panel]:not([hidden]) { pointer-events: auto !important; cursor: move; outline: 2px dashed #3cf0a0; outline-offset: 2px; border-radius: 8px; z-index: 30; }
#mapWrap.moving [data-panel] * { pointer-events: none !important; }
#mapWrap.moving #legends:empty { min-width: 120px; min-height: 24px; }
[data-panel].dragging { opacity: .85; }

/* 2.2: phone layout (narrow screens, and short touch screens held sideways). Desktop and tablet are unchanged.
   The map fills the screen; space weather and clocks sit in a bottom sheet that opens from a slim handle;
   the info box for a tapped country shows as a card at the bottom; Settings and Help fill the screen. */
.sheethandle, .hoverclose { display: none; }
@media (max-width: 720px), (max-height: 500px) and (pointer: coarse) {
  body { height: 100dvh; }
  .toolbar { flex-wrap: wrap !important; padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); gap: 6px; }
  .toolbar .brand { display: none; }
  .toolbar .home { font-weight: 600; white-space: nowrap; }
  #zoomIn, #zoomOut, #enterKey { display: none; }
  .tools.right { margin-left: auto; flex: 0 0 auto; flex-wrap: nowrap; gap: 6px; }
  #openSettings, #openHelp { width: 40px; height: 40px; padding: 0; font-size: 0; border-radius: 10px; }
  #openSettings::before { content: '⚙'; font-size: 20px; }
  #openHelp::before { content: '?'; font-size: 19px; font-weight: 700; }
  .toolbar .tools:not(.right) { order: 3; flex: 1 0 100% !important; flex-wrap: nowrap !important; overflow-x: auto !important; overflow-y: hidden; scrollbar-width: none; gap: 6px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 36px; }
  .toolbar .tools:not(.right)::-webkit-scrollbar { display: none; }
  .tools button, .tools .sel { min-height: 40px; white-space: nowrap; flex: 0 0 auto; font-size: 13.5px; }
  .tools .tog, .toolbar.tight .tools .tog { padding-left: 24px; padding-right: 10px; }
  .tools .tog::before, .toolbar.tight .tog::before { left: 9px; width: 9px; height: 9px; margin-top: -4.5px; }
  input, select, textarea { font-size: 16px; }
  /* bottom sheet */
  .infobar { display: block; padding: 0 max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left)); max-height: 50dvh; overflow-y: auto; }
  .infobar > .card { display: none; }
  body.sheet-open .infobar > .card:not(.sun) { display: block; margin-bottom: 6px; }
  body.sheet-open .infobar { display: grid; grid-template-columns: 1fr 1fr; gap: 0 6px; align-content: start; }
  body.sheet-open .infobar .sw, body.sheet-open .sheethandle { grid-column: 1 / -1; }
  .sheethandle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; background: none; border: 0; border-radius: 0; padding: 4px 4px; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text); position: sticky; top: 0; background: var(--panel); z-index: 1; }
  .sheethandle .grab { width: 36px; height: 4px; border-radius: 2px; background: #5d6778; flex: 0 0 auto; }
  .sheethandle #sheetSum { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sheethandle .chev { font-size: 14px; color: var(--muted); transition: transform .2s; }
  body.sheet-open .sheethandle .chev { transform: rotate(180deg); }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .clock .time { font-size: 26px; }
  /* the info box: a card at the bottom of the map, with a close button */
  .hover { top: auto !important; left: 6px !important; right: 6px; bottom: 6px; max-height: 55%; overflow-y: auto; pointer-events: auto; max-width: none; flex-wrap: wrap; justify-content: center; -webkit-overflow-scrolling: touch; }
  .hover .box:not(.wheelbox) { max-width: 100%; flex: 1 1 260px; }
  .hover.moved, .legends.moved { left: auto; top: auto; }
  #mapWrap:has(#hover:not([hidden])) .hoverclose { display: grid; }
  .hoverclose { position: absolute; z-index: 16; right: 10px; width: 36px; height: 36px; place-items: center; padding: 0; border-radius: 50%; font-size: 20px; background: #0b1119; bottom: calc(55% - 12px); }
  .zoombadge { top: auto !important; bottom: 8px; left: 8px !important; right: auto; padding: 2px 4px 2px 8px; font-size: 11px; }
  .zoombadge button { min-height: 32px; font-size: 11px; }
  #mapWrap:has(#hover:not([hidden])) .zoombadge { display: none; }
  .badgebox { left: 50% !important; transform: translateX(-50%); top: 6px !important; bottom: auto !important; right: auto; font-size: 11px; max-width: calc(100% - 16px); white-space: nowrap; }
  /* Settings, Help and dialogs fill the screen */
  .drawer { width: 100% !important; border-left: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .drawer-grip, #settingsWide { display: none; }
  .drawer-head [data-close], .modal [data-close] { width: 44px; height: 44px; font-size: 24px; }
  .modal { padding: 0; place-items: stretch; }
  .modal-body { width: 100%; max-height: none; height: 100dvh; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .modal-body.welcome { height: auto; align-self: end; border-radius: 14px 14px 0 0; }
  .tabs button { min-height: 40px; }
}
@media (max-height: 500px) and (pointer: coarse) {
  .infobar { max-height: 60dvh; }
  .hover { max-height: 70%; left: auto !important; width: min(420px, 60%); }
  .hoverclose { bottom: calc(70% - 12px); }
}

/* 2.2: the toolbar's "More ▾" menu for the layer buttons that don't fit on one row */
.morewrap { position: relative; flex: 0 0 auto; }
.morewrap[hidden] { display: none !important; }
.morebtn { white-space: nowrap; font-size: 12.5px; padding: 4px 9px; }
.morebtn.hason { border-color: #3cf0a0; color: #fff; box-shadow: inset 0 0 0 1px rgba(60,240,160,.35); }
.moremenu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; display: flex; flex-direction: column; gap: 4px; padding: 6px;
  background: var(--panel); border: 1px solid var(--stroke); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.45); min-width: 170px; }
.moremenu[hidden] { display: none; }
.moremenu > button, .moremenu > .sel { justify-content: flex-start; text-align: left; white-space: nowrap; }

/* 2.3: Digital: band conditions near you in the map key */
.legend .digtab { border-collapse: collapse; margin-top: 4px; font-variant-numeric: tabular-nums; }
.legend .digtab th { font-weight: 600; color: var(--muted); text-align: left; padding: 0 6px 1px 0; }
.legend .digtab td { padding: 0 6px 0 0; white-space: nowrap; }
.legend .digtab td.need { color: #FFC233; }
