@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Noto+Sans+SC:wght@400;500;600;700;900&display=swap");

:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #65716b;
  --paper: #f4efe6;
  --card: rgba(255, 253, 248, 0.82);
  --line: rgba(23, 33, 29, 0.14);
  --orange: #e8612c;
  --orange-dark: #c94318;
  --green: #286050;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 33, 29, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 29, 0.032) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Noto Sans SC", system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .25;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.15'/%3E%3C/svg%3E");
}

.ambient { position: fixed; width: 42rem; height: 42rem; border-radius: 50%; filter: blur(2px); pointer-events: none; opacity: .38; }
.ambient-one { top: -25rem; right: -8rem; background: radial-gradient(circle, #f2a077 0, transparent 68%); }
.ambient-two { bottom: -28rem; left: -17rem; background: radial-gradient(circle, #9db8a4 0, transparent 68%); }

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: auto;
  padding: 28px 32px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 900; letter-spacing: -.6px; }
.brand > span:last-child span { color: var(--orange); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px 9px 9px 3px; color: #fff; background: var(--orange); transform: rotate(-3deg); }
.brand-mark svg { width: 24px; fill: currentColor; transform: rotate(3deg); }
.top-status { display: flex; align-items: center; gap: 9px; font: 500 11px "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.top-status span { width: 7px; height: 7px; border-radius: 50%; background: #42a06e; box-shadow: 0 0 0 4px rgba(66, 160, 110, .12); }

main { position: relative; z-index: 1; display: grid; grid-template-columns: 1.04fr .96fr; column-gap: 86px; max-width: 1120px; margin: 0 auto; padding: 96px 32px 62px; }
.hero { align-self: center; padding-bottom: 28px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font: 500 12px "DM Mono", monospace; letter-spacing: .12em; color: var(--muted); }
.eyebrow span { padding: 6px 9px; border: 1px solid rgba(232, 97, 44, .35); border-radius: 4px; color: var(--orange-dark); background: rgba(232, 97, 44, .08); }
h1 { margin: 0; font-size: clamp(54px, 6.2vw, 82px); line-height: 1.02; letter-spacing: -.07em; font-weight: 900; }
h1 em { color: var(--orange); font-style: normal; }
.intro { max-width: 520px; margin: 28px 0 36px; color: var(--muted); font-size: 17px; line-height: 1.85; }
.action-block { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 13px; }
esp-web-install-button { display: block; min-width: 260px; }
.install-button { display: flex; align-items: center; justify-content: center; gap: 11px; width: 100%; min-height: 58px; padding: 0 25px; border: 0; border-radius: 6px 6px 6px 2px; color: #fff; background: var(--orange); box-shadow: 0 12px 28px rgba(183, 65, 22, .21); font: 700 15px "Noto Sans SC", sans-serif; cursor: pointer; transition: transform .2s, background .2s, box-shadow .2s; }
.install-button:hover { transform: translateY(-2px); background: var(--orange-dark); box-shadow: 0 16px 32px rgba(183, 65, 22, .27); }
.install-button:active { transform: translateY(0); }
.install-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
esp-web-install-button > span { display: block; max-width: 300px; padding: 13px 16px; border: 1px solid #d78668; border-radius: 5px; color: #8e3214; background: #fff2ec; font-size: 13px; line-height: 1.55; }
.support-note { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font: 400 11px "DM Mono", monospace; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: #42a06e; }
.pulse.bad { background: var(--orange); }

.port-help-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  border: 1px solid rgba(23, 33, 29, .16);
  border-radius: 8px 8px 8px 3px;
  background: #fffdf8;
  box-shadow: 0 30px 90px rgba(18, 29, 24, .26);
  font-family: "Noto Sans SC", system-ui, sans-serif;
}
.port-help-dialog::backdrop { background: rgba(20, 29, 25, .62); backdrop-filter: blur(5px); }
.port-help-head { display: flex; align-items: center; gap: 14px; padding: 24px 26px 20px; border-bottom: 1px solid var(--line); }
.port-help-head p { margin: 0 0 3px; color: var(--orange); font: 500 9px "DM Mono", monospace; letter-spacing: .17em; }
.port-help-head h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.port-help-icon { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; border-radius: 6px 6px 6px 2px; color: var(--orange); background: rgba(232, 97, 44, .1); }
.port-help-icon svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.port-help-close { margin-left: auto; padding: 4px 8px; color: var(--muted); border: 0; background: transparent; font: 300 28px/1 sans-serif; cursor: pointer; }
.port-help-body { padding: 22px 26px 24px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.port-help-body > p { margin: 0 0 14px; }
.port-help-body ol { margin: 0; padding-left: 1.4em; }
.port-help-body li { padding-left: 5px; }
.port-help-body li + li { margin-top: 8px; }
.port-help-body a { display: inline-block; margin-left: 4px; color: var(--orange-dark); font-weight: 600; text-underline-offset: 3px; }
.port-help-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 17px 26px; border-top: 1px solid var(--line); background: #f8f4ec; }
.dialog-button { min-height: 40px; padding: 0 17px; border-radius: 4px; font: 600 13px "Noto Sans SC", sans-serif; cursor: pointer; }
.dialog-button.secondary { color: var(--muted); border: 1px solid var(--line); background: transparent; }
.dialog-button.primary { color: #fff; border: 1px solid var(--orange); background: var(--orange); }
.dialog-button:hover { filter: brightness(.96); }

.device-card { position: relative; overflow: hidden; padding: 28px; border: 1px solid rgba(23, 33, 29, .13); border-radius: 8px 8px 8px 3px; background: var(--card); box-shadow: 0 26px 80px rgba(40, 49, 43, .1); backdrop-filter: blur(12px); }
.device-card::after { content: ""; position: absolute; right: -65px; top: -70px; width: 170px; height: 170px; border: 1px solid rgba(232, 97, 44, .15); border-radius: 50%; box-shadow: 0 0 0 24px rgba(232, 97, 44, .035), 0 0 0 48px rgba(232, 97, 44, .025); }
.card-head { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; }
.label, .section-title span { margin: 0 0 8px; color: var(--orange); font: 500 10px "DM Mono", monospace; letter-spacing: .18em; }
.card-head h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.chip { padding: 6px 9px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font: 500 10px "DM Mono", monospace; }
.board-visual { display: grid; place-items: center; height: 276px; margin: 26px 0; border: 1px solid rgba(23, 33, 29, .08); border-radius: 4px; background: radial-gradient(circle, rgba(232, 97, 44, .12), transparent 55%), #eee9df; }
.board { position: relative; width: 164px; height: 236px; border: 7px solid #183a33; border-radius: 8px; background: #245346; box-shadow: 0 21px 32px rgba(20, 47, 40, .26), inset 0 0 0 1px rgba(255,255,255,.1); transform: rotate(-5deg); }
.board::before, .board::after { content: ""; position: absolute; width: 10px; height: 10px; border: 2px solid #b7a988; border-radius: 50%; top: 9px; }
.board::before { left: 9px; } .board::after { right: 9px; }
.pin-row { position: absolute; top: 26px; bottom: 26px; width: 8px; background: repeating-linear-gradient(to bottom, #d3b873 0 5px, transparent 5px 11px); }
.pin-left { left: -13px; } .pin-right { right: -13px; }
.module { position: absolute; top: 38px; left: 22px; right: 22px; height: 128px; padding: 61px 10px 0; color: rgba(255,255,255,.8); border: 1px solid #a4a5a0; background: linear-gradient(135deg, #babbb6, #7b817e); text-align: center; }
.module-lines { position: absolute; inset: 10px 11px auto; height: 38px; border: 1px solid rgba(55,62,59,.42); background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(55,62,59,.42) 7px 8px); }
.module b { display: block; font: 500 12px "DM Mono", monospace; letter-spacing: .07em; }
.module small { font: 400 7px "DM Mono", monospace; }
.usb { position: absolute; width: 48px; height: 37px; bottom: -15px; left: 51px; border: 4px solid #767b78; border-radius: 3px; background: #c7c9c5; }
.led { position: absolute; right: 21px; bottom: 18px; width: 8px; height: 8px; border-radius: 50%; background: #f29c54; box-shadow: 0 0 9px #f29c54; }
.firmware-meta { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding-top: 20px; border-top: 1px solid var(--line); }
.firmware-meta div { padding: 0 13px; border-right: 1px solid var(--line); }
.firmware-meta div:first-child { padding-left: 0; } .firmware-meta div:last-child { border: 0; }
.firmware-meta dt { margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.firmware-meta dd { margin: 0; font: 500 11px "DM Mono", monospace; }

.steps { grid-column: 1 / -1; margin-top: 112px; padding-top: 50px; border-top: 1px solid var(--line); }
.section-title h2 { margin: 0; font-size: 30px; letter-spacing: -.045em; }
.steps ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin: 38px 0 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 17px; }
.steps li > b { color: var(--orange); font: 500 11px "DM Mono", monospace; padding-top: 4px; }
.steps h3 { margin: 0 0 8px; font-size: 15px; }
.steps p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.notice { grid-column: 1 / -1; display: flex; gap: 15px; margin-top: 58px; padding: 19px 22px; border: 1px solid rgba(232, 97, 44, .23); border-radius: 5px; background: rgba(255, 249, 241, .6); }
.notice svg { flex: 0 0 auto; width: 21px; fill: none; stroke: var(--orange); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.notice strong { font-size: 13px; }
.notice p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
footer { position: relative; z-index: 1; display: flex; justify-content: space-between; max-width: 1180px; margin: auto; padding: 24px 32px 30px; border-top: 1px solid var(--line); color: var(--muted); font: 400 9px "DM Mono", monospace; letter-spacing: .12em; }

@media (max-width: 850px) {
  main { grid-template-columns: 1fr; gap: 58px; padding-top: 64px; }
  .hero { text-align: center; }
  .intro { margin-left: auto; margin-right: auto; }
  .eyebrow, .action-block { align-items: center; justify-content: center; }
  .steps { margin-top: 24px; }
  .steps ol { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 520px) {
  .topbar { padding: 20px; }
  .top-status { font-size: 0; }
  main { padding: 52px 20px 42px; }
  h1 { font-size: 50px; }
  .intro { font-size: 15px; }
  .device-card { padding: 20px; }
  .board-visual { height: 250px; }
  .firmware-meta { grid-template-columns: 1fr; gap: 13px; }
  .firmware-meta div, .firmware-meta div:first-child { padding: 0 0 13px; border: 0; border-bottom: 1px solid var(--line); }
  .firmware-meta div:last-child { padding-bottom: 0; border: 0; }
  footer { padding: 22px 20px; }
  footer span:last-child { display: none; }
}

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