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

:root {
    --bg: #1a1a2e;
    --surface: #16213e;
    --border: #0f3460;
    --text: #e0e0e0;
    --text-dim: #8892a4;
    --primary: #4a9eff;
    --success: #4caf50;
    --danger: #e74c3c;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

h1 { font-size: 1.8rem; margin-bottom: 0.25rem; }
.brand-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}
.brand-logo {
    width: 34px !important;
    height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    object-fit: contain;
    flex: 0 0 34px;
    display: block;
}
.subtitle { color: var(--text-dim); margin-bottom: 2rem; }
.build-info {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: -1.25rem;
    margin-bottom: 1.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    border-left: 3px solid var(--border);
    padding-left: 0.6rem;
}

.board-select {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}

.board-select label { font-weight: 600; white-space: nowrap; }

.board-select select,
.board-select input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
}

.board-select input::placeholder {
    color: var(--text-dim);
}

.password-row {
    flex: 1;
    display: flex;
    gap: 0.6rem;
}

.password-row input {
    flex: 1;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.45rem;
    color: var(--text);
}

.checkbox-row input {
    accent-color: var(--success);
}

.wifi-note {
    color: var(--text-dim);
    font-size: 0.83rem;
    margin-bottom: 0.5rem;
}

.advanced-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    margin-bottom: 1.25rem;
}

/* Step 2: WiFi setup (post-flash) */
.step-wifi, .step-done {
    animation: fadeSlideIn 0.35s ease-out;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.step-wifi-header, .step-done-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.step-wifi-header h2, .step-done-header h2 {
    font-size: 1.4rem;
    margin-bottom: 0.4rem;
}

.step-wifi-header p, .step-done-header p {
    color: var(--text-dim);
    font-size: 0.95rem;
}

.step-wifi-icon, .step-done-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.form-divider {
    border: none;
    border-top: 1px solid color-mix(in srgb, var(--success) 25%, var(--border));
    margin: 0.6rem 0 0.8rem;
}

.wifi-form {
    border: 1px solid color-mix(in srgb, var(--success) 45%, var(--border));
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 85%, #113018);
    padding: 1.2rem 1rem 0.8rem;
    margin-bottom: 1.25rem;
}

.advanced-panel > summary {
    cursor: pointer;
    padding: 0.65rem 0.85rem;
    color: var(--text-dim);
    user-select: none;
}

.advanced-body {
    border-top: 1px solid var(--border);
    padding: 0.8rem 0.85rem 0.2rem;
}

.board-select.compact {
    margin-bottom: 0.7rem;
}

.release-details {
    border-top: 1px solid var(--border);
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    font-size: 0.83rem;
    color: var(--text-dim);
}

.actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:hover:not(:disabled) { opacity: 0.85; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.secondary { background: #2e3a57; color: var(--text); }

.progress-section { margin-bottom: 0.7rem; }

.progress-bar {
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.15s;
}

.progress-text { color: var(--text-dim); font-size: 0.9rem; }
.status-text {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    min-height: 1.4rem;
}

.info {
    color: var(--text-dim);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}
.info p { margin-bottom: 0.25rem; }

@media (max-width: 480px) {
    .container { padding: 1.25rem 1rem; }
    h1 { font-size: 1.4rem; }
    .actions { flex-direction: column; }
    .btn { width: 100%; }
}
