:root {
  --bg-0: #080d16;
  --bg-1: #0d1321;
  --bg-2: #111a2b;
  --card: rgba(19, 29, 46, 0.92);
  --card-soft: rgba(24, 36, 56, 0.92);
  --text: #eef3ff;
  --muted: rgba(228, 236, 255, 0.72);
  --line: rgba(132, 168, 255, 0.2);
  --accent: #53d6ff;
  --accent-2: #6f7bff;
  --accent-3: #22d3a6;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1200px 800px at 80% 120%, rgba(40, 140, 255, 0.16), transparent 55%),
    radial-gradient(900px 700px at -10% -10%, rgba(115, 125, 255, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  min-height: 100%;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(106, 134, 196, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(106, 134, 196, 0.11) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 0.35;
  pointer-events: none;
}

.app {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 14px 118px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 12px;
}

.top-title {
  font-size: 31px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1;
}

.top-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(14, 22, 35, 0.9);
  font-size: 19px;
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(13, 20, 32, 0.86);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 14px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #4d6cff, #4de6d0);
  color: #f4fbff;
  font-weight: 800;
  font-size: 28px;
  text-transform: lowercase;
}

.brand-name {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}

.tab {
  display: none;
}

.tab-active {
  display: block;
}

.status-hero {
  background: linear-gradient(130deg, #7364ff, #3f84ff);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 14px;
}

.status-title {
  font-size: 24px;
  opacity: 0.95;
}

.status-main {
  font-size: 58px;
  font-weight: 800;
  line-height: 1;
  margin-top: 8px;
}

.status-hint {
  margin-top: 10px;
  font-size: 16px;
  opacity: 0.95;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 14px;
}

.panel.compact {
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 1px;
}

.badge {
  background: rgba(34, 211, 166, 0.16);
  border: 1px solid rgba(34, 211, 166, 0.36);
  color: #7ef5d3;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 99px;
}

.badge.badge-off {
  background: rgba(255, 115, 115, 0.12);
  border-color: rgba(255, 115, 115, 0.28);
  color: #ffb2b2;
}

.panel-big {
  margin-top: 12px;
  font-size: 34px;
  font-weight: 700;
}

.panel-note {
  margin-top: 5px;
  font-size: 15px;
  color: var(--muted);
}

.panel-title {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.06;
}

.action-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.outline-xl,
.primary-xl,
.primary-btn,
.secondary-btn,
.ghost-btn,
.link-btn {
  width: 100%;
  border-radius: 16px;
  border: 1px solid transparent;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  padding: 14px 16px;
}

.outline-xl {
  border-color: rgba(228, 236, 255, 0.75);
  background: rgba(8, 13, 22, 0.45);
}

.primary-xl,
.primary-btn {
  background: linear-gradient(135deg, #3f66ff, #39d7c8);
  color: #0a1220;
}

.secondary-btn {
  background: rgba(50, 64, 88, 0.85);
  border-color: rgba(170, 194, 255, 0.22);
}

.ghost-btn {
  background: transparent;
  border-color: rgba(170, 194, 255, 0.24);
}

.link-btn {
  background: rgba(56, 205, 214, 0.14);
  border-color: rgba(56, 205, 214, 0.34);
  color: #7ef0ff;
}

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

.device-accordion {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin: 12px 0;
  overflow: hidden;
}

.device-accordion summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  font-size: 42px;
  font-weight: 600;
}

.device-accordion summary::-webkit-details-marker {
  display: none;
}

.device-body {
  padding: 0 12px 12px;
  display: grid;
  gap: 10px;
}

.step-card {
  background: var(--card-soft);
  border: 1px solid rgba(150, 176, 232, 0.18);
  border-radius: 16px;
  padding: 14px;
}

.step-title {
  font-size: 28px;
  font-weight: 700;
}

.step-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.sub-key-value {
  display: block;
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(159, 186, 249, 0.25);
  background: rgba(10, 18, 31, 0.72);
  color: #cfe4ff;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 132px;
  overflow: auto;
}

.info-card {
  background: rgba(15, 35, 63, 0.74);
  border: 1px solid rgba(87, 158, 255, 0.24);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
}

.info-title {
  color: #69b5ff;
  font-size: 31px;
  font-weight: 700;
}

.info-text {
  margin-top: 8px;
  color: #d4e8ff;
  font-size: 17px;
  line-height: 1.45;
}

.devices-panel {
  margin-bottom: 18px;
}

.big-box {
  width: 100%;
  border-radius: 18px;
  padding: 22px 18px;
  border: 1px solid rgba(164, 192, 255, 0.34);
  background: rgba(12, 18, 30, 0.65);
  color: var(--text);
}

.big-title {
  display: block;
  font-size: 39px;
  font-weight: 700;
}

.big-sub {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
}

.or-line {
  margin: 14px 0;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 16px;
}

.or-line::before,
.or-line::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(187, 205, 245, 0.3);
}

.or-line span {
  padding: 0 10px;
}

.full {
  width: 100%;
  margin-top: 8px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
  width: min(760px, calc(100vw - 18px));
  background: rgba(10, 16, 27, 0.95);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  backdrop-filter: blur(8px);
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  font-size: 17px;
  font-weight: 500;
  padding: 12px 8px;
}

.nav-item.active {
  color: #42a8ff;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 92px;
  background: rgba(14, 22, 36, 0.96);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 15, 0.68);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 30;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(680px, 100%);
  background: rgba(14, 22, 34, 0.98);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  position: relative;
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(17, 28, 43, 0.9);
  color: var(--text);
  font-size: 20px;
}

.modal-title {
  font-size: 27px;
  font-weight: 700;
  margin-bottom: 12px;
}

#qrImage {
  width: 100%;
  max-width: 320px;
  display: block;
  margin: 0 auto 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.manual-list {
  margin: 0 0 14px;
  padding-left: 22px;
  color: #d6e5ff;
  font-size: 16px;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .top-title {
    font-size: 20px;
  }

  .brand-name {
    font-size: 24px;
  }

  .status-title {
    font-size: 16px;
  }

  .status-main {
    font-size: 30px;
  }

  .panel-title {
    font-size: 20px;
  }

  .panel-big {
    font-size: 24px;
  }

  .info-title {
    font-size: 20px;
  }

  .big-title {
    font-size: 22px;
  }

  .step-title {
    font-size: 18px;
  }

  .device-accordion summary {
    font-size: 18px;
  }

  .btn-row {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-item {
    font-size: 15px;
    padding: 10px 6px;
  }
}
