/**
 * 漢字練習シート一覧ページ（print/index.php）用スタイル
 * 参照: _reference/kanji/practice/index.php および common/css/style.css
 */

/* ページヘッダー */
.page-header.kanji-print-header {
    margin: 0 calc(50% - 50vw);
    padding: 1rem calc(50vw - 50% + 8px);
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-header.kanji-print-header .page-header-ttl {
    max-width: 100%;
}

.page-header.kanji-print-header .theme {
    background-color: #F5A200;
    color: #fff;
    font-weight: bold;
    display: inline-block;
}

.page-header.kanji-print-header h1 {
    font-size: 1.5rem;
}

/* 漢字リストエリア（ドット柄風の枠） */
.kanji-list {
    border: 10px solid #E4F9FF;
    background-image:
        linear-gradient(0deg, transparent calc(100% - 1px), #E4F9FF calc(100% - 1px)),
        linear-gradient(90deg, transparent calc(100% - 1px), #E4F9FF calc(100% - 1px));
    background-size: 16px 16px;
    background-repeat: repeat;
    background-position: center center;
}

.kanji-list h3 {
    font-size: 64px;
    border: 2px solid #78BC4E;
    width: 96px;
    margin: 0 auto;
    background-color: #fff;
    font-family: "Sawarabi Mincho", serif;
}

.kanji-list .each .label-on {
    background-color: #FFE978;
}

.kanji-list .each .label-kun {
    background-color: #F4C6CF;
}

.kanji-list .each .row {
    margin-right: 0;
    margin-left: 0;
}

.kanji-list .col-md-2 {
    margin-right: 1px;
}

/* 画数バッジ */
.kanji-strokes {
    background-color: #78BC4E;
    color: #fff;
    display: inline-block;
}

.kanji-strokes span {
    font-size: 20px;
}

/* 部首 */
.kanji-bushu {
    background-color: #f0f8f0;
    color: #333;
    display: inline-block;
}

.kanji-bushu .shape {
    font-size: 1.1em;
}

.kanji-bushu .yomi {
    color: #555;
}

/* 音訓 */
.kanji-reading {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    font-size: 14px;
    line-height: 1.4;
}

.kanji-reading .label-text {
    min-height: 1.5em;
}

/* スマートフォン */
@media (max-width: 767.98px) {
    .page-header.kanji-print-header {
        min-height: 120px;
    }

    .page-header.kanji-print-header h1 {
        font-size: 1.1rem;
    }

    .kanji-list {
        border: none;
    }

    .kanji-list h3 {
        width: 48px;
        font-size: 32px;
    }

    .kanji-strokes {
        font-size: 0.85rem;
    }

    .kanji-strokes span {
        font-size: 14px;
    }

    .kanji-list .col-md-2 {
        margin-right: 0;
    }
}

@media (max-width: 991.98px) {
    .kanji-list .col-md-2 {
        margin-right: 0;
    }
}

/* 漢字詳細ページ（detail.php） */
.kanji-detail-info {
    display: table;
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.kanji-detail-info > div {
    display: table-row;
}

.kanji-detail-info > div > .label,
.kanji-detail-info > div > span:not(.label) {
    display: table-cell;
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
    min-width: 80px;
}

.kanji-detail-info > div:last-child > .label,
.kanji-detail-info > div:last-child > span:not(.label) {
    border-bottom: none;
}

.kanji-detail-info .label {
    width: 30%;
    background-color: #e9ecef;
    font-weight: bold;
}

/* 漢字SVG・文字を大きく表示 */
.kanji-detail .col-12.col-md-4 {
    min-width: 200px;
}

.kanji-detail-svg {
    width: 100%;
    min-width: 200px;
    min-height: 200px;
    max-width: 280px;
    height: auto;
    object-fit: contain;
}

.kanji-detail-char-fallback {
    font-size: 180px;
    line-height: 1;
    font-family: "Sawarabi Mincho", serif;
    border: 2px solid #78BC4E;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
}

.case .text .word {
    font-weight: bold;
    font-size: 21px;
    margin-left: 5px;
    margin-right: 5px;
}

.case .text .word.start {
    margin-left: 0;
}

.case .text .yomi {
    font-size: 18px;
    color: #E9528E;
}

.case .case-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.case .case-item-img {
    flex: 0 0 auto;
    max-width: 150px;
}

.case .case-item-img img {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 767.98px) {
    .case .case-item-img {
        max-width: 120px;
    }
}

/* 書き順アニメーション */
.kanji-stroke-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.kanji-stroke-wrap .btn-stroke-anim {
    display: block;
    width: 100%;
    max-width: 280px;
}

.stroke-overlay {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    aspect-ratio: 1;
    max-width: 280px;
    background: #fff;
    z-index: 5;
}

.stroke-overlay svg {
    display: block;
}

/* 漢字詳細：SPでは漢字中央・info横いっぱい */
@media (max-width: 767.98px) {
    .kanji-detail {
        overflow-x: hidden;
    }

    .kanji-detail .row.mb-5 {
        flex-direction: column;
    }

    .kanji-detail .row.mb-5 > .col-12.col-md-4 {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .kanji-detail .row.mb-5 > .col-12.col-md-4 .kanji-detail-svg,
    .kanji-detail .row.mb-5 > .col-12.col-md-4 .kanji-detail-char-fallback {
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

    .kanji-detail .row.mb-5 > .col-12.col-md-8 {
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        width: 100vw;
        max-width: 100vw;
        padding-left: 1rem;
        padding-right: 1rem;
        box-sizing: border-box;
    }

    .kanji-detail-info {
        width: 100%;
    }
}
