.scripture-meta { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.scripture-meta strong { color: var(--text); }

.reader-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 20px 0;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.reader-controls button {
  font-size: 15px;
  padding: 8px 16px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}
.reader-controls button[aria-pressed="true"] { background: var(--accent); color: #fff; }
[data-theme="dark"] .reader-controls button[aria-pressed="true"] { color: var(--bg); }
.reader-controls button:disabled { opacity: 0.4; cursor: not-allowed; }
.font-size-label { font-size: 14px; color: var(--muted); min-width: 3.5em; text-align: center; }

.favorite-hint { margin: 4px 0 20px; font-size: 12px; color: var(--muted); }

.scripture-body {
  font-size: var(--reader-font-size, 20px);
  line-height: 2.3;
}
.scripture-body p { margin: 0 0 1em; }
.scripture-body ruby { ruby-align: center; margin: 0 1px; }
.scripture-body rt {
  font-size: 0.42em;
  color: var(--muted);
  user-select: none;
}
body[data-zhuyin="hidden"] .scripture-body rt { display: none; }

.char-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 16px; }
.char-table th, .char-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.char-table th { background: var(--card-bg); }

.tally-block {
  margin: 4px 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
}
.tally-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.tally-label { font-weight: 700; }
.tally-count { color: var(--muted); font-size: 14px; }
.tally-history-toggle {
  margin-left: auto;
  font-size: 13px;
  padding: 4px 10px;
  min-height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tally-history-toggle:hover { border-color: var(--accent); color: var(--accent); }
.tally-reset {
  font-size: 13px;
  padding: 4px 10px;
  min-height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tally-reset:hover { border-color: var(--accent); color: var(--accent); }
.tally-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
@media (min-width: 480px) {
  .tally-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (min-width: 700px) {
  .tally-grid { grid-template-columns: repeat(7, 1fr); }
}
.tally-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 4px 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.1;
  cursor: pointer;
}
.tally-box .tally-date {
  font-size: 10px;
  color: var(--muted);
  min-height: 1.1em;
}
.tally-box.is-checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.tally-box.is-checked .tally-date { color: #fff; opacity: 0.85; }
[data-theme="dark"] .tally-box.is-checked, [data-theme="dark"] .tally-box.is-checked .tally-date { color: var(--bg); }
.tally-hint { margin-top: 8px; font-size: 12px; color: var(--muted); }
.tally-history {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.tally-history-title { font-weight: 700; font-size: 13px; margin: 0 0 6px; }
.tally-history-empty { font-size: 13px; color: var(--muted); margin: 0; }
.tally-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}
.tally-history-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 4px 2px;
  border-bottom: 1px solid var(--border);
}
.tally-history-list li:last-child { border-bottom: none; }
.tally-history-date { color: var(--text); }
.tally-history-total { color: var(--muted); }

.source-block dt { font-weight: 700; margin-top: 10px; }
.source-block dd { margin: 2px 0 0; color: var(--muted); }
.grade-badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.pdf-download { margin: 0 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pdf-download-link {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--border, #999);
  border-radius: 6px; text-decoration: none; font-weight: 700;
}
.pdf-download-note { font-size: 12px; color: var(--muted); }
