:root {
    --bg-dark: #090b14;
    --card-bg: rgba(18, 22, 36, 0.75);
    --primary-neon: #00f0ff;
    --electron-glow: #7000ff;
    --wire-copper: #c0392b;
    --energy-gold: #ffa502;
    --battery-green: #2ed573;
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at center, #1b223d 0%, var(--bg-dark) 100%);
}

.app-container {
    width: 95vw;
    max-width: 1250px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255,255,255,0.02);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    z-index: 10;
}

h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(90deg, #00f0ff, #7000ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

main {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

.views-wrapper {
    flex: 1;
    position: relative;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Views (Macro vs Micro) */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.7s cubic-bezier(0.25, 1, 0.5, 1), transform 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.08); 
}

#macro-view.hidden {
    transform: scale(3) translate(0px, 100px); /* O circuito expande dando a ideia de entrar no fio */
}

.macro-active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

#micro-view {
    flex-direction: column;
    transform: scale(0.8);
}

#micro-view:not(.hidden) {
    transform: scale(1);
}

/* --------------- VISÃO MACRO (CIRCUITO SVG) --------------- */
.circuit-diagram {
    display: block;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 20px 30px rgba(0,0,0,0.5));
}

.wire-bg {
    stroke: #1e272e;
    stroke-width: 18;
    stroke-linecap: round;
}

.wire {
    stroke: #d35400; /* Cobre escuro (apagado) */
    stroke-width: 10;
    animation: flowPulse 2s linear infinite;
    stroke: var(--energy-gold); /* Ligado */
}

.wire.interactable {
    cursor: pointer;
    transition: stroke-width 0.3s ease, stroke 0.3s ease, filter 0.3s ease;
}

.wire.interactable:hover {
    stroke-width: 14;
    stroke: #ffeaa7;
    filter: drop-shadow(0 0 15px rgba(255, 165, 2, 0.9));
}

.pulsing-hint {
    animation: hintPulse 1.5s ease-in-out infinite;
}

@keyframes hintPulse {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.2); opacity: 0.3; }
    100% { transform: scale(1); opacity: 0.9; }
}

.bulb-glass.glow {
    fill: #feca57;
    animation: bulbPulse 1.5s infinite alternate;
}

@keyframes bulbPulse {
    from { 
        fill: #feca57; 
        filter: drop-shadow(0 0 20px rgba(254, 202, 87, 0.4)); 
    }
    to { 
        fill: #ffdb58; 
        filter: drop-shadow(0 0 50px rgba(254, 202, 87, 1)) drop-shadow(0 0 80px rgba(254, 202, 87, 0.5)); 
    }
}

.glow-filament {
    animation: filamentIntensity 1.5s infinite alternate;
}

@keyframes filamentIntensity {
    from { filter: drop-shadow(0 0 2px #fff); stroke: #ff7f50; }
    to { filter: drop-shadow(0 0 5px #fff); stroke: #fff; }
}


/* --------------- VISÃO MICRO (FIOS E ELÉTRONS) --------------- */
.wire-container {
    width: 85%;
    height: 200px;
    margin-bottom: 2rem;
    perspective: 1000px;
    transform-style: preserve-3d;
}

.wire-cylinder {
    width: 100%;
    height: 100%;
    /* Gradiente dando volume 3D para um fio de cobre neon */
    background: linear-gradient(180deg, #7a2700 0%, #d35400 15%, #ff7f50 40%, #ff8c42 60%, #c0392b 85%, #591b00 100%);
    border-radius: 80px; 
    position: relative;
    overflow: hidden;
    box-shadow: 
        inset 0 15px 30px rgba(0,0,0,0.6), 
        inset 0 -15px 30px rgba(0,0,0,0.6), 
        0 20px 40px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.05);
}

.wire-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.8) 100%);
    z-index: 5;
    pointer-events: none;
}

.electrons-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 2;
}

.electron {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: var(--primary-neon);
    border-radius: 50%;
    box-shadow: 
        0 0 10px #fff,
        0 0 20px var(--primary-neon), 
        0 0 40px var(--electron-glow);
    animation: pulseParticle 1s infinite alternate;
}

.electron::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 50%;
    transform: translateY(-50%);
    width: 70px;
    height: 8px;
    background: linear-gradient(to right, transparent, var(--primary-neon));
    border-radius: 4px;
    filter: blur(2px);
    z-index: -1;
}

@keyframes pulseParticle {
    0% { transform: scale(0.9); }
    100% { transform: scale(1.1); }
}

/* --------------- VISÃO MICRO (PAINEL DE FÓRMULA) --------------- */
.formula-panel {
    background: rgba(10, 12, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    padding: 1.5rem 2rem;
    border-radius: 20px;
    text-align: center;
    max-width: 320px;
    opacity: 1;
    transform: translateY(0);
}

.formula-panel h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.equation {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 2rem;
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 12px;
}

.fraction {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.numerator {
    border-bottom: 4px solid var(--text-main);
    padding: 0 0.8rem 0.2rem 0.8rem;
}

.denominator {
    padding: 0.2rem 0.8rem 0 0.8rem;
}

.highlight-i { color: var(--energy-gold); text-shadow: 0 0 15px rgba(255, 165, 2, 0.5); }
.highlight-q { color: var(--primary-neon); text-shadow: 0 0 15px rgba(0, 240, 255, 0.5); }
.highlight-t { color: #ff4757; text-shadow: 0 0 15px rgba(255, 71, 87, 0.5); }

.legend {
    list-style: none;
    text-align: left;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.5;
}

.description {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 0.8rem;
}

.btn-back {
    margin-top: 2rem;
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #1e272e, #2f3640);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
}

.btn-back:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.5), 0 0 15px rgba(255,255,255,0.1);
    background: linear-gradient(135deg, #2f3640, #353b48);
}
