        :root {
            --bg-paper: #fdfaf5;
            --primary-text: #3e3a39;
            --accent-red: #b22d30;
            --accent-blue: #2a5caa;
            --correct-green: #407434;
            --start-gradient: linear-gradient(135deg, #3b7a8d, #5d4a9e);
            --exam-gradient: linear-gradient(135deg, #b22d30, #d96459);
            --gold-glow: rgba(255, 215, 0, 0.3);
            --gold-border: rgba(255, 215, 0, 0.8);
            --card-bg: #ffffff;
        }

        body {
            background-color: var(--bg-paper);
            background-image: radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
            background-size: 20px 20px;
            text-align: center;
            font-family: "Noto Serif TC", "Microsoft JhengHei", serif;
            margin: 0; padding: 20px; color: var(--primary-text);
            overflow-x: hidden; 
        }
        #stat-bar, #exam-bar {
            display: none; 
            justify-content: center;
            align-items: center;
            gap: 30px; 
            font-size: 16px; 
            color: #666; 
            background: white;
            padding: 12px 30px;
            border-radius: 30px;
            max-width: 500px;
            margin: 0 auto 20px auto; 
            box-shadow: 0 5px 15px rgba(0,0,0,0.03);
            border: 1px solid #eee;
        }
        .stat-val { color: var(--accent-red); font-weight: bold; font-size: 20px; margin-left: 5px; }
        
        .nav-btn {
            background: #fdfaf5; border: 1px solid var(--accent-red); 
            border-radius: 15px; padding: 5px 15px; cursor: pointer; 
            color: var(--accent-red); font-size: 14px; font-weight: bold;
            transition: all 0.3s ease;
        }
        .nav-btn:hover { background: var(--accent-red); color: white; }
        #home-page, #summary-page {
            max-width: 650px; margin: 80px auto; padding: 45px;
            background: white; border-radius: 30px; 
            box-shadow: 0 15px 50px rgba(0,0,0,0.05);
            border-top: 6px solid var(--accent-red);
            line-height: 1.8; display: none;
            box-sizing: border-box;
        }
        .home-title { font-size: 36px; margin-bottom: 25px; letter-spacing: 6px; font-weight: bold; }
        .home-desc p { margin-bottom: 18px; text-align: justify; }
        .score-display { font-size: 60px; color: var(--accent-red); font-weight: bold; margin: 10px 0; }
        .score-rank { font-size: 24px; color: var(--correct-green); font-weight: bold; margin-bottom: 10px; }
        .score-stars { font-size: 32px; margin-bottom: 20px; letter-spacing: 5px; }
        .score-details { background: #f9f9f9; padding: 15px; border-radius: 15px; margin-bottom: 25px; text-align: left; width: 80%; margin-left: auto; margin-right: auto; }
        .score-details div { font-size: 16px; margin-bottom: 8px; border-bottom: 1px dashed #ccc; padding-bottom: 5px; }
        .tab-nav { margin-bottom: 20px; display: none; justify-content: center; gap: 12px; flex-wrap: wrap; }
        .tab-btn {
            padding: 10px 25px; font-size: 17px; font-weight: bold; cursor: pointer;
            border: 2px solid #ddd; background: white; border-radius: 30px; transition: all 0.3s; font-family: inherit;
        }
        .tab-btn.active { background: var(--start-gradient); color: white; border-color: transparent; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
        #modal-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.6); display: none; align-items: center;
            justify-content: center; z-index: 2000; backdrop-filter: blur(4px);
        }
        .modal-content {
            background: white; padding: 35px; border-radius: 25px; text-align: center; 
            min-width: 320px; box-shadow: 0 20px 50px rgba(0,0,0,0.3);
            animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            box-sizing: border-box; max-width: 90%;
        }
        @keyframes modalPop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
        .page { display: none; max-width: 1000px; margin: 0 auto; width: 100%; }
        .page.active { display: block; }
        
        .question-card { 
            background: var(--card-bg); padding: 25px; border-radius: 15px; 
            display: inline-block; width: 90%; max-width: 420px; 
            box-shadow: 0 10px 30px rgba(0,0,0,0.05); border-bottom: 4px solid #eee; 
            margin-bottom: 25px; box-sizing: border-box;
        }
        .mode-tip { font-size: 14px; color: #666; background: #f1f1f1; padding: 6px 18px; border-radius: 20px; margin-top: 10px; display: none; border: 1px solid #e0e0e0; }
        .main-btn { padding: 12px 35px; font-size: 18px; font-weight: bold; cursor: pointer; border: none; border-radius: 30px; transition: all 0.3s ease; color: white; font-family: inherit; }
        .btn-start { background: var(--start-gradient); }
        .btn-exam { background: var(--exam-gradient); }
        .btn-next { background: var(--correct-green); }
        .btn-retry { background: var(--accent-red); }
        .line-container { margin-bottom: 8px; }
        .line { height: 8px; margin: 4px 0; width: 55px; display: flex; justify-content: space-between; }
        .line.yang { background: #1a1a1a; border-radius: 2px; }
        .line.yin::before, .line.yin::after { content: ""; width: 42%; height: 100%; background: #1a1a1a; border-radius: 2px; }
        .bagua-circle { 
            position: relative; width: 500px; height: 500px; 
            left: 50%; transform: translateX(-50%);
            border: 2px solid rgba(0,0,0,0.03); border-radius: 50%; 
            background-image: url('4shune.png'); background-repeat: no-repeat; 
            background-position: center center; background-size: 250px 250px; 
            background-color: rgba(255, 255, 255, 0.2); 
        }
        .trigram-item { position: absolute; width: 85px; height: 95px; cursor: pointer; transition: all 0.3s ease; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 15px; }
        .trigram-item:hover { background: var(--gold-glow); box-shadow: 0 0 20px var(--gold-border); transform: scale(1.15); z-index: 10;}
        .hex-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; max-width: 850px; margin: 20px auto; }
        
        .hex-option, .pair-card { background: white; border: 1px solid #eee; padding: 20px 10px; border-radius: 15px; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; }
        .hex-option:hover, .pair-card:hover { background: var(--gold-glow); box-shadow: 0 0 15px var(--gold-border); border-color: var(--gold-border); transform: translateY(-3px); }
        .pair-card.selected { border-color: var(--accent-blue); background: var(--gold-glow); box-shadow: 0 0 20px var(--gold-border); }
        .pair-card.matched { opacity: 0; pointer-events: none; }

        .mode-cuo { color: var(--accent-red); font-weight: 800; border-bottom: 2px solid var(--accent-red); }
        .mode-zong { color: var(--accent-blue); font-weight: 800; border-bottom: 2px solid var(--accent-blue); }
        @media (max-width: 600px) {
            .hex-grid { grid-template-columns: repeat(2, 1fr); padding: 0 10px;}
        }

        @media (max-width: 550px) {
            .bagua-circle { transform: translateX(-50%) scale(0.7); margin-top: -60px; margin-bottom: -60px; }
            #home-page, #summary-page { margin: 30px auto; padding: 25px; }
            .home-title { font-size: 28px; letter-spacing: 4px; }
            .score-display { font-size: 48px; }
            .score-details { width: 100%; }
            #stat-bar, #exam-bar { flex-direction: column; gap: 10px; padding: 15px; border-radius: 20px;}
            .tab-btn { padding: 8px 16px; font-size: 15px; }
        }

        @media (max-width: 400px) {
            .bagua-circle { transform: translateX(-50%) scale(0.6); margin-top: -90px; margin-bottom: -90px; }
            .question-card { padding: 15px; }
            .question-card h2 { font-size: 20px; }
        }

        @media (max-width: 350px) {
            .bagua-circle { transform: translateX(-50%) scale(0.5); margin-top: -110px; margin-bottom: -110px; }
        }