h1 {
    text-align: center;
    color: #444;
}

form {
    max-width: 600px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

input[type="text"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: #007BFF;
    outline: none;
}

button[type="submit"] {
    padding: 14px 24px;
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    background: linear-gradient(145deg, #4aa3ff, #0e6dfd);
    /* メタリック調の青グラデーション */
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    /* 浮き上がる感じに */
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 50px;
    margin-bottom: 30px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 95%;
    max-width: 330px;
    text-align: center;
}

button[type="submit"]:hover {
    background: linear-gradient(145deg, #0e6dfd, #4aa3ff);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.center-block {
    text-align: center;
    width: 100%;
    margin: 0 auto 30px auto;
}

#uploadFrameSection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.download-btn {
    padding: 10px;
    font-size: 16px;
    color: #fff;
    background-color: #0911afce;
    max-width: 230px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 90%;
    text-align: center;
}

.download-btn:hover {
    background-color: #0963c2;
}

.download-btn.disabled {
    background-color: #888;
    cursor: not-allowed;
    text-decoration: none;
}

#qrCodeContainer {
    display: none;
    text-align: center;
    margin-top: 20px;
}

#qrCodeImage {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.thumbnail {
    width: 100px;
    /* 横幅を固定 */
    height: auto;
    /* 縦横比を保持 */
    cursor: pointer;
    margin: 5px;
    /* フレーム間の余白 */
    border: 2px solid transparent;
    transition: transform 0.3s, border-color 0.3s;
    display: block;
    /* iOSで余計な隙間を防ぐ */
    object-fit: contain;
    /* 縦長表示を防ぐ */

}

.thumbnail.selected {
    border: 2px solid #007BFF;
    transform: scale(1.1);
}

#frameSelection {
    display: flex;
    justify-content: center;
    /* 中央揃え */
    flex-wrap: wrap;
    /* 自動的に折り返す */
    margin-bottom: 20px;
    gap: 10px;
    /* ボックス間のスペースを追加 */
    align-items: flex-start;
    /* 縦方向にアイテムを揃える */
}

/* iOSで余白の原因をリセット */
.thumbnail img {
    display: block;
    /* 画像がインライン要素として扱われるのを防ぐ */
    margin: 0;
    /* 余計な上下余白をリセット */
    padding: 0;
    /* パディングをリセット */
    max-width: 100%;
    /* 親要素に収まる */
    height: auto;
    /* 縦横比を保持 */
}

/* QRコードフレーム画像の作成中アナウンス */
.dot-bounce {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.dot-bounce span {
    width: 10px;
    height: 10px;
    background-color: #333;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot-bounce span:nth-child(1) {
    animation-delay: -0.32s;
}

.dot-bounce span:nth-child(2) {
    animation-delay: -0.16s;
}

.dot-bounce span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.3;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 画像をアップロードしてフレームにするボタン */
#uploadFrameBtn {
    background: linear-gradient(145deg, #6f1d1b, #8e2c2c);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 15px;
    margin-top: 15px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

#uploadFrameBtn:hover {
    background: linear-gradient(145deg, #8e2c2c, #a42d2d);
    transform: scale(1.03);
}

#uploadFrameBtn:active {
    transform: scale(0.98);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}


/* AIで生成されたQRコードフレーム画像の追加＆削除ボタン */
.frame-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 3px;
}

.btn {
    padding: 6px 14px;
    font-size: 15px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-delete {
    background-color: #e74c3c;
    color: #fff;
}

.btn-add {
    background-color: #2ecc71;
    color: #fff;
}

.btn:hover {
    opacity: 0.85;
}

/* 無効化ボタンの視覚スタイル */
.btn.disabled,
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 無効状態で hover しても色が変わらないように */
.btn.disabled:hover,
button:disabled:hover {
    background-color: inherit;
}

/* QRコードフレーム画像の削除ボタン */
.frame-wrapper {
    display: inline-block;
    margin: 8px;
    text-align: center;
}

.frame-wrapper img {
    display: block;
    max-width: 100px;
    border: 2px solid #ccc;
    border-radius: 6px;
}

.btn-delete-frame {
    margin-top: 4px;
    padding: 2px 8px;
    font-size: 12px;
    color: #fff;
    background-color: #e74c3c;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-delete-frame:hover {
    background-color: #c0392b;
}

/* QRコードフレーム画像のダウンロードボタン */
.btn-default-frames {
    padding: 10px 24px;
    font-size: 16px;
    font-weight: bold;
    border: 1px solid #aaa;
    border-radius: 8px;
    background: linear-gradient(145deg, #d3d3d3, #f0f0f0);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), inset 0 1px 0 #fff;
    color: #333;
    transition: all 0.2s ease-in-out;
}

.btn-default-frames:hover {
    background: linear-gradient(145deg, #c0c0c0, #e0e0e0);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25), inset 0 1px 0 #fff;
}

/* ─── QRコード配置ラジオの横並びレイアウト ─── */
.qr-position {
    text-align: center;
    margin-top: 50px;
    margin-bottom: 1em;
}

.qr-position__title {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.qr-position__options {
    display: inline-flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    /* スマホで折り返し対応 */
}

.qr-position__item {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: normal;
    gap: 4px;
    cursor: pointer;
}

/* 共通レイアウトは配置ラジオと同じ */
.qr-color {
    text-align: center;
    margin-bottom: 1em;
}

.qr-color__title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.qr-color__options {
    display: inline-flex;
    gap: 16px;
    flex-wrap: wrap;
}

.qr-color__item {
    display: inline-flex;
    font-size: 14px;
    font-weight: normal;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

/* アップロード中の点滅メッセージ */
.blinking-message {
    color: #d00;
    font-weight: bold;
    animation: blink 1s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* 無効化ボタンのスタイル（グレー化＆ポインタ） */
button.disabled {
    background-color: #ccc !important;
    color: #666 !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* AIフレーム作成ボタン（やや濃いメタリック調） */
#customFrameBtn {
    display: inline-block;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px;
    border: 1px solid #666;
    background: linear-gradient(145deg, #999, #555);
    color: #fff;
    cursor: pointer;
    box-shadow: inset 1px 1px 0 #aaa, inset -1px -1px 0 #444, 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#customFrameBtn:hover {
    background: linear-gradient(145deg, #aaa, #444);
    box-shadow: inset 1px 1px 0 #bbb, inset -1px -1px 0 #333, 0 3px 6px rgba(0, 0, 0, 0.3);
    opacity: 0.95;
}

/* レスポンシブ対応: 横列を画面幅に応じて切り替え */
@media (max-width: 1024px) {
    .thumbnail {
        width: 90px;
        /* 横3列用に調整 */
    }
}

@media (max-width: 768px) {
    .thumbnail {
        width: 80px;
        /* 横2列用に調整 */
    }
}

@media (max-width: 480px) {
    .thumbnail {
        width: 70px;
        /* 横1列用に調整 */
    }
}

#customPrompt {
    width: 100%;
    max-width: 600px;
    min-width: 240px;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
    display: block;
    font-size: 1.05em;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.3s;
    margin-top:15px;
    margin-bottom:30px;
}

#customPrompt:focus {
    border-color: #007BFF;
    outline: none;
}

.sns-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.sns-button {
    display: inline-block;
    padding: 8px 12px;
    font-size: 0.8em;
    color: #fff;
    /* 文字色を白に設定 */
    text-decoration: none;
    /* 下線を除去 */
    border-radius: 4px;
    margin: 0 5px;
    /* 左右に5pxのマージン */
}

.sns-button.line {
    background-color: #00c300;
}

.sns-button.twitter {
    background-color: #1DA1F2;
}

.sns-button.facebook {
    background-color: #3b5998;
}

.sns-button.line:hover {
    background-color: #07e407;
    color: #fff;
    /* 文字色を白に固定 */
}

.sns-button.twitter:hover {
    background-color: #1da0f2ab;
    color: #fff;
    /* 文字色を白に固定 */
}

.sns-button.facebook:hover {
    background-color: #3b5898c0;
    color: #fff;
    /* 文字色を白に固定 */
}

/* ダークモード時のスタイル */
.dark-mode h1 {
    color: #fff !important;
}

.dark-mode #qrForm {
    background-color: #333 !important;
    /* 明るめのグレー */
    color: #fff !important;
}

.dark-mode label,
.dark-mode #frameLabel {
    color: #fff !important;
}

.dark-mode input[type="text"] {
    background-color: #111 !important;
    color: #fff !important;
    border-color: #666 !important;
}

.dark-mode .qr-position__item,
.dark-mode .qr-color__item {
    color: #fff !important;
}

/* ラジオボタン本体の背景とボーダー */
.dark-mode input[type="radio"] {
    accent-color: #ccc;
    /* 対応ブラウザではラジオの色を一括変更 */
    background-color: #000;
    border: 1px solid #888;
}

/* Firefoxなど一部ブラウザ用のフォールバック（疑似要素で制御） */
.dark-mode input[type="radio"]::-webkit-radio {
    background-color: #000;
    border: 1px solid #888;
}

.dark-mode input[type="radio"]:checked {
    background-color: #555;
}

/* ラジオボタンのラベルの文字 */
.dark-mode .qr-position__item,
.dark-mode .qr-color__item {
    color: #fff !important;
}