/* =========================================================
   ANTENNA LAB — visual system
   ========================================================= */
:root {
  --bg: #080d14;
  --bg-elev: #0d1520;
  --panel: rgba(15, 24, 36, .88);
  --panel-solid: #101a27;
  --panel-2: rgba(22, 33, 48, .72);
  --panel-3: #182538;
  --line: rgba(148, 178, 211, .13);
  --line-strong: rgba(148, 178, 211, .26);
  --text: #e9eff7;
  --text-soft: #c3d0de;
  --muted: #8ca0b6;
  --faint: #5c7188;
  --accent: #f0b45f;
  --accent-bright: #ffd08a;
  --accent-dim: rgba(240, 180, 95, .14);
  --cyan: #5ce0c3;
  --cyan-dim: rgba(92, 224, 195, .12);
  --danger: #ff7c7c;
  --danger-dim: rgba(255, 124, 124, .12);
  --blue: #72a9ff;
  --grid: rgba(110, 150, 190, .075);
  --shadow: 0 30px 80px rgba(0, 0, 0, .45);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, .24);
  --radius: 16px;
  --radius-sm: 10px;
  --font-body: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-display: "Bahnschrift", "DIN Alternate", "Segoe UI Variable", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Code", "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f2efe7;
  --bg-elev: #faf8f2;
  --panel: rgba(255, 253, 247, .9);
  --panel-solid: #fffdf7;
  --panel-2: rgba(244, 240, 230, .8);
  --panel-3: #eee8dc;
  --line: rgba(41, 55, 72, .13);
  --line-strong: rgba(41, 55, 72, .26);
  --text: #16212d;
  --text-soft: #2e3d4e;
  --muted: #5f7082;
  --faint: #8997a5;
  --accent: #a55f0a;
  --accent-bright: #c97810;
  --accent-dim: rgba(165, 95, 10, .1);
  --cyan: #087e6c;
  --cyan-dim: rgba(8, 126, 108, .1);
  --danger: #c23a3a;
  --danger-dim: rgba(194, 58, 58, .1);
  --blue: #2c63b8;
  --grid: rgba(40, 70, 100, .07);
  --shadow: 0 30px 70px rgba(62, 48, 26, .14);
  --shadow-soft: 0 12px 30px rgba(62, 48, 26, .1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(1100px 700px at 75% -10%, rgba(46, 92, 140, .17), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(240, 180, 95, .07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 78%);
}
::selection { background: var(--accent); color: #1b1206; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
strong { font-weight: 650; }

.app-glow {
  position: fixed;
  z-index: -1;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .5;
  pointer-events: none;
}
.app-glow-a { top: -240px; right: -120px; background: rgba(44, 104, 160, .22); }
.app-glow-b { bottom: -300px; left: 18%; background: rgba(240, 180, 95, .1); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 18px 30px 14px;
  background: linear-gradient(to bottom, rgba(8, 13, 20, .94), rgba(8, 13, 20, .72) 70%, transparent);
  backdrop-filter: blur(18px);
}
html[data-theme="light"] .topbar {
  background: linear-gradient(to bottom, rgba(242, 239, 231, .95), rgba(242, 239, 231, .74) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  color: var(--accent);
  background:
    radial-gradient(circle at 50% 0%, var(--accent-dim), transparent 70%),
    var(--panel-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), var(--shadow-soft);
  flex: 0 0 auto;
}
.brand-mark svg { width: 32px; height: 32px; }
.brand-text h1 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1;
  color: var(--text);
}
.brand-text h1 span { color: var(--accent); margin-left: 3px; }
.brand-text p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .16em;
  white-space: nowrap;
}
.topbar-meta { display: flex; align-items: center; gap: 12px; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  background: var(--panel-2);
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(92, 224, 195, .55);
  animation: livePulse 2.2s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(92, 224, 195, .5); }
  65% { box-shadow: 0 0 0 7px rgba(92, 224, 195, 0); }
  100% { box-shadow: 0 0 0 0 rgba(92, 224, 195, 0); }
}
.header-freq {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 14px 5px 16px;
  border-left: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  font-family: var(--font-mono);
}
.header-freq span { font-size: 19px; font-weight: 600; letter-spacing: .03em; color: var(--accent-bright); }
.header-freq small { color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.header-freq em {
  font-style: normal;
  margin-left: 5px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: .06em;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--panel-2);
  transition: .2s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--panel-3); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-btn .ico-sun { display: none; }
html[data-theme="light"] .theme-btn .ico-sun { display: block; }
html[data-theme="light"] .theme-btn .ico-moon { display: none; }

/* ---------- layout ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 10px 30px 40px;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 2px 4px 20px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
.workspace { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

.side-section {
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}
.side-section[hidden] { display: none; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.section-head h2 { font-size: 14px; font-weight: 650; letter-spacing: .04em; margin-top: 4px; }
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--accent);
  text-transform: uppercase;
  white-space: nowrap;
}
.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 0;
  transition: color .2s;
}
.text-btn:hover { color: var(--accent); }

/* antenna grid */
.antenna-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.antenna-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 88px;
  padding: 11px 10px 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text-soft);
  background: rgba(255,255,255,.018);
  transition: border-color .18s, background .18s, transform .18s;
  overflow: hidden;
}
.antenna-card::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .18s;
}
.antenna-card:hover { transform: translateY(-1px); border-color: var(--line-strong); background: var(--panel-3); }
.antenna-card.active {
  border-color: rgba(240, 180, 95, .48);
  background: linear-gradient(145deg, var(--accent-dim), rgba(255,255,255,.02));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(240, 180, 95, .08);
}
.antenna-card.active::after { opacity: 1; }
.antenna-card svg { width: 32px; height: 25px; color: currentColor; opacity: .9; }
.antenna-card.active svg { color: var(--accent-bright); }
.antenna-card b { display: block; font-size: 12px; font-weight: 620; letter-spacing: .01em; line-height: 1.25; }
.antenna-card small { display: block; margin-top: 1px; font-family: var(--font-mono); font-size: 8px; color: var(--faint); letter-spacing: .06em; }
.antenna-card.active small { color: var(--accent); }
.antenna-grid .antenna-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  min-height: 66px;
}
.antenna-grid .antenna-card:last-child:nth-child(odd) svg { width: 36px; flex: 0 0 auto; }

/* frequency */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0,0,0,.14);
}
html[data-theme="light"] .segmented { background: rgba(0,0,0,.04); }
.segmented button {
  border: 0;
  border-radius: 6px;
  padding: 6px 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  transition: .18s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--panel-3); color: var(--accent-bright); box-shadow: 0 1px 4px rgba(0,0,0,.2); }

.band-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
.band-chip {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 4px 5px;
  text-align: center;
  background: transparent;
  color: var(--text-soft);
  transition: .16s;
  line-height: 1.1;
}
.band-chip b { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.band-chip small { display: block; margin-top: 3px; font-size: 8px; color: var(--faint); white-space: nowrap; }
.band-chip:hover { border-color: var(--line-strong); background: var(--panel-3); }
.band-chip.active { border-color: rgba(240,180,95,.5); background: var(--accent-dim); color: var(--accent-bright); }
.band-chip.active small { color: var(--accent); }

.custom-freq { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.custom-freq > label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.custom-freq-row { display: flex; gap: 6px; }
.input-with-unit {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,.13);
  overflow: hidden;
}
html[data-theme="light"] .input-with-unit { background: rgba(0,0,0,.035); }
.input-with-unit:focus-within { border-color: var(--accent); }
.input-with-unit input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 7px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.input-with-unit input::-webkit-outer-spin-button,
.input-with-unit input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-with-unit input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.input-with-unit span { padding-right: 8px; color: var(--faint); font-family: var(--font-mono); font-size: 9px; }
.wave-readout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}
.wave-readout div { min-width: 0; }
.wave-readout span { display: block; color: var(--faint); font-size: 8px; letter-spacing: .05em; white-space: nowrap; }
.wave-readout strong { display: block; margin-top: 2px; color: var(--text-soft); font-family: var(--font-mono); font-size: 10px; font-weight: 500; white-space: nowrap; }

/* params */
.param-controls { display: flex; flex-direction: column; gap: 13px; }
.param { display: block; }
.param-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.param-head label { color: var(--text-soft); font-size: 11px; }
.param-head output {
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}
.param-head output small { color: var(--faint); font-size: 9px; margin-left: 2px; }
.param input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) 0 var(--fill, 50%), var(--line-strong) var(--fill, 50%) 100%);
  outline: none;
}
.param input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--accent-bright);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 7px rgba(0,0,0,.35);
  cursor: ew-resize;
}
.param input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border: 2px solid var(--bg); border-radius: 50%;
  background: var(--accent-bright); box-shadow: 0 0 0 1px var(--accent);
  cursor: ew-resize;
}
.param-hint { margin-top: 4px; color: var(--faint); font-size: 9px; line-height: 1.4; }
.param-select, .param-number {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,.13);
  color: var(--text);
  padding: 7px 8px;
  font-size: 11px;
}
html[data-theme="light"] .param-select, html[data-theme="light"] .param-number { background: rgba(0,0,0,.035); }
.param-select:focus, .param-number:focus { border-color: var(--accent); outline: none; }
.param-row { display: flex; gap: 6px; }
.param-row .param { flex: 1; }
.param-check { display: flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 11px; cursor: pointer; }
.param-check input { accent-color: var(--accent); }
.param-divider { height: 1px; background: var(--line); margin: 2px 0; }

.side-note {
  display: flex;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--faint);
  background: var(--panel-2);
  font-size: 10px;
  line-height: 1.55;
}
.side-note svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--cyan); margin-top: 1px; }

/* ---------- hero / preview ---------- */
.hero-panel {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(700px 300px at 80% 0%, rgba(72, 128, 180, .13), transparent 65%),
    linear-gradient(160deg, var(--panel-2), var(--panel) 55%, rgba(10,16,24,.9));
  box-shadow: var(--shadow);
  overflow: hidden;
}
html[data-theme="light"] .hero-panel {
  background:
    radial-gradient(700px 300px at 80% 0%, rgba(97, 154, 203, .12), transparent 65%),
    linear-gradient(160deg, var(--panel-2), var(--panel) 55%, rgba(255,253,247,.96));
}
.hero-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 22px; right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240,180,95,.5), transparent);
}
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.hero-title-wrap h2 { margin-top: 6px; font-family: var(--font-display); font-size: clamp(24px, 2.5vw, 34px); font-weight: 650; letter-spacing: .02em; line-height: 1.1; }
.hero-title-wrap p { margin-top: 7px; color: var(--muted); font-size: 12px; }
.hero-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.view-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,.14);
}
html[data-theme="light"] .view-toggle { background: rgba(0,0,0,.04); }
.view-toggle button {
  border: 0;
  border-radius: 5px;
  padding: 5px 9px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  transition: .18s;
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button.active { background: var(--panel-3); color: var(--accent-bright); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 13px;
  background: var(--panel-3);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
  transition: .18s;
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  border-color: rgba(240,180,95,.5);
  background: linear-gradient(180deg, rgba(240,180,95,.22), rgba(240,180,95,.12));
  color: var(--accent-bright);
}
.btn-primary:hover { background: linear-gradient(180deg, rgba(240,180,95,.3), rgba(240,180,95,.17)); }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 10px; font-size: 10px; }
.btn-small svg { width: 13px; height: 13px; }

.stage-wrap { position: relative; border-radius: 14px; overflow: hidden; }
.preview-stage {
  position: relative;
  height: clamp(380px, 46vh, 560px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(88, 139, 185, .14), transparent 62%),
    linear-gradient(180deg, rgba(6,11,17,.72), rgba(9,16,25,.35));
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
html[data-theme="light"] .preview-stage {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(111, 161, 200, .16), transparent 62%),
    linear-gradient(180deg, rgba(238, 243, 247, .7), rgba(246, 243, 235, .35));
}
.preview-stage.dragging { cursor: grabbing; }
.stage-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120,160,200,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,160,200,.055) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse at 50% 45%, black 20%, transparent 78%);
}
.stage-hint {
  position: absolute;
  left: 14px;
  bottom: 13px;
  z-index: 3;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .08em;
  pointer-events: none;
}
.stage-badge {
  position: absolute;
  top: 13px;
  left: 14px;
  z-index: 3;
  padding: 4px 7px;
  border: 1px solid rgba(92,224,195,.24);
  border-radius: 4px;
  color: var(--cyan);
  background: var(--cyan-dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .16em;
  pointer-events: none;
}
.stage-footer {
  position: absolute;
  right: 14px;
  bottom: 12px;
  left: 210px;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .05em;
  pointer-events: none;
}
#previewSvg { position: relative; z-index: 2; width: 100%; height: 100%; }

/* stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.stat-card {
  position: relative;
  min-width: 0;
  padding: 11px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.022);
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.stat-label { display: flex; align-items: center; gap: 5px; color: var(--faint); font-size: 9px; letter-spacing: .06em; white-space: nowrap; }
.stat-label svg { width: 11px; height: 11px; opacity: .8; }
.stat-value { margin-top: 5px; color: var(--text); font-family: var(--font-mono); font-size: 19px; font-weight: 600; line-height: 1.05; letter-spacing: -.02em; white-space: nowrap; }
.stat-value small { margin-left: 3px; color: var(--muted); font-size: 9px; font-weight: 400; letter-spacing: 0; }
.stat-sub { margin-top: 3px; color: var(--faint); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card.accent .stat-value { color: var(--accent-bright); }
.stat-card.cyan .stat-value { color: var(--cyan); }

.warning-bar {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 10px 13px;
  border: 1px solid rgba(255,124,124,.28);
  border-radius: 9px;
  background: var(--danger-dim);
  color: #ffb0b0;
  font-size: 11px;
  line-height: 1.55;
}
html[data-theme="light"] .warning-bar { color: #9c2727; }
.warning-bar svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.warning-bar.hidden { display: none; }
.warning-bar ul { margin: 0; padding-left: 16px; }
.warning-bar li + li { margin-top: 3px; }

/* ---------- analysis ---------- */
.analysis-grid { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.25fr); gap: 18px; }
.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow-soft);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.pattern-focus {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0,0,0,.12);
}
html[data-theme="light"] .pattern-focus { background: rgba(0,0,0,.035); }
.pattern-focus.hidden { display: none; }
.pattern-focus button {
  border: 0;
  border-radius: 4px;
  padding: 4px 7px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .04em;
  transition: .15s;
}
.pattern-focus button:hover { color: var(--text); }
.pattern-focus button.active { background: var(--panel-3); color: var(--accent-bright); }
.panel-head h3 { margin-top: 3px; font-size: 15px; font-weight: 650; letter-spacing: .02em; }
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .1em;
  white-space: nowrap;
}
.tag-cyan { border-color: rgba(92,224,195,.28); color: var(--cyan); background: var(--cyan-dim); }
.pattern-chart { min-height: 250px; display: grid; place-items: center; }
.pattern-chart svg { width: 100%; max-width: 330px; height: auto; }
.pattern-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--faint); font-family: var(--font-mono); font-size: 9px; }
.overview-list { display: flex; flex-direction: column; }
.overview-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.overview-row:first-child { padding-top: 2px; }
.overview-row:last-child { border-bottom: 0; }
.overview-row span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.overview-row strong { color: var(--text); font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-align: right; }
.design-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--accent-dim);
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.6;
}

/* ---------- tabs ---------- */
.tabs-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.tabs {
  display: flex;
  gap: 2px;
  padding: 6px 10px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative;
  border: 0;
  border-radius: 7px 7px 0 0;
  padding: 10px 14px 11px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  transition: .18s;
}
.tabs button:hover { color: var(--text); background: rgba(255,255,255,.025); }
.tabs button.active { color: var(--accent-bright); background: rgba(240,180,95,.06); }
.tabs button.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}
.tab-body { padding: 18px; }
.tab-pane { display: none; animation: fadeUp .28s ease both; }
.tab-pane.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.pane-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.pane-head h3 { font-size: 15px; font-weight: 650; }
.pane-head p { margin-top: 4px; color: var(--muted); font-size: 10px; }
.pane-actions { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.pane-note { margin-top: 12px; color: var(--faint); font-size: 10px; line-height: 1.6; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.data-table th {
  padding: 9px 12px;
  text-align: left;
  background: rgba(0,0,0,.16);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: .1em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
html[data-theme="light"] .data-table th { background: rgba(0,0,0,.04); }
.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--text-soft); font-size: 11px; vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: rgba(240,180,95,.035); }
.data-table .mono { font-family: var(--font-mono); font-size: 10px; color: var(--text); white-space: nowrap; }
.data-table .dim { color: var(--faint); font-size: 9px; }
.data-table .em { color: var(--accent-bright); }
.data-table .num { text-align: right; font-family: var(--font-mono); }
.data-table .center { text-align: center; }
.data-table .part-name { min-width: 110px; font-weight: 550; color: var(--text); }
.data-table tr.total-row td { background: rgba(92,224,195,.045); border-top: 1px solid rgba(92,224,195,.2); }
.data-table tr.total-row .mono { color: var(--cyan); }

/* drawing */
.drawing-sheet {
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(45deg, rgba(0,0,0,.02) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.02) 75%),
    linear-gradient(45deg, rgba(0,0,0,.02) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.02) 75%),
    #e9ebe6;
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  overflow: auto;
}
.drawing-sheet svg {
  width: 100%;
  max-width: 1120px;
  height: auto;
  background: #fff;
  box-shadow: 0 12px 34px rgba(0,0,0,.25);
}
.drawing-sheet .empty { color: #556; font-size: 12px; }

/* build */
.build-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 20px; }
.build-steps { display: flex; flex-direction: column; gap: 0; }
.build-step { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; }
.build-step:last-child { padding-bottom: 0; }
.build-step::before {
  content: "";
  position: absolute;
  left: 14px; top: 27px; bottom: -1px;
  width: 1px;
  background: var(--line);
}
.build-step:last-child::before { display: none; }
.step-num {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel-3);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
}
.build-step h4 { margin: 4px 0 4px; font-size: 12px; font-weight: 650; }
.build-step p { color: var(--muted); font-size: 11px; line-height: 1.65; }
.build-step p strong { color: var(--text-soft); }
.build-aside { display: flex; flex-direction: column; gap: 10px; }
.aside-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.022); }
.aside-card h4 { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; font-size: 10px; color: var(--accent); letter-spacing: .06em; }
.aside-card h4 svg { width: 13px; height: 13px; }
.aside-card ul { margin: 0; padding-left: 14px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.aside-card li + li { margin-top: 4px; }
.aside-card p { color: var(--muted); font-size: 10px; line-height: 1.65; }
.aside-card.danger { border-color: rgba(255,124,124,.22); background: var(--danger-dim); }
.aside-card.danger h4 { color: var(--danger); }
.aside-card.danger p { color: var(--danger); opacity: .9; }

/* calculator */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.calc-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.022);
}
.calc-card-wide { grid-column: 1 / -1; }
.calc-card-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.calc-index {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border: 1px solid rgba(240,180,95,.35);
  border-radius: 6px;
  color: var(--accent);
  background: var(--accent-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  flex: 0 0 auto;
}
.calc-card-head h4 { font-size: 12px; font-weight: 650; }
.calc-card-head p { margin-top: 2px; color: var(--faint); font-size: 9px; }
.calc-fields { display: flex; flex-direction: column; gap: 8px; margin-bottom: 11px; }
.calc-fields-inline { flex-direction: row; flex-wrap: wrap; }
.calc-fields label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 10px; }
.calc-fields label .unit { color: var(--faint); font-family: var(--font-mono); font-size: 8px; }
.calc-fields input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 8px;
  background: rgba(0,0,0,.14);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
}
html[data-theme="light"] .calc-fields input { background: rgba(0,0,0,.035); }
.calc-fields input:focus { border-color: var(--accent); outline: none; }
.calc-fields-inline label { flex: 1; min-width: 120px; }
.calc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.calc-result { margin-top: 10px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.calc-result:empty { display: none; }
.calc-result .result-big { color: var(--accent-bright); font-family: var(--font-mono); font-size: 17px; font-weight: 600; }
.calc-result table { width: 100%; border-collapse: collapse; margin-top: 7px; }
.calc-result th, .calc-result td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; font-size: 9px; }
.calc-result th { color: var(--faint); font-weight: 500; }
.calc-result td { font-family: var(--font-mono); color: var(--text-soft); }
.calc-result .good { color: var(--cyan); }
.calc-result .warn { color: var(--danger); }
.wave-table { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.wave-cell { padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: rgba(0,0,0,.1); }
html[data-theme="light"] .wave-cell { background: rgba(0,0,0,.025); }
.wave-cell span { display: block; color: var(--faint); font-size: 8px; }
.wave-cell strong { display: block; margin-top: 3px; color: var(--text); font-family: var(--font-mono); font-size: 11px; font-weight: 500; white-space: nowrap; }

/* footer */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 4px 20px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.6;
}
.site-footer strong { color: var(--muted); font-family: var(--font-mono); letter-spacing: .1em; margin-right: 8px; }
.footer-warn { max-width: 520px; text-align: right; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,6,10,.72); backdrop-filter: blur(8px); }
.modal-card {
  position: relative;
  width: min(820px, 100%);
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--panel-solid);
  box-shadow: 0 40px 100px rgba(0,0,0,.55);
  animation: modalIn .22s ease both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-solid);
}
.modal-head h3 { margin-top: 5px; font-size: 20px; }
.modal-body { padding: 20px 22px 24px; }
.modal-lead { color: var(--muted); font-size: 12px; line-height: 1.7; }
.modal-lead strong { color: var(--text-soft); }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.method-grid > div { padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.02); }
.method-grid h4 { margin-bottom: 5px; color: var(--accent); font-size: 11px; }
.method-grid p { color: var(--muted); font-size: 10px; line-height: 1.65; }
.modal-callout { margin-top: 16px; padding: 13px 15px; border: 1px solid rgba(92,224,195,.22); border-radius: 9px; background: var(--cyan-dim); }
.modal-callout strong { color: var(--cyan); font-size: 11px; }
.modal-callout p { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.modal-callout p strong { color: var(--cyan); }
.modal-callout ul { margin: 6px 0 0; padding-left: 17px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.modal-source { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); color: var(--faint); font-size: 9px; line-height: 1.6; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 120;
  transform: translate(-50%, 20px);
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-solid);
  color: var(--text-soft);
  box-shadow: var(--shadow);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* print */
.print-sheet { display: none; }
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: #fff !important; color: #111 !important; }
  body::before, .app-glow, .topbar, .app-shell, .modal, .toast { display: none !important; }
  .print-sheet { display: block !important; width: 100%; }
  .print-sheet svg { width: 100% !important; height: auto !important; box-shadow: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1320px) {
  .app-shell { grid-template-columns: 288px minmax(0, 1fr); gap: 18px; padding-left: 20px; padding-right: 20px; }
  .stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .topbar { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 260px minmax(0, 1fr); }
  .hero-head { flex-direction: column; }
  .hero-actions { width: 100%; justify-content: space-between; }
  .analysis-grid { grid-template-columns: 1fr; }
  .build-layout { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr; }
  .calc-card-wide { grid-column: auto; }
}
@media (max-width: 860px) {
  .topbar { position: relative; flex-wrap: wrap; padding-top: 14px; }
  .topbar-meta { width: 100%; justify-content: flex-end; }
  .app-shell { display: block; padding: 8px 14px 30px; }
  .sidebar { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .side-section { margin-bottom: 10px; }
  .antenna-grid { grid-template-columns: repeat(4, 1fr); }
  .antenna-card { min-height: 82px; }
  .band-grid { grid-template-columns: repeat(5, 1fr); }
  .preview-stage { height: 420px; }
  .stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-footer { flex-direction: column; }
  .footer-warn { text-align: left; }
  .modal-card { max-height: 88vh; }
  .method-grid { grid-template-columns: 1fr; }
  .wave-table { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .brand-text h1 { font-size: 19px; }
  .brand-text p { font-size: 9px; letter-spacing: .1em; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-mark svg { width: 28px; height: 28px; }
  .live-pill { display: none; }
  .topbar-meta { gap: 8px; }
  .header-freq { border-left: 0; border-right: 0; padding: 4px 6px; }
  .header-freq span { font-size: 16px; }
  .header-freq em { display: none; }
  .icon-btn { width: 34px; height: 34px; }
  .antenna-grid { grid-template-columns: repeat(2, 1fr); }
  .band-grid { grid-template-columns: repeat(4, 1fr); }
  .hero-panel { padding: 15px; border-radius: 15px; }
  .preview-stage { height: 340px; }
  .stage-footer { left: 14px; justify-content: space-between; gap: 8px; }
  .stage-hint { display: none; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 17px; }
  .tabs { padding-left: 4px; }
  .tabs button { padding: 9px 9px 10px; font-size: 10px; }
  .tab-body { padding: 12px; }
  .pane-head { flex-direction: column; }
  .pane-actions { width: 100%; }
  .pane-actions .btn { flex: 1; }
  .calc-fields-inline { flex-direction: column; }
  .wave-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
