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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

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.1rem;
    opacity: 0.9;
}

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

.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    background: #f8f9ff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #4CAF50;
    background: #e8f5e8;
    transform: scale(1.02);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    width: 60px;
    height: 60px;
    color: #667eea;
    margin-bottom: 10px;
}

.upload-content h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 5px;
}

.upload-content p {
    color: #666;
    font-size: 1rem;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.result-section {
    margin-top: 30px;
}

.image-container {
    text-align: center;
}

.image-wrapper {
    position: relative;
    display: inline-block;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

#originalImage {
    max-width: 100%;
    height: auto;
    display: block;
}

#landmarkCanvas {
    position: absolute;
    top: 0;
    left: 0;
    max-width: 100%;
    height: auto;
    pointer-events: none;
}

/* 元写真セクション */
.original-image-section {
    margin-top: 30px;
    text-align: center;
}

.original-image-section h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
}

.original-image-wrapper {
    display: inline-block;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    max-width: 100%;
}

#originalImageBelow {
    max-width: 100%;
    height: auto;
    display: block;
}

.controls {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:not(.secondary) {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn:not(.secondary):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn.secondary {
    background: #f5f5f5;
    color: #666;
    border: 2px solid #ddd;
}

.btn.secondary:hover {
    background: #e9e9e9;
    border-color: #ccc;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #f8f9ff;
    border-radius: 15px;
    margin: 20px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading p {
    font-size: 1.1rem;
    color: #667eea;
    font-weight: 600;
}

/* 顔の向きセクション */
.face-orientation {
    margin-top: 30px;
    padding: 25px;
    background: #f0f8ff;
    border-radius: 15px;
    border: 2px solid #b3d9ff;
}

.face-orientation h3 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 700;
}

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

.orientation-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-left: 4px solid #4a90e2;
}

.orientation-item h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.orientation-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4a90e2;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f0f8ff;
    border-radius: 8px;
}

.orientation-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.orientation-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b 0%, #ffd93d 50%, #6bcf7f 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 50%;
}

.orientation-description {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

/* 比率分析セクション */
.ratio-analysis {
    margin-top: 30px;
    padding: 25px;
    background: #f8f9ff;
    border-radius: 15px;
    border: 2px solid #e0e6ff;
}

.ratio-analysis h3 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 700;
}

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

.ratio-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
}

.ratio-item h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.ratio-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f0f2ff;
    border-radius: 8px;
}

.ratio-comparison {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comparison-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fafafa;
    border-radius: 6px;
    font-size: 0.9rem;
}

.ratio-name {
    font-weight: 600;
    color: #555;
    min-width: 60px;
}

.ratio-target {
    color: #666;
    font-family: monospace;
    min-width: 80px;
    text-align: center;
}

.ratio-diff {
    font-weight: 600;
    min-width: 80px;
    text-align: right;
}

.ratio-diff.positive {
    color: #e74c3c;
}

.ratio-diff.negative {
    color: #27ae60;
}

.ratio-diff.neutral {
    color: #f39c12;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 20px;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .upload-icon {
        width: 50px;
        height: 50px;
    }
    
    .upload-content h3 {
        font-size: 1.3rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 200px;
    }
    
    .ratio-grid {
        grid-template-columns: 1fr;
    }
    
    .ratio-item {
        padding: 15px;
    }
    
    .comparison-item {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .upload-area {
        padding: 30px 10px;
    }
    
    .upload-content h3 {
        font-size: 1.2rem;
    }
    
    .upload-content p {
        font-size: 0.9rem;
    }
}
