/* =========================================
   Milk Tea & Greige Style (Z世代・女性向け)
========================================= */
:root { 
    --primary: #d4a3a3;       /* くすみピンク */
    --primary-light: #f5ebeb; /* ごく淡いピンク */
    --bg: #fcfaf8;            /* オートミール（背景） */
    --panel: #ffffff;         /* 白（パネル） */
    --text: #5c5353;          /* チャコールグレー（文字） */
    --border: #eee8e8;        /* 淡い境界線 */
    --shadow: rgba(140, 130, 130, 0.12); /* フワッとした影 */
}

body { 
    font-family: 'M PLUS Rounded 1c', 'Yomogi', sans-serif; 
    background: #f0ebeb; /* PCで見た時の外側の背景色（くすみピンクグレー） */
    color: var(--text); 
    margin: 0; 
    padding: 0; 
    overflow-x: hidden; 
}

/* === ベースレイアウト・ヘッダー === */
header, .sticky-action-container, .bottom-info-area, footer, #actionContainer {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    background: var(--bg);
}

.main-container { 
    display: flex; 
    flex-direction: column; 
    max-width: 480px; 
    margin: 0 auto; 
    padding: 15px; 
    gap: 15px; 
    background: var(--bg);
    box-shadow: 0 0 30px rgba(0,0,0,0.08);
}

header { 
    padding: 20px 15px; 
    box-shadow: 0 4px 20px var(--shadow); 
    text-align: center; 
    position: relative;
    z-index: 10;
}
header h1 { margin: 0; font-size: 28px; color: var(--primary); letter-spacing: 2px; }
.description { font-size: 13px; line-height: 1.6; margin: 10px auto 0; max-width: 600px; color: #8c8584; }

/* === レスポンシブ (PC & スマホ) === */
@media (min-width: 992px) {
    .preview-area { 
        position: sticky; top: 20px; z-index: 100; max-height: 55vh; 
        display: flex; flex-direction: column; align-items: center; justify-content: center; 
        background: var(--panel); border-radius: 16px; box-shadow: 0 5px 20px var(--shadow); 
        padding: 10px; box-sizing: border-box; 
    }
}

@media (max-width: 991px) {
    header { padding: 15px 10px; }
    header h1 { font-size: 22px; }
    .description { font-size: 12px; }
    
    .preview-area { 
        position: sticky; top: 0; z-index: 100; max-height: 55vh; height: auto; min-height: 25vh; 
        box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; 
        background: var(--panel); padding: 10px; border-radius: 0 0 20px 20px; box-shadow: 0 5px 20px var(--shadow); 
    }
    .sticky-action-container { padding: 10px 10px 15px 10px; margin-top: -5px; }
}

/* 画面幅に関わらず、下部の固定バー（スマホUI）を強制適用する */
.mobile-fixed-action-bar { 
    display: flex; position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; 
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); 
    border-top: 1px solid var(--border); padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); z-index: 9000; 
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05); gap: 6px; align-items: center; justify-content: space-between; 
    box-sizing: border-box;
}
.mobile-action-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text); font-size: 11px; font-weight: bold; cursor: pointer; padding: 6px 0; border-radius: 8px; transition: background 0.2s; }
.mobile-action-btn:active { background: #f0ebeb; }
.mobile-action-btn.primary-action { background: var(--primary-light); color: var(--primary); }
.mobile-action-icon { font-size: 20px; margin-bottom: 4px; }

#actionContainer .btn-random { display: none !important; }
#actionContainer .btn-action { display: flex; flex-direction: row; gap: 6px; }
#actionContainer .btn-save, #actionContainer .btn-share, #actionContainer .btn-reset { box-shadow: none; border: 1px solid var(--border); padding: 12px 2px; font-size: 12px; border-radius: 10px; flex: 1; min-width: 0; transform: none !important; }
#actionContainer .btn-save { color: #82a382; border-color: #dbeadb; background: #f9fbf9; }
#actionContainer .btn-share { color: #8294a3; border-color: #dbdfea; background: #f9fafb; }
#actionContainer .btn-reset { color: #b87b7b; border-color: #f2dbdb; background: #fbf9f9; }

/* フッターの底上げも全画面で共通化 */
.bottom-info-area { margin-bottom: 20px !important; }
footer { padding-bottom: 120px !important; }

.control-panel { width: 100%; box-sizing: border-box; }
.canvas-wrapper { position: relative; width: 100%; display: grid; place-items: center; flex: 1; min-height: 0; }
#displayArea, #penArea { grid-area: 1 / 1; max-width: 100%; max-height: calc(55vh - 40px); width: auto; height: auto; border-radius: 8px; }
#displayArea { box-shadow: 0 5px 20px rgba(0,0,0,0.08); }
#penArea { pointer-events: none; touch-action: none; box-shadow: none; }
#penArea.active { pointer-events: auto; cursor: crosshair; }

/* ★追加：プレビューエリアのプライバシーオーバーレイ */
#demoPrivacyOverlay {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    padding: 10px;
    border-radius: 10px;
    font-size: 11px;
    text-align: center;
    line-height: 1.5;
    pointer-events: none; /* 下にあるキャンバスを触れるようにする */
    z-index: 10;
}

/* ズームボタン */
.btn-zoom { position: absolute; bottom: 10px; left: 10px; background: rgba(255, 255, 255, 0.9); border: 1px solid var(--border); border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: 0 2px 10px rgba(0,0,0,0.15); z-index: 20; cursor: pointer; transition: transform 0.2s; }
.btn-zoom:hover { transform: scale(1.1); }

/* =========================================
   UIコンポーネント (フォーム・ボタン類)
========================================= */
.accordion-panel { background: var(--panel); border-radius: 16px; margin-bottom: 15px; box-shadow: 0 4px 15px var(--shadow); overflow: hidden; border: 1px solid var(--border); }
.accordion-panel summary { padding: 18px 20px; font-weight: bold; font-size: 15px; color: var(--text); cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; background: var(--panel); transition: background 0.2s; }
.accordion-panel summary::-webkit-details-marker { display: none; }
.accordion-panel summary:hover { background: #fdfbfb; }
.accordion-panel summary::after { content: '▼'; font-size: 12px; color: #bbb; transition: transform 0.3s ease; }
.accordion-panel[open] summary::after { transform: rotate(180deg); }
.accordion-panel[open] summary { border-bottom: 1px solid var(--border); }
.accordion-content { padding: 20px; background: #faf9f8; }

.tab-menu { display: flex; gap: 8px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 5px; -ms-overflow-style: none; scrollbar-width: none; }
.tab-menu::-webkit-scrollbar { display: none; }
.tab-btn { flex-shrink: 0; padding: 12px 16px; text-align: center; border: none; background: #f0ebeb; border-radius: 12px; cursor: pointer; white-space: nowrap; font-size: 13px; font-weight: bold; color: #8c8584; transition: 0.3s; }
.tab-btn.active { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(212, 163, 163, 0.4); }

.filter-group { display: none; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: -5px; -ms-overflow-style: none; scrollbar-width: none; white-space: nowrap; }
.filter-group::-webkit-scrollbar { display: none; }
.filter-group.active { display: flex; align-items: start; }
.btn-filter { flex-shrink: 0; padding: 12px 16px; border: 2px solid transparent; border-radius: 12px; background: var(--panel); cursor: pointer; font-size: 11px; font-weight: bold; color: var(--text); box-shadow: 0 2px 8px var(--shadow); transition: 0.2s; }
.btn-filter:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-filter.active { background: var(--primary-light); border-color: var(--primary); color: var(--text); }

.opt-card { display: flex; flex-direction: column; gap: 15px; }
.opt-card-title { font-size: 13px; font-weight: bold; color: var(--primary); margin-bottom: 5px; }
.opt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; }

.ctrl-input, .ctrl-select { padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; flex: 1; background: var(--panel); color: var(--text); outline: none; transition: border-color 0.2s; }
.ctrl-input:focus, .ctrl-select:focus { border-color: var(--primary); }
textarea.ctrl-input { resize: vertical; min-height: 60px; font-family: inherit; width: 100%; box-sizing: border-box; }
.color-picker { height: 44px; padding: 0; width: 50px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; flex-shrink: 0; background: var(--panel); }

.slider-group { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 120px; }
.slider-group label { font-size: 12px; color: #777; font-weight: bold; display: flex; justify-content: space-between; }
.ctrl-slider { width: 100%; accent-color: var(--primary); touch-action: pan-y; }

.btn-icon, .btn-crop { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); cursor: pointer; font-size: 13px; font-weight: bold; color: var(--text); transition: 0.2s; display: flex; justify-content: center; align-items: center; flex: 1; }
.btn-icon:hover, .btn-crop:hover { background: #f9f8f6; }
.btn-crop.active { background: var(--primary-light); border-color: var(--primary); }
.crop-btns { display: flex; gap: 8px; }

/* 共通汎用ユーティリティクラス（HTMLのインラインCSS削減用） */
.flex-row-gap { display: flex; gap: 10px; margin-bottom: 20px; }
.flex-row-center { display: flex; align-items: center; gap: 8px; }
.panel-footer-actions { display: flex; justify-content: space-between; margin-top: 15px; }
.btn-danger-outline { color: #e63246; border-color: #f5c6cb; background: #fff; }
.btn-primary-solid { background: var(--primary); color: white; border: none; font-weight: bold; box-shadow: 0 2px 8px var(--shadow); }
.btn-text-add { width: 100%; padding: 10px; background: #eef2ff; color: var(--primary); font-weight: bold; border-radius: 8px; border: 1px solid var(--primary); margin-bottom: 10px;}
.info-alert { font-size: 11px; color: #666; margin: 0 0 12px 0; line-height: 1.5; padding: 10px; background: #fff5f5; border-radius: 8px; border: 1px dashed var(--primary); }
.info-alert-title { color: var(--primary); font-weight: bold; display: block; margin-bottom: 4px; }
.bg-wrapper { background: #fdfbfb; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); }
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; } .mb-15 { margin-bottom: 15px; }

/* アクションボタン群 */
.btn-action { display: flex; gap: 15px; margin-top: 25px; flex-wrap: wrap; }
.btn-save, .btn-share, .btn-reset { flex: 1; padding: 16px; border: none; border-radius: 14px; cursor: pointer; font-weight: bold; font-size: 15px; color: white; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.3s; box-shadow: 0 4px 15px rgba(0,0,0,0.1); min-width: 120px; }
.btn-save { background: #a8c2a8; } .btn-save:hover { background: #96b396; transform: translateY(-2px); }
.btn-share { background: #a8b4c2; } .btn-share:hover { background: #96a2b2; transform: translateY(-2px); }
.btn-reset { background: #d4a3a3; } .btn-reset:hover { background: #c69292; transform: translateY(-2px); }

.btn-reselect { flex: 1; padding: 14px; background: var(--panel); color: var(--text); font-weight: bold; font-size: 13px; border-radius: 14px; border: 2px solid var(--border); cursor: pointer; box-shadow: 0 4px 15px var(--shadow); display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.3s; }
.btn-reselect:hover { background: #fdfbfb; transform: translateY(-2px); }
.custom-file-btn { flex: 1; padding: 14px; font-size: 14px; border: none; background: var(--primary); color: white; border-radius: 50px; cursor: pointer; display: inline-block; font-weight: bold; box-shadow: 0 6px 20px rgba(212, 163, 163, 0.5); transition: 0.3s; }
.custom-file-btn:hover { transform: translateY(-2px); }

.check-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: bold; color: #666;}
.check-label input[type="checkbox"] { accent-color: var(--primary); width: 18px; height: 18px; cursor: pointer; }

/* テキストレイヤー */
.text-layer-item { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 15px; display: flex; flex-direction: column; gap: 10px; position: relative; box-shadow: 0 2px 10px var(--shadow); margin-bottom: 10px; }
.text-layer-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: bold; color: #888; }
.btn-remove-text { background: transparent; border: none; color: #d4a3a3; cursor: pointer; font-size: 20px; font-weight: bold; line-height: 1; padding: 0 5px; }

/* =========================================
   メインカテゴリー＆カルーセル (横スクロール) UI
========================================= */
.main-mode-tabs { display: flex; background: #f0ebeb; border-radius: 30px; padding: 4px; margin-bottom: 20px; box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); }
.main-mode-tabs .mode-tab-btn { flex: 1; background: transparent; border: none; padding: 12px 0; font-size: 14px; font-weight: bold; color: #999; border-radius: 25px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); text-align: center; margin: 0; cursor: pointer; }
.main-mode-tabs .mode-tab-btn.active { background: #ffffff; color: var(--primary); box-shadow: 0 2px 10px rgba(0,0,0,0.08); }

.category-title { font-size: 13px; font-weight: bold; color: var(--text); margin-bottom: 8px; }
.h-scroll-row { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 10px; scrollbar-width: none; -ms-overflow-style: none; }
.h-scroll-row::-webkit-scrollbar { display: none; }

.pill-btn { flex: 0 0 auto; font-size: 13px; margin: 0; padding: 10px 16px; border-radius: 20px; white-space: nowrap; background: #fff; border: 1px solid var(--border); color: var(--text); box-shadow: 0 2px 8px var(--shadow); transition: all 0.2s; cursor: pointer; }
.pill-btn:active { transform: scale(0.96); }
.pill-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* AIマジックボタン */
.ai-btn-card { flex: 0 0 125px; margin: 0; padding: 16px 8px; background: var(--panel); border: 2px solid transparent; border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 6px 20px var(--shadow); transition: all 0.3s ease; text-align: center; overflow: hidden; }
.ai-btn-card:hover { transform: translateY(-4px); border-color: var(--primary-light); }
.ai-btn-card:disabled { opacity: 0.5; cursor: not-allowed; background: #f0f0f0; transform: none; box-shadow: none; border-color: transparent;}
.ai-icon { font-size: 32px; margin-bottom: 8px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)); }
.ai-name { font-size: 13px; font-weight: bold; color: var(--text); margin-bottom: 4px; }
.ai-desc { font-size: 11px; color: #999; font-weight: bold; }

/* アラート系（リセット等）のボタン */
.btn-alert-reset { color: #e63246; border-color: #f5c6cb; width: 100%; padding: 14px; font-weight: bold; border-radius: 12px; background: #fff; box-shadow: 0 4px 12px var(--shadow); cursor: pointer; transition: 0.2s; border: 1px solid;}
.btn-alert-reset:active { transform: scale(0.98); background: #fff5f5; }

/* AI全自動専用ボタン */
.btn-magic { width: 100%; padding: 12px; background: linear-gradient(135deg, #ff7b9c, #ff9a9e); color: white; font-weight: bold; font-size: 14px; border: none; border-radius: 12px; cursor: pointer; box-shadow: 0 4px 10px rgba(255, 123, 156, 0.4); transition: transform 0.1s; }
.btn-magic:active { transform: scale(0.98); }

/* PWAインストールボタン */
.btn-pwa-install { display: none; width: 100%; background: #ff4785; color: white; font-weight: bold; padding: 12px; border-radius: 8px; margin-bottom: 20px; border: none; box-shadow: 0 4px 6px rgba(255, 71, 133, 0.3); font-size: 14px; cursor: pointer; transition: 0.2s;}
.btn-pwa-install:active { transform: scale(0.98); }

/* iOS PWA プロンプト */
.ios-pwa-prompt { display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: 90%; max-width: 400px; background: rgba(255, 255, 255, 0.95); color: #333; padding: 15px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 9999; font-size: 14px; text-align: center; }

/* =========================================
   身体補正 (Pro UI) 固有のスタイル
========================================= */
.body-tool-bar { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 5px; scrollbar-width: none; }
.body-tool-bar::-webkit-scrollbar { display: none; }
.body-tool-btn { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--border); background: #f5f5f5; font-size: 13px; font-weight: bold; color: #999; cursor: pointer; transition: 0.2s; }
.body-tool-btn.active { border: 2px solid var(--primary); background: var(--primary-light); color: var(--primary); }
.body-tool-btn.danger { color: #e63246; }

.body-prop-panel { background: #fdfbfb; padding: 12px; border-radius: 8px; border: 1px solid var(--border); animation: fadeIn 0.3s ease; }
.body-prop-panel.eraser-panel { border-color: #ffcccc; background: #fff5f5; }

.body-mode-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.body-mode-btn { flex: 1; padding: 8px 4px; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: #666; font-weight: bold; font-size: 12px; cursor: pointer; transition: 0.2s; }
.body-mode-btn.active { border: 2px solid var(--primary); background: var(--primary-light); color: var(--primary); }

.color-preset-btn { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: 0.2s; padding: 0; box-sizing: border-box; }
.color-preset-btn.active { border: 3px solid var(--primary); box-shadow: 0 0 8px rgba(0,0,0,0.2); transform: scale(1.1); }

.btn-undo-body { background: #fff; border: 1px solid var(--border); padding: 8px 16px; border-radius: 20px; font-size: 12px; cursor: pointer; color: #333; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.05); transition: 0.2s; }
.btn-undo-body:hover { background: #f9f9f9; transform: translateY(-1px); }

/* =========================================
   ボトムシート（ポップアップUI）
========================================= */
.bottom-sheet-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: transparent; z-index: 9998; opacity: 0; transition: opacity 0.3s ease; }
.bottom-sheet-overlay.active { display: block; opacity: 1; }
.bottom-sheet { position: fixed; bottom: -100%; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: #ffffff; border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1); z-index: 9999; transition: bottom 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); box-sizing: border-box; }
.bottom-sheet.active { bottom: 0; }
.bottom-sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.bottom-sheet-title { font-size: 15px; font-weight: bold; color: var(--text); margin: 0; display: flex; align-items: center; gap: 8px; }
.btn-close-sheet { background: #f0ebeb; border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 16px; color: #888; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-close-sheet:active { background: #e4dcdc; }
.bottom-sheet-content { padding-bottom: 10px; }

/* =========================================
   その他の共通・アニメーション
========================================= */
.mode-panel { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.bottom-info-area { margin-bottom: 0 !important; width: 95%; max-width: 600px; margin: 30px auto 60px; }
.minimal-accordion { margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.minimal-accordion summary { padding: 15px 5px; font-size: 14px; font-weight: bold; color: var(--text); cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.minimal-accordion summary::-webkit-details-marker { display: none; }
.minimal-accordion summary::after { content: '＋'; font-size: 16px; color: var(--primary); transition: transform 0.3s; }
.minimal-accordion[open] summary::after { content: '−'; }
.minimal-content { padding: 5px 5px 20px; font-size: 13px; line-height: 1.8; color: #777; animation: fadeIn 0.3s ease; }
.qa-q { font-weight: bold; color: var(--text); margin-bottom: 2px !important; }
.qa-a { margin-bottom: 15px !important; }

footer { margin-top: 0; padding: 0 20px 20px; text-align: center; background: transparent; }

/* ズーム用モーダル */
.zoom-modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.9); z-index: 99999; align-items: center; justify-content: center; flex-direction: column; }
.zoom-modal img { max-width: 95vw; max-height: 80vh; object-fit: contain; border-radius: 8px; box-shadow: 0 4px 30px rgba(0,0,0,0.5); touch-action: none; user-select: none; -webkit-user-drag: none; }
.btn-close-zoom { margin-top: 25px; background: rgba(255, 255, 255, 0.2); color: white; border: 1px solid rgba(255, 255, 255, 0.5); padding: 12px 40px; border-radius: 30px; font-size: 16px; font-weight: bold; cursor: pointer; transition: background 0.2s; z-index: 100000; }
.btn-close-zoom:hover { background: rgba(255, 255, 255, 0.4); }

/* スクロール時の固定領域用 */
.sticky-action-container { position: sticky; top: 0; z-index: 105; background: var(--bg); padding: 15px 15px 20px 15px; box-shadow: 0 10px 15px -10px rgba(0,0,0,0.1); }

/* =========================================
   ★ツールチップ
========================================= */
/* 吹き出し全体を包む枠 */
.tooltip-wrap {
  position: relative;
  display: inline-block;
  margin-left: 5px;
}

/* 「i」アイコンのデザイン */
.info-icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 18px;
  height: 18px;
  background-color: #ddd; /* アイコンの背景色 */
  color: #555;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  outline: none; /* タップ時の青枠を消す */
}

/* 吹き出し本体（最初は非表示） */
.tooltip-content {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  width: 220px; /* 吹き出しの幅 */
  background-color: #333; /* 黒背景 */
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  z-index: 100;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: all 0.2s ease; /* ふわっと出すアニメーション */
  pointer-events: none;
}

/* 吹き出しの「しっぽ（▼）」を作る */
.tooltip-content::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

/* アイコンをタップ(フォーカス)またはホバーした時に吹き出しを表示 */
.info-icon:focus + .tooltip-content,
.tooltip-wrap:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* アプリ全体でテキスト選択と長押しメニューを完全に禁止する */
body {
    -webkit-user-select: none; /* Safari用 */
    user-select: none;         /* 標準 */
    -webkit-touch-callout: none; /* iOSの長押しメニュー禁止 */
    -webkit-tap-highlight-color: transparent; /* タップ時の青い半透明の枠を消す */
}

/* ※もし今後、文字入力（テキストスタンプなど）の機能がある場合は、
   入力欄だけは選択できるように例外ルールを書いておきます */
input, textarea {
    -webkit-user-select: auto;
    user-select: auto;
}

/* =========================================
   ★追加：SNS（X）リンクボタン・フッターエリア
========================================= */
.footer-social-area {
    margin: 40px 0 30px;
}

.social-lead {
    font-size: 12px;
    color: var(--text);
    margin-bottom: 10px;
    font-weight: bold;
}

.social-sub {
    font-size: 10px;
    color: #999;
    margin-top: 10px;
}

.btn-social-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #333; /* Xのブランドカラーを少し柔らかくしたダークグレー */
    color: #fff;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-social-x:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    color: #fff;
}

.x-icon {
    font-size: 16px;
    margin-right: 5px;
}

/* --- 有料版バナー（フッター内） --- */
.pro-dev-footer-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #fdfbfb; /* パネルと同じ白背景 */
    color: var(--text); /* 既存のテキスト色 */
    border: 2px dashed rgba(212, 163, 163, 0.6); /* くすみピンクの点線枠 */
    border-radius: 12px; /* 角丸 */
    padding: 15px 10px;
    margin: 30px auto 10px; /* 上下の余白と中央揃え */
    max-width: 90%; /* 横幅を少し絞ってカードっぽく */
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03); /* ほんのり影 */
    user-select: none; /* テキストを選択不可に */
    pointer-events: none; /* クリック不可 */
}

.pro-dev-footer-banner .dev-icon {
    font-size: 1.2em;
}

/* ==========================================
   アプリ内ブラウザ警告バナー
========================================== */
#inAppBrowserWarning {
    display: none; /* 初期状態は非表示 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ff4b72; /* 注意を引くが可愛さもあるピンクレッド */
    color: white;
    text-align: center;
    padding: 12px 30px 12px 10px;
    font-size: 13px;
    font-weight: bold;
    z-index: 9999;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
#inAppBrowserWarning span {
    display: block;
    font-size: 11px;
    font-weight: normal;
    margin-top: 4px;
    opacity: 0.9;
}
#closeBrowserWarning {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: white;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
}

#closeBrowserWarning {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: white;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
}

        /* CSSをHTMLに直書きしてLINEの白背景化（キャッシュ）を防ぐ */
        #forceBrowserWarning {
            display: none;
            position: fixed;
            top: 0; left: 0; width: 100%;
            background-color: #ff4b72 !important; /* 絶対にピンクにする */
            color: white !important;
            text-align: center;
            padding: 12px 30px 12px 10px;
            font-size: 13px;
            font-weight: bold;
            z-index: 2147483647; /* どんな要素よりも上に配置（MAX値） */
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
            box-sizing: border-box;
        }
        #forceBrowserWarning span {
            display: block; font-size: 11px; font-weight: normal; margin-top: 4px; opacity: 0.9;
        }
        #closeForceWarning {
            position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
            font-size: 18px; color: white; cursor: pointer; padding: 5px; opacity: 0.8;
        }

/* =========================================
   骨格診断用 UI
========================================= */
.custom-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    z-index: 99999;
}
.custom-modal-content {
    background: var(--panel); width: 85%; max-width: 340px;
    max-height: 90vh; /* ★追加: モーダルの高さを画面の90%までに制限 */
    overflow-y: auto; /* ★追加: はみ出た分はスクロールできるようにする */
    border-radius: 16px; padding: 25px; position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    animation: popIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* ★追加: 描画される画像（Canvas）自体も縦長になりすぎないように制御 */
#skeletonDebugCanvas {
    max-height: 45vh;
    object-fit: contain;
}

.modal-close-btn {
    position: absolute; top: 10px; right: 15px; font-size: 24px;
    background: none; border: none; color: #999; cursor: pointer;
}
.skeleton-guide-box {
    border: 2px dashed var(--primary); border-radius: 12px;
    background: var(--primary-light); padding: 20px; text-align: center;
    color: var(--primary); font-weight: bold; margin-top: 10px;
}
.skeleton-ans-btn {
    display: block; width: 100%; padding: 12px; margin-bottom: 8px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--text); font-size: 13px; font-weight: bold;
    cursor: pointer; transition: 0.2s;
}
.skeleton-ans-btn:active { background: var(--primary-light); border-color: var(--primary); }
.skeleton-loader {
    width: 40px; height: 40px; border: 4px solid var(--border);
    border-top: 4px solid var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite; margin: 0 auto 15px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes popIn { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* =========================================
   骨格診断 デモ画像サムネイル (上部切り抜き)
========================================= */
/* 画像をボタン化するためのリセットスタイル */
.img-popup-trigger {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    width: 48%; /* 横並び。親要素のflexで制御されていると推測 */
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    border-radius: 8px;
    overflow: hidden; /* ★重要：画像のはみ出しをカット */
    display: block;
}

.img-popup-trigger:active {
    transform: scale(0.96);
    opacity: 0.8;
}

/* ★修正：画像の上部のみを切り抜いてサムネイルとして表示 */
.img-popup-trigger .skeleton-demo-img {
    width: 100%;
    height: 100px; /* ★重要：サムネイルの高さを固定 */
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px; /* overflow:hidden で効かなくなるため、imgにも付与 */
    object-fit: cover; /* ★重要：アスペクト比を維持しつつ、枠に合わせてクロップ */
    object-position: top; /* ★最重要：画像の「上部」を基準に表示 */
}

/* =========================================
   骨格診断 デモ画像サムネイル (絶対横並び・上部切り抜き)
========================================= */

/* ★親要素：ここで強制的に横並び（並列）にする */
.skeleton-demo-images {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    gap: 10px; /* 画像と画像の隙間 */
    margin-bottom: 10px;
}

/* ★子要素（画像を囲むボタン） */
.img-popup-trigger {
    flex: 1; /* 2つの画像が均等な幅で横に並ぶ */
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    border-radius: 8px;
    overflow: hidden;
    display: block;
}

.img-popup-trigger:active {
    transform: scale(0.96);
    opacity: 0.8;
}

/* ★中の画像（上部100pxだけを切り抜いてサムネイル化） */
.img-popup-trigger .skeleton-demo-img {
    width: 100%;
    height: 100px; /* サムネイルの高さ */
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    object-fit: cover; /* アスペクト比を維持して切り抜き */
    object-position: top; /* 画像の上部を基準にする */
}

/* =========================================
   骨格診断 デモ画像サムネイル (絶対横並び・上部切り抜き)
========================================= */

/* ★親要素：ここで強制的に横並び（並列）にする */
.skeleton-demo-images {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    gap: 10px; /* 画像と画像の隙間 */
    margin-bottom: 10px;
}

/* ★子要素（画像を囲むボタン） */
.img-popup-trigger {
    flex: 1; /* 2つの画像が均等な幅で横に並ぶ */
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    border-radius: 8px;
    overflow: hidden;
    display: block;
}

.img-popup-trigger:active {
    transform: scale(0.96);
    opacity: 0.8;
}

/* ★中の画像（上部100pxだけを切り抜いてサムネイル化） */
.img-popup-trigger .skeleton-demo-img {
    width: 100%;
    height: 100px; /* サムネイルの高さ */
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    object-fit: cover; /* アスペクト比を維持して切り抜き */
    object-position: top; /* 画像の上部を基準にする */
}

/* =========================================
   汎用画像拡大ポップアップ (完全はみ出し防止版)
========================================= */

.global-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.global-popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.global-popup-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: popupPopIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* ★修正：画像自身に「画面幅の90%」「画面高さの85%」を上限として強制指定 */
.global-popup-img {
    max-width: 90vw !important;  /* 画面幅の90%を絶対に超えない */
    max-height: 85vh !important; /* 画面高さの85%を絶対に超えない（上下に必ず余白ができる） */
    width: auto;
    height: auto;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    object-fit: contain; /* 縦横比を崩さず、上記の枠内に「画像全体」をピタッと収める */
}

.global-popup-close {
    position: fixed;
    top: 3%;
    right: 4%;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 1000001;
}

.global-popup-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* =========================================
   ★追加: 骨格診断バナー＆撮影ガイドポップアップ
========================================= */
.skeleton-banner {
    background: linear-gradient(135deg, #f5ebeb, #ffffff);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}
.skeleton-banner:active {
    transform: scale(0.98);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.skeleton-banner-left { display: flex; align-items: center; gap: 15px; }
.skeleton-banner-icon { font-size: 30px; }
.skeleton-banner-content { text-align: left; }
.skeleton-banner-title { margin: 0; font-size: 16px; font-weight: bold; color: var(--text); }
.skeleton-banner-badge {
    background: var(--primary); color: white; font-size: 10px;
    padding: 2px 6px; border-radius: 10px; margin-left: 5px; vertical-align: middle;
}
.skeleton-banner-desc { margin: 5px 0 0 0; font-size: 12px; color: #888; }
.skeleton-banner-arrow { font-size: 20px; color: var(--primary); }

.guide-popup-content {
    background: var(--panel); width: 90%; max-width: 400px; border-radius: 20px;
    padding: 24px 16px; text-align: center; box-shadow: 0 10px 25px var(--shadow);
    animation: popupPopIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.guide-popup-header h3 { color: var(--primary); margin: 0 0 8px 0; font-size: 1.2rem; }
.guide-popup-header p { color: var(--text); font-size: 0.9rem; margin: 0 0 20px 0; }
.guide-images { display: flex; gap: 12px; margin-bottom: 24px; }
.guide-item {
    flex: 1; position: relative; background: var(--primary-light);
    border-radius: 12px; padding: 16px 8px 12px;
}
.guide-item img { width: 100%; border-radius: 8px; margin-bottom: 8px; background: white; }
.guide-badge {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    padding: 4px 16px; border-radius: 20px; font-weight: bold; font-size: 0.85rem;
    color: white; box-shadow: 0 2px 6px var(--shadow);
}
.ok-badge { background: #ff8e8b; }
.ng-badge { background: #b5b5b5; }
.guide-item p { font-size: 0.75rem; margin: 0; line-height: 1.4; color: var(--text); font-weight: bold; }
.guide-submit-btn {
    background: var(--primary); color: white; border: none; border-radius: 30px;
    padding: 14px 24px; font-size: 1rem; font-weight: bold; width: 100%;
    margin-bottom: 12px; cursor: pointer; transition: transform 0.2s;
}
.guide-submit-btn:active { transform: scale(0.95); }
.guide-cancel-btn {
    background: transparent; color: var(--text); border: none; font-size: 0.9rem;
    cursor: pointer; text-decoration: underline;
}

/* =========================================
   骨格診断バナーのキラキラエフェクト
========================================= */
.skeleton-banner {
    position: relative;
    overflow: hidden;
}

.skeleton-banner-left,
.skeleton-banner-arrow {
    position: relative;
    z-index: 2;
}

.skeleton-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    z-index: 1;
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; opacity: 0; }
    10% { opacity: 1; }
    20% { left: 200%; opacity: 0; }
    100% { left: 200%; opacity: 0; }
}