* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
}

.speed-control label {
    font-weight: 600;
    color: #555;
}

.speed-control input[type="range"] {
    width: 150px;
}

.speed-control #speedValue {
    font-weight: 600;
    color: #667eea;
    min-width: 30px;
}

.pi-display-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 30px;
    overflow-x: auto;
    border: 2px solid #e9ecef;
    max-height: 133px;
    overflow-y: auto;
}

.pi-display {
    font-family: 'Courier New', monospace;
    font-size: 2em;
    line-height: 1.27;
    word-wrap: break-word;
    position: relative;
    min-height: 27px;
}

.pi-start {
    color: #667eea;
    font-weight: bold;
}

.pi-digits {
    color: #495057;
    letter-spacing: 2px;
}

.pi-digits .processed {
    color: #28a745;
    font-weight: bold;
}

.pi-digits .current-digit {
    background-color: #fff3cd;
    border-radius: 3px;
    padding: 2px 4px;
}

.pi-digits .pointer {
    color: #dc3545;
    font-weight: bold;
    font-size: 1.2em;
    animation: blink 1s infinite;
    margin: 0 2px;
    display: inline-block;
}

.pointer {
    color: #dc3545;
    font-weight: bold;
    font-size: 1.2em;
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    min-width: 150px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
}

.counter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.counter-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.counter-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.counter-item.highlight {
    background: #fff3cd;
    border-color: #ffc107;
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.counter-digit {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
}

.counter-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #495057;
    text-align: center;
    margin-bottom: 5px;
}

.counter-percentage {
    font-size: 1em;
    color: #6c757d;
    text-align: center;
    margin-bottom: 15px;
}

.counter-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.counter-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .pi-display {
        font-size: 1.5em;
    }
    
    .counter-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .speed-control {
        margin-left: 0;
        justify-content: center;
    }
}
