@font-face {
  font-family: "Instrument Sans";
  src: url("./instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f5f7f3;
  --card: #fff;
  --ink: #203e40;
  --muted: #586c6c;
  --green: #176e67;
  --line: #dce5e1;
  --soft: #edf5f0;
  --radius: 16px;
  font-family: "Instrument Sans", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--green); text-underline-offset: .22em; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 3px solid #65a99e; outline-offset: 4px; }
.shell { width: min(1040px, calc(100% - 56px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.header-inner { min-height: 86px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); line-height: 1.2; }
.brand img { display: block; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; font-size: 12px; color: var(--muted); }
.header-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px 18px; }
.header-link { font-size: 14px; font-weight: 650; text-decoration: none; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .55fr); align-items: center; gap: clamp(16px, 4vw, 40px); padding: 38px 0 27px; }
.eyebrow { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 13px; font-size: clamp(34px, 4.5vw, 48px); font-weight: 700; letter-spacing: -.045em; line-height: 1.13; }
.intro { max-width: 515px; margin: 0; font-size: 16px; line-height: 1.58; color: var(--muted); }
.intro strong { color: var(--ink); }
.hero-product { width: min(100%, 246px); margin: 0; justify-self: end; padding: 12px; border: 1px solid #d4e6df; border-radius: 15px; background: #e6f3ed; }
.hero-product img { display: block; width: 100%; height: auto; }

.installer, .step-panel { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: var(--radius); padding: clamp(18px, 3.2vw, 30px); box-shadow: 0 4px 24px #173c3107; }
.installer-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 11px; }
.installer-heading .eyebrow { margin: 0; }
h2 { font-size: clamp(21px, 3.1vw, 28px); line-height: 1.2; letter-spacing: -.036em; margin: 0; }
.version { background: #f3f5f3; border-radius: 99px; color: var(--muted); padding: 5px 10px; font-size: 12px; font-weight: 650; }
.targets { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
.target { position: relative; display: flex; align-items: center; gap: 13px; min-width: 0; padding: 15px; border-radius: 14px; border: 1px solid var(--line); background: #ffffff80; cursor: pointer; }
.target:hover { border-color: #8eb1a5; }
.target:has(input:checked) { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: var(--soft); }
.target:has(input:focus-visible) { outline: 3px solid #65a99e; outline-offset: 3px; }
.target:has(input:disabled) { cursor: default; }
.target input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.target-icon { flex: 0 0 41px; width: 41px; height: 41px; display: grid; place-items: center; color: var(--muted); background: #e5ece7; border-radius: 11px; }
.target:has(input:checked) .target-icon { background: var(--green); color: white; }
.target-icon svg { width: 22px; height: 22px; }
.target-text { min-width: 0; display: grid; gap: 2px; }
.target-text strong { font-size: 16px; line-height: 1.15; }
.target-text small { color: var(--muted); font-size: 13px; }
.target-select { margin-left: auto; flex: 0 0 16px; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #a2ae9d; }
.target:has(input:checked) .target-select { border: 5px solid var(--green); background: white; }
.preparation { margin: 13px 0 17px; }
.guide-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; }
.firmware-tag { color: var(--green); white-space: nowrap; font-family: ui-monospace, Consolas, monospace; font-size: 11px; margin: 2px 0 0; }
.guide-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .46fr); align-items: center; gap: 14px clamp(16px, 4vw, 42px); }
.guide-grid > ol { margin-block: 0; }
.guide-grid > ol li + li { margin-top: 6px; }
.guide-figure { width: min(100%, 288px); min-width: 0; margin: 0; justify-self: end; padding: 8px; border: 1px solid #d4e6df; border-radius: 12px; background: #e6f3ed; }
.guide-figure-peach { background: #fff0e7; border-color: #f3dfd1; }
.guide-photo { position: relative; overflow: hidden; border-radius: 7px; }
.guide-photo img { display: block; width: 100%; height: auto; }
.guide-figure figcaption { margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 650; text-align: center; }
.wifi-button-mark { --mark-x: 78.12%; --mark-y: 76.3%; --mark-size: 6.2%; }
.radio-button-mark { --mark-x: 80.1%; --mark-y: 50%; --mark-size: 8.3%; }
.photo-marker {
  position: absolute;
  left: var(--mark-x);
  top: var(--mark-y);
  width: var(--mark-size);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid #ffd75e;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #26382a, inset 0 0 0 1px #26382a;
  pointer-events: none;
}
.montage-guide { margin-top: 16px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.button { min-height: 44px; display: inline-flex; gap: 9px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 9px; padding: 10px 15px; line-height: 1.25; font-size: 14px; font-weight: 700; text-decoration: none; }
.button.primary { color: white; background: var(--green); }
.button.primary:not(:disabled):hover { background: #10564f; }
.button.secondary { color: var(--green); border-color: var(--line); background: var(--card); }
.button.secondary:not(:disabled):hover { background: var(--soft); }
.download-link { font-size: 14px; font-weight: 650; margin-left: 6px; }
.download-link span { padding-left: 3px; }
.notice, .status, .post-install { border-radius: 10px; margin: 0 0 14px; padding: 11px 13px; font-size: 14px; line-height: 1.5; background: #f7efd8; color: #5d481d; }
.status, .post-install { margin: 14px 0 0; background: var(--soft); color: var(--green); }
.status[data-kind="error"] { color: #842d24; background: #faece7; }
.status[data-kind="ok"] { color: #224b31; background: #e9f1df; }
.progress-area { margin-top: 15px; }
.progress-label { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 650; margin-bottom: 5px; }
progress { width: 100%; height: 10px; accent-color: #3e7650; }

.next-controls { margin-top: 13px; }
.step-panel { margin-top: 17px; scroll-margin-top: 16px; }
.step-wifi { border-top-color: #c48e69; }
.step-ha { border-top-color: #5d87a6; }
.step-heading { display: flex; align-items: center; gap: 13px; }
.step-number { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 35px; border-radius: 50%; color: var(--green); background: var(--soft); font-weight: 700; }
.step-wifi .step-number { color: #87502f; background: #fdf0e6; }
.step-ha .step-number { color: #285974; background: #eef5f9; }
.mqtt-guide { margin-block: 17px 20px; }
.mqtt-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-width: 0; padding: 0; margin: 0 0 10px; border: 0; }
.mqtt-options legend { margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 700; }
.mqtt-options .target { gap: 8px; padding: 12px; min-height: 48px; }
.mqtt-options .target-text strong { font-size: 14px; line-height: 1.3; }
.mqtt-instructions { display: none; padding: 13px 15px; border: 1px solid #d4e6df; border-radius: 11px; background: #e6f3ed; color: var(--ink); font-size: 14px; line-height: 1.58; }
.mqtt-guide:has(input[value="existing"]:checked) #mqtt-existing,
.mqtt-guide:has(input[value="automatic"]:checked) #mqtt-automatic,
.mqtt-guide:has(input[value="manual"]:checked) #mqtt-manual { display: block; }
#mqtt-automatic { background: #eaf2ff; border-color: #dce3f4; }
#mqtt-manual { background: #fff0e7; border-color: #f3dfd1; }
.mqtt-instructions p { margin-bottom: 10px; }
.mqtt-instructions p:last-child { margin-bottom: 0; }
.short-steps { margin: 12px 0 14px; padding-left: 1.4em; color: var(--muted); line-height: 1.65; font-size: 15px; }
.short-steps li + li { margin-top: 3px; }
.short-steps strong { color: var(--ink); }
.lower-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; align-items: start; margin-top: 12px; }
.config-text .short-steps { margin-top: 0; }
.app-store-link { margin: 8px 0 10px; }
.config-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.config-example { min-width: 0; }
.config-example label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.config-example input { width: 100%; border: 1px solid #cbdad2; background: white; color: var(--ink); border-radius: 8px; min-height: 42px; padding: 9px 11px; }
.config-example input[aria-invalid="true"] { border-color: #b34035; }
.field-hint { color: var(--muted); font-size: 12px; margin: 6px 0 10px; }
.ip-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.ip-input-row:has(input[aria-invalid="true"]) + .field-hint { color: #9a3329; }
.code { overflow: hidden; border: 1px solid var(--line); background: #f3f7f4; color: var(--ink); border-radius: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.code-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 13px; border-bottom: 1px solid var(--line); }
.code-header button { background: white; color: var(--green); border: 1px solid #cbdad2; padding: 5px 8px; border-radius: 6px; }
.code-header button:hover { background: var(--soft); }
.code pre { margin: 0; padding: 11px 13px; line-height: 1.6; overflow: auto; }
.reset-panel, .help-panel { border-top: 1px solid var(--line); margin-top: 16px; font-size: 14px; }
.reset-panel summary, .help-panel summary { padding: 13px 0 0; font-weight: 700; cursor: pointer; color: var(--green); }
.help-panel p { color: var(--muted); margin: 10px 0; line-height: 1.55; }
.help-panel .config-links a { font-size: 13px; }
.help-panel .code + .config-links { margin-top: 10px; }
.reset-body { padding: 1px 2px 16px; line-height: 1.5; color: var(--muted); }
.reset-body p:first-child { margin-top: 10px; }
.reset-body p { margin-bottom: 9px; }
.reset-body .status { margin-bottom: 0; }
.wifi-setup-button { display: flex; margin-top: 8px; }
.wifi-form-panel { margin-top: 22px; padding: clamp(16px, 3vw, 23px); border: 1px solid var(--line); border-radius: 12px; background: #f3f7f4; }
.wifi-form-panel h3 { margin: 0; font-size: 19px; line-height: 1.3; }
.wifi-setup-guide { margin: 10px 0 16px; }
.wifi-form-panel .short-steps { margin-block: 8px 15px; font-size: 14px; }
.wifi-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin-bottom: 8px; }
.wifi-form-panel .config-example > .field-hint { margin: 8px 0 0; }
.wifi-form-panel .wifi-fallback { margin-bottom: 0; }
.step-wifi .short-steps .field-hint { font-size: 13px; margin: 6px 0 8px; }
.step-wifi .short-steps .status { margin: 8px 0 0; }
.driver-help { color: var(--muted); font-size: 14px; margin: 0; }
.step-wifi > .driver-help { margin-top: 12px; }
.wifi-credentials { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 22px; padding: 13px; background: var(--soft); margin-top: 12px; border-radius: 10px; }
.wifi-credentials dl { display: flex; flex-wrap: wrap; gap: 9px 22px; margin: 0; }
.wifi-credentials dt { font-size: 12px; color: var(--muted); }
.wifi-credentials dd { margin: 3px 0 0; font-family: ui-monospace, Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding-block: 20px 25px; font-size: 13px; color: var(--muted); }
.footer a { font-weight: 650; }

dialog { width: min(460px, calc(100% - 30px)); padding: 24px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--card); box-shadow: 0 20px 70px #10261944; }
dialog::backdrop { background: #13291db5; }
dialog p { margin: 12px 0 19px; color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }

@media (max-width: 690px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 61px; }
  .header-link { font-size: 12px; }
  .hero { grid-template-columns: 1fr; gap: 17px; padding: 30px 0 22px; }
  .hero-product { max-width: 208px; justify-self: start; }
  .guide-grid { grid-template-columns: minmax(0, 1fr); }
  .guide-grid > .guide-figure { grid-row: 1; width: min(100%, 242px); justify-self: start; }
  .lower-panel { grid-template-columns: 1fr; gap: 15px; }
  .wifi-form-fields { grid-template-columns: 1fr; }
  .mqtt-options { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  .targets { grid-template-columns: 1fr; gap: 8px; }
  .target { padding: 10px; }
  .installer-heading { align-items: flex-start; }
}

.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.language-picker { position: relative; flex: none; z-index: 2; }
.language-picker summary { display: grid; place-items: center; width: 36px; height: 36px; cursor: pointer; list-style: none; border-radius: 8px; }
.language-picker summary::-webkit-details-marker { display: none; }
.language-picker img { display: block; border-radius: 2px; object-fit: fill; box-shadow: 0 0 0 1px #203e4033; }
.language-picker ul { position: absolute; inset-inline-end: 0; margin: 6px 0 0; padding: 4px; min-width: 146px; list-style: none; border: 1px solid var(--line); border-radius: 10px; background: var(--card); box-shadow: 0 5px 18px #203e4026; }
.language-picker a { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.language-picker summary:hover, .language-picker a:hover, .language-picker a[aria-current] { background: var(--soft); }
.language-picker a[aria-current] { font-weight: 700; }
