/* 考生區（登入後）共用樣式：與首頁同一套配色。只依賴本站的 Bootstrap 5.3 / Bootstrap Icons。 */
:root {
    --ink: #0f172a;
    --muted: #5b6475;
    --line: #e6e9ef;
    --paper: #f6f8fb;
    --navy: #0b2545;
    --navy-2: #13315c;
    --primary: #1d4ed8;
    --primary-dark: #1e3a8a;
    --primary-soft: #eef3ff;
    --accent: #f5b301;
    --ok: #15803d;
    --ok-soft: #e7f7ec;
    --bad: #b42318;
    --bad-soft: #fdecec;
    --radius: 14px;
    --bs-primary: #1d4ed8;
    --bs-link-color: #1d4ed8;
    --bs-link-hover-color: #1e3a8a;
}
html { scroll-padding-top: 76px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
a { text-decoration: none; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid #93b4ff; outline-offset: 2px; }
.container-xl { max-width: 1180px; }

/* ── 頂部導覽 ── */
.cz-nav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1030; }
.cz-nav .inner { display: flex; align-items: center; gap: 1rem; height: 64px; }
.cz-brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; color: var(--navy); white-space: nowrap; }
.cz-brand img { width: 32px; height: 32px; border-radius: 9px; }
.cz-tabs { display: flex; gap: .25rem; margin-left: 1rem; }
.cz-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .85rem; border-radius: 9px; color: #3b4455; font-weight: 600; font-size: .95rem; }
.cz-tab:hover { background: var(--primary-soft); color: var(--primary); }
.cz-tab.active { background: var(--primary-soft); color: var(--primary); }
.cz-user { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .92rem; color: var(--muted); }
.cz-user .name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 手機底部分頁列 ── */
.cz-bottom { display: none; }
@media (max-width: 991.98px) {
    .cz-tabs { display: none; }
    .cz-user .name { display: none; }
    .cz-bottom {
        display: grid; grid-template-columns: repeat(4, 1fr);
        position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
        background: #fff; border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .cz-bottom a { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .5rem 0 .45rem; color: #6b7280; font-size: .72rem; font-weight: 600; }
    .cz-bottom a i { font-size: 1.3rem; }
    .cz-bottom a.active { color: var(--primary); }
    body.has-bottom { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* ── 頁面 ── */
.cz-main { padding: 1.75rem 0 3rem; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); font-weight: 800; margin: 0 0 .35rem; }
.page-head p { color: var(--muted); margin: 0; }
.section-h { font-size: 1.1rem; font-weight: 800; margin: 2rem 0 .9rem; display: flex; align-items: center; gap: .5rem; }

.cz-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.cz-card.pad { padding: 1.25rem; }
.cz-card.hover { transition: border-color .15s, box-shadow .15s; }
.cz-card.hover:hover { border-color: #c7d4f3; box-shadow: 0 12px 28px -20px rgba(29, 78, 216, .55); }
.cz-empty { text-align: center; color: #94a3b8; padding: 2.5rem 1rem; }
.cz-empty i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #cbd5e1; }

.chip { display: inline-block; font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; background: #f1f4f9; color: #334155; margin: 0 .3rem .35rem 0; }
.chip-ok { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.chip-muted { background: #f1f4f9; color: #64748b; }
.chip-blue { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: #b9c9f1; }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-accent { background: var(--accent); color: var(--navy); border: 0; font-weight: 700; }
.btn-accent:hover { background: #e2a400; color: var(--navy); }
.form-control, .form-select { border-radius: 10px; border-color: #d6dbe4; }
.form-control:focus, .form-select:focus { border-color: #8fb0f5; box-shadow: 0 0 0 .2rem rgba(29, 78, 216, .15); }

.price { font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.price-old { color: #94a3b8; text-decoration: line-through; font-size: .85rem; margin-right: .25rem; }

/* 練習：題目 */
.q-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.q-no { display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; padding: 0 .5rem; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 800; font-size: .9rem; margin-right: .6rem; }
.q-text { font-weight: 600; line-height: 1.8; white-space: pre-line; }
.q-opt { display: flex; gap: .7rem; align-items: flex-start; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; margin-top: .55rem; cursor: pointer; line-height: 1.6; transition: border-color .12s, background .12s; }
.q-opt:hover { border-color: #b9c9f1; background: #f8faff; }
.q-opt input { position: absolute; opacity: 0; pointer-events: none; }
.q-opt .k { flex: 0 0 1.75rem; height: 1.75rem; border-radius: 50%; display: grid; place-items: center; background: #f1f4f9; font-weight: 700; font-size: .85rem; }
.q-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.q-opt:has(input:checked) .k { background: var(--primary); color: #fff; }
.q-opt:has(input:focus-visible) { outline: 3px solid #93b4ff; outline-offset: 2px; }
.q-opt.is-correct { border-color: #86d6a2; background: var(--ok-soft); }
.q-opt.is-correct .k { background: var(--ok); color: #fff; }
.q-opt.is-wrong { border-color: #f2b8b5; background: var(--bad-soft); }
.q-opt.is-wrong .k { background: var(--bad); color: #fff; }
.q-img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-top: .75rem; }
.explain { background: #fffbea; border: 1px solid #f6e3a1; border-radius: 10px; padding: .85rem 1rem; margin-top: .85rem; font-size: .93rem; line-height: 1.8; white-space: pre-line; }
.score-ring { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--primary) calc(var(--p) * 1%), #e6ecf8 0); }
.score-ring > div { width: 92px; height: 92px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; color: var(--navy); }
.sticky-submit { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--paper) 30%); padding: 1rem 0 .5rem; z-index: 5; }
@media (max-width: 991.98px) { .sticky-submit { bottom: calc(60px + env(safe-area-inset-bottom)); } }

/* 討論區 */
.chat-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; height: calc(100vh - 64px - 3.5rem); min-height: 480px; }
.chat-list { overflow-y: auto; }
.chat-item { display: flex; gap: .75rem; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.chat-item:hover { background: #f8faff; }
.chat-item.active { background: var(--primary-soft); }
.chat-avatar { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.chat-item .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .p { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 700; padding: .1rem .45rem; }
.chat-room { display: flex; flex-direction: column; min-height: 0; }
.chat-head { padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .75rem; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 1rem; background: #f8fafc; }
.msg { display: flex; gap: .6rem; margin-bottom: .85rem; max-width: 82%; }
.msg .who { font-size: .78rem; color: var(--muted); margin-bottom: .2rem; }
.msg .bubble { background: #fff; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: .55rem .8rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg .time { font-size: .72rem; color: #94a3b8; margin-top: .2rem; }
.msg.me { margin-left: auto; flex-direction: row-reverse; }
.msg.me .bubble { background: var(--primary); border-color: var(--primary); color: #fff; border-radius: 14px 4px 14px 14px; }
.msg.me .who { display: none; }
.msg.me .time { text-align: right; }
.msg .bubble img { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; }
.msg .bubble.muted { background: #f1f4f9; color: #64748b; font-style: italic; }
.chat-input { border-top: 1px solid var(--line); padding: .75rem; display: flex; gap: .5rem; align-items: flex-end; background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
.chat-input textarea { resize: none; max-height: 140px; }
@media (max-width: 991.98px) {
    .chat-wrap { grid-template-columns: 1fr; height: calc(100vh - 64px - 64px - 2rem); }
    .chat-wrap.in-room .chat-list-col { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
