:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --card: #141822;
  --text: #f4f7fb;
  --muted: #9ba6b6;
  --line: #2a3140;
  --accent: #ff6b2c;
  --accent2: #ff9a3c;
  --good: #43d17a;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 50% -20%, #222a3b 0, var(--bg) 42%); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
body { padding: 34px 18px 60px; }
button, input { font: inherit; }
.page { width: min(760px, 100%); margin: 0 auto; }
.hero { padding: 18px 4px 24px; }
.brand { display: flex; gap: 16px; align-items: center; }
.logo { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 18px; font-size: 34px; background: linear-gradient(145deg, #2a2020, #171922); border: 1px solid #3d302d; box-shadow: 0 12px 34px #0008; }
.eyebrow { color: var(--accent2); font-weight: 800; letter-spacing: .19em; font-size: 12px; }
h1 { margin: 4px 0 5px; font-size: clamp(27px, 4vw, 40px); line-height: 1.08; }
.subtitle { margin: 0; color: var(--muted); font-size: 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 24px; }
.step { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); background: #10141d; border-radius: 14px; color: #7f8998; transition: .2s; }
.step > span { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #242a36; color: #a9b1bd; font-weight: 800; }
.step b { display: block; font-size: 13px; color: #b7c0cd; }
.step small { display: block; color: #707b8b; line-height: 1.3; margin-top: 2px; }
.step.active { border-color: #734124; background: #1a1716; }
.step.active > span { background: var(--accent); color: white; }
.step.active b { color: white; }
.step.done { border-color: #245b3b; background: #101b16; }
.step.done > span { background: var(--good); color: #07150c; }
.card { background: linear-gradient(180deg, rgba(27,32,45,.96), rgba(18,22,31,.98)); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 55px #0005; margin: 14px 0; }
.primary-card { padding: 20px; }
.port-row, .firmware-summary { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.port-state { display: flex; align-items: center; gap: 11px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: #596273; box-shadow: 0 0 0 5px #5962731e; }
.status-dot.good { background: var(--good); box-shadow: 0 0 0 5px #43d17a20, 0 0 16px #43d17a55; }
.label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.value { margin-top: 3px; font-weight: 750; }
.btn { border: 0; border-radius: 14px; cursor: pointer; transition: transform .14s ease, filter .14s ease, opacity .14s ease; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { padding: 11px 16px; color: white; background: #252c39; border: 1px solid #343e50; }
.btn.secondary:hover:not(:disabled) { filter: brightness(1.12); }
.firmware-summary { margin-top: 18px; padding: 14px 0; border-top: 1px solid var(--line); }
.firmware-meta { text-align: right; color: var(--muted); font-size: 13px; }
.btn.flash { width: 100%; padding: 16px 20px; margin-top: 8px; font-weight: 850; color: white; font-size: 17px; background: linear-gradient(135deg, var(--accent), #ff8c2c); box-shadow: 0 12px 28px #ff6b2c28; }
.btn.flash:hover:not(:disabled) { filter: brightness(1.08); }
.flash-icon { display: inline-block; margin-right: 8px; font-size: 19px; }
.progress-wrap { margin-top: 18px; }
.progress-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.progress-track { height: 9px; border-radius: 99px; background: #272d38; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .12s linear; }
.result { margin-top: 16px; padding: 13px 14px; border-radius: 12px; font-size: 14px; border: 1px solid transparent; }
.result.success { display: block; background: #0f2518; border-color: #235b39; color: #a9f6c6; }
.result.error { display: block; background: #291216; border-color: #6b2830; color: #ffb4bb; }
.banner { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: #2a1716; border: 1px solid #6f322d; color: #ffc0b8; }
.hidden { display: none !important; }
details.card > summary { cursor: pointer; padding: 17px 20px; font-weight: 800; list-style: none; }
details.card > summary::-webkit-details-marker { display:none; }
details.card > summary::after { content: "▾"; float: right; color: var(--muted); }
details[open].card > summary::after { transform: rotate(180deg); }
.advanced-body { padding: 0 20px 20px; border-top: 1px solid var(--line); }
.check-row { display: flex; gap: 11px; align-items: flex-start; margin: 16px 0; }
.check-row input { margin-top: 4px; accent-color: var(--accent); }
.check-row b, .check-row small { display: block; }
.check-row small { color: var(--muted); margin-top: 4px; }
.info-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.info-grid div { padding: 10px; border-radius: 10px; background: #10141c; border: 1px solid #242b38; }
.info-grid span { display: block; color: var(--muted); font-size: 11px; }
.info-grid b { display: block; margin-top: 3px; font-size: 13px; }
.file-list { margin-top: 14px; border: 1px solid #252d3a; border-radius: 12px; overflow: hidden; }
.file-row { display: grid; grid-template-columns: 100px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #252d3a; font-size: 13px; }
.file-row:last-child { border-bottom: 0; }
.file-row code { color: #ffae72; }
.file-row .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fsize { color: var(--muted); }
.log-toolbar { display: flex; justify-content: flex-end; padding: 8px 16px 0; border-top: 1px solid var(--line); }
.link-btn { border: 0; background: transparent; color: #9db7ff; cursor: pointer; }
pre { margin: 0; padding: 14px 16px 18px; max-height: 300px; overflow: auto; color: #b8c2d1; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.help { padding: 12px 6px 0; color: #d8dee9; }
.help h2 { font-size: 17px; margin-bottom: 6px; }
.help p { color: #b2bbc8; line-height: 1.55; }
.help .muted { color: #7f8998; font-size: 13px; }
@media (max-width: 680px) {
  body { padding: 20px 12px 40px; }
  .steps { grid-template-columns: 1fr; }
  .port-row { align-items: stretch; flex-direction: column; }
  .btn.secondary { width: 100%; }
  .firmware-summary { align-items: flex-start; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .file-row { grid-template-columns: 82px 1fr; }
  .file-row .fsize { grid-column: 2; }
}
