:root {
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    --secondary-color: #f43f5e;
    /* Rose 500 */
    --accent-color: #06b6d4;
    /* Cyan 500 */
    --bg-color: #020617;
    /* Slate 950 */
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-hover: rgba(255, 255, 255, 0.08);

    --success-color: #10b981;
    --error-color: #f43f5e;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Noto Sans TC', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* Background Animations */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: move 20s infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    background: var(--primary-color);
    width: 45vw;
    height: 45vw;
    opacity: 0.15;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    background: var(--secondary-color);
    width: 40vw;
    height: 40vw;
    opacity: 0.12;
    animation-delay: -5s;
}

.blob-3 {
    top: 30%;
    right: 20%;
    background: var(--accent-color);
    width: 25vw;
    height: 25vw;
    opacity: 0.08;
    animation-duration: 25s;
}

@keyframes move {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(50px, 20px);
    }
}

/* Glass Container */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-width: 1000px;
    width: 95%;
    position: relative;
    z-index: 10;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 3rem;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.header-titles {
    text-align: left;
    flex: 0 0 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    height: 64px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
    white-space: nowrap;
    word-break: normal;
}

header p {
    color: var(--text-muted);
    letter-spacing: 1px;
    font-size: 1.1rem;
    font-weight: 500;
}

.header-text {
    min-width: 0;
    overflow: hidden;
    flex: 1;
}

.header-subtitle {
    font-size: 0.75rem !important;
    color: rgba(148, 163, 184, 0.6) !important;
    letter-spacing: 0.5px !important;
    font-weight: 400 !important;
    margin-top: 0.1rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.header-auth {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 20px;
    min-width: 280px;
    max-width: 320px;
}

.auth-inline {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.input-group-compact {
    position: relative;
    flex: 1;
}

.form-input-compact {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.6rem 0.75rem 0.6rem 0.2rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: var(--font-body);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input-compact:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.button-row {
    display: flex;
    gap: 0.5rem;
}

.primary-btn-compact {
    flex: 2;
    padding: 0.6rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.primary-btn-compact:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.2);
    filter: brightness(1.1);
}

.secondary-btn-compact {
    flex: 1.2;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    border-radius: 10px;
    font-size: 0.8rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn-compact:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.user-info-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
}

/* Dashboard Grid */
.info-collapse {
    margin-bottom: 1.5rem;
}

.info-toggle {
    width: 100%;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text-muted);
    padding: 0.85rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

.info-toggle:hover {
    background: rgba(30, 41, 59, 0.65);
    border-color: rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
}

.info-toggle .toggle-arrow {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
    opacity: 0.6;
}

.info-toggle.open {
    border-radius: 16px 16px 0 0;
    border-bottom-color: transparent;
}

.info-toggle.open .toggle-arrow {
    transform: rotate(180deg);
}

.info-body {
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid var(--glass-border);
    border-top: none;
    border-radius: 0 0 16px 16px;
    padding: 1.2rem 1.5rem 1.4rem;
    font-size: 0.88rem;
    line-height: 1.85;
    color: var(--text-muted);
}

.info-section {
    margin-bottom: 0.9rem;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section strong {
    color: #94a3b8;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.info-body ul {
    margin: 0.4rem 0 0 1.1rem;
    padding: 0;
}

.info-body li {
    margin-bottom: 0.3rem;
}

.announcement-list {
    margin: 0 !important;
    padding: 0 0 0 1.1rem !important;
    list-style: disc;
    max-height: calc(5 * 1.8rem);
    overflow-y: auto;
}

.announcement-list li {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
}

.announce-date {
    font-weight: 600;
    margin-right: 0.4rem;
}

.announce-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0.6rem;
    font-weight: 400;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.announcement-toggle.open .announce-preview {
    display: none;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card:hover {
    background: var(--card-hover);
    transform: translateY(-8px);
    border-color: var(--primary-color);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.3));
}

.card h2 {
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-family: var(--font-heading);
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Quiz View */
.hidden {
    display: none !important;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
}

.back-btn:hover {
    color: #fff;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-controls select {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    cursor: pointer;
}

.filter-controls select option {
    background: var(--bg-color);
    color: var(--text-main);
}

.inline-filters {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.year-input {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 0.5rem;
    border-radius: 8px;
    width: 80px;
    font-family: inherit;
}

.filter-controls span {
    margin: 0 0.2rem;
}

.question-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    /* For badge positioning */
}

.source-badge {
    position: absolute;
    top: -28px;
    right: 20px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    z-index: 10;
    transition: all 0.3s ease;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
    color: #fff;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.explanation-text {
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    text-align: left !important;
}

.explanation-text * {
    text-align: left !important;
}

.explanation-text p,
.explanation-text li {
    margin-bottom: 0.2rem;
}

.explanation-text h1,
.explanation-text h2,
.explanation-text h3 {
    margin-top: 0.4rem;
    margin-bottom: 0.2rem;
    font-size: 1.1rem;
}

.explanation-text ul,
.explanation-text ol {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.explanation-text img {
    max-width: min(300px, 100%) !important;
    height: auto !important;
    border-radius: 8px;
    margin: 0.5rem 0;
    display: block;
}

.acupoint-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.acupoint-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.acupoint-item strong {
    font-size: 0.9rem;
}

.acupoint-item img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px;
    display: block;
    margin: 0 !important;
}

/* ── 考試模式題號格 ── */
.question-navigator {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.navigator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.navigator-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.1rem 0.3rem;
}

.navigator-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.nav-btn {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.15s, border-color 0.15s;
}
.nav-btn:hover { background: rgba(255,255,255,0.12); }
.nav-btn.nav-current { border-color: var(--accent); color: var(--accent); font-weight: 700; box-shadow: 0 0 0 1px var(--accent); }
.nav-btn.nav-correct { background: rgba(74,222,128,0.18); border-color: #4ade80; color: #4ade80; }
.nav-btn.nav-wrong   { background: rgba(248,113,113,0.18); border-color: #f87171; color: #f87171; }

/* 送出按鈕 */
.submit-session-btn {
    background: rgba(74,222,128,0.12);
    border: 1px solid #4ade80;
    color: #4ade80;
    padding: 0.55rem 1.3rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.submit-session-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.submit-session-btn:not(:disabled):hover { background: rgba(74,222,128,0.25); }

/* 分數 modal */
.score-display {
    font-size: 3.2rem;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    color: var(--accent);
}
.score-detail {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.7;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.option-btn {
    display: block;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.option-btn.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.option-btn.correct {
    background: var(--success-color);
    border-color: var(--success-color);
}

.option-btn.wrong {
    background: var(--error-color);
    border-color: var(--error-color);
}

.explanation-card {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease;
}

.answer-row {
    margin: 1rem 0;
    font-weight: bold;
}

.correct-badge {
    color: var(--success-color);
    font-size: 1.2rem;
    margin-left: 0.5rem;
}

.primary-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.primary-btn:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-color) 100%);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.secondary-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.reference-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.ref-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ref-content {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.6;
    opacity: 0.95;
    white-space: pre-wrap;
}

.exam-info {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.15rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

#question-id-display {
    font-size: 0.85rem;
}

.difficulty-badge {
    display: inline-block;
    padding: 0.15rem 0.65rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    margin-right: 0.4rem;
    letter-spacing: 0.05em;
}

.difficulty-badge.diff-easy {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.difficulty-badge.diff-medium {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.difficulty-badge.diff-hard {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.session-progress {
    display: inline-block;
    padding: 0.15rem 0.65rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.year-range-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.year-range-row .full-width-select {
    flex: 1;
    min-width: 0;
    width: auto;
}

.year-range-sep {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* User & Stats Styles */
.user-nav {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
    gap: 1rem;
}

.user-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.analysis-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
}

#ai-analysis-content h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.8rem 0 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

#ai-analysis-content h2:first-child {
    margin-top: 0.2rem;
}

#ai-analysis-content p {
    margin: 0.4rem 0 0.8rem;
    line-height: 1.75;
}

#ai-analysis-content ul {
    margin: 0.4rem 0 0.8rem 0;
    padding-left: 1.2rem;
}

#ai-analysis-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.subject-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.subject-bar-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.5s ease-in-out;
}

/* iPad 及平板（600px - 1024px） */
@media (max-width: 1024px) and (min-width: 600px) {
    .glass-container {
        width: 100%;
        min-height: 100vh;
        border-radius: 0;
        border: none;
        padding: 1.5rem;
        max-width: none;
    }

    header {
        margin-bottom: 1.5rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .header-en-subtitle {
        display: none;
    }

    .card-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.2rem;
    }

    .card {
        padding: 2rem 1.5rem;
    }
}

/* 手機（max 599px） */
@media (max-width: 599px) {
    .glass-container {
        width: 100%;
        min-height: 100vh;
        border-radius: 0;
        border: none;
        padding: clamp(0.6rem, 2vw, 0.8rem);
        max-width: none;
        overflow-x: hidden;
    }

    header {
        margin-bottom: clamp(0.6rem, 2vw, 1rem);
    }

    .header-main {
        flex-direction: column;
        align-items: stretch;
        gap: clamp(0.6rem, 2vw, 0.8rem);
    }

    .header-titles {
        width: 100%;
        min-width: 0;
    }

    header h1 {
        font-size: clamp(1.4rem, 8vw, 2.5rem);
        margin-bottom: 0;
        white-space: nowrap;
        line-height: 1.1;
    }

    .title-line1, .title-line2 {
        display: inline;
    }

    .header-en-subtitle,
    .header-subtitle {
        display: none;
    }

    .header-logo {
        height: clamp(40px, 11vw, 56px);
    }

    header p {
        font-size: clamp(0.72rem, 2vw, 0.8rem);
        letter-spacing: 0.5px;
        margin: 0;
    }

    .header-auth {
        min-width: auto;
        max-width: none;
        width: 100%;
        padding: clamp(0.5rem, 1.5vw, 0.6rem) clamp(0.2rem, 1vw, 0.3rem);
        background: rgba(30, 41, 59, 0.4);
        border: 1px solid var(--glass-border);
        border-radius: clamp(12px, 3vw, 16px);
    }

    .auth-inline {
        gap: clamp(0.3rem, 1vw, 0.4rem);
    }

    .input-group-compact {
        width: 100%;
    }

    .form-input-compact {
        font-size: clamp(1rem, 3vw, 1.2rem);
        padding: clamp(0.4rem, 1.2vw, 0.5rem) 0.5rem;
        width: 100%;
        border-radius: clamp(8px, 2vw, 10px);
    }

    .primary-btn-compact {
        font-size: clamp(0.9rem, 2.5vw, 1rem);
        padding: clamp(0.3rem, 1vw, 0.4rem);
        flex: 1 !important;
        border-radius: clamp(8px, 2vw, 10px);
    }

    .button-row {
        gap: clamp(0.3rem, 1vw, 0.4rem);
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: clamp(0.6rem, 2vw, 0.8rem);
    }

    .card {
        padding: clamp(1.2rem, 3vw, 1.5rem) clamp(0.8rem, 2.5vw, 1rem);
        border-radius: clamp(14px, 3vw, 16px);
    }
}

/* Selection Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-left: 0.2rem;
}

.full-width-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.full-width-select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.full-width-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.full-width-select option {
    background: var(--bg-color);
    color: var(--text-main);
    padding: 10px;
}

/* Question Context Block (題組背景) */
.question-context-block {
    background: rgba(99, 102, 241, 0.08);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    animation: fadeIn 0.4s ease-out;
}

.context-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.context-label::before {
    content: '';
    font-size: 0.9rem;
}

.context-content {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-main);
    opacity: 0.9;
    font-style: italic;
}

/* ── Explanation Actions Bar ── */
.explanation-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.65rem 1.1rem;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    margin-top: 0.75rem;
}
.rating-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.rating-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}
.rating-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.3rem 0.75rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.18s;
    line-height: 1.4;
    color: var(--text-main);
}
.rating-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.3);
}
.rating-btn.active-like {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}
.rating-btn.active-dislike {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}
.feedback-inline-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.3rem 0.85rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
    flex-shrink: 0;
}
.feedback-inline-btn:hover {
    border-color: #e67e22;
    color: #e67e22;
    background: rgba(230, 126, 34, 0.08);
}
.rating-hint {
    font-size: 0.78rem;
    color: #f59e0b;
    opacity: 0.85;
    white-space: nowrap;
}

@keyframes hint-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-4px); }
    40%       { transform: translateX(4px); }
    60%       { transform: translateX(-3px); }
    80%       { transform: translateX(3px); }
}
.hint-shake { animation: hint-shake 0.4s ease; }

/* ── Next Button Disabled ── */
.primary-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    filter: none !important;
}

/* ── Feedback Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.modal-box {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 1.6rem;
    width: min(440px, 92vw);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
}
.modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal-close-btn {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}
.modal-close-btn:hover { color: var(--text-main); }
.modal-subtitle { margin: 0; font-size: 0.82rem; color: var(--text-muted); }
.feedback-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.feedback-check-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-main);
}
.feedback-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
}
.modal-box textarea {
    width: 100%;
    border: 1px solid rgba(128,128,128,0.35);
    border-radius: 8px;
    padding: 0.7rem;
    font-size: 0.9rem;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}
.modal-box textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}
.modal-box input[type="email"] {
    width: 100%;
    border: 1px solid rgba(128,128,128,0.35);
    border-radius: 8px;
    padding: 0.7rem;
    font-size: 0.9rem;
    font-family: inherit;
    box-sizing: border-box;
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}
.modal-box input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
}
.modal-actions {
    display: flex;
    gap: 0.7rem;
    justify-content: flex-end;
}
.modal-cancel-btn {
    background: none;
    border: 1px solid rgba(128,128,128,0.4);
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
}
.modal-cancel-btn:hover { border-color: var(--text-muted); color: var(--text-main); }
.modal-submit-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    border: none;
    color: #fff;
    border-radius: 8px;
    padding: 0.5rem 1.6rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.modal-submit-btn:hover { opacity: 0.9; }
