/* ----------------------------------------------------
   設計系統與變數 (簡約森林風 2.0 - 遊戲化升級版)
   ---------------------------------------------------- */
:root {
    --bg-base: #EBF2EE;          /* 嫩青森林基底色 */
    --bg-paper: #FCFAF6;         /* 羊皮紙/米白主色 */
    --forest-deep: #163B26;      /* 墨綠森林色 */
    --forest-medium: #225C3C;    /* 中度青松綠 */
    --forest-light: #3D8C61;     /* 活潑萌芽綠 */
    --forest-pale: #F0F6F3;      /* 淺嫩綠 (Hover / 標籤) */
    
    --beige-dark: #D4C9B9;       /* 泥土米灰線條 */
    --beige-light: #F6F3EC;      /* 柔和米砂色 */
    
    --text-primary: #1C2420;     /* 深炭綠主文字 */
    --text-muted: #56635C;       /* 灰綠副文字 */
    
    --yangming-red: #A63F24;     /* 古典朱砂紅 (先生評語/印章) */
    --gold-main: #E5A823;        /* 聖人良知金 */
    --gold-glow: #FCE8AB;        /* 良知金光效 */
    --gray-dust: #8FA097;        /* 習氣人欲灰 */
    
    --shadow-game: 0 8px 0px rgba(22, 59, 38, 0.08), 0 15px 30px rgba(22, 59, 38, 0.06);
    --shadow-active: 0 12px 0px rgba(22, 59, 38, 0.12), 0 20px 40px rgba(22, 59, 38, 0.12);
    --border-radius: 24px;
    --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --transition-smooth: all 0.3s ease;
}

/* ----------------------------------------------------
   全局樣式與森林動態背景
   ---------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    font-family: 'Noto Sans TC', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    line-height: 1.6;
    position: relative;
}

/* 森林背景螢火蟲 */
.forest-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 20%, #F5F9F7 0%, #D4E2DB 50%, #C4D6CD 100%);
    z-index: 1;
    overflow: hidden;
}

.glow-particle {
    position: absolute;
    background-color: var(--gold-glow);
    border-radius: 50%;
    filter: blur(4px);
    opacity: 0.6;
    pointer-events: none;
}

.gp-1 { width: 30px; height: 30px; top: 15%; left: 10%; animation: float-drift 22s infinite ease-in-out; }
.gp-2 { width: 45px; height: 45px; bottom: 10%; right: 15%; animation: float-drift 28s infinite ease-in-out 3s; }
.gp-3 { width: 25px; height: 25px; top: 75%; left: 20%; animation: float-drift 18s infinite ease-in-out 1s; }
.gp-4 { width: 35px; height: 35px; top: 40%; right: 8%; animation: float-drift 25s infinite ease-in-out 5s; }

@keyframes float-drift {
    0% { transform: translateY(0) translateX(0) scale(1); opacity: 0.3; }
    50% { transform: translateY(-40px) translateX(30px) scale(1.2); opacity: 0.7; }
    100% { transform: translateY(0) translateX(0) scale(1); opacity: 0.3; }
}

/* ----------------------------------------------------
   遊戲主視窗結構 (#app-container)
   ---------------------------------------------------- */
#app-container {
    position: relative;
    width: 100%;
    max-width: 550px;
    min-height: 90vh;
    background: var(--bg-paper);
    border: 6px double var(--forest-deep);
    border-radius: var(--border-radius);
    padding: 2.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 2;
    box-shadow: 0 20px 0px var(--forest-deep), 0 30px 60px rgba(22, 59, 38, 0.25);
    overflow: hidden;
    transition: var(--transition-smooth);
}

/* 頂部裝飾藤蔓 */
.top-vine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 12px;
    background: repeating-linear-gradient(45deg, var(--forest-deep), var(--forest-deep) 15px, var(--forest-light) 15px, var(--forest-light) 30px);
    border-bottom: 2px solid var(--forest-deep);
}

#main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 3;
}

/* ----------------------------------------------------
   單頁面應用程式視圖 (SPA Views) 轉場
   ---------------------------------------------------- */
.view-section {
    display: none;
    opacity: 0;
    transform: scale(0.96) translateY(10px);
    transition: opacity 0.4s ease-out, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.view-section.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* ----------------------------------------------------
   遊戲化風格裝飾與元件
   ---------------------------------------------------- */

/* 徽章與小標 */
.sub-badge {
    align-self: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--forest-deep);
    background-color: var(--bg-base);
    padding: 0.4rem 1.2rem;
    border-radius: 12px;
    border: 2px solid var(--forest-deep);
    margin-bottom: 1.2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 2px 2px 0px var(--forest-deep);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--forest-light);
    border-radius: 50%;
    display: inline-block;
    animation: dot-pulse 1.5s infinite alternate;
}

@keyframes dot-pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.3); opacity: 1; }
}

/* 標題與字型 */
.main-title {
    font-family: 'Noto Serif TC', serif;
    font-weight: 900;
    font-size: 3.2rem;
    background: linear-gradient(135deg, var(--forest-deep) 30%, var(--forest-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    letter-spacing: 0.15em;
    margin-bottom: 0.4rem;
    filter: drop-shadow(1px 2px 3px rgba(22, 59, 38, 0.15));
}

.sub-title {
    font-family: 'Noto Serif TC', serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--forest-light);
    text-align: center;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
}

/* 紙張質感的卡片 */
.paper-texture {
    background-color: var(--beige-light);
    border: 2px solid var(--beige-dark);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: inset 0 0 15px rgba(212, 201, 185, 0.2), var(--shadow-game);
    position: relative;
    z-index: 1;
}

.paper-texture::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 7px;
    right: 7px;
    bottom: 7px;
    border: 1px dashed rgba(22, 59, 38, 0.15); /* 古籍格線效果 */
    border-radius: calc(var(--border-radius) - 7px);
    pointer-events: none;
    z-index: 1;
}

.paper-texture > * {
    position: relative;
    z-index: 2; /* 確保內容高於格線與浮水印 */
}

.paper-texture .watermark-seal {
    z-index: 0 !important; /* 浮水印置於底層，避免遮擋文字或干擾事件 */
}

/* ----------------------------------------------------
   1. 首頁 (Home View)
   ---------------------------------------------------- */
.portrait-container-outer {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.portrait-box {
    position: relative;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background-color: var(--bg-base);
    border: 3.5px solid var(--forest-deep);
    padding: 5px;
    box-shadow: 4px 4px 0px var(--forest-deep);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-bounce);
}

.portrait-box:hover {
    transform: scale(1.05) rotate(-3deg);
    box-shadow: 6px 6px 0px var(--forest-deep);
}

.cartoon-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background: radial-gradient(circle, #e4eef0 0%, #cbdad2 100%);
}

.ym-seal {
    position: absolute;
    bottom: -6px;
    right: -15px;
    background-color: var(--yangming-red);
    color: #FFF;
    font-family: 'Noto Serif TC', serif;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.4rem 0.7rem;
    line-height: 1.1;
    border-radius: 4px;
    box-shadow: 3px 3px 0px var(--forest-deep);
    border: 2px solid var(--forest-deep);
    transform: rotate(6deg);
}

.intro-card {
    border-left: 6px solid var(--forest-deep);
    margin-bottom: 2rem;
}

.intro-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    text-align: justify;
    line-height: 1.7;
    margin-bottom: 0.8rem;
}

.intro-text::first-letter {
    font-family: 'Noto Serif TC', serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--yangming-red);
    float: left;
    margin-right: 8px;
    line-height: 1.1;
    border: 2.5px solid var(--yangming-red);
    padding: 3px 5px;
    border-radius: 4px;
    background-color: rgba(166, 63, 36, 0.03);
    box-shadow: 2px 2px 0px rgba(166, 63, 36, 0.15);
}

.intro-author {
    font-family: 'Noto Serif TC', serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--yangming-red);
    text-align: right;
}

/* 遊戲感按鈕 */
.btn-gameplay {
    position: relative;
    font-family: 'Noto Sans TC', sans-serif;
    outline: none;
    border: 3px solid var(--forest-deep);
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 0.9rem 3.5rem;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 6px 0px var(--forest-deep);
    transition: var(--transition-bounce);
}

.btn-primary.btn-gameplay {
    background: linear-gradient(135deg, var(--forest-light) 0%, var(--forest-medium) 100%);
    color: #FFF;
}

.btn-primary.btn-gameplay:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0px var(--forest-deep);
}

.btn-primary.btn-gameplay:active {
    transform: translateY(3px);
    box-shadow: 0 3px 0px var(--forest-deep);
}

.btn-secondary.btn-gameplay {
    background-color: var(--bg-paper);
    color: var(--forest-deep);
    box-shadow: 0 5px 0px var(--forest-deep);
}

.btn-secondary.btn-gameplay:hover {
    background-color: var(--forest-pale);
    transform: translateY(-2px);
    box-shadow: 0 7px 0px var(--forest-deep);
}

.btn-secondary.btn-gameplay:active {
    transform: translateY(2px);
    box-shadow: 0 3px 0px var(--forest-deep);
}

/* ----------------------------------------------------
   2. 測驗問題頁 (Quiz View)
   ---------------------------------------------------- */
.progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.progress-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--forest-deep);
}

.purity-mini-score {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--forest-medium);
    background-color: var(--bg-base);
    padding: 0.2rem 0.7rem;
    border-radius: 8px;
    border: 1.5px solid var(--forest-deep);
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: var(--beige-dark);
    border-radius: 10px;
    border: 1.5px solid var(--forest-deep);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-main) 0%, var(--forest-light) 100%);
    border-radius: 10px;
    transition: width 0.4s ease-out;
}

/* 10點冶煉軌跡進度點 */
.purity-tracker {
    display: flex;
    justify-content: space-between;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.tracker-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--forest-deep);
    background-color: var(--beige-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: var(--transition-bounce);
}

.tracker-dot.active {
    background-color: var(--forest-light);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(34, 92, 60, 0.4);
    animation: active-pulse 1s infinite alternate;
}

.tracker-dot.correct {
    background-color: var(--gold-main);
    color: white;
    border-color: var(--forest-deep);
    box-shadow: 0 0 6px rgba(229, 168, 35, 0.5);
}

.tracker-dot.incorrect {
    background-color: var(--gray-dust);
    color: white;
    border-color: var(--forest-deep);
}

.tracker-dot.completed {
    background-color: var(--forest-light);
    color: white;
    border-color: var(--forest-deep);
}

@keyframes active-pulse {
    0% { border-color: var(--forest-deep); }
    100% { border-color: var(--gold-main); }
}

.question-container {
    padding: 1.8rem;
    margin-bottom: 1.5rem;
    border: 2.5px solid var(--forest-deep);
    box-shadow: 4px 4px 0px var(--forest-deep);
}

.scenario-tag {
    position: absolute;
    top: -14px;
    left: 20px;
    background-color: var(--yangming-red);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.9rem;
    border-radius: 6px;
    border: 2px solid var(--forest-deep);
    box-shadow: 2px 2px 0px var(--forest-deep);
}

.question-text {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.6;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

/* 遊戲卡牌樣式選項 (質感升級：仿玉石精裝卡片) */
.option-btn {
    background: linear-gradient(to bottom, #FFFFFF 0%, #FAF8F5 100%);
    border: 2px solid var(--forest-deep);
    border-radius: 16px;
    padding: 1.15rem 1.5rem;
    text-align: left;
    font-size: 0.96rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 6px 0px var(--forest-deep);
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    transition: var(--transition-bounce);
    position: relative;
}

.option-btn::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    border: 1px dashed rgba(22, 59, 38, 0.08); /* 內虛線裝飾 */
    border-radius: 12px;
    pointer-events: none;
}

.option-btn:hover {
    border-color: var(--forest-deep);
    background: linear-gradient(to bottom, var(--forest-pale) 0%, #FFFFFF 100%);
    transform: translateY(-4px);
    box-shadow: 0 10px 0px var(--forest-deep);
}

.option-btn:active {
    transform: translateY(3px);
    box-shadow: 0 3px 0px var(--forest-deep);
}

.option-btn .option-label {
    background-color: var(--bg-base);
    color: var(--forest-deep);
    font-weight: 900;
    min-width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
    border: 2px solid var(--forest-deep);
}

.option-btn .option-text {
    flex-grow: 1;
    margin-top: 1px;
}

/* ----------------------------------------------------
   遊戲化動態特效樣式 (Sparks, Shake, Flash)
   ---------------------------------------------------- */

/* 卡牌點擊答錯震動 */
.shake-anim {
    animation: card-shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    background-color: #FDF2F0 !important;
    border-color: var(--yangming-red) !important;
    box-shadow: 0 5px 0px var(--yangming-red) !important;
}

@keyframes card-shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* 卡牌點擊答對閃爍 */
.correct-flash-anim {
    animation: correct-glow-flash 0.5s ease-out;
    background-color: #EBF7F0 !important;
    border-color: var(--forest-light) !important;
    box-shadow: 0 5px 0px var(--forest-light) !important;
}

@keyframes correct-glow-flash {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.02); filter: brightness(1.1); box-shadow: 0 0 15px rgba(61, 140, 97, 0.4); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* 懸浮上升文字 (例如「良知 +1」) */
.floating-text {
    position: fixed;
    pointer-events: none;
    font-family: 'Noto Serif TC', serif;
    font-size: 1.4rem;
    font-weight: 900;
    z-index: 9999;
    animation: float-up-fade 1.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1), 0 0 8px #FFF;
}

.floating-text.gold {
    color: var(--gold-main);
    text-shadow: 0 2px 4px rgba(229,168,35,0.2), 0 0 8px #FFF;
}

.floating-text.gray {
    color: var(--yangming-red);
    text-shadow: 0 2px 4px rgba(166,63,36,0.2), 0 0 8px #FFF;
}

@keyframes float-up-fade {
    0% { transform: translate(-50%, -50%) translateY(0) scale(0.8); opacity: 0; }
    20% { transform: translate(-50%, -50%) translateY(-20px) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) translateY(-80px) scale(0.9); opacity: 0; }
}

/* 粒子噴砂效果 */
.spark-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: spark-fly-fade 1.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes spark-fly-fade {
    0% { transform: translate(-50%, -50%) translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* ----------------------------------------------------
   3. 陽明式省察引導頁 (Reflection View)
   ---------------------------------------------------- */
.reflection-header {
    text-align: center;
    margin-bottom: 1.2rem;
}

.reflection-badge {
    align-self: center;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--yangming-red);
    background-color: rgba(166, 63, 36, 0.08);
    padding: 0.4rem 1.2rem;
    border-radius: 12px;
    border: 2px solid var(--yangming-red);
    box-shadow: 2px 2px 0px var(--yangming-red);
    display: inline-block;
}

.reflection-title {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--forest-deep);
    margin-top: 0.6rem;
}

/* 古色古香捲軸樣式 */
.ancient-scroll {
    background-color: #F4EFE6;
    border-left: 2px solid #D1C0A5;
    border-right: 2px solid #D1C0A5;
    padding: 2.2rem 1.8rem;
    position: relative;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 0 20px rgba(186, 172, 147, 0.3), var(--shadow-game);
    border-radius: 6px;
}

.scroll-wood {
    position: absolute;
    left: -8px;
    right: -8px;
    height: 12px;
    background: linear-gradient(90deg, #5c4033 0%, #8b5a2b 10%, #d2b48c 50%, #8b5a2b 90%, #5c4033 100%); /* 高級紅木/黃花梨木紋 */
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.scroll-wood::before, .scroll-wood::after {
    content: "";
    position: absolute;
    width: 9px;
    height: 16px;
    top: -3px;
    background: radial-gradient(circle, #FFE8A1 20%, #E5A823 80%, #7A5300 100%); /* 黃銅金屬軸頭 */
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 2px;
    box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.scroll-wood::before { left: -6px; }
.scroll-wood::after { right: -6px; }

.scroll-wood.top { top: -7px; }
.scroll-wood.bottom { bottom: -7px; }

.quote-mark {
    display: none; /* 古典書軸不使用西式雙引號，隱藏以臻古典純粹 */
}

.quote-text {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--yangming-red);
    line-height: 2.1;
    position: relative;
    z-index: 2;
    padding: 0.5rem 0;
    writing-mode: vertical-rl; /* 垂直書寫：從上到下，從右到左 */
    text-orientation: mixed;
    height: 195px; /* 固定直排高度 */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    letter-spacing: 0.22em;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.7);
}

.guidance-card {
    border: 2px solid var(--beige-dark);
    margin-bottom: 1.8rem;
}

.guidance-text {
    font-size: 0.98rem;
    color: var(--text-primary);
    text-align: justify;
    line-height: 1.8;
}

/* ----------------------------------------------------
   4. 結果頁 (Result View)
   ---------------------------------------------------- */
.result-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.result-main-title {
    font-family: 'Noto Serif TC', serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--forest-deep);
    letter-spacing: 0.05em;
    text-shadow: 2px 2px 0px rgba(34, 92, 60, 0.1);
}

/* 遊戲爐鼎展示 */
.gold-crucible-wrapper {
    position: relative;
    width: 175px;
    height: 175px;
}

.crucible-glow {
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    background-color: var(--gold-glow);
    filter: blur(15px);
    opacity: 0.55;
    z-index: 1;
    animation: pulse-glow 2.5s infinite alternate;
}

@keyframes pulse-glow {
    0% { transform: scale(0.9); opacity: 0.3; }
    100% { transform: scale(1.1); opacity: 0.8; }
}

/* 雙欄並排結果版面 */
.result-visual-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.2rem;
    margin: 0.5rem auto 1.5rem auto;
    width: 100%;
}

/* 左側：成色黃金展示球 */
.gold-purity-sphere {
    position: relative;
    width: 145px;
    height: 145px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 30% 30%, #FFFFFF 0%, #FAF6EE 60%, #E2DCCF 100%); /* 仿白玉/象牙質感 */
    border: 3.5px solid var(--forest-deep);
    padding: 15px;
    box-shadow: 6px 6px 0px var(--forest-deep);
    z-index: 2;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.gold-purity-sphere::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0) 100%); /* 3D水晶玻璃反光 */
    border-radius: 50%;
    pointer-events: none;
    z-index: 4;
}

.cartoon-gold {
    width: 68%;
    height: 68%;
    object-fit: contain;
    z-index: 2;
    filter: drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.12));
    transition: filter 0.8s ease-in-out;
}

/* 右側：迷你陽明先生同伴 */
.mini-ym-companion {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 180px;
    z-index: 2;
}

.mini-ym-box {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    border: 3px solid var(--forest-deep);
    overflow: hidden;
    background-color: var(--bg-base);
    box-shadow: 3px 3px 0px var(--forest-deep);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-bounce);
}

.mini-ym-box:hover {
    transform: scale(1.08) rotate(-4deg);
}

.mini-ym-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-ym-title-tag {
    font-family: 'Noto Serif TC', serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    background-color: var(--yangming-red);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 2px solid var(--forest-deep);
    box-shadow: 2px 2px 0px var(--forest-deep);
    margin-top: 0.5rem;
}

/* 陽明先生語錄氣泡 */
.mini-ym-bubble {
    position: relative;
    background: #FFF;
    border: 2.5px solid var(--forest-deep);
    border-radius: 14px;
    padding: 0.55rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--forest-deep);
    margin-bottom: 0.8rem;
    text-align: center;
    box-shadow: 3.5px 3.5px 0px var(--forest-deep);
    animation: bubble-float 3.5s ease-in-out infinite alternate;
}

/* 氣泡三角尖角 */
.mini-ym-bubble::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #FFF transparent;
    display: block;
    width: 0;
    z-index: 10;
}

.mini-ym-bubble::before {
    content: "";
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: var(--forest-deep) transparent;
    display: block;
    width: 0;
    z-index: 9;
}

@keyframes bubble-float {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-4px); }
}

.float-anim {
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0px); }
}

/* 圓餅圖疊加 */
.chart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.pie-chart {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.pie-bg {
    fill: none;
    stroke: rgba(22, 59, 38, 0.08);
    stroke-width: 2.8;
}

.pie-fill {
    fill: none;
    stroke: var(--gold-main);
    stroke-width: 2.8;
    stroke-linecap: round;
    transition: stroke-dasharray 1.2s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.8s ease;
}

/* 勳章數值 */
.purity-number {
    position: absolute;
    bottom: -10px;
    background-color: var(--forest-deep);
    color: #FFF;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    padding: 0.3rem 1rem;
    border-radius: 30px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 10px rgba(22, 59, 38, 0.3);
    border: 2px solid #FFF;
    pointer-events: auto;
    z-index: 4;
}

/* RPG 屬性面板 */
.rpg-stats-board {
    background-color: var(--bg-base);
    border: 2.5px solid var(--forest-deep);
    border-radius: var(--border-radius);
    padding: 1.2rem;
    margin-bottom: 1.2rem;
    box-shadow: 3px 3px 0px var(--forest-deep);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--forest-deep);
    width: 110px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot-gold { background-color: var(--gold-main); }
.dot-gray { background-color: var(--gray-dust); }

.stat-bar-outer {
    flex-grow: 1;
    height: 10px;
    background-color: rgba(22, 59, 38, 0.1);
    border-radius: 10px;
    border: 1.5px solid var(--forest-deep);
    overflow: hidden;
}

.stat-bar-inner {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-out;
}

.bar-gold {
    background: linear-gradient(90deg, var(--gold-main) 0%, #F5CE62 100%);
}

.bar-gray {
    background-color: var(--gray-dust);
}

.stat-val {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--forest-deep);
    width: 45px;
    text-align: right;
}

/* 成色分析詳情卡片 */
.analysis-card {
    border: 2.5px solid var(--forest-deep);
    box-shadow: 4px 4px 0px var(--forest-deep);
    margin-bottom: 1.8rem;
}

.analysis-level {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--yangming-red);
    text-align: center;
    margin-bottom: 0.8rem;
    letter-spacing: 0.05em;
}

.analysis-status {
    font-size: 0.95rem;
    color: var(--text-primary);
    text-align: justify;
    line-height: 1.7;
    margin-bottom: 1.2rem;
    border-bottom: 2px dashed var(--beige-dark);
    padding-bottom: 1rem;
}

.ym-comment-box, .practice-box {
    margin-bottom: 1.2rem;
}

.practice-box {
    margin-bottom: 0;
}

.comment-label, .practice-label {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--forest-deep);
    background-color: var(--bg-base);
    padding: 0.2rem 0.7rem;
    border-radius: 6px;
    border: 1.5px solid var(--forest-deep);
    margin-bottom: 0.6rem;
}

.comment-label {
    color: var(--yangming-red);
    background-color: rgba(166, 63, 36, 0.05);
    border-color: var(--yangming-red);
}

.ym-comment-text {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--yangming-red);
    line-height: 1.6;
    padding-left: 0.8rem;
    border-left: 3px solid var(--yangming-red);
}

.practice-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.65;
    text-align: justify;
}

/* 總綱開示樣式 */
.analysis-general-box {
    background-color: var(--forest-pale);
    border: 2px solid var(--forest-light);
    border-radius: 16px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 0 10px rgba(34, 92, 60, 0.05);
}

.general-title {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--forest-deep);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.general-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.65;
    text-align: justify;
}

/* 成色與分兩之辨樣式 */
.analysis-alchemy-box {
    background-color: #F8F4EC;
    border: 2px solid var(--beige-dark);
    border-left: 5px solid var(--gold-main);
    border-radius: 16px;
    padding: 1.3rem;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 0 12px rgba(212, 168, 35, 0.04), 2px 2px 6px rgba(0,0,0,0.02);
}

.alchemy-title {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--yangming-red);
    margin-bottom: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.alchemy-text {
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.7;
    text-align: justify;
}

.alchemy-text strong {
    color: var(--yangming-red);
}

/* 結尾黃金成色動態等級特效 */
.gold-purity-sphere.gold-rank-1 {
    box-shadow: 0 0 25px rgba(229, 168, 35, 0.7), 4px 4px 0px var(--forest-deep) !important;
    border-color: var(--gold-main) !important;
    animation: gold-glow-pulse 2s infinite alternate;
}

.gold-purity-sphere.gold-rank-2 {
    box-shadow: 0 0 20px rgba(245, 206, 98, 0.6), 4px 4px 0px var(--forest-deep) !important;
    border-color: #F5CE62 !important;
    animation: warm-glow-pulse 2s infinite alternate;
}

.gold-purity-sphere.gold-rank-3 {
    box-shadow: 0 0 20px rgba(217, 109, 26, 0.55), 4px 4px 0px var(--forest-deep) !important;
    border-color: #DCA725 !important;
    animation: fire-glow-pulse 2s infinite alternate;
}

.gold-purity-sphere.gold-rank-4 {
    box-shadow: 0 0 15px rgba(181, 166, 142, 0.45), 4px 4px 0px var(--forest-deep) !important;
    border-color: #B5A68E !important;
    animation: bronze-glow-pulse 2s infinite alternate;
}

.gold-purity-sphere.gold-rank-5 {
    box-shadow: 0 0 12px rgba(143, 160, 151, 0.35), 4px 4px 0px var(--forest-deep) !important;
    border-color: var(--gray-dust) !important;
}

@keyframes gold-glow-pulse {
    0% { box-shadow: 0 0 15px rgba(229, 168, 35, 0.5), 4px 4px 0px var(--forest-deep); }
    100% { box-shadow: 0 0 30px rgba(229, 168, 35, 0.9), 4px 4px 0px var(--forest-deep); }
}

@keyframes warm-glow-pulse {
    0% { box-shadow: 0 0 12px rgba(245, 206, 98, 0.4), 4px 4px 0px var(--forest-deep); }
    100% { box-shadow: 0 0 25px rgba(245, 206, 98, 0.8), 4px 4px 0px var(--forest-deep); }
}

@keyframes fire-glow-pulse {
    0% { box-shadow: 0 0 10px rgba(217, 109, 26, 0.4), 4px 4px 0px var(--forest-deep); }
    100% { box-shadow: 0 0 25px rgba(217, 109, 26, 0.75), 4px 4px 0px var(--forest-deep); }
}

@keyframes bronze-glow-pulse {
    0% { box-shadow: 0 0 8px rgba(181, 166, 142, 0.3), 4px 4px 0px var(--forest-deep); }
    100% { box-shadow: 0 0 20px rgba(181, 166, 142, 0.6), 4px 4px 0px var(--forest-deep); }
}

/* 古典玉佩掛飾樣式 */
.jade-pendant {
    position: absolute;
    top: 0px;
    right: 42px;
    width: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    transform-origin: top center;
    animation: pendant-sway 4.5s ease-in-out infinite;
    pointer-events: none;
}

.red-string-top {
    width: 2.5px;
    height: 18px;
    background-color: var(--yangming-red);
}

.pendant-knot {
    width: 9px;
    height: 9px;
    background-color: var(--yangming-red);
    border-radius: 50%;
    border: 1px solid var(--forest-deep);
}

.jade-stone {
    position: relative;
    width: 24px;
    height: 24px;
    background: radial-gradient(circle, #A6E2BB 0%, #2A7C4B 100%);
    border: 2.5px solid var(--forest-deep);
    border-radius: 50%;
    box-shadow: 0 3px 6px rgba(22, 59, 38, 0.15);
    margin: 1px 0;
}

.jade-stone::after {
    content: "";
    position: absolute;
    top: 6px;
    left: 6px;
    width: 7px;
    height: 7px;
    background-color: var(--bg-paper);
    border: 2px solid var(--forest-deep);
    border-radius: 50%;
}

.red-tassel {
    width: 5px;
    height: 28px;
    background: linear-gradient(180deg, var(--yangming-red) 70%, #d16e54 100%);
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    border-left: 1px solid var(--forest-deep);
    border-right: 1px solid var(--forest-deep);
}

@keyframes pendant-sway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* 四角古典邊框裝飾 */
.corner-bracket {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid var(--gold-main); /* 奢華黃銅金邊裝飾 */
    border-image: linear-gradient(135deg, #FFE8A1 0%, var(--gold-main) 40%, #B8850C 70%, #7A5300 100%) 1;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 0 5px rgba(229, 168, 35, 0.15);
}

.cb-tl { top: 16px; left: 16px; border-right: none; border-bottom: none; }
.cb-tr { top: 16px; right: 16px; border-left: none; border-bottom: none; }
.cb-bl { bottom: 16px; left: 16px; border-right: none; border-top: none; }
.cb-br { bottom: 16px; right: 16px; border-left: none; border-top: none; }

/* 水墨印章浮水印 */
.watermark-seal {
    position: absolute;
    bottom: 12px;
    right: 15px;
    font-family: 'Noto Serif TC', serif;
    font-size: 3.6rem;
    font-weight: 900;
    color: rgba(166, 63, 36, 0.035);
    border: 2.5px solid rgba(166, 63, 36, 0.035);
    padding: 0.2rem 0.6rem;
    line-height: 1;
    border-radius: 6px;
    pointer-events: none;
    user-select: none;
    z-index: 1;
    transform: rotate(-10deg);
}

/* ----------------------------------------------------
   頁尾 (Footer)
   ---------------------------------------------------- */
.app-footer {
    margin-top: 1.5rem;
    text-align: center;
    border-top: 2px solid rgba(22, 59, 38, 0.08);
    padding-top: 1rem;
}

.app-footer p {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* 行動裝置優化 */
@media (max-width: 600px) {
    #app-container {
        min-height: 100vh;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        padding: 1.5rem;
        box-shadow: none;
        border-top: 4px double var(--forest-deep); /* 簡化頂部雙線 */
    }
    
    .jade-pendant {
        display: none !important; /* 手機端隱藏玉佩，完全防止遮擋字 */
    }
    
    .corner-bracket {
        width: 14px;
        height: 14px;
        border-width: 2px;
        top: 10px;
        left: 10px;
    }
    .cb-tr { top: 10px; right: 10px; }
    .cb-bl { bottom: 10px; left: 10px; }
    .cb-br { bottom: 10px; right: 10px; }
    
    .main-title {
        font-size: 2.4rem;
    }
    
    .question-text {
        font-size: 1.05rem;
    }
    
    .option-btn {
        padding: 0.9rem 1.1rem;
        font-size: 0.9rem;
    }
    
    .quote-text {
        font-size: 1.05rem;
    }
    
    .analysis-card {
        padding: 1.2rem;
    }
    
    .purity-tracker {
        gap: 0.2rem;
    }
    
    .tracker-dot {
        width: 19px;
        height: 19px;
        font-size: 0.65rem;
    }
}
