@charset "UTF-8";

@font-face {
    font-family: 'EspressoDolce';
    src: url('/fonts/EspressoDolce.ttf') format('truetype');
}
@font-face {
    font-family: 'Pacifico';
    src: url('/fonts/Pacifico-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Lobster';
    src: url('/fonts/Lobster-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Manbow';
    src: url('/fonts/manbow-solid.ttf') format('truetype');
}
@font-face {
    font-family: 'LovelyValentine';
    src: url('/fonts/Lovely-Valentine.ttf') format('truetype');
}
@font-face {
    font-family: 'ZenMaruGothic';
    src: url('/fonts/ZenMaruGothic-Regular.ttf') format('truetype');
}

/* =========================================
   Base & Variables
   ========================================= */
:root {
    --col-pink: #F48FB1;
    --col-mint: #7ED1C2;
    --col-mint-light: #E0F2F1;
    --col-blue: #7FA8F5;
    --col-yellow: #FFD966;
    --col-text: #3A3A3A;
    --col-gray: #999;
    --col-bg: #FFF5F7;
    
    --font-jp: "ZenMaruGothic", sans-serif;
    --font-en: "Pacifico", cursive;
    --font-dot: "DotGothic16", sans-serif;
    
    --header-height: 70px;
    --mobile-preview-height: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-jp);
    color: var(--col-text);
    line-height: 1.6;
    background-color: white;
    /* ギンガムチェック背景 */
    background-image:
      linear-gradient(90deg, rgba(244, 143, 177, 0.15) 50%, transparent 50%),
      linear-gradient(rgba(244, 143, 177, 0.15) 50%, transparent 50%);
    background-size: 20px 20px;
    padding-top: var(--header-height); 
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: opacity 0.3s; }
a:hover { opacity: 0.7; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }

/* =========================================
   Custom Modal (Popup) & Toast
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.6); backdrop-filter: blur(2px);
    z-index: 99999;
    display: flex; justify-content: center; align-items: center;
}
.modal-box {
    background: white; width: 280px; padding: 25px;
    border-radius: 20px; text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    /* 点線枠、可愛いピンク */
    border: 3px dashed var(--col-pink);
}
#modal-message { font-family: var(--font-dot); font-weight: bold; margin-bottom: 20px; font-size: 0.9rem; line-height: 1.6; color: var(--col-text); }
.modal-actions { display: flex; justify-content: center; gap: 15px; }
.modal-btn {
    font-family: var(--font-dot);
    padding: 8px 20px; border-radius: 20px; font-weight: bold; width: 90px; font-size: 0.9rem;
}
.modal-btn.cancel { background: #eee; color: #666; }
.modal-btn.ok { background: var(--col-pink); color: white; }

.toast {
    font-family: var(--font-dot);
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: var(--col-pink); color: white; /* 完了通知はピンクで */
    padding: 10px 25px; border-radius: 30px;
    font-size: 0.95rem; font-weight: bold;
    box-shadow: 0 5px 15px rgba(244, 143, 177, 0.4);
    z-index: 99999;
    display: flex; align-items: center; gap: 8px;
    animation: fadeUp 0.3s ease-out;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* =========================================
   HOW TO Mobile Modal
   ========================================= */
/* PC時はスマホ用HOW TOボタンを非表示 */
#howto-btn-mobile {
    display: none;
}

/* HOW TO モーダル固有のスタイル */
.howto-modal-box {
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px 20px 20px;
    position: relative;
    text-align: left;
    border: 3px dashed var(--col-mint); /* ピンクと分けるためにミントに */
}
.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    transition: 0.2s;
}
.close-modal-btn:hover {
    color: var(--col-pink);
}

/* =========================================
   Header & Nav
   ========================================= */
.header {
    position: fixed;
    top: 0; left: 0; width: 100%; height: var(--header-height);
    background: rgba(255,255,255,0.7); 
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 5%; 
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.logo {
    font-family: var(--font-en);
    font-size: 1.5rem;
    color: var(--col-pink);
}

.hamburger {
    cursor: pointer; width: 30px; height: 20px; 
    position: fixed; 
    right: 5%; top: 25px; 
    z-index: 9999;
}
.hamburger span {
    display: block; width: 100%; height: 2px;
    background: var(--col-pink); position: absolute; transition: 0.3s;
}
.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 9px; }
.hamburger span:nth-child(3) { bottom: 0; }
.hamburger.active span:nth-child(1) { transform: rotate(45deg); top: 9px; }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg); bottom: 9px; }

.nav-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    
    /* ★変更：単色からギンガムチェック柄（ピンク）に変更 */
    background-color: rgba(255, 255, 255, 0.95); /* 後ろがほんのり透ける白ベース */
    background-image: 
        linear-gradient(90deg, rgba(244, 143, 177, 0.2) 50%, transparent 50%),
        linear-gradient( rgba(244, 143, 177, 0.2) 50%, transparent 50%);
    background-size: 24px 24px; /* チェックの大きさ */
    
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: 0.4s; 
    z-index: 1500;
}
.nav-overlay.active { opacity: 1; visibility: visible; }
.nav-list { list-style: none; text-align: center; }
.nav-list li { margin: 15px 0; }
.nav-list a { font-size: 1.2rem; color: var(--col-text); font-weight: bold; }
.sub-link a { font-size: 1rem; font-weight: normal; color: #666; }

/* =========================================
   Layout
   ========================================= */
.main-container {
    display: flex; flex-direction: row;
    justify-content: center; align-items: flex-start;
    gap: 40px; max-width: 1200px;
    margin: 40px auto; padding: 0 20px;
}

/* Left: Preview */
.preview-wrapper {
    flex: 1; max-width: 500px; 
    position: sticky; top: 90px; z-index: 10;
}
.preview-area {
    width: 100%; aspect-ratio: 1 / 1;
    background-color: white; border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
#svg-container {
    width: 85%; height: 85%;
    display: flex; justify-content: center; align-items: center;
}
#svg-container svg { width: 100%; height: 100%; display: block; }

.action-btn {
    position: absolute; bottom: 20px; right: 20px;
    width: 50px; height: 50px; border-radius: 50%;
    /* カメラボタンはピンク */
    background: var(--col-pink); color: white;
    font-size: 1.2rem; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: flex; justify-content: center; align-items: center;
    transition: transform 0.2s; z-index: 10;
}
.action-btn:hover { transform: scale(1.1); }

/* Right: Controls */
.controls-container {
    flex: 1; max-width: 600px;
    background: rgba(255,255,255,0.95);
    border-radius: 20px; padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    min-height: 500px;
}

/* Tabs */
.tab-sticky-wrapper {
    position: relative; margin-bottom: 20px;
    border-bottom: 2px dashed var(--col-pink);
    padding-bottom: 10px;
    background: rgba(255,255,255,0.95);
    z-index: 20;
}
.tabs { display: flex; gap: 5px; flex-wrap: nowrap; overflow-x: auto; }
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    flex: 1; background: none; padding: 8px 2px;
    font-family: var(--font-dot); 
    font-weight: bold;
    font-size: 1rem;
    color: var(--col-gray);
    white-space: nowrap; transition: 0.3s;
    text-align: center; border-radius: 5px;
}
.tab-btn.active { color: var(--col-pink); background-color: #FFF0F5; }
.scroll-hint { display: none; }

/* Contents */
.tab-content { display: none; }
.tab-content.active { display: block; }

.control-title {
    font-family: var(--font-dot); /* ★ドットフォント適用 */
    font-size: 1.3rem; 
    margin-bottom: 20px; 
    color: var(--col-mint);
    text-shadow: 1px 1px 0 rgba(0,0,0,0.1); /* ★ぷっくり影を追加 */
    border-bottom: 2px dashed var(--col-mint);
    padding-bottom: 8px; display: inline-block; width: 100%;
}

.selected-info { margin-bottom: 10px; font-size: 0.9rem; color: #666; }
.current-val { font-weight: normal; font-size: 0.9rem; color: var(--col-mint); margin-left: 10px; }

/* HOW TO */
.howto-container { display: flex; flex-direction: column; gap: 5px; }

/* ★変更：角丸囲み・背景・影を削除し、スッキリさせる */
.step-card {
    background: transparent;
    border-radius: 0; 
    padding: 12px 5px; /* 上下の余白 */
    box-shadow: none;
    border: none;
    border-bottom: 1px dashed #eee; /* 項目の間に区切り線を引く */
}
/* 最後の項目の下線は消す */
.step-card:last-child {
    border-bottom: none;
}

.row-layout { 
    display: flex; 
    flex-direction: column; /* ★横並びから縦並びに変更 */
    align-items: stretch;   /* ★要素を横幅いっぱいに広げる */
    gap: 8px;               /* ★タイトルと説明文の隙間 */
}

.step-title {
    font-family: var(--font-dot);
    font-weight: bold; 
    font-size: 1rem; 
    white-space: nowrap; 
    width: 100%;            /* ★横幅いっぱいに広げて点線を伸ばす */
    text-align: left;
    padding-bottom: 2px;
    background: transparent;
}

.step-card:nth-child(1) .step-title { color: var(--col-pink); border-bottom: 2px dashed var(--col-pink); }
.step-card:nth-child(2) .step-title { color: var(--col-mint); border-bottom: 2px dashed var(--col-mint); }
.step-card:nth-child(3) .step-title { color: var(--col-blue); border-bottom: 2px dashed var(--col-blue); }
.step-card:nth-child(4) .step-title { color: var(--col-yellow); border-bottom: 2px dashed var(--col-yellow); }
.step-card:nth-child(5) .step-title { color: var(--col-pink); border-bottom: 2px dashed var(--col-pink); }

/* ★変更：説明文もグレーではなく通常カラー（--col-text）に */
.step-desc { font-size: 0.8rem; color: var(--col-text); line-height: 1.5; flex: 1; }

/* ★変更：注意書きを通常サイズ＆通常カラーにし、可愛い枠で目立たせる */
.disclaimer-box {
    margin-bottom: 20px; 
    padding: 12px 15px; 
    font-size: 0.8rem;
    color: var(--col-text); /* ★通常カラー */
    background: #FFF5F7; /* ほんのりピンク背景 */
    border-radius: 8px; 
    border: 1px dashed var(--col-pink); /* ピンクの点線枠 */
    font-weight: 500;
}

/* Color Layout */
.sub-label {
    font-size: 0.9rem; color: var(--col-gray); margin-bottom: 5px; margin-top: 10px;
}

/* Grid & Palette */
.grid-options {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 15px;
}
.grid-options.small { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
.option-card {
    border: 2px solid #eee; border-radius: 10px; padding: 10px;
    text-align: center; cursor: pointer; transition: 0.2s;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #fff;
}
.option-card:hover { border-color: var(--col-pink); }
.option-card.selected { border-color: var(--col-pink); background: #FFF5F7; }
.option-name { font-size: 0.75rem; margin-top: 5px; }

.color-palette { display: flex; flex-wrap: wrap; gap: 10px; }
/* ★修正: カラーパレットの丸の設定 (文字を中央配置＆白フチ追加) */
.color-swatch {
    width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
    border: 2px solid #eee; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-size: 100% 100%; 
    
    /* ▼ここから下を追加・変更▼ */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.65); /* 濃すぎない黒で馴染ませる */
    /* 背景色に文字が沈まないように、文字の周りに白いぼかしフチをつける */
    text-shadow: 
        1px 1px 0px rgba(255,255,255,0.8), 
       -1px -1px 0px rgba(255,255,255,0.8), 
        1px -1px 0px rgba(255,255,255,0.8), 
       -1px 1px 0px rgba(255,255,255,0.8);
}
/* CSS側のチェック柄指定は念のためJSのバックアップとして残すが、JSで上書きされる */
.color-swatch[data-pattern="check"] {
    background-color: white;
}
.color-swatch.selected { border: 3px solid var(--col-text); transform: scale(1.1); }
.color-palette.small .color-swatch { width: 30px; height: 30px; }

/* Accordion */
.accordion-item { border: 1px solid #eee; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.accordion-header {
    background: #f9f9f9; padding: 15px; cursor: pointer;
    font-weight: bold; display: flex; justify-content: space-between; align-items: center;
}
.accordion-header:hover { background: #f0f0f0; }
.accordion-item.open .accordion-header i { transform: rotate(180deg); }
.accordion-content { display: none; padding: 15px; background: white; }
.accordion-item.open .accordion-content { display: block; }

/* Embroidery Controls */
.emb-type-selector, .thread-tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.type-btn, .thread-tab {
    font-family: var(--font-dot);
    flex: 1; padding: 10px; border: 1px solid #ddd;
    background: white; border-radius: 8px;
    font-weight: bold; color: var(--col-gray);
}
/* 「大きめ文字 / ワンポイント」が選択された時はピンク */
.type-btn.active {
    background: var(--col-pink); 
    color: white; 
    border-color: var(--col-pink);
}

/* 「グロス / マット」が選択された時 */
.thread-tab.active {
    background: var(--col-yellow); 
    color: white; 
    border-color: var(--col-yellow);
}
.input-group { margin-bottom: 25px; }
.input-group label { display: block; font-weight: bold; margin-bottom: 8px; font-size: 0.95rem; }
.label-with-help { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.label-with-help label { margin-bottom: 0; }
.help-btn {
    background: none; color: var(--col-yellow); font-size: 1.2rem; padding: 0;
}
.help-popup {
    background: #FFFEF0; border: 1px solid var(--col-yellow);
    padding: 10px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 15px;
}
input[type="text"] {
    width: 100%; padding: 12px; border: 2px solid #ddd;
    border-radius: 8px; font-size: 1rem;
}
.font-options { display: flex; flex-wrap: wrap; gap: 8px; }
.font-btn {
    padding: 8px 12px; border: 1px solid #ddd; background: white;
    border-radius: 6px; cursor: pointer;
}
.font-btn.active { border-color: var(--col-pink); background: #FFF5F7; color: var(--col-pink); }

/* Save Slots (Ticket Style) */
.save-note-box {
    margin-bottom: 20px;
    font-size: 0.9rem; color: var(--col-text);
    line-height: 1.6;
}
.sub-note { font-size: 0.8rem; color: #888; margin-top: 5px; }
.btn-save-main {
    font-family: var(--font-dot);
    width: 100%; padding: 12px; 
    background: var(--col-pink); color: white; font-weight: bold;
    border-radius: 30px; margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(244, 143, 177, 0.4);
    transition: transform 0.2s;
}
.btn-save-main:hover { transform: scale(1.02); }

.slots-list { display: flex; flex-direction: column; gap: 15px; margin-top: 10px; }
.slot-card {
    display: flex; flex-direction: row; 
    /* 浮いている角丸デザイン */
    background: white; border-radius: 12px; overflow: hidden; align-items: center;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); border: 1px solid #eee;
}
.slot-thumb { width: 70px; height: 70px; border-radius: 8px; background: #eee; object-fit: cover; }
.slot-info { padding: 5px 10px; font-size: 0.8rem; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.slot-item-name { font-weight: bold; margin-bottom: 2px; font-size: 0.85rem; color: var(--col-pink); }
.slot-color-info { color: #555; font-size: 0.75rem; margin-bottom: 2px; }
.slot-date { font-size: 0.7rem; color: #999; }

.slot-actions { 
    display: flex; flex-direction: row; width: auto; gap: 5px; margin-left: 5px;
}
.slot-btn { 
    width: 35px; height: 35px; padding: 0; 
    display: flex; align-items: center; justify-content: center; 
    border-radius: 50%; color: white;
    font-size: 0.9rem; border: none;
}
.slot-btn.load { background: var(--col-blue); box-shadow: 0 2px 5px rgba(127,168,245,0.3); }
.slot-btn.del { background: var(--col-yellow); box-shadow: 0 2px 5px rgba(255,217,102,0.3); }

/* Order Summary */
.order-info-box {
    background: white;
    border-radius: 12px; /* COLOR枠と同じ角丸 */
    padding: 15px;       /* COLOR枠と同じ余白 */
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* COLOR枠と同じ淡い影 */
    border: 1px solid #eee; /* COLOR枠と同じ薄いグレーの線 */
}
.order-info-box h4 { 
    margin-bottom: 15px; 
    color: var(--col-text); /* ミントから通常の文字色にしてよりシンプルに */
    font-size: 1.05rem; 
    font-family: var(--font-dot); 
    text-align: center; 
}

/* 追加：項目名のデザイン（小さめのグレー） */
.order-label {
    display: block;
    font-size: 0.85rem;
    color: var(--col-gray);
    margin-bottom: 2px;
}

/* 追加：選択内容のデザイン（大きめ・太字・ピンク） */
.order-val {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--col-pink);
    margin-bottom: 15px;
    border-bottom: 1px dashed var(--col-gray); /* 項目ごとに薄い線を引く */
    padding-bottom: 10px;
}
/* 一番最後の項目は下線と余白をなくす */
.order-val:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

/* ★変更：上の枠と全く同じシンプルな設定に統一 */
.order-summary-box {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}

/* ★変更：見出しも上と同じ、通常カラーで中央寄せ */
.order-summary-box h4 { 
    margin-bottom: 15px; 
    color: var(--col-text); 
    font-size: 1.05rem; 
    font-family: var(--font-dot); 
    text-align: center;
}

/* ★変更：外枠が白になったので、テキスト部分は薄いグレーにして区別する */
.summary-details {
    background: #f9f9f9; 
    border: 1px solid #f0f0f0; /* 薄い線を足して分かりやすく */
    padding: 15px; 
    border-radius: 8px;
    font-size: 0.9rem; 
    line-height: 1.8; 
    margin-bottom: 15px;
    white-space: pre-wrap; 
    font-family: monospace;
}

.btn-copy {
    font-family: var(--font-dot);
    width: 100%; 
    padding: 12px; 
    background: var(--col-pink); /* ピンク色に変更 */
    color: white; 
    font-weight: bold;
    border-radius: 30px; /* 角を丸く */
    box-shadow: 0 4px 10px rgba(244, 143, 177, 0.4); /* ピンクのふんわり影 */
    transition: transform 0.2s; /* アニメーションの設定 */
    border: none;
    cursor: pointer;
}

/* ホバー（タップ）した時の動きを追加 */
.btn-copy:hover {
    transform: scale(1.02); /* 少しだけ大きくなる */
}

.order-section { margin-top: 30px; }

/* ★追加：Online Shop の見出しをトップページ風の筆記体に */
.shop-title-en {
    font-family: var(--font-en);
    font-size: 1.6rem;
    color: var(--col-text);
    text-align: center;
    font-weight: normal;
    margin-bottom: 5px;
}

/* ★追加：説明文 */
.shop-desc-text {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}
/* ★変更：商品名も中央寄せに */
.current-item-name {
    font-weight: bold; color: var(--col-pink); margin-bottom: 10px; font-size: 1rem;
    text-align: center; 
}

/* ★変更：ボタン群を中央寄せに */
.link-buttons { 
    display: flex; gap: 10px; flex-wrap: nowrap; justify-content: center; margin-bottom: 20px; 
}

/* ★変更：トップページのライトグレーボタンと全く同じデザインに */
.shop-link-btn {
    font-family: var(--font-dot);
    background-color: #eee;
    color: var(--col-text);
    min-width: 0;
    width: 110px;
    padding: 12px 5px;
    text-align: center;
    border-radius: 30px;
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, opacity 0.3s;
}

/* ★追加：ホバー時の浮き上がる動き */
.shop-link-btn:hover {
    transform: translateY(-2px);
    opacity: 0.7;
}
/* ↓ 変更後 ↓ */
.url-share-box {
    margin-bottom: 30px; /* 下のOnline Shopとの間に少し余白を取る */
}
.url-share-box label { 
    display: block;
    font-size: 1.05rem; /* ★他の見出しとサイズを合わせる */
    font-weight: bold;  /* ★太字にする設定を追加 */
    font-family: var(--font-dot); 
    text-align: center; 
    color: var(--col-text);
}
.url-input-wrap { 
    display: flex; 
    gap: 5px; 
    margin-top: 10px; 
    justify-content: center; /* ★入力欄とボタンも中央に配置 */
}
#share-url { 
    background: #f9f9f9; 
    color: #666; 
    padding: 10px; 
    font-size: 0.8rem; 
    border: 1px solid #eee; /* 薄い枠線をつけて綺麗に */
    border-radius: 5px;
    width: 100%;
    max-width: 300px; /* 横に広がりすぎないように制限 */
}
#copy-url-btn { 
    width: 45px; 
    background: #eee; 
    color: var(--col-text);
    border-radius: 5px; 
    transition: 0.2s;
    border: none;
    cursor: pointer;
}
#copy-url-btn:hover {
    background: #ddd;
}

/* =========================================
   Stitch Mode UI (New)
   ========================================= */

/* モード切替タブ */
.stitch-mode-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
}
.mode-btn {
    font-family: var(--font-dot);
    flex: 1;
    padding: 10px 5px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.2;
    transition: 0.2s;
}
/* ↓ 変更後（ボタンごとに色分け） ↓ */

/* アクティブ時の共通設定 */
.mode-btn.active {
    font-weight: bold;
    color: white; /* 基本は白文字 */
}

/* 1. なし（ミントグリーン） */
.mode-btn[data-mode="none"].active {
    background: var(--col-mint);
    border-color: var(--col-mint);
    box-shadow: 0 2px 5px rgba(126, 209, 194, 0.4);
}

/* 2. きほんのシンプル（ピンク） */
.mode-btn[data-mode="simple"].active {
    background: var(--col-pink);
    border-color: var(--col-pink);
    box-shadow: 0 2px 5px rgba(244, 143, 177, 0.4);
}

/* 3. こだわりカスタム（イエロー） */
.mode-btn[data-mode="custom"].active {
    background: var(--col-yellow);
    border-color: var(--col-yellow);
    box-shadow: 0 2px 5px rgba(255, 217, 102, 0.4);
}

/* 4. たからものアート（ブルー） */
.mode-btn[data-mode="art"].active {
    background: var(--col-blue);
    border-color: var(--col-blue);
    box-shadow: 0 2px 5px rgba(127, 168, 245, 0.4);
}
/* パネル */
.stitch-panel {
    animation: fadeIn 0.3s ease;
}
.panel-msg {
    text-align: center;
    color: #888;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    font-size: 0.9rem;
}
.panel-msg.small {
    font-size: 0.8rem;
    padding: 10px;
    margin-bottom: 15px;
}

/* カスタムブロック */
.custom-block {
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 15px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}
.block-header {
    background: #fcfcfc;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}
.block-title {
    font-weight: bold;
    font-size: 0.95rem;
    flex: 1;
    color: var(--col-text);
}
.block-content {
    padding: 15px;
    transition: 0.3s;
}
/* 無効化状態 */
.block-content.disabled {
    opacity: 0.4;
    pointer-events: none;
    background: #f5f5f5;
}

/* トグルスイッチ */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.toggle-switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--col-mint);
}
input:checked + .slider:before {
    transform: translateX(18px);
}

/* 十字キー (D-Pad) */
.d-pad {
    display: grid;
    grid-template-areas: 
        ". up ."
        "left . right"
        ". down .";
    gap: 4px; /* ボタン同士の隙間を広げる */
    width: 90px; /* 全体を60pxから90pxに拡大 */
    height: 90px;
}
.d-btn {
    width: 28px; /* ボタンサイズを20pxから28pxに拡大 */
    height: 28px;
    background: var(--col-blue);
    color: #fff;
    border-radius: 5px; /* 角の丸みも少し大きく */
    padding: 0;
    font-size: 0.9rem; /* 矢印アイコンを大きく */
    display: flex;
    align-items: center;
    justify-content: center;
}
.d-btn:active { background: var(--col-blue); color: white; }
.d-btn.up { grid-area: up; }
.d-btn.down { grid-area: down; }
.d-btn.left { grid-area: left; }
.d-btn.right { grid-area: right; }

.mini-label {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin: 10px 0 5px;
}

/* style.css の末尾に追加・修正 */

/* ヘルプ（？ボタン）機能 */
.label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.label-row label {
    margin-bottom: 0;
}
.help-trigger {
    background: #eee;
    color: #888;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.help-trigger:hover {
    background: var(--col-yellow);
    color: white;
}
.help-content {
    display: none; /* デフォルト非表示 */
    background: #fffff0;
    border: 1px dashed var(--col-yellow);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}
.help-content.open {
    display: block;
}

/* カスタムブロックの制御（OFF時はヘッダー以外隠す） */
.custom-block.inactive .d-pad {
    display: none !important; /* OFF時は矢印キーを隠す */
}
.custom-block.inactive .block-content {
    display: none; /* OFF時は中身を隠す */
}

/* style.css の末尾に追加 */

textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical; /* 縦方向のみリサイズ可 */
    line-height: 1.5;
}
textarea:focus {
    outline: none;
    border-color: var(--col-pink);
}

/* ★追加: ITEMタブのサムネイル画像用スタイル */
.item-thumb {
    width: 80%;
    max-width: 80px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin-bottom: 5px;
}
/* アイコンのフォールバック用（画像がない時だけ表示される） */
.fallback-icon {
    margin-bottom: 5px;
}

/* ★追加: COLORタブの枠と説明文のデザイン */
.color-section-box {
    background: white;
    border-radius: 12px; /* HOW TOタブ(step-card)と角丸を統一 */
    padding: 15px;       /* 余白を統一 */
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* 淡い影を統一 */
    border: 1px solid #eee; /* ピンクの点線をやめ、薄いグレーの枠線に統一 */
}

/* 1つ目（メインカラー）の枠：イエローの影と枠線、薄イエロー背景 */
#tab-color .color-section-box:nth-of-type(1) {
    box-shadow: 0 4px 12px rgba(255, 217, 102, 0.25); /* テーマカラーのイエローの影 */
    border-color: rgba(255, 217, 102, 0.4); /* イエローの枠線 */
    background-color: #fffdf5; /* かなり薄いパステルイエロー */
}

/* 2つ目（サブカラー）の枠：ブルーの影と枠線、薄ブルー背景 */
#tab-color .color-section-box:nth-of-type(2) {
    box-shadow: 0 4px 12px rgba(127, 168, 245, 0.25); /* テーマカラーのブルーの影 */
    border-color: rgba(127, 168, 245, 0.4); /* ブルーの枠線 */
    background-color: #F5F8FF; /* かなり薄いパステルブルー */
}

.color-desc {
    font-size: 0.8rem; /* 元の0.85remから少し小さく */
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
    
    /* 以前の背景色や左の線をリセット */
    background: none;
    border: none;
    padding: 0;
    
    /* 波線の装飾のみを適用 */
    text-decoration: underline;
    text-decoration-style: wavy;
    text-decoration-color: #F48FB1; /* 悪目立ちしない控えめなグレー */
    text-underline-offset: 4px;
}

/* =========================================
   Mobile App Layout (Flexbox完全積み上げ型)
   ========================================= */
@media (max-width: 767px) {
    /* 1. 画面全体を固定サイズの箱にする */
    body {
        position: fixed; /* ★復活: 画面全体を固定して、強引な押し上げを防ぐ */
        top: 0; left: 0;
        width: 100%;
        padding-top: 0; 
        height: 100dvh; 
        display: flex;
        flex-direction: column; 
        overflow: hidden; 
    }

    /* ★追加: ハンバーガーメニューがヘッダーと一緒に動くように変更 */
    .hamburger {
        position: absolute; 
    }

    /* 2. ヘッダー (1番目の積み木) */
    .header {
        position: relative; 
        flex: 0 0 var(--header-height); 
    }

    /* 3. メインエリア (2番目の積み木、残りの高さをすべて使う) */
    .main-container { 
        flex: 1; /* ヘッダー以外の残りの空間をすべて埋める */
        display: flex;
        flex-direction: column; 
        justify-content: flex-start; /* PC用の中央寄せを上書きし、上から詰める */
        align-items: stretch; 
        margin: 0; 
        padding: 0; 
        gap: 0;
        width: 100%; 
        max-width: none; 
        min-height: 0; /* ★重要: 中身が溢れてもコンテナが伸びないようにする */
    }

    /* 4. プレビューエリア (メインの中の1番目) */
    .preview-wrapper {
        position: relative; 
        top: 0; /* PC用の sticky 90px をリセット */
        flex: 0 0 var(--mobile-preview-height); 
        height: var(--mobile-preview-height); 
        width: 100%; 
        max-width: 100%; /* ★追加: PC用の500px制限を上書きして横幅いっぱいに */
        padding: 5px 0; 
        background: #ffffff; 
        border-bottom: none;
        z-index: 1;
        display: flex; align-items: center; justify-content: center;
        overflow: hidden;
    }

    .preview-area { 
        height: 100%; width: 100%; 
        aspect-ratio: unset; border-radius: 0;
        box-shadow: none; border: none; background: transparent; 
        margin: 0; padding: 0;
    }

    #svg-container { width: 100%; height: 100%; }
    #svg-container svg { width: auto; height: 100%; max-width: 100%; margin: 0 auto; }
    
    /* 5. 操作エリア (メインの中の2番目、残りをすべて使う) */
    .controls-container {
        flex: 1; 
        width: 100%; 
        max-width: 100%; /* ★追加: PC用の600px制限を上書きして横幅いっぱいに */
        padding: 0; margin: 0;
        /* ★変更: メニュー部分を透かせるため、コンテナ自体の白背景と角丸をなくす */
        background: transparent; 
        border-radius: 0;
        box-shadow: none;
        display: flex; flex-direction: column;
        min-height: 0; 
        position: relative; z-index: 5;
    }

    /* 操作エリアのタブ(固定) */
    .tab-sticky-wrapper {
        flex: 0 0 auto; position: relative; 
        margin: 0; padding: 10px 0; 
        /* ★変更: 完全な白から半透明にしてギンガムチェックを透かす */
        /* 透明度はお好みで変更してください (0.0が完全透明、1.0が真っ白) */
        background: rgba(255, 255, 255, 0.4); 
        border-top: none;
        border-bottom: 2px dashed var(--col-pink);
        z-index: 10; padding-right: 25px; 
    }

    /* ★変更: タブを中央寄せにする (flex-start -> center) */
    .tabs { justify-content: center; gap: 0; padding: 0 5px; }
    
    .tab-btn { 
        flex: 0 0 auto; width: auto; padding: 5px 12px; 
        background: transparent; border-radius: 0; margin-bottom: 0;
        color: var(--col-gray); font-size: 0.95rem; 
    }
    .tab-btn.active {
        background: transparent; color: var(--col-pink);
        text-decoration: underline wavy var(--col-pink);
        text-underline-offset: 4px; box-shadow: none;
    }
    
    @keyframes blinkFloat {
        0% { opacity: 0.5; transform: translateY(-50%) translateX(0); }
        50% { opacity: 1; transform: translateY(-50%) translateX(3px); }
        100% { opacity: 0.5; transform: translateY(-50%) translateX(0); }
    }
    .scroll-hint { 
        display: none; 
        position: absolute; 
        top: 50%; 
        color: var(--col-pink);
        font-size: 1.1rem;
        z-index: 20;
        pointer-events: none; 
        background: rgba(255, 255, 255, 0.8); 
        width: 24px;
        height: 24px;
        border-radius: 50%;
    }
    .scroll-hint.visible {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .scroll-hint.left-hint {
        left: 2px;
        animation: floatLeft 1.5s infinite ease-in-out;
    }
    .scroll-hint.right-hint {
        right: 2px;
        animation: floatRight 1.5s infinite ease-in-out;
    }
    
    /* 6. スクロールするコンテンツ部分 */
    .tab-content { 
        flex: 1; 
        overflow-y: auto; 
        -webkit-overflow-scrolling: touch; 
        padding: 20px; 
        padding-bottom: 40px; 
        /* ★変更: コンテンツ部分は白背景にして、上部に角丸と影をつける */
        background: #ffffff; 
        border-radius: 0; 
        box-shadow: 0 -2px 10px rgba(0,0,0,0.03); 
        position: relative; z-index: 4; 
    }
    
    .option-card, .save-slot, .slot-card, .order-summary-box, .input-group, .howto-box, .step-card, .order-info-box {
        background: white; 
    }
    
    input[type="text"], textarea { 
        font-size: 16px; /* iOSズーム防止 */
        background: white; 
    }
    
    .color-section-box {
        padding: 15px;
    }

    /* -------------------------------------
       スマホ用のHOW TOボタンとタブの制御を追加
       ------------------------------------- */
    /* HOW TOタブを非表示にする */
    .tab-btn[data-tab="tab-howto"],
    #tab-howto {
        display: none !important;
    }

    /* スマホ用HOW TO（？）ボタンを表示 */
    #howto-btn-mobile {
        display: flex !important; /* PC側のnoneを上書き */
        bottom: 80px; /* カメラボタン(20px)の上に配置するため上にズラす */
        background: var(--col-mint); /* カメラと色を変える */
    }

    /* =========================================
       スマホ用セーブスロットのレイアウト変更 (3列グリッド)
       ========================================= */
    .slots-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr); /* 1行に3つ並べる */
        gap: 10px; /* カード同士の隙間 */
    }
    
    .slot-card {
        flex-direction: column; /* 画像とボタンを縦並びに */
        align-items: center;
        padding: 8px; /* スマホ用に余白を少し調整 */
    }
    
    /* ★文字情報はスマホでは隠す */
    .slot-info {
        display: none !important;
    }
    
    /* サムネイル画像をカード幅いっぱいの正方形にする */
    .slot-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1; 
        margin-bottom: 8px; 
    }
    
    /* アクションボタンの並びを調整 */
    .slot-actions {
        width: 100%;
        margin-left: 0;
        justify-content: center;
        gap: 8px;
    }
    
    /* ボタンが綺麗に2つ並ぶようにサイズ調整 */
    .slot-btn {
        flex: none; /* 横伸びを解除 */
        width: 32px; /* 幅を固定 */
        height: 32px; /* 高さを固定 */
        border-radius: 50%; /* まん丸にする */
        font-size: 0.9rem;
    }

    /* =========================================
       スマホ用 ITEMタブのグリッド調整
       ========================================= */
    /* 4つのもの（通常サイズ）: 1行に4つ並べる */
    .grid-options {
        grid-template-columns: repeat(4, 1fr); /* 4等分にする */
        gap: 8px; /* スマホ画面に合わせて隙間を少し狭める */
    }
    
    /* 3つのもの（ハンカチなど）: 1行に3つ並べる */
    /* ※HTML側でハンカチの親枠（grid-options）に .col-3 というクラスを追加する必要があります */
    .grid-options.col-3 {
        grid-template-columns: repeat(3, 1fr); /* 3等分にする */
    }
    
    /* カード内の文字サイズや余白をスマホ用に最適化 */
    .option-card {
        padding: 8px 5px;
    }
    .option-name {
        font-size: 0.7rem; 
        line-height: 1.3; /* 2行になった時も読みやすい行間に */
    }
    
    /* ITEMタブのアイテム名だけは、単語の途中で改行させない */
    .item-card .option-name {
        word-break: keep-all; 
    }
    
    /* STITCHタブのモチーフ名などは枠に合わせて自然に改行させる */
    .motif-card .option-name,
    .art-card .option-name {
        word-break: normal;
        white-space: normal;
    }
}