/* 給學生的線上學習單、考卷、歌曲學習單（/shared/sheet.js 產生內容）。
   基本樣式沿用 /exam/style.css，顏色用 /shared/theme.css。 */
.toolbar .crumb { font-size: 15px; color: var(--muted); }
.toolbar .crumb a { color: var(--accent); text-decoration: none; }
.toolbar .crumb a:hover { text-decoration: underline; }
.sheet-page { max-width: 800px; margin: 0 auto; padding: 16px 16px 8px; font-size: 17px; line-height: 1.6; }
.sheet-page h1 { font-size: 25px; text-align: center; margin: 8px 0 4px; color: var(--accent); }
.sheet-page .sub { text-align: center; color: var(--muted); font-size: 16px; margin-bottom: 14px; }
.sheet-page .card { margin: 14px 0; padding: 16px 18px; border-radius: 12px; }
.sheet-page .card h2 { font-size: 21px; display: block; margin: 0 0 6px; }
.sheet-page .card h2 .meta { font-weight: 400; }
.sheet-page h3 { font-size: 17px; margin: 14px 0 4px; color: var(--accent); }
.sheet-page .meta { font-size: 15px; color: var(--muted); }
.sheet-page p { margin: 6px 0; }
.sheet-page p.note { font-size: 15px; color: var(--muted); }
.sheet-foot { text-align: center; color: var(--muted); font-style: italic; font-size: 15px; padding: 20px 16px 28px; }

.toc { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; }
.toc .row-item { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.toc a { color: var(--accent); text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.wk { font-weight: 700; color: var(--accent); min-width: 58px; font-size: 16px; }
.mark { flex: none; width: 18px; height: 18px; border: 2px solid #c8c8c8; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.mark.done { border-color: #2e9e4f; background: #2e9e4f; }
.mark.done::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translate(0, -1px) rotate(45deg); }
.total { background: var(--accent); color: #fff; border-radius: 12px; padding: 10px 16px; margin-bottom: 14px; text-align: center; }
.score-bar { position: sticky; top: 52px; z-index: 4; text-align: center; font-weight: 700; background: var(--tint) !important; }
.score-bar button { margin-left: 8px; font-weight: 400; }

.q { margin: 14px 0; }
.q .extra { margin-top: 2px; }
.q .qimg { display: block; max-width: 180px; max-height: 140px; margin: 6px 0; border-radius: 8px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
@media (max-width: 520px) { .opts { grid-template-columns: 1fr; } }
.opts button { text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfaf8; font-size: 16px; color: var(--text); }
.opts button:hover:not(:disabled) { border-color: var(--accent-fill); background: var(--tint); }
.opts button:disabled { cursor: default; color: var(--text); opacity: 1; }
.opts button.ok { background: #dff3e3; border-color: #3a9d55; font-weight: 600; }
.opts button.no { background: #fbe1e1; border-color: #c94444; font-weight: 600; }
.q textarea { min-height: 50px; margin-top: 6px; font-size: 16px; }
.q details { margin-top: 6px; font-size: 16px; }
.q summary { cursor: pointer; color: var(--accent); }
.fb { margin-top: 6px; font-size: 16px; padding: 6px 10px; border-radius: 8px; }
.fb.good { background: #eef8f0; color: #22713a; }
.fb.bad { background: #fdf0ee; color: #a33; }
.self { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 16px; }
.self button, .unit-fb button, .song-done { border-color: var(--accent); color: var(--accent); }
.self button.on, .song-done.on { background: var(--accent); color: #fff; }
.unit-fb { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--tint); font-size: 16px; }
.unit-fb b { color: var(--accent); }
.unit-fb .msg { margin: 4px 0 6px; }

table.w { border-collapse: collapse; margin: 6px 0; }
table.w td { border: 1px solid var(--line); padding: 3px 10px; font-size: 16px; }

/* 歌曲 */
.qr { display: flex; gap: 14px; align-items: flex-start; }
.qr .qrcode { width: 110px; height: 110px; flex: none; }
.qr .qrcode svg { width: 100%; height: 100%; }
.btn { display: inline-block; background: #c0392b; color: #fff; padding: 6px 12px; border-radius: 6px; text-decoration: none; font-size: 16px; margin-top: 6px; }
.cloze { line-height: 2.2; margin-top: 6px; }
.cloze input { width: 7.5em; padding: 1px 6px; font-size: 16px; border-radius: 4px; text-align: center; }
.cloze input.ok { border-color: #3a9d55; background: #eef8f0; }
.cloze input.no { border-color: #c94444; background: #fdf0ee; }
.cloze-empty { border: 2px dashed var(--line); border-radius: 8px; padding: 12px; color: var(--muted); font-size: 16px; }
.tasks li { margin: 8px 0; line-height: 1.9; }
.tasks .blank { width: 9em; padding: 1px 6px; font-size: 16px; border: none; border-bottom: 2px solid var(--accent); border-radius: 0; background: var(--tint); text-align: center; }
.task-a { margin-top: 4px; }
.task-a textarea { width: 100%; font: inherit; font-size: 16px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1.5px solid var(--accent); color: var(--accent); background: #fff; border-radius: 999px; padding: 3px 14px; font-size: 16px; cursor: pointer; }
.chip.on { background: var(--accent); color: #fff; }
.chip.on::before { content: "✓ "; }
.counter { display: flex; align-items: center; gap: 8px; }
.counter .cnt { min-width: 2em; text-align: center; font-size: 23px; color: var(--accent); }
.counter button { border: 1.5px solid var(--accent); color: var(--accent); background: #fff; border-radius: 8px; padding: 3px 12px; font-size: 16px; cursor: pointer; }
.counter .cnt-plus { background: var(--accent); color: #fff; }
button.say { border: none; background: none; padding: 0; font: inherit; cursor: pointer; color: inherit; }
.song-foot { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.preview-banner { background: #fff4c2; border: 1px solid #e6cf6e; color: #6b5510; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 16px; text-align: center; }

/* 目錄在左邊、內容在右邊 */
.sheet-page.has-side { max-width: 1180px; }
.sheet-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 22px; align-items: start; }
.sheet-side { position: sticky; top: calc(var(--pg-top, 70px) + 12px); max-height: calc(100vh - var(--pg-top, 70px) - 24px); overflow: auto; }
.sheet-side .toc { margin: 14px 0 0; padding: 8px; }
.sheet-side .toc .row-item { display: grid; grid-template-columns: 22px 1fr; gap: 2px 8px; padding: 7px 8px; border-radius: 8px; line-height: 1.35; }
.sheet-side .toc .row-item:not(:has(.mark)) { grid-template-columns: 1fr; }
.sheet-side .toc .wk { grid-column: 2; grid-row: 1; font-size: 13px; color: var(--muted); }
.sheet-side .toc .wk:empty { display: none; }
.sheet-side .toc .mark { grid-row: 1 / span 2; align-self: center; }
.sheet-side .toc a { font-size: 15px; }
.sheet-side .toc .row-item:hover { background: var(--tint, #eef2ea); }
.sheet-side .toc .row-item.cur { background: var(--accent); }
.sheet-side .toc .row-item.cur a, .sheet-side .toc .row-item.cur .wk { color: #fff; }
@media (max-width: 860px) {
  .sheet-layout { grid-template-columns: 1fr; }
  .sheet-side { position: static; max-height: 260px; }
}
/* 一題一個框 */
@media screen {
  body:not([data-kind="songs"]) .sheet-body section.card { background: transparent; border: 0; box-shadow: none; padding: 0; }
  body:not([data-kind="songs"]) .sheet-page .sheet-body section.card > h2 { background: var(--bg); margin: 0; padding: 12px 2px 8px; }
  body:not([data-kind="songs"]) .sheet-body section.card > .meta { padding: 12px 2px 0; }
  .sheet-body .q { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 12px 0; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
  .sheet-body .unit-fb { margin-top: 14px; }
}

/* 換頁 */
@media screen {
  .sheet-page section.card.pg-hide { display: none; }
  .sheet-page section.card > h2 { position: sticky; top: var(--pg-top, 0px); z-index: 3; background: var(--card); margin: -6px -18px 6px; padding: 8px 18px; border-bottom: 1px solid transparent; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 6px; flex-wrap: wrap; }
.pager > button { font-size: 18px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink, inherit); cursor: pointer; }
.pager > button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager > button:disabled { opacity: .35; cursor: default; }
.pg-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; flex: 1; }
.pg-dot { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 15px; cursor: pointer; padding: 0; }
.pg-dot.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
@media (max-width: 560px) { .pg-dots { order: -1; flex-basis: 100%; } .pager > button { flex: 1; } }
@media print {
  .pager { display: none !important; }
  .toolbar, .score-bar button, .self, .unit-fb button, .song-foot { display: none !important; }
  .sheet-page .card { break-inside: avoid; }
}

/* 學生代碼與存檔狀態 */
.who { font-size: 14px; padding: 4px 10px; border-radius: 999px; background: var(--card, #fff); border: 1px solid var(--line, #ddd); white-space: nowrap; }
.who.ok { color: #2e7d32; border-color: #a5d6a7; }
.who.warn { color: #b26a00; border-color: #ffcc80; }
.who.local { color: var(--muted, #666); }
.who button { margin-left: 6px; font-size: 13px; padding: 2px 8px; }
.score-bar .submitted { color: #2e7d32; font-weight: 600; margin-left: 8px; }
/* 進來先輸入代碼：畫面中間的大卡片 */
.code-gate[hidden] { display: none; }
.code-gate { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(40, 38, 35, .45); }
.code-card { box-sizing: border-box; width: min(440px, 100%); display: grid; gap: 12px; padding: 26px 24px; border-radius: 18px; background: var(--card, #fff); box-shadow: 0 12px 40px rgba(0, 0, 0, .2); text-align: center; }
.code-card h2 { margin: 0; font-size: 24px; }
.code-card p { margin: 0; color: var(--muted, #666); font-size: 16px; line-height: 1.6; }
.code-card .code-err { color: #b3261e; font-weight: 600; }
.code-card > * { min-width: 0; }
.code-card input { box-sizing: border-box; width: 100%; font-size: 26px; letter-spacing: 3px; text-align: center; text-transform: uppercase; padding: 10px; border-radius: 12px; border: 2px solid var(--accent, #567150); }
.code-card button.primary { font-size: 19px; padding: 12px; border-radius: 12px; }
.code-card .code-skip { border: 0; background: none; color: var(--muted, #666); font-size: 14px; text-decoration: underline; cursor: pointer; }
@media print { .who, .code-gate { display: none !important; } }
