:root {
  --paper: #f6f1e8;
  --paper-2: #efe6d6;
  --card: #fffdf8;
  --ink: #1c2430;
  --muted: #5c6570;
  --line: #e2d6c4;
  --accent: #c45c26;
  --accent-2: #9a3f16;
  --bold: #8b1e3f;
  --ok: #2d6a4f;
  --warn: #9a6b12;
  --learn: #2c5aa0;
  --danger: #9b2c2c;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --radius: 18px;
  --nav-h: calc(64px + env(safe-area-inset-bottom));
  --font-ui: Arial, Helvetica, sans-serif;
  --font-vocab: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-family: var(--font-ui);
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  max-width: 100%;
  width: 100%;
}
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font-ui); }
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  max-width: 100%;
  width: 100%;
  overflow-x: clip;
}
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; }
img, video, canvas { max-width: 100%; }
#app { min-height: 100dvh; max-width: 100%; overflow-x: hidden; }

.screen {
  min-height: 100dvh;
  max-width: 100%;
  padding: 20px 20px calc(var(--nav-h) + 20px);
  overflow-x: hidden;
}
.screen.auth { padding-bottom: 40px; }
.screen.auth:not([hidden]) { display: flex; flex-direction: column; justify-content: center; }
#login-screen[hidden],
#app[hidden] { display: none !important; }
.auth-foot {
  margin: 20px 4px 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
}
.auth-foot a { color: var(--accent-2); }

.https-login-warn a {
  color: var(--danger);
  font-weight: 700;
  word-break: break-all;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 28px;
}
.brand img, .brand svg { width: 48px; height: 48px; border-radius: 12px; }
.brand h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.03em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.35; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.field { display: block; margin: 0 0 14px; }
.field > span,
.field > label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.field > span small { font-weight: 400; }
input:not([type]),
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 48px;
}
input:not([type]),
input[type="text"], input[type="password"], input[type="number"], input[type="search"] {
  height: 48px;
  font-size: 1rem;
  line-height: 1.2;
}
select,
select option {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.3;
}
select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c6570' d='M2.4 4.2L6 8.1l3.6-3.9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  padding-right: 36px;
}
textarea { min-height: 72px; resize: vertical; }

.pw-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.pw-wrap input {
  flex: 1 1 auto;
  min-width: 0;
}
/* Auge neben dem Feld — nicht darüber, sonst blockiert es Chrome Autofill rechts im Input. */
.pw-toggle {
  position: static;
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transform: none;
}
.pw-toggle svg { width: 20px; height: 20px; display: block; }
.pw-toggle .pw-eye-off { display: none; }
.pw-toggle[aria-pressed="true"] .pw-eye-open { display: none; }
.pw-toggle[aria-pressed="true"] .pw-eye-off { display: block; }
.pw-toggle:hover,
.pw-toggle:focus {
  color: var(--accent);
  outline: none;
  background: var(--card);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.btn:disabled { opacity: 0.5; }
input:disabled, select:disabled {
  background: var(--paper-2);
  color: var(--muted);
  opacity: 0.72;
}
.btn.secondary { background: var(--paper-2); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--accent-2); }
.btn.ok { background: var(--ok); }
.btn.warn { background: var(--danger); }
.btn.row { width: auto; flex: 1; }

.row { display: flex; gap: 10px; }
.hint { color: var(--muted); font-size: 0.92rem; line-height: 1.4; }
.error {
  background: #fde8e8;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 12px;
  margin: 0 0 14px;
}
#error-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}
#error-modal[hidden] { display: none !important; }
.error-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.error-modal-panel {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  max-height: min(80vh, 520px);
  margin: 0;
  padding: 20px 18px 16px;
  overflow: auto;
  border-radius: 18px;
  border-color: #f0c4c4;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.28);
}
.error-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.error-modal-close:hover,
.error-modal-close:focus {
  background: rgba(0, 0, 0, 0.06);
  outline: none;
}
.error-modal-title {
  margin: 0 36px 10px 0;
  font-size: 1.05rem;
}
.error-modal-text {
  margin: 0 0 16px;
  color: var(--danger);
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
body.error-modal-open {
  overflow: hidden;
}
.okmsg {
  background: #e7f4ec;
  color: var(--ok);
  padding: 10px 12px;
  border-radius: 12px;
  margin: 0 0 14px;
}
.warnmsg {
  background: #f8efd6;
  color: var(--warn);
  padding: 10px 12px;
  border-radius: 12px;
  margin: 0 0 14px;
}
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--nav-h) + 12px);
  z-index: 40;
  background: #2d6a4f;
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(28, 36, 48, 0.18);
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.on {
  opacity: 1;
  transform: translateY(0);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.page-banner input {
  max-width: 8rem;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
}
.continue-note {
  background: #e8eef8;
  color: var(--learn);
  padding: 10px 12px;
  border-radius: 12px;
  margin: 0 0 14px;
  font-size: 0.92rem;
}
.assignment-check-warn {
  border-color: #d4a017;
  background: #fffdf5;
}
.assignment-check-warn > .edit-section-sum {
  color: #9a6b12;
}
.assignment-status-warn {
  margin: 0 0 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #9a6b12;
}
.assignment-check-note {
  margin: 10px 0 12px;
  font-size: 0.85rem;
}
.assignment-check {
  margin: 0;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
}
.assignment-chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.assignment-chapter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--paper-2, #f4f1ec);
}
.assignment-chapter-row.is-missing {
  background: #fff8e6;
  outline: 1px solid #e6c35c;
}
.assignment-chapter-row.is-editing {
  flex-wrap: wrap;
}
.assignment-chapter-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}
.assignment-chapter-title {
  font-weight: 600;
  color: var(--ink);
}
.assignment-chapter-pages {
  color: var(--muted);
  font-size: 0.88rem;
}
.assignment-chapter-count {
  color: var(--muted);
  font-size: 0.82rem;
}
.assignment-chapter-edit-btn {
  flex: 0 0 auto;
  width: auto;
  min-height: 36px;
  min-width: 36px;
  padding: 4px 8px;
  font-size: 1.05rem;
  line-height: 1;
}
.assignment-chapter-edit {
  flex: 1 1 160px;
  margin: 0;
}
.assignment-chapter-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
.assignment-chapter-cancel {
  width: auto;
  min-height: 36px;
  padding: 4px 10px;
}
.assignment-chapter-empty { margin: 0; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-2);
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--muted);
}
.chip-missing {
  border: 1px solid #d4a017;
  color: #9a6b12;
  background: #fff8e6;
}
.chip-also-in {
  font-size: 0.75rem;
  padding: 4px 8px;
}
.item-chapter-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  max-width: 100%;
}
.item-chapter-label {
  flex: 0 0 auto;
  font-size: 0.82rem;
}
.item-chapter-input {
  flex: 1 1 120px;
  min-width: 0;
  width: min(220px, 100%);
  margin: 0;
  padding: 4px 8px;
  border: 1px solid #d4a017;
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  background: #fff;
}
.item-chapter-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }

.book-search { margin: 0 0 12px; }
.book-search input { position: sticky; top: 0; z-index: 2; }
.book-hits {
  margin: -4px 0 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-ink, var(--ink));
}
.book-flat-list .item-meta { flex-wrap: wrap; gap: 6px; }
.edit-finished-hint { margin-bottom: 16px; }
.edit-section {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 12px);
  background: var(--paper);
  overflow: hidden;
}
.edit-section-sum {
  padding: 12px 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.edit-section-sum::-webkit-details-marker { display: none; }
.edit-section-sum::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s ease;
}
.edit-section[open] .edit-section-sum::before { transform: rotate(90deg); }
.book-reset-card { border: none; border-radius: 0; margin: 0; }
.book-reset-page-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.book-reset-page-row input {
  width: 5.5rem;
  flex: 0 0 auto;
}
.book-reset-page-row .btn { flex: 1 1 auto; }
.book-reset-note { margin-top: 6px; }
.book-reset-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}
.review-chapter-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.review-chapter-head .review-chapter-input {
  flex: 1;
  margin: 0;
}
.review-chapter-drop {
  flex: 0 0 auto;
  width: auto;
  min-height: 36px;
  padding: 4px 10px;
  font-size: 0.85rem;
}
.review-chapter-head .ico {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: var(--paper-2);
  color: var(--muted);
  font-weight: 800;
  font-size: 1rem;
}
.review-chapter-head .bold-btn.on {
  background: var(--bold);
  color: #fff;
}
.review-chapter-head .skip-btn.on {
  background: var(--danger);
  color: #fff;
}
.review-insert-slot.open {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--paper-2, #f7f4ef);
}
.review-insert-input {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 1rem;
  font-weight: 600;
}
.edit-readonly-card { border: none; border-radius: 0; box-shadow: none; margin: 0; }
.edit-readonly-meta {
  display: grid;
  gap: 10px;
  margin: 0;
}
.edit-readonly-meta > div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 8px;
  align-items: start;
}
.edit-readonly-meta dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.edit-readonly-meta dd { margin: 0; }
.edit-readonly-cover {
  max-width: 120px;
  border-radius: 8px;
  display: block;
}
.edit-prompt-readonly {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.45;
  max-height: 40vh;
  overflow: auto;
}
.page-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: -4px 0 14px;
  padding: 4px 0 10px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; }
.page-tab {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 8px 14px;
  font-weight: 700;
}
.page-tab.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.two-col,
.filters .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.two-col > .card { min-width: 0; }
.two-col .field { margin-bottom: 14px; }
.display-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 14px;
}
.display-row .field {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.display-row .check {
  margin: 0;
  min-height: 48px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.filters .grid { margin: 0 0 4px; }
.filters .grid .field { margin-bottom: 10px; }
.filters > .field { margin-bottom: 12px; }
.filters .grid.check-row {
  align-items: start;
  margin: 0 0 8px;
}
.filters .grid.check-row .check {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.3;
  align-items: flex-start;
}
.filters .grid.check-row .check input { margin-top: 2px; flex: 0 0 20px; }
.learn-h {
  margin: 12px 0 8px;
  font-weight: 700;
  color: var(--ink);
  font-size: inherit;
  line-height: inherit;
}
.filters > .learn-h:first-child { margin-top: 0; }
.learn-book-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 0 0 12px;
}
.learn-book-field {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0 !important;
}
.learn-photo-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding-bottom: 2px;
}
.learn-photo-btn,
.learn-photo-undo {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.learn-photo-btn svg { width: 22px; height: 22px; display: block; }
.learn-photo-btn.on {
  color: var(--accent);
  background: #fff7ef;
  border-color: rgba(196, 92, 38, 0.45);
}
.learn-photo-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.learn-photo-btn:active:not(:disabled),
.learn-photo-undo:active { transform: scale(0.94); background: var(--paper-2); }
.learn-photo-undo {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  color: var(--muted);
}
.learn-photo-hint { margin: -4px 0 12px; }
#learn-photo-modal {
  position: fixed;
  inset: 0;
  z-index: 1450;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}
#learn-photo-modal[hidden] { display: none !important; }
.learn-photo-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.learn-photo-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(82vh, 640px);
  margin: 0;
  padding: 20px 18px 16px;
  overflow: auto;
  border-radius: 18px;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.28);
}
.learn-photo-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.learn-photo-close:hover,
.learn-photo-close:focus {
  background: rgba(0, 0, 0, 0.06);
  outline: none;
}
.learn-photo-title {
  margin: 0 36px 12px 0;
  font-size: 1.05rem;
}
.learn-photo-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 12px 4px 8px;
}
.learn-photo-loading p { margin: 0; }
.learn-photo-spinner {
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: learn-photo-spin 0.8s linear infinite;
}
@keyframes learn-photo-spin {
  to { transform: rotate(360deg); }
}
.learn-photo-error {
  margin: 0 0 12px;
  color: var(--danger);
  line-height: 1.4;
}
.learn-photo-summary { margin: 0 0 10px; }
.learn-photo-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  max-height: min(46vh, 360px);
  overflow: auto;
  border-top: 1px solid var(--line);
}
.learn-photo-list li {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-vocab);
  font-size: 0.95rem;
}
.learn-photo-list li.external,
.learn-photo-list li.external .learn-photo-term,
.learn-photo-list li.external .learn-photo-de {
  font-style: italic;
  color: var(--muted);
}
.learn-photo-term { font-weight: 600; min-width: 0; word-break: break-word; }
.learn-photo-de { min-width: 0; word-break: break-word; color: var(--ink); }
body.learn-photo-modal-open { overflow: hidden; }
.count-line {
  margin: 12px 0 0;
  font-weight: 700;
  color: var(--ink);
}
.learn-split {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0 14px;
}
.filters .learn-split {
  margin: 6px 0 14px;
}
.mode-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin: 2px 0 6px;
  padding: 10px 0;
  overflow: hidden;
}
.mode-btn {
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: 0 0 76px;
}
.mode-btn img {
  display: block;
  width: 76px;
  height: 76px;
  object-fit: cover;
  pointer-events: none;
}
.mode-btn.on {
  transform: scale(1.08);
}
.mode-hint {
  text-align: center;
  margin: 0 0 14px;
}
.flash-card.speak-card { cursor: default; }
.speak-status {
  margin-top: 18px;
  font-weight: 600;
}
.speak-reveal {
  margin-top: 14px;
}
.speak-reveal .label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.speak-reveal[hidden] { display: none; }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 4px 0 10px;
}
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-h);
  padding: 8px 4px env(safe-area-inset-bottom);
  background: rgba(246, 241, 232, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  z-index: 20;
}
.nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.62rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  padding: 4px 2px;
  white-space: nowrap;
}
.nav button.active { color: var(--accent-2); font-weight: 700; }
.nav svg { width: 22px; height: 22px; }

.flash {
  margin-top: 12px;
  min-height: 42vh;
  display: flex;
  flex-direction: column;
}
.flash-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 28px 20px;
  text-align: center;
  min-height: 240px;
}
.flash-card .meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 16px; }
.flash-card .term {
  font-family: var(--font-vocab);
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
}
.flash-card .term.bold { font-weight: 700; }
.flash-card .back {
  font-family: var(--font-vocab);
  font-size: 1.6rem;
}
.flash-card { cursor: pointer; }
.flash-card.type-card { cursor: default; text-align: center; }
.term-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
}
.term-row .term,
.term-row .back { min-width: 0; }
.speak-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.speak-btn svg { width: 22px; height: 22px; }
.speak-btn:active { transform: scale(0.94); background: var(--paper-2); }
.speak-btn:disabled { opacity: 0.45; }
.speak-redo-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
}
.speak-redo-btn:active { transform: scale(0.94); background: var(--paper-2); }
.speak-redo-btn:disabled { opacity: 0.45; cursor: wait; }
.speak-auto-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.speak-auto-track {
  position: relative;
  display: block;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #d9d2c8;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.speak-auto-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s ease;
}
.speak-auto-btn:active .speak-auto-track { filter: brightness(0.96); }
.speak-auto-btn.on .speak-auto-track {
  background: var(--accent);
  border-color: rgba(196, 92, 38, 0.35);
}
.speak-auto-btn.on .speak-auto-knob {
  transform: translateX(16px);
}
.tts-log-btn {
  flex: 0 0 auto;
  min-width: 42px;
  height: 42px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--paper);
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.tts-log-btn:active { transform: scale(0.94); background: var(--paper-2); }
.drill-compare {
  margin-top: 12px;
}
.drill-compare .label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0;
  margin-bottom: 2px;
}
.drill-compare .wrong-typed {
  font-family: var(--font-vocab);
  font-size: 1.25rem;
  color: var(--danger);
  text-decoration: line-through;
}
.drill-input {
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 48px;
  font-size: 16px;
  text-align: center;
}
.progress-line { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }

.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin: 0 0 8px;
}
.item-list .en,
.item-list .de {
  font-family: var(--font-vocab);
}
.item-list .en { color: inherit; }
.item-list .en.bold { font-weight: 700; }
.item-term-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.item-term-row .en,
.item-term-row .de {
  flex: 1;
  min-width: 0;
}
.item-tts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}
.item-tts-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.item-tts-btn svg { width: 18px; height: 18px; display: block; }
.item-tts-btn.redo { font-size: 1.05rem; line-height: 1; font-weight: 600; }
.item-tts-btn:active { transform: scale(0.94); color: var(--ink); }
.item-tts-btn:disabled { opacity: 0.45; cursor: wait; }
.item-admin-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.item-admin-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.item-admin-btn svg { width: 17px; height: 17px; display: block; }
.item-admin-btn:active { transform: scale(0.94); color: var(--ink); }
.item-admin-btn.danger:active { color: var(--danger); }
.item-edit input[type="text"] {
  width: 100%;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  font-family: var(--font-vocab);
}
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 0.75rem; color: var(--muted); align-items: center; }
.item-meta .hist-gems { margin-top: 0; }
.status {
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--paper-2);
}
.status.new { background: #e8eef8; color: var(--learn); }
.status.learning { background: #f8efd6; color: var(--warn); }
.status.mastered { background: #e3f3ea; color: var(--ok); }

.review-chapter { margin: 0 0 8px; }
.review-chapter-input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 4px 0;
  min-height: 40px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.review-chapter-input:focus {
  outline: none;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.review-ex {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
  color: var(--accent-2);
  font-size: 0.88rem;
  font-weight: 700;
}
.review-ex input {
  width: 6.5rem;
  min-height: 36px;
  padding: 4px 8px;
  font-weight: 700;
  color: var(--accent-2);
}
.review-ex .ico {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}
.review-ex .ico:disabled,
.review-ex .ex-split:disabled {
  opacity: 0.35;
}
.review-ex .ex-split {
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  background: var(--paper-2);
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.78rem;
}
.review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 42px 42px 42px;
  align-items: center;
  column-gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  margin: 0 0 6px;
}
.review-row.framed {
  border-style: dashed;
  background: #f3eef6;
}
.review-row.ignored {
  opacity: 0.42;
}
.review-row .en,
.review-row .de {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  font-family: var(--font-vocab);
}
.review-row .en.bold {
  font-weight: 700;
  color: var(--bold);
}
.review-row.ignored .en,
.review-row.ignored .de {
  text-decoration: line-through;
}
.review-row .dash {
  color: var(--line);
  font-size: 0.95rem;
}
.review-row .ico {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: var(--paper-2);
  color: var(--muted);
  font-weight: 800;
  font-size: 1rem;
}
.review-row .bold-btn.on {
  background: var(--bold);
  color: #fff;
}
.review-row .skip-btn.on {
  background: var(--danger);
  color: #fff;
}
.review-row .head-btn {
  font-size: 0.78rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.review-row .head-btn-spacer {
  visibility: hidden;
  pointer-events: none;
}
.review-row .head-btn.on {
  background: var(--accent);
  color: #fff;
}

@media (max-width: 520px) {
  .review-row {
    grid-template-columns: minmax(0, 1fr) 42px 42px 42px;
    grid-template-areas:
      "en bold skip head"
      "de de de de";
  }
  .review-row .en { grid-area: en; }
  .review-row .de { grid-area: de; }
  .review-row .dash { display: none; }
  .review-row .bold-btn { grid-area: bold; }
  .review-row .skip-btn { grid-area: skip; }
  .review-row .head-btn,
  .review-row .head-btn-spacer { grid-area: head; }
}

.hidden-file { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }

.install {
  background: #fff4e8;
  border: 1px dashed var(--accent);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.install a { color: var(--accent-2); }
.more-hint a { color: var(--accent-2); font-family: var(--font-ui); font-size: inherit; }
.more-hint p { margin: 0 0 8px; line-height: 1.45; font-family: var(--font-ui); }
.more-hint p:last-child { margin-bottom: 0; }
.more-hint strong { font-weight: 600; }
.more-collapsible { margin-bottom: 16px; padding: 0; overflow: hidden; }
.more-collapsible > summary {
  font-weight: 700;
  min-height: 48px;
  display: flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  color: var(--accent-2);
}
.more-collapsible > summary::-webkit-details-marker { display: none; }
.more-collapsible > summary::after {
  content: '';
  margin-left: auto;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.more-collapsible[open] > summary::after { transform: rotate(45deg); }
.more-collapsible-body { padding: 0 14px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.more-https-warn {
  color: var(--danger);
  font-size: 0.92rem;
  line-height: 1.45;
  margin: 0;
}
.more-https-warn a { color: var(--danger); font-weight: 600; text-decoration: underline; }

.busy { opacity: 0.7; pointer-events: none; }
.group-h {
  margin: 18px 0 8px;
  font-size: 0.95rem;
  color: var(--accent-2);
}
.group-h small { color: var(--muted); font-weight: 400; }

.book-section {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  overflow: hidden;
}
.book-section-sum {
  margin: 0;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-2);
  cursor: pointer;
  list-style: none;
}
.book-section-sum::-webkit-details-marker { display: none; }
.book-section-sum::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s ease;
  color: var(--muted);
}
.book-section[open] .book-section-sum::before { transform: rotate(90deg); }
.book-section .item-list li:first-child { border-top: 1px solid var(--line); }
.book-readonly .book-section { border-color: color-mix(in srgb, var(--muted) 35%, var(--line)); }
.book-finish-wrap {
  margin: 20px 0 8px;
  padding-top: 4px;
}
.book-finish-btn { width: 100%; }

.lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lb-all-schools {
  margin: 0;
  font-weight: 400;
  color: var(--ink);
  font-size: 0.9rem;
}

.kv {
  display: grid;
  gap: 12px;
  margin: 0;
}
.kv > div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 10px;
  align-items: baseline;
}
.kv dt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.kv dd {
  margin: 0;
  font-weight: 700;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 8px;
}
.session-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-2);
  border-radius: 14px;
  padding: 8px 8px 8px 14px;
  min-height: 48px;
}
.session-unit {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.session-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.session-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.session-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}
.session-main { flex: 1; min-width: 0; }
.session-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.session-title {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-weight: 700;
  padding: 4px 6px 4px 0;
  min-height: 28px;
  cursor: text;
  border-radius: 8px;
}
.session-title::placeholder { color: var(--ink); opacity: 1; font-weight: 700; }
.session-title:hover { background: rgba(255,255,255,0.35); }
.session-title:focus {
  outline: none;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--accent);
}
.session-edit {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.session-edit svg { width: 16px; height: 16px; }
.session-edit:hover,
.session-edit:focus {
  color: var(--accent);
  background: rgba(255,255,255,0.55);
  outline: none;
}
.session-lang {
  flex: 0 0 auto;
  margin: 0;
  min-width: 2.4em;
  justify-content: center;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 4px 8px;
}
.session-book {
  flex: 0 1 auto;
  margin: 0;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.3;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
  background: none;
  border: 0;
}
.session-date { font-weight: 700; }
.session-stat { color: var(--muted); font-size: 0.88rem; margin-top: 0; line-height: 1.3; }
.session-unit .session-stat { padding-left: 2px; }
.session-stat .linkish {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent-2);
  text-decoration: underline;
  cursor: pointer;
}
.session-stat .linkish:hover { color: var(--accent); }
.session-unit .session-replay { margin-left: auto; }
@media (max-width: 480px) and (orientation: portrait) {
  .session-unit .session-top {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .session-unit .session-title-row {
    flex: 0 0 auto;
    width: 100%;
  }
  .session-unit .session-actions-row {
    width: 100%;
  }
  .session-unit .session-book {
    max-width: min(12rem, 48vw);
  }
  .session-unit .session-replay { margin-left: auto; }
}
.session-icon-btn {
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.session-icon-btn svg { width: 18px; height: 18px; }
.session-replay {
  background: var(--paper);
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.session-replay:hover,
.session-replay:focus {
  color: var(--accent);
  background: #fff;
  outline: none;
}
.session-forget {
  background: transparent;
  color: var(--muted);
}
.session-forget:hover,
.session-forget:focus {
  color: var(--danger);
  background: rgba(255,255,255,0.55);
  outline: none;
}
.session-remind {
  background: var(--paper);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}
.session-remind:hover,
.session-remind:focus {
  color: var(--accent-2);
  outline: none;
}
.session-remind.on {
  color: var(--accent);
  background: #fff7ef;
}
.remind-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: end center;
  padding: 0 12px max(16px, env(safe-area-inset-bottom));
}
.remind-modal[hidden] { display: none !important; }
.remind-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 18, 8, 0.45);
}
.remind-modal-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(88vh, 640px);
  overflow: auto;
  margin-bottom: 8px;
  padding: 20px 18px 16px;
}
.remind-subtitle {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}
.remind-dials {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin: 0 0 16px;
}
.remind-colon {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
}
.remind-dial-wrap {
  position: relative;
  height: 160px;
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.remind-dial-window {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 40px;
  margin-top: -20px;
  border-radius: 8px;
  background: rgba(196, 92, 38, 0.12);
  box-shadow: inset 0 0 0 1px rgba(196, 92, 38, 0.28);
  pointer-events: none;
  z-index: 1;
}
.remind-dial {
  height: 160px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-snap-stop: always;
  padding: 60px 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
}
.remind-dial::-webkit-scrollbar { display: none; }
.remind-dial-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 100%;
  border: 0;
  background: transparent;
  margin: 0;
  padding: 0;
  text-align: center;
  font: inherit;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  scroll-snap-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 2;
}
.remind-dial-item.on {
  color: var(--ink);
  font-weight: 700;
  font-size: 1.45rem;
}
.remind-intervals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.remind-skip-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--ink);
}
.remind-skip-check input {
  margin-top: 3px;
  flex: 0 0 auto;
}
.remind-interval.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.remind-actions {
  display: grid;
  gap: 8px;
}
body.remind-modal-open {
  overflow: hidden;
}
.session-row.pending-del {
  outline: 2px solid var(--danger);
  background: #fde8e8;
}
.user-manage.pending-del .session-row {
  outline: 2px solid var(--danger);
  background: #fde8e8;
}
.muted {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.82rem;
}
.tree-branch {
  background: var(--card);
  border-radius: 16px;
  margin: 0 0 10px;
  padding: 2px 10px 10px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.tree-branch > summary,
.tree-class > summary {
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.tree-branch > summary::-webkit-details-marker,
.tree-class > summary::-webkit-details-marker { display: none; }
.tree-branch > summary::before,
.tree-class > summary::before {
  content: '▸';
  margin-right: 8px;
  color: var(--muted);
}
.tree-branch[open] > summary::before,
.tree-class[open] > summary::before { content: '▾'; }
.tree-class {
  margin: 4px 0 4px 6px;
  padding: 0 0 4px;
}
.tree-users { margin: 4px 0 0; }
.user-manage {
  background: var(--paper-2);
  border-radius: 14px;
  margin: 0 0 8px;
  padding: 4px 4px 8px;
}
.user-manage .session-row {
  background: transparent;
  padding: 6px 8px 4px 10px;
  min-height: 40px;
  flex-wrap: nowrap;
}
.user-manage .session-main {
  flex: 1;
  min-width: 0;
}
.user-manage .session-row .btn {
  width: auto;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.88rem;
  align-self: center;
}
.user-manage-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}
.user-manage-actions .btn {
  width: auto;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.82rem;
  white-space: nowrap;
}
.user-del-confirm {
  max-width: 220px;
}
.user-del-ask {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.25;
  white-space: normal;
}
.user-rights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
  padding: 0 8px 4px 12px;
}
.user-rights .check {
  min-height: 40px;
  margin: 0;
  font-size: 0.88rem;
}

.confirm-card {
  border-color: #f0c4c4;
  margin-bottom: 14px;
}
.confirm-card p { margin: 0 0 12px; }
.profile-invisible-ban {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 2px solid var(--warn, #b45309);
  background: #fff7ed;
  color: #7c2d12;
}
.profile-invisible-ban-title {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 1.05rem;
}
.profile-invisible-ban p {
  margin: 0 0 8px;
  line-height: 1.45;
}
.profile-invisible-ban p:last-child {
  margin-bottom: 0;
}
.profile-invisible-ban-mail {
  margin-top: 10px !important;
  font-weight: 600;
}
.profile-invisible-ban a {
  color: inherit;
}
.legal-doc {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}
.legal-head {
  margin-bottom: 16px;
}
.legal-head h1 {
  margin: 12px 0 4px;
  font-size: 1.55rem;
}
.legal-meta {
  margin: 0;
  color: var(--muted, #666);
  font-size: 0.92rem;
}
.legal-section {
  margin-bottom: 12px;
  padding: 14px 16px;
}
.legal-section h2 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}
.legal-section h3 {
  margin: 14px 0 6px;
  font-size: 0.98rem;
}
.legal-section p,
.legal-section li {
  line-height: 1.5;
  font-size: 0.95rem;
}
.legal-section ul {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}
.legal-section li + li {
  margin-top: 4px;
}
.legal-foot {
  margin-top: 18px;
  text-align: center;
  color: var(--muted, #666);
  font-size: 0.92rem;
}
.legal-foot a {
  color: inherit;
}
@media (max-width: 480px) {
  .session-row { flex-wrap: wrap; }
  .session-main { flex: 1 1 100%; }
  .user-manage .session-row { flex-wrap: nowrap; }
  .user-manage .session-main { flex: 1 1 auto; min-width: 0; }
}

.pick {
  outline: 2px solid var(--accent);
}

.chart-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 10px 8px;
  margin: 0 0 10px;
  box-shadow: var(--shadow);
}
.chart-svg {
  width: 100%;
  height: var(--plot-h, 156px);
  display: block;
  color: var(--muted);
}
.chart-plot {
  position: relative;
  overflow: hidden;
}
.chart-end-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.chart-end-label {
  position: absolute;
  left: var(--label-left, 76%);
  width: var(--label-width, 22%);
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 4px var(--card), 0 0 8px var(--card);
}
.chart-end-label.on { font-weight: 800; }
.chart-end-label.dim { opacity: 0.32; }
.chart-xticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 4px 8px 0 26px;
}
.compare-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 12px;
}
.compare-picks .check {
  margin: 0;
  font-size: 0.9rem;
}

.leaderboard-wrap { margin: 18px 0 8px; overflow-x: auto; max-width: 100%; }
.leaderboard {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.leaderboard th {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px 8px;
  background: var(--paper-2);
}
.leaderboard th:last-child { text-align: right; }
.lb-group + .lb-group td {
  border-top: 1px solid var(--line);
}
.lb-group td {
  padding: 7px 12px;
  vertical-align: middle;
}
.lb-group tr + tr td {
  border-top: 1px dashed var(--line);
}
.lb-badge {
  width: 7.2rem;
  vertical-align: top;
  text-align: center;
  padding-top: 10px;
  border-right: 1px solid var(--line);
  background: var(--paper-2);
}
.lb-group tr + tr .lb-badge { border-top: 0; }
.lb-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.lb-level .badge-stack {
  --buddy-size: 52px;
  width: var(--buddy-size);
  height: var(--buddy-size);
}
.lb-level .badge-stack.has-ring {
  width: calc(var(--buddy-size) * 1.2);
  height: calc(var(--buddy-size) * 1.2);
}
.lb-level-name {
  font-size: 0.72rem;
  line-height: 1.15;
  color: var(--ink);
}
.lb-name { min-width: 0; }
.lb-place {
  font-size: 0.85rem;
  color: var(--muted);
}
.lb-xp {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}
.lb-me .lb-name,
.lb-me .lb-place,
.lb-me .lb-xp { color: var(--ink); font-weight: 700; }

.reward-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.reward-badge-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 0;
  border-radius: 50%;
}
.reward-badge-btn:focus-visible {
  outline: 2px solid var(--accent, #c45c26);
  outline-offset: 3px;
}
.page-head-tools {
  margin-left: auto;
  align-self: flex-start;
  flex: 0 0 auto;
}
@media (max-width: 520px) {
  .page-head-tools { width: 100%; margin-left: 0; }
}
.reward-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.reward-copy strong {
  font-size: 0.98rem;
}
.reward-copy span {
  color: var(--muted);
  font-size: 0.86rem;
}
.reward-streak { font-weight: 700; color: var(--ink) !important; }
.badge-stack {
  --buddy-size: 72px;
  --star: #c45c4a;
  position: relative;
  width: var(--buddy-size);
  height: var(--buddy-size);
  flex: 0 0 auto;
  display: block;
  overflow: hidden;
  border-radius: 50%;
}
.badge-stack.has-ring {
  width: calc(var(--buddy-size) * 1.2);
  height: calc(var(--buddy-size) * 1.2);
}
.badge-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--buddy-size) * 1.2);
  height: calc(var(--buddy-size) * 1.2);
  max-width: none;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
  z-index: 0;
}
.badge-buddy {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: var(--buddy-size);
  height: var(--buddy-size);
  max-width: none;
  margin: 0;
  transform: translate(-50%, -50%);
  object-fit: contain;
  display: block;
}
.badge-gem {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 37.5%;
  height: auto;
  max-width: none;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 2;
}
.badge-stack.up-ring::after,
.badge-stack.up-glow::after,
.badge-stack.up-gold::after,
.badge-stack.up-sparkle::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  pointer-events: none;
}
.badge-stack.up-ring::after {
  border: 1.5px solid var(--star);
  opacity: 0.45;
}
.badge-stack.up-glow::after {
  border: 2px solid var(--star);
  box-shadow: 0 0 8px var(--star);
  opacity: 0.7;
}
.badge-stack.up-gold::after {
  border: 2px solid #e0b422;
  box-shadow: 0 0 8px rgba(224, 180, 34, 0.55);
}
.badge-stack.up-sparkle::after {
  border: 2px solid #7ec8ff;
  box-shadow: 0 0 0 3px rgba(224, 180, 34, 0.35), 0 0 10px rgba(126, 200, 255, 0.7);
}

.import-book { margin-bottom: 16px; }
.import-book .book-cover,
.import-book .book-pick-ph.book-cover {
  width: 88px;
  height: 118px;
}
.book-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
}
.book-cover {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: #ddd;
  flex: 0 0 auto;
}
.cover-pick {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.cover-pick-preview {
  position: relative;
  flex: 0 0 auto;
  display: block;
  width: 72px;
  height: 96px;
}
.cover-pick-preview .book-cover,
.cover-pick-preview .book-pick-ph.book-cover {
  width: 72px;
  height: 96px;
  margin: 0;
  display: block;
}
.cover-rotate {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #1f2933;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
}
.cover-rotate:active { transform: scale(0.94); }
.cover-rotate:disabled { opacity: 0.55; cursor: wait; }
.cover-rotate svg {
  width: 15px;
  height: 15px;
  display: block;
}
.cover-pick-actions {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cover-pick-actions .hint { margin: 0; }
.book-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.book-hero-copy strong { font-size: 1.05rem; }
.book-hero-copy span { color: var(--muted); font-size: 0.86rem; }
.book-picker {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  margin: 0 0 12px;
  -webkit-overflow-scrolling: touch;
}
.book-pick {
  flex: 0 0 auto;
  width: 112px;
  padding: 8px 8px 10px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--card);
  text-align: center;
  min-height: 0;
  position: relative;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.book-pick-done {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--ok);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.22);
  z-index: 2;
  pointer-events: none;
}
.book-pick.finished.on {
  border-color: color-mix(in srgb, var(--ok) 55%, var(--accent));
}
.book-pick img,
.book-pick-ph {
  width: 64px;
  height: 86px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 0 auto 8px;
  background: var(--paper-2);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.book-pick-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.74rem;
  line-height: 1.25;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}
.book-pick-meta {
  display: block;
  font-size: 0.64rem;
  line-height: 1.25;
  color: var(--muted);
}
.book-pick.on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transform: scale(1.04);
}
.book-pick.on img,
.book-pick.on .book-pick-ph {
  transform: scale(1.03);
}
.book-pick.on .book-pick-title { color: var(--accent-ink, var(--ink)); }
.book-pick.on .book-pick-meta { color: var(--ink); opacity: 0.78; }
.book-pick:active { transform: scale(0.98); }
.book-pick.on:active { transform: scale(1.02); }

.edit-book-picker { margin-bottom: 16px; }

.import-pdf-progress {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 12%, var(--paper));
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}
#import-queue-anchor { margin-top: 16px; }
.import-queue-wrap {
  margin-top: 0;
  padding: 14px;
  background: var(--paper-2);
}
.import-queue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.import-queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.import-queue-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.import-queue-item.ready {
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
}
.import-queue-item.imported {
  border-color: color-mix(in srgb, var(--muted) 40%, var(--line));
  opacity: 0.92;
}
.import-queue-item.err {
  border-color: color-mix(in srgb, var(--warn) 35%, var(--line));
}
.import-queue-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 72px;
  padding: 0;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper-2);
  cursor: pointer;
}
.import-queue-thumb-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 72px;
}
.import-queue-thumb-wrap .import-queue-thumb {
  width: 100%;
  height: 100%;
}
.import-queue-thumb-redo {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 24px;
  min-height: 24px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 72%, transparent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.import-queue-thumb-redo svg {
  width: 14px;
  height: 14px;
  display: block;
  margin: 0 auto;
}
.import-queue-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.import-queue-thumb-ph-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.import-queue-thumb-ph {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}
.import-queue-item.preparing {
  opacity: 0.92;
}
.import-queue-main { flex: 1; min-width: 0; }
.import-queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.import-queue-page { font-size: 0.95rem; }
.import-queue-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  white-space: nowrap;
}
.import-queue-status.run {
  background: color-mix(in srgb, var(--accent) 18%, var(--paper));
  color: var(--accent-ink, var(--ink));
}
.import-queue-status.ok {
  background: color-mix(in srgb, var(--ok) 20%, var(--paper));
  color: var(--ok);
}
.import-queue-status.done {
  background: color-mix(in srgb, var(--muted) 16%, var(--paper));
  color: var(--ink);
}
.import-queue-status.err {
  background: color-mix(in srgb, var(--warn) 18%, var(--paper));
  color: var(--warn);
}
.import-queue-err {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--warn);
  line-height: 1.35;
}
.import-queue-chapter-warn {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--danger);
  line-height: 1.3;
}
.import-queue-chapter-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 12%, var(--paper));
  color: var(--danger);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.35;
}
.import-queue-item.needs-chapter {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}
.import-queue-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.import-queue-actions .btn {
  width: auto;
  min-height: 34px;
  padding: 4px 12px;
  font-size: 0.85rem;
}
.import-queue-actions .ico {
  width: 32px;
  min-height: 32px;
  padding: 0;
}
.import-queue-retry svg {
  width: 18px;
  height: 18px;
  display: block;
}
.import-queue-del { color: var(--warn); }
.import-queue-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}
.import-queue-foot .hint {
  flex: 1 1 100%;
  margin: 0;
}
#import-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.import-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}
.import-lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 520px);
  max-height: 92vh;
  background: var(--paper);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.import-lightbox-panel img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 48px);
  margin: 0 auto;
  border-radius: 8px;
}
.import-lightbox-close {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: var(--paper-2);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.book-pick-new-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--muted);
}
.book-pick-new.on .book-pick-new-ph { color: var(--accent-ink, var(--ink)); }

.prompt-chat-card { margin-bottom: 12px; padding-bottom: 14px; }
.prompt-chat-log {
  min-height: 280px;
  max-height: 380px;
  overflow: auto;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px;
}
.prompt-chat-msg {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.prompt-chat-msg.user {
  background: var(--paper-2);
  align-self: flex-end;
  max-width: 92%;
}
.prompt-chat-msg.assistant {
  background: transparent;
  border: 1px solid var(--line);
  align-self: flex-start;
  max-width: 100%;
}
.prompt-chat-msg.typing {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  min-height: 42px;
}
.prompt-chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.prompt-chat-typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: prompt-chat-dot 1.2s infinite ease-in-out;
}
.prompt-chat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.prompt-chat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
.prompt-chat-typing-label { font-size: 0.88rem; font-style: italic; }
@keyframes prompt-chat-dot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
.prompt-chat-compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.prompt-chat-compose textarea {
  flex: 1;
  min-height: 64px;
  resize: vertical;
}
.prompt-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.prompt-chat-send {
  width: 44px;
  min-height: 44px;
  padding: 0;
  flex: 0 0 auto;
}
.prompt-chat-send svg { width: 20px; height: 20px; }
.edit-prompt-field textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  min-height: 320px;
}

.profile-filter-select.is-placeholder { color: var(--muted); }
.profile-filter-select option { color: var(--ink); }

.profile-books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
  align-items: stretch;
}
.fav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 8px 12px;
  min-width: 0;
  height: 100%;
}
.fav-card .book-cover,
.fav-card .book-pick-ph.book-cover {
  width: 64px;
  height: 86px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 0 auto 8px;
  background: var(--paper-2);
  box-shadow: 0 2px 8px rgba(28, 36, 48, 0.1);
  flex-shrink: 0;
}
.fav-card.is-default { border-color: var(--accent); }
.fav-copy {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0;
  min-width: 0;
  width: 100%;
  align-items: center;
}
.fav-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  width: 100%;
}
.fav-chip { margin-top: 2px; }
.fav-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.25;
  font-weight: 600;
}
.fav-meta {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.25;
}
.fav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.fav-actions .btn {
  width: auto;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.78rem;
}
.fav-actions .chip { font-size: 0.68rem; }

.tts-fill { margin: 0 0 16px; }
.tts-fill-sum { margin: 0 0 10px; font-weight: 700; }
.tts-fill-actions { margin: 0 0 8px; align-items: center; flex-wrap: wrap; gap: 8px; }
.tts-fill-actions .btn { width: auto; min-height: 40px; padding: 8px 12px; flex: 0 0 auto; }
.tts-fill-overwrites {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}
.tts-fill-overwrite {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
  flex: 0 0 auto;
}
.tts-fill-overwrite input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}
.tts-fill-log {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 240px;
  overflow: auto;
  border-top: 1px solid var(--line);
}
.tts-fill-log li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.tts-fill-log li.on { background: var(--paper-2); margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
.tts-fill-log .muted { display: block; font-size: 0.78rem; margin-bottom: 2px; }
.tts-fill-log strong { display: block; font-family: var(--font-vocab); }
.tts-fill-sides { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 4px; color: var(--muted); font-size: 0.82rem; }
.tts-fill-side.had { color: var(--muted); }
.tts-fill-side.saved { color: var(--ok); font-weight: 700; }
.tts-fill-side.busy { color: var(--accent); font-weight: 700; }
.tts-fill-side.fail { color: var(--danger); }
.tts-fill-side.todo { color: var(--warn); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}

.drill-done { margin-bottom: 16px; }
.drill-done-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
}
.drill-done .session-review-sum { margin-top: 0; }
.drill-done-review {
  max-height: min(52vh, 420px);
  margin-bottom: 14px;
}
.drill-done .btn { margin-top: 10px; }
.drill-done .btn:first-of-type { margin-top: 4px; }

#session-review {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.session-review-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, 0.42);
}
.session-review-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(88vh, 760px);
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px 18px 14px 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}
.session-review-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.session-review-head h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
}
.session-review-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.session-review-sum {
  margin: 0 0 6px;
  font-size: 0.92rem;
  font-weight: 700;
}
.session-review-hist-hint { margin: 0 0 10px; }
.session-review-body {
  overflow: auto;
  flex: 1;
  min-height: 0;
  margin: 0 -4px;
  padding: 0 4px 4px;
}
.session-review-group { margin: 0 0 14px; }
.session-review-group h4 {
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.session-review-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.session-review-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 10px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.session-review-words { min-width: 0; }
.session-review-words strong { font-family: var(--font-vocab); }

#levels-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.levels-modal-hint { margin: 0 0 10px; }
.levels-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.levels-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}
.levels-row.is-me {
  background: #fff8e6;
  margin: 0 -8px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 10px;
  border-bottom-color: transparent;
}
.levels-row .badge-stack {
  --buddy-size: 48px;
  width: var(--buddy-size);
  height: var(--buddy-size);
  flex: 0 0 auto;
}
.levels-row .badge-stack.has-ring {
  width: calc(var(--buddy-size) * 1.2);
  height: calc(var(--buddy-size) * 1.2);
}
.levels-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.levels-copy strong {
  font-size: 0.95rem;
  color: var(--ink);
}
.levels-copy span {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.news-admin-inner {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}
.news-admin-inner > .hint {
  margin: 12px 0 14px;
}
.news-form .field:last-of-type { margin-bottom: 12px; }
.news-actions { margin-top: 4px; }
.news-jahrgang { margin: 0 0 14px; }
.news-jahrgang .field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.news-jahrgang-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
}
.news-jahrgang-item { margin: 0; }
.buch-jahrgaenge .buch-jahrgang-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
}
.buch-jahrgang-item { margin: 0; }

#news-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}
.news-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.news-panel {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  max-height: min(88vh, 680px);
  min-height: 240px;
  margin: 0;
  overflow: hidden;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.28);
  isolation: isolate;
}
.news-mascot-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}
.news-mascot {
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: auto;
  max-width: 55%;
  opacity: 0.12;
  mix-blend-mode: multiply;
}
.news-content {
  position: relative;
  z-index: 1;
  padding: 22px 22px 20px;
  max-height: min(88vh, 680px);
  overflow: auto;
  background: transparent;
}
.news-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
}
.news-kicker-icon {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--accent);
}
.news-headline {
  margin: 0 0 12px;
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding-right: 8px;
}
.news-message {
  margin: 0 0 22px;
  line-height: 1.55;
  white-space: pre-wrap;
  font-size: 0.95rem;
  color: var(--ink);
  max-width: 92%;
}
.news-close-btn {
  margin-top: 2px;
}
body.news-open,
body.levels-modal-open { overflow: hidden; }
.hist-gems {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  flex: none;
  margin-top: 2px;
}
.hist-gem {
  width: 12px;
  height: 12px;
  object-fit: contain;
  display: block;
  flex: none;
}
.hist-gem.none {
  filter: grayscale(1);
  opacity: 0.62;
}
