@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@500;700;900&display=swap');

body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background: radial-gradient(#ffd1dc 10%, transparent 11%), radial-gradient(#ffd1dc 10%, transparent 11%), #fff5f7;
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    color: #4a4a4a;
    margin: 0;
    padding: 20px;
    
    /* 🌟 ここを修正！縦に並べて中央に寄せる設定 */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 15px 35px rgba(255, 182, 193, 0.3);
    padding: 30px;
    max-width: 850px;
    width: 100%;
    border: 3px solid #ffe4e1;
    box-sizing: border-box;
}

.header-area { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
h1 { color: #ff6b81; font-size: 26px; margin: 0; text-shadow: 2px 2px 0px #ffe4e1; }
.btn-help { background: #fff; border: 2px solid #ffb6c1; color: #ff6b81; padding: 8px 15px; border-radius: 50px; font-weight: bold; cursor: pointer; }

/* プレビューエリアの外枠 */
.preview-box {
    background: #fff;
    border: 4px dashed #ffb6c1;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: inset 0 0 15px rgba(255, 182, 193, 0.2);
    
    /* 🌟 ここがポイント：横にはみ出た時にスクロールさせる */
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;

    /* 🌟 スムーズなスクロール（スマホ用） */
    -webkit-overflow-scrolling: touch;
}

/* プレビューの入力欄本体 */
.preview-input {
    /* 🌟 横幅を固定せず、中身の長さに合わせる */
    width: max-content;
    min-width: 100%;
    
    font-size: 38px; /* 文字サイズはしっかり大きくキープ！ */
    font-weight: 900;
    text-align: center;
    border: none;
    background: transparent;
    color: #ff4757;
    font-family: inherit;
    margin-bottom: 15px;
    outline: none;

    /* 🌟 折り返さないように設定 */
    white-space: nowrap;
    
    padding: 10px 20px;
}

/* 🌟 スクロールバーを可愛くする（Chrome, Safari用） */
.preview-box::-webkit-scrollbar {
    height: 8px;
}
.preview-box::-webkit-scrollbar-track {
    background: #fff5f7;
    border-radius: 10px;
}
.preview-box::-webkit-scrollbar-thumb {
    background: #ffb6c1;
    border-radius: 10px;
}
.preview-box::-webkit-scrollbar-thumb:hover {
    background: #ff6b81;
}
.action-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.btn { border: none; padding: 12px 18px; border-radius: 50px; cursor: pointer; font-size: 14px; font-weight: bold; color: white; box-shadow: 0 4px 0 rgba(0,0,0,0.1); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.1); }
.btn-update { background: #7bed9f; color: #2f3542; }
.btn-copy { background: #ff6b81; }
.btn-share { background: #1e90ff; }
.btn-reset { background: #a4b0be; }
.btn-primary { background: #70a1ff; width: 100%; font-size: 16px; padding: 15px;}

.section-title { border-bottom: 3px solid #ffe4e1; padding-bottom: 10px; margin-top: 30px; color: #ff6b81; font-size: 18px; display: flex; justify-content: space-between; align-items: center; }
.sync-toggle { font-size: 13px; cursor: pointer; background: #eccc68; color: #fff; padding: 6px 12px; border-radius: 50px; font-weight: bold; box-shadow: 0 3px 0 #d4a73e; }
.random-sync { background: #ff7f50; box-shadow: 0 3px 0 #cd5b45; }

.control-grid { display: flex; gap: 15px; background: #fff; padding: 20px; border-radius: 15px; border: 2px solid #f1f2f6; }
.part-column { flex: 1; min-width: 0; background: #f8f9fa; padding: 15px; border-radius: 15px; }
.center-col { background: #fff0f5; border: 2px dashed #ffb6c1; }
.part-column h3 { text-align: center; font-size: 15px; color: #ff6b81; margin-top: 0; margin-bottom: 15px; }
.input-group { display: flex; flex-direction: column; margin-bottom: 10px; }
.input-group label { font-size: 12px; font-weight: bold; color: #747d8c; margin-bottom: 3px; }
.input-group select { padding: 6px; border: 2px solid #dfe4ea; border-radius: 6px 6px 0 0; font-size: 14px; font-weight: bold; outline: none; }
.input-group input[type="text"] { padding: 8px; border: 2px solid #dfe4ea; border-top: none; border-radius: 0 0 6px 6px; font-size: 16px; text-align: center; outline: none; }

.flex-box { display: flex; gap: 10px; background: #f1f2f6; padding: 15px; border-radius: 15px; margin-top: 15px; align-items: center; }
.flex-box select, .flex-box button, .flex-box input { flex: 1; }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); backdrop-filter: blur(3px); }
.modal-content { background-color: #fff; margin: 15% auto; padding: 30px; border-radius: 20px; width: 85%; max-width: 400px; position: relative; }
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 24px; cursor: pointer; color: #aaa; }
/* ↓↓↓ ここを追加！テンプレとランダムの入力欄デザイン ↓↓↓ */
.flex-box select, .flex-box input {
    padding: 10px 15px;
    border: 2px solid #dfe4ea;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #2f3542;
    background-color: #fff;
    outline: none;
    font-family: inherit;
    transition: 0.2s;
}
.flex-box select:focus, .flex-box input:focus {
    border-color: #ff6b81;
    background-color: #fff5f7;
}
/* ↓↓↓ ここから下を style.css の最後に追加 ↓↓↓ */

/* ナビゲーション（ホームリンク） */
.nav-links {
    margin-bottom: 15px;
    text-align: left;
}
.home-link {
    display: inline-block;
    color: #ff6b81;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    background: #fff5f7;
    padding: 8px 15px;
    border-radius: 50px;
    border: 2px solid #ffb6c1;
    transition: 0.2s;
}
.home-link:hover {
    background: #ffb6c1;
    color: white;
}

/* トップへ戻るワープボタン */
#page-top-btn {
    position: fixed;
    bottom: -60px; /* 初期状態は画面外に隠す */
    right: 20px;
    background: #ff6b81;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}
#page-top-btn.show {
    bottom: 20px; /* クラスが付いたらシュッと出てくる */
}
#page-top-btn:hover {
    transform: translateY(-5px);
    background: #ff4757;
}

/* フッター・楽天アフィリエイト */
.footer-area {
    margin-top: 30px;
    text-align: center;
    width: 100%;
}
.affiliate-box {
    display: flex;
    justify-content: center;
    overflow: hidden; /* スマホではみ出さないようにガード */
    margin-bottom: 15px;
}
.copyright {
    color: #a4b0be;
    font-size: 13px;
    margin-bottom: 20px;
    font-weight: bold;
}
@media screen and (max-width: 768px) {
    .control-grid { flex-direction: column; }
    .part-column { width: 100%; margin-bottom: 10px; box-sizing: border-box;}
    .action-buttons { flex-direction: column; width: 100%; }
    .btn { width: 100%; box-sizing: border-box; }
    .header-area { flex-direction: column; gap: 10px; }
    .preview-input { font-size: 32px; }
    .flex-box { flex-direction: column; }
    .flex-box select, .flex-box button, .flex-box input { width: 100%; box-sizing: border-box; }
}
.section-title {
    margin-top: 30px;    /* 上のセクションとの間隔 */
    margin-bottom: 5px;  /* 下のボックスとの間隔を狭く！ */
    padding-bottom: 5px;
}

.flex-box {
    margin-top: 0px;     /* ボックス自体の上の余白をゼロに */
    padding: 15px;       /* 中の余白を少し調整 */
}

/* --- アクション・ランダム内のドロップダウン＆入力欄の見た目 --- */
.flex-box select, 
.flex-box input {
    width: 100%;
    padding: 12px;
    border: 2px solid #dfe4ea;
    border-radius: 10px;
    background-color: #fff;
    font-size: 15px;
    font-weight: bold;
    color: #2f3542;
    font-family: inherit;
    outline: none;
    box-sizing: border-box; /* はみ出し防止 */
    transition: 0.2s;
    appearance: none; /* ブラウザ標準の矢印をリセット（必要なら） */
    -webkit-appearance: none;
}

/* ドロップダウンに可愛い矢印を付ける（任意） */
.flex-box select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff6b81'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 35px;
}

.flex-box select:focus, 
.flex-box input:focus {
    border-color: #ff6b81;
    background-color: #fff5f7;
    box-shadow: 0 0 8px rgba(255, 107, 129, 0.2);
}

/* スマホで縦に並んだ時の間隔 */
@media screen and (max-width: 768px) {
    .flex-box {
        gap: 10px;
    }
}
h2.section-title {
    margin-top: 35px !important;    /* 上（カスタムエリア）との間隔 */
    margin-bottom: 0 !important;    /* 下（ボックス）との隙間をゼロに！ */
    padding-bottom: 8px !important; /* 下線の微調整 */
    line-height: 1 !important;      /* 行の高さを最小限に */
    display: flex;
    align-items: center;
    justify-content: flex-start;    /* 左寄せに固定 */
    gap: 10px;                      /* アイコンと文字の間隔 */
}

/* ボックス部分の余白を完全にリセット */
.flex-box.template-box, 
.flex-box.random-box {
    margin-top: 0 !important;       /* タイトルとの隙間を強制ゼロ */
    padding: 20px !important;       /* 中の余裕はキープ */
}
h2.section-title {
    display: flex;
    justify-content: space-between; /* 左右に要素がある時は離す（カスタム用） */
    align-items: center;
    margin-top: 30px !important;
    margin-bottom: 0 !important;   /* 下の隙間をゼロに */
    padding-bottom: 5px !important;
    height: auto !important;       /* 高さを自動に */
    min-height: 0 !important;      /* 余計な高さを出さない */
}

/* 🌟 アイコンと文字をくっつける設定 */
h2.section-title span {
    display: flex;
    align-items: center;
    gap: 8px; /* アイコンと文字の間の隙間 */
}

/* ボックス側の調整 */
.flex-box.template-box {
    margin-top: 5px !important;    /* タイトルの下線との微調整（お好みで0でもOK） */
}
