/* Established Open-Book-Is-Good defaults: light canvas, white cards, system
   fonts, compact controls, and restrained blue for interaction. */
@font-face {
  font-family: "NumFit";
  src: local("Songti TC"), local("Noto Serif TC"), local("Times New Roman");
  unicode-range: U+0030-0039;
  size-adjust: 109%;
}

:root {
  color-scheme: light;
  --paper: #f4f5f7;
  --paper-deep: #e8eaed;
  --paper-card: #fff;
  --ink: #1c1813;
  --ink-soft: #51493e;
  --ink-faint: #6e6555;
  --rule: #d2d5da;
  --rule-faint: #e7e9ec;
  --bad-ink: #a23b2e;
  --bad-wash: #f3e4de;
  --accent: #2f5d8a;
  --accent-wash: #e6edf3;
  --serif: "NumFit", "Noto Serif TC", "Songti TC", PMingLiU, "Times New Roman", serif;
  --sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --r: 8px;
  --r-lg: 12px;
  --shadow: 0 1px 2px rgba(28, 24, 19, 0.05), 0 6px 18px rgba(28, 24, 19, 0.05);
  --shadow-sm: 0 1px 2px rgba(28, 24, 19, 0.05);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
a { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button { cursor: pointer; }

button:disabled {
  cursor: default;
  opacity: 0.4;
}

button:focus-visible,
a:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r);
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

img {
  display: block;
  max-width: 100%;
}

#app { min-height: 24rem; }

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.2rem 1.1rem 4rem;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1.2rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--ink);
}

.work-title,
.page-title,
.question-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.45;
}

.work-title { font-size: 1.7rem; }

.masthead-note,
.exam-option__meta,
.question-source,
.question-note,
.caption,
.progress-label,
.music-status__detail {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.7;
}

.masthead-note { text-align: right; }

.banner {
  margin: 0.8rem 0;
  padding: 0.65rem 0.9rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--accent-wash);
  color: var(--ink);
  line-height: 1.7;
}

.banner--error,
.question-error {
  border-color: var(--bad-ink);
  background: var(--bad-wash);
  color: var(--bad-ink);
}

.panel { margin-top: 1.4rem; }

.panel__body,
.question-sheet {
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--paper-card);
  box-shadow: var(--shadow);
}

.panel__body { padding: 1.3rem 1.5rem 1.5rem; }

.page-title {
  margin: 0 0 0.9rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--rule-faint);
  font-size: 1.24rem;
}

.lead {
  margin: 0.5rem 0;
  color: var(--ink-soft);
  line-height: 1.8;
}

.exam-list {
  display: grid;
  gap: 0.7rem;
  margin: 1rem 0;
}

button.exam-option {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper-card);
  color: var(--ink);
  text-align: left;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.08s var(--ease);
}

button.exam-option:hover {
  border-color: var(--accent);
  background: var(--accent-wash);
}

button.exam-option:active { transform: translateY(1px); }

button.exam-option:disabled:hover {
  border-color: var(--rule);
  background: var(--paper-card);
  transform: none;
}

button.exam-option--single {
  display: block;
  padding: 1rem;
}

.exam-option__title {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 600;
}

.exam-option__meta {
  display: block;
  margin-top: 0.15rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0.34rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper-card);
  color: var(--ink);
  font-size: 0.92rem;
  text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.08s var(--ease);
}

.button:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-card);
}

.button:active { transform: translateY(1px); }

.button--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button--primary:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-card);
}

.button--quiet {
  background: transparent;
  color: var(--ink-soft);
}

.button--quiet:hover {
  border-color: var(--ink-soft);
  background: var(--ink-soft);
  color: var(--paper-card);
}

.branding {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin-top: 1.25rem;
  padding: 0.8rem 0.95rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--accent-wash);
}

.branding__qr {
  width: 7rem;
  padding: 0.3rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
}

.branding__name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
}

.branding__url { overflow-wrap: anywhere; }

.progress { margin: 1rem 0 0.75rem; }

.progress__top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.progress progress {
  display: block;
  width: 100%;
  height: 0.6rem;
  accent-color: var(--accent);
}

.question-sheet { padding: 1.3rem 1.5rem 1.5rem; }

.question-sheet__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--rule-faint);
}

.question-title { font-size: 1.24rem; }

.passage {
  margin: 0.85rem 0;
  padding: 0.7rem 1rem;
  border-left: 3px solid var(--rule);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--paper-deep);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.95;
  white-space: pre-wrap;
}

.passage__paragraph { margin: 0.35rem 0 0.8rem; }
.passage__paragraph:last-child { margin-bottom: 0; }

.stem,
.table-text {
  margin: 1rem 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.math--display {
  overflow-x: auto;
  margin: 0.6rem 0;
}

.figure-list {
  display: grid;
  gap: 0.8rem;
  margin: 0.9rem 0;
}

.figure {
  margin: 0;
  padding: 0.6rem;
  border: 1px solid var(--rule-faint);
  border-radius: var(--r);
  background: #fff;
}

.figure figcaption {
  margin-top: 0.45rem;
  color: var(--ink-faint);
  font-size: 0.84rem;
}

.figure__error {
  margin: 0.35rem 0;
  color: var(--bad-ink);
  font-size: 0.9rem;
}

.data-table-list { display: grid; gap: 0.6rem; }

.data-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-card);
  line-height: 1.65;
}

.data-table th,
.data-table td {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--rule-faint);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--paper-deep);
  font-family: var(--serif);
}

.choice-list {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0;
}

button.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.75;
  text-align: left;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

button.choice:hover {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--ink);
}

button.choice:disabled:hover {
  border-color: var(--rule);
  background: var(--paper);
  color: var(--ink);
}

.choice__label {
  flex: 0 0 auto;
  min-width: 1.7rem;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-weight: 600;
}

.exam-option .choice__label {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
}

.choice__content {
  min-width: 0;
  white-space: pre-wrap;
}

.choice__image {
  margin-top: 0.6rem;
  border: 1px solid var(--rule-faint);
  border-radius: 4px;
}

.choice__unavailable {
  color: var(--bad-ink);
  font-size: 0.9rem;
}

.question-note--visual-options { margin-top: 0.8rem; }

.question-note { margin: 0.7rem 0 0; }

.question-error {
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid;
  border-radius: 0 var(--r) var(--r) 0;
  line-height: 1.7;
}

.question-error--content { margin: 0.85rem 0; }
.question-error--content p { margin: 0.2rem 0; }
.question-error__details { margin: 0.2rem 0 0; padding-left: 1.35rem; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}

.summary-grid div {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--rule-faint);
  border-radius: var(--r);
  background: var(--paper);
}

.summary-grid dt {
  color: var(--ink-faint);
  font-size: 0.84rem;
}

.summary-grid dd {
  margin: 0.25rem 0 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 600;
}

.music-status {
  margin-top: 1rem;
  padding: 0.65rem 0.9rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--accent-wash);
}

.music-status__title {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
}

.music-status__detail { margin: 0.2rem 0 0; }

.empty {
  margin-top: 1.2rem;
  color: var(--ink-soft);
  line-height: 1.8;
}

.noscript {
  max-width: 46rem;
  margin: 2rem auto;
  padding: 1rem;
  border: 1px solid var(--bad-ink);
  border-radius: var(--r);
  background: var(--bad-wash);
  color: var(--bad-ink);
}

@media (max-width: 560px) {
  .page { padding-top: 1.4rem; }
  .masthead-note { text-align: left; }
  .panel__body,
  .question-sheet { padding: 1rem; }
  .branding { grid-template-columns: 5.75rem minmax(0, 1fr); }
  .branding__qr { width: 5.75rem; }
  .summary-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.playback-group { margin-block: 1.5rem; }
.playback-group h3 { margin-block: 0 .65rem; font-size: 1rem; }
.playback-group [aria-pressed="true"] { border-color: currentColor; }

/* Keep official source-page lettering readable on the exhibition laptop. */
.page--question { max-width: 64rem; }
.figure__enlarge { display: inline-block; margin-top: .35rem; font-size: .9rem; }

/* Local SVG notation; the document remains narrow on small screens. */
.score-panel { margin: 2rem 0; padding-top: 1.4rem; border-top: 1px solid #d7dee5; min-width: 0; }
.score-panel h3 { margin: 0 0 .5rem; font-size: 1.2rem; }
.score-caption { color: #5b6571; font-size: .9rem; line-height: 1.7; }
.score-controls { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.score-controls [aria-pressed="true"] { background: #243d54; color: white; border-color: #243d54; }
.score-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.3rem; font-size: .9rem; font-weight: 700; }
.score-correct, .score-table tr[data-status="correct"] td:last-child { color: #b42318; }
.score-wrong, .score-table tr[data-status="wrong"] td:last-child { color: #15803d; }
.score-original { color: #737b86; }
.score-viewport { max-height: 660px; overflow: auto; background: #fff; border: 1px solid #d7dee5; border-radius: 8px; overscroll-behavior: contain; }
.score-viewport:empty { display: none; }
.score-viewport:focus-visible { outline: 3px solid #2f5d8a; outline-offset: 3px; }
.score-system { width: 100%; min-width: 800px; border-bottom: 1px solid #eef0f3; }
.score-system svg { display: block; width: 100%; height: auto; }
.score-results { margin: 1rem 0; font-size: .9rem; }
.score-results summary { cursor: pointer; padding: .5rem 0; }
.score-table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.score-table td, .score-table th { padding: .4rem .6rem; text-align: left; border-bottom: 1px solid #e7ebef; }
@media (max-width: 600px) { .score-viewport { max-height: 520px; } }

.page--completion { max-width: 72rem; }

/* Public artwork authorship is present throughout the visitor flow. */
.author-credit { flex-basis: 100%; display: flex; align-items: center; gap: 1rem; margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--line, #d7dee5); }
.author-credit__portrait { flex: 0 0 5.5rem; width: 5.5rem; height: auto; object-fit: contain; border-radius: .25rem; }
.author-credit__words { min-width: 0; }
.author-credit__label { margin: 0 0 .2rem; font-size: .75rem; color: var(--muted, #5b6571); }
.author-credit__name { margin: 0 0 .25rem; font-size: 1rem; font-weight: 650; }
.author-credit__website { font-size: .85rem; overflow-wrap: anywhere; }
@media (max-width: 480px) { .author-credit { gap: .75rem; } .author-credit__name { font-size: .95rem; } .author-credit__website { font-size: .8rem; } }

.masthead-identity { width:100%; display:flex; justify-content:space-between; align-items:center; gap:1rem; margin-top:.85rem; padding-top:.85rem; border-top:1px solid var(--line,#d7dee5); }
.masthead-identity .author-credit { flex-basis:auto; margin-top:0; padding-top:0; border-top:0; }
.session-controls { flex-shrink:0; text-align:right; }
.session-controls .button-row { justify-content:flex-end; margin-top:.5rem; }
.session-clock { display:flex; gap:.75rem; align-items:baseline; justify-content:flex-end; }
.session-clock strong { font-variant-numeric:tabular-nums; }
@media(max-width:600px) { .masthead-identity { flex-wrap:wrap; } .session-controls { margin-left:auto; } }

.exhibition-tools { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.5rem; width:100%; }
.song-progress { display:flex; flex-wrap:wrap; align-items:baseline; gap:.6rem 1.2rem; margin:1rem 0; }
.song-progress strong { font-size:2.2rem; font-variant-numeric:tabular-nums; }
.reset-dialog { max-width:30rem; width:calc(100% - 2rem); padding:1.5rem; border:1px solid var(--ink); background:#fff; color:#111; }
.reset-dialog::backdrop { background:rgb(0 0 0 / .5); }
.reset-dialog p { line-height:1.8; }
.reset-row { display:flex; flex-wrap:wrap; gap:.6rem; margin-top:1.5rem; }
.reset-row--0 { justify-content:flex-start; }
.reset-row--1 { justify-content:center; }
.reset-row--2 { justify-content:flex-end; }
.reset-confirm { border-color:#9a2929; color:#9a2929; }

/* Only the requested portfolio view; normal exhibition presentation is unchanged. */
.portfolio-preview .score-viewport {max-height:none;overflow:visible;border:0;border-radius:0;}
.portfolio-preview .score-panel {margin:0;padding:8px 0 0;border:0;}
.portfolio-preview .score-panel h3,
.portfolio-preview .score-controls,
.portfolio-preview .score-results,
.portfolio-preview .score-panel [role="status"],
.portfolio-preview .playback-group[aria-label="正確版本"],
.portfolio-preview .playback-group h3,
.portfolio-preview [data-testid="play-current-mine"] {display:none;}
.portfolio-preview .playback-group {margin:0;padding:0;border:0;}
.portfolio-preview .score-legend {margin:4px 0;}
.portfolio-preview [data-testid="play-snapshot"]::before {content:"▶ ";}
