@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

:root {
    --primary: #1A1E22;
    --secondary: #007AFF;
    --accent: #FF9F0A;
    --success: #34C759;
    --bg-light: #FFFFFF;
    --bg-gradient: linear-gradient(135deg, #F7F9FB, #ECEFF2);
    --text: #000000;
    --text-light: rgba(0, 0, 0, 0.5);
    --text-inverse: #FFFFFF;
    --text-inverse-light: rgba(255, 255, 255, 0.85);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.06);
    --tier-basic: #34C759;
    --tier-professional: #5856D6;
    --tier-premium: #FF9F0A;
    --spacing-unit: 6px;
    --spacing-xs: calc(var(--spacing-unit) * 1);
    --spacing-sm: calc(var(--spacing-unit) * 2);
    --spacing-md: calc(var(--spacing-unit) * 3);
    --spacing-lg: calc(var(--spacing-unit) * 5);
    --spacing-xl: calc(var(--spacing-unit) * 7);
    --z-base: 1;
    --z-component: 2;
    --z-tooltip: 3;
    --z-modal: 100;
    --z-overlay: 1000;
    --progress-ring-radius: 26;
    --progress-ring-circumference: calc(2 * 3.14159 * var(--progress-ring-radius));
    --progress-ring-animation-duration: 1.2s;
    --progress-ring-easing: cubic-bezier(0.215, 0.61, 0.355, 1);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-gradient);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.8;
    overflow-x: hidden;
    padding: var(--spacing-xl) 0;
}

.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1A1A1A, #0A0A0A);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay);
    opacity: 1;
    animation: none;
    pointer-events: auto;
}

.onboarding-overlay.active {
    pointer-events: auto; /* Enable pointer events after animation (optional) */
}

.onboarding-content {
    text-align: center;
    color: var(--text-inverse);
    max-width: 90vw;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    padding: var(--spacing-lg);
    pointer-events: auto;
    position: relative;
    z-index: calc(var(--z-overlay) + 1);
}

.onboarding-content h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 16px;
    animation: popIn 0.6s ease-out;
}

.onboarding-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    animation: popIn 0.8s ease-out;
}

.onboarding-content p {
    font-size: 1.25rem;
    color: var(--text-inverse-light);
    margin-bottom: 32px;
    animation: popIn 1s ease-out;
}

#start-building {
    background: var(--secondary);
    color: var(--text-inverse);
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 122, 255, 0.4);
    animation: pulse 2s infinite ease-in-out;
    position: relative;
    z-index: calc(var(--z-overlay) + 2);
    pointer-events: auto;
}

#start-building:hover {
    box-shadow: 0 0 25px rgba(0, 122, 255, 0.7);
}

.hero {
    position: relative;
    width: 100%;
    max-width: 1440px;
    min-height: 280px;
    height: 25vh;
    max-height: 380px;
    background: linear-gradient(135deg, #1A1E22, #2C3438);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-inverse);
    border-radius: 14px;
    margin: 0 auto var(--spacing-lg);
    box-shadow: var(--shadow-subtle);
    padding: var(--spacing-lg);
    opacity: 0;
    animation: slideUp 0.8s ease-out 0.6s forwards;
}

.hero h1 {
    font-size: clamp(2rem, 3.5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    max-width: 60ch;
    margin: 0 auto;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-inverse-light);
    margin-top: var(--spacing-sm);
    letter-spacing: 0.02em;
    font-weight: 500;
}

.hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.25;
    animation: pulseWave 2s ease-in-out infinite;
    pointer-events: none;
}

.filter-bar {
    background: linear-gradient(145deg, rgba(48, 57, 58, 0.7), rgba(64, 72, 76, 0.7));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg, transparent, var(--secondary), transparent) 1;
    border-radius: 14px;
    margin: 0 auto 4px auto;
    padding: 8px;
    max-width: 100%;
    backdrop-filter: blur(12px);
    transition: box-shadow 0.3s ease;
}

.filter-bar:hover {
    box-shadow: 0 0 12px rgba(0, 122, 255, 0.3);
}

.challenge-bar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    color: var(--text-inverse);
    align-items: center;
    gap: 6px;
}

.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

.filter-group-wrapper {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 4px;
    flex: 1;
    min-width: 80px;
    max-width: 120px;
    backdrop-filter: blur(10px);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-inverse);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.filter-group select, .filter-group input {
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-inverse);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    height: 24px;
    width: 100%;
    backdrop-filter: blur(10px);
}

.filter-group select:focus, .filter-group input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 5px rgba(0, 122, 255, 0.3);
    outline: none;
}

.filter-group select:hover, .filter-group input:hover {
    box-shadow: 0 0 5px rgba(0, 122, 255, 0.15);
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

#apply-filters, #reset-filters {
    padding: 4px 10px;
    height: 28px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    border: none;
    transition: all 0.3s ease;
}

#apply-filters {
    background: rgba(0, 122, 255, 0.8);
    color: var(--text-inverse);
}

#apply-filters.pending {
    background: var(--success);
}

#apply-filters.loading {
    opacity: 0.7;
    pointer-events: none;
}

#apply-filters.loading::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--text-inverse);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#reset-filters {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

#apply-filters:hover, #reset-filters:hover {
    box-shadow: 0 0 6px rgba(0, 122, 255, 0.3);
}

.why-section {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    box-shadow: var(--shadow-subtle);
    max-width: 1440px;
    margin: var(--spacing-lg) auto;
    padding: var(--spacing-md);
}

.challenge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    position: relative;
    cursor: pointer;
}

.challenge-header h2 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.challenge-header-accent {
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary), var(--accent));
    border-radius: 2px;
}

.why-section .toggle-section {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
}

.why-section .toggle-icon {
    width: 20px;
    height: 20px;
    fill: var(--text);
    transition: transform 0.3s ease;
}

.why-section .toggle-icon.rotated {
    transform: rotate(180deg);
}

.why-content {
    padding: var(--spacing-sm);
    overflow-y: auto;
    transition: height 0.4s ease, opacity 0.3s ease;
    height: auto;
    opacity: 1;
}

.why-content:not(.active) {
    height: 0;
    opacity: 0;
    padding: 0 var(--spacing-sm);
}

.why-explanation p {
    margin-bottom: var(--spacing-sm);
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-light);
}

.challenge-list {
    flex: 1;
    margin: 0;
}

.challenge-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

.challenge-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    box-shadow: var(--shadow-subtle);
    transition: transform 0.3s ease, background 0.3s ease;
    backdrop-filter: blur(10px);
}

.challenge-item:hover {
    transform: scale(1.03);
    background: rgba(255, 255, 255, 0.15);
}

.challenge-icon {
    width: 14px;
    height: 14px;
    fill: var(--text);
}

.container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--spacing-lg);
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.main-content {
    max-width: 100%;
}

.section {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    box-shadow: var(--shadow-subtle);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.section:hover {
    box-shadow: 0 0 12px rgba(0, 122, 255, 0.15);
}

.section-header {
    background: var(--secondary);
    color: var(--text-inverse);
    padding: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 14px 14px 0 0;
    cursor: pointer;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.defense-number {
    width: 32px;
    height: 32px;
    background: var(--text-inverse);
    color: var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 12px;
}

.toggle-section {
    background: transparent;
    border: none;
    color: var(--text-inverse);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
}

.toggle-icon {
    width: 20px;
    height: 20px;
    fill: var(--text-inverse);
    transition: transform 0.3s ease;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

.section-content {
    padding: var(--spacing-md);
    overflow-y: auto;
    transition: height 0.4s ease, opacity 0.3s ease;
    height: auto;
    opacity: 1;
}

.section-content:not(.active) {
    height: 0;
    opacity: 0;
    padding: 0 var(--spacing-md);
}

.section-description {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: var(--spacing-sm);
    line-height: 1.7;
}

.components {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
}

.component {
    background: linear-gradient(145deg, #FFFFFF, #F5F7FA);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: var(--spacing-md);
    position: relative;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.7), var(--shadow-subtle);
    z-index: var(--z-component);
    min-height: 360px;
    min-width: 300px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.component:hover {
    box-shadow: 0 0 12px rgba(0, 122, 255, 0.15);
    transform: scale(1.02);
    z-index: 2;
}

.component.selected {
    border: 2px solid var(--secondary);
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
    box-sizing: border-box;
}

.icon-placeholder {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    margin: 0 auto var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.bisd-illustration {
    width: 200px;
    height: 133px;
    display: block;
    margin: 0 auto var(--spacing-md);
    transition: transform 0.3s ease;
    pointer-events: none;
}

.component:hover .icon-placeholder,
.component:hover .bisd-illustration {
    background: rgba(255, 255, 255, 0.25);
}

.component-tier {
    position: absolute;
    top: -8px;
    right: 14px;
    padding: 4px 8px;
    border-radius: 8px;
    color: var(--text-inverse);
    font-size: 0.75rem;
    font-weight: 600;
}

.tier-basic { background: var(--tier-basic); }
.tier-professional { background: var(--tier-professional); }
.tier-premium { background: var(--tier-premium); }

.component-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.component-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.component-title .variation {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-light);
    margin-left: 4px;
}

.component-title em {
    font-style: italic;
    color: var(--text-light);
    font-weight: 400;
    margin-left: 4px;
}

.component-description {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
    line-height: 1.7;
    text-align: center;
}

.specs {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
    width: 100%;
}

.spec-row {
    display: flex;
    justify-content: space-between;
}

.spec-name {
    color: var(--text-light);
}

.spec-value {
    font-weight: 600;
    text-align: right;
}

.dimensions {
    display: block;
    font-size: 0.8rem;
    color: rgba(0, 0, 0, 0.5);
    font-style: italic;
    text-align: right;
    margin-top: 4px;
}

.optional-costs {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.optional-costs label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.optional-checkbox {
    appearance: none;
    width: 36px;
    height: 18px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.optional-checkbox::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--text);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.optional-checkbox:checked {
    background: var(--secondary);
}

.optional-checkbox:checked::before {
    transform: translateX(18px);
}

.sidebar {
    position: sticky;
    top: 16px;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: 0 var(--spacing-sm);
    align-self: start;
}

.sidebar-section {
    background: linear-gradient(145deg, rgba(28, 37, 38, 0.96), rgba(44, 52, 56, 0.96));
    backdrop-filter: blur(12px);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 3px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.sidebar-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-inverse);
    position: relative;
}

.sidebar-header h2 {
    font-size: 1.85rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary), var(--accent));
    border-radius: 2px;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
}

.toggle-sidebar {
    background: transparent;
    border: none;
    color: var(--text-inverse);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
}

.toggle-sidebar .toggle-icon {
    width: 20px;
    height: 20px;
    fill: var(--text-inverse);
    transition: transform 0.3s ease;
}

.toggle-sidebar .toggle-icon.rotated {
    transform: rotate(180deg);
}

.sidebar-content {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    min-height: 580px;
}

.sidebar-content:not(.active) {
    display: none;
}

.tabs {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: var(--spacing-sm);
}

.tab {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-inverse);
    border: none;
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
}

.tab.active {
    background: rgba(0, 122, 255, 0.3);
    color: var(--text-inverse);
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.3);
}

.tab:hover {
    background: rgba(255, 255, 255, 0.12);
}

.tab-content {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    opacity: 1;
}

.terrain-diagram {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: var(--spacing-sm);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(10px);
}

.terrain-diagram h3 {
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: var(--spacing-sm);
    color: var(--text-inverse);
}

#property-diagram {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.sound-wave {
    fill: none;
    stroke: url(#wave-gradient);
    stroke-width: 0.5%;
    animation: ripple 2s ease-in-out infinite;
}

.sound-path {
    fill: none;
    stroke-width: 0.4%;
    stroke-dasharray: 8, 8;
    animation: pulse 2s ease-in-out infinite;
    transition: stroke 0.3s ease, stroke-dasharray 0.3s ease, stroke-opacity 0.3s ease;
}

.zoom-button {
    position: absolute;
    top: 28px;
    right: var(--spacing-sm);
    background: rgba(0, 122, 255, 0.9);
    color: var(--text-inverse);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.zoom-button:hover {
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.7);
}

.zoom-button svg {
    width: 14px;
    height: 14px;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.frequency-chart {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: var(--spacing-md);
    backdrop-filter: blur(10px);
}

.frequency-chart h3 {
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--text-inverse);
}

.source-spl-chart {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: var(--spacing-md);
    backdrop-filter: blur(10px);
}

.source-spl-chart h3 {
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--text-inverse);
}

#eq-chart text, #source-spl-chart text {
    fill: var(--text-inverse);
    font-weight: 500;
}

#eq-chart text.bar-value, #source-spl-chart text.bar-value {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.summary-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.summary-controls button, #recommend-me {
    background: var(--secondary);
    color: var(--text-inverse);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    flex: 1;
    min-width: 90px;
    max-width: 110px;
    backdrop-filter: blur(10px);
}

#recommend-me.recommended {
    background: var(--accent);
    box-shadow: 0 0 12px rgba(255, 159, 10, 0.4);
}

#export-solution {
    background: var(--accent);
}

#clear-selection {
    background: rgba(255, 255, 255, 0.12);
}

.summary-controls button:hover, #recommend-me:hover {
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.3);
}

.progress-bar {
    position: relative;
    width: 200px;
    height: 32px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    overflow: hidden;
    margin: 10px auto;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(to right, #007AFF, #34C759);
    border-radius: 16px;
    transition: width 0.3s ease-out;
    width: 0;
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.3);
}

.reduction-value {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.reduction-value .unit {
    font-size: 16px;
    opacity: 0.8;
    margin-left: 2px;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
    padding: var(--spacing-sm);
    justify-items: center;
    align-items: center;
}

.summary-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 24px var(--spacing-sm) 24px;
    border-radius: 10px;
    transition: box-shadow 0.3s ease;
    height: 120px;
    width: 100%;
    backdrop-filter: blur(10px);
}

.summary-item:hover {
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.2);
}

.summary-item:nth-child(1) {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.summary-item:nth-child(2) {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.summary-item:nth-child(3) {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    width: 100%;
    padding: 24px var(--spacing-md) 24px;
}

.summary-item h3 {
    font-size: 0.95rem;
    color: var(--text-inverse-light);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.neighbour .mini-bar {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.neighbour .mini-fill {
    height: 100%;
    background: var(--success);
    border-radius: 2px;
    transition: width 0.6s ease;
}

.night-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-inverse-light);
    width: 100%;
    text-align: center;
}

.night-toggle input {
    appearance: none;
    width: 36px;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.night-toggle input::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--text-inverse);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

.night-toggle input:checked {
    background: var(--secondary);
}

.night-toggle input:checked::before {
    transform: translateX(18px);
}

.compliance-bar {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-inverse-light);
}

.compliance-bar span {
    font-weight: 600;
    color: var(--text-inverse);
}

.compliance-bar .bar {
    width: 100%;
    height: 7px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    margin-top: 6px;
    position: relative;
    overflow: hidden;
}

.compliance-bar .fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.neighbour-impact {
    margin-bottom: var(--spacing-md);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(10px);
}

.neighbour-impact h3 {
    font-size: 1rem;
    text-align: center;
    margin-bottom: var(--spacing-sm);
    color: var(--text-inverse);
}

.disclaimer {
    font-size: 0.85rem;
    color: var(--text-inverse-light);
    opacity: 0.8;
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-xs);
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
    line-height: 1.4;
    font-style: italic;
    text-align: center;
}

.neighbours-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.neighbour {
    background: rgba(255, 255, 255, 0.08);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    position: relative;
    backdrop-filter: blur(10px);
}

.neighbour:hover {
    background: rgba(255, 255, 255, 0.12);
}

.neighbour span:first-child {
    color: var(--text-inverse-light);
}

.neighbour span:last-child {
    font-weight: 600;
}

.app-footer {
    background: rgba(28, 37, 38, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    margin-top: var(--spacing-xl);
    padding: var(--spacing-md);
    color: var(--text-inverse-light);
    font-size: 0.9rem;
    border-radius: 14px 14px 0 0;
}

.help-icon {
    position: fixed;
    bottom: 16px;
    right: 16px;
    background: var(--secondary);
    color: var(--text-inverse);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-subtle);
    transition: box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
}

.help-icon:hover {
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.6);
}

.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: calc(var(--z-modal) + 1);
}

.help-modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: var(--z-modal);
}

.help-content {
    position: relative;
    background: rgba(28, 37, 38, 0.96);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: var(--spacing-lg);
    max-width: 480px;
    margin: 10vh auto;
    box-shadow: var(--shadow-subtle);
    color: var(--text-inverse);
    text-align: center;
}

.help-content h2 {
    font-size: 1.4rem;
    margin-bottom: var(--spacing-md);
}

.help-content p {
    font-size: 0.95rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-inverse-light);
}

.help-content a {
    color: var(--secondary);
    text-decoration: none;
}

.help-content a:hover {
    text-decoration: underline;
}

#close-help {
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    padding: 8px 18px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#close-help:hover {
    box-shadow: 0 0 10px rgba(255, 159, 10, 0.6);
}

.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--z-modal) + 2);
}

.tour-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    padding: var(--spacing-lg);
    max-width: 90%;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.tour-content p {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-md);
    color: var(--text);
    animation: popIn 0.5s ease-out;
}

#tour-next, #tour-skip {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 8px;
}

#tour-next {
    background: var(--secondary);
    color: var(--text-inverse);
    border: none;
}

#tour-next:hover {
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
}

#tour-skip {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--text-light);
}

#tour-skip:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: var(--text-inverse);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: var(--z-tooltip);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
    z-index: var(--z-tooltip);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
    opacity: 1;
}

.tooltip-below:hover::after {
    top: 100%;
    bottom: auto;
    margin-top: 4px;
}

.tooltip-below:hover::before {
    top: 100%;
    bottom: auto;
    border-top-color: transparent;
    border-bottom-color: rgba(0, 0, 0, 0.85);
    margin-top: -4px;
}

@media (max-width: 1200px) {
    .container { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }
    .main-content { margin-right: 0; }
    .sidebar-section { max-width: 100%; }
}

@media (max-width: 768px) {
    .hero h1 { font-size: 1.75rem; }
    .hero p { font-size: 0.95rem; }
    .filter-bar {
        padding: 2px;
        max-width: 100%;
        border-radius: 14px;
        border-bottom: none;
        margin-bottom: 4px;
    }
    .filter-section {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }
    .filter-group-wrapper {
        min-width: 100%;
        max-width: 100%;
    }
    .filter-group select, .filter-group input {
        width: 100%;
    }
    .filter-actions {
        width: 100%;
        justify-content: center;
        flex-direction: row;
        gap: 2px;
    }
    .summary-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 12px;
    }
    .summary-item:nth-child(1) {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
    }
    .summary-item:nth-child(2) {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }
    .summary-item:nth-child(3) {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    .sidebar { font-size: 0.9rem; }
    .summary-controls {
        gap: 6px;
    }
    .summary-controls button, #recommend-me {
        padding: 6px 8px;
        font-size: 0.85rem;
        min-width: 80px;
        max-width: 90px;
    }
    .challenge-items {
        flex-direction: row;
        justify-content: center;
    }
    .challenge-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .challenge-items {
        justify-content: flex-start;
    }
    .bisd-illustration {
        width: 160px;
        height: 107px;
    }
    .component {
        min-height: 340px;
        min-width: 280px;
    }
    .component-title {
        font-size: 1rem;
    }
    .component-description {
        font-size: 0.85rem;
    }
    .specs {
        font-size: 0.85rem;
    }
    .dimensions {
        font-size: 0.75rem;
    }
}

@media (max-width: 320px) {
    body { font-size: 0.85rem; }
    .bisd-illustration {
        width: 140px;
        height: 93px;
    }
    .component {
        min-height: 320px;
        min-width: 260px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes popIn {
    0% { transform: scale(0.96); opacity: 0; }
    80% { transform: scale(1.01); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes pulse {
    0% { stroke-opacity: 0.8; stroke-width: 2; }
    50% { stroke-opacity: 0.4; stroke-width: 3; }
    100% { stroke-opacity: 0.8; stroke-width: 2; }
}

@keyframes pulseWave {
    0% {
        opacity: 0.8;
        transform: scale(0.8);
    }
    50% {
        opacity: 0.4;
        transform: scale(1.1);
    }
    100% {
        opacity: 0.8;
        transform: scale(0.8);
    }
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Update other pointer-events */
[data-tooltip]::after,
[data-tooltip]::before {
    pointer-events: none;
}

/* Ensure other elements don't interfere with the overlay */
body.has-overlay > *:not(.onboarding-overlay) {
    pointer-events: none;
}

.progress-ring {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    margin-bottom: 4px;
}

.progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring circle {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
}

.progress-ring .bg {
    stroke: rgba(255, 255, 255, 0.15);
}

.progress-ring .fg {
    stroke: url(#ring-gradient);
    stroke-dasharray: 163.4;
    stroke-dashoffset: 163.4;
    transition: stroke-dashoffset 0.6s ease;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-inverse);
    display: flex;
    align-items: baseline;
    gap: 3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.summary-value .unit {
    font-size: 0.75rem;
    color: var(--text-inverse-light);
}