/* ========================================= */
/* 1. 全域變數與字型載入 */
/* ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Chiron+GoRound+TC:wght@200..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Press+Start+2P&family=Noto+Sans+TC:wght@400;900&display=swap');


/* Chiron GoRound TC Font Overrides for Warm Educational Style */
h1, h2, h3, h4, h5, h6, .card-header, .navbar .logo, .social-group h3 {
    font-family: "Chiron GoRound TC", "Noto Sans TC", sans-serif !important;
    font-weight: 700;
}

:root {
    --navbar-bg: rgba(44, 158, 158, 0.85);
    --navbar-border: rgba(255, 255, 255, 0.15);
    --hero-gradient: linear-gradient(135deg, #2c9e9e 0%, #3bb8b8 40%, #4f46e5 100%);
    --body-bg: #f4f7f6;

    /* Brand Accent Colors */
    --accent: #F5A130;
    --accent-hover: #fbbf24;

    /* Subject: Chinese */
    --ch-primary: #0f766e;
    --ch-dark: #0d9488;
    --ch-light: rgba(204, 251, 241, 0.5);
    --ch-border: rgba(15, 118, 110, 0.15);

    /* Subject: Math */
    --ma-primary: #1d4ed8;
    --ma-dark: #2563eb;
    --ma-light: rgba(219, 234, 254, 0.5);
    --ma-border: rgba(29, 78, 216, 0.15);

    /* Subject: English */
    --en-primary: #6d28d9;
    --en-dark: #8b5cf6;
    --en-light: rgba(237, 233, 254, 0.5);
    --en-border: rgba(109, 40, 217, 0.15);

    /* Subject: Social */
    --so-primary: #be123c;
    --so-dark: #f43f5e;
    --so-light: rgba(255, 228, 230, 0.5);
    --so-border: rgba(190, 18, 60, 0.15);

    /* Subject: Strategy */
    --st-primary: #0e7490;
    --st-dark: #06b6d4;
    --st-light: rgba(236, 254, 255, 0.5);
    --st-border: rgba(14, 116, 144, 0.15);

    --shadow-hover: 0 20px 40px rgba(44, 158, 158, 0.12);
    --card-shadow: 0 10px 30px rgba(44, 158, 158, 0.05);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}



body {
    background: radial-gradient(circle at 10% 20%, rgba(44, 158, 158, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(79, 70, 229, 0.05) 0%, transparent 40%),
                var(--body-bg);
    background-attachment: fixed;
    color: #334155;
    margin: 0;
    padding: 20px 20px 80px 20px;
    padding-top: 70px;
    font-family: "Outfit", "Noto Sans TC", sans-serif;
    font-size: 18px;
    font-weight: 500;
    min-height: 100vh;
    position: relative;
}

/* ========================================= */
/* 2. 導航欄 (Navbar) */
/* ========================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(44, 158, 158, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 14px 48px;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 5000 !important;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
    animation: slideInFromTop 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: translateY(-150%);
}

@keyframes slideInFromTop {
    0% {
        transform: translateY(-150%);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.navbar .logo {
    font-size: 1.8em;
    font-weight: 900;
    background: linear-gradient(135deg, #ffffff 30%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2.5px;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.navbar .logo:hover {
    transform: translateY(-1px) scale(1.03);
    filter: drop-shadow(0 4px 8px rgba(251,191,36,0.3));
}

.navbar nav {
    margin-left: auto;
}

.nav-links {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
    gap: 12px;
    margin-left: auto;
    margin-right: 40px;
    align-items: center;
}

.nav-links li {
    display: inline;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    font-size: 1.05em;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 14px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: translateY(-1.5px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nav-links a.active {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

/* --- 導覽列身份標籤與登入按鈕 --- */
#nav-identity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    color: #1e293b;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
    flex-shrink: 0;
    margin-left: 12px;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

#nav-identity:hover {
    background: #f0fdfa;
    border-color: #2C9E9E;
    color: #0f766e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(44, 158, 158, 0.2);
}

/* 🎓 未登入引導按鈕：Google 官方風極簡清新按鈕 */
#nav-identity.is-guest-login {
    background: #ffffff !important;
    border: 1.5px solid #dadce0 !important;
    color: #3c4043 !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.12) !important;
}

#nav-identity.is-guest-login:hover {
    background: #f8fafd !important;
    border-color: #4285f4 !important;
    color: #1a73e8 !important;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.25) !important;
    transform: translateY(-1px);
}

/* 👑 管理員標籤 */
#nav-identity.is-admin {
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    color: #b45309;
    font-weight: 800;
}

#nav-identity.is-admin:hover {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

@media (max-width: 600px) {
    #nav-identity {
        font-size: 0.78rem;
        padding: 4px 10px;
        margin-left: 6px;
    }
}

/* --- 首頁左右分割版型 (Split Layout) --- */
.homepage-split-layout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 24px 40px 24px;
    display: grid;
    grid-template-columns: 440px 1fr;
    gap: 32px;
    align-items: start;
}

/* 左側 Panel 欄位區塊 */
.split-left-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 90px;
}

.split-left-panel {
    background: transparent;
    backdrop-filter: none;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.split-left-panel .greeting-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.split-left-panel .greeting-icon {
    font-size: 1.6rem;
}

.split-left-panel h1 {
    font-size: 1.35rem;
    font-weight: 900;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

.split-left-panel .hero-subtitle {
    font-size: 0.9rem;
    color: #64748b;
    margin: 4px 0 16px 0;
    font-weight: 500;
}

/* --- 雷達圖與開始練習按鈕樣式 --- */
.radar-card-wrapper {
    background: #ffffff;
    border-radius: 20px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.radar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.radar-badge {
    font-size: 0.85rem;
    font-weight: 800;
    color: #0f766e;
    background: #ccfbf1;
    padding: 6px 14px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.radar-chart-container {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0;
}

.radar-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* 左下角「開始練習」主按鈕 */
.start-practice-btn {
    background: linear-gradient(135deg, #0d9488 0%, #059669 100%);
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 900;
    padding: 14px 28px;
    border-radius: 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 24px rgba(13, 148, 136, 0.25);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    letter-spacing: 0.5px;
}

.start-practice-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 16px 32px rgba(13, 148, 136, 0.35);
    color: #ffffff;
}

/* 第一屏右側 (四張成績數據卡片) */
.split-right-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 四科成績數據卡片網格 (2x2 Grid) */
.subject-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
}

.subject-stat-card {
    border-radius: 18px;
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    transition: all 0.22s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.03);
    border: 1px solid transparent;
}

.subject-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.subject-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #ffffff;
    flex-shrink: 0;
}

.bg-chinese { background: #fef2f2; border-color: #fee2e2; }
.bg-chinese .subject-stat-icon { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.bg-chinese .subject-stat-name { color: #991b1b; }
.bg-chinese .subject-stat-val { color: #dc2626; }

.bg-math { background: #ecfeff; border-color: #cffaff; }
.bg-math .subject-stat-icon { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.bg-math .subject-stat-name { color: #155e75; }
.bg-math .subject-stat-val { color: #0891b2; }

.bg-english { background: #f5f3ff; border-color: #ede9fe; }
.bg-english .subject-stat-icon { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.bg-english .subject-stat-name { color: #5b21b6; }
.bg-english .subject-stat-val { color: #7c3aed; }

.bg-social { background: #fffbeb; border-color: #fef3c7; }
.bg-social .subject-stat-icon { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.bg-social .subject-stat-name { color: #92400e; }
.bg-social .subject-stat-val { color: #d97706; }

.subject-stat-info {
    display: flex;
    flex-direction: column;
}

.subject-stat-name {
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1;
}

.subject-stat-val {
    font-size: 1.45rem;
    font-weight: 900;
    margin-top: 6px;
    line-height: 1;
}

/* 第二屏：選擇課程年級與科目 (3 個卡片網格) */
.subject-selection-section {
    max-width: 1280px;
    margin: 40px auto 0 auto;
    width: 100%;
    padding: 0 24px;
}

.section-title-wrapper {
    margin-bottom: 20px;
}

.cards-container-three {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
}

/* ==========================================
   全方位 RWD 響應式佈局 (Responsive Design)
   ========================================== */

/* 💻 小筆電 / 中型平板 (<= 1100px) */
@media (max-width: 1100px) {
    .dashboard {
        padding: 16px 14px;
    }
    .homepage-split-layout {
        grid-template-columns: 380px 1fr;
        gap: 24px;
        padding: 12px 16px 30px 16px;
    }
    .subject-stat-card {
        padding: 16px 14px;
        gap: 12px;
    }
    .subject-stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }
    .subject-stat-val {
        font-size: 1.3rem;
    }
    .cards-container-three {
        gap: 16px;
    }
}

/* 📱 直立式平板 / 大手機 (<= 992px) */
@media (max-width: 992px) {
    .dashboard {
        padding: 8px 10px;
    }
    .homepage-split-layout {
        grid-template-columns: 1fr;
        padding: 6px 14px 24px 14px;
        gap: 20px;
    }
    .split-left-column {
        position: static;
    }
    .cards-container-three {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* 📱 標準智慧型手機 (<= 640px) */
@media (max-width: 640px) {
    .dashboard {
        padding: 4px 6px;
    }
    .homepage-split-layout {
        padding: 4px 10px 20px 10px;
        gap: 14px;
    }
    .greeting-header {
        margin-bottom: 8px;
    }
    .greeting-header h1 {
        font-size: 1.15rem;
    }
    .scores-header-tag {
        font-size: 0.82rem;
        padding: 5px 12px;
        margin-bottom: 12px;
    }
    .subject-stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .subject-stat-card {
        padding: 12px 10px;
        gap: 10px;
        border-radius: 14px;
    }
    .subject-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1.05rem;
        border-radius: 10px;
    }
    .subject-stat-name {
        font-size: 0.8rem;
    }
    .subject-stat-val {
        font-size: 1.2rem;
        margin-top: 4px;
    }
    .split-right-panel .cards-container {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* 📱 超小螢幕手機 (<= 380px) */
@media (max-width: 380px) {
    .subject-stat-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

body.menu-hidden .button-container,
body.menu-hidden .section-title,
body.menu-hidden #floating-toggle {
    display: none !important;
}

.breadcrumb-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 40px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 89, 89, 0.1);
    font-size: 0.9rem;
    color: #475569;
    position: sticky;
    top: 63px;
    /* 蝺票 Navbar */
    width: 100%;
    z-index: 950;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    height: 45px;
    box-sizing: border-box;
}

/* 蝘駁 body padding-top ?踹?頝喳?嚗??sticky 雿? */
body {
    padding-top: 63px;
    /* ?芣? Navbar ??摨?*/
}

.breadcrumb-item {
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

.breadcrumb-item:hover {
    color: #2C9E9E;
}

.breadcrumb-separator {
    color: #cbd5e1;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
}

.breadcrumb-active {
    color: #2C9E9E;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-item {
    cursor: pointer;
    transition: color 0.2s;
}

.breadcrumb-item:hover {
    color: #2C9E9E;
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #cbd5e1;
    font-size: 0.8rem;
}

.breadcrumb-active {
    color: #2C9E9E;
    font-weight: 700;
}

/* 蝘駁憭???padding ?踹?頝喳? */
body.with-breadcrumb {
    padding-top: 63px;
}

.menu-toggle {
    font-size: 28px;
    cursor: pointer;
    color: #fff;
    background: none;
    border: none;
    display: none;
    text-shadow: 2px 2px 0px #C84C0C;
}

/* 手機底部主導覽，桌面版維持原本的上方導覽列 */
.mobile-bottom-nav {
    display: none;
}

/* ========================================= */
/* 3. 鞈???? (Cards) */
/* ========================================= */
.section-content {
    display: none;
    width: 100%;
}

.section-content.active-section {
    display: flex;
    align-items: center;
    min-height: calc(100vh - 220px);
    padding: 20px 0;
}

/* 撠釣璅∪?銝?撠摰孵?憛??游?銝?*/
body.menu-hidden .section-content.active-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
    /* ??撠汗??頝臬?璇?擃漲 */
    padding: 20px 0;
}

.social-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    /* 蝘駁?箏? margin-top */
}

/* 撠釣璅∪?銝葬皜??寥?頝?*/
body.menu-hidden .social-container {
    margin-top: 0;
}

.single-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    width: 100%;
    margin-bottom: 30px;
}

.social-group {
    padding: 30px 25px 25px 25px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    text-align: left;
    flex: 0 0 calc((100% - 60px) / 3);
    min-width: 300px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.social-group:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(44, 158, 158, 0.3);
}

.social-group h3 {
    margin-top: -48px;
    background: linear-gradient(135deg, #2c9e9e 0%, #3bb8b8 100%);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 14px;
    border: none;
    font-size: 20px;
    box-shadow: 0 8px 20px rgba(44, 158, 158, 0.15);
    text-align: center;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 1px; pointer-events: none;
    position: relative;
    z-index: 1;
}

@media (max-width: 950px) {
    .social-group {
        flex: 0 0 calc((100% - 30px) / 2);
    }
}

@media (max-width: 600px) {
    .social-group {
        flex: 0 0 100%;
        margin-top: 20px;
    }
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    background: rgba(255, 255, 255, 0.85);
    color: #2C9E9E;
    padding: 14px 22px;
    font-size: 20px;
    border-radius: 16px;
    border: 1px solid rgba(44, 158, 158, 0.15);
    border-left: 6px solid #2C9E9E;
    text-decoration: none;
    text-align: left;
    display: block;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(44, 158, 158, 0.03);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-weight: 800;
}

.btn:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #f5a130 100%);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 161, 48, 0.25);
    border-color: #F5A130;
}

.btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* ========================================= */
/* 4. ???? */
/* ========================================= */
.chapter-button,
.section-button {
    margin: 8px;
    padding: 12px 20px;
    font-size: clamp(16px, 1.8vw, 20px);
    font-weight: 800;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #475569;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 220px;
    min-height: 70px;
    text-align: center;
    line-height: 1.3;
    vertical-align: middle;
}

.chapter-button:hover,
.section-button:hover {
    background: #ffffff;
    color: #2C9E9E;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(44, 158, 158, 0.1);
    border-color: #2C9E9E;
}

.chapter-button:active,
.section-button:active {
    transform: translateY(1px);
    box-shadow: none;
}

.chapter-button.active,
.section-button.active {
    background: linear-gradient(135deg, #f59e0b 0%, #f5a130 100%);
    color: #ffffff;
    border: 1px solid #f5a130;
    box-shadow: 0 8px 20px rgba(245, 161, 48, 0.2);
    transform: scale(1.03);
}

.button-row,
.button-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 30px auto 50px auto;
    text-align: center;
    max-width: 1200px;
}

/* ========================================= */
/* 5. 頁尾 (Footer - 現代化毛玻璃風格，全站統一) */
/* ========================================= */
footer,
.sticky-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-height: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.85);
    border: 0;
    border-top: 1px solid rgba(190, 232, 228, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #7a90a3;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 20px !important;
    z-index: 1001 !important;
}

.footer-left,
.footer-center,
.footer-right {
    flex: 1 1 0%;
    display: flex;
    align-items: center;
    min-width: 0;
    font-weight: 700;
    font-size: 0.85rem;
}

.footer-left {
    justify-content: flex-start;
}

.footer-center {
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    color: #7a90a3;
}

.footer-right {
    justify-content: flex-end;
    gap: 10px;
}

.footer-left .countdown-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fef2f2;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #fecdd3;
    box-shadow: 0 4px 12px rgba(35, 83, 94, 0.08);
    color: #e11d48;
    font-size: 0.8rem;
    font-weight: 800;
}

.footer-btn {
    background: #ffffff;
    color: #008f89;
    border: 1.5px solid #b2e7df;
    padding: 6px 18px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 143, 137, 0.08);
}

.footer-btn:hover {
    background: #008f89;
    color: #ffffff;
    border-color: #008f89;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 143, 137, 0.25);
}

.footer-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* ========================================= */
/* ????撠曉??刻身摰?(?拇?蝒撟? */
/* ========================================= */

/* ========================================= */
/* ????撠曉??刻身摰?(蝎曄陛?? */
/* ========================================= */


/* ========================================= */
/* ????撠曉??刻身摰?(?株???撅) */
/* ========================================= */
@media (max-width: 768px) {

    footer,
    .sticky-footer {
        display: flex !important;
        flex-direction: row !important;
        padding: 5px 10px;
        min-height: 40px;
        gap: 5px;
        align-items: center;
        justify-content: space-between;
        white-space: nowrap;
    }

    .footer-left,
    .footer-center,
    .footer-right {
        flex: 0 1 auto;
        min-width: 0;
        text-align: center;
    }

    /* ???蝮桀??? */
    .footer-left .countdown-wrapper {
        font-size: 10px !important;
        padding: 3px 6px !important;
        white-space: nowrap;
    }

    /* 銝剝?????蝮桀? */
    .footer-center {
        font-size: 9px !important;
        white-space: nowrap;
        opacity: 0.9;
    }

    /* ??蝮桀? */
    .footer-right .footer-btn {
        font-size: 11px !important;
        padding: 3px 8px !important;
        white-space: nowrap;
        border-width: 2px !important;
    }

    /* ?梯???內?征??*/
    .footer-left .countdown-wrapper i {
        display: none;
    }

    /* ???偌蝞∠葬撠?*/
    .pipe-decoration {
        width: 40px !important;
        height: 50px !important;
        bottom: 40px !important;
    }

    .pipe-decoration::before {
        width: 50px !important;
        height: 18px !important;
        top: -18px !important;
        left: -5px !important;
    }

    .pipe-decoration.right {
        height: 40px !important;
    }

    /* ???憛?甇亦葬撠?*/
    .pipe-blocks {
        top: -60px !important;
    }

    .block {
        width: 30px !important;
        height: 30px !important;
        font-size: 16px !important;
    }
}

/* ========================================= */
/* 6. ?嗡???辣 */
/* ========================================= */
.intro-text {
    /* ?? 銝餉?靽格??銵?撠???潮隤踹之 ?? */
    font-size: clamp(2.2rem, 6vw, 4rem);

    font-weight: 900;
    text-align: center;
    margin: 5px auto 40px;
    color: #2C9E9E;
    text-shadow: none;
    letter-spacing: 2px;
    max-width: 90vw;
    padding: 0 10px;
    animation: slowPulse 1.5s ease-in-out infinite;
    border-bottom: 5px solid #F5A130;
    display: inline-block;
    padding-bottom: 5px;
}

@keyframes slowPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: block;
    position: absolute;
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    min-width: 140px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    z-index: 9999 !important;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.25s;
    padding: 6px 0;
}

.dropdown-content a {
    color: #475569 !important;
    padding: 10px 20px;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    border-bottom: none;
    transition: all 0.2s ease;
    margin: 2px 6px;
    border-radius: 10px;
}

.dropdown-content a:hover {
    background-color: rgba(44, 158, 158, 0.08);
    color: #2c9e9e !important;
    transform: translateX(2px);
}

.dropdown-content a.locked {
    opacity: 0.65;
}

.dropdown-content a.locked:hover {
    background: transparent !important;
    color: #94a3b8 !important;
    transform: none !important;
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.section-content {
    display: none;
}

.active-section {
    display: block !important;
    animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.section-title {
    font-weight: 900;
    font-size: clamp(2.5rem, 5vw, 4rem);
    text-align: center;
    color: #2C9E9E;
    text-shadow: none;
    margin: 50px auto 30px;
    max-width: 700px;
    letter-spacing: 3px;
    position: relative;
    padding-bottom: 15px;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ========================================= */
/* 6. 擐??銵冽 (Dashboard Cards) */
/* ========================================= */
.dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: calc(100vh - 150px);
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    margin-bottom: 30px;
}

.grade-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: scaleIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.grade-card:nth-child(2) {
    animation-delay: 0.1s;
}

.grade-card:nth-child(3) {
    animation-delay: 0.2s;
}

.grade-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(44, 158, 158, 0.3);
}

.card-header {
    background: linear-gradient(135deg, #2c9e9e 0%, #3bb8b8 100%);
    color: #ffffff;
    padding: 12px 14px;
    text-align: center;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1px;
}

.card-header small {
    display: block;
    font-size: 11.5px;
    opacity: 0.88;
    font-weight: 600;
    margin-top: 1px;
    letter-spacing: 0.5px;
}

.card-body {
    padding: 18px 16px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.subject-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 22px 10px;
    border-radius: 20px;
    text-decoration: none;
    color: #475569;
    font-weight: 800;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
}

.subject-btn i {
    font-size: 28px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Specific Subject Theme Styles */
.subject-btn.ch {
    background: var(--ch-light);
    border-color: var(--ch-border);
    color: var(--ch-primary);
}
.subject-btn.ch i {
    color: var(--ch-primary);
}

.subject-btn.ma {
    background: var(--ma-light);
    border-color: var(--ma-border);
    color: var(--ma-primary);
}
.subject-btn.ma i {
    color: var(--ma-primary);
}

.subject-btn.en {
    background: var(--en-light);
    border-color: var(--en-border);
    color: var(--en-primary);
}
.subject-btn.en i {
    color: var(--en-primary);
}

.subject-btn.so {
    background: #fffbeb;
    border-color: #fef3c7;
    color: #d97706;
}
.subject-btn.so i {
    color: #d97706;
}

.subject-btn.exam {
    background: #fff1f2;
    border-color: #ffe4e6;
    color: #e11d48;
}
.subject-btn.stra {
    background: #eef2ff;
    border-color: #e0e7ff;
    color: #4f46e5;
}
.subject-btn.stra i {
    color: #6366f1;
}

.subject-btn.anc {
    background: #f3e8ff;
    border-color: #e9d5ff;
    color: #7e22ce;
}
.subject-btn.anc i {
    color: #7e22ce;
}

/* Hover effects */
.subject-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.03);
}

.subject-btn.ch:hover {
    background: var(--ch-primary);
    color: #ffffff;
    border-color: var(--ch-primary);
}
.subject-btn.ch:hover i {
    color: #ffffff;
    transform: scale(1.1) rotate(-5deg);
}

.subject-btn.ma:hover {
    background: var(--ma-primary);
    color: #ffffff;
    border-color: var(--ma-primary);
}
.subject-btn.ma:hover i {
    color: #ffffff;
    transform: scale(1.1) rotate(5deg);
}

.subject-btn.en:hover {
    background: var(--en-primary);
    color: #ffffff;
    border-color: var(--en-primary);
}
.subject-btn.en:hover i {
    color: #ffffff;
    transform: scale(1.1) rotate(-5deg);
}

.subject-btn.so:hover {
    background: #d97706;
    color: #ffffff;
    border-color: #d97706;
}
.subject-btn.so:hover i {
    color: #ffffff;
    transform: scale(1.1) rotate(5deg);
}

.subject-btn.stra:hover {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
}
.subject-btn.stra:hover i {
    color: #ffffff;
    transform: scale(1.1) rotate(5deg);
}

.subject-btn.exam:hover {
    background: #e11d48;
    color: #ffffff;
    border-color: #e11d48;
}
.subject-btn.exam:hover i {
    color: #ffffff;
    transform: scale(1.1) rotate(-5deg);
}

.subject-btn.anc:hover {
    background: #7e22ce;
    color: #ffffff;
    border-color: #7e22ce;
}
.subject-btn.anc:hover i {
    color: #ffffff;
    transform: scale(1.1) rotate(5deg);
}

/* ????孵?∠? */
.special-card {
    grid-column: span 3;
    background: #F5A130;
    color: #1e293b;
    padding: 25px;
    border-radius: 20px;
    text-decoration: none;
    text-align: center;
    font-size: 24px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 10px 20px rgba(245, 161, 48, 0.3);
    transition: all 0.2s;
    border: 2px solid transparent;
}

.special-card:hover {
    transform: scale(1.02);
    background: #ffdb7d;
    box-shadow: 0 15px 30px rgba(255, 206, 84, 0.4);
    border-color: #2C9E9E;
}

@media (max-width: 1000px) {
    .cards-container {
        grid-template-columns: repeat(1, 1fr);
        max-width: 500px;
    }

    .special-card {
        grid-column: span 1;
    }
}

@keyframes scaleIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================= */
/* 7. 敶閬? (Modal) */
/* ========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.open {
    display: block;
}

/* 阻尼條與手機專用關閉鈕在桌機版預設隱藏 */
.modal-drag-handle {
    display: none;
}

.modal-bottom-close-btn {
    display: none;
}

.modal-content {
    background: rgba(248, 250, 252, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: 5% auto;
    padding: 40px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.15);
    width: 85%;
    max-width: 960px;
    position: relative;
    color: #1e293b;
    animation: modalPopIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    /* ?? ???銵???憭折?摨佗?銝血?閮勗摰寥?憭??臭?銝???*/
    max-height: 80vh;
    overflow-y: auto;
}
@keyframes modalPopIn {
    from {
        transform: scale(0.95) translateY(10px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-title {
    text-align: center;
    color: #c2410c;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.close-modal,
.gacha-animation-close {
    color: #ef4444 !important;
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ffffff !important;
    border: 2.5px solid #ef4444 !important;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.22);
    line-height: 1;
    z-index: 10;
    user-select: none;
    box-sizing: border-box;
    padding: 0;
    outline: none;
}

.close-modal:hover,
.gacha-animation-close:hover {
    color: #ffffff !important;
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.42);
    transform: rotate(90deg) scale(1.1);
}

.close-modal:active,
.gacha-animation-close:active {
    transform: scale(0.95);
}

.modal-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
}

.modal-group {
    flex: 1 1 280px;
    min-width: 280px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.modal-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.04);
}

.modal-group h3 {
    margin-top: 0;
    padding-bottom: 12px;
    border-bottom: 2px dashed rgba(44, 158, 158, 0.2);
    text-align: center;
    color: #2C9E9E;
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.modal-group .btn {
    text-align: center;
    background: #ffffff;
    color: #2C9E9E;
    border: 1px solid rgba(44, 158, 158, 0.3);
    font-size: 16px;
    margin: 0;
    padding: 12px 20px;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    display: block;
    font-weight: 700;
    transition: all 0.2s ease;
}

.modal-group .btn:hover {
    background: #2C9E9E;
    color: #ffffff;
    border-color: #2C9E9E;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(44, 158, 158, 0.2);
}

/* 管理員專區客製樣式 */
.admin-group {
    border: 1px solid rgba(79, 70, 229, 0.15);
    background: rgba(243, 244, 246, 0.5);
}

.admin-group h3 {
    color: #4f46e5;
    border-bottom-color: rgba(79, 70, 229, 0.2);
}

.modal-group .btn.admin-btn {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.modal-group .btn.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
    background: linear-gradient(135deg, #4338ca, #6d28d9);
}

/* --- ??蝳???--- */
a.btn[href="#"],
a.btn[href=""] {
    background: #BDBDBD !important;
    color: #757575 !important;
    border: 3px solid #757575 !important;
    box-shadow: 0 4px 0 #757575 !important;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.7;
}

/* Locked buttons (e.g., social skill & learning strategy on home page, and portal subject buttons, nav dropdowns) */
a.btn.locked,
.section-content .btn.locked,
.modal-group .btn.locked,
.subject-btn.locked,
.dropdown-content a.locked {
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    opacity: 0.8;
}

a.btn.locked i,
.subject-btn.locked i,
.dropdown-content a.locked i {
    margin-right: 6px;
    color: #94a3b8 !important;
}

.subject-btn.locked:hover,
.dropdown-content a.locked:hover {
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
    border-color: #cbd5e1 !important;
    transform: none !important;
    box-shadow: none !important;
}

.modal-group .btn.locked:hover {
    background: #e2e8f0 !important;
    color: #94a3b8 !important;
    border-color: #cbd5e1 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* --- 摮豢?憿舐內 --- */
#semester1-area {
    display: none;
}

#semester2-area {
    display: block;
}

/* --- ?喃?閫??? --- */
/* --- 學期切換與小節切換分頁控制鈕 (Segmented Control) --- */
.semester-segmented-control {
    position: relative;
    top: auto;
    right: auto;
    display: flex;
    background: #e2e8f0; /* 質感淺灰底色 */
    padding: 4px;
    border-radius: 99px;
    width: fit-content;
    margin: 20px auto;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    z-index: 1301;
    gap: 0;
    cursor: default;
    transition: none;
    box-shadow: none;
    transform: none;
    isolation: isolate;
    pointer-events: auto;
    touch-action: manipulation;
}

.semester-segmented-control button.segmented-item {
    position: relative;
    z-index: 1;
    min-height: 44px;
    padding: 8px 24px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #64748b;
    cursor: pointer;
    border-radius: 99px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    background: transparent;
    border: none;
    outline: none;
    user-select: none;
    font-family: inherit;
}

.semester-segmented-control button.segmented-item:focus-visible {
    outline: 3px solid rgba(15, 23, 42, .7);
    outline-offset: 2px;
}

.semester-segmented-control button.segmented-item:hover:not(.active) {
    color: #334155;
    background: rgba(255, 255, 255, 0.55);
}

/* 學門專屬高亮主色定義 */
body.chinese-menu-page {
    --sem-active-bg: var(--ch-primary);
}
body.math-menu-page {
    --sem-active-bg: var(--ma-primary);
}
body.english-menu-page {
    --sem-active-bg: var(--en-primary);
}

.semester-segmented-control button.segmented-item.active {
    background: var(--sem-active-bg, var(--accent));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}


.stop-update-notice {
    background: #fef2f2;
    border: 2px dashed #e11d48;
    color: #e11d48;
    padding: 15px 20px;
    margin: 20px auto 10px auto;
    max-width: 90%;
    border-radius: 15px;
    text-align: center;
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transform: rotate(-1deg);
}

/* ========================================= */
/* 8. ????恍 (Title Screen)撠璅?? */
/* ========================================= */








/* ???? */
.start-btn {
    background: #F5A130;
    color: #000000;
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 1.8rem;
    padding: 15px 50px;
    border: 2px solid #F5A130;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 206, 84, 0.3);
    transition: all 0.2s;
    animation: pulse-btn 2s infinite ease-in-out;
    z-index: 5;
    font-weight: 900;
}

.start-btn:hover {
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 184, 184, 0.25);
}

.start-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

.copyright {
    position: absolute;
    bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    z-index: 10;
    font-weight: bold;
}

/* --- ?梯?撌亙 --- */
.hidden {
    display: none !important;
}

/* --- ?摰儔 --- */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse-btn {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes blink-color {
    0% {
        background: #818cf8;
        box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
    }

    100% {
        background: #4f46e5;
        box-shadow: 0 8px 15px rgba(99, 102, 241, 0.3);
    }
}

/* 八年級數學 2x2 網格 */
.button-container.ma-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 600px;
    margin: 30px auto 50px auto;
}

.ma-grid-2x2 .section-button {
    width: 100% !important;
    margin: 0 !important;
}

@media (max-width: 480px) {
    .button-container.ma-grid-2x2 {
        grid-template-columns: 1fr;
    }
}

.button-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 800px;
    margin: 20px auto;
}

/* --- 展開後的小標題 --- */
.topic-inner-title {
    font-weight: 900;
    font-size: 1.4rem;
    text-align: center;
    color: #2C9E9E;
    margin: 30px auto 10px;
    letter-spacing: 2px;
    position: relative;
    padding-bottom: 10px;
    animation: bounce 2s infinite;
}

/* --- 展開內容裡的按鈕：正方形 --- */
.section-content .btn {
    display: block;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    font-size: 1.2rem;
    font-weight: 900;
    text-align: left;
    padding: 15px 20px;
    border-radius: 18px;
    border: 1px solid rgba(44, 158, 158, 0.15);
    border-left: 6px solid #2C9E9E;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(44, 158, 158, 0.03);
    background: rgba(255, 255, 255, 0.85);
    color: #2C9E9E;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-content .btn:hover {
    background: #2C9E9E;
    color: #ffffff;
    border-color: #2C9E9E;
    border-left-color: #2C9E9E;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px rgba(44, 158, 158, 0.2);
}

.section-content .btn:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow: 0 4px 8px rgba(44, 158, 158, 0.1);
}

.section-content .btn-group {
    flex-direction: column;
    width: 100%;
    justify-content: center;
    gap: 10px;
    position: relative;
    z-index: 3;
}

/* --- 萬用資源入口按鈕美化 (Unifies all links inside section-content into premium card layouts) --- */
.section-content a.btn {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 16px;
    min-height: 96px;
    padding: 18px 150px 18px 22px;
    border-radius: 20px;
    border: 1px solid rgba(44, 158, 158, 0.16);
    border-left: 8px solid #2C9E9E;
    background: linear-gradient(135deg, rgba(240, 253, 250, 0.9), rgba(255, 255, 255, 0.98));
    color: #2C9E9E;
    box-shadow: 0 12px 28px rgba(44, 158, 158, 0.08);
    font-size: 1.35rem;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    position: relative;
    z-index: 4;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(44, 158, 158, 0.18);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 10px;
    font-weight: 900;
}

.section-content a.btn::before {
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    font-family: "Font Awesome 6 Free";
    font-size: 24px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(44, 158, 158, 0.18);
    pointer-events: none;
    content: "\f0c1"; /* Default icon: link */
}

.section-content a.btn::after {
    grid-column: 2;
    color: #64748b;
    font-size: 0.92rem;
    font-weight: 800;
    margin-top: 6px;
    pointer-events: none;
    content: none; /* 沒有指定類型的按鈕不加副標 */
}

.section-content a.btn:hover {
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    border-color: #2c9e9e;
    border-left-color: #2C9E9E;
    box-shadow: 0 16px 30px rgba(44, 158, 158, 0.22);
    transform: translateY(-3px) scale(1.01);
}

.section-content a.btn:hover::before {
    background: rgba(255,255,255,0.2);
    box-shadow: none;
}

.section-content a.btn:hover::after {
    color: rgba(255, 255, 255, 0.85);
}

/* --- 1. 四選一選擇 (Vocab / Choose Quiz) --- */
.section-content a.btn[href*="vocab.html"]::before,
.section-content a.btn[href*="vocab-player.html"]::before,
.section-content a.btn[href*="choose-player.html"]::before,
.section-content a.btn[href*="text-choice.html"]::before {
    content: "\f02d" !important; /* fa-book */
    background: linear-gradient(135deg, #0f766e, #0d9488) !important;
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.18) !important;
}
.section-content a.btn[href*="vocab.html"]::after,
.section-content a.btn[href*="vocab-player.html"]::after,
.section-content a.btn[href*="choose-player.html"]::after,
.section-content a.btn[href*="text-choice.html"]::after {
    content: none !important;
}

/* --- 1b. 注釋配對遊戲 (Vocab Match) --- */
.section-content a.btn[href*="vocab-match.html"]::before {
    content: "12e" !important; /* fa-puzzle-piece */
    background: linear-gradient(135deg, #d97706, #f59e0b) !important;
    box-shadow: 0 10px 22px rgba(217, 119, 6, 0.18) !important;
}
.section-content a.btn[href*="vocab-match.html"]::after {
    content: "配對闖關遊戲" !important;
}

.section-content a.btn[href*="char-detective.html"]::before {
    content: "002" !important; /* fa-magnifying-glass */
    background: linear-gradient(135deg, #c2410c, #f97316) !important;
    box-shadow: 0 10px 22px rgba(194, 65, 12, 0.18) !important;
}
.section-content a.btn[href*="char-detective.html"]::after {
    content: "國字四選一闖關" !important;
}

/* --- 2. 句子重組練習 (Sentence Jumble) --- */
.section-content a.btn[href*="jumble.html"]::before,
.section-content a.btn[href*="jumble-player.html"]::before {
    content: "\f0cb" !important; /* fa-tasks */
    background: linear-gradient(135deg, #0e7490, #06b6d4) !important;
    box-shadow: 0 10px 22px rgba(14, 116, 144, 0.18) !important;
}
.section-content a.btn[href*="jumble.html"]::after,
.section-content a.btn[href*="jumble-player.html"]::after {
    content: none !important;
}

/* --- 3. 課後練習與學習單 (Worksheets & Sheets) --- */
.section-content a.btn[href*="sheet"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::before,
.section-content a.btn[href*="practice"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::before,
.section-content a.btn[href*="G7S"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::before,
.section-content a.btn[href*="G8S"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::before,
.section-content a.btn[href*="G9S"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::before {
    content: "\f15c" !important; /* fa-file-lines */
    background: linear-gradient(135deg, #0f766e, #0d9488) !important;
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.18) !important;
}
.section-content a.btn[href*="sheet"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after,
.section-content a.btn[href*="practice"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after,
.section-content a.btn[href*="G7S"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after,
.section-content a.btn[href*="G8S"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after,
.section-content a.btn[href*="G9S"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after {
    content: none !important;
}

/* 數學專用：將「課文自學區」改為「步驟式練習」 */
.section-content a.btn[href*="math"][href*="sheet"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after,
.section-content a.btn[href*="math"][href*="practice"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after,
.section-content a.btn[href*="math"][href*="G7S"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after,
.section-content a.btn[href*="math"][href*="G8S"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after,
.section-content a.btn[href*="math"][href*="G9S"]:not([href*="vocab"]):not([href*="choose"]):not([href*="jumble"]):not([href*="dialogue"]):not([href*="習作"]):not([href*="workbook"])::after {
    content: "步驟式練習" !important;
}


/* --- 4. 習作專區 --- */
.section-content a.btn[href*="習作"]::before,
.section-content a.btn[href*="workbook"]::before {
    content: "\f044" !important; /* fa-pen-to-square */
    background: linear-gradient(135deg, #ea580c, #f97316) !important;
    box-shadow: 0 10px 22px rgba(234, 88, 12, 0.18) !important;
}
.section-content a.btn[href*="習作"]::after,
.section-content a.btn[href*="workbook"]::after {
    content: "課後習作練習" !important;
}

/* --- 5. 對話朗讀專區 --- */
.section-content a.btn[href*="dialogue"]::before {
    content: "\f0a1" !important; /* fa-bullhorn */
    background: linear-gradient(135deg, #059669, #10b981) !important;
    box-shadow: 0 10px 22px rgba(5, 150, 105, 0.18) !important;
}
.section-content a.btn[href*="dialogue"]::after {
    content: "對話朗讀與練習" !important;
}

/* --- 6. Gemini 小遊戲 --- */
.section-content a.btn[href*="gemini.google.com"]::before,
.section-content a.btn[href*="g.co/gemini"]::before {
    content: "\f544" !important;
    background: linear-gradient(135deg, #0d9488, #0f766e) !important;
}
.section-content a.btn[href*="gemini.google.com"]::after,
.section-content a.btn[href*="g.co/gemini"]::after {
    content: "Gemini小遊戲" !important;
}

/* 所有 math/*.html 連結按鈕基礎樣式 */
.section-content a.btn[href*="math/"] {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 16px;
    min-height: 96px;
    padding: 18px 150px 18px 22px;
    border-radius: 20px;
    border: 1px solid rgba(44, 158, 158, 0.16);
    border-left: 8px solid #F5A130;
    background: linear-gradient(135deg, rgba(240, 253, 250, 0.9), rgba(255, 255, 255, 0.98));
    color: #2C9E9E;
    box-shadow: 0 12px 28px rgba(44, 158, 158, 0.08);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    position: relative;
    z-index: 4;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(44, 158, 158, 0.18);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 10px;
}

/* Icon 背景圓角標章 */
.section-content a.btn[href*="math/"]::before {
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    font-family: "Font Awesome 6 Free";
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(44, 158, 158, 0.25);
    pointer-events: none;
    content: "\f1ec";
}

/* 副標題文字 */
.section-content a.btn[href*="math/"]::after {
    grid-column: 2;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 700;
    margin-top: 5px;
    pointer-events: none;
    content: "步驟式練習";
}

/* Hover 狀態 */
.section-content a.btn[href*="math/"]:hover {
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    border-color: #2c9e9e;
    border-left-color: #F5A130;
    box-shadow: 0 16px 30px rgba(44, 158, 158, 0.28);
    transform: translateY(-3px) scale(1.01);
}

.section-content a.btn[href*="math/"]:hover::before {
    background: rgba(255,255,255,0.2);
    box-shadow: none;
}

.section-content a.btn[href*="math/"]:hover::after {
    color: rgba(255, 255, 255, 0.85);
}

/* --- 入口頁按鈕上的學生最高成績徽章 (Student Highest Score Badge) --- */
.btn-score-badge {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.3px;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    z-index: 5;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

/* 1. 滿分 (100分) 也用綠色（比高分再深一點），一眼就能跟未達標的分數區分 */
.btn-score-badge.badge-perfect {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    border: 1.5px solid #16a34a;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.22);
}
.btn-score-badge.badge-perfect i {
    color: #15803d;
    filter: drop-shadow(0 1px 2px rgba(21, 128, 61, 0.3));
}

/* 2. 高分 (80~99分) 翡翠綠 */
.btn-score-badge.badge-high {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    color: #15803d;
    border: 1.5px solid #22c55e;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.18);
}
.btn-score-badge.badge-high i {
    color: #16a34a;
}

/* 3. 及格 (60~79分) 蔚藍 */
.btn-score-badge.badge-pass {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1d4ed8;
    border: 1.5px solid #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
.btn-score-badge.badge-pass i {
    color: #2563eb;
}

/* 4. 需加強 (< 60分) 柔和珊瑚紅 */
.btn-score-badge.badge-low {
    background: linear-gradient(135deg, #fff1f2, #ffe4e6);
    color: #be123c;
    border: 1.5px solid #f43f5e;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.15);
}
.btn-score-badge.badge-low i {
    color: #e11d48;
}

/* 5. 尚未練習 (無紀錄) 輕量灰 */
.btn-score-badge.badge-none {
    background: rgba(248, 250, 252, 0.88);
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
}
.btn-score-badge.badge-none i {
    color: #cbd5e1;
}

/* 當按鈕 Hover 時，徽章維持清晰 */
.section-content a.btn:hover .btn-score-badge {
    background: #ffffff;
    transform: translateY(-50%) scale(1.04);
}
.section-content a.btn:hover .btn-score-badge.badge-perfect {
    color: #166534;
    border-color: #16a34a;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}
.section-content a.btn:hover .btn-score-badge.badge-high {
    color: #15803d;
    border-color: #22c55e;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}
.section-content a.btn:hover .btn-score-badge.badge-pass {
    color: #1d4ed8;
    border-color: #3b82f6;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}
.section-content a.btn:hover .btn-score-badge.badge-low {
    color: #be123c;
    border-color: #f43f5e;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}
.section-content a.btn:hover .btn-score-badge.badge-none {
    color: #64748b;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- 英文單字三合一模式最高成績微型標籤 (Multi-Mode Vocabulary Score Badge) --- */
.btn-score-multi-badge {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    pointer-events: none;
    user-select: none;
    z-index: 5;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 當三模式全滿分時的綠邊光芒 */
.btn-score-multi-badge.badge-all-perfect {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-color: #16a34a;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.25);
}

.btn-score-multi-badge .multi-crown {
    display: inline-flex;
    align-items: center;
    color: #15803d;
    font-size: 0.9rem;
    margin-right: 2px;
    filter: drop-shadow(0 1px 2px rgba(21, 128, 61, 0.3));
    animation: crownPulse 2s infinite ease-in-out;
}

@keyframes crownPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.multi-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.2px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

/* 滿分 100分 */
.multi-chip.chip-perfect {
    background: #bbf7d0;
    color: #166534;
    border: 1px solid #86efac;
}

/* 高分 80~99分 */
.multi-chip.chip-high {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* 及格 60~79分 */
.multi-chip.chip-pass {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* 需加強 < 60分 */
.multi-chip.chip-low {
    background: #ffe4e6;
    color: #be123c;
    border: 1px solid #fecdd3;
}

/* 尚未練習 (無紀錄) */
.multi-chip.chip-none {
    background: #f1f5f9;
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
}

/* 按鈕懸停 Hover 效果 */
.section-content a.btn:hover .btn-score-multi-badge {
    background: #ffffff;
    transform: translateY(-50%) scale(1.03);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}
.section-content a.btn:hover .btn-score-multi-badge.badge-all-perfect {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-color: #16a34a;
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.3);
}

/* 英文單字按鈕排版加大與右側留白加寬 */
.section-content a.btn[href*="vocab-player.html"] {
    min-height: 104px;
    padding-right: 215px !important;
}
/* 只有單一徽章（尚未練習）時不必留那麼寬，避免「單字 10 ~ 18」被擠到換行 */
.section-content a.btn[href*="vocab-player.html"]:has(> .btn-score-badge) {
    padding-right: 150px !important;
}

/* 手機版與窄螢幕適配 */
@media (max-width: 640px) {
    .section-content a.btn,
    .section-content a.btn[href*="math/"] {
        padding-right: 110px !important;
    }
    .section-content a.btn[href*="vocab-player.html"] {
        padding-right: 185px !important;
    }
    .section-content a.btn[href*="vocab-player.html"]:has(> .btn-score-badge) {
        padding-right: 110px !important;
    }
    .btn-score-badge {
        right: 12px;
        padding: 4px 10px;
        font-size: 0.82rem;
        gap: 4px;
    }
    .btn-score-multi-badge {
        right: 10px;
        padding: 4px 6px;
        gap: 4px;
    }
    .multi-chip {
        padding: 2px 6px;
        font-size: 0.74rem;
        gap: 2px;
    }
}
@media (max-width: 440px) {
    .section-content a.btn,
    .section-content a.btn[href*="math/"] {
        padding-right: 90px !important;
    }
    .section-content a.btn[href*="vocab-player.html"] {
        padding-right: 180px !important;
    }
    .section-content a.btn[href*="vocab-player.html"]:has(> .btn-score-badge) {
        padding-right: 90px !important;
    }
    .btn-score-badge {
        right: 8px;
        padding: 3px 8px;
        font-size: 0.76rem;
    }
    .btn-score-multi-badge {
        right: 6px;
        padding: 3px 4px;
        gap: 2px;
    }
    .multi-chip {
        padding: 2px 4px;
        font-size: 0.68rem;
        gap: 1px;
    }
}

/* 互動挑戰 (G*S* 命名) - 火箭圖示、深青色 */
.section-content a.btn[href*="math/G"]::before {
    background: linear-gradient(135deg, #2c9e9e, #0e7490);
    content: "\f135";
}
.section-content a.btn[href*="math/G"]::after {
    content: "互動挑戰";
}

/* Canva 學習單 - 湖水綠系 */
.section-content a.btn[href*="canva.site"] {
    border: 1px solid rgba(44, 158, 158, 0.16);
    border-left: 8px solid #F5A130;
    background: linear-gradient(135deg, rgba(240, 253, 250, 0.9), rgba(255, 255, 255, 0.98));
    color: #2C9E9E;
    min-height: 96px;
    padding: 18px 22px;
    border-radius: 20px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 16px;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    position: relative;
    z-index: 4;
    pointer-events: auto;
    touch-action: manipulation;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 10px;
}
.section-content a.btn[href*="canva.site"]::before {
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    font-family: "Font Awesome 6 Free";
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(44, 158, 158, 0.25);
    pointer-events: none;
    content: "\f15c";
}
.section-content a.btn[href*="canva.site"]::after {
    grid-column: 2;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 700;
    margin-top: 5px;
    pointer-events: none;
    content: "Canva 學習單";
}
.section-content a.btn[href*="canva.site"]:hover {
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    border-color: #2c9e9e;
    border-left-color: #F5A130;
    box-shadow: 0 16px 30px rgba(44, 158, 158, 0.28);
    transform: translateY(-3px) scale(1.01);
}
.section-content a.btn[href*="canva.site"]:hover::before {
    background: rgba(255,255,255,0.2);
    box-shadow: none;
}
.section-content a.btn[href*="canva.site"]:hover::after {
    color: rgba(255,255,255,0.85);
}

/* Wordwall 遊戲 - 湖水綠系 */
.section-content a.btn[href*="wordwall.net"] {
    border: 1px solid rgba(44, 158, 158, 0.16);
    border-left: 8px solid #F5A130;
    background: linear-gradient(135deg, rgba(240, 253, 250, 0.9), rgba(255, 255, 255, 0.98));
    color: #2C9E9E;
    min-height: 96px;
    padding: 18px 22px;
    border-radius: 20px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 16px;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    position: relative;
    z-index: 4;
    pointer-events: auto;
    touch-action: manipulation;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 10px;
}
.section-content a.btn[href*="wordwall.net"]::before {
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    font-family: "Font Awesome 6 Free";
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(44, 158, 158, 0.25);
    pointer-events: none;
    content: "\f11b";
}
.section-content a.btn[href*="wordwall.net"]::after {
    grid-column: 2;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 700;
    margin-top: 5px;
    pointer-events: none;
    content: "Wordwall 遊戲";
}
.section-content a.btn[href*="wordwall.net"]:hover {
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    border-color: #2c9e9e;
    border-left-color: #F5A130;
    box-shadow: 0 16px 30px rgba(44, 158, 158, 0.28);
    transform: translateY(-3px) scale(1.01);
}
.section-content a.btn[href*="wordwall.net"]:hover::before {
    background: rgba(255,255,255,0.2);
    box-shadow: none;
}
.section-content a.btn[href*="wordwall.net"]:hover::after {
    color: rgba(255,255,255,0.85);
}

/* Gemini 練習 - 湖水綠系 */
.section-content a.btn[href*="gemini.google.com"] {
    border: 1px solid rgba(44, 158, 158, 0.16);
    border-left: 8px solid #F5A130;
    background: linear-gradient(135deg, rgba(240, 253, 250, 0.9), rgba(255, 255, 255, 0.98));
    color: #2C9E9E;
    min-height: 96px;
    padding: 18px 22px;
    border-radius: 20px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 16px;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    position: relative;
    z-index: 4;
    pointer-events: auto;
    touch-action: manipulation;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 10px;
}
.section-content a.btn[href*="gemini.google.com"]::before {
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    font-family: "Font Awesome 6 Free";
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(44, 158, 158, 0.25);
    pointer-events: none;
    content: "\f544";
}
.section-content a.btn[href*="gemini.google.com"]::after {
    grid-column: 2;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 700;
    margin-top: 5px;
    pointer-events: none;
    content: "Gemini";
}
.section-content a.btn[href*="gemini.google.com"]:hover {
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    border-color: #2c9e9e;
    border-left-color: #F5A130;
    box-shadow: 0 16px 30px rgba(44, 158, 158, 0.28);
    transform: translateY(-3px) scale(1.01);
}
.section-content a.btn[href*="gemini.google.com"]:hover::before {
    background: rgba(255,255,255,0.2);
    box-shadow: none;
}
.section-content a.btn[href*="gemini.google.com"]:hover::after {
    color: rgba(255,255,255,0.85);
}

/* EdCafe AI 測驗 - 湖水綠系 */
.section-content a.btn[href*="edcafe.ai"] {
    border: 1px solid rgba(44, 158, 158, 0.16);
    border-left: 8px solid #F5A130;
    background: linear-gradient(135deg, rgba(240, 253, 250, 0.9), rgba(255, 255, 255, 0.98));
    color: #2C9E9E;
    min-height: 96px;
    padding: 18px 22px;
    border-radius: 20px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 16px;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    position: relative;
    z-index: 4;
    pointer-events: auto;
    touch-action: manipulation;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 10px;
}
.section-content a.btn[href*="edcafe.ai"]::before {
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    font-family: "Font Awesome 6 Free";
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(44, 158, 158, 0.25);
    pointer-events: none;
    content: "\f19d";
}
.section-content a.btn[href*="edcafe.ai"]::after {
    grid-column: 2;
    color: #64748b;
    font-size: 0.88rem;
    font-weight: 700;
    margin-top: 5px;
    pointer-events: none;
    content: "EdCafe 測驗";
}
.section-content a.btn[href*="edcafe.ai"]:hover {
    background: linear-gradient(135deg, #2c9e9e, #3bb8b8);
    color: #ffffff;
    border-color: #2c9e9e;
    border-left-color: #F5A130;
    box-shadow: 0 16px 30px rgba(44, 158, 158, 0.28);
    transform: translateY(-3px) scale(1.01);
}
.section-content a.btn[href*="edcafe.ai"]:hover::before {
    background: rgba(255,255,255,0.2);
    box-shadow: none;
}
.section-content a.btn[href*="edcafe.ai"]:hover::after {
    color: rgba(255,255,255,0.85);
}

/* ========================================= */
/* 9. 其它樣式優化 */
/* ========================================= */

/* --- 停止更新公告優化 (Stop Update Notice Premium Flat Card) --- */
.stop-update-notice {
    transform: none !important;
    border: 2px solid #fda4af !important;
    background: #fff5f5 !important;
    color: #e11d48 !important;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.08) !important;
    border-radius: 12px !important;
}

/* --- 背景裝飾光暈樣式 --- */
.bg-blur-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    z-index: -1;
    pointer-events: none;
    animation: blobFloat 25s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #2C9E9E;
    top: 10%;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #8b5cf6;
    bottom: 10%;
    right: -150px;
    animation-delay: -5s;
}

@keyframes blobFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(80px, 50px) scale(1.15);
    }
}

/* Generalized Segmented Capsule Selector (Pills) for English, Chinese, Math & all subject portals */
.subsection-selector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    width: min(100%, 880px);
    position: relative;
    z-index: 5;
    margin: 18px auto 28px;
    padding: 4px;
    border: 1.5px solid rgba(255, 255, 255, .45);
    border-radius: 999px;
    background: #e2e8f0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
    pointer-events: auto;
    touch-action: manipulation;
}

.subsection-selector--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 560px;
}

.subsection-selector--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 720px;
}

.subsection-selector--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 880px;
}

.subsection-button {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 8px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font: inherit;
    font-size: .95rem;
    font-weight: 800;
    text-align: center;
    transition: all .25s cubic-bezier(.16, 1, .3, 1);
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(109, 40, 217, .18);
}

.subsection-button span { flex: 1; }
.subsection-button > :first-child,
.subsection-button > :last-child { display: none; }

.subsection-button:hover {
    background: rgba(255, 255, 255, 0.6);
    color: #334155;
}

/* Subject-specific active capsule pill styles */
.math-menu-page .subsection-button:hover,
.math-menu-page .subsection-button.is-active {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    box-shadow: 0 4px 14px rgba(29, 78, 216, .35);
}

.english-menu-page .subsection-button:hover,
.english-menu-page .subsection-button.is-active {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #fff;
    box-shadow: 0 4px 14px rgba(109, 40, 217, .35);
}

.chinese-menu-page .subsection-button:hover,
.chinese-menu-page .subsection-button.is-active {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    color: #fff;
    box-shadow: 0 4px 14px rgba(15, 118, 110, .35);
}

.subsection-button.is-active {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
}

.subsection-panels { display: block; width: 100%; max-width: 880px; margin: 0 auto; }
.subsection-panels .subsection-panel { display: none; width: 100%; }
.subsection-panels .subsection-panel.is-active {
    display: block;
    min-width: 0;
    margin: 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.subsection-panels .subsection-panel.is-active:hover {
    transform: none;
    box-shadow: none;
}
.subsection-panels .subsection-panel h3 { display: none; }
.subsection-panels .subsection-panel .btn-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.subsection-panels .subsection-panel .btn-group .btn {
    min-height: 112px;
    margin: 0;
}
.subsection-panels .subsection-panel .btn-group .btn:only-child {
    grid-column: 1 / -1;
    width: min(100%, 420px);
    justify-self: center;
}

@media (max-width: 680px) {
    .subsection-selector,
    .subsection-selector--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-radius: 20px;
        gap: 4px;
    }
    .subsection-panels .subsection-panel .btn-group { grid-template-columns: 1fr; }
}

/* 英文只有「單字／句型／其它」三類，手機維持同一排，不套用通用的兩欄換行規則。 */
@media (max-width: 680px) {
    .english-menu-page .subsection-selector.subsection-selector--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        border-radius: 999px;
        gap: 0;
    }

    .english-menu-page .subsection-selector {
        border-radius: 999px;
        gap: 0;
    }
}

body.chinese-menu-page .section-title,
body.english-menu-page .section-title,
body.math-menu-page .section-title {
    display: none !important;
}


.curriculum-note {
    margin: -6px 0 18px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
}

/* ========================================= */
/* 5. 頁面載入流暢度與轉場微動畫 (Page Transitions & Load Smoothness) */
/* ========================================= */

/* A. 載入穩定 (Page Loading Shell) */
.hero-section,
.cards-container,
#semester1-area,
#semester2-area,
#floating-toggle,
.breadcrumb-container {
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

body.loaded .hero-section,
body.loaded .cards-container,
body.loaded #semester1-area,
body.loaded #semester2-area,
body.loaded #floating-toggle,
body.loaded .breadcrumb-container {
    opacity: 1;
}

/* =========================================
   Home dashboard refresh — soft learning landscape
   ========================================= */
body.portal-page {
    --home-teal: #00a79d;
    --home-teal-dark: #008f89;
    --home-ink: #123754;
    --home-card-bg: rgba(255,255,255,.94);
    --home-card-border: rgba(195,235,232,.8);
    --home-shadow: 0 10px 30px rgba(10,120,118,.10);
    background:
        radial-gradient(circle at 0% 9%, rgba(155, 232, 223, .28) 0 10rem, transparent 10.1rem),
        radial-gradient(circle at 101% 90%, rgba(163, 230, 221, .32) 0 14rem, transparent 14.1rem),
        radial-gradient(circle at 50% 50%, rgba(240, 255, 253, .6) 0%, transparent 70%),
        linear-gradient(180deg, #f5feff 0%, #edfbfa 60%, #eafcf8 100%);
    color: var(--home-ink);
    padding: 78px 0 90px;
    overflow-x: hidden;
}

body.portal-page::before,
body.portal-page::after {
    content: "";
    position: fixed;
    pointer-events: none;
    z-index: -1;
}

body.portal-page::before {
    width: 15rem;
    height: 7rem;
    bottom: 0;
    left: -1rem;
    border-radius: 55% 55% 0 0;
    background: radial-gradient(ellipse at 18% 100%, #82d5c6 0 7%, transparent 7.5%), radial-gradient(ellipse at 40% 100%, #a9e6d9 0 13%, transparent 13.5%), radial-gradient(ellipse at 72% 100%, #72cdbd 0 9%, transparent 9.5%);
    opacity: .7;
}

body.portal-page::after {
    right: 1.4rem;
    top: 17rem;
    width: 4.8rem;
    height: 5.8rem;
    opacity: .35;
    background-image: radial-gradient(circle, #7ccfc8 2px, transparent 3px);
    background-size: 18px 18px;
}

body.portal-page .navbar {
    height: 78px;
    padding: 0 clamp(20px, 4.5vw, 72px);
    background: linear-gradient(105deg, #009d96 0%, #00b5ae 52%, #00a9a3 100%);
    border: 0;
    box-shadow: 0 4px 20px rgba(0, 110, 106, .22);
}

body.portal-page .navbar .logo {
    font-size: clamp(1.45rem, 2.1vw, 2rem);
    color: #fff;
    background: none;
    -webkit-text-fill-color: #fff;
    letter-spacing: 1px;
}

body.portal-page #navbar-logo-img {
    height: 50px !important;
    width: 50px !important;
    padding: 3px;
    background: #fff;
    border-radius: 13px !important;
    box-shadow: 0 4px 10px rgba(0,80,78,.2);
}

body.portal-page .nav-links { gap: 28px; margin-right: 20px; }
body.portal-page .nav-links a { padding: 8px 9px; font-size: 1rem; border-radius: 12px; }
body.portal-page .nav-links a:hover { background: rgba(255, 255, 255, .15); transform: translateY(-1px); }

body.portal-page #nav-identity {
    background: #fff;
    border: 0;
    color: var(--home-teal-dark);
    min-width: 120px;
    justify-content: center;
    padding: 10px 18px;
    box-shadow: 0 6px 15px rgba(0, 95, 92, .16);
}

body.portal-page .dashboard {
    display: block;
    min-height: 0;
    padding: 0;
}

body.portal-page .hero-section {
    background: transparent;
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
}
/* Subject card color themes */
body.portal-page .bg-chinese { background: linear-gradient(145deg, #fffcfc, #fff2f2); border-color: rgba(255,186,186,.6); }
body.portal-page .bg-math { background: linear-gradient(145deg, #f8fdff, #ecf9ff); border-color: rgba(170,224,255,.6); }
body.portal-page .bg-english { background: linear-gradient(145deg, #fdfaff, #f4eeff); border-color: rgba(214,192,255,.6); }
body.portal-page .bg-social { background: linear-gradient(145deg, #fffef8, #fff8e4); border-color: rgba(252,214,130,.6); }

body.portal-page .subject-selection-section { max-width: 1000px; margin: 8px auto 0; padding: 0 32px 36px; }
body.portal-page .section-title-wrapper { display: flex; align-items: center; gap: 16px; margin: 0 0 20px; }
body.portal-page .section-title-wrapper::before,
body.portal-page .section-title-wrapper::after { content: ""; height: 2px; flex: 1; border-top: 2px dashed rgba(160,220,214,.7); }
body.portal-page .section-title {
    order: 1;
    padding: 0;
    margin: 0;
    color: var(--home-ink);
    font-size: clamp(1.65rem, 2.5vw, 2.3rem);
    text-shadow: none;
    letter-spacing: .07em;
    white-space: nowrap;
    animation: none;
}
body.portal-page .section-title-wrapper::before { order: 0; }
body.portal-page .section-title-wrapper::after { order: 2; }
body.portal-page .section-title i { color: #04a09a; margin-right: 12px; }
body.portal-page .cards-container-three {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 420px));
    gap: 20px;
    justify-content: center;
    margin: 0 auto;
}
body.portal-page .grade-card {
    min-height: 0;
    background: rgba(255, 255, 255, .93);
    border: 1.5px solid rgba(210, 240, 237, .9);
    border-radius: 24px;
    box-shadow: 0 6px 24px rgba(22, 100, 108, .10), 0 2px 6px rgba(0,0,0,.04);
    transition: all .3s cubic-bezier(.16,1,.3,1);
}
body.portal-page .grade-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 36px rgba(22, 100, 108, .16);
    border-color: rgba(0, 175, 168, .35);
}
body.portal-page .card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px 12px;
    color: #007d78;
    background: transparent;
    text-align: left;
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(200,238,234,.5);
}
body.portal-page .grade-label {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 5px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #01aea4 0%, #009890 100%);
    color: #fff;
    font-weight: 900;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(0, 149, 141, .22), inset 0 1px 0 rgba(255,255,255,.25);
    letter-spacing: .04em;
}
body.portal-page .card-header small { display: inline; margin: 0; font-size: .9rem; color: #30a49d; opacity: 1; font-weight: 700; letter-spacing: .03em; }
body.portal-page .card-body { padding: 10px 10px 14px; gap: 8px; justify-content: center; }
body.portal-page .subject-btn { aspect-ratio: 1 / 1; min-height: 0; max-width: 120px; flex: 0 1 calc(33.33% - 6px); padding: 8px; gap: 6px; border-radius: 14px; font-size: 1rem; font-weight: 800; align-items: center; justify-content: center; text-align: center; transition: all .25s cubic-bezier(.34,1.56,.64,1); }
body.portal-page .subject-btn:hover { transform: translateY(-3px) scale(1.04); }
body.portal-page .subject-btn i { font-size: 1.65rem; }
body.portal-page .subject-btn.locked { background: rgba(237,241,245,.7); border-color: #dce4ec; color: #9aa7b8; cursor: not-allowed; }
body.portal-page .subject-btn.locked i { color: #b0bcc9; }
body.portal-page .subject-btn.locked:hover { transform: none; }

/* 其它卡片：按鈕尺寸與年級卡片一致（沿用 .subject-btn 規則） */
body.portal-page #main-view.practice-started .hero-section { display: none; }
body.portal-page #main-view.practice-started .subject-selection-section {
    display: block;
    padding-top: clamp(28px, 6vh, 70px);
    animation: practiceMenuIn .35s ease-out both;
}

@keyframes practiceMenuIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

body.portal-page .sticky-footer {
    position: relative;
    min-height: 58px;
    margin-top: 4px;
    background: rgba(255, 255, 255, .82);
    border: 0;
    border-top: 1px solid rgba(190,232,228,.5);
    backdrop-filter: blur(10px);
    color: #7a90a3;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 20px !important;
}

body.portal-page .footer-left,
body.portal-page .footer-center,
body.portal-page .footer-right {
    flex: 1 1 0% !important;
    min-width: 0 !important;
}

body.portal-page .footer-left {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
}

body.portal-page .footer-center {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    color: #7a90a3 !important;
}

body.portal-page .footer-right {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 10px !important;
}

body.portal-page .footer-left .countdown-wrapper { border-radius: 999px; padding: 9px 18px; box-shadow: 0 4px 12px rgba(35, 83, 94, .12); }
body.portal-page .footer-btn { border-radius: 999px; padding: 9px 22px; color: #008f89; border-color: #b2e7df; }

@media (max-width: 768px) {

    body.portal-page .subject-selection-section { padding: 0 14px 22px; }
    body.portal-page .section-title-wrapper { gap: 8px; }
    body.portal-page .section-title { white-space: normal; font-size: 1.28rem; }
    body.portal-page .section-title i { margin-right: 6px; }
    body.portal-page .cards-container-three { grid-template-columns: 1fr; max-width: 480px; gap: 14px; justify-content: center; }
    body.portal-page .grade-card { min-height: 0; border-radius: 20px; }
    body.portal-page .card-header { padding: 14px 16px 10px; gap: 10px; border-bottom-color: rgba(200,238,234,.4); }
    body.portal-page .grade-label { min-height: 32px; padding: 4px 12px; font-size: 1.05rem; }
    body.portal-page .card-body { padding: 8px 8px 12px; gap: 7px; }
    body.portal-page .subject-btn { font-size: 0.95rem; border-radius: 12px; }
    body.portal-page .subject-btn i { font-size: 1.5rem; }
}


/* B. 選單與標題 fade-out 狀態 (進入單元時) */
.button-container,
.section-title,
#floating-toggle {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s cubic-bezier(0.25, 1, 0.5, 1), transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

body.menu-leaving .button-container,
body.menu-leaving .section-title,
body.menu-leaving #floating-toggle {
    opacity: 0 !important;
    transform: translateY(-12px) !important;
    pointer-events: none;
}

/* C. 選單 fade-in 狀態 (回到選單時) */
.menu-fade-in-prepare {
    opacity: 0 !important;
    transform: translateY(-12px) !important;
    transition: none !important;
}

.menu-fade-in-active {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* D. 單元內容切換與滑動動畫 (.section-content) */
.section-content {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s cubic-bezier(0.25, 1, 0.5, 1), transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

/* 準備淡入：初始隱藏並稍微往下偏 */
.section-content.fade-in-prepare {
    display: flex !important; /* 確保在 display: flex 狀態下做動畫 */
    opacity: 0 !important;
    transform: translateY(15px) !important;
    transition: none !important;
}

/* 淡入中 */
.section-content.fade-in-active {
    display: flex !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* 淡出中 */
.section-content.fade-out-active {
    opacity: 0 !important;
    transform: translateY(15px) !important;
    transition: opacity 0.2s cubic-bezier(0.25, 1, 0.5, 1), transform 0.2s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* Keep the home greeting on one line from tablets down to small phones. */
@media (max-width: 1024px) {
    body.portal-page .greeting-header h1 {
        max-width: 100% !important;
        white-space: nowrap !important;
        font-size: clamp(.88rem, 4vw, 2.25rem) !important;
        letter-spacing: 0 !important;
    }

    body.portal-page .grade-card { min-height: 0; }
    body.portal-page .card-header { padding: 12px 18px 8px; }
    body.portal-page .grade-label { font-size: 1.3rem; }
    body.portal-page .card-header small { font-size: 1rem; }
    body.portal-page .card-body { padding: 8px 10px 12px; gap: 8px; }
    body.portal-page .subject-btn { font-size: 1.05rem; }
    body.portal-page .subject-btn i { font-size: 1.65rem; }
}

/* Desktop footer stays attached to the viewport and does not reserve a tall blank band. */
@media (min-width: 769px) {
    body.portal-page { padding-bottom: 48px; }

    body.portal-page .sticky-footer {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1001;
        height: 48px;
        min-height: 48px;
        margin: 0;
        padding: 0 16px;
    }

    body.portal-page .footer-left .countdown-wrapper { padding: 5px 12px; }
    body.portal-page .footer-btn { padding: 5px 14px; }
}

/* Shared site navigation: modern translucent frosted glass design */
.navbar,
body.portal-page .navbar {
    height: 68px;
    padding: 0 clamp(16px, 3.5vw, 44px);
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.85) !important;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04) !important;
}

.navbar .logo,
body.portal-page .navbar .logo {
    gap: 10px !important;
    padding: 0;
    color: #0f172a !important;
    -webkit-text-fill-color: initial !important;
    background: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Chiron GoRound TC", "Noto Sans TC", sans-serif !important;
    font-size: clamp(1.35rem, 2vw, 1.6rem);
    font-weight: 800 !important;
    letter-spacing: -0.3px;
    filter: none !important;
}

.navbar #navbar-logo-img,
body.portal-page #navbar-logo-img {
    width: 38px !important;
    height: 38px !important;
    padding: 2px;
    background: #ffffff;
    border: 1.5px solid rgba(44, 158, 158, 0.3);
    border-radius: 11px !important;
    box-shadow: 0 2px 8px rgba(44, 158, 158, 0.15);
}

.navbar .logo-subtitle {
    margin-left: 14px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(44, 158, 158, 0.09);
    color: #0d9488;
    border: 1px solid rgba(44, 158, 158, 0.18);
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.navbar .nav-links a {
    color: #334155;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all .18s ease;
}

.navbar .nav-links a:hover {
    background: rgba(44, 158, 158, 0.08);
    color: #0d9488;
    transform: translateY(-1px);
    border-color: transparent;
    box-shadow: none;
}

.navbar .nav-links a.active {
    background: rgba(44, 158, 158, 0.12);
    color: #0f766e;
    font-weight: 700;
    border-color: transparent;
    box-shadow: none;
}

.navbar .dropdown:hover .dropbtn i {
    transform: rotate(180deg);
}

.navbar .dropbtn i {
    transition: transform .2s ease;
    margin-left: 4px;
    font-size: 0.75rem;
    color: #94a3b8;
}

.navbar .dropdown:hover .dropbtn i {
    color: #0d9488;
}

.navbar .dropdown-content {
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.02);
    border-radius: 14px;
    padding: 6px;
}

.navbar .dropdown-content a {
    color: #334155 !important;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 14px;
    margin: 2px 0;
    border-radius: 8px;
    transition: all .15s ease;
}

.navbar .dropdown-content a:hover {
    background-color: #f0fdfa;
    color: #0d9488 !important;
    transform: translateX(2px);
}

.navbar #nav-identity {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.navbar #nav-identity:hover {
    background: #f0fdfa;
    border-color: #2C9E9E;
    color: #0f766e;
    box-shadow: 0 4px 12px rgba(44, 158, 158, 0.2);
    transform: translateY(-1px);
}

.navbar #nav-identity.is-guest-login {
    background: #ffffff !important;
    border: 1.5px solid #dadce0 !important;
    color: #3c4043 !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.12) !important;
}

.navbar #nav-identity.is-guest-login:hover {
    background: #f8fafd !important;
    border-color: #4285f4 !important;
    color: #1a73e8 !important;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.25) !important;
    transform: translateY(-1px);
}

.navbar #nav-identity.is-admin {
    background: #fffbeb !important;
    border: 1.5px solid #fde68a !important;
    color: #b45309 !important;
    font-weight: 800 !important;
}

.navbar #nav-identity.is-admin:hover {
    background: #fef3c7 !important;
    border-color: #f59e0b !important;
    color: #92400e !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2) !important;
}

.navbar .menu-toggle {
    color: #334155;
    font-size: 20px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    display: none;
    align-items: center;
    justify-content: center;
    text-shadow: none;
    cursor: pointer;
    transition: all .15s ease;
}

.navbar .menu-toggle:hover {
    background: #e2e8f0;
    color: #0f172a;
}

@media (max-width: 640px) {
    .navbar,
    body.portal-page .navbar { height: 64px; padding: 0 16px; }

    .navbar .logo,
    body.portal-page .navbar .logo { font-size: 1.35rem; }

    .navbar #navbar-logo-img,
    body.portal-page #navbar-logo-img { width: 34px !important; height: 34px !important; }
    .navbar .logo-subtitle { display: none; }
}

/* ===========================================================
   Adventure dashboard — unified refresh (desktop + mobile)
   =========================================================== */
body.portal-page {
    --adventure-teal: #08aaa4;
    --adventure-ink: #123858;
    --adventure-gold: #f4b63d;
    background: linear-gradient(170deg, #e6fbff 0%, #f6feff 35%, #eafbf8 70%, #e2f8f3 100%);
}

/* Left column: content stacked on the left, right panel on the right (approx 2:1 ratio / right panel ~1/3) */
body.portal-page .homepage-split-layout {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr);
    gap: 20px;
    padding: 20px 24px 24px;
    align-items: stretch !important;
    justify-content: center;
    transform: none;
    box-sizing: border-box;
}

body.portal-page .split-left-column {
    position: relative !important;   /* override global sticky on .split-left-column */
    top: auto !important;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid rgba(185, 230, 224, 0.85);
    border-radius: 24px;
    padding: 18px 20px;
    box-shadow: 0 10px 30px rgba(16, 110, 110, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(12px);
    margin-top: 0;
    box-sizing: border-box;
    align-self: stretch;
    min-height: 0;
}

body.portal-page .split-right-column {
    position: relative !important;
    top: auto !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid rgba(185, 230, 224, 0.85);
    border-radius: 24px;
    padding: 18px 18px;
    box-shadow: 0 10px 30px rgba(16, 110, 110, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(12px);
    margin-top: 0;
    box-sizing: border-box;
    align-self: stretch;
    min-height: 0;
}

body.portal-page .panel-title-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--adventure-ink);
}

body.portal-page .panel-title-badge a {
    font-size: 0.76rem;
    color: #0d9488;
    background: rgba(204, 251, 241, 0.6);
    border: 1px solid rgba(153, 246, 228, 0.8);
    border-radius: 99px;
    padding: 3px 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    transition: all 0.2s ease;
    white-space: nowrap;
}

body.portal-page .panel-title-badge a:hover {
    background: rgba(204, 251, 241, 1);
    transform: translateY(-1px);
}

body.portal-page .subject-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

body.portal-page .subject-stat-card {
    min-width: 0;
    width: 100%;
    border-radius: 14px;
    padding: 10px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.22s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
}

body.portal-page .subject-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

body.portal-page .subject-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: #ffffff;
    flex-shrink: 0;
}

body.portal-page .subject-stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

body.portal-page .subject-stat-name {
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

body.portal-page .subject-stat-val {
    font-size: 1.2rem;
    font-weight: 900;
    margin-top: 2px;
    line-height: 1;
    white-space: nowrap;
}

body.portal-page .hero-stats-footer-strip {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 8px;
    padding: 9px 12px;
    background: linear-gradient(135deg, rgba(240, 253, 250, 0.9), rgba(230, 251, 246, 0.75));
    border: 1px solid rgba(175, 230, 222, 0.75);
    border-radius: 14px;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.8), 0 2px 8px rgba(16, 110, 110, 0.04);
    box-sizing: border-box;
    margin-top: auto;
}

body.portal-page .footer-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.portal-page .footer-stat-icon {
    font-size: 1.15rem;
    line-height: 1;
}

body.portal-page .footer-stat-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

body.portal-page .footer-stat-lbl {
    font-size: 0.72rem;
    color: #476882;
    font-weight: 700;
}

body.portal-page .footer-stat-val {
    font-size: 0.96rem;
    color: var(--adventure-ink);
    font-weight: 900;
}

body.portal-page .footer-stat-divider {
    width: 1px;
    height: 24px;
    background: rgba(175, 230, 222, 0.8);
}

/* 英雄卡片右半邊：緊湊排版 */
body.portal-page .hero-content-side {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: space-between;
}

body.portal-page .adventure-mascot {
    display: none !important;
}

/* Header Sections inside Left & Right Cards — EXACT EQUAL Y-POSITION & DIVIDER LINE */
body.portal-page .greeting-header,
body.portal-page .panel-title-badge {
    min-height: 44px;
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 2px dashed rgba(170, 225, 220, 0.65);
    box-sizing: border-box;
}

body.portal-page .greeting-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

body.portal-page .greeting-icon { font-size: 2.2rem; display: none; }
body.portal-page .greeting-header h1 {
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    color: var(--adventure-ink);
    margin: 0;
    font-weight: 900;
    letter-spacing: .03em;
    line-height: 1.25;
}

body.portal-page .greeting-header h1::after {
    content: none;
    display: none;
}

/* =========================================
   步步夥伴圖鑑：完整角色扭蛋收藏
   ========================================= */
body.portal-page .companion-level-line {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 5px;
    color: #456382;
    font-size: .83rem;
    font-weight: 800;
}
body.portal-page .companion-level-line strong {
    color: var(--adventure-ink);
    font-size: 1.08rem;
    font-weight: 950;
}
body.portal-page .level-progress {
    color: #7890a3;
    font-size: .72rem;
    font-weight: 800;
}
body.portal-page .energy-line {
    color: #8b6418;
}
body.portal-page .energy-line strong {
    color: #a87516;
}
body.portal-page .companion-profile.is-gacha-ready {
    border-color: rgba(241, 178, 49, .86);
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, .9), 0 0 0 3px rgba(255, 218, 112, .2), 0 8px 24px rgba(218, 153, 24, .15);
    animation: gacha-card-glow 2.2s ease-in-out infinite;
}
body.portal-page .companion-character-button {
    position: relative;
    isolation: isolate;
}
body.portal-page .companion-character-button {
    touch-action: manipulation;
}
body.portal-page .companion-character-img {
    pointer-events: none;
    -webkit-user-drag: none;
}
body.portal-page .companion-character-button.is-gacha-ready::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 22px 10px 10px;
    border: 2px solid rgba(240, 174, 42, .7);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 239, 174, .72), rgba(255, 255, 255, 0) 68%);
    animation: gacha-ready-ring 1.7s ease-out infinite;
    pointer-events: none !important;
}
body.portal-page .companion-character-button.is-gacha-ready::after {
    content: "🪙";
    position: absolute;
    z-index: 3;
    top: 0px;
    right: 0px;
    font-size: 26px;
    filter: drop-shadow(0 3px 4px rgba(151, 98, 8, .24));
    animation: gacha-ready-coin 1.15s ease-in-out infinite;
    pointer-events: none !important;
}
body.portal-page .companion-character-button.is-gacha-ready .companion-character-img {
    animation: gacha-ready-bounce 1.35s cubic-bezier(.34, 1.56, .64, 1) infinite;
}
body.portal-page .companion-shop-hint.is-gacha-ready {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 9px;
    border-radius: 99px;
    color: #8a5a0b;
    background: #fff1bb;
    box-shadow: 0 0 0 0 rgba(240, 174, 42, .28);
    animation: gacha-ready-hint 1.8s ease-in-out infinite;
}
@keyframes gacha-card-glow {
    0%, 100% { box-shadow: inset 0 1px 3px rgba(255, 255, 255, .9), 0 0 0 3px rgba(255, 218, 112, .15), 0 8px 20px rgba(218, 153, 24, .11); }
    50% { box-shadow: inset 0 1px 3px rgba(255, 255, 255, .9), 0 0 0 5px rgba(255, 218, 112, .28), 0 10px 29px rgba(218, 153, 24, .22); }
}
@keyframes gacha-ready-ring {
    0% { opacity: .75; transform: scale(.82); }
    72%, 100% { opacity: 0; transform: scale(1.17); }
}
@keyframes gacha-ready-coin {
    0%, 100% { transform: translateY(0) rotate(-8deg) scale(1); }
    50% { transform: translateY(-8px) rotate(10deg) scale(1.1); }
}
@keyframes gacha-ready-bounce {
    0%, 100% { transform: translateY(0) rotate(0); }
    38% { transform: translateY(-6px) rotate(-2deg); }
    64% { transform: translateY(-2px) rotate(2deg); }
}
@keyframes gacha-ready-hint {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240, 174, 42, .28); }
    50% { box-shadow: 0 0 0 6px rgba(240, 174, 42, 0); }
}

.companion-center-content {
    width: min(1000px, 100%);
}
.companion-center-content [hidden] {
    display: none !important;
}
.starter-choice-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}
.starter-choice-card {
    position: relative;
    min-width: 0;
    min-height: 215px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 9px 7px 12px;
    border: 1.5px solid #d9e8eb;
    border-radius: 17px;
    background: #fff;
    color: #253b54;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.starter-choice-card:hover {
    border-color: #64c7c0;
    box-shadow: 0 8px 18px rgba(7, 143, 146, .14);
    transform: translateY(-3px);
}
.starter-choice-card:focus-visible,
.collection-card:focus-visible,
.gacha-spin-button:focus-visible {
    outline: 3px solid #f4b63d;
    outline-offset: 2px;
}
.starter-choice-card.is-selected {
    border: 2px solid #159f9a;
    background: linear-gradient(180deg, #effdfb, #fffdf6);
    box-shadow: 0 7px 18px rgba(21, 159, 154, .16);
}
.starter-choice-image-wrap {
    width: 100%;
    height: 145px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 2px;
}
.starter-choice-image-wrap img {
    width: 100%;
    height: 145px;
    object-fit: contain;
    filter: drop-shadow(0 5px 7px rgba(17, 88, 100, .14));
    transition: transform .2s ease;
}
.starter-choice-card:hover .starter-choice-image-wrap img {
    transform: scale(1.04);
}
.starter-choice-card strong {
    color: #123858;
    font-size: 13px;
    font-weight: 950;
}
.starter-choice-card > span:not(.starter-choice-image-wrap) {
    margin-top: 3px;
    color: #6b8194;
    font-size: 10px;
    font-weight: 800;
}
.starter-choice-card em {
    margin-top: 7px;
    padding: 4px 8px;
    border-radius: 99px;
    color: #078f92;
    background: #e6faf7;
    font-size: 10px;
    font-style: normal;
    font-weight: 950;
}
.starter-choice-card.is-selected em {
    color: #fff;
    background: #159f9a;
}

.collection-showcase {
    display: grid;
    grid-template-columns: minmax(210px, .82fr) minmax(0, 1.18fr);
    align-items: center;
    gap: 18px;
}
.collection-preview-stage {
    position: relative;
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #d7eeee;
    border-radius: 22px;
    background:
        radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .96), rgba(220, 250, 246, .88) 52%, rgba(255, 244, 205, .78)),
        #effcfb;
}
.collection-preview-stage::after {
    content: "";
    position: absolute;
    left: 14%;
    right: 14%;
    bottom: 19px;
    height: 16px;
    border-radius: 50%;
    background: rgba(26, 121, 132, .16);
    filter: blur(5px);
}
.collection-preview-character {
    position: relative;
    z-index: 1;
    width: min(190px, 82%);
    height: 210px;
    object-fit: contain;
    filter: drop-shadow(0 9px 11px rgba(17, 88, 100, .18));
    animation: companion-float 3.8s ease-in-out infinite;
}
.collection-preview-character.collection-silhouette {
    filter: brightness(0) drop-shadow(0 9px 11px rgba(17, 45, 56, .18));
    opacity: .28;
}
.collection-preview-glow {
    position: absolute;
    z-index: 0;
    width: 145px;
    height: 145px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .55);
    box-shadow: 0 0 36px rgba(87, 210, 197, .4);
}
@keyframes companion-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
.collection-preview-stage .rarity-badge {
    position: absolute;
    z-index: 2;
    top: 13px;
    left: 13px;
}
.rarity-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 5px 9px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .08em;
}
.rarity-badge.rarity-N,
.rarity-inline.rarity-N {
    color: #587187;
    background: #edf3f6;
}
.rarity-badge.rarity-R,
.rarity-inline.rarity-R {
    color: #067f88;
    background: #dff8f4;
}
.rarity-badge.rarity-SR,
.rarity-inline.rarity-SR {
    color: #9a6611;
    background: linear-gradient(135deg, #fff1ad, #ffe0a2);
}
.collection-preview-copy {
    min-width: 0;
    padding: 5px 4px;
}
.collection-preview-kicker {
    color: #078f92;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .08em;
}
.collection-preview-copy h3 {
    margin: 5px 0 5px;
    color: #123858;
    font-size: 28px;
    font-weight: 950;
    letter-spacing: .05em;
}
.collection-preview-copy p {
    margin: 0;
    color: #6b8194;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.65;
}
.gacha-spin-button {
    width: 100%;
    margin-top: 17px;
    padding: 12px 16px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, #0a9c9c, #1bb9a8);
    box-shadow: 0 7px 14px rgba(10, 156, 156, .2);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 950;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.gacha-spin-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 18px rgba(10, 156, 156, .28);
}
.gacha-spin-button:disabled {
    cursor: not-allowed;
    opacity: .55;
    box-shadow: none;
}
.gacha-spin-button.is-ready {
    position: relative;
    overflow: hidden;
    animation: gacha-button-ready 1.75s ease-in-out infinite;
}
.gacha-spin-button.is-ready::after {
    content: "";
    position: absolute;
    top: -40%;
    bottom: -40%;
    left: -28%;
    width: 20%;
    background: rgba(255, 255, 255, .58);
    transform: rotate(18deg);
    animation: gacha-button-shine 2.1s ease-in-out infinite;
}
@keyframes gacha-button-ready {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-1px) scale(1.012); }
}
@keyframes gacha-button-shine {
    0%, 24% { left: -28%; opacity: 0; }
    38% { opacity: 1; }
    68%, 100% { left: 118%; opacity: 0; }
}
.gacha-spin-hint {
    margin-top: 8px !important;
    color: #9a6b18 !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-align: center;
}
.gacha-result-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 13px;
    padding: 10px 13px;
    border: 1px solid #f1d58b;
    border-radius: 14px;
    background: linear-gradient(135deg, #fff9e1, #fffdf6);
}
.gacha-result-burst {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    color: #fff;
    background: #f0af31;
    font-size: 13px;
    font-weight: 950;
    transform: rotate(-8deg);
}
.gacha-result-panel strong {
    color: #8b6418;
    font-size: 13px;
    font-weight: 950;
}
.gacha-result-panel p {
    margin: 2px 0 0;
    color: #806c47;
    font-size: 11px;
    font-weight: 700;
}

/* 全畫面扭蛋演出 */
body.gacha-animation-open {
    overflow: hidden;
}
.gacha-animation-modal[hidden],
.gacha-animation-modal [hidden] {
    display: none !important;
}
.gacha-animation-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 18px;
    overflow: auto;
    background:
        radial-gradient(circle at 50% 24%, rgba(47, 215, 204, .22), transparent 34%),
        rgba(10, 25, 43, .84);
    backdrop-filter: blur(11px);
    -webkit-backdrop-filter: blur(11px);
    opacity: 0;
    transition: opacity .18s ease;
}
.gacha-animation-modal.is-active {
    opacity: 1;
}
.gacha-animation-card {
    position: relative;
    width: min(510px, 100%);
    min-height: 570px;
    box-sizing: border-box;
    padding: 24px 24px 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 30px;
    background:
        radial-gradient(circle at 18% 8%, rgba(255, 231, 147, .7), transparent 25%),
        linear-gradient(160deg, #f8fffe 0%, #e9fbf8 54%, #fff7dd 100%);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .38);
    text-align: center;
    transform: translateY(14px) scale(.98);
    transition: transform .3s cubic-bezier(.16, 1, .3, 1);
}
.gacha-animation-modal.is-active .gacha-animation-card {
    transform: translateY(0) scale(1);
}
.gacha-animation-close {
    position: absolute;
    z-index: 8;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    color: #36536a;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 4px 14px rgba(18, 56, 88, .12);
    cursor: pointer;
    font: inherit;
    font-size: 18px;
    font-weight: 900;
}
.gacha-animation-close:focus-visible,
.gacha-reveal-confirm:focus-visible {
    outline: 3px solid #f4b63d;
    outline-offset: 3px;
}
.gacha-animation-copy {
    position: relative;
    z-index: 2;
}
.gacha-animation-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 99px;
    color: #8a5a0b;
    background: #fff0b8;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .05em;
}
.gacha-animation-copy h2 {
    margin: 10px 0 4px;
    color: #123858;
    font-size: 25px;
    font-weight: 950;
}
.gacha-animation-copy p {
    min-height: 22px;
    margin: 0;
    color: #5f768a;
    font-size: 13px;
    font-weight: 750;
}
.gacha-animation-scene {
    position: relative;
    width: 100%;
    height: 425px;
    margin-top: 8px;
}
.gacha-machine {
    position: absolute;
    left: 50%;
    top: 10px;
    width: 252px;
    height: 370px;
    transform: translateX(-50%);
    transform-origin: 50% 84%;
}
.gacha-machine-dome {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 19px;
    width: 214px;
    height: 190px;
    overflow: hidden;
    border: 9px solid #fff;
    border-bottom-width: 15px;
    border-radius: 50% 50% 43% 43%;
    background:
        linear-gradient(135deg, rgba(255,255,255,.72), transparent 35%),
        rgba(122, 230, 222, .48);
    box-shadow:
        inset 0 -18px 28px rgba(20, 130, 144, .18),
        0 10px 24px rgba(18, 56, 88, .16);
}
.gacha-machine-dome::after {
    content: "";
    position: absolute;
    inset: 10px auto auto 26px;
    width: 38px;
    height: 82px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .45);
    transform: rotate(28deg);
}
.gacha-ball {
    position: absolute;
    width: 58px;
    height: 58px;
    border: 5px solid rgba(255,255,255,.9);
    border-radius: 50%;
    box-shadow: inset 0 -8px 11px rgba(18, 56, 88, .14), 0 5px 10px rgba(18, 56, 88, .12);
}
.gacha-ball::after {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: 23px;
    height: 5px;
    background: rgba(255,255,255,.9);
}
.gacha-ball.ball-1 { left: 18px; bottom: 12px; background: #ffcf57; transform: rotate(14deg); }
.gacha-ball.ball-2 { left: 72px; bottom: 2px; background: #43cbbf; transform: rotate(-22deg); }
.gacha-ball.ball-3 { right: 12px; bottom: 18px; background: #ff8790; transform: rotate(28deg); }
.gacha-ball.ball-4 { left: 40px; bottom: 64px; background: #8ca8ff; transform: rotate(-8deg); }
.gacha-ball.ball-5 { right: 48px; bottom: 67px; background: #f3a7ed; transform: rotate(12deg); }
.gacha-ball.ball-6 { left: 82px; bottom: 96px; background: #9adf78; transform: rotate(-30deg); }
.gacha-machine-body {
    position: absolute;
    z-index: 1;
    left: 8px;
    bottom: 8px;
    width: 236px;
    height: 205px;
    border: 8px solid #fff;
    border-radius: 38px 38px 28px 28px;
    background: linear-gradient(145deg, #18aaa4, #087f8c);
    box-shadow: inset 0 -13px 0 rgba(4, 91, 103, .3), 0 14px 24px rgba(18, 56, 88, .24);
}
.gacha-machine-body::after {
    content: "";
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: -20px;
    height: 28px;
    border-radius: 10px 10px 18px 18px;
    background: #ffca45;
    box-shadow: inset 0 -7px 0 #d99517;
}
.gacha-coin-slot {
    position: absolute;
    top: 30px;
    left: 31px;
    width: 51px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 5px solid #fff3bd;
    border-radius: 10px;
    color: #fff;
    background: #173c58;
    font-size: 12px;
    font-weight: 950;
}
.gacha-coin-slot::before {
    content: "🪙";
    position: absolute;
    top: -28px;
    font-size: 22px;
}
.gacha-machine-window {
    position: absolute;
    left: 68px;
    bottom: 24px;
    width: 92px;
    height: 57px;
    border: 7px solid #fff;
    border-radius: 15px 15px 26px 26px;
    background: #10334c;
    box-shadow: inset 0 8px 12px rgba(0,0,0,.22);
}
.gacha-machine-knob {
    position: absolute;
    top: 25px;
    right: 30px;
    width: 67px;
    height: 67px;
    border: 8px solid #fff;
    border-radius: 50%;
    background: #ffc947;
    box-shadow: inset 0 -8px 0 #db951f, 0 4px 10px rgba(18,56,88,.2);
}
.gacha-machine-knob::after {
    content: "";
    position: absolute;
    left: 25px;
    top: 8px;
    width: 15px;
    height: 48px;
    border-radius: 99px;
    background: #fff7d1;
}
.gacha-machine-chute {
    position: absolute;
    left: 78px;
    bottom: -12px;
    width: 72px;
    height: 28px;
    border-radius: 0 0 20px 20px;
    background: #092f48;
}
.gacha-capsule {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: 4px;
    width: 86px;
    height: 86px;
    opacity: 0;
    transform: translate(-50%, -188px) scale(.55) rotate(-18deg);
}
.gacha-capsule-top,
.gacha-capsule-bottom {
    position: absolute;
    left: 0;
    width: 86px;
    height: 45px;
    box-sizing: border-box;
    border: 5px solid #fff;
    box-shadow: inset 0 -7px 10px rgba(18,56,88,.12), 0 5px 12px rgba(18,56,88,.18);
}
.gacha-capsule-top {
    top: 0;
    border-radius: 50px 50px 9px 9px;
    background: #ffcb4e;
}
.gacha-capsule-bottom {
    bottom: 0;
    border-radius: 9px 9px 50px 50px;
    background: #24b9b2;
}
.gacha-capsule-shine {
    position: absolute;
    z-index: 2;
    top: 12px;
    left: 18px;
    width: 16px;
    height: 25px;
    border-radius: 50%;
    background: rgba(255,255,255,.65);
    transform: rotate(27deg);
}
.gacha-animation-modal.is-spinning .gacha-machine {
    animation: gacha-machine-shake .22s ease-in-out infinite;
}
.gacha-animation-modal.is-spinning .gacha-machine-knob {
    animation: gacha-knob-turn .72s cubic-bezier(.65,0,.35,1) infinite;
}
.gacha-animation-modal.is-spinning .gacha-ball {
    animation: gacha-ball-tumble .42s ease-in-out infinite alternate;
}
.gacha-animation-modal.is-spinning .gacha-ball:nth-child(even) {
    animation-direction: alternate-reverse;
}
.gacha-animation-modal.is-dropping .gacha-capsule {
    opacity: 1;
    animation: gacha-capsule-drop .88s cubic-bezier(.2,.8,.2,1) both;
}
.gacha-animation-modal.is-opening .gacha-capsule {
    opacity: 1;
    transform: translate(-50%, 0) scale(1) rotate(0);
    animation: gacha-capsule-pop .55s ease-in-out both;
}
.gacha-animation-modal.is-opening .gacha-capsule-top {
    animation: gacha-capsule-top-open .65s .28s cubic-bezier(.2,.8,.2,1) forwards;
}
.gacha-animation-modal.is-opening .gacha-capsule-bottom {
    animation: gacha-capsule-bottom-open .65s .28s cubic-bezier(.2,.8,.2,1) forwards;
}
.gacha-animation-modal.is-opening .gacha-capsule::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -30px;
    border-radius: 50%;
    background: #fff5b8;
    box-shadow: 0 0 45px 20px rgba(255, 220, 91, .72);
    animation: gacha-light-burst .6s .25s ease-out both;
}
@keyframes gacha-machine-shake {
    0%, 100% { transform: translateX(-50%) rotate(-1.2deg); }
    50% { transform: translateX(-50%) rotate(1.2deg); }
}
@keyframes gacha-knob-turn {
    to { transform: rotate(360deg); }
}
@keyframes gacha-ball-tumble {
    from { translate: -5px -6px; rotate: -12deg; }
    to { translate: 6px 7px; rotate: 14deg; }
}
@keyframes gacha-capsule-drop {
    0% { opacity: 0; transform: translate(-50%, -188px) scale(.55) rotate(-18deg); }
    58% { opacity: 1; transform: translate(-50%, 6px) scale(1) rotate(13deg); }
    76% { transform: translate(-50%, -20px) scale(.96) rotate(-8deg); }
    100% { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(0); }
}
@keyframes gacha-capsule-pop {
    0%, 100% { transform: translate(-50%, 0) scale(1); }
    45% { transform: translate(-50%, -9px) scale(1.08); }
}
@keyframes gacha-capsule-top-open {
    to { transform: translate(-34px, -45px) rotate(-24deg); opacity: 0; }
}
@keyframes gacha-capsule-bottom-open {
    to { transform: translate(34px, 35px) rotate(24deg); opacity: 0; }
}
@keyframes gacha-light-burst {
    from { opacity: 0; transform: scale(.25); }
    55% { opacity: 1; }
    to { opacity: 0; transform: scale(1.45); }
}

.gacha-reveal {
    position: relative;
    z-index: 3;
    display: flex;
    min-height: 470px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 12px 0;
    animation: gacha-reveal-enter .68s cubic-bezier(.16,1,.3,1) both;
}
.gacha-reveal > .rarity-badge {
    position: relative;
    z-index: 4;
    margin-bottom: 4px;
}
.gacha-reveal-image-wrap {
    position: relative;
    width: min(270px, 76vw);
    height: 275px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gacha-reveal-image-wrap img {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 16px 15px rgba(18, 56, 88, .25));
    animation: gacha-character-arrive .8s .08s cubic-bezier(.16,1,.3,1) both;
}
.gacha-reveal-rays {
    position: absolute;
    z-index: 1;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(255,207,80,.52) 0 10deg, transparent 10deg 22deg);
    animation: gacha-rays-spin 12s linear infinite;
}
.gacha-reveal-rays::after {
    content: "";
    position: absolute;
    inset: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,.72);
    box-shadow: 0 0 38px rgba(255,218,91,.78);
}
.gacha-reveal-kicker {
    color: #087f8c;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .08em;
}
.gacha-reveal h3 {
    margin: 5px 0 3px;
    color: #123858;
    font-size: 22px;
    font-weight: 950;
}
.gacha-reveal p {
    margin: 0;
    color: #60778a;
    font-size: 13px;
    font-weight: 750;
}
.gacha-reveal-confirm {
    width: min(300px, 100%);
    min-height: 48px;
    margin-top: 16px;
    border: 0;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, #089b98, #20bcae);
    box-shadow: 0 10px 20px rgba(8, 155, 152, .24);
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 950;
}
.gacha-confetti {
    position: absolute;
    inset: 5px 0 auto;
    height: 260px;
    pointer-events: none;
}
.gacha-confetti i {
    position: absolute;
    top: 8%;
    width: 9px;
    height: 17px;
    border-radius: 3px;
    background: #ffc947;
    animation: gacha-confetti-fall 1.7s ease-out both;
}
.gacha-confetti i:nth-child(1) { left: 9%; transform: rotate(18deg); }
.gacha-confetti i:nth-child(2) { left: 20%; background: #22b8ad; animation-delay: .12s; }
.gacha-confetti i:nth-child(3) { left: 34%; background: #ff7c8b; animation-delay: .04s; }
.gacha-confetti i:nth-child(4) { left: 45%; background: #7d9bff; animation-delay: .18s; }
.gacha-confetti i:nth-child(5) { left: 57%; background: #f4a5e8; animation-delay: .08s; }
.gacha-confetti i:nth-child(6) { left: 69%; background: #9bdc71; animation-delay: .2s; }
.gacha-confetti i:nth-child(7) { left: 81%; background: #ff9c54; animation-delay: .02s; }
.gacha-confetti i:nth-child(8) { left: 91%; background: #33c7d4; animation-delay: .14s; }
@keyframes gacha-reveal-enter {
    from { opacity: 0; transform: scale(.78); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes gacha-character-arrive {
    from { opacity: 0; transform: translateY(35px) scale(.65) rotate(-4deg); }
    to { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes gacha-rays-spin {
    to { transform: rotate(360deg); }
}
@keyframes gacha-confetti-fall {
    0% { opacity: 0; translate: 0 -22px; rotate: 0deg; }
    12% { opacity: 1; }
    100% { opacity: 0; translate: 0 230px; rotate: 420deg; }
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 9px;
}
.collection-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 7px 6px 8px;
    border: 1px solid #e1ebef;
    border-radius: 14px;
    background: #fff;
    color: #2d465f;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.collection-card:hover {
    border-color: #66c8c1;
    background: #f8fffe;
    box-shadow: 0 6px 14px rgba(7, 143, 146, .12);
    transform: translateY(-2px);
}
.collection-card.is-previewed {
    border: 2px solid #159f9a;
    background: linear-gradient(180deg, #f0fdfb, #fffdf6);
}
.collection-card.is-locked {
    background: #f8fafb;
}
.collection-card-image-wrap {
    width: 100%;
    height: 103px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    border-radius: 10px;
    background: radial-gradient(circle at 50% 45%, #fff, #edf5f6);
}
.collection-card-image {
    width: 100%;
    height: 103px;
    object-fit: contain;
    filter: drop-shadow(0 4px 5px rgba(17, 88, 100, .12));
    opacity: 0;
    transition: opacity .35s ease-out;
}
.collection-card-image.is-loaded {
    opacity: 1;
}
.collection-card-image.collection-silhouette {
    opacity: .32;
    filter: none;
}
.collection-card-name {
    max-width: 100%;
    margin-top: 6px;
    overflow: hidden;
    color: #24455d;
    font-size: 11px;
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.collection-card.is-locked .collection-card-name {
    color: #7b8a94;
    letter-spacing: .06em;
}
.collection-card-meta {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-top: 4px;
}
.rarity-inline {
    padding: 2px 4px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: .04em;
}
.collection-card-meta small {
    min-width: 0;
    overflow: hidden;
    color: #7b8f9f;
    font-size: 9px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 820px) {
    .starter-choice-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .collection-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    body.portal-page .companion-level-line {
        font-size: .76rem;
    }
    body.portal-page .companion-level-line strong {
        font-size: 1rem;
    }
    .starter-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .starter-choice-card {
        min-height: 205px;
    }
    .starter-choice-image-wrap,
    .starter-choice-image-wrap img {
        height: 134px;
    }
    .collection-showcase {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .collection-preview-stage {
        min-height: 210px;
    }
    .collection-preview-character {
        height: 180px;
    }
    .collection-preview-copy h3 {
        font-size: 24px;
    }
    .collection-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .collection-card-image-wrap,
    .collection-card-image {
        height: 88px;
    }
    .gacha-animation-modal {
        padding: 8px;
    }
    .gacha-animation-card {
        min-height: min(620px, calc(100vh - 16px));
        padding: 18px 12px 15px;
        border-radius: 24px;
    }
    .gacha-animation-copy h2 {
        font-size: 21px;
    }
    .gacha-animation-scene {
        height: 408px;
        transform: scale(.91);
        transform-origin: top center;
    }
    .gacha-reveal {
        min-height: 450px;
        padding-inline: 4px;
    }
    .gacha-reveal-image-wrap {
        height: 245px;
    }
    .gacha-reveal h3 {
        font-size: 19px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.portal-page .companion-profile.is-gacha-ready,
    body.portal-page .companion-character-button.is-gacha-ready::before,
    body.portal-page .companion-character-button.is-gacha-ready::after,
    body.portal-page .companion-character-button.is-gacha-ready .companion-character-img,
    body.portal-page .companion-shop-hint.is-gacha-ready,
    .gacha-spin-button.is-ready,
    .gacha-spin-button.is-ready::after,
    .gacha-animation-modal *,
    .gacha-animation-modal *::before,
    .gacha-animation-modal *::after {
        animation: none !important;
    }
}

body.portal-page .companion-message {
    margin: 6px 0 0;
    color: #476882;
    font-size: .98rem;
    font-weight: 700;
    letter-spacing: .02em;
}

body.portal-page .panel-title-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--adventure-ink);
    font-size: 1.18rem;
    font-weight: 900;
    letter-spacing: .04em;
}
body.portal-page .panel-title-badge > i { color: var(--adventure-gold); margin-right: 6px; filter: drop-shadow(0 2px 4px rgba(240,180,40,.35)); }
body.portal-page .panel-title-badge a {
    margin-left: auto;
    padding: 5px 12px;
    border-radius: 99px;
    color: #068f92;
    background: rgba(228, 252, 250, .9);
    border: 1px solid rgba(140,220,214,.5);
    font-size: .78rem;
    font-weight: 800;
    text-decoration: none;
    transition: all .2s ease;
}
body.portal-page .stat-progress-block {
    margin-top: 6px;
}
body.portal-page .companion-level-line,
body.portal-page .energy-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0;
    color: #456382;
    font-size: .95rem;
    font-weight: 700;
}
body.portal-page .companion-level-line strong,
body.portal-page .energy-line strong {
    color: var(--adventure-ink);
    font-size: 1.12rem;
    font-weight: 900;
}
body.portal-page .level-progress {
    font-size: .88rem;
    color: #078f92;
    font-weight: 900;
}
body.portal-page .coins-progress-text {
    font-size: .88rem;
    color: #d97706;
    font-weight: 900;
}
body.portal-page .energy-cost { color: #7890a3; font-size: .78rem; font-weight: 700; }
body.portal-page .companion-shop-hint { margin: 6px 0 0; color: #4b6b85; font-size: .84rem; font-weight: 800; }
body.portal-page .energy-track {
    height: 10px;
    margin-top: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: linear-gradient(90deg, #d4ecf2, #c9e8ee);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.08);
}
body.portal-page .energy-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #04aca5, #55d4c6, #80e8df);
    box-shadow: 0 0 8px rgba(4,172,165,.4);
    transition: width .5s cubic-bezier(.34,1.56,.64,1);
}
body.portal-page .coins-track {
    height: 10px;
    margin-top: 4px;
    overflow: hidden;
    border-radius: 99px;
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.08);
}
body.portal-page .coins-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f59e0b, #fbbf24, #fcd34d);
    box-shadow: 0 0 8px rgba(245,158,11,.4);
    transition: width .5s cubic-bezier(.34,1.56,.64,1);
}
body.portal-page .companion-profile.is-gacha-ready .coins-track span {
    animation: coins-bar-glow 1.5s infinite alternate;
}
@keyframes coins-bar-glow {
    0% { box-shadow: 0 0 4px rgba(245,158,11,.4); }
    100% { box-shadow: 0 0 12px rgba(245,158,11,.9); }
}

body.portal-page .panel-title-badge a:hover { background: #b8f0ec; }

/* Left Card Body Components */
body.portal-page .companion-profile {
    flex: 1;
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: 144px 1fr;
    align-content: center;
    gap: 16px;
    padding: 16px 20px;
    border: 1px solid rgba(180, 228, 222, .7);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(244, 254, 253, .9), rgba(232, 251, 248, .75));
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, .8), 0 4px 14px rgba(20, 100, 120, .06);
    backdrop-filter: blur(12px);
}

body.portal-page .companion-character-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 144px;
    height: 162px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
body.portal-page .companion-character-button:focus-visible {
    outline: 3px solid #f4b63d;
    outline-offset: 4px;
}
body.portal-page .companion-character-button:hover { transform: scale(1.05) translateY(-2px); }
body.portal-page .companion-character-img {
    display: block;
    width: 144px;
    height: 162px;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(10, 80, 80, 0.16));
}

body.portal-page .profile-name { color: var(--adventure-ink); font-size: 1.25rem; font-weight: 900; }
body.portal-page .companion-type-label { margin-top: 3px; color: #078f92; font-size: .88rem; font-weight: 800; }
body.portal-page .profile-edit { margin-left: 6px; border: 0; background: transparent; color: var(--adventure-teal); cursor: pointer; opacity: .7; transition: opacity .2s; }
body.portal-page .profile-edit:hover { opacity: 1; }

body.portal-page .adventure-stats {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 4px;
}
body.portal-page .adventure-stats > div {
    display: grid;
    grid-template-columns: 30px 1fr;
    align-items: center;
    gap: 2px 6px;
    min-width: 0;
    padding: 6px 7px;
    border: 1.5px solid rgba(210, 238, 244, .7);
    border-radius: 12px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 2px 6px rgba(20,100,120,.06);
    transition: all .2s ease;
}
body.portal-page .adventure-stats > div:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(20,100,120,.10); }
body.portal-page .adventure-stats i {
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    color: #fff;
    font-size: .85rem;
    background: linear-gradient(135deg, #ff9258, #ff5353);
    box-shadow: 0 3px 6px rgba(255,90,90,.22);
}
body.portal-page .adventure-stats > div:nth-child(2) i { background: linear-gradient(135deg, #ffd257, #ef9b1e); box-shadow: 0 3px 6px rgba(240,155,30,.22); }
body.portal-page .adventure-stats > div:nth-child(3) i { background: linear-gradient(135deg, #8b69f6, #5d3ed7); box-shadow: 0 3px 6px rgba(130,100,240,.22); }
body.portal-page .adventure-stats small { overflow: hidden; color: #638196; font-size: .63rem; font-weight: 700; white-space: nowrap; letter-spacing: .01em; }
body.portal-page .adventure-stats strong { color: var(--adventure-ink); font-size: .95rem; font-weight: 900; }

body.portal-page .start-practice-btn {
    position: relative;
    overflow: hidden;
    width: 100%;
    margin-top: auto;
    min-height: 54px;
    border-radius: 16px;
    background: linear-gradient(135deg, #02b0a6 0%, #009e95 60%, #008c84 100%);
    border: 1.5px solid rgba(254, 240, 138, 0.6);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(0, 148, 140, .28), 0 0 14px 2px rgba(251, 191, 36, 0.45);
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: .05em;
    cursor: pointer;
    transition: all .25s cubic-bezier(.34,1.56,.64,1);
    animation: goldPulseGlow 2.4s infinite ease-in-out;
}

body.portal-page .start-practice-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -70%;
    width: 45%;
    height: 200%;
    background: linear-gradient(
        90deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(254, 240, 138, 0.45) 50%, 
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(25deg);
    animation: goldShimmerSweep 3.2s infinite ease-in-out;
    pointer-events: none;
}

body.portal-page .start-practice-btn i {
    color: #fef08a;
    text-shadow: 0 0 8px rgba(253, 224, 71, 0.7);
    transition: transform .25s ease;
    animation: playIconNudge 1.6s infinite ease-in-out;
}

body.portal-page .start-practice-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 28px rgba(0, 148, 140, .38), 0 0 26px 4px rgba(251, 191, 36, 0.75);
    border-color: #fef08a;
    animation-play-state: paused;
}

body.portal-page .start-practice-btn:active {
    transform: translateY(1px) scale(0.98);
}

@keyframes goldPulseGlow {
    0%, 100% {
        box-shadow: 0 6px 18px rgba(0, 148, 140, .28), 0 0 12px 1px rgba(251, 191, 36, 0.35);
        border-color: rgba(254, 240, 138, 0.45);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 24px rgba(0, 148, 140, .35), 0 0 24px 5px rgba(251, 191, 36, 0.7);
        border-color: rgba(254, 240, 138, 0.9);
        transform: scale(1.018);
    }
}

@keyframes goldShimmerSweep {
    0% {
        left: -70%;
        opacity: 0;
    }
    15% {
        opacity: 0.8;
    }
    45% {
        left: 140%;
        opacity: 0.8;
    }
    100% {
        left: 140%;
        opacity: 0;
    }
}

@keyframes playIconNudge {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(3.5px);
    }
}

/* Right Card Body Components */
body.portal-page .subject-stat-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-content: stretch;
    width: 100%;
    box-sizing: border-box;
}
body.portal-page .subject-stat-card {
    min-width: 0;
    width: 100%;
    height: auto;
    min-height: 56px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    text-align: left;
    box-shadow: 0 4px 14px rgba(22, 100, 120, .07);
    transition: all .22s ease;
    box-sizing: border-box;
    overflow: hidden;
}
body.portal-page .subject-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(22,100,120,.14);
}
body.portal-page .subject-stat-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; flex-shrink: 0; box-shadow: 0 4px 10px rgba(0,0,0,.08); }
body.portal-page .subject-stat-info { display: flex; flex-direction: column; min-width: 0; flex: 1; overflow: hidden; }
body.portal-page .subject-stat-name { font-size: 0.76rem; font-weight: 800; line-height: 1.1; white-space: nowrap; letter-spacing: -0.2px; }
body.portal-page .subject-stat-val { margin-top: 2px; font-size: 1.15rem; font-weight: 900; line-height: 1; white-space: nowrap; }
body.portal-page .subject-stat-card::after { display: none; }

body.portal-page .radar-card-wrapper {
    display: block;
    min-height: 155px;
    padding: 12px 18px 8px;
    border: 1.5px solid rgba(185,232,226,.7);
    border-radius: 20px;
    background: linear-gradient(120deg, rgba(255,255,255,.97) 0%, rgba(240,255,252,.9) 100%);
    box-shadow: 0 5px 16px rgba(20,115,115,.08);
}
body.portal-page .radar-header { margin: 0; }
body.portal-page .radar-badge { padding: 4px 11px; border: 1px solid rgba(170,225,218,.6); background: rgba(218,250,242,.8); color: var(--adventure-ink); font-size: .92rem; border-radius: 12px; }
body.portal-page .radar-chart-container { height: 115px; margin: 0; }

body.portal-page .subject-selection-section { max-width: 1000px; margin-top: 18px; }
body.portal-page .section-title { font-size: clamp(1.6rem, 2.4vw, 2.25rem); }

/* Grade cards — no castle decoration */
body.portal-page .grade-card { overflow: hidden; border-radius: 24px; position: relative; }
body.portal-page .card-header { margin-left: 0; }
body.portal-page .card-body { padding-top: 9px; }
body.portal-page .subject-btn { aspect-ratio: 1 / 1; min-height: 0; }

/* ---- Responsive breakpoints for adventure layout ---- */
@media (max-width: 1024px) {
    body.portal-page .homepage-split-layout {
        grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
        gap: 18px;
        padding: 16px;
        max-width: 980px;
    }
    body.portal-page .split-left-column,
    body.portal-page .split-right-column {
        padding: 16px 16px;
        gap: 12px;
    }
    body.portal-page .greeting-header h1 { font-size: 1.2rem; }
    body.portal-page .panel-title-badge { font-size: 0.98rem; }
    body.portal-page .subject-stat-card { min-height: 88px; padding: 10px 8px; gap: 8px; }
    body.portal-page .subject-stat-icon { width: 36px; height: 36px; font-size: 1.05rem; }
    body.portal-page .subject-stat-name { font-size: 0.8rem; }
    body.portal-page .subject-stat-val { font-size: 1.15rem; }
}

@media (max-width: 768px) {
    body.portal-page { padding-top: 67px; padding-bottom: 80px; }
    body.portal-page .hero-section { padding: 0 !important; margin: 0 !important; }
    body.portal-page .homepage-split-layout {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 12px 14px;
        max-width: 600px;
    }
    body.portal-page .split-left-column,
    body.portal-page .split-right-column {
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
        padding: 18px 16px;
        border-radius: 20px;
    }
    body.portal-page .greeting-header h1 { font-size: 1.15rem !important; white-space: normal; text-align: left; }
    body.portal-page .greeting-header h1::after { font-size: 0.78rem; text-align: left; }
    body.portal-page .panel-title-badge { font-size: 1.05rem; }
    body.portal-page .panel-title-badge a { font-size: 0.74rem; padding: 4px 10px; }
    body.portal-page .companion-profile { grid-template-columns: 82px 1fr; padding: 12px 10px; gap: 10px; border-radius: 16px; }
    body.portal-page .companion-character-button,
    body.portal-page .companion-character-img { width: 82px; height: 96px; }
    body.portal-page .start-practice-btn { min-height: 52px; font-size: 1.15rem; border-radius: 28px; }
    body.portal-page .subject-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    body.portal-page .subject-stat-card { min-height: 100px; padding: 12px 10px; gap: 10px; border-radius: 16px; }
    body.portal-page .subject-stat-icon { width: 48px; height: 48px; border-radius: 14px; font-size: 1.4rem; }
    body.portal-page .subject-stat-name { font-size: 0.92rem; }
    body.portal-page .subject-stat-val { font-size: 1.55rem; }
    body.portal-page .subject-selection-section { padding-left: 14px; padding-right: 14px; }
}

/* =========================================
   Home dashboard refresh — original pixel adventure world
   ========================================= */

/* =========================================
   科目成績明細彈出視窗 (Subject Detail Score Modal)
   ========================================= */
button.subject-stat-card {
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    width: 100%;
}

.subject-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    padding: 16px;
    box-sizing: border-box;
}

.subject-detail-modal.open {
    opacity: 1;
    visibility: visible;
}

.subject-detail-content {
    background: #ffffff;
    border-radius: 24px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    padding: 24px;
    position: relative;
    box-sizing: border-box;
    transform: translateY(20px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.subject-detail-modal.open .subject-detail-content {
    transform: translateY(0);
}

.subject-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 2px dashed #e2e8f0;
    margin-bottom: 16px;
}

.subject-detail-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.subject-detail-icon {
    font-size: 28px;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    flex-shrink: 0;
}

.subject-detail-title {
    font-size: 20px;
    font-weight: 900;
    color: #0f172a;
    margin: 0;
    letter-spacing: 0.5px;
}

.subject-detail-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 3px 0 0;
    font-weight: 600;
}

.subject-detail-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 180px;
    max-height: 50vh;
}

.sdm-record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    gap: 12px;
    transition: all 0.15s ease;
}

.sdm-record-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.sdm-record-main {
    min-width: 0;
    flex: 1;
}

.sdm-record-concept {
    font-size: 14.5px;
    font-weight: 800;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sdm-record-sub {
    font-size: 12px;
    color: #64748b;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sdm-record-badge {
    flex-shrink: 0;
    text-align: right;
}

.sdm-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
    font-size: 15px;
    font-weight: 700;
}

.sdm-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.6;
}

.subject-detail-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    gap: 12px;
    flex-wrap: wrap;
}

.sdm-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    background: #0f766e;
    color: #ffffff !important;
    font-weight: 800;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sdm-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
    color: #ffffff !important;
}

.sdm-history-link {
    font-size: 13.5px;
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.sdm-history-link:hover {
    color: #0f172a;
}

/* =========================================
   學習等級總覽彈出視窗
   ========================================= */
.level-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.level-detail-modal.open {
    opacity: 1;
    visibility: visible;
}

.level-detail-content {
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    padding: 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.level-detail-modal.open .level-detail-content {
    transform: translateY(0);
}

.level-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 2px dashed #e2e8f0;
}

.level-detail-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.level-detail-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #fff7d6, #ffed9a);
    font-size: 28px;
}

.level-detail-title {
    margin: 0;
    color: #0f172a;
    font-size: 20px;
    font-weight: 900;
}

.level-detail-subtitle {
    margin: 3px 0 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

.level-detail-progress {
    padding: 14px 16px;
    margin-bottom: 14px;
    border: 1px solid rgba(170, 225, 218, 0.7);
    border-radius: 16px;
    background: linear-gradient(135deg, #f4fefd, #e8fbf8);
}

.level-detail-progress-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #123858;
    font-size: 13px;
}

.level-detail-progress-line span {
    color: #52718a;
    font-weight: 700;
}

.level-detail-progress-track {
    height: 9px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 99px;
    background: #c9e8ee;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .06);
}

.level-detail-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #04aca5, #55d4c6, #80e8df);
    box-shadow: 0 0 8px rgba(4, 172, 165, .4);
    transition: width .45s ease;
}

.level-roadmap {
    min-height: 180px;
    max-height: 48vh;
    padding-right: 4px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.level-roadmap-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.level-roadmap-item.is-complete {
    border-color: #a7e3d8;
    background: #f0fdfa;
}

.level-roadmap-item.is-current {
    border: 2px solid #2c9e9e;
    background: linear-gradient(135deg, rgba(44, 158, 158, .13), rgba(245, 161, 48, .08));
    box-shadow: 0 5px 14px rgba(44, 158, 158, .12);
    transform: scale(1.015);
}

.level-roadmap-item.is-locked {
    opacity: .62;
}

.level-roadmap-badge {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #e2e8f0;
    font-size: 21px;
}

.is-complete .level-roadmap-badge {
    background: #ccfbf1;
}

.is-current .level-roadmap-badge {
    background: #fff0b2;
}

.level-roadmap-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.level-roadmap-copy strong {
    overflow: hidden;
    color: #1e293b;
    font-size: 14px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.level-roadmap-copy span {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.level-roadmap-status {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.is-complete .level-roadmap-status {
    color: #0f766e;
}

.is-current .level-roadmap-status {
    color: #b45309;
}

.level-detail-tip {
    margin: 14px 0 0;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.level-detail-tip i {
    margin-right: 5px;
    color: #f4b63d;
}

@media (max-width: 560px) {
    .level-detail-content {
        padding: 18px;
        border-radius: 20px;
    }

    .level-detail-progress-line {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .level-roadmap-item {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .level-roadmap-status {
        grid-column: 2;
    }
}

/* =========================================
   步步夥伴中心：角色圖鑑與扭蛋
   ========================================= */
.companion-center-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, .68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.companion-center-modal.open {
    opacity: 1;
    visibility: visible;
}

.companion-center-content {
    position: relative;
    width: min(960px, 100%);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    padding: 22px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .24);
    transform: translateY(18px) scale(.98);
    transition: transform .28s cubic-bezier(.16, 1, .3, 1);
}

.companion-center-content .close-modal {
    top: 15px;
    right: 15px;
}

.companion-center-modal.open .companion-center-content {
    transform: translateY(0) scale(1);
}

.companion-center-header,
.companion-panel-heading,
.companion-energy-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.companion-center-header {
    flex-shrink: 0;
    padding-bottom: 15px;
    border-bottom: 2px dashed #e2e8f0;
}

.companion-center-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.companion-center-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #dffaf6, #fff1c5);
    font-size: 28px;
}

.companion-center-title {
    margin: 0;
    color: #123858;
    font-size: 21px;
    font-weight: 900;
}

.companion-center-subtitle {
    margin: 3px 0 0;
    color: #647b91;
    font-size: 13px;
    font-weight: 700;
}

.companion-energy-strip {
    flex-shrink: 0;
    margin: 14px 0;
    padding: 11px 15px;
    border: 1px solid rgba(170, 225, 218, .75);
    border-radius: 16px;
    background: linear-gradient(135deg, #f2fdfb, #fffaf0);
}

.companion-energy-strip > div {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.companion-energy-label {
    color: #4e6e88;
    font-size: 13px;
    font-weight: 800;
}

.companion-energy-strip strong {
    color: #078f92;
    font-size: 20px;
    font-weight: 900;
}

.companion-energy-note {
    color: #9a6b18;
    font-size: 12px;
    font-weight: 800;
}

.companion-center-scroll {
    min-height: 0;
    padding: 2px 4px 4px 0;
    overflow-y: auto;
    scrollbar-color: #9bded8 transparent;
}

.companion-panel {
    padding: 15px;
    margin-bottom: 13px;
    border: 1px solid #e2eef0;
    border-radius: 19px;
    background: #fbfefe;
}

.companion-panel-heading {
    margin-bottom: 12px;
}

.companion-panel-heading h3 {
    margin: 0;
    color: #123858;
    font-size: 16px;
    font-weight: 900;
}

.companion-panel-heading p {
    margin: 3px 0 0;
    color: #6b8194;
    font-size: 12px;
    font-weight: 600;
}

.companion-panel-count {
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 99px;
    color: #078f92;
    background: #e6faf7;
    font-size: 12px;
    font-weight: 900;
}

.robot-choice-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.robot-choice-card {
    position: relative;
    min-width: 0;
    min-height: 198px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 9px 7px 11px;
    border: 1.5px solid #d9e8eb;
    border-radius: 16px;
    background: #fff;
    color: #253b54;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.robot-choice-card:hover {
    border-color: #64c7c0;
    box-shadow: 0 8px 18px rgba(7, 143, 146, .12);
    transform: translateY(-3px);
}

.robot-choice-card:focus-visible,
.equipment-shop-card:focus-visible {
    outline: 3px solid #f4b63d;
    outline-offset: 2px;
}

.robot-choice-card.is-selected {
    border: 2px solid #159f9a;
    background: linear-gradient(180deg, #f0fdfb, #fffdf6);
    box-shadow: 0 7px 18px rgba(21, 159, 154, .14);
}

.robot-choice-image-wrap {
    width: 100%;
    height: 118px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3px;
}

.robot-choice-image-wrap img {
    width: 100%;
    height: 118px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(17, 88, 100, .12));
    transition: transform .2s ease;
}

.robot-choice-card:hover .robot-choice-image-wrap img {
    transform: scale(1.05);
}

.robot-choice-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 18px;
}

.robot-choice-card strong {
    color: #123858;
    font-size: 13px;
    font-weight: 900;
}

.robot-choice-card > span:last-of-type {
    margin-top: 3px;
    color: #6b8194;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.35;
}

.robot-choice-card em {
    position: absolute;
    right: 7px;
    bottom: 7px;
    padding: 3px 6px;
    border-radius: 99px;
    color: #fff;
    background: #159f9a;
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
}

.owned-equipment-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.owned-equipment-item,
.empty-equipment {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border-radius: 13px;
    background: #f1fbfa;
}

.owned-equipment-item .equipment-icon,
.empty-equipment > span {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 11px;
    background: #fff4cf;
    font-size: 21px;
}

.owned-equipment-item > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.owned-equipment-item strong {
    color: #24455d;
    font-size: 12px;
    font-weight: 900;
}

.owned-equipment-item > div span {
    overflow: hidden;
    color: #72879a;
    font-size: 10px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.owned-equipment-item em {
    margin-left: auto;
    flex-shrink: 0;
    color: #159f9a;
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
}

.empty-equipment {
    grid-column: 1 / -1;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 14px;
    text-align: center;
}

.empty-equipment strong {
    color: #456382;
    font-size: 13px;
}

.empty-equipment p {
    flex-basis: 100%;
    margin: 0;
    color: #72879a;
    font-size: 11px;
    font-weight: 600;
}

.equipment-shop-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.equipment-shop-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 9px;
    border: 1px solid #e1e9ee;
    border-radius: 13px;
    background: #fff;
    color: #2d465f;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.equipment-shop-card:hover:not(:disabled) {
    border-color: #f1bd54;
    background: #fffaf0;
    transform: translateY(-2px);
}

.equipment-shop-card:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.equipment-shop-card.is-owned {
    background: #f1fbfa;
}

.equipment-shop-card .equipment-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #fff4cf;
    font-size: 19px;
}

.equipment-shop-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.equipment-shop-copy strong {
    overflow: hidden;
    color: #24455d;
    font-size: 11px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.equipment-shop-copy span {
    overflow: hidden;
    color: #72879a;
    font-size: 9px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.equipment-shop-card em {
    grid-column: 1 / -1;
    padding-top: 5px;
    border-top: 1px solid #edf2f4;
    color: #a16b16;
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
    text-align: center;
}

.equipment-shop-card.is-owned em {
    color: #159f9a;
}

.companion-center-message {
    flex-shrink: 0;
    min-height: 18px;
    margin: 8px 0 0;
    color: #159f9a;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.companion-center-message.is-error {
    color: #d04a45;
}

@media (max-width: 820px) {
    .robot-choice-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .equipment-shop-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .companion-center-modal {
        padding: 8px;
    }

    .companion-center-content {
        max-height: 94vh;
        padding: 15px;
        border-radius: 21px;
    }

    .companion-center-title {
        font-size: 18px;
    }

    .companion-center-subtitle {
        font-size: 11px;
    }

    .companion-center-icon {
        width: 44px;
        height: 44px;
        font-size: 23px;
    }

    .companion-energy-strip {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
        margin: 11px 0;
    }

    .robot-choice-grid,
    .equipment-shop-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .robot-choice-card {
        min-height: 188px;
    }

    .owned-equipment-list {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   學生專用學習獎勵規則彈窗與按鈕
   ========================================= */
.rules-badge-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border: 1.5px solid #f59e0b;
    border-radius: 999px;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #92400e;
    font-size: 13.5px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
}

.rules-badge-btn:hover {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.rules-badge-btn:active {
    transform: translateY(0) scale(0.98);
}

.student-rules-modal {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, .65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.student-rules-modal.open {
    opacity: 1;
    visibility: visible;
}

.student-rules-dialog {
    position: relative;
    width: min(540px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 22px 24px;
    box-sizing: border-box;
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
    transform: translateY(16px) scale(.98);
    transition: transform .25s cubic-bezier(.16, 1, .3, 1);
    overflow: hidden;
}

.student-rules-modal.open .student-rules-dialog {
    transform: translateY(0) scale(1);
}

.student-rules-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
}

.student-rules-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.student-rules-icon {
    font-size: 26px;
}

.student-rules-title {
    margin: 0;
    font-size: 20px;
    font-weight: 900;
    color: #0f766e;
}

.student-rules-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rule-card {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid transparent;
}

.rule-card-gold {
    background: #fffdf5;
    border-color: #fef08a;
}

.rule-card-teal {
    background: #f0fdfa;
    border-color: #ccfbf1;
}

.rule-card-rose {
    background: #fff1f2;
    border-color: #fecdd3;
}

.rule-card-amber {
    background: #fffbeb;
    border-color: #fde68a;
}

.rule-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.rule-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 900;
    background: rgba(0, 0, 0, 0.06);
}

.rule-card h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
}

.rule-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13.5px;
    color: #334155;
    line-height: 1.55;
}

.rule-list li {
    margin-bottom: 4px;
}

.rule-val {
    font-weight: 900;
    color: #b45309;
}

.rule-highlight {
    font-weight: 900;
    color: #e11d48;
}

.rule-notice {
    margin: 0;
    font-size: 13px;
    color: #92400e;
    line-height: 1.5;
    font-weight: 600;
}

.student-rules-footer {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.student-rules-ok-btn {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #0f766e, #0d9488);
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
    transition: filter 0.2s ease, transform 0.1s ease;
}

.student-rules-ok-btn:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.student-rules-ok-btn:active {
    transform: translateY(0);
}

/* 段考區：聽力／朗讀（口說）測驗卡片 */
#semester1-area .section-content a.btn[href*="exam-listening"]::before,
#semester2-area .section-content a.btn[href*="exam-listening"]::before {
    content: "025" !important; /* fa-headphones */
    background: linear-gradient(135deg, #b45309, #f59e0b) !important;
    box-shadow: 0 10px 22px rgba(180, 83, 9, 0.2) !important;
}
#semester1-area .section-content a.btn[href*="exam-listening"][href*="part=2"]::before,
#semester2-area .section-content a.btn[href*="exam-listening"][href*="part=2"]::before {
    content: "130" !important; /* fa-microphone */
    background: linear-gradient(135deg, #be123c, #f43f5e) !important;
    box-shadow: 0 10px 22px rgba(190, 18, 60, 0.2) !important;
}
#semester1-area .section-content a.btn[href*="exam-listening"][href*="part=1"]::after,
#semester2-area .section-content a.btn[href*="exam-listening"][href*="part=1"]::after {
    content: "段考聽力測驗" !important;
}
#semester1-area .section-content a.btn[href*="exam-listening-reading"][href*="part=2"]::after,
#semester2-area .section-content a.btn[href*="exam-listening-reading"][href*="part=2"]::after {
    content: "段考朗讀測驗" !important;
}
#semester1-area .section-content a.btn[href*="exam-listening-speaking"][href*="part=2"]::after,
#semester2-area .section-content a.btn[href*="exam-listening-speaking"][href*="part=2"]::after {
    content: "段考口說測驗" !important;
}

/* ===== 夥伴升星外觀（2★光環＋表情、3★跳躍姿勢、4★香氣特效、5★金框閃光） ===== */
.star-host { --ring-size: 150px; --rc: #9fb3c3; --rc2: #dfe9f0; }
.star-host[data-rarity="R"]   { --rc: #2bb8b0; --rc2: #c9f3ee; }
.star-host[data-rarity="SR"]  { --rc: #f0b432; --rc2: #ffe7a8; }
.star-host[data-rarity="SSR"] { --rc: #ff6a3d; --rc2: #c86bff; }
.star-host[data-stars="5"]    { --rc: #f2a516; --rc2: #fff1b8; }
#companion-trigger.star-host { --ring-size: 132px; }
.collection-preview-stage.star-host { --ring-size: 190px; }
.gacha-reveal-image-wrap.star-host { --ring-size: 240px; }
.collection-card-image-wrap.star-host { --ring-size: 92px; position: relative; }

.star-fx-back, .star-fx-front { position: absolute; inset: 0; pointer-events: none; }
.star-fx-back { z-index: 0; }
.star-fx-front { z-index: 5; }
#companion-trigger.star-host > img { position: relative; z-index: 1; }
.star-ring, .star-halo {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--ring-size);
    max-width: 96%;
    aspect-ratio: 1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
.star-halo { background: radial-gradient(circle, color-mix(in srgb, var(--rc2) 70%, #fff) 0%, rgba(255, 255, 255, 0) 70%); }
.star-ring {
    background: conic-gradient(var(--rc), var(--rc2), var(--rc), var(--rc2), var(--rc));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
    animation: star-ring-spin 8s linear infinite;
}
.star-host[data-stars="5"] .star-ring {
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
    filter: drop-shadow(0 0 8px rgba(255, 190, 40, .85));
    animation-duration: 4s;
}
@keyframes star-ring-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.star-emote {
    position: absolute;
    top: 26%;
    left: 4%;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .15);
    font-size: 18px;
    animation: star-emote 4.5s ease-in-out infinite;
}
@keyframes star-emote { 0%, 55%, 100% { transform: scale(0); opacity: 0; } 62%, 90% { transform: scale(1); opacity: 1; } }

.star-host.star-hop[data-stars="3"]:not(.is-gacha-ready) > img,
.star-host.star-hop[data-stars="4"]:not(.is-gacha-ready) > img,
.star-host.star-hop[data-stars="5"]:not(.is-gacha-ready) > img {
    transform-origin: 50% 100%;
    animation: star-hop 3.4s ease-in-out infinite;
}
@keyframes star-hop {
    0%, 40%, 100% { transform: translateY(0) rotate(0) scale(1); }
    48% { transform: translateY(0) scale(1.05, .93); }
    58% { transform: translateY(-14px) rotate(-6deg) scale(.96, 1.05); }
    68% { transform: translateY(0) rotate(5deg) scale(1.04, .95); }
    76% { transform: rotate(-3deg); }
    84% { transform: rotate(0); }
}

.star-steam {
    position: absolute;
    bottom: 55%;
    width: 10px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(to top, rgba(170, 140, 120, 0), rgba(170, 140, 120, .55) 50%, rgba(170, 140, 120, 0));
    filter: blur(2px);
    opacity: 0;
    animation: star-steam 2.6s ease-out infinite;
}
.star-steam:nth-child(1) { left: 38%; }
.star-steam:nth-child(2) { left: 50%; animation-delay: .9s; }
.star-steam:nth-child(3) { left: 61%; animation-delay: 1.7s; }
@keyframes star-steam {
    0% { transform: translateY(10px) scaleX(.6); opacity: 0; }
    30% { opacity: .9; }
    100% { transform: translateY(-60px) scaleX(1.4) skewX(12deg); opacity: 0; }
}
.star-spark {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--rc);
    box-shadow: 0 0 8px var(--rc);
    opacity: 0;
    animation: star-spark 3s ease-out infinite;
}
.star-spark:nth-child(4) { left: 16%; bottom: 22%; }
.star-spark:nth-child(5) { left: 80%; bottom: 30%; animation-delay: 1s; }
.star-spark:nth-child(6) { left: 24%; bottom: 60%; animation-delay: 2s; }
.star-spark:nth-child(7) { left: 74%; bottom: 66%; animation-delay: 1.5s; }
@keyframes star-spark {
    0% { transform: translateY(0) scale(.4); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: translateY(-40px) scale(1); opacity: 0; }
}

.star-shine {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--ring-size);
    max-width: 96%;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    transform: translate(-50%, -50%);
}
.star-shine::before {
    content: "";
    position: absolute;
    top: -20%;
    bottom: -20%;
    left: -50%;
    width: 30%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .8), transparent);
    transform: skewX(-20deg);
    animation: star-shine 3.6s ease-in-out infinite;
}
@keyframes star-shine { 0%, 60% { left: -50%; } 100% { left: 130%; } }

/* 圖鑑格子：只顯示靜態光環，滿星加金框，不跑動畫 */
.collection-card-image-wrap.star-host > img { position: relative; z-index: 1; }
.collection-card-image-wrap.star-host .star-ring { animation: none; }
.collection-card.is-owned.is-max-star {
    border-color: #f2b632;
    box-shadow: 0 0 0 2px #fff4d0, 0 6px 16px rgba(242, 166, 22, .3);
}

@media (prefers-reduced-motion: reduce) {
    .star-ring, .star-emote, .star-steam, .star-spark, .star-shine::before,
    .star-host.star-hop > img { animation: none !important; }
    .star-emote { transform: none; opacity: 1; }
    .star-steam, .star-spark { display: none; }
}

/* 右上角星等藥丸標籤：1★灰、2～4★稀有度色、5★金色 */
.star-pill {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: .02em;
    white-space: nowrap;
    color: #fff;
    background: var(--rc);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18), inset 0 0 0 2px rgba(255, 255, 255, .55);
}
.star-host[data-stars="1"] .star-pill { color: #4d6275; background: #e7eef3; }
.star-host[data-rarity="SR"]:not([data-stars="1"]):not([data-stars="5"]) .star-pill { color: #7a4e00; }
.star-host[data-stars="5"] .star-pill {
    color: #7a4300;
    background: linear-gradient(135deg, #ffe58a, #ffbf3a);
    box-shadow: 0 0 10px rgba(255, 186, 40, .8), inset 0 0 0 2px rgba(255, 255, 255, .7);
}
#companion-trigger .star-pill { top: auto; bottom: 4px; right: -6px; font-size: 11px; padding: 3px 7px; }
.collection-card-image-wrap .star-pill { top: 5px; right: 5px; font-size: 10px; padding: 2px 6px; }
.gacha-reveal-image-wrap .star-pill { top: 10px; right: 6px; font-size: 15px; padding: 5px 12px; }
