/* =========================================
   Circuit Theory Specific Styles (circuit.css)
   ========================================= */

/* Main Content */
.circuit-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
}

.circuit-section {
    padding: 80px 0;
    border-bottom: 1px solid var(--border);
    display: none;
    scroll-margin-top: 150px;
}

.circuit-section.active {
    display: block;
}

/* =========================================
   Section 1: Fundamental Concepts
   ========================================= */

.subsection {
    margin-bottom: 60px;
}

.subsection__title {
    color: #facc15;
    margin-bottom: 25px;
    font-family: var(--font-head);
    letter-spacing: 1px;
    border-bottom: 1px dashed rgba(250, 204, 21, 0.3);
    padding-bottom: 10px;
    display: inline-block;
}

/* Flip Cards */
.flip-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    perspective: 1000px;
}

.flip-card {
    background-color: transparent;
    height: 220px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: z-index 0s 0.3s;
}

.flip-card:hover {
    z-index: 10;
    transition: z-index 0s 0s;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    border-radius: 12px;
    box-sizing: border-box;
    overflow: hidden;
}

.flip-card-front h4 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.flip-hint {
    margin-top: 25px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.flip-card-back {
    transform: rotateY(180deg);
    background: rgba(0, 245, 255, 0.08);
    border: 1px solid rgba(0, 245, 255, 0.25);
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.1);
}

.flip-card-back p {
    font-size: 0.78rem;
    margin-bottom: 5px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.flip-card-back strong {
    color: var(--text-primary);
    font-weight: 600;
}

.neon-svg {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 0 5px currentColor);
}

.icon-split {
    font-size: 2.5rem;
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Parameter Cards */
.parameter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.param-card {
    display: flex;
    flex-direction: column;
}

.param-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.param-header h4 {
    color: var(--text-primary);
}

.param-header .unit {
    color: var(--electric-yellow);
    font-family: var(--font-head);
    font-size: 0.9rem;
}

.param-formula {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.param-animation {
    height: 120px;
    background: rgba(10, 14, 26, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Resistor animation */
.resistor-bar-anim {
    width: 80%;
    height: 20px;
    background: linear-gradient(90deg, #ff5252, #ff9800);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.restriction-zone {
    position: absolute;
    left: 40%;
    width: 20%;
    height: 100%;
    background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(0, 0, 0, 0.5) 5px, rgba(0, 0, 0, 0.5) 10px);
}

.current-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: radial-gradient(circle, #fff 10%, transparent 20%) 0 0 / 20px 20px;
    animation: flowRight 2s linear infinite;
}

@keyframes flowRight {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Inductor Visuals Container */
.inductor-visuals {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.inductor-anim-container {
    height: 80px;
    background: rgba(10, 14, 26, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.inductor-anim {
    width: 100%;
    height: 100%;
}

/* Synced Animation Keyframes */
.current-wave {
    stroke-dasharray: 100;
    animation: waveFlow 2s linear infinite;
    opacity: 0.8;
}

@keyframes waveFlow {
    0% {
        stroke-dashoffset: 100;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

.inductor-anim .mag-field {
    animation: pulseFieldSync 2s ease-in-out infinite;
    transform-origin: center;
}

@keyframes pulseFieldSync {

    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.1;
        stroke-width: 1px;
    }

    50% {
        transform: scale(1.3);
        opacity: 1;
        stroke-width: 3px;
    }
}

/* Capacitor animation */
.capacitor-anim {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.plate {
    width: 120px;
    height: 10px;
    background: var(--text-muted);
    border-radius: 5px;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    position: relative;
}

.top-plate {
    border-bottom: 2px solid var(--neon-cyan);
}

.bottom-plate {
    border-top: 2px solid var(--electric-yellow);
}

.dielectric {
    width: 100px;
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
}

.charge {
    font-weight: bold;
    opacity: 0;
    animation: chargeUp 3s infinite;
}

.charge-pos {
    color: var(--neon-cyan);
}

.charge-neg {
    color: var(--electric-yellow);
}

.top-plate .charge:nth-child(1) {
    animation-delay: 0s;
}

.top-plate .charge:nth-child(2) {
    animation-delay: 0.5s;
}

.top-plate .charge:nth-child(3) {
    animation-delay: 1s;
}

.bottom-plate .charge:nth-child(1) {
    animation-delay: 0.1s;
}

.bottom-plate .charge:nth-child(2) {
    animation-delay: 0.6s;
}

.bottom-plate .charge:nth-child(3) {
    animation-delay: 1.1s;
}

@keyframes chargeUp {
    0% {
        opacity: 0;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(0);
    }

    90% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Sources */
.sources-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .sources-container {
        grid-template-columns: 1fr;
    }
}

.source-types {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.src-icon-svg {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 0 5px currentColor);
}

.transform-formula {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
}

.transform-anim-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    cursor: pointer;
}

.tr-vs,
.tr-is {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.tr-vs.active,
.tr-is.active {
    opacity: 1;
}

.tr-arrow {
    font-size: 2rem;
    color: var(--text-muted);
}

/* Topology Diagram */
.topology-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
}

@media (max-width: 768px) {
    .topology-container {
        grid-template-columns: 1fr;
    }
}

.topo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.topo-hover {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topo-hover:hover {
    background: rgba(0, 245, 255, 0.1);
    transform: translateX(5px);
}

.topo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
    display: inline-block;
}

.topo-line {
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    display: inline-block;
}

.topo-dash {
    width: 20px;
    height: 2px;
    border-bottom: 2px dashed var(--text-secondary);
    display: inline-block;
}

.topo-fill {
    width: 15px;
    height: 15px;
    background: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255, 255, 255, 0.2) 2px, rgba(255, 255, 255, 0.2) 4px);
    display: inline-block;
}

.topo-hover:hover .topo-dot,
.topo-hover.active .topo-dot {
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
}

.topo-hover:hover .topo-line,
.topo-hover.active .topo-line {
    background: var(--text-primary);
    box-shadow: 0 0 10px var(--text-primary);
}

.topo-hover:hover .topo-dash,
.topo-hover.active .topo-dash {
    border-color: var(--electric-yellow);
}

.topo-hover:hover .topo-fill,
.topo-hover.active .topo-fill {
    background: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(0, 245, 255, 0.4) 2px, rgba(0, 245, 255, 0.4) 4px);
}

.topology-diagram {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 12px;
}

.topo-svg {
    width: 100%;
    height: auto;
    max-width: 400px;
    margin: 0 auto;
    display: block;
}

/* Base states for diagram elements */
.t-elem {
    transition: all 0.3s ease;
}

.topo-nodes.active {
    fill: var(--neon-cyan);
    r: 7;
    filter: drop-shadow(0 0 5px var(--neon-cyan));
}

.topo-branches.active {
    stroke: var(--text-primary);
    filter: drop-shadow(0 0 3px var(--text-primary));
    stroke-width: 3;
}

.topo-loops.active {
    opacity: 1;
    stroke: var(--electric-yellow);
    filter: drop-shadow(0 0 5px var(--electric-yellow));
    stroke-width: 3;
    stroke-dasharray: 5, 5;
    animation: dashAnim 1s linear infinite;
}

.topo-meshes.active {
    opacity: 1;
}

@keyframes dashAnim {
    0% {
        stroke-dashoffset: 10;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

/* Formula Specific Styling */
.formula {
    font-size: 1.1rem;
    color: #e2e8f0;
    text-align: center;
    padding: 12px;
    background: rgba(0, 245, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(0, 245, 255, 0.15);
    margin: 10px 0;
}

.katex {
    color: #ffffff !important;
    font-size: 1.2em !important;
}

.katex-display {
    margin: 0.5em 0 !important;
}

/* =========================================
   SECTION 2: DC & AC ANALYSIS UI
   ========================================= */

/* Ohm's Law Triangle */
.ohms-law-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: center;
    justify-content: center;
}

.ohms-triangle {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.triangle-btn {
    cursor: pointer;
    transition: all 0.3s;
}

.triangle-btn .hover-zone:hover {
    fill: rgba(0, 245, 255, 0.2);
}

.triangle-btn.active text {
    fill: #fff;
    text-shadow: 0 0 10px #fff;
}

.triangle-btn.active .hover-zone {
    fill: rgba(0, 245, 255, 0.4);
}

.ohms-display {
    flex: 2;
    min-width: 250px;
    background: rgba(10, 14, 26, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    position: relative;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ohms-formula-box {
    display: none;
    width: 100%;
    text-align: center;
}

.ohms-formula-box.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

.ohms-formula-box p {
    margin-top: 15px;
    color: var(--text-muted);
    font-size: 0.95em;
}

/* Phasors Container */
.phasor-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: center;
}

.phasor-formulas {
    flex: 1;
    min-width: 250px;
}

.phasor-visualizer {
    flex: 2;
    min-width: 300px;
    background: rgba(10, 14, 26, 0.8);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Range Slider neon styling */
.neon-slider {
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
    outline: none;
    margin-top: 10px;
}

.neon-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    box-shadow: 0 0 10px var(--neon-cyan);
}

/* 3 Phase Toggles */
.p-btn {
    transition: all 0.3s ease;
}

.p-btn.active.outline-btn {
    background: var(--electric-yellow);
    color: var(--bg-primary);
    border-color: var(--electric-yellow);
    box-shadow: 0 0 15px var(--electric-yellow);
}

/* =========================================
   SECTION 3: NETWORK THEOREMS UI
   ========================================= */

.stepper-ui {
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.stepper-nav {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
}

.stepper-nav::-webkit-scrollbar {
    display: none;
}

.step-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-head);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
}

.step-btn:hover {
    background: rgba(0, 245, 255, 0.05);
    color: var(--text-primary);
}

.step-btn.active {
    color: var(--neon-cyan);
    border-bottom: 2px solid var(--neon-cyan);
    background: rgba(0, 245, 255, 0.1);
}

.stepper-content-box {
    padding: 20px;
    min-height: 250px;
    position: relative;
}

.step-pane {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.step-pane.active {
    display: block;
}

.stepper-svg-box {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.th-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.1));
}

.stepper-text {
    text-align: center;
    margin-top: 15px;
}

.theorem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

/* --- Section 4: Flip Cards (Laplace Key Pairs) --- */
.laplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.flip-card {
    background-color: transparent;
    width: 100%;
    height: 100px;
    perspective: 1000px;
    cursor: pointer;
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-card:hover .flip-inner {
    transform: rotateY(180deg);
}

.flip-front,
.flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
}

.flip-front {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.flip-back {
    background: rgba(244, 143, 177, 0.1);
    border: 1px solid #f48fb1;
    color: #f48fb1;
    transform: rotateY(180deg);
}

/* --- SVG Keyframe Animations for Section 4 --- */
.anim-path {
    stroke-dasharray: 200;
}

.rc-curve {
    stroke-dashoffset: 200;
    animation: extendCurve 3s ease-out infinite;
}

.rl-curve {
    stroke-dashoffset: 200;
    animation: extendCurve 3s ease-in-out infinite;
}

@keyframes extendCurve {
    0% {
        stroke-dashoffset: 200;
    }

    40% {
        stroke-dashoffset: 0;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

.cap-fill {
    transform-origin: bottom;
    animation: capFillAnim 3s ease-out infinite;
}

@keyframes capFillAnim {
    0% {
        transform: scaleY(0);
        fill: rgba(0, 245, 255, 0);
    }

    40% {
        transform: scaleY(1);
        fill: rgba(0, 245, 255, 1);
    }

    100% {
        transform: scaleY(1);
        fill: rgba(0, 245, 255, 1);
    }
}

.mag-flux {
    animation: fluxPulse 3s ease-in-out infinite;
    transform-origin: center;
}

.flux-1 {
    animation-delay: 0.2s;
}

.flux-2 {
    animation-delay: 0.4s;
}

@keyframes fluxPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    60% {
        transform: scale(1.5);
        opacity: 0;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.z-peak,
.y-peak {
    animation: glowPulse 2s infinite alternate;
}

@keyframes glowPulse {
    from {
        r: 3;
        filter: drop-shadow(0 0 4px #fff);
    }

    to {
        r: 6;
        filter: drop-shadow(0 0 12px #fff);
    }
}

.bw-pt {
    animation: popPulse 1.5s infinite;
}

.bw-1 {
    animation-delay: 0s;
}

.bw-2 {
    animation-delay: 0.75s;
}

@keyframes popPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.bw-bracket {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawBracket 3s ease-out infinite;
}

@keyframes drawBracket {
    0% {
        stroke-dashoffset: 400;
    }

    40% {
        stroke-dashoffset: 0;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

/* =========================================
   CARD 0: Units & Dimensions Styles
   ========================================= */
.units-table-container {
    overflow-x: auto;
}

.neon-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.95em;
    text-align: left;
}

.neon-table th {
    padding: 12px 15px;
    border-bottom: 2px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.neon-table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.neon-table tr:hover td {
    background: rgba(0, 245, 255, 0.05);
    cursor: pointer;
}

.neon-table tr:hover .qty-col {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 245, 255, 0.5);
}

.neon-table tr:hover .dim-col {
    color: var(--electric-yellow);
    text-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

/* Dimension Colors */
:root {
    --dim-m: #ff5252;
    /* Mass - Red */
    --dim-l: #42a5f5;
    /* Length - Blue */
    --dim-t: #facc15;
    /* Time - Gold/Yellow */
    --dim-a: #69f0ae;
    /* Current - Green */
}

.dim-m {
    color: var(--dim-m);
}

.dim-l {
    color: var(--dim-l);
}

.dim-t {
    color: var(--dim-t);
}

.dim-a {
    color: var(--dim-a);
}

/* =========================================
   CARD 0: Resistor Combiner & Animations
   ========================================= */
.card-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.card-grid-sidebar {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .card-grid-2 {
        grid-template-columns: 1fr;
    }
    .card-grid-sidebar {
        grid-template-columns: 1fr;
    }
}

.mini-calc {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
}

.neon-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 245, 255, 0.3);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    text-align: center;
}

.neon-input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 245, 255, 0.5);
}

/* =========================================
   CARD 0.3: Delta - Star Conversion
   ========================================= */
.ds-visual {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

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

.ds-pane {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* =========================================
   CARD 0.4: Resistor vs Temp
   ========================================= */
.rvt-chart-container {
    position: relative;
    overflow: hidden;
}

.neon-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    border-radius: 2px;
    margin-top: 10px;
}

.neon-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    box-shadow: 0 0 10px var(--neon-cyan);
}

/* =========================================
   CARD 0.7 & 0.8: Metals and Dielectrics
   ========================================= */

.metal-row,
.dielectric-row {
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.metal-row:hover {
    background: rgba(0, 240, 255, 0.1);
}

.dielectric-row:hover {
    background: rgba(188, 19, 254, 0.1);
    box-shadow: inset 0 0 10px rgba(188, 19, 254, 0.2);
}

.prop-badge {
    padding: 8px 15px;
    border-radius: 6px;
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    transition: 0.3s;
    animation: badgeBounce 2s infinite alternate;
}

.box-linear {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    text-shadow: var(--glow-cyan);
    animation-delay: 0s;
}

.box-bilateral {
    border-color: var(--neon-purple);
    color: var(--neon-purple);
    text-shadow: 0 0 10px var(--neon-purple);
    animation-delay: 0.4s;
}

.box-passive {
    border-color: var(--electric-yellow);
    color: var(--electric-yellow);
    text-shadow: 0 0 10px var(--electric-yellow);
    animation-delay: 0.8s;
}

@keyframes badgeBounce {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-5px);
    }
}

/* --- Capacitor Key Points Animations (Card 0.15) --- */
.e-field-lines {
    animation: flowLines 1.5s linear infinite;
}

@keyframes flowLines {
    0% {
        stroke-dashoffset: 8;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

.polarity-arrow-c {
    stroke-dasharray: 4, 4;
    animation: flowLines 1s linear infinite reverse;
}

.polarity-arrow-d {
    stroke-dasharray: 4, 4;
    animation: flowLines 1s linear infinite;
}

/* =========================================
   TWO PORT NETWORKS - Cards 44-54
   ========================================= */

/* Card grid layout */
.card-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .card-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Mini parameter grid inside cards */
.mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* SVG diagrams */
.tp-meas-svg {
    max-width: 280px;
    width: 100%;
    display: block;
    margin: 0 auto;
}

/* Two Port Card accent */
.tp-card {
    transition: box-shadow 0.3s ease;
}

.tp-card:hover {
    box-shadow: 0 0 18px rgba(0, 245, 255, 0.15);
}

/* h/g tabs */
.hg-tabs {
    display: flex;
    gap: 8px;
}

/* Connection tabs */
.conn-tabs .hero__cta.active,
.conn-tabs .hero__cta:hover {
    background: rgba(0, 245, 255, 0.15);
}

/* Neon input fields */
.neon-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 245, 255, 0.4);
    border-radius: 5px;
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 0.9em;
    transition: border 0.2s;
    outline: none;
    width: 100%;
}

.neon-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 245, 255, 0.3);
}

select.neon-input option {
    background: #0f1220;
    color: var(--text-primary);
}

/* Neon slider */
.neon-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 245, 255, 0.3);
    outline: none;
}

.neon-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--neon-cyan);
    cursor: pointer;
    box-shadow: 0 0 6px var(--neon-cyan);
}

/* Badge styles */
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
}

/* Connection pane */
.conn-pane.active {
    display: block;
}

/* Subsection title */
.subsection__title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--neon-cyan);
    letter-spacing: 1px;
    border-left: 4px solid var(--neon-cyan);
    padding-left: 12px;
    margin-bottom: 1.5rem;
}

/* T-Pi SVG animation */
#t-pi-svg line,
#t-pi-svg text {
    transition: all 0.5s ease;
}

/* =========================================
   TWO PORT NETWORKS - MOBILE RESPONSIVE
   ========================================= */

/* ----- Tablet (max-width: 768px) ----- */
@media (max-width: 768px) {

    /* Card grids → single column */
    .card-grid-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Intro flex container → stack vertically */
    .two-port-intro-container {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .two-port-svg-wrapper {
        min-width: unset !important;
    }

    .two-port-intro-text {
        min-width: unset !important;
    }

    /* Parameter selector buttons → wrap smaller */
    .param-set-selector {
        gap: 6px !important;
        justify-content: center;
    }

    .param-sel-btn {
        font-size: 0.75em !important;
        padding: 4px 10px !important;
    }

    /* Mini param grids → 2 cols still but smaller gap */
    .mini-grid {
        gap: 6px;
    }

    /* h/g tab header → stack */
    .hg-tabs {
        flex-direction: column;
        gap: 6px;
    }

    .hg-tabs .hero__cta {
        font-size: 0.75em;
        padding: 6px 10px;
    }

    .hg-content-wrapper {
        min-height: 220px !important;
    }

    /* BJT/FET SVGs */
    .bjt-model-container svg,
    .fet-model-container svg {
        max-width: 100% !important;
    }

    .bjt-model-container .row,
    .fet-model-container .row {
        flex-direction: column !important;
        gap: 4px;
        text-align: center;
    }

    /* Hybrid params header → stack */
    .card-panel>div[style*="justify-content:space-between"] {
        flex-direction: column !important;
        gap: 10px;
    }

    /* ABCD/abcd cards */
    .mini-grid.text-sm {
        font-size: 0.82em;
    }

    /* Symmetry checker → stack */
    #sym-inputs {
        flex-wrap: wrap !important;
        gap: 5px !important;
    }

    #sym-inputs .neon-input {
        width: 50px !important;
        font-size: 0.8em;
        padding: 4px 6px;
    }

    #sym-results {
        margin-left: 0 !important;
        flex-wrap: wrap;
        gap: 6px !important;
    }

    .badge {
        font-size: 0.7em;
        padding: 3px 8px;
    }

    /* Connection tabs → scroll horizontal */
    .conn-tabs {
        gap: 6px !important;
        padding-bottom: 8px !important;
    }

    .conn-tabs .hero__cta {
        font-size: 0.72em;
        padding: 5px 10px;
        white-space: nowrap;
    }

    /* Transformer card → stack */
    .card-panel>div[style*="flex-wrap:wrap"][style*="gap:20px"] {
        flex-direction: column !important;
        gap: 15px !important;
    }

    /* T-Pi card → stack */
    .t-pi-visual-container {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .t-pi-visual-container>div {
        min-width: unset !important;
    }

    /* Universal converter → stack */
    .card-panel>div[style*="flex-wrap:wrap"][style*="padding:15px"] {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .card-panel>div[style*="flex-wrap:wrap"][style*="padding:15px"]>div {
        min-width: unset !important;
    }

    /* Converter results grid → single col */
    .card-panel>div>div[style*="grid-template-columns: 1fr 1fr"][style*="gap:15px"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Neon slider → larger touch target */
    .neon-slider {
        height: 6px;
    }

    .neon-slider::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }

    /* Subsection title → smaller on mobile */
    .subsection__title {
        font-size: 1.1rem;
    }

    /* KaTeX formulas: allow horizontal scroll */
    .formula {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Neon inputs → slightly larger for touch */
    .neon-input {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
        padding: 8px 10px;
    }

    select.neon-input {
        font-size: 16px;
    }

    /* Card panels → reduce padding for mobile */
    .tp-card {
        padding: 12px !important;
    }
}

/* ----- Small Mobile (max-width: 480px) ----- */
@media (max-width: 480px) {

    /* Mini grid → single column on very small screens */
    .mini-grid {
        grid-template-columns: 1fr;
    }

    /* Param buttons → 3-per-row */
    .param-set-selector {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 5px !important;
    }

    .param-sel-btn {
        font-size: 0.7em !important;
        padding: 5px 6px !important;
        text-align: center;
    }

    /* h/g wrapper → reduce min height */
    .hg-content-wrapper {
        min-height: 180px !important;
    }

    /* Symmetry checker inputs → full width row */
    #sym-inputs {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 6px !important;
    }

    #sym-inputs .neon-input {
        width: 100% !important;
    }

    /* Badges → full width */
    #sym-results {
        flex-direction: column;
    }

    /* Converter input grid → single col */
    .card-panel>div>div[style*="grid-template-columns: 1fr 1fr"][style*="gap:10px"] {
        grid-template-columns: 1fr !important;
    }

    /* Subsection title → even smaller */
    .subsection__title {
        font-size: 1rem;
        padding-left: 8px;
    }

    /* Card panel → tighter padding */
    .tp-card {
        padding: 10px !important;
    }

    .card-panel {
        padding: 10px;
    }

    /* SVG containers → full width */
    .tp-meas-svg {
        max-width: 100%;
    }

    .tp-intro-svg {
        max-width: 100% !important;
    }

    /* Tables → allow scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .neon-table {
        font-size: 0.8em;
        min-width: 400px;
    }

    .neon-table th,
    .neon-table td {
        padding: 8px 10px;
    }
}

/* =========================================================================
   GLASS SIDEBAR DESIGN
   ========================================================================= */

/* Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 80px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #00f0ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
    background: rgba(0, 240, 255, 0.15);
    border-color: rgba(0, 240, 255, 0.4);
    transform: scale(1.05);
}

.sidebar-toggle.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-60px);
}

/* Thevenin/Norton Step Buttons */
.thev-step-btn.active,
.norton-step-btn.active {
    background: rgba(0, 240, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(0, 240, 255, 0.15);
    transform: translateY(-2px);
}
.norton-step-btn.active {
    background: rgba(250, 204, 21, 0.15);
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.4), inset 0 0 10px rgba(250, 204, 21, 0.15);
}

/* Glass Sidebar */
.glass-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 300;
    background: rgba(15, 10, 30, 0.75);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5), inset 0 0 80px rgba(0, 240, 255, 0.03);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.glass-sidebar.open {
    transform: translateX(0);
}

.glass-sidebar::-webkit-scrollbar {
    width: 4px;
}

.glass-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.glass-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.25);
    border-radius: 4px;
}

/* Sidebar Header */
.glass-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-sidebar__profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.glass-sidebar__avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #00f0ff, #00b8d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
}

.glass-sidebar__info {
    display: flex;
    flex-direction: column;
}

.glass-sidebar__label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    color: rgba(0, 240, 255, 0.7);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.glass-sidebar__name {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #fff;
    font-weight: 600;
}

.glass-sidebar__close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.glass-sidebar__close:hover {
    background: rgba(255, 70, 70, 0.15);
    color: #ff6b6b;
    border-color: rgba(255, 70, 70, 0.3);
}

/* Section Label */
.glass-sidebar__section-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2.5px;
    padding: 16px 20px 8px;
    text-transform: uppercase;
}

/* Nav Links */
.glass-sidebar__nav {
    list-style: none;
    padding: 0 10px 20px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.glass-sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.glass-sidebar__link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    border-radius: 0 3px 3px 0;
    background: transparent;
    transition: all 0.3s ease;
}

.glass-sidebar__link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.glass-sidebar__link.active {
    color: #fff;
    background: rgba(0, 240, 255, 0.1);
}

.glass-sidebar__link.active::before {
    background: #00f0ff;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

/* Per-unit active colors */
.glass-sidebar__link[data-unit="1"].active { background: rgba(0, 240, 255, 0.1); }
.glass-sidebar__link[data-unit="1"].active::before { background: #00f0ff; box-shadow: 0 0 12px #00f0ff; }

.glass-sidebar__link[data-unit="2"].active { background: rgba(250, 204, 21, 0.1); }
.glass-sidebar__link[data-unit="2"].active::before { background: #facc15; box-shadow: 0 0 12px #facc15; }

.glass-sidebar__link[data-unit="3"].active { background: rgba(0, 255, 136, 0.1); }
.glass-sidebar__link[data-unit="3"].active::before { background: #00ff88; box-shadow: 0 0 12px #00ff88; }

.glass-sidebar__link[data-unit="4"].active { background: rgba(167, 139, 250, 0.1); }
.glass-sidebar__link[data-unit="4"].active::before { background: #a78bfa; box-shadow: 0 0 12px #a78bfa; }

.glass-sidebar__link[data-unit="5"].active { background: rgba(251, 113, 133, 0.1); }
.glass-sidebar__link[data-unit="5"].active::before { background: #fb7185; box-shadow: 0 0 12px #fb7185; }

.glass-sidebar__icon {
    font-size: 1.1rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

/* Overlay */
.glass-sidebar__overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.glass-sidebar__overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .glass-sidebar {
        width: 260px;
    }

    .sidebar-toggle {
        top: 75px;
        left: 10px;
        width: 40px;
        height: 40px;
    }

    .glass-sidebar__link {
        font-size: 0.78rem;
        padding: 9px 12px;
    }
}

/* ══════════ COMPREHENSIVE MOBILE OPTIMIZATION ══════════ */

/* --- Tablet Portrait / Large Phone (≤768px) --- */
@media (max-width: 768px) {
    .circuit-main { padding: 30px 12px; }
    .circuit-section { padding: 40px 0; }
    .flip-card-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .parameter-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .theorem-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .ohms-display {
        min-width: 0;
        width: 100%;
    }
    .phasor-visualizer {
        min-width: 0;
        width: 100%;
    }
    .phasor-formulas {
        min-width: 0;
        width: 100%;
    }
    .formula {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    .katex-display {
        overflow-x: auto;
        overflow-y: hidden;
    }
    svg[width] { max-width: 100%; height: auto; }
    .hero-icons { gap: 16px; }
    .hero-icon { width: 50px; height: 50px; font-size: 2rem; }
}

/* --- Phone (≤480px) --- */
@media (max-width: 480px) {
    .circuit-main { padding: 20px 8px; }
    .circuit-section { padding: 24px 0; scroll-margin-top: 80px; }
    .subsection { margin-bottom: 30px; }
    .subsection__title { font-size: 1rem; }
    .flip-card-grid { gap: 14px; }
    .flip-card { height: auto; min-height: 200px; }
    .parameter-grid { gap: 14px; }
    .theorem-grid { gap: 14px; }
    .ohms-display { padding: 12px; }
    .phasor-visualizer { padding: 10px; }
    .formula { font-size: 0.95rem; }
    .katex { font-size: 0.9em !important; }
    .hero-icons { gap: 10px; }
    .hero-icon { width: 42px; height: 42px; font-size: 1.6rem; }
    .hero__cta { padding: 12px 24px; font-size: 0.85rem; letter-spacing: 1px; }
}