:root {
    --bg-dark: #0a0e14;
    --card-bg: #151b23;
    --text-main: #e6edf3;
    --text-muted: #8b949e;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    /* Theme Reef (Default) */
    --primary-rgb: 0, 210, 255;
    --primary: rgb(var(--primary-rgb));
    --secondary: #3a7bd5;
    --accent: #00d2ff;
    --gradient: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    --hero-bg: url('assets/hero_banner.png');
}

[data-theme="aquascape"] {
    --primary-rgb: 74, 222, 128;
    --primary: rgb(var(--primary-rgb));
    --secondary: #059669;
    --accent: #84cc16;
    --gradient: linear-gradient(135deg, #4ade80 0%, #059669 100%);
    --hero-bg: url('assets/aquascape_hero_bg.png');
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Typography */
h1 { font-size: 4rem; font-weight: 800; line-height: 1.1; margin-bottom: 1.5rem; }
h2 { font-size: 2.5rem; font-weight: 700; margin-bottom: 2rem; }
h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; }
p { margin-bottom: 1rem; font-size: 1.1rem; color: var(--text-muted); }

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-center { text-align: center; }

/* Navigation */
.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(10, 14, 20, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo span { color: var(--primary); }

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover { color: var(--primary); }

.lang-switcher, .theme-switcher {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.lang-switcher button, .theme-switcher button {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s;
}

.lang-switcher button.active, .theme-switcher button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.lang-switcher button:hover:not(.active), .theme-switcher button:hover:not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    background: var(--hero-bg) center/cover no-repeat;
    padding-top: 80px;
    transition: background 0.5s ease;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(10, 14, 20, 0.9) 20%, rgba(10, 14, 20, 0.4) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
}

.hero-content p {
    font-size: 1.4rem;
    margin-bottom: 2.5rem;
    color: #cbd5e1;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 10px 20px rgba(var(--primary-rgb), 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(0, 210, 255, 0.3);
}

.btn-secondary {
    background: var(--glass);
    color: white;
    border: 1px solid var(--glass-border);
    margin-left: 1rem;
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

.btn-outline {
    border: 1px solid var(--primary);
    color: var(--primary);
}

/* Motivation Box */
.motivation-box {
    padding: 4rem;
    border-radius: 32px;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    font-style: italic;
    line-height: 1.8;
}

.motivation-box h3 {
    font-style: normal;
    font-size: 2rem;
    margin-bottom: 2rem;
}

.motivation-box p {
    color: var(--text-main);
    font-size: 1.2rem;
}

.author {
    margin-top: 2rem;
    font-weight: 600;
    font-style: normal;
    color: var(--primary) !important;
}

/* Sections */
.section { padding: 8rem 0; }
.dark-section { background-color: #0d1117; }

.section-title {
    text-align: center;
    position: relative;
}

.section-title.left { text-align: left; }

/* Pinout Layout */
.pinout-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.pin-group {
    padding: 2rem;
    border-radius: 24px;
}

.pin-group h4 {
    margin-bottom: 1.5rem;
    color: var(--primary);
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.image-center {
    display: flex;
    justify-content: center;
    margin-top: 4rem;
}

.glow-img.large {
    max-width: 800px;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.feature-card, .step-card, .manual-item {
    background: var(--card-bg);
    padding: 3rem 2rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s, border-color 0.3s;
}

.feature-card { text-align: center; }

.feature-card:hover, .step-card:hover, .manual-item:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

/* Lists & Tables */
.bom-list {
    list-style: none;
    margin-top: 1.5rem;
}

.bom-list li {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    position: relative;
}

.bom-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    overflow: hidden;
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
    font-weight: 600;
}

/* Flashing & Manual Grids */
.flashing-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.manual-item h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    color: var(--primary);
}

/* Build Guide Steps */
.split-layout {
    display: flex;
    gap: 4rem;
    align-items: center;
}

.content-side { flex: 1; }
.image-side { flex: 1; }

.step {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.step-num {
    background: var(--gradient);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.image-container {
    position: relative;
}

.glow-img {
    width: 100%;
    border-radius: 24px;
    box-shadow: 0 0 50px rgba(var(--primary-rgb), 0.2);
}

/* Download Section */
.download-card {
    max-width: 600px;
    margin: 4rem auto;
    padding: 3rem;
    border-radius: 32px;
}

.glass {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.download-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

.flashing-hint {
    margin-top: 2rem;
    background: #000;
    padding: 1.5rem;
    border-radius: 12px;
    font-family: monospace;
    font-size: 0.95rem;
    color: #4ade80;
    overflow-x: auto;
    border: 1px solid #333;
}

.highlight {
    color: #facc15;
    font-weight: 800;
}

/* Reference Grid */
.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2.5rem;
    margin-top: 4rem;
}

.ref-category {
    padding: 2.5rem;
    border-radius: 32px;
}

.ref-category h3 {
    color: var(--primary);
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ref-item {
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--glass-border);
    transition: border-color 0.3s;
}

.ref-item:hover {
    border-left-color: var(--primary);
}

.ref-item strong {
    display: block;
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.ref-item p {
    font-size: 0.95rem;
    margin-bottom: 0;
}

.highlight-border {
    border: 2px solid var(--glass-border);
}

.highlight-border:hover {
    border-color: var(--primary);
}

/* Footer */
footer {
    padding: 4rem 0;
    border-top: 1px solid var(--glass-border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.social-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 1.5rem;
}

.disclaimer {
    padding: 1.5rem;
    border-radius: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    margin-top: 2rem;
    text-align: center;
}

/* Animations */
.animate-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* —— Overview: LCD mockups & hero layout —— */
.overview-section {
    position: relative;
    overflow: hidden;
}

.overview-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 70% 45% at 50% 0%, rgba(70, 110, 150, 0.06), transparent 50%);
    pointer-events: none;
}

.overview-section .container {
    position: relative;
    z-index: 1;
}

.overview-title-accent::after {
    content: "";
    display: block;
    width: 72px;
    height: 3px;
    margin: 1rem auto 0;
    background: var(--gradient);
    border-radius: 3px;
}

.overview-lead {
    max-width: 640px;
    margin: 0 auto 3.5rem;
    font-size: 1.15rem;
    line-height: 1.65;
}

.overview-panel {
    background: linear-gradient(145deg, rgba(21, 27, 35, 0.95) 0%, rgba(15, 20, 28, 0.9) 100%);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.35);
}

.overview-hero {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.1fr);
    gap: 3rem;
    align-items: start;
    margin-bottom: 4rem;
}

.overview-hero-visual {
    padding: 2rem 2rem 1.5rem;
}

.overview-figure-caption {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 1.25rem;
    margin-bottom: 0;
}

.lcd-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
}

.lcd-bezel {
    position: relative;
    padding: 1rem 1.25rem 1.15rem;
    border-radius: 14px;
    background: linear-gradient(165deg, #5c636b 0%, #454b52 35%, #353a40 100%);
    border: 1px solid rgba(0, 0, 0, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 14px 32px rgba(0, 0, 0, 0.5);
}

.lcd-bezel--hero {
    width: 100%;
    max-width: 420px;
}

.lcd-bezel--small {
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 8px 22px rgba(0, 0, 0, 0.45);
}

.lcd-brand {
    position: absolute;
    top: 0.45rem;
    right: 0.75rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.25);
    text-transform: uppercase;
}

/* Prevent flexbox from stretching the SVGs, and align them to the text */
.lcd-icon, .lcd-lamp {
    display: inline-flex;
    align-items: center; /* Centers the SVG vertically with the text */
    flex-shrink: 0; /* Prevents the SVG from squishing */
}

.lcd-icon svg, .lcd-lamp svg {
    height: 0.8em; /* Scales the 5x8 grid perfectly to VT323's cap-height */
    width: auto;
    display: block;
}

.lcd-screen {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    /* Blue-white STN-style panel when the backlight is on */
    background: linear-gradient(180deg, #a8d4ef 0%, #7eb8de 42%, #5a9bc8 100%);
    border: 1px solid rgba(25, 55, 85, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -8px 24px rgba(30, 70, 100, 0.12);
    font-family: 'VT323', monospace;
    font-size: 1.4rem; /* You may need to bump the size slightly for pixel fonts */
    letter-spacing: 2px;
    line-height: 1; /* <-- This is the crucial fix for the vertical stretching */
    padding: 0.85rem 1rem 0.75rem;
}

.lcd-screen--hero {
    padding: 1.1rem 1.15rem 0.95rem;
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
}

.lcd-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 255, 255, 0.06) 2px,
        rgba(255, 255, 255, 0.06) 3px
    );
    pointer-events: none;
    opacity: 0.35;
}

.lcd-row {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    color: #0c1a26;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
    line-height: 1; /* <-- Changed from 1.5 to 1 */
    letter-spacing: 0.02em;
  }

.lcd-row + .lcd-row {
    margin-top: 0.35rem;
}

.lcd-row--sm {
    font-size: 0.72rem;
    margin-top: 0.2rem;
}

.lcd-row--sm:first-of-type {
    margin-top: 0;
}

.lcd-msg {
    color: #152a3d;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lcd-pct {
    flex-shrink: 0;
    font-weight: 600;
    color: #0c1a26;
}

.lcd-lamp {
    margin-left: 0.15em;
    opacity: 0.85;
    font-size: 0.9em;
}

.lcd-row--ghost {
    justify-content: center;
    color: rgba(30, 60, 90, 0.14);
    text-shadow: none;
}

.lcd-screen--sleep {
    background: linear-gradient(180deg, #0a0e12 0%, #050709 100%);
    border-color: rgba(0, 0, 0, 0.5);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.85);
}

.lcd-bezel--sleep {
    opacity: 0.85;
    filter: grayscale(0.25);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

/* Same blue panel as normal; “blink” is only backlight brightness (see .lcd-screen--backlight-blink) */
.lcd-screen--alarm {
    background: linear-gradient(180deg, #a8d4ef 0%, #7eb8de 42%, #5a9bc8 100%);
    border-color: rgba(25, 55, 85, 0.35);
}

.lcd-screen--alarm .lcd-row {
    color: #0c1a26;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

.lcd-screen--backlight-blink {
    animation: lcd-backlight-blink 1.45s ease-in-out infinite;
}

.lcd-row--alert {
    text-align: center;
    font-size: 0.68rem;
}

.lcd-row--alert + .lcd-row--alert {
    margin-top: 0.2rem;
}

/* Simulates toggling the LCD backlight: panel nearly black when “off”, grey bezel unchanged */
@keyframes lcd-backlight-blink {
    0%, 48% {
        filter: brightness(1);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -8px 24px rgba(30, 70, 100, 0.12);
    }
    52%, 100% {
        filter: brightness(0.06);
        box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.92);
    }
}

.keypad-art {
    width: 100%;
    max-width: 200px;
}

.keypad-svg {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4));
}

.keypad-plate {
    fill: #1e2633;
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1;
}

.key {
    fill: rgba(36, 42, 52, 0.98);
    stroke: rgba(255, 255, 255, 0.12);
    stroke-width: 1;
}

.key--up { fill: rgba(55, 62, 74, 0.98); stroke: rgba(255, 255, 255, 0.18); }
.key--down { fill: rgba(55, 62, 74, 0.98); stroke: rgba(255, 255, 255, 0.18); }

.keypad-glyph {
    fill: rgba(230, 237, 243, 0.85);
    font-size: 11px;
    font-family: "Outfit", sans-serif;
    pointer-events: none;
}

.overview-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.overview-callout {
    display: flex;
    gap: 1.25rem;
    padding: 1.75rem 2rem;
    align-items: flex-start;
    transition: border-color 0.3s, transform 0.3s;
}

.overview-callout:hover {
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
}

.overview-callout-icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border-radius: 12px;
    background: var(--gradient);
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.25);
}

.overview-callout-title {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    font-weight: 700;
}

.overview-callout p {
    font-size: 0.98rem;
    margin-bottom: 0.65rem;
    line-height: 1.55;
}

.overview-callout p:last-child {
    margin-bottom: 0;
}

.overview-states {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.75rem;
    align-items: stretch;
}

.overview-state-card {
    margin: 0;
    padding: 1.5rem 1.25rem 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s, border-color 0.3s;
}

.overview-state-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.14);
}

.overview-state-card .lcd-bezel {
    width: 100%;
    max-width: 220px;
    margin-bottom: 1rem;
}

.overview-state-card figcaption {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 260px;
}

.overview-state-card figcaption strong {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
}

.overview-state-card figcaption span {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
    .lcd-screen--backlight-blink {
        animation: none !important;
        filter: none !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    .split-layout { flex-direction: column; }
    .hero-btns { display: flex; flex-direction: column; gap: 1rem; }
    .btn-secondary { margin-left: 0; }
    .footer-content { flex-direction: column; gap: 2rem; text-align: center; }
    .overview-hero {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .overview-states {
        grid-template-columns: 1fr;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }
    .overview-callout {
        flex-direction: column;
        align-items: flex-start;
    }
    .overview-hero-visual {
        padding: 1.25rem 1rem 1rem;
    }
}

/* Hardware Details Grids */
.hardware-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.detail-card {
    padding: 2.5rem;
}

.detail-card h4 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

/* LED Curve Table & Chart */
.curve-section {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: start;
    margin-top: 4rem;
}

.curve-chart-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 24px;
    padding: 2rem;
    border: 1px solid var(--glass-border);
    position: sticky;
    top: 100px;
}

.curve-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.curve-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 8px rgba(var(--primary-rgb), 0.5));
    transition: d 0.3s ease-out;
}

.curve-point {
    fill: var(--primary);
    transition: cx 0.3s ease-out, cy 0.3s ease-out, r 0.3s;
}

.curve-point:hover {
    r: 6;
}

.curve-axis {
    stroke: var(--text-muted);
    stroke-width: 1;
    opacity: 0.3;
}

.curve-label {
    fill: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
}

.curve-grid {
    stroke: var(--glass-border);
    stroke-width: 0.5;
    stroke-dasharray: 4;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 14, 20, 0.7);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 3rem;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--primary);
}

.modal-body h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.modal-body h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    color: var(--text-main);
}

.modal-body p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.legal-links a:hover {
    color: var(--primary) !important;
}

@media (max-width: 992px) {
    .curve-section {
        grid-template-columns: 1fr;
    }
    .curve-chart-container {
        position: static;
    }
}
