* {
    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;
    margin-bottom: 40px;
    padding: 30px 20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

main {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.calc-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.calc-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.calc-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.calc-box {
    margin-top: 15px;
}

.calc-box h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.input-group.compound {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.input-group.compound button {
    grid-column: 1 / -1;
}

input[type="number"] {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    width: 120px;
    transition: border-color 0.3s ease;
}

input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

select:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 600;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: scale(0.98);
}

.result {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 1.1rem;
    color: #333;
    min-height: 50px;
    display: flex;
    align-items: center;
    border-left: 4px solid #667eea;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.result.show {
    opacity: 1;
    transform: translateY(0);
}

.result.error {
    border-left-color: #e74c3c;
    color: #e74c3c;
}

.result.success {
    border-left-color: #27ae60;
}

footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.8;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group span {
        text-align: center;
    }
    
    input[type="number"], select {
        width: 100%;
    }
    
    button {
        width: 100%;
        margin-top: 10px;
    }
    
    .input-group.compound {
        grid-template-columns: 1fr;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calc-section {
    animation: fadeIn 0.6s ease forwards;
}

.calc-section:nth-child(1) { animation-delay: 0.1s; }
.calc-section:nth-child(2) { animation-delay: 0.2s; }
.calc-section:nth-child(3) { animation-delay: 0.3s; }
.calc-section:nth-child(4) { animation-delay: 0.4s; }
.calc-section:nth-child(5) { animation-delay: 0.5s; }
.calc-section:nth-child(6) { animation-delay: 0.6s; }
.calc-section:nth-child(7) { animation-delay: 0.7s; }
.calc-section:nth-child(8) { animation-delay: 0.8s; }