:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --dark: #0f172a;
    --nav-bg: #020617;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #cbd5e1;
}

html { scroll-behavior: smooth; }
* { 
    box-sizing: border-box; 
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
}

nav {
    background: var(--nav-bg);
    padding: 0 5%;
    height: 60px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
    color: white;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.4px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.brand-logo svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

.nav-links {
    position: absolute;
    left: 5%;
    display: flex;
    gap: 2px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 6px 12px;
    border-radius: 6px;
    letter-spacing: 0.01em;
    transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.07);
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.nav-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: 7px 17px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    font-family: inherit;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.nav-btn.primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: transparent;
    color: white;
    border-radius: 999px;
    padding: 6px 15px 6px 11px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(37, 99, 235, 0.5);
    display: inline-flex;
    align-items: center;
}

.nav-btn.primary::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 7px;
    flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") no-repeat center / contain;
}

.nav-btn.primary:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.45), 0 0 0 1px rgba(59, 130, 246, 0.6);
    transform: translateY(-1px);
}



header {
    background-color: var(--dark);
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 22px 22px;
    color: white;
    padding: 60px 5% 90px;
    text-align: center;
    border-bottom: 3px solid var(--primary);
}

header h1 {
    margin: 0 0 12px 0;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    line-height: 1.15;
}

header p {
    margin: 0;
    color: #94a3b8;
    font-size: 1.05rem;
}


.controls-wrapper {
    background: white;
    position: sticky;
    top: 60px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    padding: 16px 5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

.tab-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.tab-btn {
    padding: 7px 18px;
    border: 1.5px solid var(--border);
    background: white;
    color: var(--text-light);
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.4;
    font-family: inherit;
    transition: all 0.2s;
}

.tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-bar {
    width: 100%;
    max-width: 520px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 11px 16px 11px 42px;
    border-radius: 25px;
    border: 1.5px solid var(--border);
    background: #f8fafc;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--dark);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    box-sizing: border-box;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    width: 17px;
    height: 17px;
    pointer-events: none;
}

.components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 36px 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.comp-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.comp-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
    border-color: #c7d9fc;
}

.comp-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    padding: 20px;
}

.comp-icon-wrap svg {
    width: 52px;
    height: 52px;
    opacity: 0.85;
}

.comp-body {
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.comp-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.comp-category-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.comp-model {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-light);
    background: #f1f5f9;
    border: 1px solid var(--border);
    padding: 2px 10px;
    border-radius: 12px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

.comp-name {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--dark);
    line-height: 1.3;
}

.comp-desc {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.6;
    margin: 0 0 16px 0;
    flex: 1;
}

.comp-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.spec-pill {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    background: #f1f5f9;
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.no-results {
    text-align: center;
    color: var(--text-light);
    padding: 60px 20px;
    font-size: 1.05rem;
    display: block;
}

.no-results.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.modal.hidden { 
    display: none; 
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    user-select: none;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.fixed-area {
    width: 100%;
    resize: none;
    min-height: 80px;
    padding: 12px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    box-sizing: border-box;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text);
    background: white;
}

.fixed-area:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-solid {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
}

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

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
}

.btn-danger:hover { 
    background: #dc2626; 
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    font-family: inherit;
}

.hidden { 
    display: none !important; 
}

#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--dark);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    animation: toast-in 0.25s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}


.account-modal-content {
    max-width: 400px;
    width: 90%;
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    max-height: min(640px, 90vh);
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.07);
    background: #fff;
}

.acct-panels-wrapper {
    position: relative;
}

.acct-main {
    display: flex;
    flex-direction: column;
    background: #fff;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.acct-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid #e8edf5;
    background: linear-gradient(135deg, #eef4ff 0%, #f8faff 100%);
}

.acct-avatar {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,0.35);
}

.acct-avatar svg { width: 22px; height: 22px; stroke: white; }

.acct-header-info { flex: 1; min-width: 0; }

.acct-display-name {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acct-email {
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.acct-close-btn {
    background: rgba(0,0,0,0.05);
    border: none;
    cursor: pointer;
    color: #64748b;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    flex-shrink: 0;
    font-family: inherit;
}

.acct-close-btn svg { width: 15px; height: 15px; }
.acct-close-btn:hover { background: rgba(0,0,0,0.1); color: #0f172a; }

.verify-email-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    background: #fff7ed;
    border-bottom: 1px solid #fed7aa;
    font-size: 0.82rem;
    color: #9a3412;
    font-weight: 500;
}

.verify-email-box.hidden { display: none !important; }

.acct-menu {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 2px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #fff;
}

.acct-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 12px;
    background: none;
    border: none;
    border-bottom: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    border-radius: 12px;
}

.acct-menu-item:hover { background: #f1f5f9; }
.acct-menu-item:active { background: #e2e8f0; }

.acct-menu-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.acct-menu-icon svg { width: 17px; height: 17px; stroke: #4f46e5; }
.acct-menu-item:hover .acct-menu-icon { background: #e0e7ff; }

.acct-menu-danger .acct-menu-icon { background: #fef2f2; }
.acct-menu-danger .acct-menu-icon svg { stroke: #ef4444; }
.acct-menu-danger .acct-menu-title { color: #dc2626; }
.acct-menu-danger:hover { background: #fff5f5; }
.acct-menu-danger:hover .acct-menu-icon { background: #fee2e2; }

.acct-menu-label { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.acct-menu-title { font-size: 0.875rem; font-weight: 600; color: #1e293b; }
.acct-menu-sub { font-size: 0.75rem; color: #94a3b8; }
.acct-chevron { width: 15px; height: 15px; stroke: #c7d2e0; flex-shrink: 0; }

.acct-footer { padding: 10px 20px 16px; border-top: 1px solid #e8edf5; }

.acct-signout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit;
    justify-content: center;
}

.acct-signout-btn svg { width: 16px; height: 16px; stroke: currentColor; }
.acct-signout-btn:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }

.acct-sub-panel {
    display: none;
    flex-direction: column;
    background: #fff;
}

.acct-sub-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid #e8edf5;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    background: linear-gradient(135deg, #eef4ff 0%, #f8faff 100%);
    flex-shrink: 0;
}

.acct-back-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(0,0,0,0.06);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
    flex-shrink: 0;
    font-family: inherit;
}

.acct-back-btn svg { width: 15px; height: 15px; stroke: #475569; }
.acct-back-btn:hover { background: rgba(0,0,0,0.12); }

.acct-sub-body { padding: 20px 20px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }

.acct-sub-desc { font-size: 0.875rem; color: #64748b; margin: 0 0 4px; line-height: 1.5; }

.acct-field-label { display: block; font-size: 0.8rem; font-weight: 600; color: #374151; margin-bottom: -4px; }

.acct-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #dde3ed;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    color: #0f172a;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    box-sizing: border-box;
    outline: none;
}

.acct-input:focus { border-color: #4f46e5; background: #fff; box-shadow: 0 0 0 3px rgba(79,70,229,0.12); }

.acct-submit-btn { width: 100%; margin-top: 4px; padding: 11px; font-size: 0.9rem; }

.acct-danger-box {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 14px;
    color: #991b1b;
    font-size: 0.85rem;
    line-height: 1.55;
}

.acct-danger-box svg { width: 18px; height: 18px; flex-shrink: 0; stroke: #dc2626; margin-top: 1px; }
.acct-danger-box p { margin: 0; }

.theme-toggle { display: flex; gap: 10px; }

.theme-btn {
    flex: 1;
    padding: 16px 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.theme-btn:hover { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.theme-icon { width: 24px; height: 24px; line-height: 1; }
.theme-btn-light { background: linear-gradient(135deg, #f8fafc, #eef4ff); color: #0f172a; }
.theme-btn-dark  { background: linear-gradient(135deg, #1e293b, #0f172a); color: #f1f5f9; }


html.dark-mode {
    --bg: #0f172a;
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --border: #334155;
    --card-bg: #1e293b;
    --primary-light: #1e3354;
}

html.dark-mode body { background: var(--bg); color: var(--text); }

html.dark-mode .controls-wrapper {
    background: #1e293b;
    border-color: var(--border);
}

html.dark-mode .tab-btn {
    background: #1e293b;
    border-color: var(--border);
    color: var(--text-light);
}

html.dark-mode .tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

html.dark-mode .tab-btn:hover:not(.active) {
    background: #162032;
    color: #93c5fd;
    border-color: #1e3a5f;
}

html.dark-mode .search-bar input {
    background: #0f172a;
    border-color: var(--border);
    color: var(--text);
}

html.dark-mode .search-bar input:focus { background: #162032; }

html.dark-mode .comp-card {
    background: var(--card-bg);
    border-color: var(--border);
}

html.dark-mode .comp-card:hover {
    border-color: #334155;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

html.dark-mode .comp-name { color: var(--text); }

html.dark-mode .comp-model {
    background: #334155;
    border-color: #475569;
    color: #94a3b8;
}

html.dark-mode .spec-pill {
    background: #334155;
    border-color: #475569;
    color: #cbd5e1;
}

html.dark-mode .modal-content { background: #1e293b; color: var(--text); }

html.dark-mode .account-modal-content { background: #151f2e; }
html.dark-mode .acct-main { background: #151f2e; }
html.dark-mode .acct-header { background: linear-gradient(135deg, #1a2540 0%, #1e293b 100%); border-color: #2a3a52; }
html.dark-mode .acct-display-name { color: #f1f5f9; }
html.dark-mode .acct-email { color: #7a8fa8; }
html.dark-mode .acct-close-btn { color: #7a8fa8; }
html.dark-mode .acct-close-btn:hover { background: rgba(255,255,255,0.1); color: #f1f5f9; }

html.dark-mode .acct-menu { background: #151f2e; }
html.dark-mode .acct-menu-item { border: none; border-bottom: none; }
html.dark-mode .acct-menu-item:hover { background: #1e2d42; }
html.dark-mode .acct-menu-item:active { background: #243352; }
html.dark-mode .acct-menu-icon { background: #1e2d42; }
html.dark-mode .acct-menu-icon svg { stroke: #818cf8; }
html.dark-mode .acct-menu-item:hover .acct-menu-icon { background: #2a3c58; }
html.dark-mode .acct-menu-title { color: #e2e8f0; }
html.dark-mode .acct-menu-sub { color: #566880; }
html.dark-mode .acct-chevron { stroke: #3a4f68; }
html.dark-mode .acct-footer { border-color: #2a3a52; }
html.dark-mode .acct-signout-btn { background: #1e2d42; border-color: #2a3a52; color: #7a8fa8; }
html.dark-mode .acct-signout-btn:hover { background: #3d1a1a; border-color: #7c2d2d; color: #f87171; }
html.dark-mode .acct-sub-panel { background: #151f2e; }
html.dark-mode .acct-sub-header { background: linear-gradient(135deg, #1a2540 0%, #1e293b 100%); color: #f1f5f9; border-color: #2a3a52; }
html.dark-mode .acct-back-btn { background: rgba(255,255,255,0.07); }
html.dark-mode .acct-back-btn svg { stroke: #94a3b8; }
html.dark-mode .acct-back-btn:hover { background: rgba(255,255,255,0.13); }
html.dark-mode .acct-field-label { color: #94a3b8; }
html.dark-mode .acct-input { background: #0f172a; border-color: #2a3a52; color: #e2e8f0; }
html.dark-mode .acct-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.18); background: #111827; }
html.dark-mode .acct-danger-box { background: #1a0a0a; border-color: #5c1d1d; color: #fca5a5; }
html.dark-mode .acct-danger-box svg { stroke: #f87171; }
html.dark-mode .acct-menu-danger .acct-menu-icon { background: #2d1010; }
html.dark-mode .acct-menu-danger .acct-menu-icon svg { stroke: #f87171; }
html.dark-mode .acct-menu-danger .acct-menu-title { color: #f87171; }
html.dark-mode .acct-menu-danger:hover { background: #1f0d0d; }
html.dark-mode .acct-menu-danger:hover .acct-menu-icon { background: #3d1616; }
html.dark-mode .verify-email-box { background: #2a1a08; border-color: #7c4d12; color: #fbbf72; }
html.dark-mode .theme-btn { border-color: #2a3a52; }
html.dark-mode .theme-btn:hover { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
html.dark-mode .theme-btn-light { background: linear-gradient(135deg, #2a3a52, #334155); color: #cbd5e1; }
html.dark-mode .theme-btn-dark { background: linear-gradient(135deg, #334155, #475569); color: #e2e8f0; }

html.dark-mode .fixed-area {
    background: #0f172a;
    border-color: var(--border);
    color: var(--text);
}

.comp-card { cursor: pointer; }

.comp-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.comp-detail-overlay.hidden { display: none; }

.comp-detail-panel {
    background: white;
    border-radius: 22px;
    max-width: 700px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0,0,0,0.06);
    animation: cdIn 0.24s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes cdIn {
    from { opacity: 0; transform: scale(0.91) translateY(18px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.comp-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 22px 18px;
    border-bottom: 1px solid #f1f5f9;
}

.comp-detail-cat {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.comp-detail-name {
    margin: 0 0 8px;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: #0f172a;
    line-height: 1.2;
}

.comp-detail-model {
    display: inline-block;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
}

.comp-detail-close {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: none;
    background: #f1f5f9;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    margin-top: 2px;
}

.comp-detail-close:hover { background: #e2e8f0; }
.comp-detail-close svg { width: 15px; height: 15px; }

.comp-detail-body {
    display: flex;
    min-height: 200px;
}

.comp-detail-diagram-wrap {
    flex-shrink: 0;
    width: 260px;
    background: #f8fafc;
    border-right: 1px solid #f1f5f9;
    padding: 24px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comp-detail-diagram-wrap svg { width: 100%; height: auto; }

.comp-detail-info {
    flex: 1;
    padding: 20px 22px;
    min-width: 0;
    overflow: hidden;
}

.comp-detail-desc {
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.65;
    margin: 0 0 18px;
}

.comp-detail-pins-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #64748b;
    margin: 0 0 10px;
}

.pin-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.pin-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.pin-name {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1.5px solid;
    flex-shrink: 0;
    min-width: 58px;
    text-align: center;
    line-height: 1.6;
    white-space: nowrap;
}

.pin-desc {
    font-size: 0.84rem;
    color: #374151;
    line-height: 1.55;
    padding-top: 3px;
}

.comp-detail-footer {
    padding: 14px 22px 18px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

html.dark-mode .comp-detail-panel { background: #1e293b; }
html.dark-mode .comp-detail-header,
html.dark-mode .comp-detail-footer { border-color: #334155; }
html.dark-mode .comp-detail-name { color: #f1f5f9; }
html.dark-mode .comp-detail-model { background: #0f172a; color: #94a3b8; }
html.dark-mode .comp-detail-close { background: #334155; }
html.dark-mode .comp-detail-close:hover { background: #475569; }
html.dark-mode .comp-detail-close svg { stroke: #94a3b8; }
html.dark-mode .comp-detail-diagram-wrap { background: #0f172a; border-color: #334155; }
html.dark-mode .comp-detail-desc,
html.dark-mode .pin-desc { color: #94a3b8; }
html.dark-mode .pin-list { scrollbar-color: #334155 transparent; }

@media (max-width: 560px) {
    .comp-detail-body { flex-direction: column; }
    .comp-detail-diagram-wrap { width: 100%; border-right: none; border-bottom: 1px solid #f1f5f9; }
    html.dark-mode .comp-detail-diagram-wrap { border-color: #334155; }
    .pin-list { max-height: none; }
}

@media (max-width: 768px) {
    nav {
        height: auto;
        flex-direction: column;
        gap: 10px;
        padding: 12px 5%;
    }

    .brand-logo { position: static; transform: none; }
    .nav-links { position: static; }
    .nav-buttons { width: 100%; justify-content: center; }

    header { padding: 48px 5% 72px; }
    header h1 { font-size: 1.85rem; }

    /* Remove sticky so nav and controls don't overlap when scrolling */
    .controls-wrapper { position: static; }

    .components-grid {
        grid-template-columns: 1fr;
        padding: 20px 5%;
        gap: 14px;
    }

    /* Prevent iOS Safari from zooming on input focus */
    .fixed-area, .acct-input { font-size: 1rem; }

}

@media (max-width: 480px) {
    header h1 { font-size: 1.55rem; }
    .components-grid { padding: 16px 4%; }
}
