:root {
    --bg: #000000;
    --surface: #171719;
    --surface-alt: #222226;
    --line: #2C2C2E;
    --text: #EFEADD;
    --muted: #6E6C66;

    --red: #C6472F;
    --blue: #2C3CC4;
    --yellow: #E9B23C;
    --green: #45A05B;

    --mono: 'Space Mono', ui-monospace, monospace;
    --display: 'Archivo Black', system-ui, sans-serif;

    --maxw: 62rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--mono);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--yellow); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
    font-family: var(--mono);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 0.05em 0.35em;
    font-size: 0.9em;
}

/* ---------- Header ---------- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 1.5rem 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand:hover { text-decoration: none; }
.brand-mark { height: 1.6rem; width: auto; }
.brand-word {
    font-family: var(--display);
    font-size: 1.5rem;
    letter-spacing: 0.02em;
    color: var(--text);
}
.site-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-nav a {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* ---------- Layout sections ---------- */
main > section {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 3.5rem 1.5rem;
    border-top: 1px solid var(--line);
}
main > section:first-child { border-top: 0; }

.section-label {
    font-family: var(--mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1.75rem;
}

/* ---------- Hero ---------- */
.hero {
    padding-top: 2.5rem;
    padding-bottom: 4rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    align-items: center;
}
@media (min-width: 48rem) {
    .hero { grid-template-columns: 1.3fr 1fr; }
}
.hero h1 {
    font-family: var(--display);
    font-size: clamp(2rem, 5.5vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: -0.01em;
    color: var(--text);
}
.lead {
    margin-top: 1.5rem;
    font-size: 1.05rem;
    color: #cfcabd;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2.25rem; }

.hero-device { display: flex; justify-content: center; }
.hero-device img {
    width: 100%;
    max-width: 24rem;
    height: auto;
    display: block;
}

/* ---------- Situations ---------- */
.situation-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
}
.situation-list li {
    background: var(--bg);
    padding: 1.15rem 1.35rem;
    font-size: 0.98rem;
    color: var(--text);
}

/* ---------- Reason ---------- */
.reason p { max-width: 40rem; color: #b7b2a6; margin-bottom: 1rem; }
.reason .reason-punch {
    color: var(--text);
    font-size: 1.15rem;
    border-left: 3px solid var(--yellow);
    padding-left: 1rem;
    margin-bottom: 0;
}

/* ---------- How ---------- */
.how-intro { max-width: 40rem; color: #cfcabd; }
.how-intro strong { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    font-family: var(--mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.95rem;
    padding: 0.9rem 1.6rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--yellow); color: #000; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--text); }
.btn-lg { font-size: 1.05rem; padding: 1.1rem 2rem; }

/* ---------- Install steps ---------- */
.steps {
    margin: 2rem 0;
    padding-left: 1.6rem;
    max-width: 40rem;
    color: #b7b2a6;
}
.steps li { margin-bottom: 0.9rem; padding-left: 0.35rem; }
.steps li:last-child { margin-bottom: 0; }
.steps strong { color: var(--text); }
.steps li::marker { color: var(--yellow); font-weight: 700; }

.install-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 8px solid var(--yellow);
    padding: 2rem;
    margin: 1.5rem 0;
}
.install-fineprint {
    margin-top: 1rem;
    font-size: 0.82rem;
    color: var(--muted);
}
.install-note {
    display: block;
    font-size: 0.9rem;
    color: #b7b2a6;
}
.install-note--warn { color: var(--yellow); }

esp-web-install-button {
    --esp-tools-button-color: var(--yellow);
    --esp-tools-button-text-color: #000;
    --esp-tools-button-border-radius: 0;
}

.troubleshoot {
    border: 1px solid var(--line);
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
}
.troubleshoot summary {
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.82rem;
    color: var(--muted);
}
.troubleshoot summary:hover { color: var(--text); }
.troubleshoot ul { margin: 1rem 0 0.25rem 1.2rem; display: grid; gap: 0.5rem; }
.troubleshoot li { font-size: 0.9rem; color: #b7b2a6; }

/* ---------- Open source ---------- */
.open-source p { max-width: 40rem; color: #b7b2a6; margin-bottom: 0.9rem; }
.open-source p:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */
.site-footer {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
    border-top: 1px solid var(--line);
    text-align: center;
}
.site-footer .brand-mark { height: 1.4rem; margin-bottom: 1rem; }
.site-footer p { font-size: 0.85rem; color: var(--muted); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.build-tag { margin-top: 0.75rem; font-size: 0.72rem; letter-spacing: 0.08em; }

/* ---------- Tool installer page ---------- */
.tools-main {
    max-width: 44rem;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 1.75rem;
}
.panel.disabled { opacity: 0.45; pointer-events: none; }
#connection-panel {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 8px solid var(--red);
    flex-wrap: wrap;
}
#connection-panel.connected { border-left-color: var(--green); }
.status-indicator {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--red); flex: none;
}
.connected .status-indicator { background: var(--green); }
#status-text { flex: 1 1 8rem; font-size: 1.1rem; }
#upload-panel { border-left: 8px solid var(--blue); }
.drop-zone {
    border: 2px dashed var(--muted);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--yellow); background: var(--surface-alt); }
.drop-zone p { font-size: 1.1rem; }
.drop-zone .small-text { font-size: 0.85rem; color: var(--muted); margin-top: 0.75rem; }
.hidden { display: none !important; }
#progress-container { margin-top: 1.5rem; }
.progress-bar { width: 100%; height: 20px; background: var(--surface-alt); overflow: hidden; margin: 0.75rem 0; }
.progress-fill { height: 100%; width: 0; background: var(--green); transition: width 0.2s; }
.console {
    background: var(--bg);
    border: 1px solid var(--line);
    height: 12rem;
    overflow-y: auto;
    padding: 0.9rem;
    font-size: 0.82rem;
    color: var(--muted);
    white-space: pre-wrap;
    word-break: break-word;
}
.log-info { color: var(--text); }
.log-success { color: var(--green); }
.log-error { color: var(--red); }
.back-link {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    color: var(--muted);
}
