:root {
  color-scheme: dark;
  --bg: #090b0e;
  --panel: #0d1014;
  --panel-raised: #11151a;
  --border: rgba(255, 255, 255, 0.1);
  --text: #f4f6f8;
  --muted: #a2aab2;
  --subtle: #737d87;
  --blue: #168cff;
  --blue-bright: #2b9bff;
  --green: #50d68b;
  --amber: #f2bc4b;
  --red: #ff6c6c;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -20%, rgba(22, 140, 255, 0.11), transparent 42rem),
    var(--bg);
}

button, input { font: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 3px; }

.topbar {
  height: 70px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 9, 12, 0.82);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.brand-mark {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(43, 155, 255, 0.5);
  border-radius: 9px;
  color: #8bc9ff;
  background: rgba(22, 140, 255, 0.12);
  font: 600 10px "DM Mono", monospace;
  letter-spacing: -0.1em;
}

.topbar-label, .eyebrow, .step-kicker, .step-state, .page-footer, .progress-meta, .log-time {
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.topbar-label { color: var(--subtle); font-size: 10px; letter-spacing: 0.14em; }

.page-shell { width: min(100% - 36px, 900px); margin: 0 auto; }
.intro { padding: 72px 0 40px; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: #65b7ff; font-size: 12px; letter-spacing: 0.17em; text-transform: uppercase; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-bright); box-shadow: 0 0 14px rgba(43, 155, 255, 0.8); }
h1 { margin: 19px 0 12px; font-size: clamp(38px, 7vw, 62px); line-height: 1.02; letter-spacing: -0.055em; }
.lede { max-width: 610px; margin: 0 auto; color: #aeb6be; font-size: clamp(16px, 2.7vw, 20px); line-height: 1.55; }
.requirements { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; margin-top: 26px; }
.requirements span { display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 999px; padding: 9px 14px; color: #c4cbd1; background: rgba(255,255,255,0.025); font-size: 12px; }
.requirement-icon { color: #79c1ff; font-size: 15px; }

.installer { display: grid; gap: 14px; }
.step-card, .log-panel { position: relative; border: 1px solid var(--border); border-radius: 18px; background: linear-gradient(145deg, rgba(255,255,255,0.025), transparent 52%), var(--panel); }
.step-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 17px; padding: 25px 28px 26px; }
.step-number { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.17); border-radius: 50%; color: #dbe2e8; font-size: 16px; font-weight: 700; }
.step-content { min-width: 0; }
.step-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.step-kicker { margin: 1px 0 5px; color: var(--subtle); font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase; }
h2 { margin: 0; font-size: 22px; line-height: 1.25; letter-spacing: -0.025em; }
.step-state { flex: none; margin-top: 7px; border: 1px solid var(--border); border-radius: 999px; padding: 6px 9px; color: #9da6af; font-size: 9px; white-space: nowrap; }
.step-state.ready { border-color: rgba(80,214,139,0.24); color: var(--green); background: rgba(80,214,139,0.06); }
.step-state.busy { border-color: rgba(242,188,75,0.24); color: var(--amber); background: rgba(242,188,75,0.06); }
.step-state.error { border-color: rgba(255,108,108,0.25); color: #ff9393; background: rgba(255,108,108,0.06); }
.step-copy { max-width: 680px; margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.step-copy strong { color: #e0e6eb; font-weight: 600; }

.firmware-card { display: flex; align-items: center; gap: 11px; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,0.025); }
.firmware-card strong, .firmware-card span:not(.status-pip) { display: block; }
.firmware-card strong { font-size: 12px; font-weight: 600; }
.firmware-card div span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.status-pip { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(242,188,75,0.1); }
.firmware-card.ready .status-pip { background: var(--green); box-shadow: 0 0 0 4px rgba(80,214,139,0.1); }
.firmware-card.error .status-pip { background: var(--red); box-shadow: 0 0 0 4px rgba(255,108,108,0.1); }

.button { min-height: 48px; display: inline-flex; justify-content: center; align-items: center; gap: 9px; border: 0; border-radius: 10px; padding: 0 18px; cursor: pointer; font-size: 14px; font-weight: 700; transition: transform 120ms ease, opacity 120ms ease, background 120ms ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: 0.42; }
.button-primary { width: 100%; margin-top: 15px; color: white; background: linear-gradient(180deg, #1997ff, #0876e1); box-shadow: 0 6px 20px rgba(0, 115, 226, 0.18); }
.button-primary:hover:not(:disabled) { background: linear-gradient(180deg, #35a4ff, #1185f4); }
.button-secondary { min-width: 190px; margin-top: 17px; border: 1px solid rgba(22,140,255,0.35); color: #cbe7ff; background: rgba(22,140,255,0.12); }
.button-secondary:hover:not(:disabled) { background: rgba(22,140,255,0.2); }
.button-icon { font-size: 17px; line-height: 1; }
.inline-help { min-height: 16px; margin: 9px 0 0; color: var(--subtle); font-size: 11px; }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 13px; padding: 12px 13px; border: 1px solid var(--border); border-radius: 11px; background: rgba(255,255,255,0.02); }
.backup-copy strong, .backup-copy span { display: block; }
.backup-copy strong { color: #dfe5eb; font-size: 11px; font-weight: 600; }
.backup-copy span { max-width: 440px; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.button-backup { min-height: 36px; flex: none; border: 1px solid rgba(255,255,255,0.15); color: #d4dbe1; background: rgba(255,255,255,0.045); font-size: 11px; }
.button-backup:hover:not(:disabled) { background: rgba(255,255,255,0.09); }

.acknowledgement { display: flex; align-items: flex-start; gap: 11px; margin-top: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; color: #aeb6be; background: rgba(255,255,255,0.02); font-size: 11px; line-height: 1.55; cursor: pointer; }
.acknowledgement input { width: 16px; height: 16px; flex: none; margin: 1px 0 0; accent-color: var(--blue); }
.notice { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; padding: 12px 13px; border: 1px solid rgba(242,188,75,0.19); border-radius: 11px; color: #bdb39b; background: rgba(242,188,75,0.045); font-size: 10px; line-height: 1.6; }
.notice-icon { width: 17px; height: 17px; flex: none; display: grid; place-items: center; border: 1px solid rgba(242,188,75,0.55); border-radius: 50%; color: var(--amber); font: 500 11px Georgia, serif; }

.progress-wrap { margin-top: 16px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: #b9c0c7; font-size: 10px; }
progress { display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 999px; appearance: none; background: #262d34; }
progress::-webkit-progress-bar { border-radius: 999px; background: #262d34; }
progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #0876e1, #63baff); transition: width 180ms ease; }
progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, #0876e1, #63baff); }

.log-panel { padding: 22px 25px; }
.log-heading { display: flex; justify-content: space-between; align-items: center; }
.log-heading h2 { font-size: 16px; }
.text-button { border: 0; padding: 6px 0 6px 8px; color: #7bbfff; background: transparent; cursor: pointer; font-size: 11px; }
.text-button:hover { color: white; }
.log-output { display: grid; gap: 6px; max-height: 160px; overflow: auto; margin-top: 14px; padding: 11px 12px; border: 1px solid rgba(255,255,255,0.06); border-radius: 9px; background: #080a0c; }
.log-line { margin: 0; color: #a6b0ba; font: 10px/1.5 "DM Mono", ui-monospace, monospace; overflow-wrap: anywhere; }
.log-time { margin-right: 8px; color: #66717c; }
.log-line.error { color: #ff9696; }
.log-line.success { color: #75e0a6; }
.page-footer { display: flex; justify-content: space-between; gap: 14px; padding: 20px 2px 38px; color: #636d77; font-size: 9px; }

@media (max-width: 600px) {
  .topbar { height: 60px; }
  .topbar-label { font-size: 8px; }
  .intro { padding: 54px 0 30px; }
  .requirements { gap: 7px; }
  .requirements span { padding: 8px 10px; font-size: 10px; }
  .step-card { grid-template-columns: 35px minmax(0, 1fr); gap: 12px; padding: 20px 15px; border-radius: 14px; }
  .step-number { width: 34px; height: 34px; font-size: 13px; }
  h2 { font-size: 19px; }
  .step-heading-row { align-items: flex-start; }
  .step-state { max-width: 105px; overflow: hidden; text-overflow: ellipsis; font-size: 8px; }
  .step-copy { font-size: 12px; }
  .button { width: 100%; }
  .backup-row { align-items: stretch; flex-direction: column; }
  .button-backup { width: 100%; }
  .log-panel { padding: 19px 16px; }
  .page-footer { flex-direction: column; font-size: 8px; }
}

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