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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    line-height: 1.6;
    min-height: 100vh;
}

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

header {
    text-align: center;
    padding: 3rem 0;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
    margin-bottom: 3rem;
}

h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
}

section {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    animation: slideIn 0.6s ease-out;
}

h2 {
    color: #60a5fa;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

h2::before {
    content: '';
    width: 4px;
    height: 2rem;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-radius: 2px;
}

h3 {
    color: #93c5fd;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h4 {
    color: #a78bfa;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

p {
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 1rem;
}

/* Key Points */
.key-points {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.point {
    background: rgba(59, 130, 246, 0.1);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.point-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.point h4 {
    margin-bottom: 0.5rem;
}

.point p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* Math Boxes */
.math-box {
    background: rgba(15, 23, 42, 0.8);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    margin: 1.5rem 0;
}

.formula-group {
    margin: 1.5rem 0;
}

.formula {
    font-size: 1.2rem;
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow-x: auto;
}

.explanation {
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* Notation Guide */
.notation-guide {
    background: rgba(139, 92, 246, 0.1);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    margin-top: 2rem;
}

.notation-guide ul {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.notation-guide li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.notation-guide li:last-child {
    border-bottom: none;
}

.notation-guide strong {
    color: #c4b5fd;
}

/* Learning Rate Demo */
.learning-rate-demo {
    margin-top: 2rem;
}

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

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

.lr-visual {
    width: 100%;
    height: 150px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    margin: 1rem 0;
    position: relative;
    overflow: hidden;
}

.lr-visual[data-type="small"]::after {
    content: '⟿';
    position: absolute;
    font-size: 3rem;
    top: 50%;
    left: 10%;
    transform: translateY(-50%);
    animation: slowMove 4s ease-in-out infinite;
}

.lr-visual[data-type="optimal"]::after {
    content: '➜';
    position: absolute;
    font-size: 3rem;
    top: 50%;
    left: 10%;
    transform: translateY(-50%);
    animation: optimalMove 2s ease-in-out;
    color: #10b981;
}

.lr-visual[data-type="large"]::after {
    content: '⚡';
    position: absolute;
    font-size: 3rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: chaosMove 1s ease-in-out infinite;
    color: #ef4444;
}

/* Interactive Demo */
.demo-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.control-group label {
    display: block;
    color: #93c5fd;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.5);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.5);
}

.demo-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0;
    justify-content: center;
}

.demo-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.demo-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.demo-btn.primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.demo-btn.secondary {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.network-visualization {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    overflow-x: auto;
}

#backpropNetwork {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
}

.computation-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.detail-column h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(59, 130, 246, 0.3);
}

.calc-display {
    background: rgba(15, 23, 42, 0.6);
    padding: 1rem;
    border-radius: 8px;
    min-height: 150px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
}

.calc-display .calc-step {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

.calc-display .highlight {
    color: #10b981;
    font-weight: bold;
}

/* Matrix Operations */
.matrix-example {
    margin: 2rem 0;
    padding: 2rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.matrix-visual {
    margin: 1.5rem 0;
}

.matrix-eq {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.matrix {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.multiply, .plus, .equals {
    font-size: 1.5rem;
    color: #60a5fa;
    font-weight: bold;
}

.dimension-note {
    background: rgba(15, 23, 42, 0.6);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.dimension-note ul {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.dimension-note li {
    padding: 0.5rem 0;
    color: rgba(255, 255, 255, 0.85);
}

/* Algorithm Summary */
.algorithm-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.algo-step {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.algo-step:hover {
    transform: translateX(8px);
    border-color: rgba(59, 130, 246, 0.5);
}

.step-num {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.step-content h4 {
    margin-bottom: 0.5rem;
}

.step-content p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* Common Issues */
.issues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.issue-card {
    background: rgba(15, 23, 42, 0.6);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.issue-card:hover {
    transform: translateY(-5px);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
}

.issue-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.issue-card ul {
    list-style: none;
    padding-left: 1rem;
}

.issue-card li {
    padding: 0.25rem 0;
    position: relative;
}

.issue-card li::before {
    content: '→';
    position: absolute;
    left: -1rem;
    color: #10b981;
}

/* Gradient Visualization */
.visual-gradient {
    background: rgba(15, 23, 42, 0.8);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    margin: 1.5rem 0;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    margin-top: 3rem;
}

footer a {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #93c5fd;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slowMove {
    0%, 100% { left: 10%; }
    50% { left: 30%; }
}

@keyframes optimalMove {
    0% { left: 10%; }
    100% { left: 85%; }
}

@keyframes chaosMove {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-20%, -20%) rotate(90deg); }
    50% { transform: translate(-80%, -80%) rotate(180deg); }
    75% { transform: translate(-20%, -80%) rotate(270deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .key-points,
    .lr-container,
    .demo-controls,
    .computation-details,
    .issues-grid {
        grid-template-columns: 1fr;
    }

    .matrix-eq {
        flex-direction: column;
    }

    #backpropNetwork {
        width: 100%;
        height: auto;
    }
}

/* SVG Styles */
.neuron {
    cursor: pointer;
    transition: all 0.3s ease;
}

.neuron:hover circle {
    filter: drop-shadow(0 0 10px currentColor);
}

.weight-arrow {
    transition: all 0.3s ease;
}

.gradient-highlight {
    fill: #10b981;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
