* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* 文房具屋の店内をイメージした温かみのある配色 */
    background: linear-gradient(to bottom, #f5ebe0 0%, #fff8f0 50%, #f5ebe0 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* ノートの罫線をイメージしたパターン */
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(63, 81, 181, 0.03) 2px,
            rgba(63, 81, 181, 0.03) 4px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(63, 81, 181, 0.03) 2px,
            rgba(63, 81, 181, 0.03) 4px
        );
    pointer-events: none;
    z-index: 1;
}

body > * {
    position: relative;
    z-index: 2;
}

.container {
    /* ノートやレターセットをイメージした白い紙 */
    background: rgba(255, 255, 255, 0.98);
    border-radius: 4px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.12),
        0 0 0 2px #d4a574,
        0 0 0 4px #c8956e;
    padding: 50px;
    max-width: 800px;
    width: 100%;
    backdrop-filter: blur(10px);
    border-left: 3px solid #e74c3c;
}

h1 {
    text-align: center;
    /* インクブルーをイメージした色 */
    color: #2c3e50;
    margin-bottom: 40px;
    font-size: 32px;
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 20px;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    /* 赤ペンのアンダーライン */
    background: linear-gradient(to right, transparent, #e74c3c, transparent);
}

.input-section {
    margin-bottom: 30px;
}

label {
    display: block;
    margin-bottom: 12px;
    /* 濃いインクブルー */
    color: #34495e;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

input[type="text"],
input[type="file"] {
    width: 100%;
    padding: 14px;
    /* 文房具のベージュ/クリーム色の枠 */
    border: 2px solid #d4a574;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
    background: #fffef9;
}

input[type="text"]:focus,
input[type="file"]:focus {
    outline: none;
    /* ペンのインクブルーでハイライト */
    border-color: #3498db;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

input[type="file"] {
    cursor: pointer;
}

.upload-area {
    /* クラフト紙をイメージした破線枠 */
    border: 3px dashed #d4a574;
    border-radius: 8px;
    padding: 50px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    /* レターセットのような柔らかい背景 */
    background: linear-gradient(135deg, #fffef9 0%, #fff8f0 100%);
    margin-bottom: 15px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

.upload-area:hover {
    /* ペンのインクブルーでアクセント */
    border-color: #3498db;
    background: #ffffff;
    box-shadow: inset 0 2px 12px rgba(52, 152, 219, 0.08);
}

.upload-area.dragover {
    border-color: #2980b9;
    background: linear-gradient(135deg, #e3f2fd 0%, #fff8f0 100%);
    transform: scale(1.01);
    box-shadow: inset 0 2px 16px rgba(52, 152, 219, 0.12);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.upload-text {
    color: #666;
    font-size: 16px;
    margin-bottom: 10px;
}

.upload-hint {
    color: #999;
    font-size: 14px;
}

.camera-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 12px 24px;
    /* カメラ・文房具のグレーブルーカラー */
    background: linear-gradient(135deg, #546e7a 0%, #455a64 100%);
    color: #ffffff;
    border: 2px solid #546e7a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.camera-btn:hover {
    background: linear-gradient(135deg, #455a64 0%, #37474f 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(69, 90, 100, 0.3);
}

#fileInput {
    display: none;
}

#cameraInput {
    display: none;
}

.preview-section {
    margin-bottom: 20px;
    text-align: center;
}

#preview {
    max-width: 100%;
    max-height: 300px;
    display: none;
    margin: 20px auto 0 auto;
    border-radius: 6px;
    /* クラフト紙の枠 */
    border: 3px solid #d4a574;
    box-shadow: 0 4px 16px rgba(212, 165, 116, 0.2);
}

.change-image-btn {
    margin-top: 15px;
    width: auto;
    padding: 12px 24px;
    /* オレンジ系の文房具カラー */
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    font-size: 13px;
    border: 2px solid #ff9800;
    color: #ffffff;
}

.reset-btn {
    width: auto;
    padding: 16px 32px;
    /* 鉛筆の消しゴムをイメージしたグレー */
    background: linear-gradient(135deg, #78909c 0%, #607d8b 100%);
    color: #ffffff;
    border: 2px solid #78909c;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(96, 125, 139, 0.25);
}

.reset-btn:hover {
    background: linear-gradient(135deg, #607d8b 0%, #546e7a 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(96, 125, 139, 0.35);
}

button {
    width: 100%;
    padding: 16px;
    /* 印鑑の朱肉をイメージした赤系カラー */
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #ffffff;
    border: 2px solid #e74c3c;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

button:hover:not(:disabled) {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
    color: #ffffff;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #d4a574;
    border-color: #c8956e;
    color: #9e9e9e;
}

.result-section {
    margin-top: 60px;
    display: none;
    text-align: center;
    position: relative;
    padding-top: 40px;
}

.result-section h2 {
    /* インクブルーで統一 */
    color: #2c3e50;
    margin-bottom: 50px;
    font-size: 26px;
    font-weight: 400;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-family: 'Georgia', serif;
}

.artwork-container {
    display: inline-block;
    position: relative;
}

#resultImage {
    max-width: 100%;
    max-height: 600px;
    display: block;
    margin: 0 auto;
    /* 文房具屋の額縁 - 木製フレームをイメージ */
    padding: 50px;
    background: linear-gradient(135deg, #fffef9 0%, #ffffff 50%, #fff8f0 100%);
    border: 6px solid #c8956e;
    box-shadow: 
        /* 内側の影 - 木製額縁の深み */
        inset 0 0 0 3px #d4a574,
        inset 0 0 0 8px #c8956e,
        inset 0 0 0 10px #d4a574,
        inset 0 0 0 16px #fffef9,
        inset 0 0 20px rgba(0, 0, 0, 0.08),
        /* 外側の立体的な影 */
        0 3px 6px rgba(200, 149, 110, 0.15),
        0 6px 12px rgba(200, 149, 110, 0.15),
        0 12px 24px rgba(200, 149, 110, 0.18),
        0 24px 48px rgba(200, 149, 110, 0.22),
        /* 額縁の立体感と光沢 */
        -10px -10px 20px rgba(255, 255, 255, 0.5),
        10px 10px 20px rgba(200, 149, 110, 0.3);
    border-radius: 4px;
    position: relative;
}

/* 額縁の装飾的な角 - ブラケットのような装飾 */
#resultImage::before,
#resultImage::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #d4a574;
    opacity: 0.7;
}

#resultImage::before {
    top: 15px;
    left: 15px;
    border-right: none;
    border-bottom: none;
}

#resultImage::after {
    bottom: 15px;
    right: 15px;
    border-left: none;
    border-top: none;
}

/* 作品説明プレート - ラベルシールをイメージ */
.artwork-plate {
    background: linear-gradient(135deg, #fffef9 0%, #fff8f0 100%);
    border: 2px solid #d4a574;
    border-radius: 6px;
    padding: 20px 30px;
    margin-top: 30px;
    text-align: left;
    box-shadow: 0 4px 16px rgba(212, 165, 116, 0.2);
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
}

.plate-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-family: 'Georgia', serif;
    letter-spacing: 1px;
}

.plate-subtitle {
    font-size: 14px;
    color: #546e7a;
    font-style: italic;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.plate-year {
    font-size: 13px;
    color: #78909c;
    letter-spacing: 1px;
    border-top: 2px solid #d4a574;
    padding-top: 10px;
}

/* ギャラリーライト効果 */
.result-section::before {
    content: '';
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 150px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.loading {
    text-align: center;
    /* インクブルーのローディング */
    color: #3498db;
    font-weight: 400;
    font-size: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 30px;
    display: none;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.error {
    background: linear-gradient(135deg, #fff8f0 0%, #ffebee 100%);
    color: #c62828;
    padding: 24px;
    border-radius: 6px;
    margin-top: 30px;
    display: none;
    border: 2px solid #ef9a9a;
    border-left: 5px solid #e74c3c;
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.15);
    font-size: 14px;
    line-height: 1.8;
    letter-spacing: 0.5px;
}

/* カメラモーダル */
.camera-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.camera-modal.active {
    display: flex;
}

.camera-modal-content {
    background: white;
    border-radius: 20px;
    padding: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
}

.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.camera-header h2 {
    color: #2c3e50;
    font-size: 24px;
    margin: 0;
}

.close-btn {
    background: #e74c3c;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.3s;
    padding: 0;
}

.close-btn:hover {
    background: #c0392b;
}

#cameraVideo {
    width: 100%;
    max-height: 60vh;
    border-radius: 12px;
    background: #000;
    display: block;
}

.camera-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.capture-btn,
.switch-btn {
    padding: 14px 28px;
    font-size: 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.capture-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    flex: 1;
}

.capture-btn:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.switch-btn {
    background: linear-gradient(135deg, #78909c 0%, #607d8b 100%);
    color: white;
}

.switch-btn:hover {
    background: linear-gradient(135deg, #607d8b 0%, #546e7a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(96, 125, 139, 0.3);
}

/* ダウンロードボタン - ペンのインクブルー */
.download-btn {
    width: auto;
    display: inline-block;
    padding: 16px 48px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #ffffff;
    border: 2px solid #3498db;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.download-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f6ca5 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
}

/* コピーボタン - 緑系 */
.copy-btn {
    width: auto;
    display: inline-block;
    padding: 16px 48px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: #ffffff;
    border: 2px solid #27ae60;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.copy-btn:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.4);
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .container {
        padding: 30px 20px;
    }

    h1 {
        font-size: 24px;
    }

    .style-options,
    .color-options {
        flex-direction: column;
    }

    .color-option {
        min-width: 100%;
    }

    button {
        font-size: 14px;
        padding: 14px;
    }

    .download-btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 14px;
    }

    .copy-btn {
        width: 100%;
        padding: 14px 24px;
        font-size: 14px;
    }
}
