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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    --background: #ffffff;
    --surface: #f8fafc;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
}

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

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

/* 言語切替 */
.language-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.lang-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

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

.lang-btn.active {
    background: white;
    color: var(--primary-color);
    border-color: white;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

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

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* メインコンテンツ */
main {
    background: white;
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

/* 入力セクション */
.input-section {
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.size-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

input[type="number"],
select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input[type="number"] {
    flex: 1;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select {
    cursor: pointer;
    min-width: 150px;
}

.calculate-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

/* 結果セクション */
.results-section {
    animation: fadeIn 0.5s ease;
}

.results-section.hidden {
    display: none;
}

.results-section h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.results-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* 推奨カード */
.recommendation-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.recommendation-content {
    margin-top: 1rem;
}

.best-method {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.method-name {
    font-weight: 700;
    font-size: 1.5rem;
}

.method-size {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
}

.method-ratio {
    background: rgba(16, 185, 129, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
}

.recommendation-reason {
    opacity: 0.95;
    line-height: 1.6;
}

/* 圧縮形式グリッド */
.formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.format-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.format-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.format-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.format-header h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.compression-badge {
    background: var(--secondary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.format-details {
    color: var(--text-secondary);
}

.size-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.size-value {
    font-weight: 600;
    color: var(--text-primary);
}

.size-range {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.format-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* チャート */
.chart-container {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

#compressionChart {
    width: 100%;
    height: 300px;
    max-width: 100%;
}

/* ヒント */
.tips-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 2rem;
    border-radius: var(--radius);
    border-left: 4px solid var(--warning);
}

.tips-list {
    list-style: none;
    padding-left: 0;
}

.tips-list li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1rem;
    color: #92400e;
}

.tips-list li:before {
    content: "💡";
    position: absolute;
    left: 0;
    top: 0;
}

/* フッター */
footer {
    text-align: center;
    margin-top: 3rem;
    color: white;
    opacity: 0.9;
}

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

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 1.5rem;
    }
    
    .formats-grid {
        grid-template-columns: 1fr;
    }
    
    .best-method {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .language-switcher {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .size-input-wrapper {
        flex-direction: column;
    }
    
    select {
        width: 100%;
    }
}