:root {
  --ink: #17233c;
  --muted: #68738a;
  --line: #dfe4ec;
  --canvas: #f4f6fa;
  --surface: #fff;
  --navy: #17233c;
  --cyan: #29c7b8;
  --cyan-dark: #0c746b;
  --cyan-soft: #e8faf7;
  --orange: #ff9d43;
  --orange-soft: #fff7ee;
  --red: #c83c4a;
  --red-soft: #fff4f5;
  --shadow: 0 18px 45px rgba(23, 35, 60, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.topbar {
  height: 72px;
  padding: 0 max(24px, calc((100vw - 900px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  color: white;
}

.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 2px solid var(--cyan);
  border-radius: 11px 4px;
  color: var(--cyan);
  font-size: 20px;
  font-weight: 800;
}
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand strong { letter-spacing: .12em; font-size: 16px; }
.brand small { margin-top: 4px; color: #aeb8ca; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.connection-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  color: #dfe5ee;
  font-size: 13px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8994a8; }
.connection-pill[data-state="online"] .status-dot { background: var(--cyan); box-shadow: 0 0 0 4px rgba(41, 199, 184, .12); }
.connection-pill[data-state="busy"] .status-dot { background: var(--orange); animation: pulse 1s ease-in-out infinite; }

main { width: min(900px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 60px; }
.hero { padding: 56px 4px 34px; }
.eyebrow { margin: 0 0 10px; color: var(--cyan-dark); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
h1, h2 { margin: 0; letter-spacing: -.035em; }
h1 { font-size: clamp(32px, 6vw, 48px); line-height: 1.05; }
h2 { font-size: 24px; }
.hero > p:last-child { max-width: 650px; margin: 16px 0 0; color: var(--muted); line-height: 1.65; }

.updater {
  padding: 30px;
  background: var(--surface);
  border: 1px solid rgba(223, 228, 236, .9);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.target-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.version { color: var(--cyan-dark); }
.config-state { padding: 7px 11px; border-radius: 999px; background: var(--cyan-soft); color: var(--cyan-dark); font-size: 11px; font-weight: 700; }
.config-state.error { background: var(--red-soft); color: var(--red); }

.firmware-meta { display: grid; grid-template-columns: 1fr 1.5fr; gap: 16px; margin: 24px 0 30px; }
.firmware-meta div { min-width: 0; padding: 13px 15px; border-radius: 11px; background: var(--canvas); }
.firmware-meta dt { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.firmware-meta dd { overflow: hidden; margin: 5px 0 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 24px; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; color: #929cad; }
.steps li > span { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border: 2px solid var(--line); border-radius: 50%; font-size: 11px; font-weight: 800; }
.steps li div { display: grid; }
.steps li strong { font-size: 12px; }
.steps li small { margin-top: 2px; font-size: 9px; }
.steps li.active { border-color: #b9e9e3; background: #f8fefd; color: var(--ink); }
.steps li.active > span { border-color: var(--cyan); color: var(--cyan-dark); }
.steps li.done { color: var(--cyan-dark); }
.steps li.done > span { border-color: var(--cyan); background: var(--cyan); color: var(--navy); }

.status-card { display: flex; align-items: center; gap: 15px; padding: 19px; border: 1px solid var(--line); border-radius: 13px; background: #fafbfd; }
.status-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: #eef1f5; color: #7e899b; }
.status-icon svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.status-copy { display: grid; min-width: 180px; }
.status-copy strong { font-size: 14px; }
.status-copy span { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.versions { display: grid; grid-template-columns: repeat(2, auto); gap: 24px; margin-left: auto; }
.versions div { display: grid; }
.versions span { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.versions strong { margin-top: 4px; font-size: 12px; }
.status-card[data-state="busy"] { border-color: #f0c89f; background: var(--orange-soft); }
.status-card[data-state="busy"] .status-icon { background: #fff0df; color: #b9671b; animation: pulse 1s ease-in-out infinite; }
.status-card[data-state="success"] { border-color: #b9e9e3; background: #f5fdfb; }
.status-card[data-state="success"] .status-icon { background: var(--cyan-soft); color: var(--cyan-dark); }
.status-card[data-state="warning"], .status-card[data-state="error"] { border-color: #efc4c9; background: var(--red-soft); }
.status-card[data-state="warning"] .status-icon, .status-card[data-state="error"] .status-icon { background: #ffe4e7; color: var(--red); }

.progress { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.progress > div { height: 9px; overflow: hidden; flex: 1; border-radius: 999px; background: #e2e6ed; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--cyan); transition: width .15s linear; }
.progress strong { min-width: 38px; color: var(--muted); font-size: 11px; text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.button { min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px; cursor: pointer; font-size: 12px; font-weight: 750; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button.primary { background: var(--navy); color: white; }
.button.primary:not(:disabled):hover { background: #263655; }
.button.secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.safety { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.55; }
.browser-warning { margin-bottom: 24px; padding: 13px 15px; border: 1px solid #efc4c9; border-radius: 10px; background: var(--red-soft); color: #8e2833; font-size: 12px; line-height: 1.5; }
.hidden { display: none !important; }

@keyframes pulse { 50% { opacity: .4; } }

@media (max-width: 700px) {
  .topbar { padding: 0 18px; }
  main { width: min(100% - 24px, 900px); }
  .hero { padding-top: 38px; }
  .updater { padding: 20px; }
  .target-heading, .status-card { align-items: flex-start; flex-direction: column; }
  .firmware-meta, .steps { grid-template-columns: 1fr; }
  .versions { margin-left: 59px; }
  .config-state { align-self: flex-start; }
}
