@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: .15; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: #05070a;
  font-family: 'IBM Plex Sans', sans-serif;
  color: #E7ECF2;
}

a { color: #35D0C0; }
a:hover { color: #F2A93C; }
::selection { background: #F2A93C55; }

.btn:focus-visible, .rocker:focus-visible, .linktab:focus-visible {
  outline: 2px solid #35D0C0;
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* ── Внешняя рамка приложения ─────────────────────────────────── */
.frame {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: #0B0F14;
  background-image:
    radial-gradient(ellipse 600px 300px at 50% -10%, rgba(53, 208, 192, .06), transparent),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0px, rgba(0, 0, 0, .18) 1px, transparent 1px, transparent 3px),
    linear-gradient(rgba(38, 48, 60, .3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 48, 60, .3) 1px, transparent 1px);
  background-size: 100% 100%, 100% 3px, 16px 16px, 16px 16px;
  color: #E7ECF2;
  min-height: 100vh;
}

/* ── Шапка устройства ──────────────────────────────────────────── */
.device-header {
  padding: 18px 16px 16px;
  background: linear-gradient(180deg, #171F29, #131922);
  border-bottom: 1px solid #26303C;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .03);
}

.device-header-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.device-hero-img {
  width: 96px;
  height: auto;
  flex: none;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 6px rgba(53, 208, 192, .15));
}

.device-name {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: .005em;
}

.device-sub {
  font-family: 'Handjet', monospace;
  font-size: 11px;
  color: #7C8898;
  margin-top: 4px;
  letter-spacing: .02em;
}

.device-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 16px;
  border-top: 1px solid #26303C;
  padding-top: 12px;
}

.device-stat {
  border-right: 1px solid #26303C;
  padding: 0 10px;
}
.device-stat:first-child { padding-left: 0; }
.device-stat-last { border-right: none; padding-right: 0; }

.device-stat-label {
  font-family: 'Handjet', monospace;
  font-size: 10px;
  color: #7C8898;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.device-stat-value {
  font-family: 'Handjet', monospace;
  font-size: 15px;
  margin-top: 3px;
  letter-spacing: .01em;
}

/* ── Тело — карточки ───────────────────────────────────────────── */
.device-body {
  padding: 18px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: linear-gradient(180deg, rgba(20, 27, 36, .55), rgba(20, 27, 36, .15));
  border: 1px solid #26303C;
  border-radius: 0;
  padding: 14px 14px 16px;
}

.sechead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.secdot {
  width: 6px;
  height: 6px;
  border-radius: 0;
  flex: none;
  background: #26303C;
}
.secdot.led-on {
  background: #35D0C0;
  box-shadow: 0 0 6px #35D0C0;
}

.seclabel {
  font-family: 'Handjet', monospace;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #7C8898;
  flex: none;
}

.secline { flex: 1; height: 1px; background: #26303C; }

/* ── Кнопки ────────────────────────────────────────────────────── */
.btn {
  font-family: 'Handjet', monospace;
  font-size: 12px;
  padding: 9px 0;
  text-align: center;
  background: #8A6A2E;
  color: #0B0F14;
  border: 2px solid #26303C;
  border-radius: 0;
  cursor: pointer;
  transition: none;
  width: 100%;
  box-shadow: 3px 3px 0 #000;
}
.btn:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}
.btn:disabled { opacity: .5; cursor: default; }

.btn.active {
  background: #F2A93C;
  color: #0B0F14;
  border-color: #0B0F14;
  box-shadow: 3px 3px 0 #000;
}
.btn.active:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn.ghost {
  margin-top: 8px;
  font-size: 11px;
  color: #7C8898;
  background: #0B0F14;
  border: 2px solid #26303C;
  box-shadow: 3px 3px 0 #000;
  letter-spacing: .02em;
}

.diag-box {
  margin-top: 10px;
  background: #05070a;
  border: 1px solid #26303C;
  border-radius: 0;
  padding: 10px 12px;
  font-family: 'Handjet', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: #35D0C0;
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
}

/* ── Списки (сети / устройства) ───────────────────────────────── */
.rows { display: flex; flex-direction: column; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid #26303C;
}
.row:last-child { border-bottom: none; }

.row-title { font-size: 13px; }
.row-sub {
  font-family: 'Handjet', monospace;
  font-size: 10px;
  color: #7C8898;
  margin-top: 2px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.bar {
  width: 3px;
  border-radius: 0;
  background: #26303C;
  transition: background .2s;
}
.bar.lit { background: #35D0C0; }

/* ── Гостевая сеть ─────────────────────────────────────────────── */
.guest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guest-ssid { font-size: 13px; }
.guest-sub {
  font-family: 'Handjet', monospace;
  font-size: 10px;
  color: #7C8898;
  margin-top: 2px;
}

.rocker {
  width: 46px;
  height: 24px;
  border-radius: 0;
  position: relative;
  background: #05070a;
  border: 2px solid #26303C;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
  flex: none;
  padding: 0;
}
.rocker.on {
  background: #0B0F14;
  border-color: #35D0C0;
}

.rocker-knob {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 20px;
  left: 2px;
  background: #26303C;
  border-radius: 0;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .4);
  transition: left .12s ease, background .12s ease;
}
.rocker.on .rocker-knob {
  left: 23px;
  background: #35D0C0;
}

.qr-box {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}
.qr-box canvas {
  border-radius: 0;
}
.qr-box.placeholder {
  width: 120px;
  height: 120px;
  margin: 10px auto 0;
  border: 1px dashed #26303C;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Handjet', monospace;
  font-size: 10px;
  color: #7C8898;
  padding: 8px;
}

/* ── Скорость ──────────────────────────────────────────────────── */
.speed-label {
  font-family: 'Handjet', monospace;
  font-size: 10px;
  color: #7C8898;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.speed-value {
  font-family: 'Handjet', monospace;
  font-size: 26px;
  font-weight: 500;
}
.speed-value.down { color: #35D0C0; text-shadow: 0 0 8px rgba(53, 208, 192, .5); }
.speed-value.up { color: #F2A93C; text-shadow: 0 0 8px rgba(242, 169, 60, .5); }

.speed-unit { font-size: 13px; color: #7C8898; }

.speed-status {
  font-family: 'Handjet', monospace;
  font-size: 11px;
  color: #7C8898;
  margin-top: 8px;
}

.tabs { display: flex; gap: 8px; margin-top: 10px; }

.linktab {
  flex: 1;
  font-family: 'Handjet', monospace;
  font-size: 11px;
  padding: 7px 0;
  text-align: center;
  background: #0B0F14;
  color: #7C8898;
  border: 2px solid #26303C;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 2px 2px 0 #000;
}
.linktab.active {
  background: #141B24;
  color: #35D0C0;
  border-color: #35D0C0;
}
.linktab:active { transform: translate(2px, 2px); box-shadow: none; }
.linktab:disabled { opacity: .5; cursor: default; }

/* ── Перезагрузка ──────────────────────────────────────────────── */
.btn.reboot {
  margin-top: 4px;
  margin-bottom: 4px;
  padding: 13px 0;
  font-size: 13px;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: #0B0F14;
  color: #F2545B;
  border: 2px solid #F2545B;
  box-shadow: 3px 3px 0 #000;
}
.btn.reboot.busy {
  background: #F2545B;
  color: #0B0F14;
  box-shadow: none;
  transform: translate(3px, 3px);
}
