/* ==================== VARIABLES ==================== */
:root {
    --bitcoin-orange: #f7931a;
    --neon-gold: #ffd700;
    --dark-bg: #0a0a0f;
    --darker-bg: #050508;
    --card-bg: #1a1a24;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --border-color: rgba(247, 147, 26, 0.2);
    --success-color: #00ff88;
    --error-color: #ff3366;
    --neon-orange: #ff8c00;
    --neon-glow: #ffa500;
}

/* ==================== ANIMACIONES DE NEÓN ==================== */
@keyframes subtle-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.005);
    }
}

@keyframes subtle-border {
    0%, 100% {
        border-color: var(--bitcoin-orange);
    }
    50% {
        border-color: #FFD700;
    }
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(135deg, #1a1a24 0%, #0a0a0f 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== LOGO NODE NATION ==================== */
.logo-brand {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1000;
    animation: logoFadeIn 1s ease-out;
}

.logo-nodenation {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(247, 147, 26, 0.3);
    border: 2px solid var(--bitcoin-orange);
    background: white;
    padding: 4px;
    transition: all 0.3s ease;
}

.logo-nodenation:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(247, 147, 26, 0.5);
}

.brand-text {
    font-size: 1.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--bitcoin-orange), var(--neon-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: 'Arial', sans-serif;
}

@keyframes logoFadeIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ==================== BOOK CONTAINER ==================== */
.book-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== BOOK COVER ==================== */
.book-cover {
    background: linear-gradient(135deg, #2d1810 0%, #1a0f0a 100%);
    border-radius: 20px;
    padding: 4rem 3rem;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(247, 147, 26, 0.2),
        inset 0 0 100px rgba(247, 147, 26, 0.05);
    max-width: 600px;
    width: 100%;
    position: relative;
    overflow: hidden;
    animation: bookAppear 1s ease-out;
}

.book-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(247, 147, 26, 0.03) 2px,
            rgba(247, 147, 26, 0.03) 4px
        );
    pointer-events: none;
}

@keyframes bookAppear {
    from {
        opacity: 0;
        transform: scale(0.9) rotateY(-10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateY(0);
    }
}

.cover-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

/* Honey Badger */
.honey-badger {
    margin-bottom: 2rem;
    animation: badgerBounce 2s ease-in-out infinite;
}

.badger-emoji {
    font-size: 5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 5px 15px rgba(247, 147, 26, 0.5));
}

.badger-text {
    font-family: 'Arial', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--bitcoin-orange);
    letter-spacing: 2px;
    text-transform: uppercase;
}

@keyframes badgerBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Book Title */
.book-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.1;
    text-shadow: 0 5px 20px rgba(247, 147, 26, 0.3);
    font-family: 'Arial Black', sans-serif;
}

.bitcoin-text {
    background: linear-gradient(135deg, var(--bitcoin-orange), var(--neon-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.book-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-style: italic;
}

/* Author */
.book-author {
    margin-bottom: 2.5rem;
    padding: 1.5rem 0;
    border-top: 2px solid rgba(247, 147, 26, 0.2);
    border-bottom: 2px solid rgba(247, 147, 26, 0.2);
}

.author-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.author-name {
    font-size: 2rem;
    font-weight: 800;
    color: var(--bitcoin-orange);
    margin-bottom: 0.5rem;
    font-family: 'Arial', sans-serif;
}

.publisher {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Chapter */
.book-chapter {
    background: rgba(247, 147, 26, 0.1);
    border: 2px solid rgba(247, 147, 26, 0.3);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.chapter-number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--bitcoin-orange);
    font-family: 'Arial Black', sans-serif;
    margin-bottom: 0.5rem;
}

.chapter-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-family: 'Arial', sans-serif;
}

.chapter-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Open Book Button */
.btn-open-book {
    background: linear-gradient(135deg, var(--bitcoin-orange), #ff8c00);
    color: white;
    border: none;
    padding: 1.2rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(247, 147, 26, 0.4);
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-open-book:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(247, 147, 26, 0.6);
}

.btn-open-book:active {
    transform: translateY(-1px);
}

/* ==================== BOOK PAGE ==================== */
.book-page {
    background: #faf8f3;
    border-radius: 10px;
    border: 3px solid var(--bitcoin-orange);
    max-width: 900px;
    width: 100%;
    min-height: 80vh;
    animation: pageOpen 0.6s ease-out;
}

@keyframes pageOpen {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Page Navigation */
.page-nav {
    background: linear-gradient(135deg, #2d1810, #1a0f0a);
    padding: 1.5rem 2rem;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--bitcoin-orange);
}

.btn-back {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(247, 147, 26, 0.5);
    padding: 0.7rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Arial', sans-serif;
}

.btn-back:hover {
    background: rgba(247, 147, 26, 0.2);
    border-color: var(--bitcoin-orange);
    transform: translateX(-5px);
}

.page-info {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-family: 'Arial', sans-serif;
}

.page-chapter {
    color: var(--bitcoin-orange);
    font-weight: 700;
}

.page-separator {
    margin: 0 0.5rem;
}

/* Page Content */
.page-content {
    padding: 3rem;
    color: #2d2d2d;
}

/* Lesson Section */
.lesson-section {
    margin-bottom: 3rem;
}

.lesson-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1a0f0a;
    margin-bottom: 1rem;
    font-family: 'Georgia', serif;
    border-bottom: 3px solid var(--bitcoin-orange);
    padding-bottom: 0.5rem;
}

.lesson-intro {
    font-size: 1.2rem;
    color: #4a4a4a;
    line-height: 1.8;
    font-style: italic;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d1810;
    margin-bottom: 1.5rem;
    font-family: 'Georgia', serif;
}

/* Theory Box */
.theory-box {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-left: 5px solid var(--bitcoin-orange);
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.theory-box p {
    color: #4a4a4a;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.definition-box {
    background: linear-gradient(135deg, #fff5e6, #ffe6cc);
    border: 2px solid var(--bitcoin-orange);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.definition-box h3 {
    color: #d97706;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    font-family: 'Arial', sans-serif;
}

.formula {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a0f0a;
    background: rgba(247, 147, 26, 0.1);
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
    margin-top: 1rem;
}

.key-concept {
    background: linear-gradient(135deg, #e6f7ff, #cceeff);
    border: 2px solid #0ea5e9;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.key-concept h3 {
    color: #0369a1;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    font-family: 'Arial', sans-serif;
}

.example-text {
    font-style: italic;
    color: #666;
    margin-top: 1rem;
}

/* Chapter Header */
.chapter-header {
    text-align: center;
    margin-bottom: 3rem;
}

.honey-badger-intro {
    margin-bottom: 2rem;
    animation: badgerFloat 3s ease-in-out infinite;
}

.badger-link {
    display: block;
    text-decoration: none;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.badger-link:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.badger-image {
    width: 300px;
    height: auto;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 10px 30px rgba(247, 147, 26, 0.7));
    background: transparent;
    border: none;
    box-shadow: none;
    display: block;
    margin-left: auto;
    margin-right: auto;
    cursor: pointer;
}

.badger-quote {
    font-size: 1rem;
    color: #666;
    font-style: italic;
    font-weight: 600;
}

@keyframes badgerFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Exercise Card */
.exercise-card {
    background: #fff;
    border: 3px solid var(--bitcoin-orange);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    animation: subtle-border 4s ease-in-out infinite;
}

/* Code Block */
.code-block {
    background: #1e1e1e;
    border-radius: 10px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid var(--bitcoin-orange);
    overflow-x: auto;
    box-shadow: 0 4px 15px rgba(247, 147, 26, 0.2);
}

.code-block pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.code-block code {
    color: #d4d4d4;
    display: block;
}

.code-step {
    color: #6a9955;
    font-style: italic;
    display: block;
    margin-top: 1rem;
}

.code-blank {
    background: #f7931a;
    color: #1e1e1e;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: bold;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.code-blank.filled {
    background: #00ff88;
    animation: none;
}

/* Interactive Choices */
.interactive-choices {
    margin: 2rem 0;
}

.choice-group {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid #e0e0e0;
}

.choice-group h4 {
    color: var(--bitcoin-orange);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.choice-btn {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-family: 'Consolas', 'Monaco', monospace;
}

.choice-btn:hover {
    border-color: var(--bitcoin-orange);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(247, 147, 26, 0.2);
}

.choice-btn.correct {
    background: #00ff88;
    border-color: #00cc66;
    color: #004d26;
    font-weight: bold;
}

.choice-btn.incorrect {
    background: #ff3366;
    border-color: #cc0033;
    color: white;
}

.choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.choice-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.choice-feedback.correct {
    background: #d4f4dd;
    color: #00662e;
    border: 2px solid #00cc66;
}

.choice-feedback.incorrect {
    background: #ffe0e6;
    color: #cc0033;
    border: 2px solid #ff3366;
}

.method-complete {
    background: linear-gradient(135deg, #00ff88, #00cc66);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    margin-top: 2rem;
    animation: celebrate 0.6s ease-out;
}

.method-complete h3 {
    color: #004d26;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

@keyframes celebrate {
    0% { 
        transform: scale(0.8) rotate(-5deg); 
        opacity: 0; 
    }
    50% { 
        transform: scale(1.1) rotate(2deg); 
    }
    100% { 
        transform: scale(1) rotate(0deg); 
        opacity: 1; 
    }
}

/* Shake Animation para respuestas incorrectas */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Mensaje de Felicitación */
.congrats-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: linear-gradient(135deg, #f7931a, #FFD700);
    border: 3px solid #fff;
    border-radius: 25px;
    padding: 3rem 4rem;
    text-align: center;
    z-index: 10000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.congrats-message.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.congrats-message h2 {
    font-size: 3rem;
    color: #1a0f0a;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
    animation: pulse 1s ease-in-out infinite;
}

.congrats-message p {
    font-size: 1.5rem;
    color: #2d1810;
    margin: 0.5rem 0;
    font-weight: 600;
}

.congrats-subtext {
    font-size: 1.2rem !important;
    font-style: italic;
    color: #4a2810 !important;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Mejoras en animaciones de botones */
.choice-btn {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    text-align: left;
    font-family: 'Consolas', 'Monaco', monospace;
    position: relative;
    overflow: hidden;
}

.choice-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(247, 147, 26, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.choice-btn:hover::before {
    width: 300px;
    height: 300px;
}

.choice-btn:hover {
    border-color: var(--bitcoin-orange);
    transform: translateX(5px);
    background: #fafafa;
}

.choice-btn.correct {
    background: linear-gradient(135deg, #00ff88, #00cc66);
    border-color: #00cc66;
    color: #004d26;
    font-weight: bold;
    animation: correctPulse 0.6s ease-out;
}

.choice-btn.incorrect {
    background: linear-gradient(135deg, #ff3366, #cc0033);
    border-color: #cc0033;
    color: white;
    animation: shake 0.5s ease-in-out;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Animación mejorada para code-blank */
.code-blank {
    background: linear-gradient(90deg, #f7931a, #FFD700, #f7931a);
    background-size: 200% 100%;
    color: #1e1e1e;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: bold;
    animation: blinkGradient 2s ease-in-out infinite;
}

@keyframes blinkGradient {
    0%, 100% { 
        background-position: 0% 50%;
        opacity: 1; 
    }
    50% { 
        background-position: 100% 50%;
        opacity: 0.7; 
    }
}

.code-blank.filled {
    background: linear-gradient(135deg, #00ff88, #00cc66);
    animation: fillAnimation 0.6s ease-out;
}

@keyframes fillAnimation {
    0% { 
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* Animación mejorada para method-complete */
.method-complete {
    background: linear-gradient(135deg, #00ff88, #00cc66);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    margin-top: 2rem;
    animation: celebrateGradient 3s ease infinite, celebrate 0.8s ease-out;
    border: 2px solid #00aa55;
}

@keyframes celebrateGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.method-complete h3 {
    color: #004d26;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ==================== CHAPTER 2: ELLIPTIC CURVES ==================== */

/* Curve Controls */
.curve-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    border-radius: 12px;
    border: 2px solid var(--bitcoin-orange);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-group label {
    flex: 0 0 200px;
    font-weight: 600;
    color: #2d1810;
}

.control-group input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(90deg, #ddd, var(--bitcoin-orange));
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bitcoin-orange);
    cursor: pointer;
    border: 2px solid #fff;
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.05);
    border-color: #FFD700;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bitcoin-orange);
    cursor: pointer;
    border: 2px solid #fff;
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.05);
    border-color: #FFD700;
}

.control-value {
    flex: 0 0 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--bitcoin-orange);
    background: white;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Canvas Container */
.canvas-container {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#curve-canvas {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: crosshair;
}

.curve-info {
    background: linear-gradient(135deg, #f7931a, #FFD700);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    color: #1a0f0a;
    font-weight: 600;
    text-align: center;
    border: 1px solid #e0a020;
}

/* Key Concepts Grid */
.key-concepts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.concept-card {
    background: white;
    border: 2px solid var(--bitcoin-orange);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.concept-card:hover {
    transform: translateY(-3px);
    border-color: #FFD700;
}

.concept-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.concept-card h3 {
    color: var(--bitcoin-orange);
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.formula-big {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2d1810;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
}

.concept-card p:last-child {
    color: #666;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* ==================== JUPYTER EXERCISE STYLES ==================== */

.jupyter-exercise {
    margin: 2rem 0;
}

.code-block {
    background: #1e1e1e;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #404040;
}

.code-header {
    background: #2d2d2d;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #404040;
}

.code-lang {
    color: #4EC9B0;
    font-weight: 600;
    font-size: 0.9rem;
}

.code-file {
    color: #9CDCFE;
    font-size: 0.85rem;
}

.code-block pre {
    margin: 0;
    padding: 1.5rem;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #D4D4D4;
}

.code-comment {
    color: #6A9955;
}

.code-keyword {
    color: #C586C0;
    font-weight: 600;
}

.code-function {
    color: #DCDCAA;
}

.code-number {
    color: #B5CEA8;
}

/* Code Input Fields */
.code-input {
    background: #2d2d2d;
    border: 2px solid #f7931a;
    border-radius: 4px;
    color: #fff;
    padding: 0.3rem 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
}

.code-input:focus {
    border-color: #FFD700;
    background: #3d3d3d;
}

.code-input::placeholder {
    color: #666;
    font-style: italic;
}

.code-input-line {
    background: #2d2d2d;
    border: 2px solid #f7931a;
    border-radius: 4px;
    color: #fff;
    padding: 0.5rem 0.8rem;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    width: 100%;
    max-width: 400px;
    transition: all 0.3s ease;
    display: block;
    margin: 0.3rem 0;
}

.code-input-line:focus {
    border-color: #FFD700;
    background: #3d3d3d;
    outline: none;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.code-input-line::placeholder {
    color: #666;
    font-style: italic;
}

/* Code Hints */
.code-hints {
    background: #fff3e0;
    border-left: 4px solid #f7931a;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
}

.code-hints h4 {
    color: #f7931a;
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
}

.code-hints ul {
    margin: 0;
    padding-left: 1.5rem;
}

.code-hints li {
    color: #2d1810;
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

/* Code Feedback */
.code-feedback {
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    font-weight: 600;
    display: none;
}

.code-feedback.show {
    display: block;
}

.code-feedback.success {
    background: linear-gradient(135deg, #e6fff2, #ccffe6);
    border: 2px solid #00cc66;
    color: #004d26;
}

.code-feedback.error {
    background: linear-gradient(135deg, #ffe6e6, #ffcccc);
    border: 2px solid #ef4444;
    color: #8b0000;
}

.run-btn {
    background: linear-gradient(135deg, #00ff88, #00cc66);
    color: #004d26;
    border: 1px solid #00aa55;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.run-btn:hover {
    transform: translateY(-1px);
    border-color: #008844;
}

.run-btn:active {
    transform: translateY(0);
}

.code-output {
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    min-height: 100px;
}

.output-line {
    padding: 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.output-line.true {
    color: #00cc66;
}

.output-line.false {
    color: #ef4444;
}

/* Points Grid */
.points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.point-card {
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.point-card.validated-true {
    border-color: #00cc66;
    background: linear-gradient(135deg, #e6fff2, #ccffe6);
    animation: validPulse 0.6s ease-out;
}

.point-card.validated-false {
    border-color: #ef4444;
    background: linear-gradient(135deg, #ffe6e6, #ffcccc);
    animation: shake 0.5s ease-out;
}

@keyframes validPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.point-coords {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2d1810;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.point-status {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: #f5f5f5;
}

.point-card.validated-true .point-status {
    background: #00cc66;
    color: white;
}

.point-card.validated-false .point-status {
    background: #ef4444;
    color: white;
}

/* Points Inline */
.points-inline {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    font-size: 1rem;
    text-align: center;
}

.point-inline {
    display: inline-block;
    margin: 0 0.75rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    background: white;
    border: 2px solid #ddd;
    font-weight: 600;
    transition: all 0.3s ease;
}

.point-inline.validated-true {
    background: #e6fff2;
    border-color: #00cc66;
    color: #004d26;
}

.point-inline.validated-false {
    background: #ffe6e6;
    border-color: #ef4444;
    color: #8b0000;
}

/* Curve Visualization */
.curve-visualization {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid #e0e0e0;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.curve-legend {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 10px;
    animation: fadeIn 1s ease-out 0.3s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: #2d1810;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid white;
}

.legend-dot.valid {
    background: #00cc66;
}

.legend-dot.invalid {
    background: #ef4444;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.exercise-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d1810;
    font-family: 'Arial', sans-serif;
}

.exercise-badge {
    background: var(--bitcoin-orange);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Arial', sans-serif;
}

.exercise-desc {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

/* Calculator */
.calculator {
    background: linear-gradient(135deg, #f9f9f9, #f0f0f0);
    border-radius: 10px;
    padding: 2rem;
}

.calc-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #4a4a4a;
    font-family: 'Arial', sans-serif;
}

.input-group input {
    padding: 0.8rem;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d2d2d;
    background: white;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
}

.input-group input:focus {
    outline: none;
    border-color: var(--bitcoin-orange);
    box-shadow: 0 0 0 2px rgba(247, 147, 26, 0.15);
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.calc-btn {
    background: linear-gradient(135deg, var(--bitcoin-orange), #ff8c00);
    color: white;
    border: 2px solid var(--bitcoin-orange);
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Arial', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    animation: subtle-border 3s ease-in-out infinite;
}

.calc-btn:hover {
    transform: translateY(-2px) scale(1.05);
}

.op-symbol {
    font-size: 1.3rem;
    font-weight: 900;
}

.calc-result {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 1.5rem;
    min-height: 60px;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: #2d2d2d;
}

.calc-result.success {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
}

.calc-result.error {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
}

/* Examples Grid */
.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.example-box {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.example-box:hover {
    border-color: var(--bitcoin-orange);
    box-shadow: 0 5px 15px rgba(247, 147, 26, 0.2);
    transform: translateY(-3px);
}

.example-header {
    background: var(--bitcoin-orange);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-weight: 700;
    margin-bottom: 1rem;
    font-family: 'Arial', sans-serif;
}

.example-problem {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d2d2d;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.example-solution {
    background: #f9f9f9;
    border-left: 3px solid var(--bitcoin-orange);
    padding: 1rem;
    border-radius: 5px;
}

.example-solution p {
    margin-bottom: 0.5rem;
    color: #4a4a4a;
}

.result-highlight {
    background: linear-gradient(135deg, var(--bitcoin-orange), #ff8c00);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 5px;
    font-weight: 900;
    font-size: 1.2rem;
}

.note {
    font-size: 0.9rem;
    font-style: italic;
    color: #666;
    margin-top: 0.5rem;
}

/* Importance Box */
.importance-box {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 2rem;
    margin-top: 1.5rem;
}

.importance-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.importance-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.importance-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.importance-content h3 {
    color: #2d1810;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-family: 'Arial', sans-serif;
}

.importance-content p {
    color: #666;
    line-height: 1.6;
}

/* Additional Content Box */
.additional-content-box {
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    border: 3px solid var(--bitcoin-orange);
    border-radius: 15px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    animation: subtle-border 5s ease-in-out infinite;
}

.external-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.external-link {
    background: white;
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.external-link:hover {
    border-color: var(--bitcoin-orange);
    transform: translateX(10px);
    box-shadow: 0 8px 25px rgba(247, 147, 26, 0.3);
}

.link-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.link-content {
    flex: 1;
}

.link-content h3 {
    color: var(--bitcoin-orange);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.link-content p {
    color: #666;
    margin: 0;
    font-size: 0.95rem;
}

.link-arrow {
    font-size: 2rem;
    color: var(--bitcoin-orange);
    font-weight: bold;
    flex-shrink: 0;
}

/* Credits Box */
.credits-box {
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    border: 3px solid var(--bitcoin-orange);
    border-radius: 15px;
    padding: 2.5rem;
    text-align: center;
    color: white;
    animation: subtle-border 4.5s ease-in-out infinite;
}

.credits-box p {
    margin: 0.5rem 0;
    line-height: 1.8;
}

.credits-box a {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.8rem 2rem;
    background: rgba(247, 147, 26, 0.1);
    border: 2px solid var(--bitcoin-orange);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.credits-box a:hover {
    background: var(--bitcoin-orange);
    color: white;
    transform: translateY(-2px);
}

/* Next Chapter */
.next-chapter {
    background: linear-gradient(135deg, #2d1810, #1a0f0a);
    color: white;
    border-radius: 15px;
    padding: 2.5rem;
    text-align: center;
}

.next-chapter h3 {
    color: var(--bitcoin-orange);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Arial', sans-serif;
}

.next-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    font-family: 'Georgia', serif;
}

.next-desc {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-style: italic;
    margin-bottom: 2rem;
}

.btn-next-chapter {
    background: linear-gradient(135deg, var(--bitcoin-orange), #ff8c00);
    color: white;
    border: 3px solid var(--bitcoin-orange);
    padding: 1.2rem 3rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 1rem;
    animation: subtle-pulse 3s ease-in-out infinite;
}

.btn-next-chapter:hover {
    transform: translateY(-3px) scale(1.05);
}

.btn-next-chapter:active {
    transform: translateY(-1px);
}

/* Page Footer */
.page-footer {
    background: #2d1810;
    color: var(--text-secondary);
    padding: 1.5rem 2rem;
    text-align: center;
    border-radius: 0 0 10px 10px;
    font-size: 0.9rem;
    font-family: 'Arial', sans-serif;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .book-container {
        padding: 1rem;
    }

    .book-cover {
        padding: 2rem 1.5rem;
    }

    .book-title {
        font-size: 2.5rem;
    }

    .page-content {
        padding: 2rem 1.5rem;
    }

    .lesson-title {
        font-size: 2rem;
    }

    .calc-inputs {
        grid-template-columns: 1fr;
    }

    .calc-buttons {
        grid-template-columns: 1fr 1fr;
    }

    .examples-grid {
        grid-template-columns: 1fr;
    }

    .logo-brand {
        top: 1rem;
        left: 1rem;
    }

    .logo-nodenation {
        width: 40px;
        height: 40px;
    }

    .brand-text {
        font-size: 1rem;
    }
}
