:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #070b12; }
body { display: flex; justify-content: center; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #8eb4d4;
  outline-offset: 2px;
}

.phone {
  --bg: #0e1420;
  --card: #171e2e;
  --card-2: #1d2638;
  --line: #2c3850;
  --text: #e7eef8;
  --muted: #8e9bb0;
  --green: #1f9d62;
  --green-2: #176e45;
  --mint: #3ddc84;
  --blue: #7ea4c6;
  --blue-2: #9ec0dc;
  --accent: #4c91f6;
  --danger: #e36a78;
  --chip: #243044;
  --nav: #101726ee;
  --shadow: 0 12px 40px rgba(0, 0, 0, .28);
  width: min(440px, 100%);
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  position: relative;
  display: flex;
  flex-direction: column;
}
.phone.light {
  --bg: #f3f5fb;
  --card: #ffffff;
  --card-2: #f8f9fd;
  --line: #dbe2ee;
  --text: #162033;
  --muted: #5d6b82;
  --chip: #e7eef8;
  --nav: #ffffffee;
  --shadow: 0 10px 28px rgba(22, 32, 51, .08);
  color-scheme: light;
}
.phone.hard {
  --text: #ffffff;
  --muted: #d5deea;
  --line: rgba(255, 255, 255, .45);
}
.phone.light.hard {
  --text: #000000;
  --muted: #243044;
  --line: rgba(0, 0, 0, .45);
}

main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  overscroll-behavior: contain;
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.top h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.top p, .hint, .help { color: var(--muted); font-size: 13px; line-height: 1.4; margin: 4px 0 0; }
.spacer { flex: 1; }
.local-line { color: var(--muted); font-size: 12px; margin: -6px 2px 12px; }

.iconbtn, .back, .power {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; color: var(--text);
}
.power.on { color: #ff8d8d; border-color: #e36a7888; }
.back { width: 38px; height: 38px; }

.card {
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.rx {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  min-height: 92px;
}
.rx.live { background: linear-gradient(180deg, #2caf73, #1c8a55); color: white; }
.rx.live .hint, .rx.live .help { color: rgba(255,255,255,.85); }
.rx .who { font-size: 18px; font-weight: 700; margin-top: 2px; }
.rx .dur { font-variant-numeric: tabular-nums; font-weight: 650; align-self: end; }
.speaker {
  width: 38px; height: 38px; border-radius: 12px; border: 0;
  background: rgba(255,255,255,.16); color: inherit;
}

.section-label {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px; letter-spacing: .08em;
  font-weight: 700; margin: 2px 2px 8px;
}
.section-label .tools { margin-inline-start: auto; display: flex; gap: 6px; }
.mini {
  width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text);
}

.log {
  max-height: 250px; overflow: auto; padding: 0;
}
.phone.no-ptt .log { max-height: 460px; }
.log-head, .log-row {
  display: grid; gap: 8px; align-items: center;
  padding: 7px 12px; font-size: 13px;
}
.log-head { color: var(--muted); font-size: 11px; letter-spacing: .06em; font-weight: 700; }
.log-row { border-top: 1px solid var(--line); }
.log-row b { font-weight: 650; }
.station-call { display: inline-flex; align-items: baseline; gap: .35em; max-width: 100%; }
.station-call bdi { min-width: 0; overflow-wrap: anywhere; }
.station-flag { flex: none; align-self: center; object-fit: contain; }
.log-row .other { color: var(--mint); }
.log-row .mine { color: var(--blue-2); }
.log-row .dur { color: var(--mint); font-variant-numeric: tabular-nums; text-align: end; }
.empty { padding: 18px 12px; color: var(--muted); }

.target-row { display: flex; gap: 10px; align-items: stretch; }
.round {
  width: 64px; border-radius: 18px; border: 1px solid var(--line);
  background: #24344d; color: #d5e4f5;
}
.phone.light .round { background: #e7eef8; color: #1d4f91; }
.chip {
  flex: 1; text-align: start; border-radius: 18px; border: 1px solid var(--line);
  background: var(--card); padding: 10px 14px; display: flex; align-items: center; gap: 10px;
}
.chip small { display: block; color: var(--muted); }
.chip strong { display: block; font-size: 15px; }
.chip .chev { margin-inline-start: auto; color: var(--muted); }
[dir="rtl"] :is(.chev, .back) { scale: -1 1; }

.meter { display: flex; gap: 3px; height: 14px; margin: 4px 2px 12px; align-items: end; }
.meter span {
  flex: 1; height: 8px; border-radius: 99px; background: #2a3548;
}
.meter span.on { background: var(--mint); height: 12px; }
.meter.tx span.on { background: #f0c14a; }

.ptt {
  width: 100%; min-height: 168px; border-radius: 26px; border: 1px solid #9db9d166;
  background: linear-gradient(180deg, #9ebbd4, #6f97b8);
  color: #102033; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; touch-action: none; user-select: none;
}
.ptt b { font-size: 28px; letter-spacing: .04em; }
.ptt span { font-size: 14px; opacity: .8; }
.ptt.busy, .ptt.off {
  background: var(--card); color: var(--muted); border-color: var(--line);
}
.ptt.tx {
  background: linear-gradient(180deg, #f2c56a, #e0a33a);
  border-color: #f2c56a;
}

.radio-home { display: grid; gap: 12px; }
.radio-top { margin: 2px 0 0; }
.radio-brand { min-width: 0; }
.radio-brand h1 { font-size: clamp(20px, 5.4vw, 25px); overflow-wrap: anywhere; }
.radio-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.radio-state::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; }
.radio-state.online::before { color: var(--green); }
.radio-console {
  display: grid; gap: 9px; min-width: 0; padding: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
}
.radio-console .rx { margin: 0; padding: 10px; min-height: 0; border-radius: 14px; box-shadow: none; }
.radio-console .rx:not(.live) { background: var(--card-2); }
.radio-console .rx.live { background: #126644; }
.radio-console .rx .who { overflow-wrap: anywhere; }
.radio-console .chip { background: var(--card-2); min-width: 0; border-radius: 14px; }
.radio-console .chip strong { overflow-wrap: anywhere; }
.radio-console .meter { margin: 0 3px 1px; height: 12px; }
.radio-console .ptt { min-height: 112px; border-radius: 16px; }
.radio-console .ptt:not(.off):not(.busy):not(.tx) { background: #9cbce0; }
.radio-tools { display: grid; gap: 8px; }
.radio-tools > .row { flex-wrap: wrap; }
.radio-tools > .row > button { flex: 1 1 105px; min-width: 0; }
.scan-status { margin: 0; color: var(--muted); font-size: 13px; }
.radio-home .section-label, .radio-home .log { margin: 0; }
.radio-home .log { max-height: 190px; }
.log-switch { gap: 8px; }
.log-switch button { min-height: 44px; }
.logbook, .qso-list li { display: grid; gap: 8px; overflow-wrap: anywhere; }
.logbook p { margin: 0; }
.logbook .wide { min-height: 44px; }
.qso-list { display: grid; gap: 12px; margin: 0; padding: 0; max-height: 250px; overflow-y: auto; list-style: none; }
.qso-list li { border-top: 1px solid var(--line); padding-block: 10px 2px; }
.qso-actions { flex-wrap: wrap; }
.profile-flow { display: grid; gap: 14px; }
.profile-flow .top { margin: 0; }
.profile-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0; margin: 0; list-style: none; }
.profile-steps li {
  display: grid; align-content: start; gap: 6px; min-width: 0; padding: 9px 6px;
  border-bottom: 2px solid var(--line); color: var(--muted); font-size: 12px; overflow-wrap: anywhere;
}
.profile-steps li > span {
  display: grid; place-items: center; width: 24px; height: 24px;
  background: var(--chip); color: var(--text); border-radius: 50%; font-weight: 700;
}
.profile-steps li[aria-current="step"] { color: var(--text); border-color: var(--accent); }
.profile-steps li[aria-current="step"] > span { background: #215fbb; color: #fff; }
.profile-panel { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.profile-panel h2 { margin: 0 0 10px; font-size: 19px; }
.profile-server { min-height: 64px; margin: 0; background: var(--card-2); }
.profile-server .copy { min-width: 0; overflow-wrap: anywhere; }
.profile-panel .field { margin: 14px 0; }
.profile-panel .field input { min-height: 44px; min-width: 0; padding-inline: 8px; background: var(--card-2); border-radius: 7px; }
.profile-panel .eye, .profile-advanced > summary { min-height: 44px; }
.profile-advanced > summary { display: list-item; padding-block: 12px; cursor: pointer; }
.profile-select { display: grid; gap: 4px; margin: 12px 0; color: var(--muted); }
.profile-select select { min-height: 44px; max-width: 100%; padding: 7px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--card-2); font: inherit; }
.profile-actions .wide, .catalog-more { min-height: 44px; }
.catalog-more { margin-block: 8px; }
.node-directory { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); }
.srv-row .grow { min-width: 0; overflow-wrap: anywhere; }
.srv-row { min-height: 44px; }
.profile-actions .primary, .radio-connect.primary { background: #215fbb; color: #fff; }

.nav {
  flex: none;
  margin: 0 10px calc(10px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--nav); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 22px; padding: 6px;
}
.nav button {
  min-height: 44px;
  border: 0; background: transparent; color: var(--muted);
  border-radius: 16px; padding: 8px 4px 6px; display: grid; justify-items: center; gap: 2px;
  font-size: 11px;
}
.nav button.active { background: #24344d; color: #d7e8f8; }
.phone.light .nav button.active { background: #e7eef8; color: #184e93; }

.list-btn, .add, .wide, .choice, .seg button {
  width: 100%; border-radius: 16px; border: 1px solid var(--line);
  background: var(--card); padding: 12px 14px; text-align: start;
  display: flex; gap: 12px; align-items: center;
}
.add { justify-content: center; color: var(--accent); font-weight: 650; margin-bottom: 12px; }
.wide { justify-content: center; font-weight: 650; }
.wide.connect { color: var(--accent); }
.wide.disconnect { color: var(--danger); border-color: #e36a7855; }
.wide.danger { background: var(--danger); color: white; border: 0; }
.wide.primary { background: var(--accent); color: white; border: 0; }
.wide:disabled, .ptt:disabled { opacity: .45; cursor: default; }

.profile { padding: 14px; }
.profile .row { display: flex; gap: 10px; align-items: center; }
.badge {
  font-size: 11px; font-weight: 750; letter-spacing: .04em;
  background: #1f9d62; color: white; border-radius: 99px; padding: 2px 7px;
}
.net {
  font-size: 11px; font-weight: 700; border-radius: 99px; padding: 2px 8px;
  background: #3a2a18; color: #f0b56a;
}
.net.tgif { background: #16324d; color: #8ec8f8; }
.net.ipsc { background: #2d2348; color: #c7b6f5; }
.meta { color: var(--muted); font-size: 13px; margin: 8px 0 12px; display: flex; gap: 12px; }

.setting { margin-bottom: 10px; }
.setting .copy { flex: 1; }
.setting b { display: block; }
.mark {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
}
.mark.blue { background: #24344d; color: #9ec0dc; }
.mark.green { background: #173628; color: #3ddc84; }
.mark.orange { background: #3a2a18; color: #f0b56a; }
.mark.pink { background: #3a2430; color: #f0a0c0; }
.mark.violet { background: #2a2448; color: #c7b6f5; }
.phone.light .mark.blue { background: #e7eef8; color: #1d4f91; }
.phone.light .mark.green { background: #e5f6ee; color: #0e7a45; }
.phone.light .mark.orange { background: #fff1df; color: #9a5b10; }
.phone.light .mark.pink { background: #fde8f0; color: #a33b62; }
.phone.light .mark.violet { background: #eee9fb; color: #5b3ea8; }

.switch {
  width: 48px; height: 28px; border-radius: 99px; border: 0; background: #303a4e;
  position: relative; flex: none; padding: 0;
}
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: white; transition: left .15s ease;
}
.switch.on { background: #4c91f6; }
.switch.on .knob { left: 23px; }

.field { margin: 12px 0; }
.field label, .kicker {
  display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px;
}
.field input, .field textarea, .search {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line);
  padding: 8px 0; border-radius: 0;
}
.connection-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.connection-chip {
  min-height: 44px; max-width: 100%; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--chip); color: var(--text); font-size: 13px; font-weight: 600;
}
.connection-chip[aria-pressed="true"] {
  border-color: #4c91f6; background: #215fbb; color: #fff;
}
.connection-chip:focus-visible { outline: 2px solid #4c91f6; outline-offset: 2px; }
.pair { display: grid; grid-template-columns: 1fr 90px; gap: 12px; }
.eye { border: 0; background: transparent; color: var(--muted); }

.slider { width: 100%; accent-color: #4c91f6; }
.slider:disabled { opacity: .4; }
.dim { opacity: .45; }

.seg { display: flex; gap: 8px; }
.seg button { justify-content: center; }
.seg button.on, .choice.on { background: #4c91f6; color: white; border-color: transparent; }
.icons { display: flex; gap: 8px; flex-wrap: wrap; }
.icons button, .ssid button, .mins button {
  border-radius: 14px; border: 1px solid var(--line); background: var(--chip);
  min-width: 52px; padding: 8px 10px;
}
.icons button.on, .ssid button.on, .mins button.on { background: #4c91f6; color: white; border-color: transparent; }
.ssid, .mins { display: flex; gap: 8px; flex-wrap: wrap; }

.overlay {
  position: absolute; inset: 0; background: rgba(5, 8, 14, .55);
  display: grid; place-items: center; padding: 18px; z-index: 5;
}
.sheet {
  width: min(100%, 380px); background: var(--card-2); color: var(--text);
  border-radius: 20px; padding: 16px; border: 1px solid var(--line); max-height: 80dvh; overflow: auto;
}
.sheet h2 { margin: 0 0 8px; font-size: 20px; }
.sheet .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.linkish { border: 0; background: transparent; color: #8eb4d4; font-weight: 700; }

.toast {
  position: absolute; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 6;
  background: #101722; color: white; border-radius: 14px; padding: 12px 14px;
  border: 1px solid #2c3850;
}
.check { margin-inline-start: auto; color: var(--mint); }
.star { flex: none; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 22px; }
.star.on { color: #c18400; }
.tg-row > .srv-row { min-height: 44px; border: 0; padding-block: 4px; }
.tg-row { padding-block: 0; }
.tg-row, .srv-row {
  width: 100%; display: flex; gap: 8px; align-items: center;
  background: transparent; border: 0; border-top: 1px solid var(--line);
  padding: 10px 2px; text-align: start;
}
.grow { flex: 1; }
.syslog { max-height: 220px; overflow: auto; }
.syslog .log-row { grid-template-columns: 78px 1fr; }
.search { margin-bottom: 12px; }
.banner-ok { background: #173628; color: #b7f0d2; border-radius: 16px; padding: 12px 14px; display: flex; gap: 8px; align-items: center; }
.file input { display: none; }
.file { justify-content: center; }
svg { display: block; }

.car-mode .ptt { min-height: 38vh; margin-block: 1rem; }
.car-mode .wide { min-height: 3rem; margin-bottom: .5rem; }
.car-mode.dim { opacity: .55; }
.aprs-map { padding: 10px; }
.aprs-map-surface { position: relative; width: 100%; max-width: 512px; height: min(384px, 52vh); min-height: 230px; overflow: hidden; margin-inline: auto; border-radius: 12px; background: var(--card-2); }
.aprs-map-tile { position: absolute; max-width: none; user-select: none; }
.aprs-map-marker { position: absolute; transform: translate(-50%, -50%); padding: 3px 5px; border-radius: 5px; background: #14354c; color: white; font-size: 11px; text-decoration: none; white-space: nowrap; }
.aprs-map-home { background: #0e6946; }
.aprs-map-controls { position: absolute; inset: 6px 6px auto; display: flex; justify-content: center; gap: 4px; }
.aprs-map-controls button { width: 30px; height: 30px; padding: 0; border: 1px solid #bac9d2; border-radius: 5px; background: #fff; color: #132736; }
.aprs-map-credit { position: absolute; right: 0; bottom: 0; padding: 2px 4px; color: #132736; background: #fff; font-size: 10px; }
.aprs-stations { list-style: none; margin: 0; padding: 0; }
.aprs-stations li { display: flex; justify-content: space-between; padding: 5px 0; }
.hoseline-player { display: block; width: 100%; height: min(68vh, 650px); border: 0; border-radius: 12px; background: var(--card); }
.hoseline-add { margin-bottom: 10px; }
.hoseline-add input { min-width: 0; flex: 1; }
.dtmf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding-top: 6px; }

.results { display: contents; }
