/* ============================================
   書庫（單字）頁面樣式
   沿用五十音表視覺語言（chart-table），加上卷物主題
   ============================================ */

.vocab-hero {
    text-align: center;
    margin: 0 auto 2rem;
    max-width: 760px;
    padding: 0 1rem;
}
.vocab-hero .level-tag {
    display: inline-block;
    background: var(--accent-primary);
    color: #fff;
    font-size: 0.7rem;
    letter-spacing: .08em;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    margin-bottom: 0.6rem;
}
.vocab-hero h1 {
    font-size: 1.9rem;
    color: var(--accent-primary);
    margin: 0.3rem 0;
}
.vocab-hero .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* 卷物卡片格 */
.scroll-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
    max-width: 980px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}
.scroll-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.scroll-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-primary);
    box-shadow: 0 8px 20px var(--shadow-color);
}
.scroll-card .scroll-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.2rem;
}
.scroll-card .scroll-label {
    font-size: 0.9rem;
    color: var(--text-primary);
}
.scroll-card .scroll-count {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* 單字表 */
.vocab-table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; text-align: left;
    background: var(--bg-secondary); border-radius: 10px; overflow: hidden;
    box-shadow: 0 4px 6px var(--shadow-color); }
.vocab-table th, .vocab-table td {
    padding: 10px 12px; border: 1px solid var(--border-color); text-align: left;
}
.vocab-table th {
    background: var(--accent-primary); color: #fff; font-weight: 600;
    font-size: 0.85rem; white-space: nowrap;
}
.vocab-table td { font-size: 0.95rem; vertical-align: middle; }
.vocab-table tr:hover td { background: var(--bg-tertiary, rgba(0,0,0,.03)); }
.vocab-table .w-word { font-size: 1.25rem; font-weight: 700; white-space: nowrap; }
.vocab-table .w-kana { color: var(--accent-primary); white-space: nowrap; }
.vocab-table .w-romaji { color: var(--text-secondary); font-size: 0.85rem; white-space: nowrap; }
.vocab-table .w-ex { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.6; }
.vocab-table .w-ex .ex-zh { display: block; opacity: .75; }

/* 卷物間導航 */
.scroll-nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
    max-width: 760px; margin: 2rem auto; padding: 0 1rem;
}
.scroll-nav a {
    display: block; padding: 0.9rem 1rem; border: 1px solid var(--border-color);
    border-radius: 12px; text-decoration: none; color: inherit;
    background: var(--bg-secondary); transition: border-color .18s;
}
.scroll-nav a:hover { border-color: var(--accent-primary); }
.scroll-nav .nav-label { font-size: .7rem; color: var(--text-secondary); display: block; }
.scroll-nav .nav-name { font-weight: 600; }
.scroll-nav .next { text-align: right; }

/* 試煉入口 */
.quiz-cta {
    max-width: 760px; margin: 2rem auto; padding: 1.3rem 1.4rem;
    background: linear-gradient(135deg, #8B0000 0%, #a83232 100%);
    color: #fff; border-radius: 16px; text-align: center;
}
.quiz-cta h2 { margin: 0 0 .4rem; font-size: 1.15rem; color: #fff; }
.quiz-cta p { margin: 0 0 .9rem; font-size: .85rem; opacity: .9; }
.quiz-cta a {
    display: inline-block; background: #fff; color: #8B0000; font-weight: 700;
    padding: .6rem 1.4rem; border-radius: 999px; text-decoration: none;
}

/* 測驗畫面 */
.quiz-box { max-width: 620px; margin: 0 auto; padding: 0 1rem; }
.quiz-progress { display: flex; justify-content: space-between; font-size: .85rem;
    color: var(--text-secondary); margin-bottom: .8rem; }
.quiz-question { text-align: center; margin: 1.5rem 0 1.8rem; }
.quiz-question .q-type { font-size: .78rem; color: var(--text-secondary); }
.quiz-question .q-main { font-size: 2.1rem; font-weight: 700; margin: .6rem 0; }
.quiz-question .q-sub { font-size: .95rem; color: var(--accent-primary); }
.quiz-options { display: grid; gap: .7rem; }
.quiz-option {
    padding: .85rem 1rem; border: 2px solid var(--border-color); border-radius: 12px;
    background: var(--bg-secondary); cursor: pointer; font-size: 1rem;
    text-align: left; transition: all .15s; width: 100%;
}
.quiz-option:hover:not(:disabled) { border-color: var(--accent-primary); }
.quiz-option.correct { border-color: #2e7d32; background: #e8f5e9; color: #1b5e20; }
.quiz-option.wrong { border-color: #c62828; background: #ffebee; color: #b71c1c; }
.quiz-option:disabled { cursor: default; }

.quiz-result { text-align: center; }
.quiz-result .score { font-size: 3rem; font-weight: 700; color: var(--accent-primary); }
.quiz-result .qbei-say {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1rem; margin: 1.2rem 0; font-size: .95rem;
}
.wrong-list { text-align: left; margin: 1.2rem 0; }
.wrong-list li { padding: .5rem 0; border-bottom: 1px solid var(--border-color); font-size: .9rem; }

@media (max-width: 640px) {
    /* 手機版：表格轉為堆疊卡片（5 欄在小螢幕會被切掉）*/
    .vocab-table, .vocab-table tbody, .vocab-table tr, .vocab-table td { display: block; width: 100%; }
    .vocab-table thead { display: none; }
    .vocab-table { box-shadow: none; background: transparent; }
    .vocab-table tr {
        text-align: left;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: .8rem .9rem;
        margin-bottom: .7rem;
        box-shadow: 0 2px 4px var(--shadow-color);
    }
    .vocab-table td { border: none; padding: 0; }
    .vocab-table .w-word { display: inline; font-size: 1.35rem; margin-right: .5rem; }
    .vocab-table .w-kana { display: inline; font-size: .95rem; margin-right: .4rem; }
    .vocab-table .w-romaji { display: inline; font-size: .8rem; }
    .vocab-table td:nth-child(4) {
        display: block; margin-top: .35rem; font-weight: 600; font-size: 1rem;
    }
    .vocab-table .w-ex {
        display: block; margin-top: .45rem; padding-top: .45rem;
        border-top: 1px dashed var(--border-color); font-size: .82rem;
    }
    .vocab-table tr:hover td { background: transparent; }

    .scroll-nav { grid-template-columns: 1fr; }
    .vocab-hero h1 { font-size: 1.5rem; }
    .quiz-question .q-main { font-size: 1.7rem; }
    .scroll-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
