* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: #223;
  background: #eef2f6;
  -webkit-tap-highlight-color: transparent;
}

.app {
  height: 100dvh;
  min-height: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------- шапка ---------- */
header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px 0;
}
header h1 { font-size: 18px; color: #14324f; letter-spacing: .4px; }
header .status {
  color: #5b6b7b;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- чипы диапазонов ---------- */
.bands {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.bands::-webkit-scrollbar { display: none; }
.bands button {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid #c4d0db;
  background: #fff;
  color: #334;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.bands button.active { background: #1b6fae; color: #fff; border-color: #1b6fae; }

/* ---------- слайдеры диапазона ---------- */
.ctrl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 2px;
}
.ctrl-row .lbl { font-size: 12px; color: #445; font-weight: 600; white-space: nowrap; }
.fcap { display: flex; flex-direction: column; gap: 1px; flex: 0 0 auto; }
.dr {
  flex: 1 1 160px;
  min-width: 80px;
  height: 28px;
  position: relative;
  --lo: 0%;
  --hi: 100%;
}
.dr::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right,
    #dbe4ea 0 var(--lo),
    #1b6fae var(--lo), #1b6fae var(--hi),
    #dbe4ea var(--hi), #dbe4ea 100%);
}
.dr-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  outline: none;
  cursor: grab;
}
.dr-input::-webkit-slider-runnable-track { background: transparent; }
.dr-input::-moz-range-track { background: transparent; }
.dr-input::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #eef2f6;
  border: 1px solid #5b6b7b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  cursor: grab;
}
.dr-input::-moz-range-thumb {
  pointer-events: auto;
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: #eef2f6;
  border: 1px solid #5b6b7b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  cursor: grab;
}
.readout {
  font-variant-numeric: tabular-nums;
  color: #1b6fae;
  font-weight: 700;
  font-size: 12px;
  min-width: 108px;
}

/* ---------- график ---------- */
.plot-wrap { flex: 1; position: relative; min-height: 0; }
#plot {
  width: 100%;
  height: 100%;
  display: block;
  background: #fff;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  cursor: crosshair;
  touch-action: manipulation;
  user-select: none;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(18, 28, 38, .94);
  color: #eef;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.tooltip b { color: #ffd866; }
.hidden { display: none !important; }

.hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: #889;
  font-size: 11px;
  background: rgba(255, 255, 255, .88);
  padding: 3px 10px;
  border-radius: 12px;
  pointer-events: none;
}

/* ---------- нижняя панель (мобильный) ---------- */
.info {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  max-width: 1100px;
  background: #fff;
  border-top: 1px solid #dbe3ea;
  border-radius: 16px 16px 0 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .18);
  z-index: 30;
}
.info .info-call {
  font-size: 20px;
  font-weight: 800;
  color: #14324f;
  margin-bottom: 4px;
}
.info .row { font-size: 14px; color: #334; margin: 3px 0; }
.info .row b { color: #b03512; }
.info-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: none;
  background: none;
  color: #667;
  font-size: 17px;
  cursor: pointer;
  padding: 8px;
  touch-action: manipulation;
}
footer {
  padding: 4px 2px 0;
  font-size: 12px;
  color: #95a2ad;
  text-align: left;
  line-height: 1.4;
}
footer a { color: inherit; text-decoration: none; }
