/* 統一 CSS 框架 */
:root {
    --primary-dark: #2c5a85;
    --bg-light: #f0f4f8;
    --card-purple: #4e72bc;
    --card-blue: #e3f2fd;
    --text-main: #2c3e50;
    --bg-gradient: #f1f1f1;
    --primary-purple: #7d3c8c;
    --header-bg: #4e72bc;
    --light-blue-bg: #e3f2fd;
    --footer-bg: #f5f5dc;
    --text-blue: #01579b;

}

a {
    text-decoration: none;
    color: #2c3e50;
}

a:hover {
    opacity: .9;

}

body {
    margin: 0;
    font-family: "PingFang TC", sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    font-size: 22px;
    color: #4e72bc;
}

header {
    background: var(--header-bg);
    color: #fff;
    margin: auto;
    display: flex;
    justify-content: center;

}

header div {
    width: 1000px;
    font-size: 22px;
    height: 60px;
    font-weight: bold;
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
}


header h1 {
    width: 60%;
}

header .logo-img {
    /* width: 140px; */
    width: 65px;
    margin-left: auto;
}

header a {
    color: #fff;
}

/* 首頁特有佈局 */
.container {
    flex: 1;
    max-width: 1000px;
    margin: auto;
    padding: 60px 40px;
    display: grid;
    background-color: #f8f9fa;
    /* min-height: calc(100vh - 165px); */
    grid-template-columns: 1fr 1.6fr;
    /* 左右比例 */
    gap: 20px;
    border-radius: 0 0 20px 20px;
}

/* 4. 卡片共用樣式 */
.card {
    border-radius: 20px;
    padding: 30px;
    text-decoration: none;
    /* display: flex; */
    flex-direction: column;
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    /* transform: translateY(-5px); */
    /* box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1); */
}

/* 左側大紫色卡片 */
.card-purple {
    align-items: flex-end;
    max-height: 300px;
    width: 300px;
    background: #4e72bc url(../img/Lesson.png) no-repeat center center;
    background-size: 190%;
}

.card-purple .text {
    display: block;
    text-align: right;
}

.card-purple h2 {
    display: block;
    margin: 0;
    max-width: 130px;
    width: 100%;
    text-align: right;
}

.card-purple h1 {
    font-size: 3.4rem;
    margin: 0 0 10px 0;
    line-height: 120%;
    text-align: right;

}

/* 右側區域佈局 */
.right-section {
    display: grid;
    /* grid-template-rows: auto 1fr; */
    gap: 20px;
    height: 365px;
}

.card-light-blue {
    background: url(../img/image3.png) no-repeat top -98px right -30px;
    background-size: 170%;
    color: var(--text-blue);
}

.card-light-blue h3 {
    font-size: 1.4rem;
    margin: 0;
    opacity: 0.8;
}

.card-light-blue h2 {
    font-size: 2.8rem;
    margin: 5px 0;
}

.bottom-row .card-light-blue {
    background: url(../img/image3.png) no-repeat top -133px right -45px;
    background-size: 230%;
}

/* 右下方兩格佈局 */
.bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

footer {
    padding: 20px;
    text-align: center;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.6;

}

span {
    color: #888;
}

p {
    color: #666;
}

img {
    width: 100%;
}

.sub-card {
    background: var(--card-blue);
    border-radius: 20px;
    padding: 25px;
    text-decoration: none;
    color: #01579b;
}

/* units */
.units-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 0 0 0;
    background-color: #f8f9fa;
    border-radius: 0 0 20px 20px;
    min-height: calc(100vh - 225px);
}

.title-bar {
    background: #dbeaf9;
    padding: 15px 25px;
    /* border-radius: 10px; */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 40px;
    border-radius: 24px;
}

.title-bar strong img,
.top-nav strong img {
    height: 30px;
    display: block;
    vertical-align: middle;
    margin: 0 auto;
    padding: 0;
}

.unit-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 60px 40px;
    height: auto;
}

.unit-card {
    background: white;
    border-radius: 15px;
    padding: 25px 16px;
    display: flex;
    align-items: flex-start;
    height: 120px;
    /* border: 8px solid #ccc; */
    text-decoration: none;
    color: inherit;

}

.unit-card b {
    font-size: 20px;
    color: #37475A;
}

.unit-card.active {
    border-left-color: #8fa1c1;
}

.unit-icon {
    width: 70px;
    height: 70px;
    background-color: #fff;
    border-radius: 30px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 55%;
}

.unit-icon.icon-sage {
    background-color: #5F9EA0;
}

.unit-icon.icon-sand {
    background-color: #c5afa1;
}

.unit-icon.icon-slate {
    background-color: #7f94b5;
}

.card-sage {
    background: #e6f2f0;
}

.card-sand {
    background: #f7f0ec;
}

.card-slate {
    background: #E8ECF3;
}



/* question */
.top-nav {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background-color: #dbeaf9;
    margin: 0 20px;
    border-radius: 24px;
}

.back-link {
    background: #2c5a85;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    font-size: 0.9rem;
}

.q-title {
    background-color: #F2EAE5;
    padding: 20px 24px;
    color: #2c3e50;
    font-weight: 700;
    text-align: center;
    white-space: pre-line;
    width: 300px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 22px;
    justify-content: center;
    margin: 0 auto;
}

.q-btn {

    padding: 16px 30px;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    display: inline-block;
    justify-content: space-between;
    align-items: center;
    border-radius: 30px;
    justify-content: center;
    margin: 0 auto;
}

.q-btn.qu {
    background-color: #C78B6B;
}

.q-btn.sq {
    background-color: #2c5a85;

}


.q-body {
    /* padding: 40px 0; */
}

.math-box {
    font-size: 1.2rem;
    background: #fafafa;
    padding: 20px;
    border-radius: 10px;
    border: 1px dashed #ddd;
    margin: 20px 0;
}

.options-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
}

.option {
    /* border:2px solid #5c8bad; */
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    background: #F0F4FC;
}

.option a {
    display: inline-flex;
    text-decoration: none;
    align-items: center;
}

.option:hover {
    background: #dbeaf9;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);

}

.option.action {
    background: #dbeaf9;
}

.option img {
    width: 50%;
}

.opt-num {
    width: 40px;
    height: 40px;
    background: #2c5a85;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 1.4rem;
    font-weight: 400;
    color: #fff;
}


/* 解答內文樣式 */
.solution-section {
    border-left: 4px solid var(--accent-blue);
    text-align: center;
    margin: 20px auto;
    background-color: #f1f1f1;
    padding: 20px;
    text-align: center;
    border-radius: 12px;
}

.solution-section.qu-ok img {
    width: 300px;
    height: 300px;
    margin: 40px auto;
    text-align: center;
}

.solution-section h4 {
    margin: 0 0 10px 0;
    color: var(--primary-navy);
    font-size: 1.1rem;
}

.solution-section p {
    margin: 0;
    line-height: 1.8;
    color: #555;
}

.arrow-icon {
    transition: transform 0.3s;
}

.rotate {
    transform: rotate(180deg);
}

ul.list-badge {
    display: inline-block;
    color: var(--text-blue);
    padding: 6px 0;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 16px;
    font-weight: 500;
    list-style: none;

}

.status {
    font-size: 1rem;
    background: #ffffff96;
    padding: 2px 8px;
    border-radius: 10px;
    margin: 4px auto;
    display: block;
}

.status:hover {
    font-size: 1rem;
    background: #ffffff;
    padding: 2px 8px;
    border-radius: 10px;
    margin: 4px auto;
    display: block;
}

#myBtn {
    background: #2c5a85 url(../img/icon_top_up.svg) no-repeat top;
    background-size: 100%;
    height: 50px;
    width: 50px;
    position: fixed;
    bottom: 4%;
    right: 1%;
    cursor: pointer;
    z-index: 9;
    border: none;
    border-radius: 100px;
}

#myBtn:hover {
    opacity: .8;
}

footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
    color: #888;
}

@media (max-width: 900px) {

    header div {
        width: 100%;
        padding: 0 6%;
    }

    .unit-grid {
        grid-template-columns: 1fr 1fr;
        padding: 40px 20px;
    }

    body {

        font-size: 16px;
        color: #4e72bc;
    }

    .q-title {
        /* 
        width: 90%; */
        padding: 15px 24px;

    }

    .right-section {
        height: auto;
    }

    .card-purple {
        width: 260px;
        /* max-height: 260px; */
    }

    .card {
        padding: 20px;
    }

    .card-light-blue h2 {
        font-size: xx-large;
    }
}

/* RWD */
@media (max-width: 768px) {

    /* 5. 響應式設計 (RWD) */
    .container {
        grid-template-columns: 1fr;
        padding: 40px 40px;
        height: 100%;
        /* 手機版改為單欄 */
    }

    .bottom-row {
        grid-template-columns: 1fr;
        /* 手機版下方卡片也改為單欄 */
    }

    .right-section {
        height: auto;
    }

    .card {
        border-radius: 16px
    }

    .card-purple {
        min-height: auto;
        width: auto;
        /* background: url(../img/Lesson.png) no-repeat top -140px center; */
        background-size: 160%;
        padding: 20px;
        height: 200px;
    }

    .card-purple h2 img {

        height: 50%;
        width: auto;
    }

    .home-grid,
    .bottom-row {
        grid-template-columns: 1fr;
    }

    .bottom-row .card-light-blue,
    .card-light-blue {
        background: url(../img/image3.png) no-repeat top -180px right -80px;
        /* background-size: 190%; */
    }

    .title-bar strong img,
    .top-nav strong img {
        height: 20px;
        display: block;
        vertical-align: middle;
        margin: 0 auto;
        padding: 0;
        width: auto;
    }

    .title-bar {
        padding: 15px;
        margin: 0 20px;
    }

    .q-title {
        width: calc(100% - 40px);
        max-width: calc(100% - 40px);
        box-sizing: border-box;
    }

}

@media (max-width: 600px) {
    .unit-grid {
        grid-template-columns: 1fr;
    }

    .options-group {
        /* grid-template-columns: 1fr; */
    }

    .q-body {
        /* padding: 25px; */
    }

    .q-body img {
        width: 100%;
    }

    .q-body .option img {
        width: 55%;
    }

    .accordion-content.active {
        padding: 20px;
    }

    .opt-num {
        width: 30px;
        height: 30px;

        font-size: 1rem;
        font-weight: 600;
    }

    .q-btn {
        font-size: .8rem;
        padding: 8px 20px;
    }

}

@media (width: 440px) {
    .card-purple {
        min-height: auto;
        width: auto;
        background: url(../img/Lesson.png) no-repeat top -105px center;
        background-size: 125%;
        /* padding: 20px;
        height: 200px; */
    }
}
