*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 420px at 85% -8%, rgba(124, 255, 107, 0.05), transparent 55%),
    linear-gradient(180deg, #141414 0%, var(--bg) 42%);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem 0 1.5rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-size: 0.9rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.page-home main {
  justify-content: center;
  padding: 0.5rem 0 1.5rem;
}

.page-flash main {
  gap: 1.25rem;
}

.hero {
  display: grid;
  gap: 1.25rem;
  align-items: stretch;
}

@media (min-width: 760px) {
  .hero {
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    align-items: center;
  }

  .page-flash .hero {
    align-items: stretch;
    flex: 1;
  }
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.85rem, 4.5vw, 2.55rem);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 34ch;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  transition:
    transform var(--dur) var(--ease-mech),
    background var(--dur) ease,
    border-color var(--dur) ease;
}

.btn:hover {
  text-decoration: none;
  border-color: #55554c;
}

.btn:active {
  transform: translateY(2px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: #5fd652;
  color: #102010;
}

.btn-primary:hover {
  background: #8fff7d;
  border-color: #8fff7d;
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem;
  min-width: 0;
}

.panel-raised {
  background: var(--raised);
}

.panel-label {
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.panel-foot {
  margin-top: auto;
  padding-top: 1rem;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.led {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.led-ok {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.led-pulse {
  animation: led-pulse 2.4s var(--ease-mech) infinite;
}

@keyframes led-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px var(--accent-dim);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 5px rgba(124, 255, 107, 0.08);
    opacity: 0.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  .led-pulse {
    animation: none;
  }
}

.led-warn {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 200, 87, 0.18);
}

.led-err {
  background: var(--error);
  box-shadow: 0 0 0 3px rgba(255, 92, 92, 0.18);
}

.meta-grid {
  display: grid;
  gap: 0.4rem 1rem;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

@media (min-width: 420px) {
  .meta-grid {
    grid-template-columns: auto 1fr;
  }
}

.meta-grid dt {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
}

.meta-grid dd {
  margin: 0;
  color: var(--text);
}

.device-module {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.65rem;
  height: 100%;
}

.device-module::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(124, 255, 107, 0.07), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 35%);
}

.device-module-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  height: 100%;
  min-height: 17rem;
  padding: 0.85rem 0.95rem 0.95rem;
  border: 1px dashed rgba(156, 156, 149, 0.28);
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 13px,
      rgba(255, 255, 255, 0.018) 13px,
      rgba(255, 255, 255, 0.018) 14px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 13px,
      rgba(255, 255, 255, 0.018) 13px,
      rgba(255, 255, 255, 0.018) 14px
    ),
    var(--raised);
}

.device-module-inner::before,
.device-module-inner::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(124, 255, 107, 0.45);
  pointer-events: none;
}

.device-module-inner::before {
  top: 6px;
  left: 6px;
  border-right: none;
  border-bottom: none;
}

.device-module-inner::after {
  right: 6px;
  bottom: 6px;
  border-left: none;
  border-top: none;
}

.device-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.device-status {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text);
}

.device-sku {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.device-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
}

.pin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pin {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.22rem 0.45rem;
  background: rgba(17, 17, 17, 0.55);
}

.device-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.device-sub {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.bus-line {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.bus-sep {
  color: rgba(124, 255, 107, 0.55);
}

.device-meta {
  margin-top: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.site-footer {
  flex-shrink: 0;
  margin-top: 1.75rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0 0 0.3rem;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

.mono {
  font-family: var(--font-mono);
}

.callout {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-left: 2px solid var(--amber);
  background: rgba(255, 200, 87, 0.06);
  color: var(--muted);
  font-size: 0.88rem;
}

.callout strong {
  color: var(--text);
}

.flash-intro {
  max-width: 40rem;
}

.flash-intro .lede {
  margin-bottom: 0;
  max-width: 46ch;
}

.field-label {
  display: block;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 55%,
    calc(100% - 11px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.select:focus {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.flash-install {
  margin: 0;
}

.flash-install[hidden] {
  display: none !important;
}

esp-web-install-button {
  display: block;
}

esp-web-install-button:not(:defined) {
  visibility: hidden;
}

esp-web-install-button[hidden] {
  display: none !important;
}

esp-web-install-button button,
esp-web-install-button .button,
.flash-install .btn {
  width: 100%;
}

.offset-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin: 0;
}

.offset-table th,
.offset-table td {
  text-align: left;
  padding: 0.45rem 0.2rem;
  border-bottom: 1px solid var(--border);
}

.offset-table th {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
}

.offset-table tr:last-child td {
  border-bottom: none;
}

.status-message {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.status-message.is-ok {
  color: var(--accent);
}

.status-message.is-err {
  color: var(--error);
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
