.custom-page-content {
    font-family: "Meiryo", Arial, sans-serif;
    text-align: center;
    margin: 0; /* 余白をなくす */
    overflow-y: auto; /* 垂直方向のスクロールバーを有効にする */
    overflow-x: hidden; /* 水平方向のスクロールバーを無効にする */
    min-height: 80vh; /* コンテンツ用ラッパーの高さ（body ではなくラッパーにスコープ） */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* コンテンツを上部に配置 */
}
h1 {
    font-size: 28px; /* フォントサイズを小さく設定 */
    margin-top: 0; /* h1要素の上部の余白を完全になくす */
}
#pageHeader {
    white-space: pre-line; /* JSで設定する \n を改行として表示（スマホの日本語改行を自然に） */
}
.hidden {
    display: none;
}
.top-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto 1em;
}
.top-image-container img {
    display: block;
    max-width: 100%;
    max-height: 40vh;
    object-fit: contain;
}
.top-image-container.hidden {
    display: none !important;
}
#pageHeader.hidden {
    display: none !important;
}
.image-container {
    display: flex;
    justify-content: center; /* 水平方向に中央揃え */
    align-items: center; /* 垂直方向に中央揃え */
    width: 50%; /* コンテナの幅を100%に設定 */
    height: 100%; /* コンテナの高さを100%に設定 */
    margin: 0 auto; /* センタリング */
}
.image-container img {
    display: block;
    margin: auto;
    max-width: 100%;
    max-height: 100%;
    max-height: 50vh; /* 画面の半分までに制限 */
    object-fit: contain; /* 画像の比率を保ちながら、枠内に収まる */
}
.countdown {
    font-size: 24px;
    margin-top: 10px;
    color: red; /* テキストカラーを赤にする */
}
.hint {
    font-size: 20px;
    margin-top: 10px;
    white-space: pre-wrap; /* 改行を保持する */
}
.grid-container {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    width: 80%;
    margin: 0 auto;
    margin-top: 20px; /* 数値の表示開始位置をもう少し下に変更 */
}
.grid-item {
    padding: 10px;
    background-color: lightgray;
    border: 1px solid #ccc;
    cursor: pointer;
}
.grid-item.selected {
    background-color: yellow;
}

.recall-input-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2列のグリッドを設定 */
    gap: 10px 20px; /* ギャップを調整 */
    justify-content: center;
    margin: 20px 10px; /* 上下に20px、左右に10pxの余白を追加 */
    width: calc(100% - 20px); /* 全体の幅を指定し、左右のマージン分を引く */
    box-sizing: border-box; /* パディングを含めてサイズを計算 */
}

.recall-input-container .input-group {
    display: flex;
    align-items: center;
    width: 100%;
}

.recall-input-container .label {
    flex: 0 0 150px; /* ラベルの固定幅を設定 */
    font-size: 18px; /* テキストサイズを調整 */
    padding-right: 10px; /* テキストボックスとのスペース */
    box-sizing: border-box; /* パディングを含めてサイズを計算 */
    white-space: nowrap; /* テキストが改行されないようにする */
    text-align: left; /* テキストを左寄せにする */
}

.recall-input-container input {
    flex: 1; /* 残りのスペースを占有 */
    height: 40px; /* 高さを指定 */
    padding: 10px; /* 内側に余白を追加 */
    font-size: 18px; /* フォントサイズを拡大 */
    box-sizing: border-box; /* パディングを含めてサイズを計算 */
}
.answers-container {
    width: 80%; /* 全体の幅を調整 */
    margin: 0 auto; /* 中央に配置 */
}
.answers-container table {
    width: 100%;
    border-collapse: collapse;
}
.answers-container th, .answers-container td {
    border: 1px solid #ccc;
    padding: 4px 8px; /* 縦方向の余白を減らすために上下のパディングを4pxに変更 */
    text-align: center;
}
.answers-container th {
    background-color: #f4f4f4;
}
.answers-container th:nth-child(1), .answers-container td:nth-child(1) {
    width: 25%; /* 1回目の回答列の幅 */
}
.answers-container th:nth-child(2), .answers-container td:nth-child(2) {
    width: 25%; /* 2回目の回答列の幅 */
}
.answers-container th:nth-child(3), .answers-container td:nth-child(3) {
    width: 25%; /* 正解列の幅 */
}
.answers-container th:nth-child(4), .answers-container td:nth-child(4) {
    width: 25%; /* 判定列の幅 */
}
.correct {
    background-color: limegreen; /* 正解のバックグラウンドカラーをグリーンに */
    color: white; /* テキストカラーを白に */
    white-space: nowrap; /* テキストが改行されないようにする */
}
.incorrect {
    background-color: gray; /* 不正解のバックグラウンドカラーをグレーに */
    color: white; /* テキストカラーを白に */
    white-space: nowrap; /* テキストが改行されないようにする */
}
.correct-answer {
    background-color: limegreen; /* 正解のバックグラウンドカラーをグリーンに */
    color: white; /* テキストカラーを白に */
}
.unanswered {
    color: grey; /* テキストカラーをgreyに */
}
.answers-container div {
    flex: 1;
    min-width: 200px; /* 最小幅を設定 */
    max-width: 30%; /* 最大幅を設定 */
    max-height: calc(100vh - 200px); /* 最大高さを設定 */
    overflow-y: auto; /* 縦スクロールを有効にする */
}
.answers-container ul {
    font-size: 1.4rem; /* テキストサイズをさらに大きく設定 */
    padding: 0;
    list-style-type: none;
}
.answers-container li {
    margin-bottom: 5px;
}
.left-align {
    text-align: left;
    padding: 0px 20px 0px 20px; /*上 右 下 左*/
    border: 1px solid #000;
    margin: 10px auto;
    border-radius: 5px;
    background-color: #c0f080;
    width: 60%;
    box-sizing: border-box;
}
button {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 16px;
    border: none; /* 境界線を削除 */
    border-radius: 5px; /* 角を丸くする */
    background-color: #007BFF; /* 背景色を青に */
    color: white; /* テキストカラーを白に */
    cursor: pointer; /* カーソルをポインターに */
    transition: background-color 0.3s, transform 0.3s; /* 背景色と変形のトランジションを追加 */
}

button:hover {
    background-color: #0056b3; /* ホバー時の背景色 */
    transform: scale(1.05); /* ホバー時に少し大きくする */
}

button:active {
    background-color: #004080; /* クリック時の背景色 */
    transform: scale(0.95); /* クリック時に少し小さくする */
}
.control-button {
    padding: 10px 20px;
    font-size: 16px;
    width: 120px; /* ボタンの横幅を固定サイズに設定 */
    height: auto; /* ボタンの高さを自動に設定 */
    text-align: center; /* テキストを中央に配置 */
}
.control-buttons {
    margin-top: 10px; /* カウントダウンの下に余白を追加 */
    display: flex;
    justify-content: center;
    gap: 10px; /* ボタン間のスペースを調整 */
}
/* スタイリッシュなプルダウンメニューのスタイル */
.stylish-select {
    /*appearance: none;*/ /* デフォルトのプルダウン矢印を非表示に */
    background-color: #fff; /* 背景色を白に */
    border: 2px solid #007BFF; /* 青色の枠線を追加 */
    border-radius: 4px; /* 角を丸くする */
    padding: 10px 40px 10px 10px; /* 内側の余白を調整 */
    font-size: 16px; /* フォントサイズを調整 */
    color: #333; /* テキストカラーを調整 */
    cursor: pointer; /* カーソルをポインターに */
    transition: border-color 0.3s, box-shadow 0.3s; /* 枠線とボックスシャドウのトランジションを追加 */
    width: 150px; /* 横幅を適切に設定 */
    height: auto; /* 高さを自動に設定 */
}

#resultSection {
    overflow: auto; /* 縦横両方のスクロールバーを設置 */
    margin-top: 0; /* 上部の余白をなくす */
    box-sizing: border-box; /* パディングを含めてサイズを計算 */
}
#resultSection h2 {
    margin-top: 0px; /* h2要素の上部に0pxの余白を追加 */
}
#interruptionSection, #interruptionSection2 {
    margin-top: 0px; /* 上部に0pxの余白を追加 */
    overflow: auto; /* コンテンツがはみ出す場合にスクロールバーを追加 */
    max-height: 100vh; /* ウィンドウの高さを超えないように設定 */
    padding: 10px; /* 内側に余白を追加 */
    box-sizing: border-box; /* パディングを含めてサイズを計算 */
    overflow-y: auto; /* ウィンドウ全体に対して垂直方向のスクロールを有効にする */
}
#illustrationSection1, #illustrationSection2, #illustrationSection3, #illustrationSection4 {
    overflow: auto; /* コンテンツがはみ出す場合にスクロールバーを追加 */
    max-height: 100vh; /* ウィンドウの高さを超えないように設定 */
    padding: 10px; /* 内側に余白を追加 */
    box-sizing: border-box; /* パディングを含めてサイズを計算 */
    overflow-x: hidden; /* 水平方向のスクロールバーを無効にする */
    overflow-y: auto; /* 垂直方向のスクロールバーを有効にする */
}
#patternSelect {
    height: auto;
    font-size: 18px;
    width: 160px;
    padding: 0.6rem 0.75rem;
}
#audioSelect {
    height: auto; /* ボタンの高さを自動に設定 */
    font-size: 16px; /* フォントサイズをテスト開始ボタンと同じに設定 */
    width: 150px; /* 横幅を適切に設定 */
}
#includeOption {
    height: auto; /* ボタンの高さを自動に設定 */
    font-size: 16px; /* フォントサイズをテスト開始ボタンと同じに設定 */
    width: 150px; /* 横幅を適切に設定 */
}
#startSection #formContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    max-width: 480px;
    margin: 0 auto;
    padding: 1.5rem 1.75rem;
    background: #f0f2f5;
    border-radius: 14px;
    border: 2px solid #b8bcc4;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    box-sizing: border-box;
}

#startSection .form-container-intro {
    margin: 0;
    padding: 0 0.25rem;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
    text-align: center;
    width: 100%;
}

#startSection .form-group {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    gap: 0.75rem;
}

#startSection .label {
    flex: 0 0 170px; /* 時間の見当識：が収まる幅 */
    min-width: 170px;
    text-align: left;
    padding-right: 12px;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.5;
    color: #333;
}

#startSection .form-group .form-row-value {
    display: flex;
    align-items: center;
    gap: 12px;
}

#startSection .form-group .form-row-value .form-state {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    min-width: 5em;
}

#startSection .control-button {
    flex: 0 0 auto;
    min-width: 160px;
    padding: 0.6rem 0.75rem;
    font-size: 18px;
}

#startSection button {
    margin-top: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 18px;
}

/* テスト開始ボタン：視認性・押したくなるモダンCTA（オレンジ系） */
#startSection .btn-start-test {
    margin-top: 1.5rem;
    margin-bottom: 0.25rem;
    padding: 1rem 2.5rem;
    min-height: 48px;
    width: 100%;
    max-width: 320px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    border: none;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.4);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
#startSection .btn-start-test:hover {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.5);
    transform: translateY(-2px);
}
#startSection .btn-start-test:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(234, 88, 12, 0.35);
}
#startSection .btn-start-test:focus-visible {
    outline: 3px solid rgba(234, 88, 12, 0.5);
    outline-offset: 2px;
}

#orientationSection table {
    width: auto; /* テーブルの幅を自動に設定 */
    margin: 20px auto 0; /* テーブル全体を中央揃え、上部に20pxの余白を追加 */
    border-collapse: collapse; /* テーブルの境界線を結合 */
    background-color: #f9f9f9; /* 背景色を追加 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* テーブルに影を追加 */
}

#orientationSection table th,
#orientationSection table td {
    padding: 12px 15px; /* セルの内側に余白を追加 */
    border: 1px solid #ddd; /* セルの境界線を追加 */
    text-align: center; /* テキストを中央揃え */
    font-size: 18px; /* テキストサイズを9ページ目と一致させる */
}

#orientationSection table th {
    background-color: #f4f4f4; /* ヘッダーの背景色を追加 */
    font-weight: bold; /* ヘッダーのフォントを太字に */
}
#orientationSection table input {
    flex: 1; /* 残りのスペースを占有 */
    height: 40px; /* 高さを指定 */
    padding: 10px; /* 内側に余白を追加 */
    font-size: 18px; /* フォントサイズを拡大 */
    box-sizing: border-box; /* パディングを含めてサイズを計算 */
    text-align: left; /* テキストボックス内のテキストを左揃えにする */
}
#orientationSection table td:nth-child(1),
#orientationSection table td:nth-child(3) {
    text-align: left; /* 3列目（備考列）を左揃えに */
}
.answers-container + .answers-container {
    margin-top: 20px; /* 既存のテーブルと時間の見当識のテーブルの間に20pxの余白を追加 */
}
/* スイッチのスタイル */
.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
    flex-shrink: 0;
}

.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: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* #description {
    text-align: left;
} */
#description,
#access-stats {
    width: 90%; /* 横幅を90%に設定 */
    max-width: 1200px; /* 最大幅を1200pxに設定 */
    margin: 0 auto; /* 中央揃え */
    text-align: left; /* テキストを左揃え */
    margin-top: 20px; /* #descriptionの上に20pxの隙間を追加 */
}

/* このアプリの特徴セクション：モダンUI（#description のみ .left-align を上書き） */
#startSection #description {
    background: #ffffff;
    border: 2px solid #9ca3af;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 1.25rem 1.75rem;
    box-sizing: border-box;
}
#description h2 {
    font-size: 1.4375rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: -1.25rem -1.75rem 1rem -1.75rem;
    padding: 1rem 1.75rem;
    background: #e9ecef;
    border-bottom: 2px solid #dee2e6;
    border-radius: 12px 12px 0 0;
}
#description h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 1.5rem 0 0.5rem 0;
    padding: 0.5rem 0.75rem 0.5rem 0.75rem;
    background: #f0f2f5;
    border-left: 4px solid #0d6efd;
    border-radius: 0 8px 8px 0;
}
#description h3:first-of-type {
    margin-top: 0;
}
#description p {
    line-height: 1.75;
    margin: 0 0 0.75rem 0;
    color: #333;
}
#description a {
    color: #0d6efd;
    text-decoration: none;
}
#description a:hover {
    text-decoration: underline;
}
#description .formula-block {
    background: #f0f2f5;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    border: 1px solid #e5e8eb;
}
#description .formula-block h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}
#description .formula-block p {
    margin: 0;
}

#recallSection,
#recallSection2,
#orientationSection,
#resultSection {
    padding: 10px;
    box-sizing: border-box;
}
table {
    border-collapse: collapse;
    border: 1px solid #999;
}
th, td {
    border: 1px solid #999;
    padding: 8px;
    text-align: center;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #999;
}
.history-table th,
.history-table td {
    border: 1px solid #999;
    padding: 8px;
    text-align: center;
    vertical-align: middle; /* 上下中央揃え */
}
.history-table button {
    height: 36px;
    line-height: 36px;
    font-size: 14px;
    padding: 0 12px;         /* 上下余白ゼロで中央揃え */
    margin: 0;            
    vertical-align: middle;
    display: inline-flex;    /* ボタン内もflexにする */
    align-items: center;     /* テキスト上下中央揃え */
    justify-content: center; /* 左右中央揃え（お好みで） */
}

/* スマートフォン向けのスタイル */
@media (max-width: 1080px) {
    #illustrationSection1,
    #illustrationSection2,
    #illustrationSection3,
    #illustrationSection4,
    #interruptionSection,
    #interruptionSection2,
    #recallSection,
    #recallSection2,
    #orientationSection,
    #resultSection {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding-bottom: 0 !important;
    }
    .grid-container {
        max-height: none !important;
        overflow: visible !important;
        height: auto !important;
    }

    .custom-page-content {
        font-size: 14px; /* フォントサイズを小さく調整 */
    }

    #patternSelect {
        height: auto; /* ボタンの高さを自動に設定 */
        font-size: 16px; /* プルダウンメニューのフォントサイズ */
    }
    
    #audioSelect {
        height: auto; /* ボタンの高さを自動に設定 */
        font-size: 16px; /* プルダウンメニューのフォントサイズ */
    }
    
    #includeOption {
        height: auto; /* ボタンの高さを自動に設定 */
        font-size: 16px; /* プルダウンメニューのフォントサイズ */
    }
    
    #startSection button {
        /* height: 50px; ボタンの高さを自動に設定 */
        padding: 10px 20px;
        line-height: normal;
        font-size: 16px; /* テスト開始ボタンのフォントサイズをプルダウンメニューと同じに設定 */
    }
    #startSection .btn-start-test {
        min-height: 48px;
        padding: 12px 20px;
        font-size: 1.1rem;
    }

    .image-container {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 50%; /* コンテナの幅を100%に設定 */
        height: 100%; /* コンテナの高さを100%に設定 */
        padding-bottom: 10px !important;
        margin-top: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .image-container img {
        display: block !important;
        margin: 0 auto !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
    }

    .control-buttons {
        height: auto; /* ボタンの高さを自動に設定 */
        margin-top: 10px; /* カウントダウンの下に余白を追加 */
    }

    .countdown {
        font-size: 18px; /* フォントサイズを小さく調整 */
    }

    .hint {
        font-size: 16px; /* フォントサイズを小さく調整 */
    }

    .grid-container {
        grid-template-columns: repeat(5, 1fr); /* 5列のグリッドに変更 */
        max-height: 50vh; /* 最大高さを50vhに設定 */
        overflow-y: visible; /* 垂直方向のスクロールを解除 */
    }

    .grid-item {
        padding: 5px; /* パディングを小さく調整 */
    }

    .recall-input-container {
        grid-template-columns: 1fr !important; /* 1列のグリッドに変更 */
        gap: 5px 0 !important; /* 縦方向のギャップを小さく設定 */
    }

    .recall-input-container .input-group {
        flex-direction: column !important; /* 縦方向に配置 */
        align-items: flex-start !important; /* 左揃えにする */
        margin-bottom: 5px !important; /* 入力グループ間のスペースを追加 */
    }

    .recall-input-container .label {
        flex: none !important; /* flexの設定を無効化 */
        width: auto !important; /* ラベルの幅を自動に設定 */
        height: auto !important; /* ラベルの高さを自動に設定 */
        padding-right: 0 !important; /* テキストボックスとのスペースをなくす */
        margin-bottom: 2px !important; /* ラベル下にスペースを追加 */
    }

    .recall-input-container input {
        width: 100% !important; /* 入力欄を幅いっぱいに広げる */
    }

    .answers-container {
        width: 100%; /* 全体の幅を100%に変更 */
    }

    .answers-container table th, .answers-container table td {
        padding: 2px; /* パディングを小さく調整 */
    }

    .left-align {
        text-align: left;
        padding: 0px 0px 0px 0px; /*上 右 下 左*/
        width: 95%;
    }
    
    button {
        font-size: 12px; /* フォントサイズを小さく調整 */
        padding: 5px 10px; /* パディングを小さく調整 */
    }
}

/* AdBlock 注意モーダル */
.adblock-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
.adblock-modal-overlay.is-visible {
    display: flex;
}
.adblock-modal {
    background: #fff;
    border-radius: 8px;
    padding: 1.5em;
    max-width: 90%;
    width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.adblock-modal-message {
    margin: 0 0 1em;
    line-height: 1.6;
    text-align: left;
}
.adblock-modal-reload {
    display: block;
    margin: 0 auto;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
}
.adblock-modal-reload:hover {
    background: #555;
}
