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

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

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

header {
    text-align: center;
    color: white;
    padding: 40px 0;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    margin-bottom: 20px;
}

.language-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.lang-btn {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

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

.lang-btn.active {
    background: white;
    color: #667eea;
    font-weight: 600;
}

main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.control-group input {
    padding: 10px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.control-group input:focus {
    outline: none;
    border-color: #667eea;
}

.methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.method-card {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 16px;
    padding: 25px;
    transition: all 0.3s ease;
}

.method-card:hover {
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.1);
    transform: translateY(-5px);
}

.method-card h2 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.4rem;
}

.method-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.calculate-btn {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.calculate-btn:active {
    transform: translateY(0);
}

.result {
    padding: 15px;
    background: #f0f4ff;
    border-radius: 8px;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #333;
    min-height: 50px;
    display: flex;
    align-items: center;
}

canvas {
    width: 100%;
    height: auto;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    margin-bottom: 15px;
    background: white;
}

.progress {
    height: 8px;
    background: #e1e8ed;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0;
    transition: width 0.3s ease;
}

.comparison {
    margin-top: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 16px;
}

.comparison h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.6rem;
    text-align: center;
}

#comparison-chart {
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 12px;
}

#comparison-canvas {
    display: block;
    margin: 0 auto;
}

#comparison-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

table td {
    padding: 15px;
    border-bottom: 1px solid #e1e8ed;
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover {
    background: #f8f9fa;
}

.pi-display {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 16px;
    text-align: center;
}

.pi-display h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.6rem;
}

#pi-value {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    color: #333;
    padding: 20px;
    background: white;
    border-radius: 8px;
    word-break: break-all;
    margin-bottom: 20px;
    line-height: 1.8;
}

#copy-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.copy-feedback {
    display: inline-block;
    margin-left: 15px;
    color: #4CAF50;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
}

footer {
    text-align: center;
    color: white;
    padding: 30px 0;
    margin-top: 40px;
    font-size: 14px;
    opacity: 0.9;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    main {
        padding: 20px;
    }
    
    .methods {
        grid-template-columns: 1fr;
    }
    
    .controls {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 14px;
    }
    
    table th, table td {
        padding: 10px;
    }
    
    #pi-value {
        font-size: 14px;
        padding: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}