:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #06101b;
  color: #e9f1f8;
  font-synthesis: none;
  --bg: #06101b;
  --surface: rgba(12, 28, 43, 0.82);
  --surface-strong: #10263a;
  --line: rgba(139, 171, 197, 0.2);
  --muted: #91a7b9;
  --text: #edf6fc;
  --cyan: #5be3d5;
  --blue: #79a9ff;
  --orange: #ffbd66;
  --red: #ff7d86;
  --green: #6fe6a7;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% -5%, rgba(71, 139, 184, 0.24), transparent 38rem),
    radial-gradient(circle at 95% 12%, rgba(52, 185, 164, 0.12), transparent 34rem), var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(128, 164, 190, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(128, 164, 190, 0.04) 1px, transparent 1px);
  background-size: 38px 38px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(91, 227, 213, 0.42);
  outline-offset: 3px;
}

code {
  border: 1px solid rgba(142, 178, 202, 0.2);
  border-radius: 0.35rem;
  background: rgba(4, 14, 24, 0.58);
  padding: 0.08rem 0.35rem;
  color: #b9e9ff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 32px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}

.step {
  margin: 0 0 10px;
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 0.94;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.lede {
  margin-bottom: 0;
  color: #aec0cf;
  font-size: 0.96rem;
}

.runtime-badges {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 8px;
  align-items: flex-end;
}

.badge,
.state {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(5, 16, 27, 0.68);
  padding: 7px 11px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.badge::before,
.state::before {
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  box-shadow: 0 0 12px currentColor;
}

.badge-ok,
.state-ok {
  border-color: rgba(111, 230, 167, 0.3);
  color: var(--green);
}

.badge-danger,
.state-danger {
  border-color: rgba(255, 125, 134, 0.34);
  color: var(--red);
}

.state-pending {
  border-color: rgba(255, 189, 102, 0.34);
  color: var(--orange);
}

.notice {
  margin-bottom: 18px;
  border: 1px solid;
  border-radius: 16px;
  padding: 18px 20px;
}

.notice h2 {
  margin-bottom: 6px;
  font-size: 0.94rem;
}

.notice p {
  margin-bottom: 0;
  color: #bdc9d3;
  font-size: 0.88rem;
  line-height: 1.65;
}

.notice-warning {
  border-color: rgba(255, 189, 102, 0.3);
  background: rgba(108, 70, 21, 0.18);
}

.notice-danger {
  border-color: rgba(255, 125, 134, 0.36);
  background: rgba(105, 32, 42, 0.25);
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(17, 39, 58, 0.88), rgba(8, 22, 35, 0.88));
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.switch-panel,
.recovery-panel,
.log-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.button-row,
.switch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 15px;
  color: #eff8ff;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    opacity 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.button-primary {
  background: linear-gradient(135deg, #168b9b, #236db8);
  box-shadow: 0 10px 30px rgba(28, 116, 159, 0.24);
}

.button-secondary {
  border-color: rgba(137, 177, 205, 0.28);
  background: rgba(38, 66, 87, 0.62);
}

.button-ghost {
  border-color: rgba(255, 125, 134, 0.24);
  background: transparent;
  color: #ffc2c6;
}

.button-public,
.button-dji {
  display: flex;
  flex: 1 1 240px;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 14px 18px;
  text-align: left;
}

.button-public {
  border-color: rgba(91, 227, 213, 0.28);
  background: linear-gradient(135deg, rgba(25, 127, 125, 0.78), rgba(24, 94, 125, 0.78));
}

.button-dji {
  border-color: rgba(121, 169, 255, 0.3);
  background: linear-gradient(135deg, rgba(48, 83, 157, 0.78), rgba(67, 53, 134, 0.78));
}

.button small {
  color: rgba(235, 247, 255, 0.68);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 0;
}

.facts div {
  min-width: 0;
  border: 1px solid rgba(137, 177, 205, 0.14);
  border-radius: 12px;
  background: rgba(4, 14, 24, 0.3);
  padding: 12px;
}

.facts dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.7rem;
}

.facts dd {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow {
  margin: 0 0 16px;
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

.safety-check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 189, 102, 0.28);
  border-radius: 12px;
  background: rgba(93, 57, 15, 0.18);
  padding: 14px;
  color: #e5d2b4;
  font-size: 0.83rem;
  line-height: 1.55;
  cursor: pointer;
}

.safety-check input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: #54d8c8;
}

.muted {
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.65;
}

.operation-log {
  max-height: 300px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

.operation-log li {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 12px;
  border-top: 1px solid rgba(139, 171, 197, 0.1);
  padding: 10px 0;
  color: #c5d2dc;
}

.operation-log li:first-child {
  border-top: 0;
}

.operation-log time {
  color: #738b9d;
}

.log-error {
  color: #ffacb2 !important;
}

.log-success {
  color: #9ce9bd !important;
}

.text-button {
  border: 0;
  background: transparent;
  padding: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .shell {
    padding-top: 36px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .runtime-badges {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .dashboard {
    grid-template-columns: 1fr;
  }

  .device-panel,
  .switch-panel,
  .recovery-panel,
  .log-panel {
    grid-column: 1;
  }

}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1120px);
  }

  .panel {
    border-radius: 16px;
    padding: 18px;
  }

  .facts {
    grid-template-columns: 1fr;
  }

  .button-row .button,
  .recovery-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
