* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #2d2d5f 100%);
    color: white;
    min-height: 100vh;
}

.app-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    background: linear-gradient(45deg, #ffff00, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    opacity: 0.8;
    font-size: 14px;
}

/* カメラセクション */
.camera-section {
    margin-bottom: 20px;
}

.camera-container {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

#video {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background: #000;
}

.capture-btn-container, .upload-btn-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
}

#capture-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
}

#capture-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

#capture-btn:active {
    transform: scale(0.95);
}

/* 背景選択セクション */
.background-section {
    margin-bottom: 20px;
}

.background-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

.background-options {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.bg-option {
    text-align: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.bg-option.active {
    border-color: #ffff00;
    background: rgba(255, 255, 0, 0.1);
}

.bg-option img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-bottom: 5px;
}

.bg-option span {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

/* 合成結果セクション */
.result-section {
    margin-bottom: 20px;
}

.result-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

.result-container {
    text-align: center;
    margin-bottom: 15px;
}

#result-canvas {
    max-width: 100%;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* エフェクトセクション */
.effects-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

.effect-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.effect-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.effect-btn.active {
    background: rgba(255, 255, 0, 0.3);
    border-color: #ffff00;
}

.effect-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ローディング表示 */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffff00;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* エラーメッセージ */
#error-message {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin: 20px 0;
}

/* レスポンシブデザイン */
@media (max-width: 480px) {
    .app-container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 20px;
    }
    
    #video {
        height: 250px;
    }
}

/* アニメーション */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.upload-btn-container {
    margin-top: 20px;
    text-align: center;
}

/* 撮影ボタン（ラベル）中央ぞろえ */
#upload-label {
    display: block;
    margin: 24px auto 0 auto;
    text-align: center;
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
}
#upload-label:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}
#upload-label:active {
    transform: scale(0.95);
}