/*黑暗模式*/
body.dark-mode table {
    background: #232834;
    color: #d3d7de;
}

body.dark-mode table tr:nth-child(odd) {
    background: #232834;
}

body.dark-mode table tr:hover {
    background: #2e6b97;
    color: #fff;
}

body.dark-mode .charadata_table td:first-child,
body.dark-mode .timeline_table td:first-child[rowspan],
body.dark-mode .timeline_table tr:first-child td:first-child {
    background-color: #2e6b97;
    color: #fff;
}

@media screen and (max-width: 768px) {

    /* 暗色模式下的 .charadata_table 配色 */
    body.dark-mode .charadata_table {
        background-color: transparent;
        color: #d3d7de;
        border-color: #3a4a5a;
    }

    body.dark-mode .charadata_table tr {
        background-color: #232834;
        border-color: #3a4a5a;
    }

    body.dark-mode .charadata_table td {
        color: #d3d7de;
        border-color: #3a4a5a;
    }

    body.dark-mode .charadata_table td:first-child {
        background-color: #2e6b97;
        color: #fff;
    }

    body.dark-mode .charadata_table tr td:nth-child(2) {
        background-color: #232834;
    }

    body.dark-mode .charadata_table tr td:nth-child(2)::before {
        color: #fff;
    }

    body.dark-mode .charadata_table tr td:nth-child(3) {
        background-color: #232834;
    }

    body.dark-mode .charadata_table tr td:nth-child(3)::before {
        color: #fff;
    }
}


body.dark-mode .collapse-box {
    background: #232834;
    border-color: #3a4a5a;
}

body.dark-mode .collapse-header {
    background: #2e6b97;
    color: #fff;
}

body.dark-mode .collapse-header * {
    color: #fff;
}

body.dark-mode .collapse-content {
    background: #232834;
    color: #d3d7de;
}


/*氣泡彈窗*/
.content-box {
    position: relative;
}

.popup {
    color: #84B1ED;
    cursor: pointer;
    text-decoration: underline;
    position: relative;
    text-wrap: nowrap;
}

.popup::before {
    content: attr(data-popup-content);
    white-space: pre-line;
    text-indent: 0;
    position: absolute;
    left: var(--popup-left, 100%) !important;
    top: var(--popup-top, 0) !important;
    font-size: 12px;
    color: white;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 10px;
    width: 180px;
    max-width: 220px;
    max-height: 200px;
    overflow: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 9999;
    box-sizing: border-box;
}

.popup:hover::before {
    opacity: 1;
    pointer-events: auto;
}


/* 收合區塊*/
.collapse-box {
    border: 1px solid #bbb;
    border-radius: 6px;
    margin: 1.5em 0;
    background: #f7f7f7;
    overflow: hidden;
}

.collapse-header {
    width: 100%;
    background: #2e6b97;
    color: white;
    border: none;
    outline: none;
    font-size: 1.2em;
    font-weight: bold;
    padding: 0.7em 1.2em;
    text-align: left;
    cursor: pointer;
    display: flex;
    position: relative;
    align-items: center;
    transition: background 0.2s;
}

.collapse-header * {
    color: white;
}

.collapse-header .arrow {
    display: inline-block;
    margin-right: 0.7em;
    font-size: 1.2em;
    transition: transform 0.2s;
}

.collapse-box.open .collapse-header .arrow {
    transform: rotate(90deg);
}


.collapse-content {
    max-height: 0;
    overflow: hidden;
    background: #fff;
    padding: 0 1.2em;
    transition: max-height 0.3s cubic-bezier(.4, 0, .2, 1), padding 0.3s;
}

.collapse-box.open .collapse-content {
    padding: 1em 1.2em;
    max-height: 1200px;
    /* 根據內容調整最大高度 */
}

/*縮排*/
.content-box {
    text-indent: 2em;
}

.content-box p {
    margin: 0.4em 0;
}


.content-box .image-container {
    width: 100%;
    padding: 5px;
    display: flex;
    justify-content: center;
}

.content-box img {
    max-width: 60%;
    height: auto;
    border-radius: 5px;

}

summary::marker {
    content: "";
    font-size: 0;
}

summary {
    display: inline-block;
    font-size: 1.5em;
    cursor: pointer;
    position: relative;
}

summary::after {
    content: "▼";
    font-size: 1em;
    margin-left: 0.5em;
    vertical-align: middle;
    transition: transform 0.2s;
}

details[open] summary::after {
    content: "▲";
}

.collapse-box.others .content-box {
    text-indent: 0;
    text-align: center;
}

.collapse-box.others .will-container{
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
}

.collapse-box.others .content-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

}
.collapse-box.others .will-container .content-container {
    width: 40%;
}

/*表格共通樣式*/
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-family: Arial, sans-serif;
    font-size: 16px;
    background-color: #f9f9f9;
}

table td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
    word-wrap: break-word;
    word-break: break-all;
    overflow-wrap: break-word;
}

table tr:nth-child(odd) {
    background-color: #f2f2f2;
}

table tr:hover {
    background-color: #e0e0e0;
}

/* 設定表格樣式 */

.charadata_table td:first-child {
    width: 10%;
    background-color: #1E6C93;
    color: white;
    font-weight: bold;
    text-align: left;
    padding: 12px;
    border: 1px solid #ddd;
    position: sticky;
}

.charadata_table td:not(:first-child) {
    width: 45%;
}

.charadata_table img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 5px;
}

/*大頭照名字*/
.headshot_container {
    position: relative;
    display: inline-block;
}


.headshot::before {
    bottom: 5px;
    content: "繪師：Shuja";
    position: absolute;
    color: white;
    text-shadow: #181c22 1px 1px 2px,
        #666 0.5px 0.5px 0,
        #666 -0.5px -0.5px 0,
        #666 0.5px -0.5px 0,
        #666 -0.5px 0.5px 0;
    ;
    padding: 2px 4px;
}

@media screen and (max-width: 768px) {
    .headshot_container {
        display: block;
        text-align: center;
    }

    .headshot::before {
        font-size: 12px;
        left: 15%;
        bottom: 2px;
        padding: 1px 3px;
    }
}

/*時間線表格樣式*/

/* 第一欄作為標題 */
.timeline_table td:first-child[rowspan],
.timeline_table tr:first-child td:first-child {
    background-color: #1E6C93;
    color: white;
    text-align: left;
    font-weight: bold;
    padding: 12px;
    border: 1px solid #ddd;
    position: sticky;
    left: 0;
}

/*響應式表格*/
@media screen and (max-width: 768px) {

    .content-box {
        font-size: 14px;
    }


    .charadata_table {
        border: 0;
        font-size: 14px;
    }

    .charadata_table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 5px;
        background-color: #fff;
        overflow: hidden;
        box-sizing: border-box;
    }

    .charadata_table td {
        width: unset !important;
    }

    .charadata_table td:first-child {
        display: block;
        background-color: #1E6C93;
        color: white;
        font-weight: bold;
        text-align: center;
        padding: 12px;
        border: none;
        border-radius: 5px 5px 0 0;
        position: relative;
        font-size: 16px;
    }

    .charadata_table td:nth-child(n+2) {
        display: block;
        padding: 10px 10px 10px 50%;
        position: relative;
        border: none;
        border-bottom: 1px solid #eee;
        text-align: left;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .charadata_table tr td:nth-child(2) {
        background-color: #f9f9f9;
    }

    .charadata_table tr td:nth-child(2)::before {
        content: "玄真";
        position: absolute;
        left: 10px;
        width: 40%;
        padding-right: 10px;
        font-weight: bold;
        text-align: left;
        color: #333;
        white-space: nowrap;
    }

    .charadata_table tr td:nth-child(3) {
        background-color: #e8f0f4;
    }

    .charadata_table tr td:nth-child(3)::before {
        content: "克里姆特";
        position: absolute;
        left: 10px;
        width: 40%;
        padding-right: 10px;
        font-weight: bold;
        text-align: left;
        color: #333;
        white-space: nowrap;
    }

    .charadata_table img {
        max-width: 70%;
        margin: 5px auto;
    }

    .charadata_table td {
        word-break: break-all;
        line-height: 1.4;
    }

    .timeline_table {
        border: 0;
        font-size: 12px;
        /* 減小字體大小 */
    }

    /* 長文本處理 */
    .timeline_table td {
        word-break: break-all;
        line-height: 1.4;
    }
}

@media screen and (max-width: 400px) {
    .charadata_table {
        font-size: 12px;
    }

    .charadata_table td:first-child {
        font-size: 14px;
        padding: 10px;
    }

    .charadata_table td:nth-child(n+2) {
        padding: 8px 10px 8px 45%;
    }

    .charadata_table td:nth-child(n+2)::before {
        width: 35%;
        font-size: 12px;
    }

    .charadata_table img {
        max-width: 60%;
    }
}