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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --background: #ffffff;
    --surface: #f8fafc;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --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: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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: var(--text-primary);
    line-height: 1.6;
}

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

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

header h1 {
    font-size: 2.5rem;
    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: 30px;
}

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

.lang-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.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;
}

.converter-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.category-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border);
}

.category-tabs::-webkit-scrollbar {
    height: 6px;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    position: relative;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px 2px 0 0;
}

.converter-panel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .converter-panel {
        grid-template-columns: 1fr;
    }
}

.input-section, .output-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-section label, .output-section label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

input[type="number"] {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.2rem;
    font-weight: 500;
    transition: var(--transition);
    background: var(--surface);
}

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

select {
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    background: white;
    cursor: pointer;
    transition: var(--transition);
    min-width: 150px;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.swap-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.swap-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.swap-btn:hover {
    background: var(--primary-hover);
    transform: rotate(180deg);
    box-shadow: var(--shadow-lg);
}

.formula-display {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    border: 2px solid var(--border);
}

.formula-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.copy-btn {
    padding: 8px 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.copy-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.quick-conversions, .conversion-history, .preset-values {
    margin-bottom: 30px;
}

.quick-conversions h3, .conversion-history h3, .preset-values h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.quick-buttons, .preset-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-btn, .preset-btn {
    padding: 10px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.quick-btn:hover, .preset-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.history-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.reuse-btn {
    padding: 5px 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.reuse-btn:hover {
    background: var(--primary-hover);
    transform: rotate(360deg);
}

.clear-history-btn {
    padding: 10px 20px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.clear-history-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 50px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.feature {
    text-align: center;
    color: white;
}

.feature h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.feature p {
    opacity: 0.9;
    font-size: 0.95rem;
}

.copyright {
    text-align: center;
    color: white;
    margin-top: 30px;
    opacity: 0.8;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--success-color);
    color: white;
    padding: 15px 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 1000;
}

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

/* スクロールバーのスタイリング */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

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

.converter-container {
    animation: fadeIn 0.6s ease-out;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .converter-container {
        padding: 20px;
    }
    
    .category-tabs {
        gap: 5px;
    }
    
    .tab-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    input[type="number"] {
        font-size: 1rem;
        padding: 12px;
    }
    
    select {
        min-width: 120px;
        padding: 12px;
    }
    
    .features {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}