:root {
    --primary-color: #00ff88;
    --secondary-color: #0066ff;
    --accent-color: #ff0066;
    --background: #0a0e27;
    --surface: #151933;
    --surface-light: #1e2444;
    --text-primary: #ffffff;
    --text-secondary: #a8b2d1;
    --border-color: #2a3555;
    --error-color: #ff4444;
    --success-color: #00ff88;
    --warning-color: #ffaa00;
}

* {
    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, #0a0e27 0%, #151933 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* ヘッダー */
header {
    text-align: center;
    padding: 40px 0;
    position: relative;
}

h1 {
    font-size: 3em;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2em;
    margin-bottom: 20px;
}

/* 言語セレクター */
.language-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.lang-btn {
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.lang-btn:hover {
    background: var(--surface-light);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--background);
    border-color: transparent;
}

/* メインセクション */
main {
    margin: 40px 0;
}

/* アップロードエリア */
.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    background: var(--surface);
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 255, 136, 0.1);
}

.upload-area:hover::before {
    opacity: 0.05;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--surface-light);
}

.upload-icon {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.3em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* プレビューセクション */
.preview-section {
    background: var(--surface);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
}

.image-container {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

#previewImage {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
}

#faceCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* ボタン */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 20px auto 0;
    display: block;
    width: fit-content;
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* 結果セクション */
.results-section {
    margin: 40px 0;
}

.results-section h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2em;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.result-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 255, 136, 0.1);
    border-color: var(--primary-color);
}

.face-label {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.age-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    margin-bottom: 10px;
}

.age-main {
    font-size: 3.5em;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.age-unit {
    margin-left: 10px;
    color: var(--text-secondary);
    font-size: 1.2em;
}

.age-range {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 20px;
}

.confidence-bar {
    margin-top: 15px;
}

.confidence-label {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-bottom: 8px;
}

.confidence-track {
    background: var(--surface-light);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    transition: width 0.6s ease;
}

.confidence-value {
    text-align: right;
    color: var(--primary-color);
    font-size: 0.9em;
    font-weight: 600;
}

/* ローディング */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
    background: var(--surface);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* エラーメッセージ */
.error-message {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 15px 20px;
    border-radius: 10px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 機能セクション */
.features {
    margin: 80px 0;
}

.features h2 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--surface);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 255, 136, 0.1);
    border-color: var(--primary-color);
}

.feature-card svg {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 使い方セクション */
.how-it-works {
    margin: 80px 0;
}

.how-it-works h2 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.steps {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 200px;
    text-align: center;
    padding: 20px;
}

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--background);
    margin: 0 auto 20px;
}

.step h3 {
    font-size: 1.3em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.step p {
    color: var(--text-secondary);
}

/* フッター */
footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 80px;
    color: var(--text-secondary);
}

/* レスポンシブ */
@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .steps {
        flex-direction: column;
    }
    
    .language-selector {
        flex-wrap: wrap;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
}