:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --background-color: #f9f9f9;
    --card-color: #ffffff;
    --text-color: #2d3436;
    --text-light: #636e72;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --gradient: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

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

.pi-explorer {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.header {
    text-align: center;
    margin-bottom: 1rem;
}

.header h1 {
    font-size: 4rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
    position: relative;
    display: inline-block;
}

.header h1 .explorer {
    font-weight: 300;
    font-size: 3.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.search-box {
    display: flex;
    width: 100%;
    max-width: 600px;
    position: relative;
    box-shadow: var(--shadow);
    border-radius: 50px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(108, 92, 231, 0.2);
}

#number-input {
    flex: 1;
    padding: 1.2rem 2rem;
    font-size: 1.1rem;
    border: none;
    outline: none;
    background: var(--card-color);
}

#search-button {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 0 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#search-button:hover {
    opacity: 0.9;
}

.hint {
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: center;
}

.result-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.result-card {
    background: var(--card-color);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 800px;
    transition: all 0.5s ease;
    transform-origin: center;
}

.result-card.hidden {
    display: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 1rem;
}

.result-header h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(108, 92, 231, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s infinite linear;
    display: none;
}

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

.result-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.pi-visualization {
    background: rgba(108, 92, 231, 0.05);
    padding: 1.5rem;
    border-radius: 10px;
    font-family: monospace;
    font-size: 1.1rem;
    line-height: 1.8;
    overflow-x: auto;
    margin-top: 1.5rem;
    position: relative;
}

.highlight {
    background-color: var(--accent-color);
    color: white;
    padding: 0 4px;
    border-radius: 4px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(253, 121, 168, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(253, 121, 168, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(253, 121, 168, 0);
    }
}

.pi-facts {
    margin: 3rem 0;
}

.pi-facts h3 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.8rem;
    color: var(--primary-color);
}

.fact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.fact-card {
    background: var(--card-color);
    border-radius: 15px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.fact-card:hover {
    transform: translateY(-10px);
}

.fact-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: white;
    font-size: 1.5rem;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 3rem;
    }
    
    .header h1 .explorer {
        font-size: 2.5rem;
    }
    
    .search-box {
        flex-direction: column;
        border-radius: 15px;
    }
    
    #search-button {
        width: 100%;
        padding: 1rem;
    }
    
    .fact-cards {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.scale-in {
    animation: scaleIn 0.5s ease forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.bounce {
    animation: bounce 0.5s ease;
}

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