/* --- お問い合わせページ全体：色と形をハッキリさせる --- */

/* 1. 全体の背景色（変数が効かない場合を想定して具体的に指定） */
:root {
    --accent-blue: #74c0fc;
    --accent-pink: #ff8787;
    --accent-yellow: #ffec99;
    --text-main: #343a40;
    --shadow-pop: 8px 8px 0px #343a40;
}

.form-wrapper {
    max-width: 900px;
    margin: 60px auto;
    padding: 20px;
}

/* 2. タイトルをポップに */
.form-page-title {
    font-size: 4rem;
    font-weight: 900;
    text-align: center;
    color: var(--text-main);
    margin-bottom: 50px;
    text-shadow: 4px 4px 0px var(--accent-blue); /* 青い影をハッキリ出す */
}

/* --- イントロ文：マステで貼ったメッセージ風 --- */
.form-intro {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 60px; /* 下のカードとの距離をしっかりあける */
    padding: 25px 40px;
    
    /* 背景を薄い黄色にして、手書きメモっぽく */
    background: #fffdf0; 
    border: 2px solid var(--text-main);
    border-radius: 15px;
    
    /* フォントの設定 */
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.8;
    color: var(--text-main);
    
    /* 影と傾きで「置いてある感」を出す */
    box-shadow: 6px 6px 0px rgba(0,0,0,0.05);
    transform: rotate(-1.5deg); /* 絶妙な傾き */
    
    position: relative;
    z-index: 1;
}

/* マスキングテープの装飾（一癖！） */
.form-intro::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%) rotate(2deg);
    width: 120px;
    height: 35px;
    /* 半透明のピンク（マステっぽい色） */
    background: rgba(255, 135, 135, 0.5); 
    box-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

/* --- ホームへ戻る：ぷかぷか看板ボタン --- */
.back-to-home {
    margin-bottom: 40px;
    display: inline-block;
    position: relative;
    z-index: 100;
}

.back-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    background: #fff;
    color: var(--text-main);
    font-weight: 900;
    font-size: 1rem;
    
    /* 太枠とポップな影 */
    border: 3px solid var(--text-main);
    border-radius: 50px;
    box-shadow: 6px 6px 0px var(--accent-blue);
    
    /* 最初の角度を少し傾ける */
    transform: rotate(-3deg);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 矢印（アイコン）の演出 */
.back-link .arrow {
    display: inline-block;
    font-size: 1.4rem;
    transition: transform 0.3s ease;
}

/* 矢印を「←」に変更（HTMLに書いてなければCSSで追加） */
.back-link .arrow::before {
    content: '←';
}

/* ホバー：看板が起き上がって、色がピンクに！ */
.back-link:hover {
    transform: rotate(0deg) scale(1.1);
    background: var(--accent-pink);
    color: #fff;
    box-shadow: 10px 10px 0px var(--text-main);
}

/* ホバー：矢印が「こっちこっち！」と手招きするアニメーション */
.back-link:hover .arrow {
    animation: beckon 0.6s infinite alternate ease-in-out;
}

@keyframes beckon {
    0% { transform: translateX(0); }
    100% { transform: translateX(-8px); } /* 左にピョコピョコ動く */
}

/* 3. テーブル構造を「カード」に組み替える */
.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 30px; /* カード同士の間隔を広げる */
}

.custom-table tr {
    display: table-row;
    background: #fff;
    border: 3px solid var(--text-main);
    box-shadow: 12px 12px 0px var(--text-main);
    border-radius: 40px;
}

/* 4. 項目（th）を消さない！ハッキリ表示 */
.custom-table th {
    padding: 40px 20px 40px 40px; /* 左側に大きな余白 */
    width: 250px;
    background: #fdfdfd;
    border-radius: 40px 0 0 40px;
    border-right: 3px dashed #eee; /* 境界線を優しく */
    vertical-align: middle;
}

/* 必須マーク */
.custom-table th sup {
    color: var(--accent-pink);
    font-size: 1.2rem;
    margin-left: 5px;
}

/* 5. 入力エリア（td） */
.custom-table td {
    padding: 30px 40px; /* 上下左右にしっかり余白を確保 */
    border-radius: 0 40px 40px 0;
    vertical-align: middle;
    /* はみ出しを物理的に許さない */
    width: auto; 
    overflow: hidden; 
}

/* 6. 入力フォーム自体の色と形 */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    display: block;
    /* width: 100% にしても box-sizing: border-box があるのでハミ出しません */
    width: 100%; 
    padding: 18px;
    border: 3px solid var(--text-main);
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    background: #fff;
    /* 横方向の余裕を確実に作る */
    margin: 0; 
}

/* --- エラー時の演出：枠を赤くしてプルプルさせる --- */
input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown),
input.error-active, 
textarea.error-active {
    border-color: var(--accent-pink) !important;
    background-color: #fffafa !important; /* ほんのり赤っぽい背景 */
    box-shadow: 0 0 10px rgba(255, 135, 135, 0.3) !important; /* ぼんやり光らせる */
    animation: shake 0.5s ease-in-out !important; /* プルプルさせる */
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

input.error-active:focus, 
textarea.error-active:focus {
    box-shadow: none !important;
}

/* 3. プルプル震えるアニメーション（すでにあれば不要ですが念のため） */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* 4. エラー文言の微調整 */
.error {
    color: var(--accent-pink) !important;
    font-size: 0.9rem;
    font-weight: 900;
    margin-top: 8px;
    display: block; /* 確実に改行して表示 */
}

/* 入力中に「一癖」色を変える */
input:focus, textarea:focus {
    outline: none;
    background: #fffef0; /* ほんのり黄色 */
    box-shadow: 5px 5px 0px var(--accent-yellow);
    transform: scale(1.02);
}

/* 7. 送信ボタン（絶対に目立つ黄色！） */
.fuwafuwa-btn {
    display: block;
    margin: 50px auto;
    padding: 25px 80px;
    background: var(--accent-yellow) !important; /* 強制的に黄色 */
    color: var(--text-main);
    font-size: 1.8rem;
    font-weight: 900;
    border: 4px solid var(--text-main);
    border-radius: 100px;
    box-shadow: 0px 10px 0px var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.fuwafuwa-btn:hover {
    background: var(--accent-pink) !important; /* ホバーでピンク */
    color: #fff;
    transform: translateY(-5px);
    box-shadow: 0px 15px 0px var(--text-main);
}

/* 8. エラー文言 */
.error {
    color: var(--accent-pink);
    font-weight: bold;
    margin-top: 10px;
}

/* スマホ対応 */
@media (max-width: 768px) {
    .custom-table th, .custom-table td {
        display: block;
        width: 100%;
        border-radius: 0;
        text-align: left;
    }
    .custom-table th {
        border-right: none;
        border-bottom: 3px dashed var(--text-main);
        padding: 20px;
    }
}

/* スマホ対応：さらに安全に */
@media (max-width: 768px) {
    .custom-table th, .custom-table td {
        display: block;
        width: 100%;
        padding: 20px !important; /* スマホでは余白を少し詰める */
    }
}

/* --- 最終兵器：はみ出し粉砕＆強制適用 --- */

/* 1. すべての要素のサイズ計算を「内側基準」に強制（これが無いとはみ出します） */
*, *::before, *::after {
    box-sizing: border-box !important;
}

/* 2. カードの横幅を固定ではなく「最大幅」にする */
.custom-table tr {
    display: flex !important; /* table-rowをやめてflexにすると制御しやすくなります */
    flex-direction: row;
    background: #fff !important;
    border: 3px solid var(--text-main) !important;
    box-shadow: 12px 12px 0px var(--text-main) !important;
    border-radius: 40px !important;
    margin-bottom: 30px;
    width: 100% !important;
    overflow: hidden;
}

/* 3. 項目の幅を固定 */
.custom-table th {
    flex: 0 0 220px !important; /* 幅を220pxで固定 */
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #fdfdfd !important;
    border-right: 3px dashed #eee !important;
    padding: 20px !important;
    margin: 0 !important;
}

/* 4. 入力エリアを「残りの幅全部」にする */
.custom-table td {
    flex: 1 !important; /* 残りのスペースを埋める */
    display: block !important;
    padding: 30px !important;
    background: #fff !important;
    margin: 0 !important;
}

/* 5. 入力欄が絶対にはみ出さない設定 */
.custom-table input, 
.custom-table textarea {
    width: 100% !important;
    max-width: 100% !important; /* 念押し */
    box-sizing: border-box !important;
}

/* スマホでは縦並びに強制チェンジ */
@media (max-width: 768px) {
    .custom-table tr {
        flex-direction: column !important;
    }
    .custom-table th {
        flex: 1 1 auto !important;
        width: 100% !important;
        border-right: none !important;
        border-bottom: 3px dashed #eee !important;
    }
}

/* スマホでは傾きをゆるめる */
@media (max-width: 600px) {
    .form-intro {
        font-size: 0.95rem;
        padding: 20px;
        transform: rotate(0deg);
        width: 90%;
    }
    .form-intro::before {
        width: 80px;
    }
}

/* スマホ対応 */
@media (max-width: 600px) {
    .back-to-home {
        margin-bottom: 30px;
    }
    .back-link {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}
