/* ═══════════════════════════════════════════════════════════
   guide.css — Build Guide module styles
   Uses existing design tokens from base.css
   ═══════════════════════════════════════════════════════════ */

/* ── Phase visibility ───────────────────────────────────── */
.guide-phase { padding: 0; }

/* ── Mode toggle (Browse / Edit) ────────────────────────── */
.guide-mode-toggle {
    display: flex;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}
.guide-mode-btn {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.guide-mode-btn.active {
    background: var(--bg-panel);
    color: var(--accent-red);
    box-shadow: var(--card-shadow);
}
.guide-mode-btn:hover:not(.active) { color: var(--text-main); }

/* ── Selection grid ─────────────────────────────────────── */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.guide-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: var(--card-shadow);
}
.guide-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.guide-card-thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 48px;
}
.guide-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.guide-card-body { padding: 16px; }
.guide-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}
.guide-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.guide-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
}
.guide-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Difficulty badges */
.difficulty-beginner { color: #22c55e; }
.difficulty-intermediate { color: #f59e0b; }
.difficulty-advanced { color: #ef4444; }

/* Empty state */
.guide-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.guide-empty-state h3 {
    margin-top: 12px;
    color: var(--text-main);
    font-size: 18px;
}
.guide-empty-state p { margin-top: 6px; font-size: 14px; }

/* ── Overview ───────────────────────────────────────────── */
.guide-overview-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.guide-back-btn { margin-bottom: 16px; font-size: 13px; }
.guide-overview-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}
.guide-overview-desc {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}
.guide-overview-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.guide-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-dark);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
}

/* Tools */
.guide-tools-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-tools-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.guide-tools-list li {
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-tools-list li::before {
    content: "\2022";
    color: var(--accent-red);
    font-weight: bold;
}

/* Checklist */
.guide-overview-checklist-area .glass-panel {
    padding: 20px 24px;
}
.guide-checklist-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-checklist { margin-bottom: 16px; }
.guide-checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}
.guide-checklist-item input[type="checkbox"] {
    accent-color: var(--accent-red);
    width: 16px;
    height: 16px;
}

/* Start section */
.guide-start-section { margin-top: 16px; }
.guide-start-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
}

/* ── Step transition animations ───────────────────────────── */
@keyframes stepFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

.guide-step-content.step-exiting {
    animation: stepFadeOut 0.15s ease-in forwards;
}

.guide-step-content.step-entering {
    animation: stepFadeIn 0.25s ease-out forwards;
}

/* Staggered entrance for child elements */
.guide-step-content.step-entering .guide-step-header       { animation: stepFadeIn 0.25s ease-out 0.05s both; }
.guide-step-content.step-entering .guide-step-title        { animation: stepFadeIn 0.25s ease-out 0.10s both; }
.guide-step-content.step-entering .guide-safety-warning:not(.hidden) { animation: stepFadeIn 0.25s ease-out 0.14s both; }
.guide-step-content.step-entering .guide-step-description  { animation: stepFadeIn 0.25s ease-out 0.18s both; }
.guide-step-content.step-entering .guide-media-carousel:not(.hidden),
.guide-step-content.step-entering .guide-stl-viewer:not(.hidden),
.guide-step-content.step-entering .guide-cli-section:not(.hidden) { animation: stepFadeIn 0.25s ease-out 0.22s both; }

.guide-runner-extras.step-entering {
    animation: stepFadeIn 0.25s ease-out 0.1s both;
}

/* Nav button press feedback */
.guide-runner-nav .btn:active {
    transform: scale(0.96);
    transition: transform 0.08s ease;
}

@media (prefers-reduced-motion: reduce) {
    .guide-step-content.step-entering,
    .guide-step-content.step-exiting,
    .guide-step-content.step-entering .guide-step-header,
    .guide-step-content.step-entering .guide-step-title,
    .guide-step-content.step-entering .guide-step-description,
    .guide-step-content.step-entering .guide-safety-warning,
    .guide-step-content.step-entering .guide-media-carousel,
    .guide-step-content.step-entering .guide-stl-viewer,
    .guide-step-content.step-entering .guide-cli-section,
    .guide-runner-extras.step-entering {
        animation: none !important;
    }
}

/* ── Runner ─────────────────────────────────────────────── */
.guide-progress-track {
    height: 4px;
    background: var(--bg-dark);
    border-radius: 2px;
    margin-bottom: 20px;
}
.guide-progress-bar {
    height: 100%;
    background: var(--accent-red);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.guide-runner-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Photo + Notes row below step content */
.guide-runner-extras {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
.guide-photo-panel { padding: 20px; }


/* Step header */
.guide-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.guide-step-number {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-red);
    text-transform: uppercase;
}
.guide-step-type-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    color: var(--text-muted);
}
.guide-step-time {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Step timer */
.guide-step-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.guide-timer-build,
.guide-timer-step {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}
.guide-timer-build {
    color: var(--accent-red);
    background: rgba(34, 211, 238, 0.08);
}
.guide-timer-step {
    color: var(--text-muted);
    background: var(--bg-dark);
}
.guide-timer-step.over-estimate {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

/* Estimate comparison in nav bar */
.guide-runner-nav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.guide-timer-estimate {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.guide-step-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
}

/* Safety warning */
.guide-safety-warning {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    color: #f59e0b;
    line-height: 1.5;
}
.guide-safety-warning i { font-size: 20px; flex-shrink: 0; margin-top: 1px; }

/* Step description — markdown rendered content */
.guide-step-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-main);
    margin-bottom: 20px;
}
.guide-step-description p { margin-bottom: 12px; }
.guide-step-description p:last-child { margin-bottom: 0; }
.guide-step-description strong { font-weight: 600; color: var(--text-main); }
.guide-step-description em { font-style: italic; }
.guide-step-description a {
    color: var(--accent-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.guide-step-description a:hover { color: var(--accent-red); }
.guide-step-description ul,
.guide-step-description ol {
    padding-left: 20px;
    margin-bottom: 12px;
}
.guide-step-description li { margin-bottom: 4px; }
.guide-step-description code {
    background: var(--bg-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}
.guide-step-description pre {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    overflow-x: auto;
    margin-bottom: 12px;
}
.guide-step-description pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Inline checklists */
.guide-step-checklist { margin-top: 12px; }
.guide-step-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
}
.guide-step-checklist-item:last-child { border-bottom: none; }
.guide-step-checklist-item input[type="checkbox"] {
    accent-color: var(--accent-red);
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
}
.guide-step-checklist-item.checked {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* ── Media Carousel ─────────────────────────────────────── */
.guide-media-carousel {
    position: relative;
    margin-bottom: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-dark);
    overflow: hidden;
}
.guide-media-viewport { overflow: hidden; width: 100%; }
.guide-media-track {
    display: flex;
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
}
.guide-media-slide {
    flex: 0 0 100%;
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 420px;
    overflow: hidden;
}
.guide-media-slide img {
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
    cursor: pointer;
}
.guide-media-slide iframe,
.guide-media-slide video {
    width: 100%;
    height: 420px;
    border: none;
}

/* Carousel arrows */
.guide-media-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}
.guide-media-carousel:hover .guide-media-arrow,
.guide-media-arrow:focus-visible { opacity: 1; }
.guide-media-arrow--prev { left: 8px; }
.guide-media-arrow--next { right: 8px; }
.guide-media-arrow:hover { background: rgba(0, 0, 0, 0.7); }

/* Dot indicators */
.guide-media-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.3));
}
.guide-media-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
}
.guide-media-dot.active {
    background: #fff;
    transform: scale(1.25);
}

/* Expand button */
.guide-media-expand {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}
.guide-media-carousel:hover .guide-media-expand { opacity: 1; }

/* Caption */
.guide-media-caption {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 6px 12px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
}
.guide-media-caption:empty { display: none; }

/* Hide arrows/dots when only 1 item */
.guide-media-carousel[data-count="1"] .guide-media-arrow,
.guide-media-carousel[data-count="1"] .guide-media-dots { display: none; }

/* ── Lightbox ──────────────────────────────────────────── */
#media-lightbox {
    background-color: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(12px);
}
.guide-lightbox-content {
    position: relative;
    width: 95vw;
    height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.guide-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}
.guide-lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }
.guide-lightbox-viewport {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.guide-lightbox-viewport img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
}
.guide-lightbox-viewport iframe,
.guide-lightbox-viewport video {
    width: 80vw;
    height: 75vh;
    border: none;
}
.guide-lightbox-arrow {
    position: absolute;
    top: 50%;
    opacity: 0.7;
}
.guide-lightbox-arrow:hover { opacity: 1; }
.guide-lightbox-caption {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
}
.guide-lightbox-caption:empty { display: none; }
.guide-lightbox-dots {
    position: absolute;
    bottom: 50px;
    background: none;
}

/* ── Editor media list ─────────────────────────────────── */
.guide-editor-media-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.guide-editor-media-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}
.guide-editor-upload-btn {
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.guide-editor-upload-btn.uploading {
    opacity: 0.5;
    pointer-events: none;
}
.guide-editor-media-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm, 4px);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* 3D viewer */
.guide-stl-viewer { margin-bottom: 20px; }
.guide-stl-canvas {
    width: 100%;
    height: 400px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-dark);
    overflow: hidden;
}

/* Betaflight CLI */
.guide-cli-section { margin-bottom: 20px; }
.guide-cli-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}
.guide-cli-copy { padding: 4px 10px; font-size: 11px; }
.guide-cli-content {
    background: #1a1a2e;
    color: #e0e0e0;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    max-height: 300px;
    overflow-y: auto;
}

/* Photo area */
.guide-photo-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-photo-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.guide-photo-btn { width: 100%; margin-bottom: 12px; }
.guide-photo-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.guide-photo-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

/* Step notes */
.guide-notes-panel {
    padding: 20px;
}
.guide-notes-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-notes-status {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.guide-notes-status.visible { opacity: 1; }
.guide-notes-status.saving { color: var(--text-muted); }
.guide-notes-status.saved { color: #22c55e; }
.guide-notes-input {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    font-size: 13px;
    line-height: 1.6;
}

/* Runner nav bar */
.guide-runner-nav {
    display: grid;
    grid-template-columns: minmax(100px, 15%) 1fr minmax(100px, 15%);
    align-items: center;
    padding: 16px 0;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    gap: 12px;
}
.guide-runner-nav .btn { width: 100%; }
.guide-runner-nav-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Completed ──────────────────────────────────────────── */
.guide-completed-card {
    max-width: 480px;
    margin: 40px auto;
    text-align: center;
    padding: 40px;
}
.guide-completed-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 12px;
    margin-bottom: 8px;
}
.guide-completed-sn {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-red);
    letter-spacing: 1px;
    margin-bottom: 20px;
}
.guide-completed-meta {
    text-align: left;
    font-size: 14px;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.guide-completed-meta strong { color: var(--text-muted); }

/* ── Session sidebar panel ──────────────────────────────── */
.guide-session-panel {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}
.guide-session-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.guide-session-sn {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-red);
    margin-bottom: 8px;
}
.guide-session-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.guide-session-progress-track {
    height: 3px;
    background: var(--bg-dark);
    border-radius: 2px;
}
.guide-session-progress-bar {
    height: 100%;
    background: var(--accent-red);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ── Editor layout ──────────────────────────────────────── */
.guide-editor-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Sidebar guide list (shown in edit mode) */
.guide-sidebar-list-section {
    display: flex;
    flex-direction: column;
}
.guide-sidebar-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0 10px;
}
.guide-sidebar-list-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}
.guide-editor-guide-list { max-height: 45vh; overflow-y: auto; }
.guide-editor-guide-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s;
}
.guide-editor-guide-item:hover { background: var(--bg-dark); }
.guide-editor-guide-item.active {
    background: rgba(34, 211, 238, 0.06);
    border-left: 3px solid var(--accent-red);
}
.guide-editor-guide-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}
.guide-editor-guide-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Detail panel */
.guide-editor-detail-panel { display: flex; flex-direction: column; gap: 16px; }
.guide-editor-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.guide-editor-placeholder p { margin-top: 12px; font-size: 14px; }

.guide-editor-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
}
.guide-editor-meta-form .editor-form { gap: 14px; }

/* Extra breathing room inside editor glass panels */
.guide-editor-meta-form,
.guide-editor-steps-panel,
.guide-editor-step-detail { padding: 24px; }

/* Steps list in editor */
.guide-editor-steps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.guide-editor-steps-list { display: flex; flex-direction: column; gap: 6px; }
.guide-editor-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.1s;
}
.guide-editor-step-item:hover { border-color: var(--border-color); }
.guide-editor-step-item.active { border-color: var(--accent-red); }
.guide-editor-step-item-order {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-red);
    min-width: 24px;
}
.guide-editor-step-item-title {
    font-size: 13px;
    color: var(--text-main);
    flex: 1;
}
.guide-editor-step-item-type {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}
.guide-editor-step-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
}
.guide-editor-step-item-remove:hover { color: #ef4444; }

/* Drag handle */
.guide-editor-step-drag-handle {
    color: var(--text-muted);
    font-size: 16px;
    cursor: grab;
    opacity: 0.4;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
}
.guide-editor-step-item:hover .guide-editor-step-drag-handle { opacity: 0.8; }
.guide-editor-step-drag-handle:active { cursor: grabbing; }

/* Drag states */
.guide-editor-step-item.dragging {
    opacity: 0.35;
    border-color: var(--accent-red);
    border-style: dashed;
}
.guide-editor-step-item.drag-over-above {
    box-shadow: 0 -2px 0 0 var(--accent-red);
}
.guide-editor-step-item.drag-over-below {
    box-shadow: 0 2px 0 0 var(--accent-red);
}

/* Add Step button — compact red action */
.btn-add-step {
    padding: 5px 12px;
    font-size: 12px;
    white-space: nowrap;
}

/* Collapsible step detail */
.guide-editor-collapse-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding-bottom: 12px;
}
.guide-editor-collapse-header:hover .guide-editor-collapse-icon { color: var(--text-main); }
.guide-editor-collapse-icon {
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.guide-editor-collapse-header.collapsed .guide-editor-collapse-icon {
    transform: rotate(180deg);
}
.guide-editor-collapsible {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    max-height: 3000px;
    opacity: 1;
}
.guide-editor-collapsible.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* Editor actions bar */
.guide-editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.guide-editor-actions-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: nowrap;
}
.btn-editor-delete {
    padding: 6px 14px;
    font-size: 12px;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
}
.btn-editor-delete:hover {
    border-color: #ef4444;
    color: #ef4444;
}
.btn-editor-preview {
    padding: 10px 28px;
    font-size: 14px;
    min-width: 140px;
    text-align: center;
    justify-content: center;
}
.btn-editor-save {
    padding: 10px 32px;
    font-size: 14px;
    font-weight: 600;
    min-width: 160px;
    text-align: center;
    justify-content: center;
}

/* ── Camera modal ───────────────────────────────────────── */
.guide-camera-modal {
    max-width: 640px;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.guide-camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.guide-camera-header h2 {
    font-size: 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-camera-body {
    position: relative;
    background: #000;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.guide-camera-video {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
}
.guide-camera-preview {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
}
.guide-camera-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    justify-content: center;
    border-top: 1px solid var(--border-color);
}

/* ── Settings panel ─────────────────────────────────────── */
.guide-settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 9997;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}
.guide-settings-panel.hidden { transform: translateX(100%); display: flex; }
.guide-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.guide-settings-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-settings-body { padding: 20px; }
.guide-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.guide-setting-row label {
    font-size: 13px;
    color: var(--text-main);
}
.guide-setting-row select { max-width: 140px; }

/* ── Rich Component Checklist (Overview) ──────────────── */
.guide-checklist-group {
    margin-bottom: 16px;
}
.guide-checklist-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}
.guide-checklist-rich {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}
.guide-checklist-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-dark);
}
.guide-checklist-thumb-placeholder {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 20px;
    flex-shrink: 0;
}
.guide-checklist-info {
    flex: 1;
    min-width: 0;
}
.guide-checklist-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.guide-checklist-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.guide-checklist-mfr { font-weight: 500; }
.guide-checklist-price {
    color: var(--accent-blue, #3b82f6);
    font-weight: 600;
}
.guide-checklist-steps { font-style: italic; }
.guide-checklist-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.guide-comp-action {
    color: var(--text-muted);
    font-size: 16px;
    padding: 4px;
    transition: color 0.15s;
    text-decoration: none;
}
.guide-comp-action:hover { color: var(--accent-blue, #3b82f6); }
.guide-checklist-unresolved { opacity: 0.6; }
.guide-checklist-pid-fallback {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

/* Attribute badges shown on checklist items */
.guide-checklist-attr {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--bg-dark);
    color: var(--text-muted);
    white-space: nowrap;
}
.guide-checklist-attr i { font-size: 12px; }

/* ── Checklist Fields Picker (Editor) ─────────────────── */
.guide-checklist-field-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}
.guide-checklist-field-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    font-size: 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.1s;
    user-select: none;
}
.guide-checklist-field-option:hover { background: var(--bg-dark); }
.guide-checklist-field-option input { margin: 0; accent-color: var(--accent-red); }
.guide-checklist-field-option.disabled { opacity: 0.35; pointer-events: none; }
.guide-checklist-field-option i { font-size: 14px; color: var(--text-muted); }

/* ── BOM Summary ──────────────────────────────────────── */
.guide-bom-summary {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.guide-bom-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-bom-stats {
    display: flex;
    gap: 24px;
}
.guide-bom-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.guide-bom-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}
.guide-bom-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}
.guide-bom-cost { color: var(--accent-blue, #3b82f6); }
.guide-bom-note {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Step Component Cards (Runner) ────────────────────── */
.guide-step-components {
    padding: 20px;
    background: var(--bg-panel);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}
.guide-step-comp-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-step-comp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}
.guide-step-comp-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.guide-step-comp-card.guide-step-comp-missing {
    opacity: 0.5;
    border-style: dashed;
}
.guide-step-comp-img {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-panel);
}
.guide-step-comp-img-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 18px;
    flex-shrink: 0;
}
.guide-step-comp-info {
    flex: 1;
    min-width: 0;
}
.guide-step-comp-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.guide-step-comp-mfr {
    font-size: 11px;
    color: var(--text-muted);
}
.guide-step-comp-tips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.guide-step-comp-tip {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-panel);
    padding: 2px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}
.guide-step-comp-manual {
    color: var(--text-muted);
    font-size: 18px;
    padding: 4px;
    flex-shrink: 0;
    text-decoration: none;
}
.guide-step-comp-manual:hover { color: var(--accent-red); }

/* ── Component Picker (Editor) ────────────────────────── */
.guide-comp-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.guide-comp-picker-build-parts {
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 10px;
    background: rgba(239, 68, 68, 0.04);
}
.guide-comp-picker-build-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 8px;
}
.guide-build-parts-add-all {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 8px;
    border: 1px solid var(--accent);
    border-radius: 4px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.guide-build-parts-add-all:hover {
    background: var(--accent);
    color: #fff;
}
.guide-comp-picker-build-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.guide-build-part-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.guide-build-part-btn:hover {
    border-color: var(--accent);
    background: rgba(239, 68, 68, 0.08);
}
.guide-build-part-btn.added {
    border-color: var(--success, #22c55e);
    background: rgba(34, 197, 94, 0.08);
    color: var(--success, #22c55e);
    cursor: default;
    opacity: 0.6;
}
.guide-build-part-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 3px;
}
.guide-build-part-cat {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.guide-comp-picker-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 32px;
}
.guide-comp-picker-hint {
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 0;
}
.guide-comp-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-dark);
    color: var(--text-main);
    padding: 4px 8px 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border-color);
}
.guide-comp-chip-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
    font-size: 12px;
    line-height: 1;
}
.guide-comp-chip-remove:hover { color: #ef4444; }
.guide-comp-picker-search-wrap {
    position: relative;
}
.guide-comp-picker-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
}
.guide-comp-picker-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--border-color);
}
.guide-comp-picker-result:last-child { border-bottom: none; }
.guide-comp-picker-result:hover { background: var(--bg-dark); }
.guide-comp-picker-result-img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.guide-comp-picker-result-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.guide-comp-picker-result-name {
    font-size: 13px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.guide-comp-picker-result-meta {
    font-size: 11px;
    color: var(--text-muted);
}
.guide-comp-picker-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* Animate step components panel on step enter */
.guide-step-content.step-entering .guide-step-components:not(.hidden) {
    animation: stepFadeIn 0.25s ease-out 0.26s both;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .guide-runner-extras {
        grid-template-columns: 1fr;
    }
    .guide-runner-nav {
        grid-template-columns: auto 1fr auto;
    }
    .guide-step-header {
        flex-wrap: wrap;
    }
    .guide-step-timer {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }
    .guide-media-slide { max-height: 300px; }
    .guide-media-slide img { max-height: 300px; }
    .guide-media-slide iframe,
    .guide-media-slide video { height: 300px; }
}

@media (max-width: 768px) {
    .guide-grid {
        grid-template-columns: 1fr;
    }
    .guide-phase { padding: 16px; }
    .guide-step-title { font-size: 18px; }
    .guide-overview-title { font-size: 20px; }
    .guide-settings-panel { width: 100%; }
}
