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

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 0;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

h1 {
    font-size: 2.5em;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-top: 50px;
    margin-bottom: 10px;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
}

.fact-card {
    background: #fff;
    border-radius: 24px;
    padding: 40px 35px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    position: relative;
    animation: fadeIn 0.4s ease;
}

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

.fact-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: bounce 2s ease-in-out infinite;
}

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

.category-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.category-badge.science { background: linear-gradient(135deg, #00b894 0%, #00cec9 100%); }
.category-badge.animals { background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%); }
.category-badge.history { background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%); }
.category-badge.space { background: linear-gradient(135deg, #2d3436 0%, #636e72 100%); }
.category-badge.food { background: linear-gradient(135deg, #e84393 0%, #fd79a8 100%); }
.category-badge.geography { background: linear-gradient(135deg, #00b894 0%, #55efc4 100%); }
.category-badge.human-body { background: linear-gradient(135deg, #d63031 0%, #ff7675 100%); }
.category-badge.technology { background: linear-gradient(135deg, #0984e3 0%, #74b9ff 100%); }
.category-badge.nature { background: linear-gradient(135deg, #00b894 0%, #81ecec 100%); }
.category-badge.sports { background: linear-gradient(135deg, #e17055 0%, #fab1a0 100%); }
.category-badge.music { background: linear-gradient(135deg, #6c5ce7 0%, #fd79a8 100%); }
.category-badge.language { background: linear-gradient(135deg, #fdcb6e 0%, #ffeaa7 100%); color: #333; }

.fact-text {
    font-size: 1.4em;
    line-height: 1.6;
    color: #333;
    font-weight: 500;
}

.fact-source {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #666;
}

.fact-source a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.fact-source a:hover {
    text-decoration: underline;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 15px;
    padding: 6px 15px;
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: #fff;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
}

.verified-badge span {
    font-size: 1.1em;
}

.loading .fact-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.new-fact-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    color: #e74c3c;
    font-size: 0.9em;
    margin-top: 10px;
}

.new-fact-btn {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    color: #667eea;
    border: none;
    padding: 18px 50px;
    font-size: 1.3em;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font-family: inherit;
}

.new-fact-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.new-fact-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-icon {
    font-size: 1.2em;
}

.fact-counter {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 25px;
    border-radius: 20px;
    color: #fff;
    font-weight: 500;
}

#factCounter {
    font-weight: 700;
}

footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.8em;
        margin-top: 55px;
    }

    .back-btn {
        font-size: 0.8em;
        padding: 8px 15px;
    }

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

    .fact-icon {
        font-size: 3em;
    }

    .fact-text {
        font-size: 1.15em;
    }

    .new-fact-btn {
        padding: 15px 35px;
        font-size: 1.1em;
    }
}
