/* --- タブシステムのスタイル --- */
.tab-wrap {
    max-width: 1200px;
    margin: 30px auto;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 20px;
}

.tab-contents-container {
    position: relative;
    transition: height 0.4s ease-out;
    overflow: visible;
}

.tab-contents-container.no-transition {
    transition: none;
}

/* タブアイコン（ラベル）を格納するコンテナ */
.tab-labels-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* モバイル: 2列 */
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    max-width: 100%;
}

/* タブレット以上: 4列表示 */
@media screen and (min-width: 768px) {
    .tab-labels-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

.tab-switch {
    display: none;
}

/* --- タブの見た目、選択時の設定 --- */
.tab-label {
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: block;
    width: 100%;
    position: relative;
}

.tab-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid transparent;
    border-radius: 8px;
    transition: all 0.3s ease;
    pointer-events: none;
}

.tab-label:hover::before {
    border-color: rgba(246, 173, 73);
}

.tab-switch:checked + .tab-label::before {
    border-color: #f39800;
    box-shadow: 0 0 0 1px rgba(243, 152, 0);
}

/* 選択中ではないラベルだけがホバーで動く */
.tab-switch:not(:checked) + .tab-label:hover {
    transform: translateY(-3px);
}

.tab-label img {
    width: 100%;
    aspect-ratio: 2 / 1;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

/* --- コンテンツエリアのレイアウト --- */
.tab-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity 0.3s ease-out, transform 0.4s ease-out, visibility 0s linear 0.3s;
    display: flex;
    flex-direction: column; /* モバイルは縦積み */
    gap: 20px;
}

/* 2カラムレイアウト（デフォルト） */
@media screen and (min-width: 768px) {
    .tab-content[data-layout="2column"],
    .tab-content:not([data-layout]) {
        flex-direction: row;
        gap: 30px;
    }
}

/* 1カラムレイアウト */
.tab-content[data-layout="1column"] {
    flex-direction: column;
    gap: 30px;
}

.tab-content.active {
    position: relative;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.3s ease-out 0.1s, transform 0.4s ease-out 0.1s;
}

/* --- 左側:キャラクター画像エリア --- */
.character-image {
    flex: 0 0 auto;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* 2カラムレイアウト時 */
@media screen and (min-width: 768px) {
    .tab-content[data-layout="2column"] .character-image,
    .tab-content:not([data-layout]) .character-image {
        flex: 0 0 570px;  /* 固定幅に変更 */
        max-width: 570px;  /* 追加 */
        margin: 0;
    }
}

@media screen and (min-width: 768px) {
    .tab-content[data-layout="2column"] .background-image,
    .tab-content:not([data-layout]) .background-image {
        flex: 0 0 570px;  /* 固定幅に変更 */
        max-width: 570px;  /* 追加 */
        margin: 0;
    }
}


/* 1カラムレイアウト時 */
.tab-content[data-layout="1column"] .character-image {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

.character-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    -webkit-mask-image: 
        linear-gradient(to bottom, transparent, black 5%, black 95%, transparent),
        linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    mask-image: 
        linear-gradient(to bottom, transparent, black 5%, black 95%, transparent),
        linear-gradient(to right, transparent, black 5%, black 95%, transparent);

    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}

.tab-content[data-layout="1column"] .background-image img {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}


.background-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}


/* --- 右側:キャラクター情報エリア --- */
.character-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 30px;
    justify-content: flex-start;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    overflow: visible;  /* hidden を visible に変更 */
}

@media screen and (min-width: 768px) {
    .tab-content[data-layout="2column"] .character-info,
    .tab-content:not([data-layout]) .character-info {
        flex: 0 0 550px;  /* 固定幅に変更 */
        max-width: 550px;
        min-width: 0;           /* 追加 */
        overflow: visible;  /* 追加 */
    }
}

@media screen and (min-width: 768px) {
    .character-info {
    overflow: visible;  /* 追加 */
    }
}


.character-name {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 20px 0;
    color: #333;
    font-family: "Mochiy Pop P One", sans-serif;
    text-shadow: 2px 2px 0px rgba(255,255,255,0.5);
    letter-spacing: 0.05em;
    position: relative;
    display: inline-block;
}

.character-name::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(0,0,0,0.2);
    border-radius: 2px;
}

@media screen and (min-width: 768px) {
    .character-name {
        font-size: 1.7rem;
    }
}

.character-reading {
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
    text-shadow: none;
    letter-spacing: 0.1em;
}

@media screen and (min-width: 768px) {
.character-reading {
    font-size: 0.8rem;
}
}

.character-description {
    font-size: 0.9rem;
    line-height: 1.8;
    color: #555;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
    line-height: 1.8;  /* 追加: 行間を広げる */
}

.character-description strong {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: inline;  /* または display: block; */
}

@media screen and (min-width: 768px) {
    .character-description {
        font-size: 1rem;
    }
}