* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.app-header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.app-header h1 {
    font-family: 'Space Mono', monospace;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.section-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.nav-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: white;
    color: #667eea;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.content-card h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-family: 'Space Mono', monospace;
}

.explanation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.analogy-box {
    background: #f8f9ff;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
}

.analogy-box h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.visual-demo {
    background: #f8f9ff;
    border-radius: 10px;
    padding: 20px;
}

.demo-container h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
    font-family: 'Space Mono', monospace;
}

.reaction-selector {
    margin-bottom: 20px;
}

.reaction-selector label {
    display: block;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
}

.reaction-selector select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
}

.reaction-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.reaction-inputs {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #f0f0f0;
}

.molecules-container {
    min-height: 200px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.molecule {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.molecule.h2 {
    background: #ff6b6b;
}

.molecule.cl2 {
    background: #4ecdc4;
}

.molecule.hcl {
    background: #45b7d1;
}

.molecule.consumed {
    opacity: 0.3;
    transform: scale(0.8);
}

.demo-btn, .simulate-btn, .submit-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.demo-btn:hover, .simulate-btn:hover, .submit-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.steps-container {
    display: grid;
    gap: 20px;
}

.step {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.step:hover {
    transform: translateX(5px);
}

.step-number {
    width: 50px;
    height: 50px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
}

.step-content h3 {
    color: #667eea;
    margin-bottom: 5px;
}

.simulator-container {
    display: grid;
    gap: 30px;
}

.reaction-setup {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 10px;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
}

.input-group label {
    min-width: 150px;
    font-weight: 600;
}

.input-group input[type="range"] {
    flex: 1;
}

.input-group span {
    background: #667eea;
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

.simulation-area {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    text-align: center;
}

.reactants, .products {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 10px;
    min-height: 150px;
}

.arrow {
    font-size: 2em;
    color: #667eea;
    font-weight: bold;
}

#simulation-reactants, #simulation-products {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.results {
    background: #e8f5e8;
    border: 2px solid #4caf50;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.exercise-container {
    max-width: 800px;
    margin: 0 auto;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.difficulty-stars {
    display: flex;
    gap: 5px;
}

.star {
    color: #ffd700;
    font-size: 1.2em;
}

.star.empty {
    color: #ddd;
}

.exercise-content {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.answer-section {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

#answer-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
}

#answer-input:focus {
    outline: none;
    border-color: #667eea;
}

.feedback {
    min-height: 40px;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}

.feedback.correct {
    background: #e8f5e8;
    border: 2px solid #4caf50;
    color: #2e7d32;
}

.feedback.incorrect {
    background: #ffebee;
    border: 2px solid #f44336;
    color: #c62828;
}

.exercise-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-exercise-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-exercise-btn:hover:not(:disabled) {
    background: #5a67d8;
    transform: translateY(-2px);
}

.nav-exercise-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#exercise-counter {
    font-weight: 600;
    color: #667eea;
}

.pizza-demo, .molecular-demo {
    transition: all 0.5s ease;
}

.pizza-controls {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #f0f0f0;
}

.ingredient-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.ingredient-control label {
    min-width: 140px;
    font-weight: 600;
    color: #667eea;
}

.ingredient-control input[type="range"] {
    flex: 1;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
}

.ingredient-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.ingredient-control span {
    background: #667eea;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    min-width: 45px;
    text-align: center;
}

.pizza-visualization {
    min-height: 200px;
    background: white;
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ingredient-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ingredient-label {
    min-width: 120px;
    font-weight: 600;
    color: #667eea;
}

.ingredient-item {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin: 2px;
    transition: all 0.3s ease;
}

.pizza-base {
    background: #deb887;
}

.pizza-cheese {
    background: #ffd700;
}

.pizza-tomato {
    background: #ff6347;
}

.ingredient-item.used {
    opacity: 0.3;
    transform: scale(0.8);
}

.complete-pizza {
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #deb887 25%, #ffd700 25%, #ffd700 50%, #ff6347 50%, #ff6347 75%, #deb887 75%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    animation: pizzaAppear 0.5s ease-in;
}

@keyframes pizzaAppear {
    from { 
        opacity: 0; 
        transform: scale(0) rotate(180deg); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) rotate(0deg); 
    }
}

.pizza-results {
    background: #f8f9ff;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    display: none;
}

.pizza-results.show {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

.understanding-check {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.check-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.check-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
}

.yes-btn {
    background: #28a745;
    color: white;
}

.yes-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

.no-btn {
    background: #ffc107;
    color: #212529;
}

.no-btn:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.points-display {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 3px solid #ddd;
    background: #f8f9ff;
    transition: all 0.3s ease;
    position: relative;
}

.badge.earned {
    border-color: #ffd700;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    animation: badgeEarned 0.8s ease-in-out;
}

@keyframes badgeEarned {
    0% { transform: scale(0) rotate(180deg); }
    50% { transform: scale(1.2) rotate(0deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.badge-tooltip {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.badge:hover .badge-tooltip {
    opacity: 1;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.8s ease;
    border-radius: 10px;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    font-size: 12px;
    color: #333;
}

.streak-counter {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    margin: 10px 0;
}

.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2000;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.level-up-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 30px 50px;
    border-radius: 20px;
    text-align: center;
    z-index: 2000;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: levelUpAppear 0.8s ease-out;
}

@keyframes levelUpAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.exercise-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.success-animation {
    animation: successPulse 0.6s ease-in-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background-color: #e8f5e8; }
    100% { transform: scale(1); }
}

.hint-system {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    display: none;
}

.hint-button {
    background: #ffc107;
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.hint-button:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

.motivational-messages {
    text-align: center;
    padding: 15px;
    margin: 10px 0;
    border-radius: 10px;
    font-weight: 600;
    animation: fadeIn 0.5s ease-in;
}

.motivational-messages.encouraging {
    background: #e3f2fd;
    color: #1976d2;
}

.motivational-messages.celebrating {
    background: #e8f5e8;
    color: #2e7d32;
}

.name-modal, .completion-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(10px);
}

.name-modal-content, .completion-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalAppear 0.5s ease-out;
}

@keyframes modalAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.name-modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-family: 'Space Mono', monospace;
}

.name-input-container {
    margin: 30px 0;
}

.name-input-container label {
    display: block;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

#student-name {
    width: 100%;
    padding: 15px;
    border: 3px solid #ddd;
    border-radius: 15px;
    font-size: 1.1em;
    text-align: center;
    transition: all 0.3s ease;
    font-family: 'Noto Sans', sans-serif;
}

#student-name:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
}

.start-game-btn, .restart-btn, .continue-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
}

.start-game-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.start-game-btn:hover:not(:disabled), .restart-btn:hover, .continue-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.completion-modal-content {
    max-width: 600px;
    padding: 50px;
}

.completion-header {
    margin-bottom: 30px;
}

.completion-header h2 {
    color: #667eea;
    font-family: 'Space Mono', monospace;
    margin-bottom: 20px;
    font-size: 2em;
}

.completion-trophy {
    font-size: 4em;
    animation: trophySpin 2s ease-in-out infinite alternate;
}

@keyframes trophySpin {
    0% { transform: rotate(-5deg) scale(1); }
    100% { transform: rotate(5deg) scale(1.1); }
}

.completion-stats {
    background: #f8f9ff;
    border-radius: 15px;
    padding: 30px;
    margin: 30px 0;
}

.completion-score {
    margin-bottom: 25px;
}

.score-value {
    display: block;
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
    font-family: 'Space Mono', monospace;
}

.score-label {
    color: #666;
    font-size: 1.1em;
    font-weight: 600;
}

.completion-details {
    display: grid;
    gap: 15px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    font-weight: 600;
}

.detail-icon {
    font-size: 1.2em;
}

.completion-feedback {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin: 25px 0;
    font-size: 1.1em;
    line-height: 1.6;
}

.completion-feedback h3 {
    margin-bottom: 15px;
    font-family: 'Space Mono', monospace;
}

.completion-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.restart-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

.continue-btn {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

.bicycle-example {
    background: #e8f5e8;
    border-left: 4px solid #4caf50;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
}

.bicycle-visual {
    background: #f0f8ff;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    text-align: center;
}

.bike-parts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.bikes-made {
    font-size: 1.2em;
    font-weight: bold;
    padding-top: 15px;
    border-top: 2px dashed #667eea;
}

@media (max-width: 768px) {
    .explanation-grid {
        grid-template-columns: 1fr;
    }
    
    .section-nav {
        flex-direction: column;
    }
    
    .simulation-area {
        grid-template-columns: 1fr;
    }
    
    .arrow {
        transform: rotate(90deg);
    }
    
    .answer-section {
        flex-direction: column;
    }
    
    .exercise-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .name-modal-content, .completion-modal-content {
        padding: 30px 20px;
        margin: 20px;
        max-width: none;
    }
    
    .completion-header h2 {
        font-size: 1.5em;
    }
    
    .completion-trophy {
        font-size: 3em;
    }
    
    .score-value {
        font-size: 2.5em;
    }
    
    .completion-actions {
        flex-direction: column;
    }
}