/* --- デザインの基本設定 --- */
:root {
    --primary-gradient: linear-gradient(135deg, #ff00cc, #3333ff);
    --special-gradient: linear-gradient(45deg, #ffd700, #ff8c00);
    --bg-color: #f5f5f7;
    --accent-color: #d81b60;
}

body {
    font-family: "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 15px;
}

.container {
    background: white;
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    padding: 25px 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

/* --- ステップ表示 --- */
.steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
}

.step-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 8px;
    color: #bbb;
}

.step {
    width: 22px;
    height: 22px;
    background: #ccc;
    border-radius: 50%;
    line-height: 22px;
    color: white;
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 11px;
}

.step-item.active { color: var(--accent-color); }
.step-item.active .step { background: var(--accent-color); }

/* --- コンテンツ --- */
.bubble {
    background: var(--accent-color);
    color: white;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    position: relative;
}

.selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* --- ボタン設定（重なり順を最優先に） --- */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    z-index: 10; /* 他の要素より手前に表示 */
    transition: opacity 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.select-btn { background: #f0f0f0; color: #333; }

.main-btn { 
    background: var(--primary-gradient); 
    color: white; 
    margin-top: 10px;
    z-index: 20; /* 生成ボタンなどは特に高く設定 */
}

.special-btn { background: var(--special-gradient); color: white; margin-top: 15px; grid-column: span 2; }

.btn-link {
    background: none; border: none; color: #888;
    margin-top: 15px; text-decoration: underline; 
    cursor: pointer;
    position: relative;
    z-index: 10;
}

/* --- プレビュー表示 --- */
.preview-box {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.sample-frame {
    width: 180px;
    height: 180px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.1));
}

/* --- キャンバス・調整エリア --- */
.canvas-outer {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.canvas-container {
    width: 280px; 
    height: 280px;
    position: relative;
    /* overflow: visible; にすることで
       レベル50フレームのような「円からはみ出た装飾」も表示されます。
    */
    overflow: visible; 
}

#mainCanvas { 
    width: 100%; 
    height: 100%; 
    cursor: move; 
    touch-action: none; /* スマホ操作時にブラウザのスクロールを防ぐ */
}

.controls {
    margin: 20px 0;
    position: relative;
    z-index: 5;
}

#zoomRange {
    width: 80%;
    cursor: pointer;
}

/* --- 保存・結果画面 --- */
.finish-title {
    color: var(--accent-color);
    font-size: 20px;
    margin-bottom: 15px;
}

#result-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.result-img {
    width: 250px; 
    height: 250px;
    object-fit: contain;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.save-guide {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
}

/* スマホ用調整 */
@media (max-width: 350px) {
    .container {
        padding: 15px 10px;
    }
    .canvas-container {
        width: 240px;
        height: 240px;
    }
}