.spacer {
  height: 10px;
}
:root {
  --bg: #0b0f0c;
  --surface: #101813;
  --surface-2: #111d16;
  --surface-3: #16241c;
  --text: #e8efe9;
  --muted: #9db3a5;
  --accent: #ff7a00;
  --accent-2: #1f7a53;
  --warn: #f59e0b;
  --border: #1a2a21;
  --ring: #2c3f34;
  --btn: #132017;
  --btn-hover: #192a21;
  --code: #111b15;
  font-family: var(--font-sans);
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(16, 24, 19, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.brand:hover {
  opacity: 0.85;
}

@media (max-width: 720px) {
  .appbar {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
  }

  .nav {
    gap: 2px;
    margin-left: -8px;
  }

  .nav-link {
    padding: 8px 8px;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
  }
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: transparent;
}

.brand-name {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 4vw, 1.22rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tg-cream);
}

.nav {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-link {
  position: relative;
  padding: 10px 14px;
  border: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.18s ease;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  color: var(--tg-cream);
  background: rgba(255, 122, 0, 0.06);
}

.nav-link.active::after {
  transform: scaleX(1);
}

.panel-hidden {
  display: none !important;
}

.wrap {
  max-width: 964px;
  margin: 0 auto;
  padding: 28px 32px 56px;
  display: grid;
  gap: 20px;
}

@media (max-width: 640px) {
  .wrap {
    padding: 22px 18px 56px;
  }
}

.setup-loading {
  margin: 40px 0;
  color: var(--muted);
}

.hero {
  padding: 0;
}

.hero-grid {
  display: grid;
  gap: 18px;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr);
  }
}

.hero-card {
  padding: 0;
  display: grid;
  gap: 24px;
}

.hero-card.primary {
  background: transparent;
}

.hero-card.secondary {
  background: var(--surface-2);
  border-color: var(--ring);
}

.hero-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.2vw, 2.3rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  line-height: 1.12;
  color: var(--tg-cream);
}

.hero-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.hero-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  font-weight: 500;
}

.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
  color: var(--muted);
  font-weight: 500;
}

.checklist.ordered {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
  margin-top: 16px;
}

.checklist.ordered li {
  color: var(--text);
  font-weight: 500;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 14px;
  line-height: 1.6;
}

/* Numbered steps use the setup-guide circle style: a filled orange disc
   with the step number, matching the guide's "Powering up" steps. */
.checklist.ordered li::before {
  counter-increment: step;
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  color: #0b0f0c;
  font-weight: 700;
  font-size: 0.95rem;
  flex: none;
  /* center the disc on the first line of the step text
     (list item is 1rem with line-height 1.6 => first line is 1.6rem tall) */
  margin-top: calc((1.6rem - 32px) / 2);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.meta-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 1rem;
  color: var(--text);
}

.meta-item span:last-child {
  font-weight: 600;
}

#fw-version,
#fw-date {
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.version-header small {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--btn);
  border: 1px solid var(--ring);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.08s ease, background 0.18s ease;
}

.btn:hover {
  background: var(--btn-hover);
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.note {
  background: var(--surface-3);
  border: 1px solid var(--ring);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.note.warn {
  border-color: var(--warn);
  color: #fcd34d;
}

.note.info {
  border-color: var(--accent-2);
  color: #8fe0b7;
}

.note-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: inherit;
  display: grid;
  gap: 8px;
}

.note-list li {
  list-style: disc;
  color: inherit;
  font-weight: 500;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--ring);
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 10px;
}

.card {
  padding: 0;
  display: grid;
  gap: 16px;
}

.card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  line-height: 1.15;
  color: var(--tg-cream);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.download-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.download-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--ring);
  border-radius: 14px;
}

.download-list li + li {
  margin-top: 12px;
}

.version-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-header small {
  color: var(--muted);
  font-size: 0.8rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: capitalize;
  margin-top: 4px;
  width: fit-content;
}

.tag-latest {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--ring);
}

.tag-variant {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--ring);
}

.version-notes {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  flex-basis: 100%;
  display: grid;
  gap: 2px;
}

.version-notes p {
  margin: 0;
}

.version-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

.inline-install {
  display: inline-block;
}

.btn.secondary {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.btn.secondary:hover {
  background: var(--btn-hover);
}

.inline-warning {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.install-block {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.install-block .flasher-console-wrap {
  margin-top: 22px;
}

.install-block .note {
  margin-top: 10px;
}

.console-advanced-actions .btn {
  width: 100%;
  justify-content: center;
}

/* Factory Reset toggle states */
.btn.factory-no {
  border-color: #ef4444;
  box-shadow: 0 0 0 1px #ef4444 inset;
  color: #fca5a5;
}

.btn.factory-yes {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-2) inset;
  color: #8fe0b7;
}

/* Version selector section */
.version-select-section {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.version-select-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.version-select-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
}

.version-select-row .btn {
  width: 100%;
  justify-content: center;
}

/* Divider between version selector and console */
.console-divider {
  margin: 0;
  border: none;
  border-top: 1px solid var(--ring);
}

.version-select {
  padding: 10px 12px;
  border: 1px solid var(--ring);
  border-radius: 12px;
  background: var(--btn);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239db3a5' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.version-select:hover {
  background-color: var(--btn-hover);
}

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

.version-select option {
  background: var(--surface);
  color: var(--text);
}

.install-main-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
}

.install-main-row .btn {
  width: 100%;
  justify-content: center;
}

/* Main action row buttons — taller than default */
.install-main-row .btn {
  padding: 14px 18px;
}

/* Advanced action buttons inside console collapsible */
.console-advanced-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--ring);
}

/* Console toolbar — label + Copy Logs / Clear buttons above the log */
.flasher-console-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--ring);
}

.flasher-console-toolbar-title {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Status bar — single strip showing current state */
.status-bar {
  position: relative;
  margin: 0;
  justify-self: center;
  max-width: 720px;
  width: 100%;
  padding: 20px 44px;
  border-radius: 12px;
  border: 1px solid var(--ring);
  background: var(--surface-2);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

/* Indicator dots on both ends */
.status-bar::before,
.status-bar::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
  transition: background 0.2s, box-shadow 0.3s, opacity 0.2s;
}

.status-bar::before {
  left: 14px;
}

.status-bar::after {
  right: 14px;
}

.status-bar.waiting {
  color: var(--muted);
  border-color: var(--ring);
}

.status-bar.connected {
  color: #8fe0b7;
  border-color: var(--accent-2);
  background: rgba(31, 122, 83, 0.12);
}

.status-bar.flashing {
  color: #93c5fd;
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

/* Pulsing glow on indicator dots during active operations */
.status-bar.flashing::before,
.status-bar.flashing::after {
  opacity: 1;
  animation: dot-pulse 1.2s ease-in-out infinite;
}

.status-bar.erasing {
  color: #fcd34d;
  border-color: var(--warn);
  background: rgba(245, 158, 11, 0.1);
}

.status-bar.erasing::before,
.status-bar.erasing::after {
  opacity: 1;
  animation: dot-pulse 1.2s ease-in-out infinite;
}

.status-bar.installed {
  color: #8fe0b7;
  border-color: var(--accent-2);
  background: rgba(31, 122, 83, 0.18);
}

.status-bar.installed::before,
.status-bar.installed::after {
  opacity: 1;
}

.status-bar.erased {
  color: #fcd34d;
  border-color: var(--warn);
  background: rgba(245, 158, 11, 0.12);
}

.status-bar.failed {
  color: #fca5a5;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.status-bar.failed::before,
.status-bar.failed::after {
  opacity: 1;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.flasher-console-wrap {
  border: 1px solid var(--ring);
  border-radius: 12px;
  overflow: hidden;
  background: var(--code);
}

/* Collapsible <details> — hide default triangle */
details.flasher-console-wrap > summary {
  list-style: none;
  cursor: pointer;
}

details.flasher-console-wrap > summary::-webkit-details-marker {
  display: none;
}

.flasher-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ring);
  user-select: none;
}

details.flasher-console-wrap:not([open]) .flasher-console-header {
  border-bottom: none;
}

.flasher-console-title {
  font-size: 0.85rem;
  color: var(--muted);
}

.console-chevron {
  display: inline-flex;
  margin-right: 8px;
  transition: transform 0.15s ease;
}

details.flasher-console-wrap[open] .console-chevron {
  transform: rotate(90deg);
}

.flasher-console-actions {
  display: flex;
  gap: 6px;
}

.btn-console {
  padding: 4px 10px;
  border: 1px solid var(--ring);
  border-radius: 6px;
  background: var(--btn);
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-console:hover {
  background: var(--btn-hover);
  color: var(--text);
}

.flasher-console {
  margin: 0;
  min-height: 220px;
  max-height: 320px;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.45;
  color: #b9d5c2;
}

.code-block {
  margin: 0;
  background: var(--code);
  border: 1px solid var(--ring);
  border-radius: 12px;
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 24px 18px;
  border-top: 1px solid var(--border);
  background: rgba(16, 24, 19, 0.85);
  font-size: 0.85rem;
  color: var(--muted);
}

.footer a {
  color: var(--accent);
}

.footer-variant {
  width: 100%;
}

.footer-variant[hidden] {
  display: none;
}

.footer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.footer-guide {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px 28px;
  flex-wrap: wrap;
  text-align: left;
}

.footer-guide-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-guide-brand img {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.footer-guide-title {
  font-weight: 600;
  color: var(--text);
}

.footer-guide-contact {
  color: #8ba295;
  font-size: 0.92rem;
  margin-top: 8px;
}

.footer-guide-contact a {
  color: var(--accent);
}

.footer-guide-note {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #8ba295;
}

@media (max-width: 640px) {
  .footer-guide-note {
    margin-left: 0;
  }
}

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

esp-web-install-button[install-supported] .install-button {
  display: block;
}

esp-web-install-button[install-unsupported] .install-button {
  display: none;
}

.troubleshooting-panel {
  display: grid;
  gap: 16px;
}

.troubleshooting-panel .muted {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.55;
}

.troubleshooting-panel .eyebrow {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.troubleshooting-panel .troubleshooting-checklist {
  margin: 0 0 16px;
  padding-left: 22px;
  list-style: disc;
  display: grid;
  gap: 10px;
  line-height: 1.5;
  color: var(--text);
}

.troubleshooting-panel .option-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.troubleshooting-panel #questionTitle {
  margin-bottom: 18px;
}

.troubleshooting-panel .option-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: var(--surface-2);
}

.troubleshooting-panel .row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.troubleshooting-panel .result-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.troubleshooting-panel .result-block h3 {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #a9c6b3;
  margin-bottom: 8px;
}

.troubleshooting-panel .result-block p {
  margin: 0;
  line-height: 1.55;
}

.troubleshooting-panel #resultActions {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.troubleshooting-panel .hidden {
  display: none;
}

.troubleshooting-panel .footnote {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.troubleshooting-panel .result-support-note {
  margin-top: 30px;
}

.troubleshooting-panel #resultScreen .row {
  margin-top: 16px;
}

.troubleshooting-panel .support-form-wrap {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.troubleshooting-panel .support-form {
  display: grid;
  gap: 8px;
}

.troubleshooting-panel .support-form label {
  font-size: 0.88rem;
  color: var(--muted);
}

.troubleshooting-panel .support-form input,
.troubleshooting-panel .support-form textarea {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--ring);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
}

.troubleshooting-panel .support-form input:focus,
.troubleshooting-panel .support-form textarea:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.troubleshooting-panel .support-form textarea[readonly] {
  background: #0f1712;
  color: var(--muted);
  cursor: default;
}

@media print {
  .appbar,
  .footer {
    display: none;
  }
}

