@charset "UTF-8";
/*
    Template: swell
    Theme Name: SWELL CHILD
    Theme URI: https://swell-theme.com/
    Description: SWELLの子テーマ
    Version: 1.0.0
    Author: LOOS WEB STUDIO
    Author URI: https://loos-web-studio.com/

    License: GNU General Public License
    License URI: http://www.gnu.org/licenses/gpl.html
*/

/* ========================================
   1. サイト全体の基本スタイル
   ======================================== */

/* SWELL CSS変数を本番と同じ値に上書き */
:root {
    /* フォントサイズ（本番と同じ16px基準） */
    --swl-fz--root: 16px;
    --swl-fz--side: 14px;

    /* カラー設定 */
    --color_main: #8bbabb;
    --color_text: #424242;
    --color_link: #518bcb;
    --color_bg: #8bbabb;
    --color_htag: #8bbabb;
    --color_border: #e0e0e0;
    --color_header_text: #fff;
    --color_header_bg: #8bbabb;
    /* SWELLがPHPでサーバーサイド計算する変数を手動で上書き */
    --color_main_thin: rgba(139, 186, 187, 0.05);
    --color_main_dark: #6a9899;
    --color_list_check: #8bbabb;
    --color_list_num: #8bbabb;
}

body {
    font-family: "游ゴシック体", "Yu Gothic", YuGothic, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    font-weight: 500;
    background: #8bbabb;
    color: #424242;
    font-feature-settings: 'palt';
    -webkit-font-feature-settings: 'palt';
}

/* ドリルページのbody背景色（本番と同じ） */
body.drill-tax,
body.post-type-archive-drill,
body.single-drill {
    background: #f1a98a;
}

/* テキスト色（本番: #424242） */
p, ol, ul {
    color: #424242;
}

/* リンク色（本番: #518bcb, font-weight: 700） */
a {
    color: #518bcb;
    font-weight: 700;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ヘッダー全体のテキスト色を白に（本番と同じ） */
.l-header {
    color: #fff;
}
.l-header a,
.l-header span {
    color: inherit;
}

/* フッター内リンクは白（本番と同じ） */
.l-footer a {
    color: #fff;
}

/* h2内のリンクは白（本番と同じ） */
.post_content h2 a {
    color: #fff;
}

/* ボタン系リンクは白テキスト維持（グローバルa色の上書き対策） */
.is-style-btn_normal a,
.is-style-btn_solid a,
.is-style-btn_shiny a,
.swell-block-button a,
.wp-block-button__link,
.u-bg-main,
.u-bg-main a,
.c-shareBtns a,
.c-shareBtns__btn,
.p-pagerLinks a,
.c-mvBtn a,
.c-infoBar a,
.p-articleThumb__cat,
.c-postThumb__cat,
.comment-reply-link,
.p-fixBtnWrap a {
    color: inherit;
}

/* 背景色付きボタンは明示的に白テキスト */
.is-style-btn_normal a,
.is-style-btn_solid a,
.is-style-btn_shiny a,
.swell-block-button a,
.wp-block-button__link,
.u-bg-main,
.u-bg-main a,
.comment-reply-link,
.pdf-link a,
#pdf-download a,
#ad-pdf a,
#no-ad-pdf a,
a[style*="background"][style*="color"] {
    color: #fff;
}

/* 見出し共通（本番: line-height 1.4, margin 3rem 0 1rem） */
.post_content h1,
.post_content h2,
.post_content h3,
.post_content h4,
.post_content h5 {
    line-height: 1.4;
    margin: 3rem 0 1rem;
}

/* h2（本番: 1.38rem, bg:#8bbabb, color:#fff, padding:1rem, border-left:6px double） */
.post_content h2 {
    font-size: 1.38rem;
    background: #8bbabb;
    color: #fff;
    padding: 1rem;
    border-left: 6px double;
    border-right: none;
    border-top: none;
    border-bottom: none;
    position: relative;
    --color_htag: #8bbabb;
}
/* SWELLの動的h2装飾（::before/::after）を無効化
   ※unit-primary/junior/highのキャラクター画像は除外 */
.post_content h2:not(.unit-primary):not(.unit-junior):not(.unit-high)::before,
.post_content h2:not(.unit-primary):not(.unit-junior):not(.unit-high)::after {
    display: none;
    content: none;
}

/* h3（本番: 1.25rem, padding-bottom:.5rem, border-bottom:3px solid #8bbabb） */
.post_content h3 {
    font-size: 1.25rem;
    padding-bottom: .5rem;
    border-bottom: 3px solid #8bbabb;
    border-left: none;
    border-right: none;
    border-top: none;
    background: none;
    color: inherit;
    --color_htag: #8bbabb;
}
/* SWELLの動的h3装飾（::before）を無効化 */
.post_content h3::before,
.post_content h3::after {
    display: none;
    content: none;
}

/* h4（本番: 1.13rem, padding-left:1rem, border-left:4px solid #8bbabb） */
.post_content h4 {
    font-size: 1.13rem;
    padding-left: 1rem;
    border-left: 4px solid #8bbabb;
    border-right: none;
    border-top: none;
    border-bottom: none;
    background: none;
}
.post_content h4::before,
.post_content h4::after {
    display: none;
    content: none;
}

/* 本文 #entry p相当（本番: line-height:2, margin-bottom:2rem） */
.post_content p {
    margin-bottom: 2rem;
    line-height: 2;
}

/* 本文リスト（本番: line-height:1.4, margin-bottom:1.8rem, padding-left:2rem） */
.post_content ol,
.post_content ul {
    margin-bottom: 1.8rem;
    padding: 0 0 0 2rem;
    line-height: 1.4;
}
.post_content ul {
    list-style: disc;
}
.post_content ol {
    list-style: decimal;
}
.post_content li {
    padding: .5rem 0;
    text-align: left;
}

/* 段落直後のfigure間隔（本番と同じ） */
.post_content p + figure,
.post_content pre + figure {
    margin-top: 2.5rem;
}

/* 四角囲みボックス（本番と同じ） */
.simple-box1 {
    border: 3px solid #5c8d89;
    border-radius: 4px;
    padding: 1.5em;
    margin-bottom: 2rem;
}

/* ボックス内の最後の段落のmargin-bottom無効化（本番と同じ） */
.post_content .cap_box_content p:last-child,
.post_content .simple-box1 p:last-child,
.post_content .wp-block-group__inner-container p:last-child {
    margin-bottom: 0;
}

/* FAQ内の段落margin無効化（本番と同じ） */
.post_content .faq-answer p,
.post_content .faq-question p {
    margin-bottom: 0;
}

/* 黒板内テキスト（本番と同じ） */
.post_content .blackboard p {
    color: #fff;
    margin-bottom: 0;
}

/* フッター（本番: bg:#8bbabb, color:#fff） */
.l-footer {
    background-color: #8bbabb;
    color: #fff;
}

/* サイドバー背景色統一（本番: #f7f6f4） */
.l-sidebar {
    background-color: #f7f6f4;
    padding: 0 20px 1.5rem;
}

/* サイドバーのフォントサイズ（投稿ページ、本番と同じ） */
body.single:not(.pdf):not(.drill-answer) .l-sidebar {
    font-size: .9rem;
}

/* サイドバー見出し（本番と同じ） */
.l-sidebar h1 {
    margin: 0 0 1rem 0;
    text-align: left;
}

/* サイドバー段落（SWELLの*リセットで消されたマージンを復元） */
.l-sidebar p,
#sidebar p {
    margin-bottom: 2rem;
}

/* サイドバーリスト（本番スタイル） */
.l-sidebar ul {
    margin-bottom: 1.5rem;
    padding: 0;
}
.l-sidebar ol {
    padding-left: 1.6em;
    list-style: decimal;
    margin-bottom: 2rem;
}
.l-sidebar li {
    line-height: 1.4;
    margin: .8rem 0;
    padding: 0;
}
.l-sidebar li a {
    font-weight: 400;
}
.l-sidebar ul li a {
    font-weight: 700;
}

/* テーブル（本番スタイル） */
.wp-block-table tr:nth-child(even) {
    background-color: #f7f6f4;
}
.wp-block-table th {
    color: #000;
    font-weight: 700;
    text-align: left;
    border-bottom: 4px double #8bbabb;
}
.wp-block-table td,
.wp-block-table th {
    padding: .5rem;
}
.wp-block-table table {
    table-layout: fixed;
    word-wrap: break-word;
}
@media (min-width: 1233px) {
    .wp-block-table table {
        min-width: 728px;
        table-layout: auto;
    }
    .wp-block-my-custom-question-child .wp-block-table table {
        min-width: auto;
    }
}

/* ブロック間隔（本番と同じ） */
.wp-block-embed,
.wp-block-group {
    margin-bottom: 2rem;
}
.wp-block-group__inner-container {
    padding: 1rem;
    line-height: 2;
}
.wp-block-image {
    margin-bottom: 2rem;
}
.wp-block-audio,
.wp-block-file {
    margin-bottom: 2rem;
}

/* ボーダースタイル（本番と同じ） */
.has-border.-border01 {
    border: 1px solid #8bbabb;
}

/* pre/codeスタイル（本番と同じ） */
pre {
    background: #f5f5f5;
    line-height: 1.4;
    margin-bottom: 1em;
    max-width: 100%;
    overflow: auto;
    padding: 1rem;
}

/* mark/highlightスタイル（本番と同じ） */
mark {
    background-color: #ff9;
    color: #000;
    font-style: italic;
    font-weight: 700;
}
.su-highlight {
    display: inline;
    padding: 1px 0;
}

/* em（本番と同じ） */
cite, dfn, em, i {
    font-style: normal;
}
em {
    font-weight: 700;
}

/* 画像グローバルリセット（本番と同じ） */
img {
    max-width: 100%;
    height: auto;
}

/* PDFページのh2余白（本番と同じ） */
.pdf .post_content h2 {
    margin: 1.5rem 0;
}

/* 記事コンテンツ内のPDFダウンロードエリアを非表示（テンプレート側で出力するため） */
#body_wrap .single-page-layout .entry-content .pdf-download-wrap {
    display: none;
}

/* PDFダウンロードセクションの見出しリセット（本番と同じ） */
.pdf-download-wrap h2 {
    background: #fff;
    padding: 0;
    border-left: none;
    color: inherit;
}
.pdf-download-wrap h2::before,
.pdf-download-wrap h2::after {
    display: none;
    content: none;
}

/* PDFダウンロードボタンスタイル */
.pdf-download-wrap .pdf-link a {
    display: block;
    background: #518bcb;
    color: #fff;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 2rem;
    text-align: center;
    margin-top: 0.5rem;
}

.pdf-download-wrap .pdf-link a:hover {
    opacity: 0.8;
}

/* PDFダウンロードエリアのグリッドレイアウト（本番と同じ） */
#pdf-download,
#pdf-download-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

#pdf-download img,
#pdf-download-inline img {
    border: 1px solid #666;
}

#pdf-download figure a:hover,
#pdf-download-inline figure a:hover {
    opacity: 0.7;
}

#pdf-download img {
    min-width: 356px;
    min-height: calc(356px * 210 / 297);
}

#right-side #pdf-download img {
    min-width: auto;
    min-height: auto;
}

.page-count {
    color: #e54c4c;
    font-weight: 700;
}

/* カテゴリーページのunit表 th上線（本番と同じ） */
.category .unit th {
    border-top: 4px double #8bbabb;
}

/* su-heading（Shortcodes Ultimate見出し、本番と同じ） */
.su-heading-align-center {
    text-align: center;
}
.su-heading-style-default {
    padding: 2px 0;
    border-top: 1px solid #999;
    border-bottom: 1px solid #999;
    margin-bottom: 2rem;
}
.su-heading-inner {
    padding: 1em .5em;
    border-top: 4px solid #eee;
    border-bottom: 4px solid #eee;
    line-height: 1.6;
}

/* SWELLのh2 margin-x変数をリセット（本番は横マージンなし） */
.post_content > h2 {
    margin-left: 0;
    margin-right: 0;
}

/* ホームページのh1余白（本番と同じ） */
.home h1 {
    margin-bottom: -3rem;
}

/* アフィリエイトボックス（本番と同じ） */
.affiliate-box {
    border: 2px solid #f2f2f2;
    display: grid;
    grid-template-columns: 25% 1fr;
    grid-gap: 1rem;
    padding: 1rem;
    margin-bottom: 2rem;
}
.affiliate-box-text {
    word-break: break-all;
}
.affiliate-amazon {
    color: #ff9901;
}
.affiliate-rakuten {
    color: #d24c4c;
}
.affiliate-yahoo {
    color: #ff4c6f;
}
.post_content .affiliate-box-text p {
    margin-bottom: 1rem;
}
.post_content ul.affiliate-box-link {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 検索フォーム（本番と同じ） */
#search-form {
    margin: 1.5rem 0;
    max-width: 630px; /* 本番と同じ */
    position: relative;
}
#search-form input[type=search] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff;
    line-height: 2;
    padding: .5rem 40px .5rem 1rem;
    width: 100%;
    height: 50px;
    border: 1px solid hsla(0, 0%, 78%, .5);
    border-radius: 1rem;
    font-size: 1rem;
}
#search-form input[type=search]:focus {
    outline: 0;
}
#search-form button {
    background-color: #518bcb;
    border-radius: 0 1rem 1rem 0;
    border: none;
    position: absolute;
    right: 0;
    top: 0;
    width: 50px;
    height: 100%;
    cursor: pointer;
    padding: 0;
}
#search-form button svg {
    fill: #fff;
    position: absolute;
    right: 50%;
    top: 50%;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    margin-right: -15px;
}

/* 検索結果リスト（本番と同じ） */
.post_content #search-result {
    list-style: none;
    max-width: 728px;
    margin: 0 auto 1.5rem;
    padding: 0;
}

/* input/select垂直方向配置（本番と同じ） */
input, select {
    vertical-align: middle;
}

/* サイドバーナビゲーション（本番と同じ） */
#side-navi {
    display: flex;
}
#side-navi ul {
    list-style: none;
    padding: 0 1.5rem;
    margin: 0 0 1.5rem 0;
}
#side-navi ul:first-child {
    border-right: 1px dashed #8bbabb;
    padding-left: 0;
}
#side-navi ul:last-child {
    border-left: 1px dashed #8bbabb;
}
#side-navi li {
    line-height: 1.4;
    margin: .8rem 0;
    padding: 0;
}
.navi-active {
    color: #e75a5a;
}

/* フィードバックエリア（本番と同じ） */
.feedback_area {
    display: block;
    margin-bottom: 1.5rem;
}

/* 1pxトラッキング画像リセット（本番と同じ） */
.single article img[height="1"] {
    height: 1px;
    border: none;
}

/* 広告スロット（本番と同じ） */
.side-top-ad,
.side-bottom-ad {
    width: 100%;
    height: 280px;
}
.side_250_ad {
    width: 100%;
    height: 280px;
}
.side_100_ad {
    width: 100%;
    height: 100px;
}
.adslot_horizontal {
    max-width: 728px;
    min-height: calc(100vw * 250 / 300);
    margin: 1.5rem auto;
    text-align: center;
}
.adslot_728x90 {
    max-width: 728px;
    min-height: calc(100vw * 250 / 300);
    margin: 1.5rem auto;
    text-align: center;
}
.adslot_336x280 {
    min-height: 280px;
    display: block;
    margin-bottom: 1.5rem;
}
.adslot_max_250 {
    min-height: 280px;
    display: block;
    margin-bottom: 1.5rem;
}
.adslot_max_100 {
    min-height: 100px;
    display: block;
    margin-bottom: 1.5rem;
}
.adslot_overlay {
    position: fixed;
    z-index: 12;
    width: 100%;
    height: 50px;
    bottom: 0;
    left: 0;
    text-align: center;
    background: #fff;
}
.adslot_sticky {
    display: none;
}
.adslot_column_control {
    display: none;
}
@media screen and (min-width: 1233px) {
    .side_250_ad {
        height: 250px;
    }
    .adslot_horizontal {
        min-height: 280px;
    }
    .adslot_728x90 {
        min-height: 90px;
    }
    .adslot_overlay {
        display: none;
    }
    .adslot_sticky {
        display: block;
        position: sticky;
        bottom: 0;
        left: 0;
        z-index: 11;
        width: 728px;
        height: 90px;
        margin: 0 auto;
    }
    .adslot_sticky_in {
        max-width: 728px;
        margin: 0 auto;
    }
    .adslot_multiplex {
        min-height: 436px;
    }
    #side-navi ul {
        padding: 0 2rem;
    }
    #side-navi li a {
        font-weight: 700;
    }
}
@media screen and (min-width: 1544px) {
    .adslot_column_control {
        display: block;
    }
}
@media screen and (min-width: 1733px) {
    .side-top-ad {
        max-width: 336px;
    }
}

/* サイドバー内.aboutテキスト（本番と同じ） */
.l-sidebar .about p {
    line-height: 2;
    word-break: break-all;
}

/* ユニットテーブル余白（生徒画像とバナーの余白を確保）
   詳細度: #body_wrap.home .unit (1-2-0) で #body_wrap .unit (1-1-0) を上書き */
#body_wrap.home .unit {
    margin-top: 7rem;
}
#body_wrap.archive .unit {
    margin-top: 9rem;
}
.unit th, .unit td {
    padding: .5rem;
}
@media screen and (min-width: 1233px) {
    .unit th, .unit td {
        padding: .7rem;
    }
}

/* ヘッダー下部の丸み（中央が低くなるカーブ）
   本番環境と同じく、position/z-index/heightを設定してmask-imageを機能させる
   SWELL親テーマのtop-header--spfix.cssが position:absolute!important と background:none を
   設定するため、!importantで上書きする必要がある */
#header.l-header {
    position: relative !important;
    z-index: 12;
    text-align: center;
    height: 130px;
    margin-bottom: 1.8rem;
    padding: 1.5rem 0;
    background: #8bbabb !important;
    -webkit-mask-image: radial-gradient(110% 30% at bottom, transparent 50%, #fff 51%);
    mask-image: radial-gradient(110% 30% at bottom, transparent 50%, #fff 51%);
}

/* ドリルページのヘッダー（本番と同じ高さ・色） */
.drill-tax #header.l-header,
.post-type-archive-drill #header.l-header,
.single-drill #header.l-header {
    height: 165px;
    margin-bottom: 1.3rem;
    background: #f1a98a !important;
}

/* 960px以上: ヘッダー高さを165pxに維持（本番と同じ） */
@media screen and (min-width: 960px) {
    .drill-tax #header.l-header,
    .post-type-archive-drill #header.l-header,
    .single-drill #header.l-header {
        height: 165px;
        margin-bottom: 1.8rem;
    }
}

/* ヘッダーの丸みで生まれた余白を埋める（本番: margin-top:-3rem;background:#fff） */
#content.l-content {
    margin-top: -3rem;
    background: #fff;
}

/* 960px〜1232px: 本番環境と同じくモバイル/タブレットレイアウト */
/* SWELLのPC用レイアウトを本番に合わせて上書き */
/* ※ドリルページは除外（ドリルは1233px+で別途gridレイアウト定義） */
@media screen and (min-width: 960px) and (max-width: 1232px) {
    /* ===== SWELLデスクトップレイアウトを無効化（SP版と統一、ドリルページ除外） ===== */
    /* SWELL 960px+: .-sidebar-on .l-content { display: flex } を上書き */
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill) .l-content {
        display: block;
    }
    /* SWELL 960px+: .-sidebar-on .l-mainContent { width: calc(...) } を上書き */
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill) .l-mainContent {
        width: 100%;
        max-width: 100%;
        padding: 3vw;
    }
    /* SWELL 960px+: .-sidebar-on #sidebar { width: 280px } を上書き */
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill) #sidebar,
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill) .l-sidebar {
        width: 100%;
        max-width: 100%;
        margin-top: 0;
    }
    /* SWELL frame-on: .c-widget の白ボックスをSP版と統一 */
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill) #sidebar .c-widget {
        background: transparent;
        border-radius: 0;
        padding: 0;
    }

    /* ヘッダー: 中央配置・ナビ非表示（ドリルページ・固定ページ以外） */
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header {
        display: block;
        text-align: center;
    }
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header .l-header__inner {
        display: flex;
        justify-content: center;
        align-items: center;
        max-width: none;
    }
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header .l-header__logo {
        flex: 0 0 auto;
        align-self: center;
        margin-top: -20px;
    }
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header .l-header__gnav {
        display: none;
    }

    /* コンテンツ: 1カラム・中央配置・パディング追加 */
    /* フッターの負のmargin-top分の余白を確保（SP版と同じ） */
    .top-page-layout,
    .taxonomy-page-layout {
        display: block;
        padding-bottom: 3rem;
    }
    #body_wrap .top-page-main,
    #body_wrap .taxonomy-page-main {
        max-width: 728px;
        margin: 0 auto;
        padding: 1.5rem 0;
    }
    #body_wrap .single-page-main {
        padding-left: 0;
        padding-right: 0;
    }

    /* サイドバー: フル幅・右端まで */
    #sidebar {
        width: 100%;
        max-width: none;
        padding: 1.5rem 20px;
        margin-left: 0;
        margin-right: 0;
    }
    #body_wrap .top-page-layout #sidebar,
    #body_wrap .taxonomy-page-layout #sidebar {
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        padding: 0 20px 1.5rem;
    }
    .top-page-layout #sidebar .w-sidebar,
    .taxonomy-page-layout #sidebar .w-sidebar {
        padding-top: 0;
    }
    /* サイドバー内のバナー画像: 右端まで広がるようにする（トップページ以外） */
    #sidebar img[src*="banner"] {
        max-width: 100%;
        width: 100%;
        height: auto;
    }
    /* トップページのみ: バナー画像を右端まで広げない（.homeはフロントページのbodyクラス） */
    #body_wrap.home #sidebar img[src*="banner"] {
        max-width: 500px;
        width: auto;
        height: auto;
    }

    /* フッターメニュー: 縦並び */
    #footer .l-footer__nav {
        flex-direction: column;
        align-items: center;
    }
    #footer .l-footer__nav li {
        margin: 0;
        text-align: center;
    }
    #footer .l-footer__nav a {
        border-right: none;
        border-left: none;
    }

    /* コピーライト: 縦並び・中央配置 */
    #footer .l-footer__foot .l-container {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    #footer .l-footer__foot .copyright {
        text-align: center;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    /* ヘッダーとコンテンツの隙間を本番と統一（margin-top:-3rem） */
    /* ※固定ページ(.page)は除外、ドリルは別途1.3rem設定 */
    #body_wrap #content.l-content,
    #body_wrap.single #content.l-content,
    #body_wrap.archive #content.l-content,
    #body_wrap.search #content.l-content {
        margin-top: -3rem;
    }

    #body_wrap .top-page-layout,
    #body_wrap .taxonomy-page-layout,
    #body_wrap .single-page-layout {
        margin-top: -3rem;
    }

    /* ヘッダーmargin-bottom（教科書系: 1.8rem） */
    #body_wrap #header.l-header,
    #body_wrap.home #header.l-header,
    #body_wrap.category #header.l-header,
    #body_wrap.tax-unit #header.l-header,
    #body_wrap.tax-subject #header.l-header,
    #body_wrap.tax-school_year #header.l-header,
    #body_wrap.single #header.l-header,
    #body_wrap.search #header.l-header {
        margin-bottom: 1.8rem !important;
    }

    /* 固定ページ：SP版と同じmargin-bottom: 0（960pxブレークポイント除去） */
    #body_wrap.page #header.l-header {
        margin-bottom: 0 !important;
    }

    /* ドリルページ：ヘッダーmargin-bottomを本番と同じ1.3remに（本番: 1233px未満は1.3rem） */
    #body_wrap.drill-tax #header.l-header,
    #body_wrap.post-type-archive-drill #header.l-header,
    #body_wrap.single-drill #header.l-header {
        margin-bottom: 1.3rem !important;
    }

}

/* 1233px以上: シングルポストのヘッダーmargin-bottom復元 */
/* 基本ルール(line 3531)で margin-bottom:0 が設定されているが、 */
/* 960-1232pxでは上記ブロック内で !important で上書き済み。1233px以上にも同様の上書きが必要 */
@media screen and (min-width: 1233px) {
    #body_wrap.single-post:not(.single-drill) .l-header {
        margin-bottom: 1.8rem;
    }
}

/* 960px〜1232px: ドリルページはモバイルレイアウト（中央配置・ナビ非表示） */
@media screen and (min-width: 960px) and (max-width: 1232px) {
    /* ドリルページのヘッダー: 中央配置・ナビ非表示・縦方向配置 */
    #body_wrap.drill-tax #header,
    #body_wrap.post-type-archive-drill #header,
    #body_wrap.single-drill #header {
        display: block;
        text-align: center;
    }
    #body_wrap.drill-tax #header .l-header__inner,
    #body_wrap.post-type-archive-drill #header .l-header__inner,
    #body_wrap.single-drill #header .l-header__inner {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        max-width: none;
        height: 100%;
    }
    /* ロゴコンテナを縦並びに（ドリルロゴ + by ゆみねこの教科書） */
    #body_wrap.drill-tax #header .l-header__logo,
    #body_wrap.post-type-archive-drill #header .l-header__logo,
    #body_wrap.single-drill #header .l-header__logo {
        flex: 0 0 auto;
        align-self: center;
        margin: -30px auto 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    /* .head-kyoukasyo-logo（by ゆみねこの教科書）を下に配置 */
    #body_wrap.drill-tax #header .head-kyoukasyo-logo,
    #body_wrap.post-type-archive-drill #header .head-kyoukasyo-logo,
    #body_wrap.single-drill #header .head-kyoukasyo-logo {
        margin-top: 0;
        margin-left: 0;
    }
    /* ナビゲーションを非表示 */
    #body_wrap.drill-tax #header .l-header__gnav,
    #body_wrap.post-type-archive-drill #header .l-header__gnav,
    #body_wrap.single-drill #header .l-header__gnav {
        display: none;
    }

    /* コンテンツエリア：SWELLのpadding-topをSP版と統一（SWELL 960px+のデフォルト2em/4emを上書き） */
    #body_wrap.drill-tax #content.l-content,
    #body_wrap.post-type-archive-drill #content.l-content,
    #body_wrap.single-drill #content.l-content {
        padding-top: 1.5rem;
    }

    /* メインコンテンツ：SP版と同じ上マージン調整（ヘッダーとの隙間を本番に合わせる） */
    #body_wrap.drill-tax #content .l-mainContent,
    #body_wrap.post-type-archive-drill #content .l-mainContent,
    #body_wrap.single-drill #content .l-mainContent {
        margin-top: -2.5rem;
    }

    /* ドリルカテゴリページ：SP版と同じtranslateYでコンテンツを上に移動（ヘッダーとの隙間を縮める） */
    #body_wrap.category.drill-tax .top-page-layout {
        transform: translateY(-3.5rem);
        margin-bottom: -3.5rem;
    }

}

/* 1233px+: SWELLのseriesレイアウトを上書き */
@media screen and (min-width: 1233px) {
    #header .l-header__inner {
        align-items: center;
    }
    #header .l-header__logo {
        align-self: center;
    }
}

/* ========================================
   ヘッダー全体の配置調整（本番環境と同じgridレイアウト）
   本番の比率に完全一致させる

   重要：本番環境では #header 自体がgridになっています。
   SWELLでは .l-header__inner.l-container がmax-widthを持つため、
   .l-header自体をgridにして、.l-header__innerをdisplay:contentsにすることで
   .l-container の幅制限を完全に回避します。
   ======================================== */

/* SWELLの -series/-parallel ヘッダーレイアウトを無効化（960px〜1232pxのみ）
   1233px以上ではgridレイアウトを使用するため、ここでは設定しない
   ※ドリルページ・固定ページは除外 */
@media screen and (min-width: 960px) and (max-width: 1232px) {
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header.l-header.-series .l-header__inner,
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header.l-header.-parallel .l-header__inner {
        display: flex;
        justify-content: center;
        align-items: center;
        max-width: none;
        padding: 0;
    }

    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header.l-header.-series .l-header__logo,
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header.l-header.-parallel .l-header__logo {
        margin-right: 0;
        padding: 0;
    }

    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header.l-header.-series .c-gnavWrap,
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill):not(.page) #header.l-header.-parallel .c-gnavWrap {
        display: none;
    }
}

/* 1233px+: 2カラムgrid（メイン可変 + サイドバー固定400px+3rem） */
/* 本番: #content,#header{display:grid;grid-template-columns:1fr calc(400px + 3rem)} */
/* ※ドリルページ（drill-tax, post-type-archive-drill, single-drill）は除外 → 960px+で別途定義 */
@media screen and (min-width: 1233px) {
    /* ヘッダー自体をgridにする（本番と同じアプローチ）
       heightを明示的に設定してmask-imageを維持
       SWELLの .-series, .-parallel クラスを明示的に含めて詳細度を確保 */
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill) #header.l-header.-series,
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill) #header.l-header.-parallel,
    #body_wrap.drill-answer #header.l-header.-series,
    #body_wrap.drill-answer #header.l-header.-parallel {
        display: grid;
        grid-template-columns: 1fr calc(400px + 3rem);
        align-items: center;
        height: 130px;
    }

    /* .l-header__innerをdisplay:contentsにして、グリッド階層から排除
       SWELLの .-series .l-header__inner { display: flex } を上書きするため詳細度を確保
       ※ .l-containerクラスの有無に関わらずマッチするよう、両方のセレクタを用意 */
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill) #header.l-header.-series .l-header__inner,
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill) #header.l-header.-parallel .l-header__inner,
    #body_wrap.drill-answer #header.l-header.-series .l-header__inner,
    #body_wrap.drill-answer #header.l-header.-parallel .l-header__inner,
    #body_wrap.drill-answer #header.l-header .l-header__inner.l-container {
        display: contents;
        max-width: none;
    }

    /* ロゴエリア：1列目、グリッド内で中央揃え（本番: #logo） */
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill) #header .l-header__logo,
    #body_wrap.drill-answer #header .l-header__logo {
        grid-row: 1/2;
        grid-column: 1/2;
        display: flex;
        justify-content: center;
        align-items: center;
        align-self: center;
        text-align: center;
        height: 100%;
        margin: -20px auto 0;
        padding: 0 20px;
    }

    /* ナビゲーションエリア：2列目、左揃え（本番: #header-navi） */
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill) #header .l-header__gnav.c-gnavWrap,
    #body_wrap.drill-answer #header .l-header__gnav.c-gnavWrap {
        grid-row: 1/2;
        grid-column: 2/3;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    /* ヘッダーウィジェットエリアをグリッド内で適切に配置（2列目、ナビの横） */
    #body_wrap:not(.single-drill) #header .w-header,
    #body_wrap.drill-answer #header .w-header {
        grid-row: 1;
        grid-column: 2;
        margin-left: auto;
    }

    /* SPボタンはPCでは非表示 */
    #body_wrap:not(.single-drill) #header .l-header__menuBtn,
    #body_wrap:not(.single-drill) #header .l-header__customBtn,
    #body_wrap.drill-answer #header .l-header__menuBtn,
    #body_wrap.drill-answer #header .l-header__customBtn {
        display: none;
    }
}

/* 1358px+: メイン固定728px+16%、サイドバー可変 */
/* 本番: #content,#header{grid-template-columns:calc(728px + 16%) 1fr} */
@media screen and (min-width: 1358px) {
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill) #header.l-header.-series,
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill) #header.l-header.-parallel,
    #body_wrap.drill-answer #header.l-header.-series,
    #body_wrap.drill-answer #header.l-header.-parallel {
        grid-template-columns: calc(728px + 16%) 1fr;
    }

    /* ロゴエリア：パディングで中央寄せ（本番: #logo { padding: 0 8% }） */
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill) #header .l-header__logo,
    #body_wrap.drill-answer #header .l-header__logo {
        padding: 0 8%;
    }

    /* ロゴ内の画像/リンクの最大幅制限（本番: #logo ul { max-width: 728px }） */
    #header .l-header__logo .c-headLogo {
        max-width: 728px;
        margin: 0 auto;
    }
}

/* 1544px+: .singleページは3カラム（左サイドバー + メイン + 右サイドバー） */
/* 本番: body.single:not(.pdf):not(.drill-answer) #content,#header{grid-template-columns:1fr calc(728px + 8%) 1fr} */
@media screen and (min-width: 1544px) {
    #body_wrap.single:not(.pdf):not(.drill-answer) #header.l-header.-series,
    #body_wrap.single:not(.pdf):not(.drill-answer) #header.l-header.-parallel {
        grid-template-columns: 1fr calc(728px + 8%) 1fr;
    }

    /* ロゴを中央列（2列目）に配置（本番: #header #logo{grid-column:2}） */
    #body_wrap.single:not(.pdf):not(.drill-answer) #header .l-header__logo {
        grid-row: 1;
        grid-column: 2;
        padding: 0;
        justify-content: center;
    }

    /* ナビゲーションを右列（3列目）に配置 */
    #body_wrap.single:not(.pdf):not(.drill-answer) #header .l-header__gnav.c-gnavWrap {
        grid-row: 1;
        grid-column: 3;
        justify-content: flex-start;
        padding-left: 0;
    }

    /* ヘッダーウィジェットエリアを3列目に配置 */
    #body_wrap.single:not(.pdf):not(.drill-answer) #header .w-header {
        grid-row: 1;
        grid-column: 3;
        display: none; /* 3カラム時は非表示 */
    }

    /* SPボタンをグリッドから除外 */
    #body_wrap.single:not(.pdf):not(.drill-answer) #header .l-header__menuBtn,
    #body_wrap.single:not(.pdf):not(.drill-answer) #header .l-header__customBtn {
        display: none;
    }
}

/* 1733px+: 均等分割（1:1）※.singleは3カラム維持 */
/* 本番: #content,#header{grid-template-columns:1fr 1fr} */
@media screen and (min-width: 1733px) {
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill):not(.single):not(.home):not(.category) #header.l-header.-series,
    #body_wrap:not(.single-drill):not(.drill-tax):not(.post-type-archive-drill):not(.single):not(.home):not(.category) #header.l-header.-parallel,
    #body_wrap.drill-answer #header.l-header.-series,
    #body_wrap.drill-answer #header.l-header.-parallel {
        grid-template-columns: 1fr 1fr;
    }
}

/* 1980px+: .singleページは3カラム比率拡大 */
/* 本番: body.single:not(.pdf):not(.drill-answer) #content,#header{grid-template-columns:1fr 1.5fr 1fr} */
@media screen and (min-width: 1980px) {
    #body_wrap.single:not(.pdf):not(.drill-answer) #header.l-header.-series,
    #body_wrap.single:not(.pdf):not(.drill-answer) #header.l-header.-parallel {
        grid-template-columns: 1fr 1.5fr 1fr;
    }
}

/* ヘッダーナビゲーションの太字・文字色白（本番と同じ） */
#header .c-gnav a,
#header .c-gnav a .ttl,
#header .c-gnav span {
    font-weight: bold;
    color: #fff;
}

/* ヘッダーナビゲーションの下線を非表示（本番環境と同様） */
#header .c-gnav > .menu-item > a::after {
    display: none;
}

/* ドリルページ（drill-tax, post-type-archive-drill, single-drill）のヘッダーレイアウト
   本番環境と同じgridレイアウトを使用（display: contentsアプローチ）
   ※ドリル回答ページ(.drill-answer)は他ページと同じgridルールを使用
   ※ブレークポイント1233px: 本番環境と統一（1232px以下は中央寄せ） */
@media screen and (min-width: 1233px) {
    /* ヘッダー自体をgridにする（本番と同じアプローチ）
       heightを130pxに設定（本番1233px+と同じ） */
    #body_wrap.drill-tax #header.l-header,
    #body_wrap.post-type-archive-drill #header.l-header,
    #body_wrap.single-drill:not(.drill-answer) #header.l-header {
        display: grid;
        grid-template-columns: 1fr calc(400px + 3rem);
        align-items: center;
        height: 130px;
        margin-bottom: 1.8rem;
        background: #f1a98a;
    }

    /* .l-header__inner.l-containerをdisplay:contentsにして、グリッド階層から排除 */
    #body_wrap.drill-tax #header .l-header__inner.l-container,
    #body_wrap.post-type-archive-drill #header .l-header__inner.l-container,
    #body_wrap.single-drill:not(.drill-answer) #header .l-header__inner.l-container {
        display: contents;
    }

    #body_wrap.drill-tax #header .l-header__logo,
    #body_wrap.post-type-archive-drill #header .l-header__logo,
    #body_wrap.single-drill:not(.drill-answer) #header .l-header__logo {
        grid-row: 1/2;
        grid-column: 1/2;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        height: 100%;
        margin: 0;
        padding: 0 20px;
    }

    /* .head-kyoukasyo-logo（by ゆみねこの教科書）を横並びに */
    #body_wrap.drill-tax #header .head-kyoukasyo-logo,
    #body_wrap.post-type-archive-drill #header .head-kyoukasyo-logo,
    #body_wrap.single-drill:not(.drill-answer) #header .head-kyoukasyo-logo {
        margin-top: 5px;
        margin-left: -10px;
    }

    /* byテキストを少し下に調整 */
    #body_wrap.drill-tax #header .head-kyoukasyo-logo::before,
    #body_wrap.post-type-archive-drill #header .head-kyoukasyo-logo::before,
    #body_wrap.single-drill:not(.drill-answer) #header .head-kyoukasyo-logo::before {
        position: relative;
        top: 3px;
    }

    /* ゆみねこロゴ画像を少し下に調整 */
    #body_wrap.drill-tax #header .head-kyoukasyo-logo img,
    #body_wrap.post-type-archive-drill #header .head-kyoukasyo-logo img,
    #body_wrap.single-drill:not(.drill-answer) #header .head-kyoukasyo-logo img {
        position: relative;
        top: 3px;
    }

    /* ドリルロゴ画像を少し上に調整 */
    #body_wrap.drill-tax #header .c-headLogo .c-headLogo__img,
    #body_wrap.post-type-archive-drill #header .c-headLogo .c-headLogo__img,
    #body_wrap.single-drill:not(.drill-answer) #header .c-headLogo .c-headLogo__img {
        position: relative;
        top: -10px;
    }

    #body_wrap.drill-tax #header .c-gnavWrap,
    #body_wrap.post-type-archive-drill #header .c-gnavWrap,
    #body_wrap.single-drill:not(.drill-answer) #header .c-gnavWrap {
        grid-row: 1/2;
        grid-column: 2/3;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    #body_wrap.drill-tax #header .c-gnav,
    #body_wrap.post-type-archive-drill #header .c-gnav,
    #body_wrap.single-drill:not(.drill-answer) #header .c-gnav {
        justify-content: flex-start;
        padding-left: 0;
    }

    #body_wrap.drill-tax #header .c-gnav > li:first-child,
    #body_wrap.post-type-archive-drill #header .c-gnav > li:first-child,
    #body_wrap.single-drill:not(.drill-answer) #header .c-gnav > li:first-child {
        padding-left: 0;
    }

    #body_wrap.drill-tax #header .c-gnav > li:first-child > a,
    #body_wrap.post-type-archive-drill #header .c-gnav > li:first-child > a,
    #body_wrap.single-drill:not(.drill-answer) #header .c-gnav > li:first-child > a {
        padding-left: 0;
    }
}

/* 1358px+: メイン固定728px+16%、サイドバー可変（ドリルページ用） */
@media screen and (min-width: 1358px) {
    #body_wrap.drill-tax #header.l-header,
    #body_wrap.post-type-archive-drill #header.l-header,
    #body_wrap.single-drill:not(.drill-answer) #header.l-header {
        grid-template-columns: calc(728px + 16%) 1fr;
    }

    #body_wrap.drill-tax #header .l-header__logo,
    #body_wrap.post-type-archive-drill #header .l-header__logo,
    #body_wrap.single-drill:not(.drill-answer) #header .l-header__logo {
        padding: 0 8%;
    }
}

/* 1733px+: 均等分割（1:1）（ドリルページ用） */
@media screen and (min-width: 1733px) {
    #body_wrap.drill-tax:not(.category) #header.l-header,
    #body_wrap.post-type-archive-drill #header.l-header,
    #body_wrap.single-drill:not(.drill-answer) #header.l-header {
        grid-template-columns: 1fr 1fr;
    }

    /* .l-header__gnavクラスのパディングも解除 */
    #body_wrap.drill-tax:not(.category) #header .l-header__gnav,
    #body_wrap.post-type-archive-drill #header .l-header__gnav,
    #body_wrap.single-drill:not(.drill-answer) #header .l-header__gnav {
        padding-left: 0;
        margin-left: 0;
    }

    /* ナビゲーションリンク内のスパンのパディングも解除 */
    #body_wrap.drill-tax:not(.category) #header .c-gnav > li:first-child > a .ttl,
    #body_wrap.post-type-archive-drill #header .c-gnav > li:first-child > a .ttl,
    #body_wrap.single-drill:not(.drill-answer) #header .c-gnav > li:first-child > a .ttl {
        padding-left: 0;
        margin-left: 0;
    }
}

/* 注意: 以下のページタイプのヘッダーレイアウトは
   上部セクション「ヘッダー全体の配置調整」のgridルールで統一管理
   - single-post（教科書コンテンツ詳細）
   - author（運営者情報）
   - page-id-12279（このサイトについて）

   本番環境と同じブレークポイント:
   - 1233px+: 1fr calc(400px + 3rem)
   - 1358px+: calc(728px + 16%) 1fr
   - 1544px+ (.singleのみ): 1fr calc(728px + 8%) 1fr
   - 1733px+: 1fr 1fr
   - 1980px+ (.singleのみ): 1fr 1.5fr 1fr
*/

/* ========================================
   2. KNOWLEDGE GRID「用語」ページのスタイル
   ======================================== */

/* 表示を強制する（JSによる非表示を打ち消すため!important必須） */
body.single-term #entry,
body.single-term #main,
body.single-term article {
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    max-height: 9999px !important;
    overflow: visible !important;
}

/* 補足情報エリア */
.single-term .term-metadata {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed #eee;
    font-size: 0.9em;
    color: #666;
}

.single-term .term-metadata span {
    margin-right: 1.5em;
}

.single-term .term-metadata .furigana {
    font-style: italic;
}

/* 階層的解説エリア */
.single-term .term-explanation {
    clear: both;
}

#body_wrap.single-term .explanation-block {
    margin-bottom: 2.5rem;
}

#body_wrap.single-term .explanation-block h2 {
    font-size: 1.3em;
    background: #f7f6f4;
    border-left: 6px double #518bcb;
    color: inherit;
    margin-top: 0;
}

.single-term .explanation-block .content-area {
    line-height: 1.8;
    margin-top: 1rem;
    overflow: hidden;
}

.single-term .explanation-block .align-right {
    float: right;
    margin: 0 0 1rem 1.5rem;
    max-width: 300px;
}

.single-term .explanation-block .align-right img {
    border: 1px solid #ddd;
    padding: 3px;
}

.single-term .explanation-block .align-right figcaption {
    font-size: 0.8em;
    text-align: center;
    color: #777;
    margin-top: 0.5rem;
}

/* 関連用語エリア */
.single-term .term-relationships {
    margin-top: 3rem;
    padding: 1.5rem;
    background-color: #f7f6f4;
    border-radius: 8px;
    clear: both;
}

#body_wrap.single-term .term-relationships h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ddd;
    font-size: 1.1em;
}

.single-term .term-relationships ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.single-term .term-relationships li {
    margin-bottom: 0.8rem;
}

.single-term .term-relationships li:last-child {
    margin-bottom: 0;
}

.single-term .term-relationships a {
    margin-right: 1em;
    text-decoration: underline;
}

/* ========================================
   3. 地図記号カードのスタイル
   ======================================== */

.map-symbol-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    font-family: "Hiragino Maru Gothic ProN", "メイリオ", sans-serif;
}

.map-symbol-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

/* 記号の名称 */
.symbol-name {
    display: flex;
    align-items: center;
    font-size: 26px;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 3px dotted #f39c12;
    font-weight: bold;
}

.symbol-name img {
    margin-right: 15px;
    width: 50px;
    height: auto;
}

.symbol-name rt {
    font-size: 14px;
    font-weight: normal;
    color: #7f8c8d;
}

/* メタ情報（学習レベル・カテゴリー） */
.symbol-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.symbol-meta span {
    font-size: 14px;
    padding: 5px 12px;
    background-color: #ecf0f1;
    color: #7f8c8d;
    border-radius: 20px;
}

/* 各セクションの小見出し */
.symbol-description h4,
.symbol-origin h4,
.symbol-memo h4 {
    font-size: 18px;
    color: #34495e;
    margin-top: 20px;
    margin-bottom: 8px;
    padding-left: 12px;
    border-left: 6px solid #3498db;
}

/* 各セクションの文章 */
.symbol-description p,
.symbol-origin p,
.symbol-memo p {
    line-height: 1.8;
    color: #333;
    margin: 0;
}

/* 成り立ち・由来の囲み */
.symbol-origin {
    background-color: #fffacd;
    border: 1px dashed #f1c40f;
    border-radius: 8px;
    padding: 15px 20px;
    margin-top: 20px;
}

.symbol-origin h4 {
    border-left-color: #f1c40f;
}

/* 先生からのひとことメモの囲み */
.symbol-memo {
    background-color: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    padding: 15px 20px;
    margin-top: 20px;
}

.symbol-memo h4 {
    border-left-color: #4caf50;
}

/* ========================================
   4. トップページ用スタイル
   ======================================== */

/* バナー（本番環境と統一） */
.drill-banner {
    margin-top: 1.5rem;
}

.drill-banner a:hover {
    opacity: 0.9;
}

.drill-banner img {
    width: 100%;
    height: auto;
}

#right-side .drill-banner + h1,
#side .drill-banner + h1 {
    margin-top: 1.5rem;
}

/* テーブル共通 */
/* 詳細度(1,1,0): #body_wrap .unit で親テーマを上回る */
#body_wrap .unit {
    margin: 1.5rem auto;
    border-collapse: collapse;
    width: 100%;
    border: none;
}

#body_wrap .unit tr {
    border: none;
    background: transparent;
}

#body_wrap .unit th {
    color: #000;
    font-weight: 700;
    text-align: left;
    border-top: 4px double #8bbabb;
    border-bottom: 4px double #8bbabb;
    position: relative;
    padding: 0.7rem;
}

#body_wrap .unit td {
    padding: 0.7rem;
    border: none;
    border-bottom: 1px solid #ddd;
}

/* カテゴリページのテーブル枠線を打ち消し（トップページと同様、SWELL上書き） */
#body_wrap .post_content .unit td,
#body_wrap .post_content .unit th {
    border: none;
}

/* 学年行（tbody th）の上下線を復活 */
#body_wrap .post_content .unit tbody th {
    border-top: 4px double #8bbabb;
    border-bottom: 4px double #8bbabb;
}

#body_wrap .unit thead th,
#body_wrap .post_content .unit thead th {
    font-size: 1.2rem;
    background-color: transparent;
    border: none;
    border-top: 4px double #8bbabb;
    border-bottom: 4px double #8bbabb;
}

.unit thead th a {
    color: #518bcb;
    font-weight: 700;
    text-decoration: none;
}

.unit tbody th {
    font-size: 16px;
    white-space: nowrap;
    position: relative;
    padding: .5rem;
}

.unit a {
    color: #518bcb;
    text-decoration: none;
}

.unit a:hover {
    color: #e54c4c;
}

/* キャラクター画像（thの上端ボーダーラインを基準に配置） */
.unit-primary:before {
    content: '';
    background: url('/wp-content/themes/swell_child/img/shougakusei.png') no-repeat;
    background-size: contain;
    width: 159px;
    height: 88.5px;
    position: absolute;
    top: -2px;
    right: 0;
    transform: translateY(-100%);
}

.unit-junior:before {
    content: '';
    background: url('/wp-content/themes/swell_child/img/chugakusei.png') no-repeat;
    background-size: contain;
    width: 159px;
    height: 88.5px;
    position: absolute;
    top: -2px;
    right: 0;
    transform: translateY(-100%);
}

.unit-high:before {
    content: '';
    background: url('/wp-content/themes/swell_child/img/koukousei.png') no-repeat;
    background-size: contain;
    width: 159px;
    height: 88.5px;
    position: absolute;
    top: -2px;
    right: 0;
    transform: translateY(-100%);
}


/* 全学年の教科で探す */
.post_content h1 {
    margin-top: 3rem;
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
}

/* トップページ：メインビジュアルとスライダーを非表示（SWELL上書き） */
/* 詳細度(1,1,0): #body_wrap.home で親テーマを上回る */
#body_wrap.home .p-mainVisual,
#body_wrap.home .p-topSlider,
#body_wrap.home .p-postSlider,
#body_wrap.home .c-postSlider,
#body_wrap.home [class*="Slider"],
#body_wrap.home [class*="mainVisual"] {
    display: none;
}

/* サイドバーの基本スタイルはグローバルセクション（上部）で定義済み */

/* ========================================
   5. ドリルページ用スタイル
   ======================================== */

/* ドリルページ用ヘッダー色（SWELL上書き） */
/* #header で詳細度UP */
.drill-tax #header,
.drill-tax #header .l-header__inner,
.post-type-archive-drill #header,
.post-type-archive-drill #header .l-header__inner {
    background-color: #f1a98a;
}

/* ドリルページ全体の背景をオレンジに（ヘッダーのmask-image対策） */
#body_wrap.drill-tax,
#body_wrap.post-type-archive-drill {
    background-color: #f1a98a;
}

/* ドリルタクソノミーページ（税別ページ）の背景を白に（コンテンツエリア用） */
#body_wrap.drill-tax.tax-unit,
#body_wrap.drill-tax.tax-subject,
#body_wrap.drill-tax.tax-school_year {
    background-color: #fff;
}

/* ドリルタクソノミーページのヘッダー下の楕円装飾を無効化 */
.drill-tax.tax-unit #header::after,
.drill-tax.tax-subject #header::after,
.drill-tax.tax-school_year #header::after,
.drill-tax.tax-unit #header::before,
.drill-tax.tax-subject #header::before,
.drill-tax.tax-school_year #header::before {
    display: none;
    content: none;
}

/* ヘッダーの下部マージン/パディング/影を削除 */
.drill-tax.tax-unit #header,
.drill-tax.tax-subject #header,
.drill-tax.tax-school_year #header {
    margin-bottom: 0;
    padding-bottom: 0;
    box-shadow: none;
}

/* SWELLのヘッダー下部装飾要素を非表示 */
.drill-tax.tax-unit .l-topTitleArea,
.drill-tax.tax-subject .l-topTitleArea,
.drill-tax.tax-school_year .l-topTitleArea {
    display: none;
}

/* ドリルタクソノミーページのtaxonomy-contentをヘッダー直下に配置 */
.drill-tax.tax-unit .taxonomy-page-layout,
.drill-tax.tax-subject .taxonomy-page-layout,
.drill-tax.tax-school_year .taxonomy-page-layout {
    margin-top: 0;
}

/* ドリルタクソノミーページのメインコンテンツ上部パディングを調整 */
.drill-tax.tax-unit .taxonomy-page-main,
.drill-tax.tax-subject .taxonomy-page-main,
.drill-tax.tax-school_year .taxonomy-page-main {
    padding-top: 2rem;
}

.drill-tax #header .c-gnav a,
.drill-tax #header .c-gnav a .ttl {
    color: #fff;
}

.drill-tax #header .c-headLogo__link {
    color: #fff;
}

/* ドリルページ用フッター色（SWELL上書き） */
/* 詳細度(1,2,0): #body_wrap.drill-tax #footer で親テーマを上回る */
#body_wrap.drill-tax #footer.l-footer {
    background: radial-gradient(110% 30% at top, #fff 50%, #f1a98a 51%);
}

#body_wrap.drill-tax #footer.l-footer,
#body_wrap.drill-tax #footer.l-footer a {
    color: #fff;
}

/* ドリルアーカイブページ用フッター色（本番と同じ） */
#body_wrap.post-type-archive-drill #footer.l-footer {
    background: radial-gradient(110% 30% at top, #fff 50%, #f1a98a 51%);
}
#body_wrap.post-type-archive-drill #footer.l-footer,
#body_wrap.post-type-archive-drill #footer.l-footer a {
    color: #fff;
}

/* ドリルページのテーブル罫線を削除（SWELL上書き） */
#body_wrap.drill-tax table.unit,
#body_wrap.drill-tax table.unit th,
#body_wrap.drill-tax table.unit td {
    border: none;
}

#body_wrap.drill-tax table.unit {
    border-collapse: collapse;
    margin-top: 9rem;
}

/* ドリルページのテーブルヘッダー行（小学校など）は下線のみ（本番と同じ） */
#body_wrap.drill-tax table.unit thead th,
#body_wrap.post-type-archive-drill table.unit thead th {
    border-top: none;
    border-bottom: 4px double #8bbabb;
}

/* ドリルページの学年行（tbody th）は上下に線（本番と同じ） */
#body_wrap.drill-tax table.unit tbody th,
#body_wrap.post-type-archive-drill table.unit tbody th {
    border-top: 4px double #8bbabb;
    border-bottom: 4px double #8bbabb;
}

/* タクソノミーテーブルの行背景色を削除し、上下の線で区切る */
#body_wrap.drill-tax table.unit tr,
#body_wrap.drill-tax table.unit tbody tr,
#body_wrap table.unit tr,
#body_wrap table.unit tbody tr {
    background: transparent;
}

#body_wrap table.unit td,
#body_wrap table.unit th,
#body_wrap.drill-tax table.unit td,
#body_wrap.drill-tax table.unit th {
    background: transparent;
}

/* 行背景色を透明に（本番と同じ） */

/* ドリルページのパンくずリストを非表示 */
.drill-tax .p-breadcrumb {
    display: none;
}

/* ドリルページのロゴレイアウト */
.drill-tax .l-header__logo {
    display: flex;
    align-items: center;
    gap: 0;
}

.drill-tax .c-headLogo {
    margin: 0;
}

/* 「by ゆみねこの教科書」ロゴのスタイル */
.drill-tax .head-kyoukasyo-logo {
    display: inline-flex;
    align-items: center;
    position: relative;
    align-self: center;
    margin-top: 22px;
    margin-left: 0;
}

.drill-tax .head-kyoukasyo-logo::before {
    content: 'by';
    color: #fff;
    font-weight: 900;
    -webkit-text-stroke: 0.5px #fff;
    align-self: flex-end;
    margin-right: 0;
    padding: 0;
}

#body_wrap.drill-tax .head-kyoukasyo-logo img {
    display: block;
    max-width: 150px;
    margin-left: 5px;
}

/* 「by ゆみねこの教科書」ロゴのホバー効果 */
.drill-tax .head-kyoukasyo-logo {
    transition: opacity 0.25s ease;
}

.drill-tax .head-kyoukasyo-logo:hover {
    opacity: 0.7;
}

/* ドリル問題ブロックの初期非表示 */
.wp-block-my-custom-question-block {
    counter-reset: questionCounter;
    margin-top: 2rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

body.single:not(.drill-answer) .wp-block-my-custom-question-block {
    transition: max-height 3s ease-in-out;
    overflow: hidden;
    max-height: 0;
}

.wp-block-my-custom-question-block.question-block-transition {
    overflow: hidden;
    transition: max-height 2s ease-in-out;
}

.wp-block-my-custom-question-child {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #f7f6f4;
}

.wp-block-my-custom-question-child p:first-child {
    position: relative;
    padding-left: 3em;
}

.wp-block-my-custom-question-child p:first-child::before {
    counter-increment: questionCounter;
    content: counter(questionCounter);
    font-weight: 700;
    position: absolute;
    left: 0;
    top: 0;
    color: #fff;
    background: #f1a98a;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    text-align: center;
    line-height: 36px;
    font-size: 1.5rem;
}

.wp-block-my-custom-question-child p {
    margin-left: 20px;
}

.wp-block-my-custom-question-child img {
    max-height: 300px;
}

.wp-block-my-custom-question-child figure {
    margin: 0;
}

.wp-block-my-custom-question-child p + figure {
    margin-top: 1rem;
    text-align: center;
}

/* 問題ブロック内のテーブルスタイル（本番環境と統一） */
.wp-block-my-custom-question-child .wp-block-table th {
    text-align: center;
}

/* 正解・不正解の表示（本番環境と統一） */
.correct-answer .question-child-correct-answer {
    color: #1e8e3e;
    font-weight: 700;
}

.incorrect-answer .question-child-correct-answer {
    color: #d93025;
    font-weight: 700;
}

.correct-answer .question-child-answer {
    border: 1px solid #1e8e3e;
    background: #e6f4ea;
    margin-bottom: 1.5rem;
    color: #1e8e3e;
}

.incorrect-answer .question-child-answer {
    border: 1px solid #d93025;
    background: #fce8e6;
    margin-bottom: 1.5rem;
    color: #d93025;
}

.correct-answer .question-child-choices,
.incorrect-answer .question-child-choices {
    margin-bottom: 1.5rem;
}

.question-child-correct-answer {
    padding-left: 2rem;
    position: relative;
}

.correct-answer .question-child-correct-answer::before {
    content: "〇";
    font-weight: 700;
    position: absolute;
    left: 0;
    top: 0;
    color: #1e8e3e;
}

.incorrect-answer .question-child-correct-answer::before {
    content: "✕";
    font-weight: 700;
    position: absolute;
    left: 0;
    top: 0;
    color: #d93025;
}

/* テスト結果コンテナ（本番環境と統一） */
.test-results-container {
    background-color: #8bbabb;
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: #fff;
    text-align: center;
}

.test-results-container div:first-child {
    font-weight: 700;
    margin: 0 1rem 1rem;
    padding: 1rem 0;
    border-bottom: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.test-results-container div:nth-child(2) {
    display: inline-block;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.test-results-container div:last-child {
    display: inline-block;
}

.test-result {
    display: block;
    margin-top: 1rem;
}

.test-result-number {
    font-size: 1.5rem;
}

.result-correct {
    font-size: 4rem;
    color: #f6f611;
}

/* バウンスアニメーション（本番環境と統一） */
@keyframes bounceIn {
    0% {
        opacity: 0;
        -webkit-transform: scale(.3);
        -ms-transform: scale(.3);
        transform: scale(.3);
    }
    50% {
        opacity: 1;
        -webkit-transform: scale(1.05);
        -ms-transform: scale(1.05);
        transform: scale(1.05);
    }
    70% {
        -webkit-transform: scale(.9);
        -ms-transform: scale(.9);
        transform: scale(.9);
    }
    100% {
        opacity: 1;
        -webkit-transform: scale(1);
        -ms-transform: scale(1);
        transform: scale(1);
    }
}

/* 回答入力欄（本番環境と統一） */
.question-child-answer {
    margin-top: 1rem;
    width: calc(100% - 3rem);
    justify-self: center;
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    background: #fff;
    box-shadow: inset 0 1px 4px rgb(0 0 0 / 6%);
    border-radius: 4px;
    border: 1px solid hsla(0, 0%, 78%, 0.5);
    padding: 1rem;
    box-sizing: border-box;
    font-size: 1rem;
}

.question-child-answer:focus-visible {
    outline: 3px solid #8bbabb;
}

/* 選択肢スタイル（本番環境と統一） */
.question-child-choices {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 1.5rem;
}

.question-child-choices label {
    position: relative;
    padding-left: 20px;
    cursor: pointer;
}

.question-child-choices input[type=radio] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #518bcb;
    border-radius: 50%;
    outline: 0;
    cursor: pointer;
    margin: 0;
}

.question-child-choices input[type=radio]:checked {
    background-color: transparent;
    border: 2px solid #518bcb;
}

.question-child-choices input[type=radio]:checked::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 9px;
    height: 9px;
    background-color: #518bcb;
    border-radius: 50%;
    box-sizing: border-box;
}

.drill-answer .question-child-choices input[type=radio] {
    border: 2px solid #c1c1c1;
}

.drill-answer .question-child-choices input[type=radio]:checked {
    border: 2px solid #c1c1c1;
}

.drill-answer .question-child-choices input[type=radio]:checked::before {
    background-color: #c1c1c1;
}

/* シェアボタン（本番環境と統一） */
.sns-share-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 1.5rem;
}

.share-button-twitter,
.share-button-facebook,
.share-button-line {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    display: block;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    margin-top: 1.5rem;
    width: 100%;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
}

/* 個別SNSボタン色（基本スタイルより後に定義して上書き） */
/* 詳細度(1,2,1): #body_wrap .container button.class で親テーマを上回る */
#body_wrap button.share-button-twitter,
#body_wrap .sns-share-container button.share-button-twitter,
#body_wrap .test-share-container button.share-button-twitter {
    background: #000;
}

#body_wrap button.share-button-facebook,
#body_wrap .sns-share-container button.share-button-facebook,
#body_wrap .test-share-container button.share-button-facebook {
    background: #3b5998;
}

#body_wrap button.share-button-line,
#body_wrap .sns-share-container button.share-button-line,
#body_wrap .test-share-container button.share-button-line {
    background: #00c300;
}

.test-share-container button:hover {
    opacity: 0.7;
}

.test-share-container p {
    text-align: center;
    margin-bottom: 1rem;
}

.sns-share-heading {
    margin-bottom: 0;
}

/* テストボタンコンテナ（本番環境と統一） */
.test-buttons-container {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 1.5rem;
}

.test-buttons-container button,
.sub-buttons-container button,
.test-share-container button {
    -webkit-appearance: none;
    appearance: none;
    background: #518bcb;
    border: none;
    display: block;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    margin-top: 1.5rem;
    width: 100%;
    height: 38px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-sizing: border-box;
}

.test-buttons-container button:hover {
    opacity: 0.7;
}

.sub-buttons-container {
    margin-bottom: 1.5rem;
    gap: 1.5rem;
}

.sub-buttons-container button {
    flex-basis: 50%;
}

.sub-buttons-container button:hover {
    opacity: 0.9;
}

.sub-buttons-container button:first-child {
    background: #009688;
    position: relative;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sub-buttons-container .button-icon-and-text {
    display: inline-flex;
    align-items: center;
}

.sub-buttons-container .button-icon {
    background: url(/wp-content/themes/swell_child/img/repeat.svg) no-repeat;
    background-size: contain;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    filter: brightness(0) invert(1);
}

/* ドリルページのh1スタイル（本番環境と統一） */
.single-drill article > h1,
.single-drill .post_content > h1:first-of-type {
    background: #f1a98a;
    color: #fff;
    padding: 1.5rem;
    border-radius: 1.5rem;
    margin: 0 0 1rem;
}

/* 導入文 */
p.intro-text {
    margin-top: 1.5rem;
}

/* 過去成績テーブル（本番環境と統一） */
.result-list {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.result-list th {
    text-align: left;
    padding: 0.5rem;
}

.result-list th,
.result-list td {
    padding: 0.5rem;
    border: 1px solid #ddd;
    text-align: left;
}

@media screen and (min-width: 1233px) {
    .result-list th {
        padding: 0.7rem;
    }
}

/* ドリル進捗バッジ（本番環境と統一） */
.drill-progress {
    background: #f1a98a;
    color: #fff;
    padding: 0.5rem 2rem;
    border-radius: 2rem;
    display: inline-block;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.drill-answer .drill-progress {
    margin-bottom: 0.5rem;
}

.drill-status {
    font-weight: 700;
}

.drill-status.status-done {
    color: green;
}

.drill-status.status-pending {
    color: red;
}

/* セクション番号（本番環境と統一） */
.section-number {
    font-weight: 700;
    color: #f1a98a;
    background: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    text-align: center;
    line-height: 36px;
    font-size: 1.5rem;
    display: inline-block;
    margin-right: 1rem;
}

/* テスト開始・終了ボタン（本番環境と統一） */
@keyframes shiny {
    0% {
        transform: scale(0) rotate(25deg);
        opacity: 0;
    }
    50% {
        transform: scale(1) rotate(25deg);
        opacity: 1;
    }
    100% {
        transform: scale(50) rotate(25deg);
        opacity: 0;
    }
}

/* 詳細度(1,1,0): #body_wrap .button で親テーマを上回る */
#body_wrap .start-test-button,
#body_wrap .end-test-button {
    background: #ce6363;
    display: block;
    color: #fff;
    padding: 1rem;
    border-radius: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    font-weight: bold;
}

.start-test-button::after,
.end-test-button::after {
    content: '';
    position: absolute;
    top: -100px;
    left: -100px;
    width: 50px;
    height: 50px;
    background-image: linear-gradient(100deg, rgba(255,255,255,0) 10%, rgba(255,255,255,1) 100%, rgba(255,255,255,0) 0);
    animation-name: shiny;
    animation-duration: 3s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.start-test-button {
    margin-top: 2rem;
}

.start-test-button:hover,
.end-test-button:hover {
    text-decoration: none;
    opacity: 0.9;
}

/* 解答ページ用スタイル（JSによる非表示を打ち消すため!important必須） */
.drill-answer .wp-block-my-custom-question-block {
    max-height: none !important;
    overflow: visible !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.drill-answer .wp-block-my-custom-question-child {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 追加問題コンテナ（初期状態で非表示） */
.additional-questions-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

/* すべての解答・解説を表示するリンク（本番環境と統一） */
.show-all-link {
    display: block;
    margin-bottom: 0.5rem;
    margin-top: -0.5rem;
    text-align: center;
    color: #518bcb;
    text-decoration: underline;
    cursor: pointer;
}

/* アコーディオンアイコン */
.accordion-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    font-size: 2rem;
}

/* サイドバーのナビゲーションリンク */
.drill-nav-links {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5em 0;
}

.drill-nav-links li {
    margin-bottom: 0.5em;
    font-size: 18px;
    font-weight: 700;
}

.drill-nav-links a {
    color: #518bcb;
    text-decoration: none;
    font-weight: 700 !important;
}

/* ドリル詳細ページ：ナビリンクの文字サイズを18pxに固定 */
#body_wrap.single-drill #sidebar .drill-nav-links li {
    font-size: 18px !important;
    font-weight: 700;
}

#body_wrap.single-drill #sidebar .drill-nav-links a {
    font-weight: 700 !important;
}

.drill-nav-links a:hover {
    text-decoration: underline;
}

/* ドリルリスト */
.drill-list {
    padding-left: 1.5em;
    margin: 0;
}

.drill-list li {
    margin-bottom: 0.3em;
    font-size: 18px;
}

/* ドリル詳細ページ：ドリルリストの文字サイズを18pxに固定 */
#body_wrap.single-drill #sidebar .drill-list li {
    font-size: 18px !important;
}

.drill-list .unit-active {
    color: #e74c3c;
    font-weight: bold;
    font-size: 18px;
}

.drill-list a {
    color: #518bcb;
    text-decoration: none;
}

/* 右側に固定表示する過去成績エリア */
#right-sidebar-fixed {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 280px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: transparent;
    padding: 15px;
    border-radius: 4px;
    box-shadow: none;
    z-index: 100;
}

/* 詳細度(2,0,1): #body_wrap #right-sidebar-fixed h2 で親テーマを上回る */
#body_wrap #right-sidebar-fixed h2 {
    font-size: 27px;
    font-weight: bold;
    margin: 0 0 1rem 0;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
}

/* 回答ページの過去成績見出し（JavaScriptが追加するh1） */
#right-sidebar-fixed #previous-results h1 {
    font-size: 1.5em;
    margin: 0 0 1em 0;
    padding: 0;
    background: transparent;
    color: inherit;
}

/* 右サイドバーの検索窓（回答ページ用） */
/* 詳細度(2,1,0): #body_wrap #right-sidebar-fixed .c-searchForm で親テーマを上回る */
#body_wrap #right-sidebar-fixed .c-searchForm {
    width: 600px;
    max-width: 600px;
    margin-bottom: 1.5rem;
}

#right-sidebar-fixed .result-list {
    width: 100%;
    border-collapse: collapse;
}

#right-sidebar-fixed .result-list th,
#right-sidebar-fixed .result-list td {
    padding: 8px 5px;
    border: none;
    text-align: left;
    font-size: 15px;
}

#right-sidebar-fixed .result-list th {
    background: transparent;
    font-weight: bold;
}

/* 右サイドバー（本番環境と統一、wide screens用） */
#right-side {
    display: none;
}

@media screen and (min-width: 1544px) {
    #right-side {
        display: block;
        position: sticky;
        top: 0;
        right: 0;
        z-index: 11;
        align-self: start;
        width: 100%;
        min-height: 100vh;
        padding: 1.5rem 1.5rem 0 1.5rem;
        margin-bottom: 1rem;
        background: #f7f6f4;
    }

    /* サイドバーの文字サイズ（本番: #right-side,body.single:not(.pdf):not(.drill-answer) #side{font-size:.9rem}） */
    #right-side,
    body.single:not(.pdf):not(.drill-answer) .l-sidebar,
    body.single:not(.pdf):not(.drill-answer) #sidebar {
        font-size: .9rem;
    }

    #right-side h1 {
        margin: 0;
        text-align: left;
    }

    .single-drill #right-side h1 {
        margin-bottom: 1rem;
    }

    #right-side #right-side-inside {
        padding-right: 1.5rem;
        padding-bottom: calc(1.5rem + 180px);
        height: 100vh;
        overflow-y: scroll;
    }

    #right-side p {
        margin-bottom: 2rem;
        line-height: 2;
    }
}

/* サイドバーのドリルリスト 済/未マーク */
.drill-list li::before {
    content: attr(data-status);
    display: inline-block;
    width: 1.5em;
    margin-right: 0.3em;
    font-size: 0.85em;
    font-weight: bold;
}

.drill-list li[data-status="済"]::before {
    color: #4CAF50;
}

.drill-list li[data-status="未"]::before {
    color: #f44336;
}

.drill-list li.unit-active::before {
    content: attr(data-status);
}

/* ドリルサイドバーのリストスタイル（本番環境と統一） */
.single-drill #side-inside ol {
    padding-left: 4em;
    list-style: decimal;
    margin-bottom: 2rem;
}

.single-drill #side-inside ol li {
    position: relative;
    line-height: 1.4;
    margin: 0.8rem 0;
}

.single-drill #side-inside ol li::before {
    content: attr(data-status);
    position: absolute;
    left: -3.8em;
    top: 0;
    color: red;
    font-weight: 700;
    width: 1.5em;
    text-align: center;
}

.single-drill #side-inside ol li[data-status="済"]::before {
    color: green;
}

/* 他の問題を解くリスト（本番環境と統一） */
#other-drill {
    list-style: none;
    padding-left: 0;
    counter-reset: otherCounter;
}

#other-drill li {
    display: flex;
    align-items: center;
}

#other-drill li img {
    max-width: 40%;
    margin-right: 1rem;
}

#other-drill li a:hover img {
    opacity: 0.9;
}

#other-drill li .drill-status {
    position: relative;
    margin-right: 2.5em;
}

#other-drill li .drill-status::after {
    counter-increment: otherCounter;
    content: counter(otherCounter) ".";
    font-weight: 700;
    position: absolute;
    left: 1em;
    top: 50%;
    color: #424242;
    font-weight: 400;
    transform: translate(50%, -50%);
}

#other-drill li.active-post {
    font-weight: bold;
    color: #e54c4c;
}

/* パンくずリスト */
#breadcrumb {
    margin-bottom: 1em;
    font-size: 0.9em;
}

#breadcrumb ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.3em;
}

#breadcrumb li {
    display: inline-block;
    padding: 0;
}

#breadcrumb a {
    color: #518bcb;
    text-decoration: none;
}

#breadcrumb a:hover {
    text-decoration: underline;
}

/* ドリル詳細ページのパンくずリスト：18px */
#body_wrap.single-drill #breadcrumb {
    font-size: 18px;
}

/* ドリル一覧テーブル（本番.unitスタイルに準拠） */
.drill-unit-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem auto;
    font-size: 94%;
    line-height: 1.5;
}

/* カテゴリページ/アーカイブページのテーブルマージン調整 */
body.category .drill-unit-table,
body.archive .drill-unit-table {
    margin-top: 7rem;
}

.drill-unit-table th,
.drill-unit-table td {
    border: none;
    padding: 0.5rem;
    text-align: left;
    vertical-align: middle;
}

/* ヘッダー行スタイル（本番: border-bottom: 4px double #8bbabb） */
.drill-unit-table thead th {
    background: transparent;
    color: #000;
    font-weight: 700;
    border-bottom: 4px double #8bbabb;
    position: relative;
}

/* カテゴリページではヘッダー行上部にもボーダー追加 */
body.category .drill-unit-table thead th {
    border-top: 4px double #8bbabb;
}

.drill-unit-table thead th a {
    color: #000;
    text-decoration: none;
}

.drill-unit-table thead th a:hover {
    text-decoration: underline;
}

.drill-unit-table tbody td {
    background: transparent;
}

.drill-unit-table tbody td a {
    color: #518bcb;
    font-weight: 700;
    text-decoration: none;
}

.drill-unit-table tbody td a:hover {
    text-decoration: underline;
}

/* 偶数行の背景色を削除（本番と同じ） */
.drill-unit-table tbody tr:nth-child(even) td {
    background: transparent;
}

/* PC用パディング調整 */
@media screen and (min-width: 1233px) {
    .drill-unit-table th,
    .drill-unit-table td {
        padding: 0.7rem;
    }
}

/* カテゴリページのキャラクター画像（本番.unit-primary/junior/highと同じ） */
/* テーブル全体にoverflow: visibleを設定 */
body.category .drill-unit-table {
    position: relative;
    overflow: visible;
}

body.category .drill-unit-table thead th:last-child {
    position: relative;
    overflow: visible;
}

/* 小学校カテゴリページの生徒画像 */
body.category-primary-school .drill-unit-table thead th:last-child::before {
    content: '';
    display: block;
    background: url('/wp-content/themes/swell_child/img/shougakusei.png') no-repeat;
    background-size: contain;
    width: 159px;
    height: 88.5px;
    position: absolute;
    bottom: 100%;
    right: 0;
    z-index: 10;
}

/* 中学校カテゴリページの生徒画像 */
body.category-junior-high-school .drill-unit-table thead th:last-child::before {
    content: '';
    display: block;
    background: url('/wp-content/themes/swell_child/img/chugakusei.png') no-repeat;
    background-size: contain;
    width: 159px;
    height: 88.5px;
    position: absolute;
    bottom: 100%;
    right: 0;
    z-index: 10;
}

/* 高等学校カテゴリページの生徒画像 */
body.category-high-school .drill-unit-table thead th:last-child::before {
    content: '';
    display: block;
    background: url('/wp-content/themes/swell_child/img/koukousei.png') no-repeat;
    background-size: contain;
    width: 159px;
    height: 88.5px;
    position: absolute;
    bottom: 100%;
    right: 0;
    z-index: 10;
}

/* モバイルではキャラクター画像を非表示 */
@media screen and (max-width: 599px) {
    body.category-primary-school .drill-unit-table thead th:last-child::before,
    body.category-junior-high-school .drill-unit-table thead th:last-child::before,
    body.category-high-school .drill-unit-table thead th:last-child::before {
        display: none;
    }
}

/* カテゴリー画像（テーブルヘッダー行の右上に配置） */
/* post_contentを基準にして配置 */
body.category .post_content {
    position: relative;
}

body.category .drill-category-image {
    position: absolute;
    top: 7rem; /* margin-top: 7remに合わせる */
    right: 0;
    margin: 0;
    z-index: 10;
    transform: translateY(-100%);
}

body.category .drill-category-image img {
    width: 159px;
    height: auto;
    max-width: none;
}

/* モバイルではカテゴリー画像を非表示 */
@media screen and (max-width: 599px) {
    body.category .drill-category-image {
        display: none;
    }
}

/* ドリルページで空のSWELLサイドバーを非表示（SWELL上書き） */
/* 詳細度(1,2,0): #body_wrap.drill-tax .l-sidebar で親テーマを上回る */
#body_wrap.drill-tax .l-sidebar:empty,
#body_wrap.drill-tax .l-sidebar .w-sidebar:empty {
    display: none;
}

#body_wrap.drill-tax .l-content > .l-sidebar ~ .l-sidebar {
    display: none;
}

#body_wrap.drill-tax .l-sidebar:nth-of-type(2) {
    display: none;
}

/* SWELLの追尾サイドバーも非表示（SWELL上書き） */
#body_wrap.drill-tax .p-fixSidebar,
#body_wrap.drill-tax #fix_sidebar {
    display: none;
}

#body_wrap.drill-tax .l-sidebar .w-sidebar:not(:has(*)) {
    display: none;
}

#body_wrap.drill-tax .l-sidebar:has(.w-sidebar:empty),
#body_wrap.drill-tax .l-sidebar:not(:has(.c-widget)):not(.drill-sidebar) {
    display: none;
}

/* ========================================
   6. サイドバー追尾（スクロール時に固定）
   ======================================== */

.l-sidebar__inner,
.l-sidebar > .w-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* ========================================
   7. パンくずリスト非表示（SWELL上書き）
   詳細度(1,1,0): #body_wrap .p-breadcrumb で親テーマを上回る
   ======================================== */

#body_wrap .p-breadcrumb {
    display: none;
}

/* ========================================
   8. 単元リストの番号表示
   ======================================== */

ol.textbook-list {
    list-style-type: decimal;
    padding-left: 2em;
}

ol.textbook-list li {
    list-style-type: decimal;
}

/* サイドバー単元リストのアクティブ状態（本番と統一） */
ol.textbook-list li.unit-active {
    color: #e54c4c;
    font-weight: bold;
}

/* ========================================
   9. Web広告プレビュー
   ======================================== */

#web-ad-preview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 800px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 2px solid #ccc;
}

.web-ad-slot {
    height: 80px;
    border: 1px dashed #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #999;
    background: #fff;
    overflow: hidden;
}

.web-ad-slot.has-logo {
    border: 2px solid #0073aa;
}

.web-ad-slot.has-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ========================================
   10. Web広告枠（ヘッダー下）
   ======================================== */

.yumineko-web-ads {
    background: #fff;
    padding: 0;
    margin-top: 20px;
    margin-bottom: 10px;
}

.yumineko-web-ads .web-ads-inner {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 728px;
    margin: 0 auto;
    padding: 0;
}

.yumineko-web-ads .web-ad-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}

.yumineko-web-ads .web-ad-item a {
    display: block;
    width: 100%;
}

.yumineko-web-ads .web-ad-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* 教科書ページの広告上部余白（本番環境と同じく余白なし） */
.top-page-main .yumineko-web-ads,
.taxonomy-page-main .yumineko-web-ads {
    margin-top: 0;
    padding-top: 0;
}

/* ========================================
   11. トップページ専用レイアウト（フルワイド）
   ======================================== */

/* トップページの上部余白を削除（SWELL上書き） */
/* ホームページの上部余白を削除（SWELL上書き） */
/* 詳細度(2,1,0): #body_wrap.home #content.l-content で親テーマを上回る */
#body_wrap.home #content.l-content {
    margin-top: -3rem;
}

/* 詳細度(2,2,0): #body_wrap.home #content で親テーマを上回る */
#body_wrap.home #content .l-mainContent,
#body_wrap.home #content .post_content,
#body_wrap.home #content .l-sidebar,
#body_wrap.home #content aside#sidebar,
#body_wrap.home #content .l-content__wrap {
    padding-top: 0;
    margin-top: 0;
}

.top-page-layout {
    display: block;
    background: #fff;
    margin-top: -3rem;
}

/* ドリルカテゴリページ（.drill-tax .top-page-layout）のレイアウト */
/* 本番環境: 1233px以上でgrid、1232px以下でblock */
/* グリッドレイアウトは下部の1233px+メディアクエリで定義 */

/* ドリルカテゴリページ：サイドバー（本番環境: #side）の基本スタイル */
/* 本番環境: 1233px以上でグリッド表示、1232px以下で非表示 */
/* 1232px以下での非表示は下部のメディアクエリで定義 */
#body_wrap.drill-tax #side,
#body_wrap.drill-tax .drill-sidebar,
#body_wrap.drill-tax .top-page-layout #side {
    background: #f7f6f4;
    padding: 1.5rem 20px;
}

/* ドリルカテゴリページ：検索フォームのスタイル（本番環境準拠） */
#body_wrap.drill-tax #side .c-searchForm,
#body_wrap.drill-tax .drill-sidebar .c-searchForm {
    max-width: 35em;
    width: 100%;
    position: relative;
    margin: 1.5rem 0;
}

#body_wrap.drill-tax #side .c-searchForm__s,
#body_wrap.drill-tax .drill-sidebar .c-searchForm__s {
    height: 50px;
    border-radius: 1rem;
    font-size: 1rem;
    padding: .5rem 50px .5rem 1rem;
    line-height: 2;
    border: 1px solid hsla(0,0%,78%,.5);
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff;
}

#body_wrap.drill-tax #side .c-searchForm__submit,
#body_wrap.drill-tax .drill-sidebar .c-searchForm__submit {
    position: absolute;
    right: 0;
    top: 0;
    width: 50px;
    height: 100%;
    border-radius: 0 1rem 1rem 0;
    background-color: #518bcb;
    border: none;
    cursor: pointer;
    padding: 0;
}

.top-page-main {
    background: #fff;
}

/* PC用（1233px以上）: トップページメインの上部余白 */
@media screen and (min-width: 1233px) {
    .top-page-main {
        padding: 4rem 0 2.5rem;
    }
}

/* カテゴリページの上部余白を削除（トップページと同じ方法、SWELL上書き） */
/* 詳細度(2,1,0): #body_wrap#content.l-content で親テーマを上回る */
#body_wrap.category #content.l-content,
#body_wrap.category #content.l-content.l-container,
#body_wrap.category > .l-content:not(#content) {
    margin-top: -3rem;
    padding-top: 0;
}

/* 詳細度(2,2,0): #body_wrap.category #content で親テーマを上回る */
#body_wrap.category #content .l-mainContent,
#body_wrap.category #content .post_content,
#body_wrap.category #content .l-sidebar,
#body_wrap.category #content aside#sidebar,
#body_wrap.category #content .l-content__wrap {
    padding-top: 0;
    margin-top: 0;
}

/* カテゴリーページのヘッダー下部マージンを削除 */
/* 詳細度(1,2,0): #body_wrap.category .l-header で親テーマを上回る */
#body_wrap.category .l-header {
    margin-bottom: 0;
}

/* カテゴリーページのパンくずリストを非表示 */
/* 詳細度(2,1,0): #body_wrap.category #breadcrumb で親テーマを上回る */
#body_wrap.category #breadcrumb,
#body_wrap.category .p-breadcrumb {
    display: none;
    height: 0;
    margin: 0;
    padding: 0;
}

/* 詳細度(1,2,1): body.category #category-content.top-page-layout で親テーマを上回る */
body.category #category-content.top-page-layout {
    margin-top: -3rem; /* ヘッダーの凹み分の余白を埋める（タクソノミーページと同じ値） */
    position: relative;
    z-index: 1;
}

body.category .top-page-main {
    padding-top: 1.5rem;
}

.top-page-layout #sidebar {
    background: #f7f6f4;
    padding: 1.5rem 20px;
}

/* トップページサイドバーのウィジェットタイトル（PC: 27px、SP: 1.5rem=24px） */
/* PC専用: 960px以上で27px */
@media screen and (min-width: 960px) {
    #body_wrap .top-page-layout #sidebar .c-widget__title.-side,
    #body_wrap .taxonomy-page-layout #sidebar .c-widget__title.-side {
        font-size: 27px;
        font-weight: bold;
        margin: 0 0 1rem 0;
        padding: 0;
    }
}

/* トップページ・カテゴリページ・検索ページ：SWELLの空コンテナを完全に非表示（SWELL上書き） */
/* 詳細度(2,2,0): #body_wrap > #content.l-content.l-container で親テーマを上回る */
/* ダミーdiv（.l-content.l-container:not(#content)）も非表示にしフッター前の隙間を防止 */
#body_wrap.home > #content.l-content.l-container,
#body_wrap.home > .l-content.l-container:not(#content),
#body_wrap.top > #content.l-content.l-container,
#body_wrap.category > #content.l-content.l-container,
#body_wrap.category > .l-content.l-container:not(#content),
#body_wrap.search > #content.l-content.l-container {
    display: none;
    padding: 0;
    margin: 0;
    height: 0;
}

/* 親テーマのテーブル枠線を打ち消し（トップページのみ、SWELL上書き） */
/* 詳細度(1,3,2): #body_wrap .top-page-main .post_content td/th で親テーマを上回る */
#body_wrap .top-page-main .post_content td,
#body_wrap .top-page-main .post_content th {
    border: none;
}

/* テーブル見出し（小学校、中学校など、SWELL上書き） */
/* 詳細度(1,3,2): #body_wrap .top-page-main table.unit thead th で親テーマを上回る */
#body_wrap .top-page-main table.unit thead th {
    font-size: 1.1em;
    font-weight: bold;
    padding: 0.75rem 0.5rem;
    border: none;
    border-bottom: 4px double #8bbabb;
    background-color: transparent;
    color: #333;
}

/* h1直後のテーブルの上マージンを削除 */
.top-page-main .post_content h1 + table.unit {
    margin-top: 0.5rem;
}

/* 「全学年の教科で探す」見出しの下線を削除（SWELL上書き） */
/* 詳細度(1,3,1): #body_wrap .top-page-main .post_content h1 で親テーマを上回る */
#body_wrap .top-page-main .post_content h1 {
    border: none;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

#body_wrap .top-page-main .post_content h1::before,
#body_wrap .top-page-main .post_content h1::after {
    display: none;
}

/* ========================================
   12. バナーレイアウト調整
   ======================================== */

.post_content .drill-banner {
    margin: 1.5rem 0;
}

.post_content .drill-banner:first-child {
    margin-top: 0;
}

/* 2x2グリッドバナー用 */
.post_content .banner-row,
.post_content .banner-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.post_content .banner-row .drill-banner,
.post_content .banner-grid .drill-banner {
    flex: 1 1 calc(50% - 5px);
    margin: 0;
}

.post_content .drill-banner a {
    display: block;
    width: 100%;
}

.post_content .drill-banner img {
    width: 100%;
    height: auto;
    display: block;
}

/* 横並びバナーのアスペクト比を揃える */
.banner-row .drill-banner,
.banner-grid .drill-banner {
    aspect-ratio: 728 / 436;
    overflow: hidden;
}

.banner-row .drill-banner img,
.banner-grid .drill-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   13. タクソノミーページ専用レイアウト
   ======================================== */

/* 教科書モード：SWELLの空コンテナを非表示（SWELL上書き） */
/* ※ドリルモードは#content内にコンテンツを配置するため、非表示にしない */
/* 詳細度(2,2,0): #body_wrap.tax > #content.l-content.l-container で親テーマを上回る */
#body_wrap.tax-unit:not(.drill-tax) > #content.l-content.l-container,
#body_wrap.tax-subject:not(.drill-tax) > #content.l-content.l-container,
#body_wrap.tax-school_year:not(.drill-tax) > #content.l-content.l-container,
#body_wrap.single-post:not(.single-drill) > #content.l-content.l-container,
#body_wrap.single-term > #content.l-content.l-container,
#body_wrap .taxonomy-page-layout + .l-content.l-container,
#body_wrap .single-page-layout + .l-content.l-container {
    display: none;
    padding: 0;
    margin: 0;
    height: 0;
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    position: absolute;
    width: 0;
    opacity: 0;
}

/* 教科書タクソノミーページの背景を白に（ヘッダー楕円部分の下の余白対策） */
/* 詳細度(1,2,0): 既に#body_wrapを使用 */
#body_wrap.tax-unit:not(.drill-tax),
#body_wrap.tax-subject:not(.drill-tax),
#body_wrap.tax-school_year:not(.drill-tax) {
    background-color: #fff;
}

/* カテゴリページ・固定ページ・検索ページ・404ページの背景を白に */
/* 詳細度(1,1,0): #body_wrap.class で親テーマを上回る */
#body_wrap.category,
#body_wrap.page,
#body_wrap.search,
#body_wrap.error404,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) {
    background-color: #fff;
}

/* ========================================
   カテゴリ・固定・アーカイブページ見出しスタイル
   （本番kyoukasyoと同じスタイルを適用）
   SWELLのカスタマイザー設定を完全に上書き
   ======================================== */

/* ヘッダーの下マージン（本番: margin-bottom:1.8rem） */
.category .l-header,
#body_wrap.page .l-header,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .l-header {
    margin-bottom: 1.8rem;
}

/* h2スタイル - SWELLカスタマイザーの設定を完全上書き */
/* 本番: background:#8bbabb, color:#fff, padding:1rem, border-left:6px double */
/* 詳細度(1,3,1): #body_wrap.category .post_content h2 で親テーマを上回る */
#body_wrap.category .post_content h2,
#body_wrap.page .post_content h2,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h2,
#body_wrap.category .post_content h2:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title)),
#body_wrap.page .post_content h2:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title)),
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h2:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title)) {
    font-size: 1.38rem;
    background: #8bbabb;
    color: #fff;
    padding: 1rem;
    border-left: 6px double #fff;
    border-right: none;
    border-top: none;
    border-bottom: none;
    position: relative;
    line-height: 1.4;
    margin: 3rem 0 1rem;
}

/* h2内リンクも白に */
#body_wrap.category .post_content h2 a,
#body_wrap.page .post_content h2 a,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h2 a {
    color: #fff;
}

/* SWELLのh2装飾（::before/::after 上下の線）を完全に無効化 */
/* ※unit-primary/junior/highのキャラクター画像は除外 */
#body_wrap.category .post_content h2:not(.unit-primary):not(.unit-junior):not(.unit-high)::before,
#body_wrap.category .post_content h2:not(.unit-primary):not(.unit-junior):not(.unit-high)::after,
#body_wrap.page .post_content h2:not(.unit-primary):not(.unit-junior):not(.unit-high)::before,
#body_wrap.page .post_content h2:not(.unit-primary):not(.unit-junior):not(.unit-high)::after,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h2:not(.unit-primary):not(.unit-junior):not(.unit-high)::before,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h2:not(.unit-primary):not(.unit-junior):not(.unit-high)::after {
    display: none;
    content: none;
    border: none;
    width: 0;
    height: 0;
}

/* h3スタイル - SWELLカスタマイザーの設定を完全上書き */
/* 本番: border-bottom:3px solid #8bbabb */
#body_wrap.category .post_content h3,
#body_wrap.page .post_content h3,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h3,
#body_wrap.category .post_content h3:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title)),
#body_wrap.page .post_content h3:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title)),
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h3:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title)) {
    font-size: 1.25rem;
    padding: 0 .5rem .5rem;
    border-bottom: 3px solid #8bbabb;
    border-left: none;
    border-right: none;
    border-top: none;
    background: none;
    color: inherit;
    line-height: 1.4;
    margin: 3rem 0 1rem;
}

/* SWELLのh3装飾を完全に無効化 */
#body_wrap.category .post_content h3::before,
#body_wrap.category .post_content h3::after,
#body_wrap.page .post_content h3::before,
#body_wrap.page .post_content h3::after,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h3::before,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h3::after,
#body_wrap.category .post_content h3:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title))::before,
#body_wrap.page .post_content h3:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title))::before,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h3:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title))::before {
    display: none;
    content: none;
    border: none;
    background: none;
    width: 0;
    height: 0;
}

/* h4スタイル - SWELLカスタマイザーの設定を完全上書き */
/* 本番: padding-left:1rem, border-left:4px solid #8bbabb */
#body_wrap.category .post_content h4,
#body_wrap.page .post_content h4,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h4,
#body_wrap.category .post_content h4:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title)),
#body_wrap.page .post_content h4:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title)),
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h4:where(:not([class^="swell-block-"]):not(.faq_q):not(.p-postList__title)) {
    font-size: 1.13rem;
    padding: 0 0 0 1rem;
    border-left: 4px solid #8bbabb;
    border-right: none;
    border-top: none;
    border-bottom: none;
    background: none;
    line-height: 1.4;
    margin: 3rem 0 1rem;
}

/* SWELLのh4装飾を完全に無効化 */
#body_wrap.category .post_content h4::before,
#body_wrap.category .post_content h4::after,
#body_wrap.page .post_content h4::before,
#body_wrap.page .post_content h4::after,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h4::before,
#body_wrap.archive:not(.drill-tax):not(.post-type-archive-drill) .post_content h4::after {
    display: none;
    content: none;
    border: none;
    width: 0;
    height: 0;
}

/* 教科書タクソノミーページのヘッダー下部マージンを削除（楕円装飾は維持） */
#body_wrap.tax-unit:not(.drill-tax) #header.l-header,
#body_wrap.tax-subject:not(.drill-tax) #header.l-header,
#body_wrap.tax-school_year:not(.drill-tax) #header.l-header {
    margin-bottom: 0;
}

/* 教科書タクソノミーページのSWELLタイトルエリアを非表示 */
#body_wrap.tax-unit:not(.drill-tax) .l-topTitleArea,
#body_wrap.tax-subject:not(.drill-tax) .l-topTitleArea,
#body_wrap.tax-school_year:not(.drill-tax) .l-topTitleArea {
    display: none;
}

/* 教科書タクソノミーページのパンくずリストを非表示 */
/* 詳細度(1,2,0): #body_wrap.tax-unit #breadcrumb で親テーマを上回る */
#body_wrap.tax-unit:not(.drill-tax) #breadcrumb,
#body_wrap.tax-unit:not(.drill-tax) .p-breadcrumb,
#body_wrap.tax-subject:not(.drill-tax) #breadcrumb,
#body_wrap.tax-subject:not(.drill-tax) .p-breadcrumb,
#body_wrap.tax-school_year:not(.drill-tax) #breadcrumb,
#body_wrap.tax-school_year:not(.drill-tax) .p-breadcrumb {
    display: none;
    height: 0;
    margin: 0;
    padding: 0;
}

/* 詳細度(1,1,0): #body_wrap .taxonomy-page-layout で親テーマを上回る */
#body_wrap .taxonomy-page-layout {
    display: block;
    background: #fff;
    margin-top: -3rem; /* ヘッダーの凹み分の余白を埋める（本番と同じ値） */
}

.taxonomy-page-main {
    padding: 1.5rem 20px 2.5rem;
    background: #fff;
}

/* 詳細度(1,2,0): #body_wrap .taxonomy-page-layout #sidebar で親テーマを上回る */
#body_wrap .taxonomy-page-layout #sidebar,
#body_wrap .taxonomy-page-layout #sidebar.l-sidebar {
    background: #f7f6f4;
    padding: 0 20px 1.5rem;
}

/* 教科書コンテンツ詳細ページの背景を白に（ヘッダー楕円部分の下の余白対策） */
/* 詳細度(1,2,0): 既に#body_wrapを使用、classの組み合わせで詳細度確保 */
#body_wrap.single-post:not(.single-drill) {
    background-color: #fff;
}

/* 教科書コンテンツ詳細ページのヘッダー下部マージンを削除（楕円装飾は維持） */
/* 詳細度(1,2,0): #body_wrap.single-post .l-header で親テーマを上回る */
#body_wrap.single-post:not(.single-drill) .l-header {
    margin-bottom: 0;
}

/* 教科書コンテンツ詳細ページのメインコンテンツを上にずらして楕円の余白を吸収 */
/* 詳細度(2,2,0): #body_wrap.single-post #content.l-content で親テーマを上回る */
#body_wrap.single-post:not(.single-drill) #content.l-content {
    margin-top: -2.5rem;
    padding-top: 2em;
    background: #fff;
}

/* 運営者情報ページ（author）のスタイル - 教科書コンテンツと同じレイアウト */
/* 詳細度(1,1,0): #body_wrap.author で親テーマを上回る */
#body_wrap.author {
    background-color: #f7f6f4;
}

#body_wrap.author .l-header {
    margin-bottom: 1.8rem;
}

/* 運営者情報ページ（author）のコンテンツレイアウト - 55:45比率 */
/* 詳細度(2,2,0): #body_wrap.author #content.l-content.l-container で親テーマを上回る */
#body_wrap.author #content.l-content.l-container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

#body_wrap.author #content.l-content {
    display: flex;
    width: 100%;
    margin-top: -3rem;
    padding-top: 0;
    background: #f7f6f4;
}

#body_wrap.author .l-mainContent.l-article {
    flex: 0 0 70%;
    width: 70%;
    max-width: 70%;
    padding: 1.5rem;
    padding-top: 1.5rem;
    box-sizing: border-box;
    margin-top: 0;
    background: #fff;
}

/* 運営者情報ページのコンテンツ幅を制限して中央寄せ */
#body_wrap.author .l-mainContent .post_content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px 3rem;
    font-size: 18px;
    line-height: 2;
}

/* 運営者情報ページのh1見出し上部余白（広告との間隔） */
/* adsense-top.phpが空のためh1が:first-childになり、SWELLの margin-top:0!important が適用される */
/* そのためpadding-topで余白を確保する */
#body_wrap.author .l-mainContent .post_content h1 {
    padding-top: 3rem;
}

/* 運営者情報ページのプロフィール画像はテンプレートのインラインスタイルで制御 */
/* 本番: <img style="width:400px; border:3px solid #8bbabb; max-width:100%"> */

/* 運営者情報ページのサイドバー - 右端まで伸ばす（トップページ同様） */
/* 詳細度(1,2,0): #body_wrap.author .l-sidebar */
#body_wrap.author .l-sidebar {
    flex: 0 0 30%;
    width: 30%;
    max-width: none;
    background: #f7f6f4;
    padding: 1.5rem 20px;
    padding-top: 1.5rem;
    box-sizing: border-box;
    margin-top: 0;
}

/* 運営者情報ページのサイドバー内部 - サイドバー幅いっぱいに広がる */
#body_wrap.author .l-sidebar .l-sidebar__inner,
#body_wrap.author .l-sidebar .w-sidebar {
    max-width: none;
    padding: 0;
    margin: 0;
    overflow: visible;
}

#body_wrap.author .l-sidebar .c-widget {
    max-width: none;
    margin-top: 20px;
    overflow: visible;
}

/* 運営者情報ページのサイドバー: バナー画像は最大500px */
#body_wrap.author .l-sidebar .c-widget img {
    max-width: 500px;
}

#body_wrap.author .l-sidebar .c-widget:first-child {
    margin-top: 0;
}

/* 運営者情報ページの検索窓（本番: max-width 630px） */
#body_wrap.author .l-sidebar .c-searchForm {
    max-width: 630px;
    margin-top: 0;
}

/* 運営者情報ページのサイドバーテキストは画面右端で折り返す */
#body_wrap.author .l-sidebar .c-widget p {
    width: 100%;
    max-width: none;
}

/* 運営者情報ページのサイドバーウィジェットタイトル（本番: 27px） */
#body_wrap.author .l-sidebar .c-widget__title {
    font-size: 27px;
}

/* 運営者情報ページのサイドバーウィジェットタイトルの下線を非表示 */
#body_wrap.author .l-sidebar .c-widget__title::after,
#body_wrap.author .l-sidebar .c-widget__title::before {
    display: none;
}

/* 運営者情報ページ: スクロール時のスティッキーサイドバーの上余白を縮小 */
/* 共通ルール(top:100px)はヘッダー分の余裕があるが、authorページでは不要 */
#body_wrap.author .l-sidebar__inner,
#body_wrap.author .l-sidebar > .w-sidebar {
    top: 30px;
    max-height: calc(100vh - 50px);
}

/* 運営者情報ページ: 960px〜1232pxはSP版と同じ1カラム表示（サイドバーを下に回り込み） */
@media screen and (min-width: 960px) and (max-width: 1232px) {
    #body_wrap.author #content.l-content {
        flex-direction: column;
    }

    #body_wrap.author .l-mainContent.l-article {
        flex: none;
        width: 100%;
        max-width: 100%;
        padding: 1rem 20px;
        padding-top: 1.5rem;
    }

    #body_wrap.author .l-sidebar {
        flex: none;
        width: 100%;
        max-width: 100%;
        padding: 1.5rem 20px;
    }

    #body_wrap.author .l-sidebar .l-sidebar__inner,
    #body_wrap.author .l-sidebar .w-sidebar,
    #body_wrap.author .l-sidebar .c-widget {
        max-width: 100%;
    }

    #body_wrap.author .l-sidebar .c-searchForm {
        max-width: 630px;
    }

}

/* ========================================
   固定ページ（.page）共通スタイル
   ※page-id-12279など特定ページは後で上書き
   詳細度: #body_wrap.page で (1,1,0) を確保
   ======================================== */

/* 固定ページの背景を白に */
#body_wrap.page {
    background-color: #fff;
}

/* 固定ページのヘッダー下マージンを0に（PC: 1233px以上） */
@media screen and (min-width: 1233px) {
    #body_wrap.page .l-header {
        margin-bottom: 0;
    }
}

/* 固定ページのパンくずリストを非表示 */
#body_wrap.page #breadcrumb,
#body_wrap.page .p-breadcrumb {
    display: none;
    height: 0;
    margin: 0;
    padding: 0;
}

/* 固定ページの.l-containerのmax-width制限を解除 */
#body_wrap.page #content.l-content.l-container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

/* 固定ページのメインコンテンツ最大幅（共通: 全サイズで適用、1233px+は2カラムルールで上書き） */
#body_wrap.page #content .l-mainContent.l-article {
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
}

/* 固定ページ: 960px〜1232pxはSP版と同じ表示を維持（960pxブレークポイント除去）
   本番環境: 1233px未満はナビ非表示・ロゴ中央配置 */
@media screen and (min-width: 960px) and (max-width: 1232px) {
    /* ヘッダー: SWELLの960pxデスクトップヘッダーを上書きしてSP表示を維持 */
    #body_wrap.page #header {
        display: block;
        text-align: center;
    }

    #body_wrap.page #header .l-header__inner {
        display: flex;
        justify-content: center;
        align-items: center;
        max-width: none;
    }

    /* ロゴ: 中央配置を維持（SP版と同じ） */
    #body_wrap.page #header .l-header__logo {
        flex: 0 0 auto;
        align-self: center;
    }

    /* ナビゲーション: 非表示（本番: 1233px未満は #header-navi { display: none }） */
    #body_wrap.page #header .l-header__gnav,
    #body_wrap.page #header .c-gnavWrap {
        display: none;
    }

    /* SWELLの-series/-parallelヘッダーレイアウトを上書き */
    #body_wrap.page #header.l-header.-series .l-header__inner,
    #body_wrap.page #header.l-header.-parallel .l-header__inner {
        display: flex;
        justify-content: center;
        align-items: center;
        max-width: none;
        padding: 0;
    }

    #body_wrap.page #header.l-header.-series .l-header__logo,
    #body_wrap.page #header.l-header.-parallel .l-header__logo {
        margin-right: 0;
        padding: 0;
    }

    #body_wrap.page #header.l-header.-series .c-gnavWrap,
    #body_wrap.page #header.l-header.-parallel .c-gnavWrap {
        display: none;
    }

    /* コンテンツレイアウト: 1カラム・SP版と同じ値 */
    #body_wrap.page #content.l-content {
        flex-direction: column;
        width: 100%;
        margin-top: 0;
        padding-top: 1rem;
        background: #fff;
    }

    #body_wrap.page .l-mainContent.l-article {
        flex: none;
        width: 100%;
        padding: 1rem 0;
        padding-top: 0;
        background: #fff;
    }

    #body_wrap.page .l-mainContent .post_content {
        max-width: 100%;
        padding: 0 0 2rem;
    }

    #body_wrap.page .l-sidebar {
        flex: none;
        width: 100%;
        max-width: 100%;
        background: #f7f6f4;
        padding: 1.5rem 20px;
    }

    /* 固定ページ：サイドバー内部要素をフル幅に（SWELLデスクトップ制限を解除） */
    #body_wrap.page .l-sidebar .l-sidebar__inner,
    #body_wrap.page .l-sidebar .w-sidebar {
        max-width: 100%;
        width: 100%;
    }

    #body_wrap.page .l-sidebar .c-widget {
        max-width: 100%;
        background: transparent;
        border-radius: 0;
        padding: 0;
    }

    /* aboutページ: 検索フォームは元の幅（400px）を維持 */
    #body_wrap.page-id-12279 #sidebar .c-searchForm {
        max-width: 400px;
    }

}

/* 固定ページのコンテンツレイアウト - PC用2カラム（1233px以上） */
@media screen and (min-width: 1233px) {
    #body_wrap.page #content.l-content {
        display: flex;
        width: 100%;
        margin-top: -3rem; /* ヘッダーの凹み分の余白を埋める */
        padding-top: 2.5rem;
        background: #fff;
    }

    /* 固定ページのメインコンテンツ */
    #body_wrap.page .l-mainContent.l-article {
        flex: 0 0 70%;
        width: 70%;
        max-width: 70%;
        padding: 1.5rem;
        box-sizing: border-box;
        background: #fff;
    }

    /* 固定ページのタイトル幅をコンテンツに合わせる */
    #body_wrap.page .l-mainContent .c-pageTitle {
        max-width: 800px;
        margin-top: 1.5rem;
        margin-left: auto;
        margin-right: auto;
        padding-left: 20px;
        padding-right: 20px;
    }

    /* 固定ページのコンテンツ幅を制限して中央寄せ */
    #body_wrap.page .l-mainContent .post_content {
        max-width: 800px;
        margin: 0 auto;
        padding: 0 20px 3rem;
    }

    /* 固定ページのサイドバー - 右端まで伸ばす */
    #body_wrap.page .l-sidebar {
        flex: 0 0 30%;
        width: 30%;
        max-width: none;
        background: #f7f6f4;
        padding: 1.5rem 20px;
        box-sizing: border-box;
    }

    /* 固定ページのサイドバー内部 */
    #body_wrap.page .l-sidebar .l-sidebar__inner,
    #body_wrap.page .l-sidebar .w-sidebar {
        max-width: 400px;
        padding: 0;
        margin: 0;
        overflow: visible;
    }

    #body_wrap.page .l-sidebar .c-widget {
        max-width: 400px;
        margin-top: 20px;
        overflow: visible;
    }

    #body_wrap.page .l-sidebar .c-widget:first-child {
        margin-top: 0;
    }

    #body_wrap.page .l-sidebar .c-searchForm {
        max-width: 100%;
        width: 100%;
    }

    #body_wrap.page .l-sidebar .c-widget__title::after,
    #body_wrap.page .l-sidebar .c-widget__title::before {
        display: none;
    }
}

/* ========================================
   固定ページ用ヘッダーグリッド（本番: 1fr calc(400px + 3rem)）
   ナビゲーションをサイドバーの左端に揃える
   詳細度: #body_wrap.page .l-header で (1,2,0) を確保
   ======================================== */
@media screen and (min-width: 1233px) {
    /* 固定ページのヘッダーをgridにする（本番と同じ比率） */
    #body_wrap.page .l-header {
        display: grid;
        grid-template-columns: 1fr calc(400px + 3rem);
        align-items: center;
        min-height: 130px;
    }

    /* .l-header__inner.l-containerをdisplay:contentsにして、グリッド階層から排除 */
    #body_wrap.page .l-header .l-header__inner.l-container {
        display: contents;
    }

    /* ロゴエリア：1列目（70%エリア） */
    #body_wrap.page .l-header .l-header__logo {
        grid-row: 1/2;
        grid-column: 1/2;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%;
        margin: -20px auto 0;
        padding: 0 20px;
    }

    /* ナビゲーションエリア：2列目（30%エリア＝サイドバーと同じ位置） */
    #body_wrap.page .l-header .l-header__gnav.c-gnavWrap {
        grid-row: 1/2;
        grid-column: 2/3;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    /* ヘッダーウィジェットエリアを2列目に配置 */
    #body_wrap.page .l-header .w-header {
        grid-row: 1;
        grid-column: 2;
        margin-left: auto;
    }

    /* SPボタンはPCでは非表示 */
    #body_wrap.page .l-header .l-header__menuBtn,
    #body_wrap.page .l-header .l-header__customBtn {
        display: none;
    }
}

/* ========================================
   このサイトについてページ（about / page-id-12279）のスタイル
   詳細度: #body_wrap.page-id-12279 で (1,2,0) を確保
   ======================================== */

#body_wrap.page-id-12279 {
    background-color: #fff;
}

#body_wrap.page-id-12279 .l-header {
    margin-bottom: 0;
}

/* aboutページ・運営者情報ページのタイトル（c-pageTitle）ボーダー削除・余白・幅調整 */
#body_wrap.page-id-12279 .c-pageTitle,
#body_wrap.author .c-pageTitle {
    border-bottom: none;
    margin-top: 2rem;
    margin-bottom: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
}

#body_wrap.page-id-12279 .c-pageTitle .c-pageTitle__inner,
#body_wrap.author .c-pageTitle .c-pageTitle__inner {
    border-bottom: none;
    float: none;
    padding: 0;
}

/* aboutページのコンテンツレイアウト - PC用2カラム（1233px以上） */
#body_wrap.page-id-12279 #content.l-content.l-container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

@media screen and (min-width: 1233px) {
    #body_wrap.page-id-12279 #content.l-content {
        display: flex;
        width: 100%;
        margin-top: -60px;
        padding-top: 2.5rem;
        background: #fff;
    }

    #body_wrap.page-id-12279 .l-mainContent.l-article {
        flex: 0 0 70%;
        width: 70%;
        max-width: 70%;
        padding: 1.5rem;
        box-sizing: border-box;
        background: #fff;
    }

    /* aboutページのコンテンツ幅を制限して中央寄せ */
    #body_wrap.page-id-12279 .l-mainContent .post_content {
        max-width: 800px;
        margin: 0 auto;
        padding: 0 20px 3rem;
    }

    /* aboutページのサイドバー - 右端まで伸ばす */
    #body_wrap.page-id-12279 .l-sidebar {
        flex: 0 0 30%;
        width: 30%;
        max-width: none;
        background: #f7f6f4;
        padding: 1.5rem 20px;
        box-sizing: border-box;
    }

    /* aboutページのサイドバー内部 */
    #body_wrap.page-id-12279 .l-sidebar .l-sidebar__inner,
    #body_wrap.page-id-12279 .l-sidebar .w-sidebar {
        max-width: 400px;
        padding: 0;
        margin: 0;
        overflow: visible;
    }

    /* aboutページ: PC 2カラム時のみウィジェット幅を400pxに制限 */
    #body_wrap.page-id-12279 .l-sidebar .c-widget {
        max-width: 400px;
    }
}

#body_wrap.page-id-12279 .l-sidebar .c-widget {
    margin-top: 20px;
    overflow: visible;
}

#body_wrap.page-id-12279 .l-sidebar .c-widget:first-child {
    margin-top: 0;
}

/* aboutページの検索窓 */
#body_wrap.page-id-12279 .l-sidebar .c-searchForm {
    width: 500px;
    max-width: none;
    margin-top: 0;
}

/* aboutページのサイドバーテキストは画面右端で折り返す */
#body_wrap.page-id-12279 .l-sidebar .c-widget p {
    width: 100%;
    max-width: none;
}

/* aboutページのサイドバーウィジェットタイトルの下線を非表示 */
#body_wrap.page-id-12279 .l-sidebar .c-widget__title::after,
#body_wrap.page-id-12279 .l-sidebar .c-widget__title::before {
    display: none;
}

/* ========================================
   スポンサーページ（page-template-page-sponsor）のレイアウト補正
   テンプレートのインラインCSSで全幅・サイドバー非表示を実装しているため、
   固定ページの2カラム・ヘッダーgrid等のルールを960px以上で統一的に無効化する
   ======================================== */

/* 基本: メインコンテンツの幅制限（728px）を解除 */
#body_wrap.page-template-page-sponsor #content .l-mainContent.l-article {
    max-width: none;
}

/* 960px以上: 全幅レイアウトを統一（960-1232pxと1233px+の差異を解消） */
@media screen and (min-width: 960px) {
    /* コンテンツ: ブロックレイアウト・余白なし */
    #body_wrap.page-template-page-sponsor #content.l-content {
        display: block;
        margin-top: 0;
        padding-top: 0;
    }

    #body_wrap.page-template-page-sponsor .l-mainContent.l-article {
        flex: none;
        width: 100%;
        max-width: none;
        padding: 0;
    }

    /* ヘッダー: gridを無効化してロゴ中央配置 */
    #body_wrap.page-template-page-sponsor #header {
        display: block;
        text-align: center;
        min-height: auto;
    }

    #body_wrap.page-template-page-sponsor #header .l-header__inner {
        display: flex;
        justify-content: center;
        align-items: center;
        max-width: none;
        padding: 0;
    }

    /* ヘッダーナビ: 非表示（LPなのでナビ不要） */
    #body_wrap.page-template-page-sponsor #header .l-header__gnav,
    #body_wrap.page-template-page-sponsor #header .c-gnavWrap {
        display: none;
    }
}

/* タクソノミーページ：ページタイトルの下マージン（本番と統一） */
#body_wrap .taxonomy-page-main .c-pageTitle,
#body_wrap.drill-tax .l-mainContent .c-pageTitle {
    margin-bottom: 8rem;
}

/* タクソノミーページ：h2見出しの背景色をヘッダーと同じに（SWELL上書き） */
/* 詳細度(1,3,1): #body_wrap .taxonomy-page-main .unit-list h2 で親テーマを上回る */
#body_wrap .taxonomy-page-main .unit-list h2,
#body_wrap.drill-tax .l-mainContent .unit-list h2 {
    background: #8bbabb;
    color: #fff;
    padding: 0.75em 1em;
    margin-top: 2rem;
}

#body_wrap .taxonomy-page-main .unit-list h2 a,
#body_wrap.drill-tax .l-mainContent .unit-list h2 a {
    color: #fff;
}

/* キャラクター画像の::before疑似要素を有効化（SWELLのh2::before無効化から除外） */
/* 詳細度(1,4,1): #body_wrap .taxonomy-page-main .unit-list h2.unit-*::before */
#body_wrap .taxonomy-page-main .unit-list h2.unit-primary::before,
#body_wrap .taxonomy-page-main .unit-list h2.unit-junior::before,
#body_wrap .taxonomy-page-main .unit-list h2.unit-high::before,
#body_wrap.drill-tax .l-mainContent .unit-list h2.unit-primary::before,
#body_wrap.drill-tax .l-mainContent .unit-list h2.unit-junior::before,
#body_wrap.drill-tax .l-mainContent .unit-list h2.unit-high::before {
    display: block;
    content: '';
    border: none;
    border-top: none;
    border-bottom: none;
    top: 2px;
    left: auto;
    width: 159px;
    height: 88.5px;
    position: absolute;
    pointer-events: none;
    transform: translateY(-100%);
}

/* タクソノミーページでの学生画像位置調整（top+transformで統一） */
#body_wrap .taxonomy-page-main h2.unit-primary::before,
#body_wrap.drill-tax .l-mainContent h2.unit-primary::before {
    display: block;
    content: '';
    background: url('/wp-content/themes/swell_child/img/shougakusei.png') no-repeat;
    background-size: contain;
    right: 0;
}

#body_wrap .taxonomy-page-main h2.unit-junior::before,
#body_wrap.drill-tax .l-mainContent h2.unit-junior::before {
    display: block;
    content: '';
    background: url('/wp-content/themes/swell_child/img/chugakusei.png') no-repeat;
    background-size: contain;
    right: 0;
}

#body_wrap .taxonomy-page-main h2.unit-high::before,
#body_wrap.drill-tax .l-mainContent h2.unit-high::before {
    display: block;
    content: '';
    background: url('/wp-content/themes/swell_child/img/koukousei.png') no-repeat;
    background-size: contain;
    right: 0;
}



/* ========================================
   14. フッタースタイル（SWELL上書き）
   詳細度: #footer.l-footer で (1,1,0) を確保
   ======================================== */

/* フッター上部の楕円形装飾（中央が凹む、本番環境と統一） */
#footer.l-footer {
    position: relative;
    z-index: 12;
    text-align: center;
    padding: 3rem 2rem 2rem;
    margin-top: -3rem;
    color: #fff;
    font-size: 18px;
    background: radial-gradient(110% 30% at top, #fff 50%, #8bbabb 51%);
}

/* 960-1232px: サイドバーとフッターの隙間をグレー背景で埋める */
@media screen and (min-width: 960px) and (max-width: 1232px) {
    #footer.l-footer {
        background: radial-gradient(110% 30% at top, #f7f6f4 50%, #8bbabb 51%);
    }
    #body_wrap.drill-tax #footer.l-footer,
    #body_wrap.post-type-archive-drill #footer.l-footer,
    #body_wrap.single-drill #footer.l-footer {
        background: radial-gradient(110% 30% at top, #f7f6f4 50%, #f1a98a 51%);
    }
}

#footer .l-footer__foot .l-container {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0;
}

#footer .l-footer__foot .l-footer__nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0;
    margin: 0;
}

#footer .l-footer__foot .copyright {
    margin: 0 0 0 20px;
    padding: 0;
    color: #fff;
    font-size: 18px;
    white-space: nowrap;
    flex-shrink: 0;
}

#footer .l-footer__foot .copyright::before {
    content: "";
    display: none;
}

/* フッターメニューの区切り線を非表示 */
#footer .l-footer__nav li::before,
#footer .l-footer__nav li::after {
    display: none;
    content: none;
}

#footer .l-footer__nav a {
    border-right: none;
}

#footer .l-footer__nav li:first-child a {
    border-left: none;
}

#footer .l-footer__nav {
    border-left: none;
    flex-wrap: nowrap;
    padding: 0;
}

/* フッターナビゲーションの太字・白色・18px */
#footer .l-footer__nav a {
    font-weight: bold;
    color: #fff;
    font-size: 18px;
    white-space: nowrap;
    padding: 0;
}

/* フッターリスト項目（本番と同じ） */
#footer .l-footer__nav li {
    color: #fff;
    margin: 0 20px 0 0;
    white-space: nowrap;
    flex-shrink: 0;
}

#footer .l-footer__nav li:last-child {
    margin-right: 0;
}

/* ========================================
   15. 検索フォームの角丸（SWELL上書き）
   詳細度: #body_wrap .c-searchForm で (1,1,0) を確保
   ======================================== */

#body_wrap .c-searchForm {
    display: flex;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #ccc;
    background: #f7f6f4;
    width: 100%;
    margin: 1.5rem 0;
    max-width: 630px; /* 本番と同じ */
    box-sizing: border-box;
}

#body_wrap .c-searchForm__s {
    border: none;
    border-radius: 0;
    padding: 0.5rem 40px 0.5rem 1rem;
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 50px;
    font-size: 1rem;
    line-height: 2;
}

#body_wrap .c-searchForm__s:focus {
    outline: none;
    box-shadow: none;
}

/* 検索ボタン: background-colorとcolorは管理画面で設定（外観→カスタマイズ→検索ボタン色を#518bcbに） */
#body_wrap .c-searchForm__submit {
    border-radius: 0 1rem 1rem 0;
    border: none;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    cursor: pointer;
    padding: 0;
}

/* トップページ・タクソノミーページ サイドバーの幅を調整（ドリルページと統一） */
/* 詳細度(1,2,0): #body_wrap .top-page-layout #sidebar で親テーマを上回る */
#body_wrap .top-page-layout #sidebar .l-sidebar__inner,
#body_wrap .taxonomy-page-layout #sidebar .l-sidebar__inner {
    max-width: none;
    padding: 10px 5px 0 5px;
    margin: 0;
    overflow: visible;
}

#body_wrap .top-page-layout #sidebar .w-sidebar,
#body_wrap .taxonomy-page-layout #sidebar .w-sidebar {
    max-width: none;
    padding: 0;
    margin: 0;
    overflow: visible;
}

#body_wrap .top-page-layout #sidebar .c-widget,
#body_wrap .taxonomy-page-layout #sidebar .c-widget {
    max-width: none;
    margin-top: 20px;
    overflow: visible;
}

/* サイドバーテキストは画面右端で折り返す */
#body_wrap .top-page-layout #sidebar .c-widget p,
#body_wrap .taxonomy-page-layout #sidebar .c-widget p,
#body_wrap.drill-tax #sidebar .c-widget p {
    width: 100%;
    max-width: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#body_wrap .top-page-layout #sidebar .c-widget:first-child,
#body_wrap .taxonomy-page-layout #sidebar .c-widget:first-child {
    margin-top: 0;
}

#body_wrap .top-page-layout #sidebar .c-searchForm,
#body_wrap .taxonomy-page-layout #sidebar .c-searchForm {
    width: 100%;
    max-width: 630px; /* 本番と同じ */
    margin-top: 20px;
}

/* サイドバーのウィジェットタイトル下の区切り線を非表示 */
#body_wrap .top-page-layout #sidebar .c-widget__title::after,
#body_wrap .top-page-layout #sidebar .c-widget__title::before,
#body_wrap .taxonomy-page-layout #sidebar .c-widget__title::after,
#body_wrap .taxonomy-page-layout #sidebar .c-widget__title::before,
#body_wrap.drill-tax #sidebar .c-widget__title::after,
#body_wrap.drill-tax #sidebar .c-widget__title::before,
#body_wrap.single #sidebar .c-widget__title::after,
#body_wrap.single #sidebar .c-widget__title::before {
    display: none;
}

/* サイドバーのウィジェットタイトルのpaddingを削除 */
#body_wrap.drill-tax #sidebar .c-widget__title.-side,
#body_wrap.post-type-archive-drill #sidebar .c-widget__title.-side,
#body_wrap.single #sidebar .c-widget__title.-side {
    padding: 0;
}

/* ドリルページのサイドバー：タイトルのフォントサイズ（PC: 27px、SP: 1.5rem=24px） */
/* PC専用: 960px以上で27px */
@media screen and (min-width: 960px) {
    #body_wrap.drill-tax #sidebar .c-widget__title,
    #body_wrap.drill-tax #sidebar .c-widget__title.-side,
    #body_wrap.post-type-archive-drill #sidebar .c-widget__title,
    #body_wrap.post-type-archive-drill #sidebar .c-widget__title.-side {
        font-size: 27px;
        font-weight: bold;
        margin: 0 0 1rem 0;
        text-align: left;
    }
}

/* ドリルページのサイドバー：全体のフォントサイズ（本番#sideと同じ） */
#body_wrap.drill-tax #sidebar,
#body_wrap.post-type-archive-drill #sidebar {
    font-size: 0.9rem;
}

/* ドリルページのサイドバー：.aboutテキスト（本番と同じ） */
#body_wrap.drill-tax #sidebar .about p,
#body_wrap.post-type-archive-drill #sidebar .about p {
    line-height: 2;
    word-break: break-all;
}

/* ドリルサイドバーのプロフィールボタンの角丸（教科書と統一） */
#body_wrap.drill-tax #sidebar a.u-bg-main,
#body_wrap.post-type-archive-drill #sidebar a.u-bg-main {
    border-radius: 2rem;
}

/* ========================================
   16. 個別投稿ページのレイアウト（グリッドレイアウト）
   ======================================== */

/* 基本設定（モバイル） */
/* 注意: single-drillは独自のレイアウトを使用 */
#body_wrap.single:not(.single-drill) #content.l-content.l-container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

/* SWELLの.-sidebar-on制約を解除（投稿ページ） */
#body_wrap.single:not(.single-drill).-sidebar-on #content .l-mainContent {
    width: auto;
}

/* 1233px以上: 2カラムグリッド（メイン + 右サイドバー） */
/* 注意: single-drillは独自のflexboxレイアウトを使用するため除外 */
@media screen and (min-width: 1233px) {
    #body_wrap.single:not(.single-drill) #content.l-content {
        display: grid;
        grid-template-columns: 1fr calc(400px + 3rem);
        width: 100%;
    }

    /* 左サイドバー: 非表示またはモバイル用 */
    #body_wrap.single:not(.single-drill) #content #sidebar {
        display: none;
    }

    /* メインコンテンツ: 1列目 */
    #body_wrap.single:not(.single-drill) #content .l-mainContent {
        grid-column: 1/2;
        grid-row: 1/2;
        padding: 1.5rem 20px 3rem;
    }

    /* 右サイドバー: 2列目 */
    #body_wrap.single:not(.single-drill) #content .l-sidebar:not(#sidebar) {
        position: sticky;
        top: 0;
        right: 0;
        z-index: 11;
        align-self: start;
        width: 100%;
        min-height: 100vh;
        padding: 1.5rem 1.5rem 0 1.5rem;
        margin-bottom: 1rem;
        background: #f7f6f4;
        grid-row: 1/2;
        grid-column: 2/3;
    }
}

/* 1358px以上: グリッド比率変更 */
@media screen and (min-width: 1358px) {
    #body_wrap.single:not(.single-drill) #content.l-content {
        grid-template-columns: calc(728px + 16%) 1fr;
    }
}

/* 1544px以上: 3カラムグリッド（左サイドバー + メイン + 右サイドバー） */
@media screen and (min-width: 1544px) {
    #body_wrap.single:not(.pdf):not(.single-drill) #content.l-content {
        grid-template-columns: 1fr calc(728px + 8%) 1fr;
    }

    /* 左サイドバー表示: 1列目 */
    #body_wrap.single:not(.pdf):not(.single-drill) #content #sidebar {
        display: block;
        position: sticky;
        top: 0;
        z-index: 11;
        align-self: start;
        width: 100%;
        min-height: 100vh;
        padding: 1.5rem 1.5rem 0 1.5rem;
        margin-bottom: 1rem;
        background: #f7f6f4;
        grid-row: 1/2;
        grid-column: 1/2;
    }

    /* メインコンテンツ: 2列目（中央） */
    #body_wrap.single:not(.pdf):not(.single-drill) #content .l-mainContent {
        grid-column: 2/3;
    }

    /* 右サイドバー: 3列目 */
    #body_wrap.single:not(.pdf):not(.single-drill) #content .l-sidebar:not(#sidebar) {
        grid-column: 3/4;
    }
}

/* 1733px以上: グリッド比率変更 */
@media screen and (min-width: 1733px) {
    #body_wrap.single:not(.single-drill) #content.l-content {
        grid-template-columns: 1fr 1fr;
    }

    #body_wrap.single:not(.pdf):not(.single-drill) #content.l-content {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* 1980px以上: single用グリッド比率変更 */
@media screen and (min-width: 1980px) {
    #body_wrap.single:not(.pdf):not(.single-drill) #content.l-content {
        grid-template-columns: 1fr 1.5fr 1fr;
    }
}

/* ========================================
   17. PDFページ用のレイアウト（コンテンツ:サイドバー = 55:45）
   ======================================== */

/* PDFページのヘッダーレイアウト（55:45に合わせる） */
@media screen and (min-width: 960px) {
    #body_wrap.pdf #header.l-header .l-header__inner.l-container {
        max-width: 100%;
        width: 100%;
        padding: 0;
    }

    #body_wrap.pdf #header.l-header .l-header__inner {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        max-width: 100%;
        width: 100%;
    }

    /* ロゴ: 70%幅の中央に配置 */
    #body_wrap.pdf #header.l-header .l-header__logo {
        flex: 0 0 70%;
        width: 70%;
        max-width: 70%;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0;
    }

    /* ナビゲーション: 30%幅、左端から開始 */
    #body_wrap.pdf #header.l-header .c-gnavWrap {
        flex: 0 0 30%;
        width: 30%;
        max-width: 30%;
        justify-content: flex-start;
        margin: 0;
        padding-left: 0;
    }

    #body_wrap.pdf #header.l-header .c-gnav {
        justify-content: flex-start;
        padding-left: 0;
    }

    #body_wrap.pdf #header.l-header .c-gnav > li:first-child {
        margin-left: 0;
        padding-left: 0;
    }

    #body_wrap.pdf #header.l-header .c-gnav > li:first-child > a {
        padding-left: 0;
    }
}

.single #content.pdf-page {
    display: flex;
    width: 100%;
}

.single #content.pdf-page .l-mainContent {
    flex: 0 0 70%;
    max-width: 70%;
    padding: 1.5rem;
    box-sizing: border-box;
}

/* PDFページのコンテンツ幅を制限して中央配置 */
.single #content.pdf-page .l-mainContent article {
    max-width: 728px;
    margin: 0 auto;
}

/* PDFページのパンくずリストを中央寄せ */
.single #content.pdf-page .l-mainContent #breadcrumb {
    max-width: 728px;
    margin: 0 auto 1rem;
}

.single #content.pdf-page .l-sidebar {
    flex: 0 0 30%;
    max-width: 30%;
    padding: 1.5rem;
    box-sizing: border-box;
}

.single #content.pdf-page .l-sidebar .c-searchForm {
    max-width: 40rem;
}

/* ========================================
   18. 検索窓幅調整
   ======================================== */

/* タクソノミーページ（単元ページなど） */
.archive #sidebar .c-searchForm,
.tax-unit #sidebar .c-searchForm {
    max-width: 40rem;
}

/* 投稿ページ（通常ページ・左サイドバー） */
.single #content:not(.pdf-page) #sidebar .c-searchForm {
    max-width: 30rem;
}

/* ========================================
   19. ドリルページのレイアウト
   ======================================== */

/* ドリルページ共通スタイル（全サイズ） */
.drill-tax #content.l-content.l-container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
}

.drill-tax .post_content {
    margin-top: 60px;
}

/* メインコンテンツ内部の幅を制限（教科書コンテンツと統一） */
.drill-tax .l-mainContent > * {
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
}

/* ドリルページPC用レイアウト（1233px以上） */
@media screen and (min-width: 1233px) {
    .drill-tax #content.l-content {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .drill-tax #content .l-mainContent {
        flex: 0 0 70%;
        width: 70%;
        padding: 1.5rem;
        min-width: 0;
        background: #fff;
    }

    #body_wrap.drill-tax #content .l-sidebar {
        flex: 1;
        width: auto;
        padding: 1.5rem 20px;
        background: #f7f6f4;
        overflow: hidden;
    }
}

/* ドリルサイドバー共通スタイル（全サイズ） */
.drill-tax #sidebar .c-widget,
.post-type-archive-drill #sidebar .c-widget {
    max-width: none;
    width: 100%;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    overflow: hidden;
}

.drill-tax #sidebar .w-sidebar > .c-searchForm + .c-widget,
.post-type-archive-drill #sidebar .w-sidebar > .c-searchForm + .c-widget {
    margin-top: 0;
}

#body_wrap.drill-tax #sidebar .l-sidebar__inner,
#body_wrap.drill-tax #sidebar .w-sidebar,
#body_wrap.post-type-archive-drill #sidebar .l-sidebar__inner,
#body_wrap.post-type-archive-drill #sidebar .w-sidebar {
    max-width: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.drill-tax #sidebar .c-widget p,
.post-type-archive-drill #sidebar .c-widget p {
    max-width: 100%;
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

/* ドリルサイドバーPC用スタイル（1233px以上） */
@media screen and (min-width: 1233px) {
    #body_wrap.drill-tax #sidebar .c-searchForm,
    #body_wrap.post-type-archive-drill #sidebar .c-searchForm {
        width: 100%;
        max-width: 630px;
        margin-top: 1.6rem;
    }

    #body_wrap.drill-tax #sidebar .c-searchForm__submit,
    #body_wrap.post-type-archive-drill #sidebar .c-searchForm__submit {
        width: 50px;
        min-width: 50px;
        height: 50px;
        padding: 0;
    }

    /* 検索バーのプレースホルダー文字サイズ */
    #body_wrap.drill-tax #sidebar .c-searchForm__s,
    #body_wrap.post-type-archive-drill #sidebar .c-searchForm__s {
        font-size: 1.1rem;
    }

    #body_wrap.drill-tax #sidebar .c-searchForm__s::placeholder,
    #body_wrap.post-type-archive-drill #sidebar .c-searchForm__s::placeholder {
        font-size: 1.1rem;
    }

    /* 教科書コンテンツの検索バー文字サイズ */
    #body_wrap .top-page-layout #sidebar .c-searchForm__s,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm__s {
        font-size: 1.1rem;
    }

    #body_wrap .top-page-layout #sidebar .c-searchForm__s::placeholder,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm__s::placeholder {
        font-size: 1.1rem;
    }

    .drill-tax #sidebar .c-widget img,
    .post-type-archive-drill #sidebar .c-widget img {
        max-width: 500px;
        height: auto;
        display: block;
    }

    /* drill-taxサイドバーの下部余白（フッター楕円との重なり調整） */
    #body_wrap.drill-tax #content .l-sidebar,
    #body_wrap.post-type-archive-drill #content .l-sidebar {
        padding-bottom: 5rem;
    }

}

/* ドリルページタブレット/モバイル用レイアウト（1232px以下） */
@media screen and (max-width: 1232px) {
    /* drill-tax / post-type-archive-drill: 1カラム縦並びレイアウト */
    .drill-tax #content.l-content,
    .post-type-archive-drill #content.l-content {
        display: block;
    }

    .drill-tax #content .l-mainContent,
    .post-type-archive-drill #content .l-mainContent {
        width: 100%;
        max-width: 100%;
        padding: 1.5rem 0;
        background: #fff;
    }

    #body_wrap.drill-tax #content .l-sidebar,
    #body_wrap.post-type-archive-drill #content .l-sidebar {
        width: 100%;
        max-width: 100%;
        padding: 1.5rem 20px 4rem;
        background: #f7f6f4;
    }

    /* サイドバー内部の幅調整 */
    #body_wrap.drill-tax #sidebar .c-searchForm,
    #body_wrap.post-type-archive-drill #sidebar .c-searchForm {
        width: 100%;
        max-width: 630px; /* 本番と同じ */
    }

    /* ナビゲーション3カラムを縦並びに変更 */
    #body_wrap.drill-tax #sidebar .c-widget p[style*="display: flex"],
    #body_wrap.drill-tax #sidebar .c-widget p[style*="display:flex"],
    #body_wrap.post-type-archive-drill #sidebar .c-widget p[style*="display: flex"],
    #body_wrap.post-type-archive-drill #sidebar .c-widget p[style*="display:flex"] {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    #body_wrap.drill-tax #sidebar .c-widget p[style*="display: flex"] ul,
    #body_wrap.drill-tax #sidebar .c-widget p[style*="display:flex"] ul,
    #body_wrap.post-type-archive-drill #sidebar .c-widget p[style*="display: flex"] ul,
    #body_wrap.post-type-archive-drill #sidebar .c-widget p[style*="display:flex"] ul {
        width: 100%;
    }

    /* drill-taxフッターの楕円デザイン維持（タブレット/モバイル） */
    #body_wrap.drill-tax #footer.l-footer,
    #body_wrap.post-type-archive-drill #footer.l-footer {
        margin-top: -3rem;
    }
}

/* SP版（959px以下）：ドリルカテゴリ/アーカイブページの左右paddingを維持（本番: #main { padding: 1.5rem 20px 0 }） */
@media screen and (max-width: 959px) {
    .drill-tax #content .l-mainContent,
    .post-type-archive-drill #content .l-mainContent {
        padding: 1.5rem 20px;
    }
}

/* ========================================
   20. ドリル個別ページのレイアウト
   ======================================== */

/* ドリル個別ページ用ヘッダー色（SWELL上書き） */
#body_wrap.single-drill #header.l-header,
#body_wrap.single-drill #header .l-header__inner,
#body_wrap.single-drill.drill-tax #header.l-header,
#body_wrap.single-drill.drill-tax #header .l-header__inner {
    background-color: #f1a98a;
}

/* ドリルページのヘッダーマスク効果を維持しつつ、下部の緑色を防ぐ */
/* #body_wrapの背景をオレンジにして、マスクで透明になる部分もオレンジに見えるようにする */
#body_wrap.single-drill,
#body_wrap.drill-tax,
#body_wrap.post-type-archive-drill {
    background-color: #f1a98a;
}

/* ドリルページのコンテンツエリア背景（mask効果を可視化するため白背景を維持）
   本番環境: #content{background:#fff} はドリルページにも適用される */
#body_wrap.drill-tax #content.l-content,
#body_wrap.post-type-archive-drill #content.l-content,
#body_wrap.single-drill #content.l-content {
    background-color: #fff;
    margin-top: -3rem;
}

#body_wrap.single-drill #header .c-gnav a,
#body_wrap.single-drill #header .c-gnav a .ttl {
    color: #fff;
}

#body_wrap.single-drill #header .c-headLogo__link {
    color: #fff;
}

/* ドリル個別ページ用フッター色（SWELL上書き） */
#body_wrap.single-drill #footer.l-footer {
    background: radial-gradient(110% 30% at top, #fff 50%, #f1a98a 51%);
}

/* 960-1232px: ドリル個別ページのフッター凹みをサイドバー背景色に合わせる */
@media screen and (min-width: 960px) and (max-width: 1232px) {
    #body_wrap.single-drill #footer.l-footer {
        background: radial-gradient(110% 30% at top, #f7f6f4 50%, #f1a98a 51%);
    }
}

#body_wrap.single-drill #footer.l-footer,
#body_wrap.single-drill #footer.l-footer a {
    color: #fff;
}

/* ドリル個別ページのロゴレイアウト */
.single-drill .l-header__logo {
    display: flex;
    align-items: center;
    gap: 0;
}

.single-drill .c-headLogo {
    margin: 0;
}

/* 「by ゆみねこの教科書」ロゴのスタイル */
.single-drill .head-kyoukasyo-logo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    position: relative;
    align-self: center;
    margin-top: 22px;
    margin-left: 0;
}

.single-drill .head-kyoukasyo-logo::before {
    content: 'by';
    color: #fff;
    font-size: 1rem;
    align-self: flex-end;
    padding-bottom: 2px;
}

#body_wrap.single-drill #header .head-kyoukasyo-logo img {
    display: block;
    max-width: 150px;
    margin-left: 5px;
}

/* 「by ゆみねこの教科書」ロゴのホバー効果 */
.single-drill .head-kyoukasyo-logo {
    transition: opacity 0.25s ease;
}

.single-drill .head-kyoukasyo-logo:hover {
    opacity: 0.7;
}

/* ドリル個別ページ共通スタイル（全サイズ） */
.single-drill #content.l-content.l-container {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

/* ドリル個別ページのサイドバー内スタイル（全サイズ） */
#body_wrap.single-drill #sidebar {
    overflow: visible;
}

#body_wrap.single-drill #sidebar .l-sidebar__inner,
#body_wrap.single-drill #sidebar .w-sidebar {
    max-width: 100%;
    width: 100%;
    padding: 0;
    padding-right: 1rem;
    margin: 0;
    overflow: visible;
}

#body_wrap.single-drill #sidebar .c-widget {
    max-width: 100%;
    width: 100%;
    margin-top: 20px;
    overflow: visible;
}

#body_wrap.single-drill #sidebar #side-inside {
    overflow: visible;
}

#body_wrap.single-drill #sidebar .c-widget:first-child {
    margin-top: 0;
}

/* サイドバーのウィジェットタイトル下の区切り線を非表示 */
#body_wrap.single-drill #sidebar .c-widget__title::after,
#body_wrap.single-drill #sidebar .c-widget__title::before {
    display: none;
}

/* ドリル個別ページのサイドバー：タイトル（PC: 27px、SP: 1.5rem=24px） */
/* PC専用: 960px以上で27px */
@media screen and (min-width: 960px) {
    #body_wrap.single-drill #sidebar .c-widget__title.-side {
        padding: 0;
        font-size: 27px;
        font-weight: bold;
        margin: 0 0 1rem 0;
        text-align: left;
    }
}

/* ドリル詳細ページのサイドバー：テキストフォントサイズ（本番: 18px） */
#body_wrap.single-drill #sidebar {
    font-size: 18px;
}

/* ドリル詳細ページのサイドバー：.aboutテキスト（本番と同じ） */
#body_wrap.single-drill #sidebar .about p {
    line-height: 2;
    word-break: break-all;
}

/* ドリル詳細ページのサイドバー：プロフィールボタン（本番: #profile a） */
#body_wrap.single-drill #sidebar #profile a,
#body_wrap.single-drill #sidebar a.u-bg-main {
    background: #518bcb;
    display: block;
    color: #fff;
    padding: .5rem 1rem;
    border-radius: 2rem;
    margin-top: .5rem;
    font-size: 1rem;
    text-decoration: none;
}

#body_wrap.single-drill #sidebar #profile a:hover,
#body_wrap.single-drill #sidebar a.u-bg-main:hover {
    opacity: 0.8;
    text-decoration: none;
}

/* ドリル詳細ページのサイドバー：プロフィールラップ（本番: #profile-wrap） */
#body_wrap.single-drill #profile-wrap {
    border: 2px dashed #8bbabb;
    border-radius: 2rem;
    margin: 3rem 0;
    padding: 2rem;
}

#body_wrap.single-drill #profile-wrap .about {
    margin-bottom: 0;
}

/* ドリル詳細ページのサイドバー：プロフィール見出し（本番: #profile-head） */
#body_wrap.single-drill #profile-head {
    background: #fff;
    color: #8bbabb;
    border-left: none;
    margin: 1rem 0 1rem 0;
    padding-left: 0;
}

/* ドリル詳細ページのサイドバー：プロフィール（本番: #profile） */
#body_wrap.single-drill #profile {
    text-align: left;
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

#body_wrap.single-drill #profile p {
    margin-bottom: 0;
    line-height: 1.4;
}

#body_wrap.single-drill #profile img {
    margin-right: 1rem;
    width: 100px;
}

/* ドリル詳細ページのサイドバー：バナー画像（本番と統一） */
#body_wrap.single-drill #sidebar .about img,
#body_wrap.single-drill #sidebar .c-widget img[src*="banner"] {
    max-width: 500px;
    width: 100%;
    height: auto;
}

/* ドリル詳細ページのサイドバー：ドリルバナー */
#body_wrap.single-drill #sidebar .drill-banner img {
    max-width: 500px;
    width: 100%;
    height: auto;
}

/* SWELLが追加する空のサイドバーを非表示（SWELL上書き） */
#body_wrap.single-drill #content .l-sidebar:last-of-type:empty,
#body_wrap.single-drill #content aside.l-sidebar:empty {
    display: none;
}

/* SWELLの追尾サイドバーを非表示（SWELL上書き） */
#body_wrap.single-drill .p-fixSidebar,
#body_wrap.single-drill #fix_sidebar {
    display: none;
}

/* ドリル個別ページのコンテンツ下部余白を削除（フッター上の余白対策） */
#body_wrap.single-drill #content.l-content {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* ドリル個別ページPC用レイアウト（1233px-1357px：2カラム、サイドバー固定幅） */
@media screen and (min-width: 1233px) and (max-width: 1357px) {
    /* 2カラムgridレイアウト（本番環境: grid-template-columns: 1fr calc(400px + 3rem)） */
    #body_wrap.single-drill:not(.drill-answer) #content.l-content,
    body.single-drill:not(.drill-answer) #content.l-content {
        display: grid !important;
        grid-template-columns: 1fr calc(400px + 3rem);
        width: 100%;
    }

    /* メインコンテンツ: 1列目 */
    #body_wrap.single-drill:not(.drill-answer) #content .l-mainContent,
    body.single-drill:not(.drill-answer) #content .l-mainContent {
        grid-row: 1/2;
        grid-column: 1/2;
        width: 100%;
        max-width: none;
        min-width: 0;
        padding: 1.5rem 20px 2.5rem;
        background: #fff;
    }

    /* サイドバー: 2列目（右側、固定幅） */
    #body_wrap.single-drill:not(.drill-answer) #content #sidebar,
    #body_wrap.single-drill:not(.drill-answer) #content .l-sidebar,
    body.single-drill:not(.drill-answer) #content #sidebar,
    body.single-drill:not(.drill-answer) #content .l-sidebar {
        grid-row: 1/2;
        grid-column: 2/3;
        position: sticky;
        top: 0;
        align-self: start;
        width: 100%;
        min-height: 100vh;
        padding: 1.5rem 0 0 1.5rem;
        background: #f7f6f4;
    }

    /* 過去成績エリア（右サイドバー）: 非表示 */
    #body_wrap.single-drill:not(.drill-answer) #content #right-sidebar-fixed,
    body.single-drill:not(.drill-answer) #content #right-sidebar-fixed {
        display: none !important;
    }

}

/* ドリル個別ページPC用レイアウト（1358px-1543px：2カラム、メイン固定幅） */
@media screen and (min-width: 1358px) and (max-width: 1543px) {
    /* 2カラムgridレイアウト（本番環境: grid-template-columns: calc(728px + 16%) 1fr） */
    #body_wrap.single-drill:not(.drill-answer) #content.l-content,
    body.single-drill:not(.drill-answer) #content.l-content {
        display: grid !important;
        grid-template-columns: calc(728px + 16%) 1fr;
        width: 100%;
    }

    /* メインコンテンツ: 1列目（固定幅） */
    #body_wrap.single-drill:not(.drill-answer) #content .l-mainContent,
    body.single-drill:not(.drill-answer) #content .l-mainContent {
        grid-row: 1/2;
        grid-column: 1/2;
        width: 100%;
        max-width: none;
        min-width: 0;
        padding: 1.5rem 8% 2.5rem;
        background: #fff;
    }

    /* サイドバー: 2列目（右側、可変幅） */
    #body_wrap.single-drill:not(.drill-answer) #content #sidebar,
    #body_wrap.single-drill:not(.drill-answer) #content .l-sidebar,
    body.single-drill:not(.drill-answer) #content #sidebar,
    body.single-drill:not(.drill-answer) #content .l-sidebar {
        grid-row: 1/2;
        grid-column: 2/3;
        position: sticky;
        top: 0;
        align-self: start;
        width: 100%;
        min-height: 100vh;
        padding: 1.5rem 0 0 1.5rem;
        background: #f7f6f4;
    }

    /* 過去成績エリア（右サイドバー）: 非表示 */
    #body_wrap.single-drill:not(.drill-answer) #content #right-sidebar-fixed,
    body.single-drill:not(.drill-answer) #content #right-sidebar-fixed {
        display: none !important;
    }

}

/* ドリル個別ページPC用レイアウト（1544px以上：3カラム） */
@media screen and (min-width: 1544px) {
    /* 3カラムgridレイアウト（本番環境: grid-template-columns: 1fr calc(728px + 8%) 1fr） */
    #body_wrap.single-drill:not(.drill-answer) #content.l-content,
    body.single-drill:not(.drill-answer) #content.l-content {
        display: grid !important;
        grid-template-columns: 1fr calc(728px + 8%) 1fr;
        width: 100%;
    }

    /* サイドバー: 1列目（左側） */
    #body_wrap.single-drill:not(.drill-answer) #content #sidebar,
    #body_wrap.single-drill:not(.drill-answer) #content .l-sidebar,
    body.single-drill:not(.drill-answer) #content #sidebar,
    body.single-drill:not(.drill-answer) #content .l-sidebar {
        grid-row: 1/2;
        grid-column: 1/2;
        position: sticky;
        top: 0;
        align-self: start;
        width: 100%;
        min-height: 100vh;
        padding: 1.5rem 0 0 1.5rem;
        background: #f7f6f4;
    }

    /* メインコンテンツ: 2列目（中央） */
    #body_wrap.single-drill:not(.drill-answer) #content .l-mainContent,
    body.single-drill:not(.drill-answer) #content .l-mainContent {
        grid-row: 1/2;
        grid-column: 2/3;
        width: 100%;
        max-width: none;
        min-width: 0;
        padding: 1.5rem 0 2.5rem;
        background: #fff;
    }

    /* 過去成績エリア（右サイドバー）: 3列目（右側） */
    #body_wrap.single-drill:not(.drill-answer) #content #right-sidebar-fixed,
    body.single-drill:not(.drill-answer) #content #right-sidebar-fixed {
        display: block !important;
        grid-row: 1/2;
        grid-column: 3/4;
        position: sticky;
        top: 0;
        align-self: start;
        width: 100%;
        min-height: 100vh;
        padding: 1.5rem 1.5rem 0 1.5rem;
        background: #f7f6f4;
    }

    /* サイドバー内のスタイル調整 */
    #body_wrap.single-drill #content #sidebar .c-searchForm {
        width: calc(100% - 1rem);
        max-width: 630px;
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* ドリル詳細ページPC：検索バースタイル（本番と統一） */
    #body_wrap.single-drill #sidebar .c-searchForm__s {
        font-size: 1.1rem;
    }

    #body_wrap.single-drill #sidebar .c-searchForm__s::placeholder {
        font-size: 1.1rem;
    }

    #body_wrap.single-drill #sidebar .c-searchForm__submit {
        width: 50px;
        min-width: 50px;
        height: 50px;
        padding: 0;
    }

    #body_wrap.single-drill #sidebar #side-inside {
        padding-right: 1rem;
    }

    #body_wrap.single-drill #content .l-mainContent,
    #body_wrap.single-drill #content #sidebar,
    #body_wrap.single-drill #content #right-sidebar-fixed {
        margin-bottom: 0;
        padding-bottom: 1.5rem;
    }
}

/* ドリル個別ページタブレット/モバイル用レイアウト（1232px以下） */
@media screen and (max-width: 1232px) {
    /* single-drill: 1カラム縦並びレイアウト */
    #body_wrap.single-drill #content.l-content,
    #body_wrap.single-drill.drill-tax #content.l-content {
        display: flex;
        flex-direction: column;
    }

    /* メインコンテンツを先に表示（本番: #entry { max-width: 728px; margin: 0 auto }） */
    #body_wrap.single-drill #content .l-mainContent,
    #body_wrap.single-drill.drill-tax #content .l-mainContent {
        order: 1;
        flex: none;
        width: 100%;
        max-width: 728px;
        margin-left: auto;
        margin-right: auto;
        padding: 1.5rem 0;
        background: #fff;
    }

    /* サイドバーをメインコンテンツの後に表示 */
    #body_wrap.single-drill #content #sidebar,
    #body_wrap.single-drill #content .l-sidebar,
    #body_wrap.single-drill.drill-tax #content #sidebar,
    #body_wrap.single-drill.drill-tax #content .l-sidebar {
        order: 2;
        flex: none;
        width: 100%;
        padding: 1.5rem 20px;
        background: #f7f6f4;
        position: static;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    /* 右サイドバーを非表示（回答ページ以外） */
    #body_wrap.single-drill:not(.drill-answer) #right-sidebar-fixed,
    #body_wrap.single-drill.drill-tax:not(.drill-answer) #right-sidebar-fixed {
        display: none;
    }

    /* 回答ページSP：右サイドバーを表示（本番環境と統一） */
    #body_wrap.single-drill.drill-answer #right-sidebar-fixed {
        display: block;
        order: 3;
        flex: none;
        width: 100%;
        padding: 1.5rem 20px;
        background: #f7f6f4;
        position: static;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    /* 回答ページSP：右サイドバー内の検索フォーム（本番: #search-form スタイル） */
    #body_wrap.single-drill.drill-answer #right-sidebar-fixed .c-searchForm {
        margin: 1.5rem 0;
        max-width: 630px;
        width: 100%;
    }

    #body_wrap.single-drill.drill-answer #right-sidebar-fixed .c-searchForm__s {
        height: 50px;
        border-radius: 1rem;
        font-size: 1rem;
        padding: .5rem 40px .5rem 1rem;
        line-height: 2;
        border: 1px solid hsla(0, 0%, 78%, .5);
    }

    #body_wrap.single-drill.drill-answer #right-sidebar-fixed .c-searchForm__submit {
        border-radius: 0 1rem 1rem 0;
        width: 50px;
        background-color: #518bcb;
    }

    /* 回答ページSP：右サイドバー内のタイトル（本番: h1スタイル） */
    #body_wrap.single-drill.drill-answer #right-sidebar-fixed h1,
    #body_wrap.single-drill.drill-answer #right-sidebar-fixed h2 {
        font-size: 1.38rem;
        margin: 0 0 1rem 0;
        padding: 0;
        background: transparent;
        border: none;
        color: inherit;
        text-align: left;
    }

    /* 回答ページSP：右サイドバー内のテキスト */
    #body_wrap.single-drill.drill-answer #right-sidebar-fixed p {
        margin-bottom: 1rem;
        line-height: 2;
        font-size: 1rem;
    }

}

/* SP版（959px以下）：ドリル個別ページの左右paddingを維持（本番: #main { padding: 1.5rem 20px 0 }） */
@media screen and (max-width: 959px) {
    #body_wrap.single-drill #content .l-mainContent,
    #body_wrap.single-drill.drill-tax #content .l-mainContent {
        max-width: none;
        padding: 1.5rem 20px;
    }
}

/* ========================================
   21. レスポンシブ対応
   ======================================== */

/* スマホ表示用（600px以下） */
@media (max-width: 600px) {
    .map-symbol-card {
        padding: 15px;
    }

    .symbol-name {
        font-size: 22px;
    }

    .symbol-name rt {
        font-size: 12px;
    }

    .symbol-meta span {
        font-size: 12px;
    }

    .symbol-description h4,
    .symbol-origin h4,
    .symbol-memo h4 {
        font-size: 16px;
    }
}

/* タブレット以下（768px以下） */
@media (max-width: 768px) {
    .unit {
        font-size: 15px;
    }

    .unit th, .unit td {
        padding: 0.4rem;
    }
}

/* 600px未満のモバイル表示: SWELLのCSS変数をオーバーライド */
/* SWELLは600px未満で --swl-fz--root: 3.6vw を使用（500px幅で18px相当）
   本番環境と同じ16pxに固定するためにオーバーライド */
@media screen and (max-width: 599px) {
    :root {
        --swl-fz--root: 16px;
        --swl-fz--side: 16px;
    }
}

/* モバイル対応（959px以下） */
@media screen and (max-width: 959px) {
    /* 全ページ共通：ヘッダー下のマージンを統一（本番: margin-top:-3rem） */
    #body_wrap .top-page-layout,
    #body_wrap .taxonomy-page-layout,
    #body_wrap .single-page-layout,
    #body_wrap #content.l-content,
    #body_wrap.page #content.l-content,
    #body_wrap.single #content.l-content,
    #body_wrap.archive #content.l-content,
    #body_wrap.search #content.l-content,
    #body_wrap.author #content.l-content {
        margin-top: -3rem; /* ヘッダーの凹み分の余白を埋める（本番と同じ） */
    }

    /* ドリルページ用：少し隙間を広げる */
    #body_wrap.post-type-archive-drill .l-mainContent,
    #body_wrap.single-drill .l-mainContent,
    #body_wrap.drill-tax .l-mainContent {
        margin-top: -2.5rem;
    }

    /* 全ページ共通：SWELLのpadding-topを統一（本番: padding:1.5rem 20px 0） */
    #body_wrap #content.l-content,
    #body_wrap.page #content.l-content,
    #body_wrap.single #content.l-content,
    #body_wrap.archive #content.l-content,
    #body_wrap.search #content.l-content,
    #body_wrap.author #content.l-content {
        padding-top: 1.5rem; /* SWELLの2em/4emを上書き */
    }

    /* 単一投稿・固定ページ：空の#content.l-contentを無効化 */
    #body_wrap.single-post:not(.single-drill) #content.l-content:empty,
    #body_wrap.page #content.l-content:empty {
        display: none;
    }

    /* 単一投稿ページ（教科書コンテンツ）：デスクトップ用ルールを上書き */
    #body_wrap.single-post:not(.single-drill) #content.l-content {
        margin: 0;
        padding: 0;
    }

    /* 固定ページ：デスクトップ用ルールを上書き */
    #body_wrap.page #content.l-content {
        margin-top: -3rem;
        padding-top: 0;
    }

    /* 固定ページの広告位置を上げる（隙間を狭める） */
    /* aboutページ(page-id-12279)は-1.8rem、他の固定ページは-0.75rem */
    #body_wrap.page .l-mainContent__inner {
        margin-top: -0.75rem;
    }
    #body_wrap.page-id-12279 .l-mainContent__inner {
        margin-top: -1.8rem;
    }

    /* 全ページ共通：ヘッダーmargin-bottomを統一（margin-bottom:0の上書き） */
    #body_wrap #header.l-header,
    #body_wrap.home #header.l-header,
    #body_wrap.category #header.l-header,
    #body_wrap.tax-unit #header.l-header,
    #body_wrap.tax-subject #header.l-header,
    #body_wrap.tax-school_year #header.l-header,
    #body_wrap.single #header.l-header,
    #body_wrap.search #header.l-header {
        margin-bottom: 1.8rem !important;
    }

    /* 固定ページ：ヘッダーmargin-bottomを0に */
    #body_wrap.page #header.l-header {
        margin-bottom: 0 !important;
    }

    /* ドリルページのヘッダーmargin-bottom（本番環境と同じ1.3rem） */
    #body_wrap.drill-tax #header.l-header,
    #body_wrap.post-type-archive-drill #header.l-header,
    #body_wrap.single-drill #header.l-header {
        margin-bottom: 1.3rem !important;
    }

    /* ===== 個別対応：ドリルカテゴリページ /primary-school/?drill ===== */
    /* コンテンツを上に移動してヘッダーとの隙間を縮める */
    #body_wrap.category.drill-tax .top-page-layout {
        transform: translateY(-3.5rem);
        margin-bottom: -3.5rem; /* 下の要素との間隔調整 */
        padding-bottom: 0;
    }

    /* ===== 個別対応：ドリル回答ページ /drill/.../answer/ ===== */
    /* translateYはgridレイアウト(1233px+)専用のため、SP版では不要 */

    #body_wrap .top-page-layout,
    #body_wrap .taxonomy-page-layout {
        display: block;
        padding-bottom: 3rem; /* フッターの負のマージン分を確保 */
    }

    /* コンテンツエリア: 本番と同じ幅制限・背景白（本番: #main { padding: 1.5rem 20px 0 }） */
    #body_wrap .top-page-main,
    #body_wrap .taxonomy-page-main {
        max-width: 728px;
        margin: 0 auto;
        padding: 1.5rem 20px 0;
        background-color: #fff;
    }

    #body_wrap .top-page-main .post_content,
    #body_wrap .taxonomy-page-main .post_content {
        max-width: 100%;
    }

    /* 教科書コンテンツSP：メインコンテンツの最大幅（本番: #main { padding: 1.5rem 20px 0 }, #entry { max-width: 728px; margin: 0 auto }） */
    #body_wrap.single:not(.single-drill) .single-page-main {
        max-width: 728px;
        margin: 0 auto;
        padding: 1.5rem 20px 0;
    }

    /* サイドバー: 背景色を両端まで、コンテンツはパディングで調整 */
    /* SP表示時のテキストサイズを16pxに統一（本番環境と同じ） */
    /* 上の599pxメディアクエリで:root CSS変数をオーバーライド済み */
    #body_wrap #sidebar {
        width: 100%;
        max-width: none;
        padding: 1.5rem 25px;
        background-color: #f7f6f4;
        font-size: 16px;
    }

    /* SP表示時：サイドバー内段落のフォントサイズを16pxに統一 */
    #body_wrap #sidebar p,
    #body_wrap .l-sidebar p,
    #body_wrap.drill-tax #sidebar p,
    #body_wrap.drill-tax .l-sidebar p,
    #body_wrap.single-drill #sidebar p,
    #body_wrap.single-drill .l-sidebar p,
    #body_wrap.post-type-archive-drill #sidebar p,
    #body_wrap.post-type-archive-drill .l-sidebar p,
    #body_wrap.drill-tax #sidebar .about p,
    #body_wrap.single-drill #sidebar .about p,
    #body_wrap.post-type-archive-drill #sidebar .about p {
        font-size: 16px;
        line-height: 2;
        word-break: break-all;
    }

    /* 教科書コンテンツSP：サイドバーの余白を減らす */
    #body_wrap .top-page-layout #sidebar,
    #body_wrap .taxonomy-page-layout #sidebar,
    #body_wrap.page #sidebar {
        padding: 1rem 15px;
    }

    /* 教科書コンテンツSP：プロフィールボタン（本番: .5rem 1rem; .79rem;）→38px調整 */
    #body_wrap .top-page-layout #profile a,
    #body_wrap .taxonomy-page-layout #profile a,
    #body_wrap.page #profile a {
        padding: 9px 1rem;
        font-size: .79rem;
    }

    /* 教科書コンテンツSP：サイドバータイトル（本番: h1{font-size:1.5rem} = 24px） */
    #body_wrap .top-page-layout #sidebar .c-widget__title,
    #body_wrap .top-page-layout #sidebar .c-widget__title.-side,
    #body_wrap .taxonomy-page-layout #sidebar .c-widget__title,
    #body_wrap .taxonomy-page-layout #sidebar .c-widget__title.-side,
    #body_wrap.page #sidebar .c-widget__title,
    #body_wrap.page #sidebar .c-widget__title.-side {
        font-size: 1.5rem;
        font-weight: bold;
        margin: 0 0 1rem 0;
        padding: 0;
        text-align: left;
    }

    /* 教科書コンテンツSP：検索フォーム（本番: height:50px; border-radius:1rem; font-size:1rem;） */
    #body_wrap .top-page-layout #sidebar .c-searchForm,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm,
    #body_wrap.page #sidebar .c-searchForm {
        max-width: 630px;
        position: relative;
    }
    #body_wrap .top-page-layout #sidebar .c-searchForm__s,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm__s,
    #body_wrap.page #sidebar .c-searchForm__s {
        height: 50px;
        border-radius: 1rem;
        font-size: 1rem;
        padding: .5rem 40px .5rem 1rem;
        line-height: 2;
    }
    #body_wrap .top-page-layout #sidebar .c-searchForm__submit,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm__submit,
    #body_wrap.page #sidebar .c-searchForm__submit {
        border-radius: 0 1rem 1rem 0;
        width: 50px;
    }

    /* 教科書コンテンツSP：aboutテキスト（本番: line-height:2; font-size:16px） */
    #body_wrap .top-page-layout #sidebar .about p,
    #body_wrap .taxonomy-page-layout #sidebar .about p,
    #body_wrap.page #sidebar .about p {
        line-height: 2;
        font-size: 16px;
    }

    /* 教科書コンテンツSP：バナー画像（本番: width:100%; max-width:500px;） */
    #body_wrap .top-page-layout #sidebar .about img,
    #body_wrap .taxonomy-page-layout #sidebar .about img,
    #body_wrap.page #sidebar .about img {
        width: 100%;
        max-width: 500px;
    }

    /* 画像の幅制限 */
    #body_wrap .top-page-main img,
    #body_wrap .taxonomy-page-main img,
    #body_wrap #sidebar img {
        max-width: 100%;
        height: auto;
    }

    /* バナー画像は固定サイズ（他のレイアウトと統一） */
    #body_wrap #sidebar img[src*="banner"] {
        max-width: 500px;
    }


    /* SP表示時の学年セルの改行防止 */
    .unit tbody th {
        white-space: nowrap;
        font-size: 14px;
        padding: 0.4rem;
    }

    /* SPヘッダーの高さ・レイアウト
       mask-imageで下部が凹んでいるため、padding-bottomを大きくして
       視覚的な緑部分の中央にロゴを配置 */
    #header .l-header__inner {
        min-height: 130px;
        height: 130px;
        padding: 0 0 4.25rem 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* SPロゴを中央寄せ（本番環境: padding:.5rem 0） */
    #header .l-header__logo {
        order: 1;
        flex: 0 0 auto;
        width: auto;
        max-width: none;
        padding: 0.5rem 0;
        text-align: center;
    }

    /* ドリルページSP：ロゴを上下配置・中央揃え（メニューボタン非表示時の暫定対応） */
    #body_wrap.drill-tax #header .l-header__logo,
    #body_wrap.post-type-archive-drill #header .l-header__logo,
    #body_wrap.single-drill #header .l-header__logo {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        align-self: center;
        gap: 8px;
    }

    /* ドリルページSP：ヘッダー内を縦中央揃え（本番環境: height:165px） */
    #body_wrap.drill-tax #header .l-header__inner,
    #body_wrap.post-type-archive-drill #header .l-header__inner,
    #body_wrap.single-drill #header .l-header__inner {
        align-items: center;
        min-height: 165px;
        height: 165px;
    }

    /* ドリルページSP：byロゴのスタイル調整（横中央寄せ） */
    #body_wrap.drill-tax .head-kyoukasyo-logo,
    #body_wrap.post-type-archive-drill .head-kyoukasyo-logo,
    #body_wrap.single-drill .head-kyoukasyo-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        margin: -8px 0 0 0;
        width: 100%;
        text-align: center;
        position: static;
        left: auto;
        transform: none;
    }

    #body_wrap.drill-tax .head-kyoukasyo-logo::before,
    #body_wrap.post-type-archive-drill .head-kyoukasyo-logo::before,
    #body_wrap.single-drill .head-kyoukasyo-logo::before {
        content: 'by';
        position: static;
        color: #fff;
        font-size: 16px;
    }

    /* ドリルページSP：byロゴの画像サイズ（本番環境: max-width:150px） */
    #body_wrap.drill-tax .head-kyoukasyo-logo img,
    #body_wrap.post-type-archive-drill .head-kyoukasyo-logo img,
    #body_wrap.single-drill .head-kyoukasyo-logo img {
        max-width: 150px;
        height: auto;
        margin-left: 5px;
    }

    /* SPロゴサイズ（本番と同じ300px） */
    #header .c-headLogo__img {
        width: 300px;
        max-width: 300px;
        height: 57px;
        object-fit: contain;
        margin: 0 auto;
        display: block;
    }

    /* SPロゴリンクの余白をリセット・垂直中央寄せ */
    #header .c-headLogo,
    #header .c-headLogo__link {
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0;
    }

    /* SP検索ボタンを非表示（メニューボタンのみ表示） */
    #header .l-header__customBtn.sp_ {
        display: none;
    }

    /* SPヘッダーメニューボタン：後工程で実装するため一時的に非表示 */
    #header .l-header__menuBtn.sp_ {
        display: none;
    }

    /* フッター（SP）- 本番環境と同じ設定 */
    /* #footer.l-footer で詳細度(1,1,0) > 親テーマの.l-footer(0,1,0) */
    /* SP表示時のテキストサイズを16pxに統一（本番環境と同じ） */
    /* SP: サイドバーが最後に回り込むため、凹みの白を#f7f6f4に変更し隙間を解消 */
    #footer.l-footer {
        margin-top: -3rem;
        padding: 3rem 2rem 2rem;
        font-size: 16px;
        background: radial-gradient(110% 30% at top, #f7f6f4 50%, #8bbabb 51%);
    }

    /* SP: ドリル系フッターも同様に凹みの白を#f7f6f4に変更 */
    #body_wrap.drill-tax #footer.l-footer,
    #body_wrap.post-type-archive-drill #footer.l-footer,
    #body_wrap.single-drill #footer.l-footer {
        background: radial-gradient(110% 30% at top, #f7f6f4 50%, #f1a98a 51%);
    }

    /* フッター内部のパディングを削除し負のmarginで調整 */
    /* 詳細度(1,1,0) > 親テーマの.l-footer__foot(0,1,0) */
    #footer .l-footer__foot {
        padding: 0;
        margin-top: -1rem;
    }

    /* フッター（SP）- コンテンツを縦並びに */
    /* 詳細度(1,2,0) > 親テーマの.l-container */
    #footer .l-footer__foot .l-container {
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        width: 100%;
        max-width: none;
        padding: 0;
        margin: 0;
    }

    /* フッター（SP）- ナビゲーションを縦並びに */
    /* 詳細度(1,2,1) > 親テーマの.l-footer__nav(0,1,0) */
    #body_wrap #footer .l-footer__foot .l-footer__nav {
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        padding-top: 2rem;
    }

    /* フッター（SP）- ナビリスト項目の中央寄せ */
    /* 詳細度(1,1,1) */
    #footer .l-footer__nav li {
        margin: 0;
        text-align: center;
        width: 100%;
    }

    /* フッター（SP）- ナビリンクの中央寄せ・フォントサイズ */
    /* 詳細度(1,1,2) > 親テーマの.l-footer__nav a(0,1,1) */
    /* SWELLは.l-footer__nav aでfont-size:3vwを使用→16pxに固定 */
    #footer .l-footer__nav li a {
        display: block;
        text-align: center;
        width: 100%;
        font-size: 16px;
    }

    /* フッター（SP）- コピーライトの中央寄せ */
    /* 詳細度(1,2,0) > 親テーマの.l-footer .copyright(0,2,0) */
    #footer .l-footer__foot .copyright {
        margin: 0;
        text-align: center;
        width: 100%;
    }



    /* サイドバーの下部スペース（背景色をフッターまで届かせる） */
    #body_wrap #sidebar {
        padding-bottom: 6rem;
    }

    /* トップページレイアウト：padding-bottom不要 */
    #body_wrap .top-page-layout {
        padding-bottom: 0;
    }

    /* SP検索フォームの調整（幅調整: 本番と同じ630px） */
    #body_wrap .top-page-layout #sidebar .c-searchForm,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm {
        margin-bottom: 1.5rem;
        width: 100%;
        max-width: 630px; /* 本番と同じ */
    }

    /* 検索ボタン（虫眼鏡）の幅を確保 */
    #body_wrap .top-page-layout #sidebar .c-searchForm__submit,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm__submit {
        min-width: 44px;
        width: 44px;
        flex-shrink: 0;
    }

    /* ドリルサイドバーSP：ナビゲーション3カラムを縦並びに変更 */
    #body_wrap.drill-tax #sidebar .c-widget p[style*="display: flex"],
    #body_wrap.drill-tax #sidebar .c-widget p[style*="display:flex"] {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* ドリルサイドバーSP：各ulリストの幅を100%に */
    #body_wrap.drill-tax #sidebar .c-widget p[style*="display: flex"] ul,
    #body_wrap.drill-tax #sidebar .c-widget p[style*="display:flex"] ul {
        width: 100%;
    }

    /* ドリルサイドバーSP：検索フォームの幅調整 */
    #body_wrap.drill-tax #sidebar .c-searchForm {
        width: 100%;
        max-width: 100%;
    }

    /* ドリルサイドバーSP：ウィジェットタイトル（本番: h1{font-size:1.5rem} = 24px） */
    #body_wrap.drill-tax #sidebar .c-widget__title,
    #body_wrap.drill-tax #sidebar .c-widget__title.-side,
    #body_wrap.post-type-archive-drill #sidebar .c-widget__title,
    #body_wrap.post-type-archive-drill #sidebar .c-widget__title.-side {
        font-size: 1.5rem;
        margin: 0 0 1rem 0;
        padding: 0;
        text-align: left;
    }

    /* ドリルサイドバーSP：aboutテキスト（本番環境と同じ16px） */
    #body_wrap.drill-tax #sidebar .about p,
    #body_wrap.post-type-archive-drill #sidebar .about p {
        font-size: 16px;
    }

    /* ドリルサイドバーSP：バナー画像（本番: width:100%; max-width:500px;） */
    #body_wrap.drill-tax #sidebar .about img,
    #body_wrap.post-type-archive-drill #sidebar .about img {
        width: 100%;
        max-width: 500px;
    }

    /* ドリルサイドバーSP：プロフィールボタン（本番: #profile a） */
    #body_wrap.drill-tax #sidebar #profile a,
    #body_wrap.post-type-archive-drill #sidebar #profile a {
        background: #518bcb;
        display: block;
        color: #fff;
        padding: .5rem 1rem;
        border-radius: 2rem;
        margin-top: .5rem;
        font-size: .79rem;
        text-decoration: none;
    }

    /* ドリルサイドバーSP：サイドバー全体の表示調整 */
    #body_wrap.drill-tax #content .l-sidebar {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
    }

    /* ドリル個別ページSP：コンテンツの順序を本番環境と統一 */
    /* 詳細度(2,2,0): #body_wrap.single-drill #content.l-content で親テーマを上回る */
    #body_wrap.single-drill #content.l-content,
    #body_wrap.single-drill.drill-tax #content.l-content {
        display: flex;
        flex-direction: column;
    }

    /* ドリル個別ページSP：メインコンテンツを先に表示 */
    #body_wrap.single-drill #content .l-mainContent,
    #body_wrap.single-drill.drill-tax #content .l-mainContent {
        order: 1;
        flex: none;
        width: 100%;
    }

    /* ドリル個別ページSP：サイドバーをメインコンテンツの後に表示（PC用order:-1を上書き） */
    #body_wrap.single-drill #content #sidebar,
    #body_wrap.single-drill #content .l-sidebar,
    #body_wrap.single-drill.drill-tax #content #sidebar,
    #body_wrap.single-drill.drill-tax #content .l-sidebar {
        order: 2;
        flex: none;
        width: 100%;
    }

    /* ドリル個別ページSP：右サイドバーを非表示（回答ページ以外） */
    #body_wrap.single-drill:not(.drill-answer) #right-sidebar-fixed,
    #body_wrap.single-drill.drill-tax:not(.drill-answer) #right-sidebar-fixed {
        display: none;
    }

    /* ドリル個別ページSP：PC用スティッキーサイドバーを解除 */
    #body_wrap.single-drill #sidebar,
    #body_wrap.single-drill #content #sidebar,
    #body_wrap.single-drill #content .l-sidebar {
        position: static;
        height: auto;
        max-height: none;
        overflow: visible;
        align-self: auto;
    }

    /* ドリル個別ページSP：サイドバー内部要素のスクロール設定を解除 */
    #body_wrap.single-drill #sidebar .l-sidebar__inner {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    /* ドリル個別ページSP：サイドバー全体のスタイル（本番環境と統一） */
    #body_wrap.single-drill #content #sidebar,
    #body_wrap.single-drill #content .l-sidebar,
    #body_wrap.single-drill.drill-tax #content #sidebar,
    #body_wrap.single-drill.drill-tax #content .l-sidebar {
        background: #f7f6f4;
        padding: 1.5rem 20px;
        width: 100%;
        max-width: 100%;
        margin-top: 0;
        margin-bottom: 0;
        padding-bottom: 2rem;
    }

    /* ドリル個別ページSP：SWELLのサイドバー内ラッパーをリセット */
    #body_wrap.single-drill #sidebar .l-sidebar__inner,
    #body_wrap.single-drill #sidebar .w-sidebar,
    #body_wrap.single-drill #sidebar .c-widget {
        padding: 0;
        margin: 0;
        max-width: 100%;
        overflow: visible;
    }

    #body_wrap.single-drill #sidebar #side-inside {
        overflow: visible;
    }

    /* ドリル個別ページSP：検索フォーム */
    #body_wrap.single-drill #sidebar .c-searchForm {
        width: 100%;
        max-width: 100%;
        margin-top: 0;
        margin-bottom: 1.5rem;
    }

    /* ドリル個別ページSP：ナビリンク（ul.drill-nav-links） */
    #body_wrap.single-drill #sidebar .drill-nav-links {
        list-style: none;
        padding: 0;
        margin: 0 0 1.5rem 0;
    }

    #body_wrap.single-drill #sidebar .drill-nav-links li {
        line-height: 1.4;
        margin: 0.8rem 0;
        padding: 0;
    }

    #body_wrap.single-drill #sidebar .drill-nav-links li a {
        font-weight: 700;
    }

    /* ドリル個別ページSP：ウィジェットタイトル（本番: h1{font-size:1.5rem} = 24px） */
    #body_wrap.single-drill #sidebar .c-widget__title.-side {
        font-size: 1.5rem;
        margin: 0 0 1rem 0;
        padding: 0;
        text-align: left;
        background: transparent;
        color: inherit;
        border: none;
    }

    #body_wrap.single-drill #sidebar .c-widget__title.-side::before,
    #body_wrap.single-drill #sidebar .c-widget__title.-side::after {
        display: none;
    }

    /* ドリル個別ページSP：ドリルリスト（ol.drill-list） */
    #body_wrap.single-drill #sidebar .drill-list {
        padding-left: 4em;
        list-style: decimal;
        margin: 0 0 2rem 0;
    }

    #body_wrap.single-drill #sidebar .drill-list li {
        position: relative;
        line-height: 1.4;
        margin: 0.8rem 0;
        padding: 0;
        font-size: 1em;
    }

    #body_wrap.single-drill #sidebar .drill-list li a {
        font-weight: 400;
    }

    /* ドリル個別ページSP：現在閲覧中のアイテム */
    #body_wrap.single-drill #sidebar .drill-list .unit-active {
        color: #e54c4c;
        font-weight: 700;
    }

    /* ドリル個別ページSP：済/未マークを表示 */
    #body_wrap.single-drill #sidebar .drill-list li::before {
        content: attr(data-status);
        position: absolute;
        left: -3.8em;
        top: 0;
        color: red;
        font-weight: 700;
        width: 1.5em;
        text-align: center;
    }

    #body_wrap.single-drill #sidebar .drill-list li[data-status="済"]::before {
        color: green;
    }

    /* ========================================
       固定ページ（.page）SP用スタイル
       ======================================== */

    /* 固定ページSP：コンテンツを縦並びに */
    #body_wrap.page #content.l-content {
        flex-direction: column;
        margin-top: 0;
        padding-top: 1rem;
    }

    /* 固定ページSP：メインコンテンツを100%幅に（max-widthは共通ルール728pxを継承） */
    #body_wrap.page #content .l-mainContent.l-article {
        flex: none;
        width: 100%;
        padding: 1rem 20px;
        padding-top: 0;
        margin-top: 0;
    }

    /* 固定ページSP：コンテンツ幅制限を解除 */
    #body_wrap.page #content .l-mainContent .post_content {
        max-width: 100%;
        padding: 0 0 2rem;
    }

    /* 固定ページSP：サイドバーを100%幅に */
    #body_wrap.page #content .l-sidebar {
        flex: none;
        width: 100%;
        max-width: 100%;
        padding: 1.5rem 20px;
        padding-top: 1.5rem;
        margin-top: 0;
    }

    /* 固定ページSP：サイドバー内部要素を100%幅に */
    #body_wrap.page #content .l-sidebar .l-sidebar__inner,
    #body_wrap.page #content .l-sidebar .w-sidebar,
    #body_wrap.page #content .l-sidebar .c-widget {
        max-width: 100%;
    }

    /* ========================================
       運営者情報ページ（author）SP用スタイル
       ======================================== */

    /* authorページSP：コンテンツを縦並びに */
    #body_wrap.author #content.l-content {
        flex-direction: column;
        margin-top: -3rem;
        padding-top: 0;
    }

    /* authorページSP：メインコンテンツを100%幅に */
    #body_wrap.author #content .l-mainContent.l-article {
        flex: none;
        width: 100%;
        max-width: 100%;
        padding: 1rem 20px;
        padding-top: 1.5rem;
        margin-top: 0;
    }

    /* authorページSP：コンテンツ幅制限を解除・文字サイズを本番(18px)に合わせる */
    #body_wrap.author #content .l-mainContent .post_content {
        max-width: 100%;
        padding: 0 0 2rem;
        font-size: 18px;
        line-height: 2;
    }

    /* authorページSP：サイドバーを100%幅に */
    #body_wrap.author #content .l-sidebar {
        flex: none;
        width: 100%;
        max-width: 100%;
        padding: 1.5rem 20px;
        padding-top: 1.5rem;
        margin-top: 0;
    }

    /* authorページSP：サイドバー内部要素を100%幅に */
    #body_wrap.author #content .l-sidebar .l-sidebar__inner,
    #body_wrap.author #content .l-sidebar .w-sidebar,
    #body_wrap.author #content .l-sidebar .c-widget {
        max-width: 100%;
    }

    /* authorページSP：検索窓の最大幅（本番: 630px） */
    #body_wrap.author #content .l-sidebar .c-searchForm {
        max-width: 630px;
    }

    /* authorページSP：ページタイトルを100%幅に */
    #body_wrap.author .c-pageTitle {
        max-width: 100%;
        margin-top: 1rem;
        padding-left: 20px;
        padding-right: 20px;
    }

    /* authorページSP：フッターのマージン調整 */
    #body_wrap.author #footer.l-footer {
        margin-top: 0;
    }

    /* ========================================
       Aboutページ（page-id-12279）SP用スタイル
       ======================================== */

    /* aboutページSP：コンテンツを縦並びに */
    #body_wrap.page-id-12279 #content.l-content {
        flex-direction: column;
        margin-top: 0;
        padding-top: 1rem;
    }

    /* aboutページSP：メインコンテンツ（max-widthは共通ルール728pxを継承） */
    #body_wrap.page-id-12279 #content .l-mainContent.l-article {
        flex: none;
        width: 100%;
        padding: 1rem 20px;
    }

    /* aboutページSP：コンテンツ幅制限を解除 */
    #body_wrap.page-id-12279 #content .l-mainContent .post_content {
        max-width: 100%;
        padding: 0 0 2rem;
    }

    /* aboutページSP：サイドバーを100%幅に */
    #body_wrap.page-id-12279 #content .l-sidebar {
        flex: none;
        width: 100%;
        max-width: 100%;
        padding: 1.5rem 20px;
    }

    /* aboutページSP：サイドバー内部要素を100%幅に */
    #body_wrap.page-id-12279 #content .l-sidebar .l-sidebar__inner,
    #body_wrap.page-id-12279 #content .l-sidebar .w-sidebar,
    #body_wrap.page-id-12279 #content .l-sidebar .c-widget {
        max-width: 100%;
    }

    /* aboutページSP：検索窓を100%幅に */
    #body_wrap.page-id-12279 #content .l-sidebar .c-searchForm {
        width: 100%;
        max-width: 100%;
    }

    /* aboutページSP：フッターのマージン調整 */
    #body_wrap.page-id-12279 #footer.l-footer {
        margin-top: 0;
    }

    /* ========================================
       PDFページSP用スタイル
       ======================================== */

    /* PDFページSP：コンテンツを縦並びに */
    #body_wrap.single #content.pdf-page {
        flex-direction: column;
    }

    /* PDFページSP：メインコンテンツを100%幅に */
    #body_wrap.single #content.pdf-page .l-mainContent {
        flex: none;
        width: 100%;
        max-width: 100%;
        padding: 1rem 20px;
    }

    /* PDFページSP：コンテンツ幅制限を解除 */
    #body_wrap.single #content.pdf-page .l-mainContent article {
        max-width: 100%;
    }

    /* PDFページSP：パンくずリスト幅制限を解除 */
    #body_wrap.single #content.pdf-page .l-mainContent #breadcrumb {
        max-width: 100%;
    }

    /* PDFページSP：サイドバーを100%幅に */
    #body_wrap.single #content.pdf-page .l-sidebar {
        flex: none;
        width: 100%;
        max-width: 100%;
        padding: 1.5rem 20px;
        background: #f7f6f4;
    }

    /* PDFページSP：検索窓を100%幅に */
    #body_wrap.single #content.pdf-page .l-sidebar .c-searchForm {
        max-width: 100%;
    }

    /* ========================================
       ドリル回答ページSP用スタイル
       ======================================== */

    /* 回答ページSP：コンテンツを縦並びに */
    #body_wrap.drill-answer #content.l-content {
        flex-direction: column;
    }

    /* 回答ページSP：メインコンテンツ（max-width: 728pxで幅制限・中央配置） */
    #body_wrap.drill-answer #content .l-mainContent {
        flex: none;
        width: 100%;
        max-width: 728px;
        padding: 1.5rem 0 0;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 0;
    }

    /* 回答ページSP：コンテンツ幅制限を解除 */
    #body_wrap.drill-answer #content .l-mainContent .post_content {
        max-width: 100%;
    }

    /* 回答ページSP：右サイドバーを100%幅に */
    #body_wrap.drill-answer #content #right-sidebar-fixed {
        flex: none;
        width: 100%;
        max-width: 100%;
        padding: 1.5rem 20px;
        background: #f7f6f4;
    }

    /* ========================================
       ドリルカテゴリページSP用サイドバー（検索バーのみ）
       本番環境: #side { background:#f7f6f4; padding:1.5rem 20px }
       ======================================== */

    /* ドリルカテゴリページSP：サイドバー全体（本番: 1232px以下は非表示） */
    /* 本番環境では1232px以下でサイドバーが非表示のため、このルールは不要
    #body_wrap.drill-tax #side,
    #body_wrap.drill-tax .drill-sidebar {
        display: none;
    }
    */

    /* ドリルカテゴリページSP：side-inside内部 */
    #body_wrap.drill-tax #side #side-inside,
    #body_wrap.drill-tax .drill-sidebar #side-inside {
        padding: 0;
        margin: 0;
    }

    /* ドリルカテゴリページSP：検索フォーム（本番: max-width:35em; height:50px） */
    #body_wrap.drill-tax #side .c-searchForm,
    #body_wrap.drill-tax .drill-sidebar .c-searchForm {
        max-width: 35em;
        width: 100%;
        position: relative;
        margin: 1.5rem 0;
    }

    /* ドリルカテゴリページSP：検索入力欄（本番: height:50px; border-radius:1rem; font-size:1rem） */
    #body_wrap.drill-tax #side .c-searchForm__s,
    #body_wrap.drill-tax .drill-sidebar .c-searchForm__s {
        height: 50px;
        border-radius: 1rem;
        font-size: 1rem;
        padding: .5rem 50px .5rem 1rem;
        line-height: 2;
        border: 1px solid hsla(0,0%,78%,.5);
        width: 100%;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-color: #fff;
    }

    /* ドリルカテゴリページSP：検索ボタン（本番: width:50px; border-radius:0 1rem 1rem 0） */
    #body_wrap.drill-tax #side .c-searchForm__submit,
    #body_wrap.drill-tax .drill-sidebar .c-searchForm__submit {
        position: absolute;
        right: 0;
        top: 0;
        width: 50px;
        height: 100%;
        border-radius: 0 1rem 1rem 0;
        background-color: #518bcb;
        border: none;
        cursor: pointer;
        padding: 0;
    }
}

/* タブレット以下（1024px以下） */
@media screen and (max-width: 1024px) {
    .single #content.l-content,
    .single #content.pdf-page,
    .drill-tax #content.l-content,
    .single-drill #content.l-content {
        flex-direction: column;
    }

    .single #content .l-sidebar:first-of-type,
    .single #content .l-sidebar:last-of-type,
    .single #content .l-mainContent,
    .single #content.pdf-page .l-mainContent,
    .single #content.pdf-page .l-sidebar,
    .drill-tax #content .l-mainContent,
    .drill-tax #content .l-sidebar,
    .single-drill #content .l-sidebar,
    .single-drill #content .l-mainContent,
    .single-drill #right-sidebar-fixed {
        order: unset;
        flex: none;
        width: 100%;
        max-width: none;
        min-width: auto;
        margin-left: 0;
        margin-right: 0;
    }
}

/* PC版（1233px以上） */
@media screen and (min-width: 1233px) {
    /* 選択肢を横並びに（本番環境と統一） */
    .question-child-choices {
        flex-direction: row;
    }

    /* テストシェアコンテナ（本番環境と統一） */
    .test-share-container {
        display: flex;
        gap: 1.5rem;
        align-items: center;
        justify-content: center;
    }

    .test-share-container p {
        margin-bottom: 0;
    }

    .test-share-container button {
        margin-top: 0;
        max-width: 300px;
    }

    /* サブボタンコンテナ（本番環境と統一） */
    .sub-buttons-container {
        display: flex;
        justify-content: space-around;
        align-items: flex-end;
    }

    .top-page-layout,
    .taxonomy-page-layout {
        display: flex;
    }

    .top-page-main,
    .taxonomy-page-main {
        flex: 0 0 70%;
        width: 70%;
        padding: 1.5rem 20px 2.5rem;
    }

    .top-page-main .post_content,
    .taxonomy-page-main .post_content {
        max-width: 728px;
        margin: 0 auto;
    }

    .top-page-layout #sidebar,
    .taxonomy-page-layout #sidebar {
        flex: 0 0 30%;
        width: 30%;
        position: sticky;
        top: 0;
        align-self: start;
        min-height: 100vh;
        padding: 1.5rem;
    }

    /* ドリルサイドバーも同じ設定（教科書と統一、SWELL親テーマ上書き） */
    #body_wrap.drill-tax #content .l-sidebar {
        position: sticky;
        top: 0;
        align-self: start;
        min-height: 100vh;
        padding: 1.5rem;
    }

    /* サイドバー内コンテンツ - pタグテキストは右端まで使用 */
    #body_wrap .top-page-layout #sidebar .l-sidebar__inner,
    #body_wrap .top-page-layout #sidebar .w-sidebar,
    #body_wrap .taxonomy-page-layout #sidebar .l-sidebar__inner,
    #body_wrap .taxonomy-page-layout #sidebar .w-sidebar {
        max-width: none;
        padding-right: 0;
        overflow: visible;
    }

    #body_wrap .top-page-layout #sidebar .c-widget,
    #body_wrap .taxonomy-page-layout #sidebar .c-widget {
        max-width: none;
        overflow: visible;
    }

    /* 検索バーの幅を本番と同じ630pxに制限 */
    #body_wrap .top-page-layout #sidebar .c-searchForm,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm {
        width: 100%;
        max-width: 630px; /* 本番と同じ */
    }

    /* 画像の幅を500pxに制限（本番と同じ） */
    #body_wrap .top-page-layout #sidebar .c-widget img,
    #body_wrap .taxonomy-page-layout #sidebar .c-widget img {
        max-width: 500px;
        height: auto;
    }

    /* ウィジェットタイトル（h2）の幅を400pxに制限 */
    #body_wrap .top-page-layout #sidebar .c-widget__title,
    #body_wrap .taxonomy-page-layout #sidebar .c-widget__title {
        max-width: 400px;
    }

    /* プロフィールのflexエリアを400pxに制限 */
    #body_wrap .top-page-layout #sidebar .c-widget div[style*="display: flex"],
    #body_wrap .top-page-layout #sidebar .c-widget div[style*="display:flex"],
    #body_wrap .taxonomy-page-layout #sidebar .c-widget div[style*="display: flex"],
    #body_wrap .taxonomy-page-layout #sidebar .c-widget div[style*="display:flex"] {
        max-width: 400px;
    }


    /* フッターのマージン調整（PC版、本番環境と統一） */
    .l-footer {
        margin-top: -2rem;
    }
}

/* より大きい画面（1358px以上） */
@media screen and (min-width: 1358px) {
    .top-page-main,
    .taxonomy-page-main {
        padding: 1.5rem 8% 2.5rem;
    }
}

/* 画面幅が狭い場合は固定サイドバーを非表示（1400px以下、回答ページ以外） */
@media screen and (max-width: 1400px) {
    #body_wrap:not(.drill-answer) #right-sidebar-fixed {
        display: none;
    }

    /* ドリル回答ページ：右サイドバーを表示（本番環境と統一） */
    #body_wrap.drill-answer #right-sidebar-fixed {
        display: block;
        width: 100%;
        padding: 1.5rem 20px;
        background: #f7f6f4;
        position: static;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    /* ドリル回答ページ：検索フォーム（本番環境と統一） */
    #body_wrap.drill-answer #right-sidebar-fixed .c-searchForm {
        margin: 1.5rem 0;
        max-width: 630px;
        width: 100%;
    }

    #body_wrap.drill-answer #right-sidebar-fixed .c-searchForm__s {
        height: 50px;
        border-radius: 1rem;
        font-size: 1rem;
    }

    /* ドリル回答ページ：タイトル（本番環境と統一） */
    #body_wrap.drill-answer #right-sidebar-fixed h1,
    #body_wrap.drill-answer #right-sidebar-fixed h2 {
        font-size: 1.38rem;
        margin: 0 0 1rem 0;
        padding: 0;
        background: transparent;
        border: none;
        color: inherit;
    }

    /* ドリル回答ページ：テキスト（本番環境と統一） */
    #body_wrap.drill-answer #right-sidebar-fixed p {
        margin-bottom: 1rem;
        line-height: 2;
        font-size: 1rem;
    }
}

/* ========================================
   22. 運営者情報（プロフィール）スタイル
   ======================================== */

/* プロフィール囲み枠（本番環境と統一） */
#profile-wrap {
    border: 2px dashed #8bbabb;
    border-radius: 2rem;
    margin: 3rem 0 3rem;
    padding: 2rem 1rem;
}

/* プロフィール見出し（本番環境と統一、SWELL上書き） */
#body_wrap .post_content h2#profile-head,
#body_wrap #profile-wrap h2#profile-head {
    background: #fff;
    color: #8bbabb;
    border: none;
    margin: 1rem 0 1rem 0;
    padding: 0;
    padding-left: 0;
    font-size: 1.38rem;
}

/* SWELLのh2疑似要素を無効化（SWELL上書き） */
#body_wrap .post_content h2#profile-head::before,
#body_wrap .post_content h2#profile-head::after,
#body_wrap #profile-wrap h2#profile-head::before,
#body_wrap #profile-wrap h2#profile-head::after {
    display: none;
    content: none;
}

/* プロフィール本体（flexレイアウト、本番環境と統一） */
#body_wrap #profile {
    text-align: left;
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

#body_wrap .top-page-layout #sidebar .c-widget #profile p,
#body_wrap .taxonomy-page-layout #sidebar .c-widget #profile p,
#body_wrap #profile p {
    margin-bottom: 0;
    line-height: 1.4;
    font-size: 18px;
    word-break: normal;
    width: auto;
}

#body_wrap #profile img {
    margin-right: 1rem;
    width: 100px;
}

/* プロフィールボタン（モバイル・本番環境と統一 206px × 38px） */
#body_wrap #profile a {
    background: #518bcb;
    display: block;
    color: #fff;
    padding: 5px 1rem;
    border-radius: 2rem;
    margin-top: .5rem;
    font-size: .79rem;
    text-decoration: none;
    width: 206px;
    text-align: center;
}

/* ドリルページ用 .u-bg-main ボタン背景色（var(--color_main)を上書き） */
#body_wrap.drill-tax .u-bg-main,
#body_wrap.post-type-archive-drill .u-bg-main,
#body_wrap.single-drill .u-bg-main {
    background: #518bcb;
}

/* .about（説明文エリア、本番環境と統一） */
.about {
    margin-bottom: 1.5rem;
}

.about figure {
    margin-bottom: 1rem;
}

.about img {
    width: 100%;
    max-width: 500px;
}

.about p {
    line-height: 2;
    word-break: break-all;
}

#profile-wrap .about {
    margin-bottom: 0;
}

#profile-wrap .about p {
    font-size: 1rem;
}

/* PC版（1233px以上） */
@media screen and (min-width: 1233px) {
    #profile-wrap {
        margin: 3rem 0 3rem;
        padding: 2rem;
    }

    #body_wrap #profile a {
        display: block;
        font-size: 18px;
        padding: 8px 1rem;
        line-height: 1.5;
        width: 250px;
        text-align: center;
    }
}

/* ========================================
   23. コメントセクションスタイル
   ======================================== */

/* コメントセクション全体を表示（SWELL上書き） */
#body_wrap .l-articleBottom,
#body_wrap .l-articleBottom__section,
#body_wrap .comment-respond,
#body_wrap #respond,
#body_wrap #commentform,
#body_wrap .comment-form {
    display: block;
    visibility: visible;
    opacity: 1;
    max-height: none;
    overflow: visible;
}

/* コメント見出し #comment-head（本番環境と統一） */
#body_wrap h2#comment-head {
    margin-top: 3rem;
    background: transparent;
    color: inherit;
    border: none;
    padding: 0;
}

#body_wrap h2#comment-head::before,
#body_wrap h2#comment-head::after {
    display: none;
    content: none;
}

/* SWELL h3 コメント見出し（本番環境と統一、SWELL上書き） */
#body_wrap .post_content h3.comment-reply-title,
#body_wrap h3.comment-reply-title,
#body_wrap #reply-title {
    background: transparent;
    color: inherit;
    border: none;
    padding: 0;
    margin-top: 0;
    font-size: 1.25rem;
}

#body_wrap .post_content h3.comment-reply-title::before,
#body_wrap .post_content h3.comment-reply-title::after,
#body_wrap h3.comment-reply-title::before,
#body_wrap h3.comment-reply-title::after {
    display: none;
    content: none;
}

/* SWELLのコメントセクション見出し（l-articleBottom__title, c-secTitle）を上書き */
#body_wrap .l-articleBottom h2.l-articleBottom__title,
#body_wrap .l-articleBottom h2.c-secTitle,
#body_wrap .post_content h2.l-articleBottom__title,
#body_wrap .post_content h2.c-secTitle {
    background: transparent;
    color: inherit;
    border: none;
    border-left: none;
    padding: 0;
    margin-top: 3rem;
}

#body_wrap .l-articleBottom h2.l-articleBottom__title::before,
#body_wrap .l-articleBottom h2.l-articleBottom__title::after,
#body_wrap .l-articleBottom h2.c-secTitle::before,
#body_wrap .l-articleBottom h2.c-secTitle::after,
#body_wrap .post_content h2.l-articleBottom__title::before,
#body_wrap .post_content h2.l-articleBottom__title::after {
    display: none;
    content: none;
    border: none;
}

/* コメントリスト（本番環境と統一） */
#commets-list,
.comment-list {
    background: rgba(200, 200, 200, .15);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: inset 0 2px 4px rgb(0 0 0 / 6%);
    list-style: none;
}

#commets-list ul,
.comment-list ul {
    list-style: none;
}

#commets-list p,
.comment-list p {
    margin-bottom: 1rem;
    word-wrap: break-word;
}

/* コメント投稿者（本番環境と統一） */
.comment-author {
    word-wrap: break-word;
}

.comment-author .says {
    display: none;
}

/* コメントメタ情報（日時部分のみ小さく・グレーに） */
.comment-metadata {
    color: #666;
    font-size: 11px;
    margin: .5em 0;
}

.comment-metadata a {
    color: inherit;
    text-decoration: none;
}

/* 返信リンク（本番環境と統一） */
.comment-reply-link {
    background: #aaa;
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    text-decoration: none;
}

/* 子コメント（本番環境と統一） */
.children {
    border-left: 1px solid hsla(0, 0%, 78%, .5);
    margin-left: 1.5em;
    margin-top: 1em;
    padding: 1em 0 0 1.5em;
}

/* コメントフォームラベル（本番環境と統一） */
.comment-respond label,
.comment-form label {
    display: block;
    font-size: .9em;
    margin-bottom: .25em;
}

/* コメント入力欄・名前入力欄（本番環境と統一、SWELL上書き） */
textarea#comment,
input#author,
.comment-respond textarea,
.comment-respond input[type="text"],
.comment-form textarea,
.comment-form input[type="text"] {
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    background: #fff;
    width: 100%;
    box-shadow: inset 0 1px 4px rgb(0 0 0 / 6%);
    border-radius: 4px;
    border: 1px solid hsla(0, 0%, 78%, .5);
    padding: 1rem;
    box-sizing: border-box;
    font-size: 1rem;
}

textarea#comment:focus-visible,
input#author:focus-visible,
.comment-respond textarea:focus-visible,
.comment-respond input[type="text"]:focus-visible {
    outline: 3px solid #8bbabb;
}

/* 名前入力欄の下余白（本番環境と統一） */
.comment-form-author {
    margin-bottom: 2rem;
}

/* コメント欄の高さ調整 */
textarea#comment,
.comment-form textarea {
    height: 150px;
    min-height: 150px;
}


/* コメントフォーム全体の下余白 */
.comment-form {
    padding-bottom: 2rem;
}

/* メインコンテンツ下の余白（フッターとの間隔） */
#body_wrap .l-mainContent,
#body_wrap #main_content {
    padding-bottom: 3rem;
}

/* サイドバー下の余白（フッターとの間隔） */
#body_wrap .l-sidebar,
#body_wrap #sidebar,
#body_wrap .l-sidebar__inner {
    padding-bottom: 3rem;
}

/* PC版のみ（960px以上）：左サイドバーのスクロール設定 */
@media screen and (min-width: 960px) {
    /* 左サイドバーのスクロール設定（コンテンツがはみ出す場合） */
    /* flexboxレイアウト対応: stickyとheight制約でスクロール実現 */
    #body_wrap.single-drill #content #sidebar {
        position: sticky;
        top: 0;
        align-self: flex-start;
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
    }

    /* 内側要素にスクロールを適用 */
    #body_wrap.single-drill #content #sidebar .l-sidebar__inner {
        height: 100%;
        max-height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: 3rem;
    }

    #body_wrap.single-drill #content #sidebar .w-sidebar {
        max-height: none;
        overflow: visible;
    }

    /* 左サイドバーのスクロールバーを目立たなくする */
    body.single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar,
    #body_wrap.single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar,
    .single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar {
        width: 6px;
    }

    body.single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar-track,
    #body_wrap.single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar-track,
    .single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar-track {
        background: transparent;
    }

    body.single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar-thumb,
    #body_wrap.single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar-thumb,
    .single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }

    body.single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar-thumb:hover,
    #body_wrap.single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar-thumb:hover,
    .single-drill #sidebar .l-sidebar__inner::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* ドリル一覧ページのサイドバー：テキストは右端で折り返し、上部余白なし */
#body_wrap.drill-tax #sidebar .l-sidebar__inner,
#body_wrap.drill-tax #sidebar .w-sidebar,
#body_wrap.post-type-archive-drill #sidebar .l-sidebar__inner,
#body_wrap.post-type-archive-drill #sidebar .w-sidebar {
    max-height: none;
    overflow: hidden;
    top: 0;
    position: relative;
}

/* 教科書コンテンツのサイドバー：上部余白なし */
#body_wrap .top-page-layout #sidebar .l-sidebar__inner,
#body_wrap .top-page-layout #sidebar .w-sidebar,
#body_wrap .taxonomy-page-layout #sidebar .l-sidebar__inner,
#body_wrap .taxonomy-page-layout #sidebar .w-sidebar {
    max-height: none;
    overflow: visible;
    top: 0;
    position: relative;
}

/* 右サイドバーのスクロール設定
   コンテンツが画面に収まらない場合のみスクロールバー表示 */
.single-drill #right-sidebar-fixed {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: auto;
}

.single-drill #right-side-inside {
    background: transparent;
}

/* 右サイドバーのスクロールバーを目立たなくする */
.single-drill #right-sidebar-fixed::-webkit-scrollbar {
    width: 6px;
}

.single-drill #right-sidebar-fixed::-webkit-scrollbar-track {
    background: transparent;
}

.single-drill #right-sidebar-fixed::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.single-drill #right-sidebar-fixed::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* コメント送信ボタン（本番環境と統一、SWELL上書き） */
.comment-respond #submit,
.comment-form #submit,
.comment-respond .submit,
input.submit[type="submit"] {
    -webkit-appearance: none;
    appearance: none;
    background: #518bcb;
    border: none;
    display: block;
    color: #fff;
    padding: 0 1rem;
    border-radius: 2rem;
    margin-top: 1.5rem;
    width: 222px;
    height: 38px;
    line-height: 38px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: opacity .25s;
}

.comment-respond #submit:hover,
.comment-form #submit:hover,
input.submit[type="submit"]:hover {
    opacity: .8;
}

/* ========================================
   24. ドリル回答ページ専用スタイル
   ======================================== */

/* 回答ページでは左サイドバーを非表示（本番環境と統一） */
#body_wrap.drill-answer #content #sidebar,
#body_wrap.drill-answer #content .l-sidebar:first-of-type,
#body_wrap.drill-answer #content aside.l-sidebar {
    display: none;
}

/* 回答ページのレイアウト調整（本番環境と同じgridレイアウト、PC: 1233px以上） */
@media screen and (min-width: 1233px) {
    #body_wrap.drill-answer #content.l-content {
        display: grid;
        grid-template-columns: 1fr calc(400px + 3rem);
    }

    #body_wrap.drill-answer #content .l-mainContent {
        grid-row: 1/2;
        grid-column: 1/2;
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 1.5rem 20px 2.5rem;
    }

    #body_wrap.drill-answer #content #right-sidebar-fixed {
        position: sticky;
        top: 0;
        right: 0;
        z-index: 11;
        align-self: start;
        grid-row: 1/2;
        grid-column: 2/3;
        width: 100%;
        max-width: none;
        min-height: 100vh;
        padding: 1.5rem 1.5rem 0 1.5rem;
        background: #f7f6f4;
    }
}

/* 回答ページのh2見出し背景色（SWELLデフォルトを上書き、本番環境と統一） */
#body_wrap.drill-answer .post_content h2 {
    background: #8bbabb;
    color: #fff;
    border-left: none;
    padding: 1rem;
}

/* 回答ページのコンテンツ中央寄せ（本番: #entry { max-width: 728px; margin: 0 auto }） */
.drill-answer .l-mainContent .post_content {
    max-width: 728px;
    margin: 0 auto;
}

/* 「他の問題を解く」リストの画像サイズ（本番: max-width:40%; margin-right:1rem;） */
#body_wrap #other-drill li img.attachment-thumbnail.size-thumbnail.wp-post-image {
    width: 40%;
    height: auto;
    margin-right: 1rem;
}

#body_wrap #other-drill li {
    margin-bottom: 0.5rem;
}

#body_wrap #other-drill li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* SWELLの .post_content>:last-child { margin-bottom:0!important } を無効化 */
.post_content > :last-child {
    margin-bottom: 2rem !important;
}

/* 運営者情報の下余白 */
#body_wrap .post_content #profile-wrap {
    margin-bottom: 3rem;
}

/* ========================================
   20. 問題と回答（答えを見る・こたえ）
   ======================================== */

/* 問題エリア（本番環境と統一） */
.exercise {
    margin-bottom: 2rem;
}

/* こたえのテキスト色（本番環境と統一） */
.exercise p {
    color: #e75a5a;
}

/* 答えを見るボタン（本番環境と統一） */
.answer {
    color: #518bcb;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 2rem;
}

/* ========================================
   21. フッター上部余白の削除（SWELL上書き）
   ======================================== */

#body_wrap .l-content {
    margin-bottom: 0;
}

/* ========================================
   22. cap_box_ttl（ボックスタイトル）の背景色統一（SWELL上書き）
   ======================================== */
/* h2/h3のスタイルはセクション1のグローバルルールで統一済み */

/* cap_box_ttl（ボックスタイトル）の背景色をデフォルトカラーに */
#body_wrap .cap_box_ttl {
    background-color: #8bbabb;
}

/* ふきだし（.c-balloon）の下余白（本番 .balloon: margin-bottom 2rem 相当） */
.post_content .c-balloon {
    margin-bottom: 2rem;
}

/* ショートコード生成バルーンの吹き出し装飾（本番と同じ配色） */
.c-balloon[data-col="gray"] .c-balloon__text {
    background: #fff;
    border-color: #a0a0a0;
    line-height: 2;
}
.c-balloon[data-col="gray"] .-speaking .c-balloon__before {
    border-right-color: #fff;
}
.c-balloon[data-col="gray"] .-speaking .c-balloon__after {
    border-right-color: #a0a0a0;
}

/* 連続するcap_box・ふきだしの間にスペースを確保 */
.post_content .cap_box + .cap_box,
.post_content .cap_box + .c-balloon {
    margin-top: 1.5em;
}

/* ========================================
   23. ヘッダーロゴサイズ（全ページ共通）
   ======================================== */

/* ゆみねこの教科書ロゴサイズ - PC用（本番と同じ300×57px） */
/* SWELLデフォルトのpadding/heightをリセットし、本番と同じ配置にする */
/* HTMLのwidth属性を上書きするため、img[width]セレクタを使用 */
@media screen and (min-width: 960px) {
    #body_wrap #header.l-header .c-headLogo__img,
    #body_wrap #header.l-header .c-headLogo__img[width],
    #body_wrap #header.l-header img.c-headLogo__img {
        display: block;
        width: 300px;
        min-width: 300px;
        max-width: 300px;
        height: 57px;
        object-fit: contain;
        margin-top: 0;
    }
}

/* 1233px以上：教科書コンテンツのロゴを少し下に調整 */
@media screen and (min-width: 1233px) {
    #body_wrap:not(.drill-tax):not(.post-type-archive-drill):not(.single-drill) #header.l-header .c-headLogo__img {
        margin-top: 5px;
    }
}

#body_wrap #header.l-header .c-headLogo {
    display: flex;
    align-items: center;
    height: auto;
    padding: 0;
    margin: 0;
}

#body_wrap #header.l-header .c-headLogo__link {
    display: flex;
    align-items: center;
    height: auto;
    padding: 0;
    transition: opacity 0.25s ease;
}

/* ヘッダーロゴのホバー効果（少しグレーがかる） */
.l-header .c-headLogo__link:hover {
    opacity: 0.7;
}

/* ロゴコンテナを垂直中央に配置（960px〜1232pxのみ、1233px以上はgridレイアウト使用）
   ※固定ページは除外（960pxブレークポイントなし） */
@media screen and (min-width: 960px) and (max-width: 1232px) {
    #body_wrap:not(.page) #header .l-header__inner {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }

    #body_wrap:not(.page) #header.l-header .l-header__logo {
        display: flex;
        align-items: center;
        justify-content: center;
        height: auto;
        padding: 0;
    }
}

/* ========================================
   ヘッダーのロゴ・ナビゲーションを本番環境に合わせる
   ======================================== */

/* ロゴエリアのパディング（本番: padding: 0 20px → 1358px+で 0 8%） */
@media screen and (min-width: 1233px) {
    #body_wrap:not(.single-drill) #header.l-header .l-header__logo,
    #body_wrap.drill-answer #header.l-header .l-header__logo,
    #body_wrap.drill-tax #header.l-header .l-header__logo {
        padding: 0 20px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media screen and (min-width: 1358px) {
    #body_wrap:not(.single-drill) #header.l-header .l-header__logo,
    #body_wrap.drill-answer #header.l-header .l-header__logo,
    #body_wrap.drill-tax #header.l-header .l-header__logo {
        padding: 0 8%;
    }

    #body_wrap #header.l-header .c-headLogo__img {
        max-width: 728px;
    }
}

/* ナビゲーションの文字サイズ・フォント・パディングを本番に合わせる */
/* 本番: font-weight: 700, color: #fff, padding: 1.5rem 10px, first-child padding-left: 0 */
/* 本番: font-family: "游ゴシック体","Yu Gothic",YuGothic,sans-serif (bodyから継承) */
/* 本番: font-size: 18px */
#body_wrap #header .c-gnav > .menu-item > a .ttl {
    font-size: 18px;
    font-family: "游ゴシック体", "Yu Gothic", YuGothic, sans-serif;
}

@media screen and (min-width: 1233px) {
    #body_wrap:not(.single-drill) #header .c-gnav > .menu-item > a,
    #body_wrap.drill-answer #header .c-gnav > .menu-item > a,
    #body_wrap.drill-tax #header .c-gnav > .menu-item > a {
        padding: 1.5rem 10px;
        font-weight: 700;
    }

    #body_wrap:not(.single-drill) #header .c-gnav > .menu-item:first-child > a,
    #body_wrap.drill-answer #header .c-gnav > .menu-item:first-child > a,
    #body_wrap.drill-tax #header .c-gnav > .menu-item:first-child > a {
        padding-left: 0;
    }

    /* ナビゲーションエリアのレイアウト */
    #body_wrap:not(.single-drill) #header.l-header .c-gnavWrap,
    #body_wrap.drill-answer #header.l-header .c-gnavWrap,
    #body_wrap.drill-tax #header.l-header .c-gnavWrap {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        height: 100%;
        padding-left: 0;
    }
}

/* ========================================
   本番環境と同じグリッドレイアウト（レスポンシブ）
   画面が広がるほどサイドバーの割合が大きくなる
   ドリル個別ページ（両サイドサイドバー）は除外
   ======================================== */

/* --- 1233px+: 2カラム（メイン可変 + サイドバー固定400px+3rem） --- */
/* 注意: .singleページは3カラムflexレイアウトを使用するため除外 */
@media screen and (min-width: 1233px) {
    /* コンテンツエリア（.single以外） */
    #body_wrap:not(.single-drill):not(.single) #content.l-content,
    #body_wrap.drill-answer #content.l-content {
        display: grid;
        grid-template-columns: 1fr calc(400px + 3rem);
    }

    #body_wrap:not(.single-drill):not(.single) #content.l-content > .l-mainContent,
    #body_wrap.drill-answer #content.l-content > .l-mainContent {
        grid-row: 1/2;
        grid-column: 1/2;
        width: 100%;
        max-width: none;
    }

    #body_wrap:not(.single-drill):not(.single) #content.l-content > .l-sidebar,
    #body_wrap.drill-answer #content.l-content > .l-sidebar {
        grid-row: 1/2;
        grid-column: 2/3;
        width: 100%;
        max-width: none;
    }

    /* PC版: #body_wrapの背景をグレーに（サイドバー列の隙間をグレーで埋める） */
    #body_wrap.home,
    #body_wrap.category,
    #body_wrap.tax-school_year,
    #body_wrap.tax-subject,
    #body_wrap.tax-unit,
    #body_wrap.drill-tax,
    #body_wrap.post-type-archive-drill,
    #body_wrap.single:not(.page):not(.single-drill),
    #body_wrap.single-drill.drill-answer {
        background-color: #f7f6f4;
    }

    /* PC版: メインコンテンツのbox-shadowで左側を白く延長 */
    #body_wrap .top-page-main,
    #body_wrap .taxonomy-page-main {
        box-shadow: 0 200px 0 0 #fff;
    }

    #body_wrap:not(.single-drill):not(.page) #content .l-mainContent,
    #body_wrap.drill-answer #content .l-mainContent {
        box-shadow: 0 200px 0 0 #fff;
    }

    /* PC版フッター：本番環境と統一（mask-image + solid background） */
    /* margin-topを微調整：サイドバーとの隙間を完全に埋める */
    #footer.l-footer {
        margin-top: calc(-2rem - 4px);
        background: #8bbabb;
        -webkit-mask-image: radial-gradient(110% 30% at top, transparent 50%, #fff 51%);
        mask-image: radial-gradient(110% 30% at top, transparent 50%, #fff 51%);
    }

    /* PC版ドリルフッター: オレンジ背景 */
    #body_wrap.drill-tax #footer.l-footer,
    #body_wrap.post-type-archive-drill #footer.l-footer,
    #body_wrap.single-drill #footer.l-footer {
        background: #f1a98a;
    }

    /* トップページ・タクソノミーページ */
    #body_wrap .top-page-layout,
    #body_wrap .taxonomy-page-layout {
        display: grid;
        grid-template-columns: 1fr calc(400px + 3rem);
    }

    /* タクソノミーページ: ヘッダーの凹み分マイナスmarginで詰まるため、padding-topで間隔を確保 */
    /* ギャップ計算: header mb(1.8rem) - layout mt(-3rem) + padding-top(1.5rem) = 0.3rem → +1.5remで1.8rem */
    #body_wrap .taxonomy-page-layout {
        padding-top: 1.5rem;
    }

    #body_wrap .top-page-main,
    #body_wrap .taxonomy-page-main {
        grid-row: 1/2;
        grid-column: 1/2;
        width: 100%;
        max-width: none;
    }

    #body_wrap .top-page-layout #sidebar,
    #body_wrap .top-page-layout #side,
    #body_wrap .taxonomy-page-layout #sidebar {
        position: sticky;
        top: 0;
        right: 0;
        z-index: 11;
        align-self: start;
        grid-row: 1/2;
        grid-column: 2/3;
        width: 100%;
        max-width: none;
        min-height: 100vh;
        padding: 1.5rem 1.5rem 0 1.5rem;
        margin-bottom: 1rem;
    }

    /* ドリルカテゴリページ：#sideの表示を強制 */
    #body_wrap.drill-tax .top-page-layout #side {
        display: block !important;
        visibility: visible !important;
    }

    /* ドリルタクソノミーページ */
    #body_wrap.drill-tax #content.l-content {
        display: grid;
        grid-template-columns: 1fr calc(400px + 3rem);
    }

    #body_wrap.drill-tax #content .l-mainContent {
        grid-row: 1/2;
        grid-column: 1/2;
        width: 100%;
        max-width: none;
    }

    #body_wrap.drill-tax #content .l-sidebar,
    #body_wrap.post-type-archive-drill #content .l-sidebar {
        position: sticky;
        top: 0;
        right: 0;
        z-index: 11;
        align-self: start;
        grid-row: 1/2;
        grid-column: 2/3;
        width: 100%;
        max-width: none;
        min-height: 100vh;
        padding: 1.5rem 1.5rem 0 1.5rem;
        margin-bottom: 1rem;
    }

    /* ヘッダーのgridルールは上部セクション（ヘッダー全体の配置調整）で定義済み */
}

/* --- 1358px+: メインコンテンツ固定、サイドバーが伸びる --- */
@media screen and (min-width: 1358px) {
    #body_wrap:not(.single-drill):not(.single) #content.l-content,
    #body_wrap.drill-answer #content.l-content {
        grid-template-columns: calc(728px + 16%) 1fr;
    }

    #body_wrap .top-page-layout,
    #body_wrap .taxonomy-page-layout {
        grid-template-columns: calc(728px + 16%) 1fr;
    }

    #body_wrap.drill-tax #content.l-content {
        grid-template-columns: calc(728px + 16%) 1fr;
    }

    /* ヘッダーのgridルールは上部セクション（ヘッダー全体の配置調整）で定義済み */
}

/* --- 1733px+: 均等分割（1:1） --- */
@media screen and (min-width: 1733px) {
    #body_wrap:not(.single-drill):not(.single) #content.l-content,
    #body_wrap.drill-answer #content.l-content {
        grid-template-columns: 1fr 1fr;
    }

    #body_wrap .taxonomy-page-layout {
        grid-template-columns: 1fr 1fr;
    }

    /* drill-taxはflexレイアウトを使用（ここでは定義しない） */

    /* ヘッダーのgridルールは上部セクション（ヘッダー全体の配置調整）で定義済み */
}

/* --- 1980px+: 投稿ページ3カラム比率拡大（本番と同じ） --- */
/* ヘッダーのgridルールは上部セクション（ヘッダー全体の配置調整）で定義済み */
@media screen and (min-width: 1980px) {
    #body_wrap.single:not(.pdf):not(.drill-answer) #content.l-content {
        grid-template-columns: 1fr 1.5fr 1fr;
    }
}

/* ========================================
   サイドバーテキストスタイル（本番と統一）
   ======================================== */

/* サイドバーのフォントサイズ（本番: 0.9rem） */
/* 教科書ページ・ドリルページ両方に適用 */
@media screen and (min-width: 1233px) {
    #body_wrap .l-sidebar,
    #body_wrap #sidebar,
    #body_wrap.single .l-sidebar:not(#sidebar),
    #body_wrap.home .l-sidebar,
    #body_wrap.home #sidebar,
    #body_wrap.category .l-sidebar,
    #body_wrap.category #sidebar,
    #body_wrap.tax-school_year .l-sidebar,
    #body_wrap.tax-school_year #sidebar,
    #body_wrap.tax-subject .l-sidebar,
    #body_wrap.tax-subject #sidebar,
    #body_wrap.tax-unit .l-sidebar,
    #body_wrap.tax-unit #sidebar,
    #body_wrap.post-type-archive-drill .l-sidebar,
    #body_wrap.post-type-archive-drill #sidebar,
    #body_wrap.drill-tax .l-sidebar,
    #body_wrap.drill-tax #sidebar {
        font-size: 0.9rem;
    }

    /* フッターmargin・背景・マスク調整（本番と同じ） */
    #body_wrap #footer.l-footer {
        margin-top: calc(-2rem - 4px);
        background: #8bbabb;
        -webkit-mask-image: radial-gradient(110% 30% at top, transparent 50%, #fff 51%);
        mask-image: radial-gradient(110% 30% at top, transparent 50%, #fff 51%);
    }

    /* ドリルフッター背景上書き */
    #body_wrap.drill-tax #footer.l-footer,
    #body_wrap.post-type-archive-drill #footer.l-footer,
    #body_wrap.single-drill #footer.l-footer {
        background: #f1a98a;
    }
}

/* サイドバーリストアイテム（本番と同じ） */
#body_wrap .l-sidebar li,
#body_wrap #sidebar li {
    line-height: 1.4;
    margin: 0.8rem 0;
    padding: 0;
}

/* サイドバーリンク（本番と同じ） */
#body_wrap .l-sidebar li a,
#body_wrap #sidebar li a {
    font-weight: 400;
}

/* サイドバー段落（PC表示: 18px、SP表示: 16px） */
/* PC専用: 960px以上で18px */
@media screen and (min-width: 960px) {
    #body_wrap .l-sidebar p,
    #body_wrap #sidebar p {
        font-size: 18px;
        line-height: 2;
        word-break: break-all;
    }
}

/* サイドバー内部のスクロールとパディング */
#body_wrap .l-sidebar .l-sidebar__inner,
#body_wrap #sidebar .l-sidebar__inner {
    padding-right: 0;
    padding-bottom: 1.5rem;
}

/* ========================================
   教科書コンテンツPC：サイドバースタイル（本番準拠）
   ======================================== */
@media screen and (min-width: 1233px) {
    /* プロフィールボタン（本番PC）→43px・18px調整 */
    #body_wrap .top-page-layout #profile a,
    #body_wrap .taxonomy-page-layout #profile a {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 43px;
        padding: 0 1rem;
        font-size: 18px;
        line-height: 1;
    }

    /* サイドバータイトル（本番: 1.5rem） */
    #body_wrap .top-page-layout #sidebar .c-widget__title,
    #body_wrap .taxonomy-page-layout #sidebar .c-widget__title {
        font-size: 1.5rem;
        margin: 0 0 1rem 0;
        text-align: left;
    }

    /* 検索フォーム（本番: max-width:630px; height:50px; border-radius:1rem;） */
    #body_wrap .top-page-layout #sidebar .c-searchForm,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm {
        width: 100%;
        max-width: 630px;
    }
    #body_wrap .top-page-layout #sidebar .c-searchForm__s,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm__s {
        height: 50px;
        border-radius: 1rem;
        font-size: 1rem;
        padding: .5rem 40px .5rem 1rem;
        line-height: 2;
    }
    #body_wrap .top-page-layout #sidebar .c-searchForm__submit,
    #body_wrap .taxonomy-page-layout #sidebar .c-searchForm__submit {
        border-radius: 0 1rem 1rem 0;
        width: 50px;
    }

    /* aboutテキスト（本番: line-height:2;） */
    #body_wrap .top-page-layout #sidebar .about p,
    #body_wrap .taxonomy-page-layout #sidebar .about p {
        line-height: 2;
    }

    /* バナー画像（本番: width:100%; max-width:500px;） */
    #body_wrap .top-page-layout #sidebar .about img,
    #body_wrap .taxonomy-page-layout #sidebar .about img {
        width: 100%;
        max-width: 500px;
    }
}

/* ========================================
   投稿詳細ページ専用レイアウト（.single-page-layout）
   ======================================== */

/* SWELLの空containerを非表示（single.phpで閉じた後のダミー） */
#body_wrap .single-page-layout + .l-content.l-container {
    display: none;
    padding: 0;
    margin: 0;
    height: 0;
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    position: absolute;
    width: 0;
    opacity: 0;
}

/* 基本レイアウト（モバイル：縦並び） */
/* ヘッダーの凹み分の余白を埋める */
.single-page-layout {
    display: block;
    background: #fff;
}

/* デスクトップ：margin-top調整 */
@media screen and (min-width: 960px) {
    .single-page-layout {
        margin-top: -1.5rem;
    }
}

.single-page-main {
    padding: 1.5rem 20px 2.5rem;
    background: #fff;
}

.single-page-sidebar {
    background: #f7f6f4;
    padding: 1.5rem 20px;
}

/* 学校種別フォントサイズ（本番と同じ：小18px / 中17px / 高16px） */
.school-primary-school .single-page-main,
.school-primary-school .single-page-sidebar { font-size: 18px; }
.school-junior-high-school .single-page-main,
.school-junior-high-school .single-page-sidebar { font-size: 17px; }
.school-high-school .single-page-main,
.school-high-school .single-page-sidebar { font-size: 16px; }

.single-page-right-sidebar {
    display: none;
    background: #f7f6f4;
    padding: 1.5rem 20px;
}

/* PDFページはmargin-top調整 */
.single-page-layout.pdf-page {
    margin-top: -2.5rem;
}

/* 投稿詳細ページの目次を非表示（本番kyoukasyoには目次機能がないため） */
#body_wrap .single-page-layout .p-toc,
#body_wrap .single-page-layout .post_toc,
#body_wrap .single-page-layout .w-beforeToc,
#body_wrap.single-post:not(.single-drill) .p-toc,
#body_wrap.single-post:not(.single-drill) .post_toc,
#body_wrap.single-post:not(.single-drill) .w-beforeToc,
#body_wrap.single-post:not(.single-drill) #fix_tocbtn,
#body_wrap.single-post:not(.single-drill) .p-fixBtnWrap [data-onclick="toggleIndex"] {
    display: none;
}

/* サイドバー内のタイトル */
.single-page-sidebar h1.sidebar-title,
.single-page-right-sidebar h1 {
    margin: 0 0 1rem 0;
    text-align: left;
    font-size: 1rem;
}

/* サイドバー内のリスト */
.single-page-sidebar ul.textbook-nav-links {
    margin-bottom: 1.5rem;
}

.single-page-sidebar ol.textbook-list {
    padding-left: 2em;
    list-style: decimal;
    margin-bottom: 2rem;
}

.single-page-sidebar li,
.single-page-right-sidebar li {
    line-height: 1.4;
    margin: 0.8rem 0;
    padding: 0;
}

.single-page-sidebar li a,
.single-page-right-sidebar li a {
    font-weight: 400;
}

.single-page-sidebar ul li a {
    font-weight: 700;
}

/* サイドバー内の段落 */
.single-page-sidebar p,
.single-page-right-sidebar p {
    line-height: 2;
    margin-bottom: 2rem;
}

/* ドリルバナー */
.single-page-right-sidebar .drill-banner {
    margin-bottom: 1.5rem;
}

.single-page-right-sidebar .drill-banner + h1 {
    margin-top: 1.5rem;
}

/* 本文コンテンツの最大幅制限（本番: #entry { max-width: 728px; margin: 0 auto }） */
.single-page-main .post_content {
    max-width: 728px;
    margin: 0 auto;
}

/* パンくずリストの文字サイズ（18px） */
.single-page-main #breadcrumb {
    font-size: 18px;
}

/* --- 1233px以上: 2カラムグリッドレイアウト --- */
@media screen and (min-width: 1233px) {
    .single-page-layout {
        display: grid;
        grid-template-columns: 1fr calc(400px + 3rem);
    }

    /* PDFページ: margin-top(-2.5rem)が通常(-1.5rem)より大きいため、padding-topで間隔を補正 */
    .single-page-layout.pdf-page {
        padding-top: 1rem;
    }

    .single-page-main {
        grid-row: 1/2;
        grid-column: 1/2;
        padding: 1.5rem 20px 2.5rem;
    }

    /* 本文コンテンツの最大幅制限（本番: #entry { max-width: 728px; margin: 0 auto }） */
    .single-page-main .post_content {
        max-width: 728px;
        margin: 0 auto;
    }

    .single-page-sidebar {
        position: sticky;
        top: 0;
        right: 0;
        z-index: 11;
        align-self: start;
        grid-row: 1/2;
        grid-column: 2/3;
        width: 100%;
        min-height: 100vh;
        padding: 1.5rem 1.5rem 0 1.5rem;
        margin-bottom: 1rem;
    }

    .single-page-sidebar #side-inside {
        padding-right: 1.5rem;
        padding-bottom: 1.5rem;
        height: 100vh;
        overflow-y: scroll;
    }
}

/* --- 1358px以上: グリッド比率調整 --- */
@media screen and (min-width: 1358px) {
    .single-page-layout {
        grid-template-columns: calc(728px + 16%) 1fr;
    }

    .single-page-main {
        padding: 1.5rem 8% 2.5rem;
    }

    .single-page-main .post_content {
        max-width: 728px;
    }
}

/* --- 1544px以上: 3カラムレイアウト（通常投稿ページのみ） --- */
@media screen and (min-width: 1544px) {
    /* 通常投稿ページ（PDFページ以外）は3カラム */
    .single-page-layout:not(.pdf-page) {
        grid-template-columns: 1fr calc(728px + 8%) 1fr;
    }

    /* メインコンテンツは中央（2列目） */
    .single-page-layout:not(.pdf-page) .single-page-main {
        grid-column: 2/3;
        padding: 1.5rem 0 2.5rem;
    }

    /* 左サイドバーは1列目 */
    .single-page-layout:not(.pdf-page) .single-page-sidebar {
        grid-column: 1/2;
        padding: 1.5rem 1.5rem 0 1.5rem;
    }

    .single-page-layout:not(.pdf-page) .single-page-sidebar #side-inside {
        padding-bottom: 1.5rem;
    }

    /* サイドバーのフォントサイズ（3面レイアウト時） */
    .single-page-layout:not(.pdf-page) .single-page-sidebar {
        font-size: 16.2px;
    }
    .single-page-right-sidebar {
        font-size: 16.2px;
    }

    /* 右サイドバーを表示（3列目） */
    .single-page-layout:not(.pdf-page) .single-page-right-sidebar {
        display: block;
        grid-row: 1/2;
        grid-column: 3/4;
        position: sticky;
        top: 0;
        right: 0;
        z-index: 11;
        align-self: start;
        width: 100%;
        min-height: 100vh;
        padding: 1.5rem 1.5rem 0 1.5rem;
        margin-bottom: 1rem;
        background: #f7f6f4;
    }

    .single-page-right-sidebar #right-side-inside {
        padding-right: 1.5rem;
        padding-bottom: calc(1.5rem + 180px);
        height: 100vh;
        overflow-y: scroll;
    }

    /* 右サイドバー内の画像サイズ調整 */
    .single-page-right-sidebar #pdf-download img {
        min-width: auto;
        min-height: auto;
    }

    /* PC3カラム時は本文内のPDFダウンロードエリアを非表示 */
    .single-page-layout:not(.pdf-page) .pdf-download-wrap {
        display: none;
    }
}

/* --- 1733px以上: メインコンテンツ幅調整（グリッドカラムは1544pxから継続） --- */
@media screen and (min-width: 1733px) {
    .single-page-main {
        width: 100%;
        padding: 1.5rem 0 2rem;
    }
}

/* --- 1980px以上: 中央カラムを広く --- */
@media screen and (min-width: 1980px) {
    .single-page-layout:not(.pdf-page) {
        grid-template-columns: 1fr 1.5fr 1fr;
    }
}

/* --- SP/タブレット（1232px以下）: サイドバーは縦並び --- */
@media screen and (max-width: 1232px) {
    .single-page-layout {
        display: block;
    }

    .single-page-main {
        padding: 1.5rem 20px 2.5rem;
    }

    .single-page-sidebar {
        padding: 1.5rem 20px;
    }

    /* モバイルでは右サイドバーは非表示（コンテンツ内の.pdf-download-wrapを使用） */
    .single-page-right-sidebar {
        display: none;
    }
}

/* モバイルでPDFダウンロードエリアを表示（コンテンツ内） */
@media screen and (max-width: 1543px) {
    #body_wrap .single-page-layout .pdf-download-wrap {
        display: block;
    }

    #body_wrap .pdf-download-wrap {
        margin: 1.5rem 0;
        padding: 1rem;
        background: #fff;
    }

    #body_wrap .pdf-download-wrap h2 img {
        max-width: 100%;
        height: auto;
    }

    #body_wrap .pdf-download-wrap #pdf-download-inline img {
        max-width: 100%;
        height: auto;
    }
}

/* ========================================
   検索結果ページスタイル（本番環境と統一）
   ======================================== */

/* 検索ページ: SWELLの空#contentを折りたたむ */
#body_wrap.search #content.l-content {
    display: none;
}

/* 検索ページレイアウト（本番と同じ構造） */
.search-page-layout {
    display: block;
    background: #fff;
    margin-top: -3rem;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* 検索ページのメインコンテンツ */
.search-page-main {
    padding: 1.5rem 20px 3rem;
}

.search-page-main #entry {
    margin: 0 auto;
    max-width: 728px;
}

/* 検索ページのタイトル（本番: h1スタイル） */
.search-page-main h1 {
    font-size: 1.5rem;
    margin: 0 auto 1rem;
    max-width: 728px;
    line-height: 1.4;
}

/* 検索件数表示 */
.search-result-count {
    margin: 0 auto 1.5rem;
    max-width: 728px;
    color: #424242;
    line-height: 2;
}

/* 検索結果リスト（本番スタイル: シンプルなリスト） */
#search-result {
    list-style: none;
    max-width: 728px;
    margin: 0 auto 1.5rem;
    padding: 0;
}

#search-result li {
    margin-bottom: 0.8rem;
    padding: 0;
    line-height: 1.4;
}

#search-result a {
    color: #518bcb;
    font-weight: 700;
    text-decoration: none;
}

#search-result a:hover {
    text-decoration: underline;
}

/* ページネーション */
.search-page-main .nav-links {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-page-main .page-numbers {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #dedede;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

.search-page-main .page-numbers.current {
    background: #518bcb;
}

/* 検索ページのサイドバー（sidebar-page.phpと共通） */
#body_wrap .search-page-layout .l-sidebar {
    background: #f7f6f4;
    padding: 1.5rem 20px;
    font-size: 1rem;
}

/* 検索ページサイドバー内のコンテンツ - 右端で折り返す */
#body_wrap .search-page-layout .l-sidebar .l-sidebar__inner {
    padding-right: 20px;
}

/* 検索ページのヘッダー下部マージンを削除 */
#body_wrap.search #header.l-header {
    margin-bottom: 0;
}

/* 検索ページのパンくずリストを非表示 */
#body_wrap.search #breadcrumb,
#body_wrap.search .p-breadcrumb {
    display: none;
    height: 0;
    margin: 0;
    padding: 0;
}

/* PC版（960px以上）: 2カラムレイアウト */
@media screen and (min-width: 960px) {
    #body_wrap .search-page-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    #body_wrap .search-page-main {
        grid-column: 1/2;
        padding: 1.5rem 20px 3rem;
    }

    #body_wrap .search-page-layout .l-sidebar {
        grid-column: 2/3;
        position: sticky;
        top: 0;
        align-self: start;
        min-height: 100vh;
        padding-left: 20px;
        width: auto;
        background: transparent;
    }

    /* 疑似要素で背景を右端まで伸ばす */
    .search-page-layout .l-sidebar::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: -100vw;
        bottom: 0;
        background: #f7f6f4;
        z-index: -1;
    }
}

/* PC版（1233px以上）: 本番と同じ比率 */
@media screen and (min-width: 1233px) {
    .search-page-layout {
        grid-template-columns: calc(728px + 16%) 1fr;
    }

    .search-page-main #entry {
        max-width: none;
    }

    .search-page-main h1 {
        margin-top: 60px;
    }
}

/* 大画面（1358px以上） */
@media screen and (min-width: 1358px) {
    .search-page-layout {
        grid-template-columns: calc(728px + 16%) 1fr;
    }
}

/* 大画面（1733px以上）: 均等分割 */
@media screen and (min-width: 1733px) {
    .search-page-layout {
        grid-template-columns: 1fr 1fr;
    }
}


/* ========================================
   最優先：ロゴサイズ強制上書き（ファイル末尾）
   ======================================== */

/* PC用ロゴサイズ（本番と同じ300×57px） - 最優先 */
/* 詳細度(1,2,0): #body_wrap #header.l-header で親テーマを上回る */
@media screen and (min-width: 960px) {
    #body_wrap #header.l-header .c-headLogo__img,
    #body_wrap #header.l-header img.c-headLogo__img,
    #body_wrap #header.l-header .c-headLogo__img[width] {
        width: 300px;
        min-width: 300px;
        max-width: 300px;
        height: 57px;
        object-fit: contain;
    }
}


/* ========================================
   学年別フォントサイズ（旧サイト準拠）
   小学生 18px ＞ 中学生 17px ＞ 高校生 16px
   SWELLはbody_classを#body_wrapに出力するため
   .school-* で指定（bodyプレフィックス不要）
   ======================================== */
.school-primary-school .post_content {
    font-size: 18px;
}
.school-junior-high-school .post_content {
    font-size: 17px;
}
.school-high-school .post_content {
    font-size: 16px;
}

/* ========================================
   用語ページ（single-term）のヘッダー余白除去
   ======================================== */
#body_wrap.single-term #header.l-header {
    margin-bottom: 0 !important;
}

/* ========================================
   用語自動リンク（.valhalla-term）
   ======================================== */
.valhalla-term {
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    cursor: help;
    color: inherit;
}
a.valhalla-term:hover {
    color: #0073aa;
}

/* ========================================
   旧テーマ形式バルーン（.balloon）
   投稿コンテンツにHTMLとして保存されているため
   旧テーマと同じCSSが必要
   ※ SWELLのバルーン（.c-balloon）とは別物
   ======================================== */
.balloon {
    align-content: flex-start;
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 2rem;
}
.balloon-right {
    flex-direction: row-reverse;
}
.balloon-icon {
    flex-shrink: 0;
    position: relative;
    text-align: center;
    width: 80px;
}
.balloon-img {
    height: 80px;
    width: 80px;
    border: 2px solid #ececec;
    border-radius: 50%;
}
.balloon-name {
    display: block;
    font-size: 14px;
    line-height: 1;
    opacity: .8;
    padding-top: 4px;
}
.balloon-speech {
    align-items: flex-start;
    display: flex;
    flex-basis: 100%;
    padding: 4px 0 4px 24px;
}
.balloon-right .balloon-speech {
    justify-content: flex-end;
    padding: 4px 24px 4px 0;
}
.balloon-text {
    border-radius: 8px;
    color: #333;
    line-height: 1.6;
    padding: 1em;
    position: relative;
    background: #fff;
    border: 1px solid #a0a0a0;
}
.balloon-text:after,
.balloon-text:before {
    right: 100%;
    top: 50%;
    border: solid transparent;
    content: "";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}
.balloon-text:after {
    border-color: rgba(255, 255, 255, 0);
    border-right-color: #fff;
    border-width: 12px;
    margin-top: -12px;
}
.balloon-text:before {
    border-color: rgba(160, 160, 160, 0);
    border-right-color: #a0a0a0;
    border-width: 13px;
    margin-top: -13px;
}
.balloon-right .balloon-text:after,
.balloon-right .balloon-text:before {
    left: 100%;
    right: auto;
}
.balloon-right .balloon-text:after {
    border-left-color: #fff;
    border-right-color: transparent;
}
.balloon-right .balloon-text:before {
    border-left-color: #a0a0a0;
    border-right-color: transparent;
}

/* ========================================
   ゆみねこドリル導線バッジ（固定表示）
   コンテンツエリア右下基準
   ======================================== */
.yumineko-drill-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 98;
    display: block;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    transition: transform 0.2s ease;
    line-height: 1;
    filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.15));
}
.yumineko-drill-badge:hover {
    transform: scale(1.1);
}
.yumineko-drill-badge img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

/* TOPへボタンをドリルバッジの上に配置 + 丸デザイン + 影 */
.p-fixBtnWrap {
    bottom: 130px;
    right: 36px;
}
/* ドリルバッジがないページではTOPボタンを下寄りに配置 */
.no-drill-badge .p-fixBtnWrap {
    bottom: 40px;
}
#pagetop.c-fixBtn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    opacity: 1;
    color: #333;
    border: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    filter: none;
    transition: transform 0.2s ease, opacity 0.25s;
}
#pagetop.c-fixBtn:hover {
    transform: scale(1.1);
    background-color: #fff !important;
    color: #333 !important;
}
#pagetop .c-fixBtn__icon {
    font-size: 20px;
}

@media (max-width: 599px) {
    .yumineko-drill-badge {
        width: 80px;
        height: 80px;
        bottom: 20px;
    }
    .p-fixBtnWrap {
        bottom: 110px;
        right: 26px;
    }
    .no-drill-badge .p-fixBtnWrap {
        bottom: 20px;
    }
}
/* ドリルページは960px以上でサイドバー表示のため先に適用 */
@media (min-width: 960px) {
    .post-type-archive-drill .yumineko-drill-badge,
    .drill-tax .yumineko-drill-badge,
    .single-drill .yumineko-drill-badge {
        right: var(--drill-badge-right, 20px);
        bottom: var(--drill-badge-bottom, 20px);
    }
    .post-type-archive-drill .p-fixBtnWrap,
    .drill-tax .p-fixBtnWrap,
    .single-drill .p-fixBtnWrap {
        right: calc(var(--drill-badge-right, 20px) + 16px);
        bottom: calc(var(--drill-badge-bottom, 20px) + 110px);
    }
    /* ドリルページでバッジなしの場合 */
    .post-type-archive-drill.no-drill-badge .p-fixBtnWrap,
    .drill-tax.no-drill-badge .p-fixBtnWrap,
    .single-drill.no-drill-badge .p-fixBtnWrap {
        bottom: var(--drill-badge-bottom, 40px);
    }
}
/* 教科書ページは1233px以上でサイドバー表示 */
@media (min-width: 1233px) {
    .yumineko-drill-badge {
        right: var(--drill-badge-right, 20px);
        bottom: var(--drill-badge-bottom, 20px);
    }
    .p-fixBtnWrap {
        right: calc(var(--drill-badge-right, 20px) + 16px);
        bottom: calc(var(--drill-badge-bottom, 20px) + 110px);
    }
    .no-drill-badge .p-fixBtnWrap {
        bottom: var(--drill-badge-bottom, 40px);
    }
}

/* ========================================
   トップページ お知らせエリア
   ======================================== */
.top-notice-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

/* 共通ボックス */
.notice-box {
    border: 1px solid;
    border-radius: 8px;
    padding: 8px 18px 13px;
}
.notice-box__title {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
    color: #333;
    line-height: 1;
}

/* 重要なおしらせ */
.notice-box--important {
    background: #fff9f9;
    border-color: #e54b4c;
}
.notice-box__title--important {
    color: #e54b4c;
}

/* 新着情報 */
.notice-box--news {
    background: #f3fafa;
    border-color: #8bbabb;
}

/* リスト項目 */
.notice-box__list {
    display: flex;
    flex-direction: column;
}
.notice-box__item {
    display: flex;
    gap: 10px;
    align-items: baseline;
    font-size: 13px;
    color: #333;
    line-height: 1.2;
    padding: 6px 0;
    border-top: 1px dotted #bababa;
}
.notice-box__item:first-child {
    border-top: none;
}
.notice-box__date {
    flex-shrink: 0;
    white-space: nowrap;
}
.notice-box__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notice-box__link {
    flex: 1;
    min-width: 0;
    color: #333;
    text-decoration: underline;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notice-box__link:hover {
    opacity: 0.7;
}

/* SP調整 */
@media (max-width: 599px) {
    .notice-box__link {
        white-space: normal;
    }
}

/* PC: タイトル左・コンテンツ右の横並び */
@media (min-width: 600px) {
    .notice-box {
        display: flex;
        align-items: baseline;
        gap: 15px;
        padding: 10px 18px;
    }
    .notice-box__title {
        flex-shrink: 0;
        margin-bottom: 0;
        font-size: 12px;
        white-space: nowrap;
        width: 96px;
        text-align: left;
    }
    .notice-box__list {
        flex: 1;
        min-width: 0;
    }
}
