:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #65706a;
  --paper: #f3f5f2;
  --surface: #ffffff;
  --line: #d8ded9;
  --green: #0d7654;
  --green-dark: #09563e;
  --signal: #d6ff45;
  --warning: #fff4cc;
  --warning-line: #e8c34c;
  --console: #121714;
  --console-ink: #cbe7d8;
  font-family: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 32, 28, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 28, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 30px;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 2px solid var(--ink);
}

.eyebrow, .console-kicker {
  margin: 0 0 8px;
  font: 500 11px/1.2 "DM Mono", monospace;
  color: var(--green);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 5vw, 46px); line-height: 1; letter-spacing: 0; }
h2 { margin-bottom: 5px; font-size: 17px; line-height: 1.25; letter-spacing: 0; }
p { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.connection-state {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  white-space: nowrap;
  font: 500 12px/1 "DM Mono", monospace;
}

.state-dot { width: 9px; height: 9px; border-radius: 50%; background: #9ba39e; box-shadow: 0 0 0 4px #e3e7e4; }
.state-dot.connected { background: var(--green); box-shadow: 0 0 0 4px #d8eee5; }
.state-dot.busy { background: #d69b19; box-shadow: 0 0 0 4px #f7e9c9; }

.instruction {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 26px 0;
  padding: 18px 20px;
  border: 1px solid var(--warning-line);
  border-left: 5px solid var(--warning-line);
  background: var(--warning);
}

.instruction svg { flex: 0 0 auto; width: 25px; height: 25px; color: #886500; }
.instruction h2 { margin-bottom: 2px; }
.instruction p { color: #594b1d; font-size: 14px; }

.driver-support {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px 24px;
  margin: 0 0 26px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  background: var(--surface);
}
.driver-copy { display: flex; min-width: 0; align-items: flex-start; gap: 14px; }
.driver-copy > svg { flex: 0 0 auto; width: 24px; height: 24px; color: var(--green); }
.driver-copy h2 { margin-bottom: 2px; }
.driver-copy strong, .driver-steps strong { color: var(--ink); }
.driver-steps {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 14px 0 0 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.driver-steps li { padding-left: 4px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr); border: 1px solid var(--line); background: var(--surface); }
.steps { min-width: 0; }
.step { display: grid; grid-template-columns: 66px 1fr; min-height: 145px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-index { display: grid; place-items: start center; padding-top: 29px; border-right: 1px solid var(--line); color: var(--green); font: 500 12px/1 "DM Mono", monospace; }
.step-body { min-width: 0; padding: 26px 28px; }
.step-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.step-heading > div { min-width: 0; }
.firmware-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.release-status { margin-top: 13px; font: 400 11px/1.5 "DM Mono", monospace; }

.chooser-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.chooser-note svg { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 1px; color: var(--green); }

.button, .icon-button {
  border: 0;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}
.button svg { width: 17px; height: 17px; }
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { color: white; background: var(--green); border-color: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: var(--ink); background: white; }
.button-secondary:hover { background: #edf1ee; }
.button-accent { color: var(--ink); background: var(--signal); border-color: var(--ink); }
.button-accent:hover { background: #c9f332; }
.button:disabled { cursor: not-allowed; color: #8a928d; background: #e9ecea; border-color: #d2d7d3; }

.icon-button { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 4px; color: var(--muted); background: transparent; }
.icon-button svg { width: 17px; height: 17px; }

.device-details { display: grid; grid-template-columns: 1fr 1.4fr 0.8fr; gap: 14px; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
.device-details div { min-width: 0; }
dt { margin-bottom: 4px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
dd { overflow: hidden; margin: 0; font: 500 12px/1.4 "DM Mono", monospace; text-overflow: ellipsis; }

.file-row { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 13px 14px; border: 1px solid var(--line); background: #f8faf8; }
.file-row > svg { color: var(--green); }
.file-row div { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.file-row strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.file-row span { color: var(--muted); font: 400 11px/1.5 "DM Mono", monospace; }

.progress-region { margin-top: 24px; }
.progress-labels { display: flex; justify-content: space-between; margin-bottom: 9px; font: 500 11px/1 "DM Mono", monospace; }
progress { display: block; width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 0; background: #e4e8e5; }
progress::-webkit-progress-bar { background: #e4e8e5; }
progress::-webkit-progress-value { background: var(--green); transition: width 180ms ease; }
progress::-moz-progress-bar { background: var(--green); }

.console-panel { display: flex; min-height: 100%; flex-direction: column; padding: 25px; color: white; background: var(--console); }
.console-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 17px; border-bottom: 1px solid #303a34; }
.console-header h2 { margin: 0; color: white; }
.console-kicker { color: #84b89f; }
.console-clear { color: #8ea098; }
.console-clear:hover { color: white; background: #263029; }
textarea { width: 100%; min-height: 380px; flex: 1; resize: none; border: 0; outline: 0; padding: 18px 0 0; color: var(--console-ink); background: transparent; font: 400 11px/1.65 "DM Mono", monospace; }

footer { display: flex; justify-content: space-between; gap: 20px; padding-top: 16px; color: var(--muted); font: 400 10px/1.5 "DM Mono", monospace; }

@media (max-width: 820px) {
  .shell { width: min(100% - 24px, 680px); padding-top: 26px; }
  .workspace { grid-template-columns: 1fr; }
  .console-panel { min-height: 360px; }
  textarea { min-height: 270px; }
}

@media (max-width: 560px) {
  .masthead { align-items: flex-start; flex-direction: column; }
  .connection-state { padding: 0; }
  .instruction { align-items: flex-start; }
  .driver-support { grid-template-columns: 1fr; }
  .driver-steps { grid-template-columns: 1fr; }
  .step { grid-template-columns: 42px 1fr; }
  .step-index { padding-top: 28px; }
  .step-body { padding: 24px 18px; }
  .step-heading { align-items: stretch; flex-direction: column; }
  .firmware-actions { flex-direction: column; }
  .button { width: 100%; }
  .device-details { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}
