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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

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

/* Language Toggle */
.language-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    background: white;
    border-radius: 25px;
    padding: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 5px;
}

.language-toggle button {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.language-toggle button.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.language-toggle button:hover:not(.active) {
    background: #f0f0f0;
}

.language-toggle button:active {
    transform: scale(0.95);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: fadeInDown 1s ease;
}

.glitch {
    position: relative;
}

.hero h2 {
    font-size: 2rem;
    color: #555;
    margin-bottom: 10px;
    animation: fadeInUp 1s ease 0.2s both;
}

.hero p {
    font-size: 1.2rem;
    color: #777;
    animation: fadeInUp 1s ease 0.4s both;
}

.author-credit {
    margin-top: 15px;
    font-size: 1rem !important;
    color: #666 !important;
    font-style: italic;
}

.author-credit a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-style: normal;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.author-credit a:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

.author-credit a:active {
    transform: scale(0.98);
}

.celebration-emoji {
    font-size: 2.5rem;
    margin-top: 20px;
    animation: bounce 2s infinite;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Counter Section */
.counter-section {
    margin-bottom: 40px;
}

.counter-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    animation: fadeIn 1s ease;
}

.counter-card h3 {
    font-size: 1.5rem;
    color: #555;
    margin-bottom: 20px;
}

.counter {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
}

.counter .number {
    font-size: 5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: countUp 2s ease;
}

.counter .label {
    font-size: 2rem;
    color: #777;
}

.counter-subtitle {
    margin-top: 15px;
    font-size: 1.1rem;
    color: #888;
    font-style: italic;
}

@keyframes countUp {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* Pacioli Section */
.pacioli-section {
    margin-bottom: 40px;
}

.pacioli-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
    align-items: center;
}

.portrait {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    animation: float 3s ease-in-out infinite;
}

.portrait-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.pacioli-content h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pacioli-facts {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.fact-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.fact-item:hover {
    transform: translateX(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

.fact-item strong {
    display: block;
    color: #667eea;
    margin-bottom: 5px;
}

.fact-item p {
    color: #666;
    margin: 0;
}

/* Facts Carousel */
.facts-section {
    margin-bottom: 40px;
}

.facts-section h2 {
    text-align: center;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.facts-carousel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.fact-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    min-height: 200px;
    max-width: 700px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fact-number {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 3rem;
    font-weight: 900;
    color: rgba(102, 126, 234, 0.2);
}

.fact-text {
    font-size: 1.3rem;
    color: #555;
    line-height: 1.8;
}

.carousel-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.carousel-btn:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.carousel-btn:active {
    transform: scale(0.95);
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: white;
    transform: scale(1.3);
}

/* Quiz Section */
.quiz-section {
    margin-bottom: 40px;
}

.quiz-section h2 {
    text-align: center;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.quiz-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.question-card h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 25px;
}

.options {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.option-btn {
    padding: 15px 25px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.option-btn:hover {
    border-color: #667eea;
    transform: translateX(5px);
}

.option-btn:active {
    transform: translateX(5px) scale(0.98);
}

.option-btn.correct {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.option-btn.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.option-btn:disabled {
    cursor: not-allowed;
}

.quiz-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1rem;
    text-align: center;
    font-weight: 600;
}

.quiz-result.correct {
    background: #e8f5e9;
    color: #2e7d32;
}

.quiz-result.incorrect {
    background: #ffebee;
    color: #c62828;
}

.next-question-btn {
    display: block;
    margin: 20px auto 0;
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.next-question-btn:hover {
    transform: scale(1.05);
}

.quiz-score {
    text-align: center;
    margin-top: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    color: #667eea;
}

/* Principles Section */
.principles-section {
    margin-bottom: 40px;
}

.principles-section h2 {
    text-align: center;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

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

.principle-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.principle-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.principle-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.principle-card h3 {
    font-size: 1.3rem;
    color: #667eea;
    margin-bottom: 10px;
}

.principle-card p {
    color: #666;
    font-size: 1rem;
}

/* Celebration Section */
.celebration-section {
    margin-bottom: 40px;
}

.celebration-card {
    background: white;
    border-radius: 20px;
    padding: 50px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.celebration-card h2 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.celebration-card p {
    font-size: 1.3rem;
    color: #555;
    margin-bottom: 30px;
    line-height: 1.8;
}

.celebrate-btn {
    padding: 18px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.celebrate-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.celebrate-btn:active {
    transform: scale(1.05);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: white;
    margin-top: 40px;
}

footer p {
    margin: 10px 0;
    font-size: 1.1rem;
}

.footer-quote {
    font-style: italic;
    margin-top: 20px;
    font-size: 1.2rem;
    opacity: 0.9;
}

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

    .hero {
        padding: 50px 20px 40px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero h2 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .author-credit {
        font-size: 0.9rem !important;
    }

    .language-toggle {
        top: 10px;
        right: 10px;
        padding: 4px;
    }

    .language-toggle button {
        padding: 6px 12px;
        font-size: 12px;
    }

    .pacioli-card {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 30px 20px;
    }

    .counter .number {
        font-size: 3.5rem;
    }

    .counter .label {
        font-size: 1.5rem;
    }

    .facts-carousel {
        flex-direction: column;
    }

    .carousel-btn {
        display: none;
    }

    .fact-card {
        padding: 30px 20px;
        min-height: 150px;
    }

    .fact-text {
        font-size: 1.1rem;
    }

    .principles-grid {
        grid-template-columns: 1fr;
    }

    .principle-card {
        padding: 25px 20px;
    }

    .celebration-card {
        padding: 35px 20px;
    }

    .celebration-card h2 {
        font-size: 2rem;
    }

    .celebration-card p {
        font-size: 1.1rem;
    }

    .celebrate-btn {
        padding: 15px 30px;
        font-size: 1.1rem;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
    
    .hero {
        position: relative;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .option-btn:hover {
        transform: none;
        border-color: #e0e0e0;
    }
    
    .principle-card:hover {
        transform: none;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    }
    
    .fact-item:hover {
        transform: none;
        box-shadow: none;
    }
}
