:root {
    --bg: #0f172a;
    --card: #1e293b;
    --accent: #3b82f6;
    --text: #f1f5f9;
    --text-muted: #cbd5e1; 
    --border: #334155;
    --table-header: #2d3b4e;
    --btn-github: #24292e;
    --btn-makerworld: #00ae42;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --warning-border: #f59e0b;
    --idea-bg: rgba(16, 185, 129, 0.1);
    --idea-border: #10b981;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

.wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 50px;
}

h1 { margin: 0; font-size: 2.5rem; color: var(--accent); }
h2 { border-left: 4px solid var(--accent); padding-left: 15px; margin-top: 50px; scroll-margin-top: 20px; }
h3 { color: var(--text); margin-top: 0; font-size: 1.2rem; }

/* Helper for colored subtitles */
.step-subtitle { margin-bottom: 10px; color: var(--accent); }

.intro { font-size: 1.1rem; color: var(--text-muted); }

/* Carousel Styles */
.carousel-wrapper { position: relative; margin-top: 30px; padding: 20px 0; overflow: hidden; }
.carousel-track { display: flex; align-items: center; will-change: transform; }
.carousel-slide { flex: 0 0 55%; margin: 0 2.5%; position: relative; transition: all 0.5s ease-in-out; opacity: 0.4; transform: scale(0.85); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 20px rgba(0,0,0,0.3); }
.carousel-slide.active { opacity: 1; transform: scale(1.1); z-index: 5; box-shadow: 0 0 20px rgba(59, 130, 246, 0.4); border: 1px solid var(--accent); }
.carousel-slide img { width: 100%; height: 100%; display: block; object-fit: cover; aspect-ratio: 16/9; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(15, 23, 42, 0.8); color: var(--accent); border: 1px solid var(--border); cursor: pointer; width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; z-index: 10; transition: all 0.2s; }
.carousel-btn:hover { background: var(--accent); color: white; }
.prev { left: 10px; }
.next { right: 10px; }
@media (max-width: 600px) { .carousel-slide { flex: 0 0 85%; margin: 0 2%; } .carousel-btn { display: none; } }

/* Screens & Services List */
.screens-list { margin: 0; padding-left: 20px; color: var(--text-muted); font-size: 0.95rem; line-height: 1.8; }
.screens-list a { color: inherit; text-decoration: underline; text-decoration-style: solid; text-decoration-color: rgba(255, 255, 255, 0.2); text-underline-offset: 4px; transition: color 0.2s ease, text-decoration-color 0.2s ease; }
.screens-list a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* Step & Card Styles */
.step { background: var(--card); border-radius: 12px; padding: 25px; margin-bottom: 20px; border: 1px solid var(--border); }
.step-divider { border: 0; border-top: 1px solid var(--border); margin: 30px 0 25px; }

.hardware-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 25px; margin-top: 20px; }
.hw-card { background: rgba(2, 6, 23, 0.5); border: 1px solid var(--border); border-radius: 10px; padding: 15px 10px; text-align: center; display: flex; flex-direction: column; align-items: center; height: 100%; box-sizing: border-box; justify-content: space-between; }
.hw-card img { width: 100%; height: 80px; object-fit: contain; margin-bottom: 10px; }
.hw-name { font-size: 0.85rem; font-weight: 600; margin-bottom: 10px; color: var(--text); min-height: 40px; display: flex; align-items: center; justify-content: center; line-height: 1.2; }
.hw-link { font-size: 0.75rem; color: var(--accent); text-decoration: none; border: 1px solid var(--accent); padding: 4px 12px; border-radius: 4px; transition: all 0.2s; width: fit-content; }
.hw-link:hover { background: var(--accent); color: white; }

.diagram-img { display: block; margin: 20px auto; max-width: 100%; width: auto; border-radius: 8px; border: 1px solid var(--border); }

/* Wiring & Assembly Specifics */
.wiring-title { margin-bottom: 5px; font-weight: bold; }
.wiring-list { margin-top: 5px; font-size: 0.9rem; margin-bottom: 20px; }
.assembly-section { margin-top: 25px; }
.assembly-intro { margin-bottom: 10px; }
.assembly-steps { padding-left: 20px; line-height: 1.6; color: var(--text-muted); }

/* Note Boxes (Design, Warning, Alert, Info) */
.note-box { margin: 8px 0; padding: 8px 10px; font-size: 0.9em; border-left-width: 2px; border-left-style: solid; }
.note-box.design { border-left-color: var(--accent); opacity: 0.9; }
.note-box.warning { border-left-color: #f97316; opacity: 0.9; } /* Orange/Red */
.note-box.alert { background: var(--warning-bg); border-left: 3px solid var(--warning-border); } /* Yellow */

.info-box { background: rgba(59, 130, 246, 0.1); padding: 15px; border-radius: 6px; font-size: 0.9rem; margin-top: 15px; border-left: 3px solid var(--accent); }
.info-box p { margin: 5px 0 0 0; }
.info-box p + p { margin-top: 10px; }

.info-box.flex-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 15px; }
.info-box.source-code { background: rgba(255,255,255,0.05); border-left: 4px solid #6e7681; margin-top: 0; }
.info-box.idea { margin-top: 25px; border-left: 4px solid var(--idea-border); background: var(--idea-bg); }

.small-desc { font-size: 0.85rem; color: var(--text-muted); }
.small-note { font-size: 0.85em; color: var(--text-muted); }

/* Tables */
.table-container { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 15px; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 500px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--table-header); color: var(--accent); white-space: nowrap; }
td { color: var(--text-muted); }
tr:last-child td { border-bottom: none; }
.pin { font-family: monospace; color: var(--text); background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; display: inline-block; }

/* Features List */
.feature-stack { display: flex; flex-direction: column; gap: 24px; margin-top: 20px; }
.feature-item { background: rgba(30, 41, 59, 0.5); padding: 25px; border-radius: 12px; border: 1px solid var(--border); }
.feature-header { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; font-size: 1.25rem; color: var(--accent); font-weight: bold; }
.feature-section-title { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); margin-top: 15px; margin-bottom: 5px; font-weight: 700; }
.api-tag { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; display: block; margin-top: 20px; padding-top: 10px; border-top: 1px solid var(--border); }
.global-item { background: rgba(59, 130, 246, 0.05); border: 1px solid var(--accent); }

/* Highlight Feature Block */
.highlight-feature { background: linear-gradient(to right, rgba(59, 130, 246, 0.15), rgba(30, 41, 59, 0.3)); border: 1px solid var(--accent); border-left-width: 6px; padding: 25px; border-radius: 12px; margin-bottom: 30px; }
.highlight-feature .feature-header { margin-bottom: 10px; }
.highlight-feature p { margin: 0; }
.highlight-feature p.desc { margin-top: 10px; }
.highlight-feature p.example { margin: 10px 0; font-size: 0.9em; opacity: 0.8; }

ol, ul { padding-left: 20px; }
li { margin-bottom: 8px; }

/* Buttons & Info */
.btn-container { display: flex; gap: 15px; flex-wrap: wrap; margin-top: 15px; }
.btn-container.centered { justify-content: center; margin-top: 20px; gap: 15px; }
.btn { display: inline-flex; align-items: center; justify-content: center; border: none; background: var(--accent); color: white; padding: 12px 20px; border-radius: 6px; text-decoration: none; font-weight: bold; cursor: pointer; transition: opacity 0.2s; min-width: 140px; text-align: center; }
.btn:hover { opacity: 0.9; }
.btn-disabled { opacity: 0.5; cursor: not-allowed; background-color: var(--border); }

.btn-github { background-color: var(--btn-github); font-size: 0.9rem; }
.btn-makerworld { background-color: var(--btn-makerworld); min-width: 160px; }
.btn-wide { min-width: 160px; }

.btn-icon-spacer { margin-right: 8px; }

code { background: #000; padding: 2px 6px; border-radius: 4px; color: #3b82f6; }

/* App Preview */
.app-screenshot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; }
.app-screenshot { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--border); box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.app-features { width: 100%; }

@media (max-width: 600px) {
    .app-screenshot-grid { grid-template-columns: 1fr; }
}

#loading-text { color: var(--text-muted); font-size: 0.9rem; }
.security-warning { margin-top: 25px; }

/* OS Grid */
.os-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; margin-top: 20px; }
.os-card { background: rgba(255,255,255,0.05); padding: 15px; border-radius: 8px; border: 1px solid var(--border); }
.os-title { color: var(--accent); }
.os-note { font-size: 0.85rem; color: var(--text-muted); }
.os-cmd { display: block; margin-top: 5px; font-size: 0.8em; }
.linux-footer { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--text-muted); opacity: 0.7; }

/* Accordion / Assembly Styles */
details { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: 8px; margin-top: 20px; overflow: hidden; /* Important for animation */ }
details.dark-mode { background: rgba(0,0,0,0.2); border-color: rgba(255,255,255,0.1); }

summary { padding: 12px 15px; cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; background: rgba(30, 41, 59, 0.3); position: relative; z-index: 2; transition: background 0.2s; }
summary:hover { background: rgba(59, 130, 246, 0.1); }
summary::-webkit-details-marker { display: none; } 
summary::after { content: '+'; font-weight: bold; font-size: 1.2rem; transition: transform 0.3s; }
details[open] summary::after { content: '-'; }

/* The container that gets animated */
.assembly-container { 
    padding: 15px; 
    border-top: 1px solid var(--border); 
    /* Start state for JS animation */
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease, 
                padding 0.3s ease,
                border-width 0.3s ease;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
}

.dark-mode .assembly-container { border-color: rgba(255,255,255,0.1); }

.assembly-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; align-items: stretch; }
.assembly-item { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #000; height: 100%; display: flex; flex-direction: column; }
.assembly-img-wrapper { flex: 1; display: flex; align-items: center; justify-content: center; background: #000; overflow: hidden; min-height: 200px; }
.assembly-item img { width: 100%; height: 100%; display: block; object-fit: contain; }
.assembly-item img.real-photo { object-fit: cover; }
.assembly-caption { padding: 8px; font-size: 0.8rem; color: var(--text-muted); text-align: center; border-top: 1px solid var(--border); background: var(--bg); font-weight: 600; flex-shrink: 0; }

/* Success Step specific */
.success-img-container { text-align: center; margin-bottom: 20px; }
.success-img { max-width: 100%; height: auto; border-radius: 8px; }
.step-subtitle-make { margin-top: 25px; color: var(--accent); }
.make-list { margin-top: 10px; }

/* Footer */
.page-footer { margin-top: 60px; padding-bottom: 40px; font-size: 0.8rem; color: var(--text-muted); }
.footer-link { color: var(--accent); text-decoration: none; }

@media (max-width: 600px) { .hardware-grid { grid-template-columns: repeat(2, 1fr); } .assembly-grid { grid-template-columns: 1fr; } }