/* Styles extracted from confidence-Interval.html */
:root {
    /* Dark Neon Theme Variables */
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #f59e0b; /* Amber/Gold Neon */
    --primary-glow: rgba(245, 158, 11, 0.4);
    --accent: #06b6d4; /* Cyan Neon */
    --accent-glow: rgba(6, 182, 212, 0.4);
    --border: #334155;
    --sw: 280px;
    --hh: 70px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- Background Formulas (Gold) --- */


/* --- Header --- */
header {
    height: var(--hh);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: bold;
    font-size: 1.3rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.3s;
    box-shadow: 0 0 5px var(--accent-glow);
}

.lang-btn:hover {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 15px var(--accent-glow);
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.8rem;
    cursor: pointer;
    display: none;
    padding: 5px;
}

.menu-btn:hover {
    color: var(--primary);
}

/* --- Layout --- */
.c {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Overlay for Mobile Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--hh);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--hh));
    background: rgba(0, 0, 0, 0.6);
    z-index: 98;
    backdrop-filter: blur(2px);
}

aside {
    width: var(--sw);
    background: rgba(15, 23, 42, 0.95);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99;
}

main {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
}

/* --- Navigation --- */
.nav {
    list-style: none;
    padding: 20px 0;
}

.nav li {
    padding: 15px 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    border-right: 3px solid transparent;
    transition: 0.3s;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.nav li:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    padding-right: 30px;
}

.nav li.active {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.1), transparent);
    color: var(--primary);
    border-right-color: var(--primary);
    text-shadow: 0 0 8px var(--primary-glow);
}

.nav svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* --- Content Sections --- */
.sec {
    display: none;
    max-width: 900px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease;
}

.sec.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    margin-bottom: 25px;
    color: var(--text-main);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    display: inline-block;
    text-shadow: 0 0 10px var(--primary-glow);
}

/* --- Cards & Inputs --- */
.card {
    background: var(--bg-panel);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 25px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.fg {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
}

input,
select {
    width: 100%;
    padding: 12px 15px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: 0.3s;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), #d97706);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    margin-top: 10px;
    box-shadow: none;
}

.btn-outline:hover {
    background: rgba(6, 182, 212, 0.1);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* --- Results & Math --- */
.res {
    margin-top: 25px;
    padding: 20px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid var(--accent);
    border-radius: 10px;
    text-align: center;
    display: none;
    box-shadow: inset 0 0 20px rgba(6, 182, 212, 0.1);
}

.res.show {
    display: block;
    animation: slideDown 0.3s;
}

.res.err {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #fca5a5;
}

.val {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    margin-top: 10px;
    text-shadow: 0 0 10px var(--accent-glow);
    direction: ltr;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Visualization Area --- */
.viz-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.viz-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.viz-title {
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-weight: bold;
}

canvas {
    background: #0f172a;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.sim-stats {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.sim-stats span {
    color: var(--accent);
    font-weight: bold;
}

/* --- Math Styling --- */
.math-box {
    background: rgba(30, 41, 59, 0.6);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px dashed var(--border);
    overflow-x: auto; /* Allow horizontal scroll for long formulas */
}

.math-title {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.formula {
    font-family: 'Times New Roman', serif;
    font-size: 1.5rem;
    text-align: center;
    direction: ltr;
    padding: 15px 0;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
    white-space: nowrap; /* Prevent breaking lines */
}

.fraction {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    margin: 0 8px;
}

.fraction>span {
    display: block;
    padding: 0 5px;
}

.fraction span.numerator {
    border-bottom: 2px solid var(--primary);
}

.sqrt {
    display: inline-flex;
    align-items: center;
    position: relative;
    margin: 0 4px;
}

.sqrt::before {
    content: "\221A";
    font-size: 1.3em;
    margin-left: 2px;
    color: var(--primary);
}

.sqrt-inner {
    border-top: 1px solid #fff;
    padding-top: 2px;
    padding-left: 4px;
}

.sup {
    font-size: 0.7em;
    vertical-align: super;
    margin-left: 2px;
}

.sub {
    font-size: 0.7em;
    vertical-align: sub;
    margin-right: 2px;
}

.symbol {
    font-style: italic;
    color: var(--accent);
}

.steps-list {
    list-style: none;
    counter-reset: step;
}

.steps-list li {
    position: relative;
    padding-right: 35px;
    margin-bottom: 12px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.steps-list li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    right: 0;
    top: 2px;
    width: 24px;
    height: 24px;
    background: rgba(245, 158, 11, 0.2);
    color: var(--primary);
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 0.8rem;
    font-weight: bold;
    border: 1px solid var(--primary);
}

.steps-list strong {
    color: var(--text-main);
}

.symbol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    font-size: 0.85rem;
}

.symbol-item {
    background: rgba(15, 23, 42, 0.5);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border);
}

.symbol-item span {
    display: block;
    font-family: 'Times New Roman', serif;
    font-weight: bold;
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: var(--primary);
}

/* --- Responsive Design --- */

@media (max-width: 900px) {
    .viz-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --hh: 60px;
    }

    .menu-btn {
        display: block;
    }

    /* Sidebar Logic */
    aside {
        position: fixed;
        top: var(--hh);
        right: 0;
        height: calc(100vh - var(--hh));
        width: 80%;
        max-width: 300px;
        transform: translateX(100%); /* Hide off-screen to the right */
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    }

    aside.open {
        transform: translateX(0); /* Slide in */
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Content Adjustments */
    main {
        padding: 20px 15px;
    }

    .sec {
        max-width: 100%;
    }

    h2 {
        font-size: 1.4rem;
    }

    .card {
        padding: 20px;
    }

    /* Inputs & Buttons */
    input,
    select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px;
    }

    .btn {
        padding: 16px;
        font-size: 1.1rem;
    }

    /* Formula Adjustments */
    .formula {
        font-size: 1.2rem;
        overflow-x: auto;
        display: inline-block;
        min-width: 100%;
    }

    /* Symbol Grid */
    .symbol-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    h2 { font-size: 1.2rem; }
    .logo-area span { display: none; } /* Hide text logo on very small screens */
    .logo-area svg { width: 32px; height: 32px; }
}