* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bs-body-bg: #f8f9fb;
  --bs-body-color: #1f2937;
  --bs-primary: #0d6efd;
  --bs-link-color: var(--bs-primary);
  --bs-border-color: rgba(0, 0, 0, 0.1);
  --app-surface: #ffffff;
  --app-nav-bg: rgb(213, 210, 255);
}

html[data-theme="dark"] {
  --bs-body-bg: #0f1115;
  --bs-body-color: #e7e9ee;
  --bs-primary: #6ea8fe;
  --bs-link-color: #8ab4ff;
  --bs-border-color: rgba(255, 255, 255, 0.12);
  --app-surface: #151922;
  --app-nav-bg: #151922;
}

html[data-theme="ocean"] {
  --bs-body-bg: #f2f7f9;
  --bs-body-color: #102a2f;
  --bs-primary: #0d6f7c;
  --bs-link-color: #0d6f7c;
  --bs-border-color: rgba(13, 111, 124, 0.2);
  --app-surface: #ffffff;
  --app-nav-bg: #e7f3f5;
}

body {
  margin: 0;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-family: var(--bs-body-font-family);
}

.card,
.modal-content,
.list-group-item {
  background-color: var(--app-surface);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}

#fileCollectionManageModal [data-draggable-modal-header] {
  cursor: move;
}

#fileCollectionManageModal.show .modal-dialog {
  transform: translate(
    var(--file-collection-manage-drag-x, 0px),
    var(--file-collection-manage-drag-y, 0px)
  ) !important;
}

.file-collection-manage-header {
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.file-collection-manage-header-main {
  flex: 1 1 220px;
  min-width: 0;
}

#mixedPracticeCustomModal .modal-content {
  max-height: calc(100vh - 2rem);
}

#mixedPracticeCustomModal .mixed-practice-custom-modal-body {
  max-height: calc(100vh - 10rem);
  overflow-y: auto;
}

.file-collection-manage-title {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.file-collection-manage-header-actions {
  flex: 999 1 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.file-collection-manage-name-input {
  width: min(100%, 220px);
}

.file-collection-manage-header-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.file-collection-manage-close {
  margin-left: auto;
  flex: 0 0 auto;
}

@media (max-width: 575.98px) {
  .file-collection-manage-header {
    padding-right: 1rem;
  }

  .file-collection-manage-header-actions {
    width: 100%;
  }

  .file-collection-manage-name-input {
    width: 100%;
  }

  .file-collection-manage-header-buttons > .btn,
  .file-collection-manage-header-buttons > a.btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .file-collection-manage-close {
    margin-left: 0;
  }
}

.form-control,
.form-select,
.input-group-text {
  background-color: var(--app-surface);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}

.words-filter-active {
  background-color: color-mix(in srgb, var(--bs-primary) 16%, var(--app-surface)) !important;
  border-color: color-mix(in srgb, var(--bs-primary) 34%, var(--bs-border-color)) !important;
  box-shadow: inset 0 0 0 1px rgba(var(--bs-primary-rgb), 0.08);
}

.words-filter-active-field {
  background: color-mix(in srgb, var(--bs-primary) 6%, transparent);
  border-radius: 10px;
  padding: 0.45rem;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.words-filter-active-field .form-label,
.words-filter-active-field .small {
  color: color-mix(in srgb, var(--bs-primary) 52%, var(--bs-body-color));
}

.words-filter-active-check {
  background-color: color-mix(in srgb, var(--bs-primary) 8%, var(--app-surface));
  border-radius: 8px;
  padding: 0.15rem 0.35rem;
}

.words-filter-section-active {
  background-color: color-mix(in srgb, var(--bs-primary) 6%, var(--app-surface));
  border-color: color-mix(in srgb, var(--bs-primary) 25%, var(--bs-border-color)) !important;
}

.words-filter-active-row {
  background-color: color-mix(in srgb, var(--bs-primary) 5%, var(--app-surface));
}

.words-filter-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.words-filter-chip-item {
  display: inline-flex;
}

.words-filter-chip {
  border-radius: 999px;
  min-height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  padding-inline: 0.8rem;
}

.btn-check:checked + .words-filter-chip {
  color: #fff;
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.15rem rgba(var(--bs-primary-rgb), 0.18);
}

.btn-check:focus-visible + .words-filter-chip,
.btn-check:focus + .words-filter-chip {
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.nav-compact {
  display: grid;
  grid-template-columns: auto minmax(200px, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.nav-search { width: 100%; }
.navbar-brand { margin: 0; font-size: 1.4rem; }
.navbar {
  padding: 12px 16px;
  background: var(--app-nav-bg);
  overflow: visible;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1030;
}

body { padding-top: 72px; }
.navbar .container-fluid { overflow: visible; }
.navbar .navbar-collapse { background: var(--app-nav-bg); }
.navbar-toggler i { font-size: 1.1rem; }

.search { position: relative; width: 100%; }
.nav-search { position: relative; }
.nav-search .form-control:focus {
  box-shadow: none;
  outline: none;
  border-color: var(--bs-border-color);
}
.search-clear-btn {
  padding-inline: 0.55rem;
}
.search-clear-btn[hidden] {
  display: none !important;
}
.search-clear-btn i {
  pointer-events: none;
}
.search-panel {
  position: absolute;
  top: 100%;
  margin-top: 8px;
  left: 0;
  right: auto;
  background: var(--app-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.08);
  display: none;
  gap: 12px;
  z-index: 1050;
  max-height: min(60vh, 520px);
  overflow: auto;
}

.doc-word-progress {
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--bs-body-color) 8%, transparent) 0,
      color-mix(in srgb, var(--bs-body-color) 8%, transparent) var(--doc-progress-min-pct, 0%),
      color-mix(in srgb, var(--bs-success, #198754) 16%, transparent) var(--doc-progress-min-pct, 0%),
      color-mix(in srgb, var(--bs-success, #198754) 16%, transparent) var(--doc-progress-max-pct, 100%),
      color-mix(in srgb, var(--bs-body-color) 8%, transparent) var(--doc-progress-max-pct, 100%),
      color-mix(in srgb, var(--bs-body-color) 8%, transparent) 100%
    );
  position: relative;
}

.doc-word-progress::before,
.doc-word-progress::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: color-mix(in srgb, var(--bs-body-color) 25%, transparent);
  pointer-events: none;
}

.doc-word-progress::before {
  left: var(--doc-progress-min-pct, 0%);
}

.doc-word-progress::after {
  left: var(--doc-progress-max-pct, 100%);
}

@media (min-width: 992px) {
  .search-panel {
    width: max(100%, 560px);
    max-width: min(760px, calc(100vw - 32px));
  }
}
.search-panel.is-open { display: grid; }
.search-section { display: grid; gap: 8px; }
.search-title { font-weight: 600; }
.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.search-results li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.search-results-section-title {
  padding-top: 6px;
  border-top: 1px solid var(--bs-border-color);
  margin-top: 4px;
  letter-spacing: 0.04em;
}
.search-results-section-title:first-child {
  padding-top: 0;
  border-top: 0;
  margin-top: 0;
}
.search-results a { color: inherit; text-decoration: none; }
.search-word-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.search-verb-conj-btn {
  flex: 0 0 auto;
  padding: 0.2rem 0.45rem;
  line-height: 1;
}
.search-word-main {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.search-word-valencian {
  font-weight: 600;
}
.search-word-spanish {
  flex: 0 0 auto;
  text-align: right;
  max-width: 45%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-diphthongs-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.word-diphthongs-actions .btn {
  flex: 1 1 0;
  min-width: 0;
}

.word-diphthongs-actions [data-word-diphthongs-save-none] {
  border-color: #fd7e14;
  color: #fd7e14;
}

.missing-diphthongs-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.missing-diphthongs-actions .btn {
  flex: 1 1 0;
  min-width: 0;
}

.missing-diphthongs-actions [data-missing-diphthongs-save-none] {
  border-color: #fd7e14;
  color: #fd7e14;
}

.nav-more {
  position: relative;
}
.nav-more-toggle {
  list-style: none;
}
.nav-more-toggle::-webkit-details-marker {
  display: none;
}
.nav-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--app-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.08);
  padding: 6px;
  display: none;
  z-index: 1100;
}
.nav-more[open] .nav-more-menu {
  display: block;
}
.nav-more-item {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 10px;
}
.nav-more-button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
}
.nav-more-item:hover,
.nav-more-item:focus {
  background: rgba(13, 110, 253, 0.08);
}
.nav-more-item-admin {
  margin-top: 4px;
  border-top: 1px solid var(--bs-border-color);
  padding-top: 10px;
}
.nav-more-item-logout {
  margin-top: 4px;
  border-top: 1px solid var(--bs-border-color);
  padding-top: 10px;
  color: var(--bs-danger-text-emphasis);
}

.word-link {
  color: inherit;
  text-decoration: none;
}
.word-link:hover,
.word-link:focus {
  color: inherit;
  text-decoration: none;
}

.words-table-wrap {
  overflow-x: auto;
}

.words-table-compact {
  table-layout: fixed;
  font-size: 0.94rem;
}

.words-table-compact thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--app-surface);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(31, 41, 55, 0.62);
  border-bottom-width: 1px;
  white-space: nowrap;
}

.words-table-compact td,
.words-table-compact th {
  padding: 0.52rem 0.7rem;
  vertical-align: middle;
}

.words-table-compact tbody tr {
  line-height: 1.2;
}

.words-col-main {
  width: 24%;
}

.words-col-options {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  white-space: nowrap;
  text-align: center;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
  border-right: 1px solid var(--bs-border-color);
}

.words-col-options .btn {
  padding: 0.18rem 0.35rem;
  line-height: 1;
}

.words-col-spanish {
  width: 18%;
}

.words-col-phonetic {
  width: 17%;
}

.words-col-meta {
  width: 18%;
}

.words-col-tags {
  width: 23%;
}

.words-main-link {
  display: inline-block;
  max-width: 100%;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.words-spanish-text {
  display: inline-block;
  max-width: 100%;
  color: rgba(31, 41, 55, 0.68);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.words-phonetic-inline {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.84rem;
}

.words-meta-inline {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: rgba(31, 41, 55, 0.76);
}

.words-meta-inline > span {
  white-space: nowrap;
}

.words-syllables-inline {
  color: rgba(13, 111, 124, 0.9);
}

.words-badges-inline {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}

.words-badges-inline .badge {
  flex: 0 1 auto;
  max-width: 9rem;
}

.words-compact-badge {
  font-size: 0.68rem;
}

.words-mobile-inline {
  display: none;
}

.syllable-select-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.22rem;
}

.syllable-letter-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 0.16rem 0.2rem;
  font-size: clamp(1.4rem, 4.8vw, 2rem);
  line-height: 1;
  font-weight: 700;
  border-radius: 0.65rem;
  color: inherit;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.syllable-letter-btn.is-grouped {
  position: relative;
  background: rgba(13, 110, 253, 0.12);
  border-color: rgba(13, 110, 253, 0.35);
  color: var(--bs-primary-text-emphasis, var(--bs-primary));
}

.syllable-letter-btn.is-group-start {
  border-top-left-radius: 0.8rem;
  border-bottom-left-radius: 0.8rem;
}

.syllable-letter-btn.is-group-end {
  margin-right: 1rem;
  border-top-right-radius: 0.8rem;
  border-bottom-right-radius: 0.8rem;
}

.syllable-letter-btn.is-grouped:not(.is-group-start) {
  margin-left: -0.1rem;
  border-top-left-radius: 0.2rem;
  border-bottom-left-radius: 0.2rem;
}

.syllable-letter-btn.is-grouped:not(.is-group-end) {
  border-top-right-radius: 0.2rem;
  border-bottom-right-radius: 0.2rem;
}

.syllable-letter-btn:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

@media (max-width: 991.98px) {
  .words-table-compact {
    table-layout: fixed;
    font-size: 0.84rem;
  }

  .words-table-compact thead th {
    font-size: 0.62rem;
    padding: 0.35rem 0.35rem;
    letter-spacing: 0.02em;
  }

  .words-table-compact td {
    padding: 0.28rem 0.28rem;
  }

  .words-main-link {
    font-size: 0.9rem;
    white-space: normal;
    line-height: 1.12;
  }

  .words-spanish-text {
    font-size: 0.75rem;
    white-space: normal;
    line-height: 1.12;
  }

  .words-phonetic-inline {
    font-size: 0.72rem;
    white-space: normal;
    line-height: 1.1;
  }

  .words-meta-inline {
    gap: 0.15rem 0.3rem;
    font-size: 0.68rem;
    line-height: 1.08;
  }

  .words-meta-inline > span {
    white-space: normal;
  }

  .words-badges-inline {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.18rem;
  }

  .words-badges-inline .badge {
    max-width: 100%;
    font-size: 0.63rem;
  }

  .words-col-main {
    width: 31%;
  }

  .words-col-options {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    padding-left: 0.2rem !important;
    padding-right: 0.2rem !important;
  }

  .words-col-options .btn {
    padding: 0.12rem 0.24rem;
  }

  .words-col-spanish {
    width: 21%;
  }

  .words-col-phonetic {
    width: 28%;
  }

  .words-col-meta {
    width: 20%;
  }

  .words-col-tags {
    display: none;
  }

  .words-table-compact thead th:last-child {
    display: none;
  }

  .syllable-letter-btn {
    padding: 0.2rem 0.24rem;
    font-size: clamp(1.3rem, 6vw, 1.8rem);
  }

  .syllable-letter-btn.is-group-end {
    margin-right: 0.85rem;
  }
}

.tagline { margin-top: 4px; }
.tag-pill { display: inline-flex; align-items: center; gap: 4px; }
.tag-remove { line-height: 1; }

details.card > summary.card-header {
  cursor: pointer;
  list-style: none;
}
details.card > summary.card-header::-webkit-details-marker { display: none; }

.practice-action-bar {
  position: sticky;
  bottom: 0;
  background: var(--app-surface);
  padding: 12px 0 0;
  border-top: 1px solid var(--bs-border-color);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  z-index: 2;
}

.practice-action-bar-no-divider {
  border-top: 0;
  padding-top: 0;
}

.practice-run-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.practice-run-header-main {
  flex: 1 1 280px;
  min-width: 0;
}

.practice-run-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 1 auto;
}

.practice-run-header-actions .btn {
  white-space: nowrap;
}

.practice-header-label-back {
  display: none;
}

@media (max-width: 575.98px) {
  .practice-run-header {
    gap: 10px;
  }

  .practice-run-header-main {
    flex-basis: 100%;
  }

  .practice-run-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .practice-run-header-actions .btn {
    padding-inline: 0.65rem;
  }

  .practice-run-header-actions .practice-header-label {
    display: none;
  }

  .practice-run-header-actions .practice-header-label-back {
    display: inline;
  }
}

.accent-marks-board {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.28rem 0.45rem;
  line-height: 1.15;
  font-size: clamp(1.9rem, 4.6vw, 2.8rem);
  letter-spacing: 0.01em;
}

.accent-marks-word {
  display: inline-flex;
  align-items: baseline;
  gap: 0.06rem;
  white-space: nowrap;
}

.accent-marks-char {
  display: inline-block;
  white-space: pre-wrap;
  line-height: 1;
}

.accent-marks-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0 0.04em;
  margin: 0;
  border: 0;
  border-radius: 0.22em;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  vertical-align: baseline;
  position: relative;
  top: 0;
}

.accent-marks-toggle:hover,
.accent-marks-toggle:focus-visible {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
  outline: none;
}

.accent-marks-toggle.is-modified {
  background: var(--bs-warning-bg-subtle);
  color: #8a5800;
}

html[data-theme="dark"] .accent-marks-toggle.is-modified {
  color: #ffd37a;
}

.practice-reveal-solution {
  border: 1px solid var(--bs-warning-border-subtle, #ffe69c);
  background: var(--bs-warning-bg-subtle, #fff3cd);
  border-radius: 0.75rem;
  padding: 0.75rem 0.9rem;
}

.practice-reveal-answer {
  margin-bottom: 0;
  line-height: 1.15;
}

.practice-reveal-answer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.practice-reveal-phonetic {
  margin-left: auto;
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--bs-secondary-color, #6c757d);
  white-space: nowrap;
}

/* IPA/AFI glyphs (ʃ, ɛ, ɔ, etc.) render more consistently with this fallback stack. */
.phonetic-text,
input[name="spanish_phonetic"],
input[name="valencian_phonetic"],
[data-word-phonetic-input],
[data-missing-phonetic-input],
.practice-reveal-phonetic {
  font-family: "Noto Sans IPA", "Noto Sans", "DejaVu Sans", "Segoe UI", "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0;
}

.practice-reveal-prompt {
  color: var(--bs-body-color);
}

.practice-context {
  min-height: 1.5rem;
  color: var(--bs-secondary-color, #6c757d);
}

.practice-pronoun {
  color: var(--bs-secondary-color, #6c757d);
}

.practice-context-verb {
  font-size: clamp(1.22rem, 2.8vw, 1.65rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--bs-body-color);
}

.practice-pronoun-verb {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--bs-body-color);
}

.dash-card {
  border: 1px solid var(--bs-border-color);
  border-left: 14px solid var(--bs-primary);
  background: rgba(13, 110, 253, 0.06);
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}
.dash-card:focus-visible,
.dash-card a:focus-visible,
.dash-card button:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.28);
  outline-offset: 3px;
}
.dash-card .dash-title {
  font-size: 1.05rem;
  font-weight: 600;
}
.dash-card .dash-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.dash-card .dash-icon {
  font-size: 1.6rem;
  opacity: 0.7;
}
.dash-card .card-body {
  min-height: 100%;
}
.dash-card.dash-primary { border-left-color: #0d6efd; }
.dash-card.dash-success { border-left-color: #198754; background: rgba(25, 135, 84, 0.08); }
.dash-card.dash-warning { border-left-color: #ffc107; background: rgba(255, 193, 7, 0.12); }
.dash-card.dash-danger { border-left-color: #dc3545; background: rgba(220, 53, 69, 0.08); }
.dash-card.dash-info { border-left-color: #0dcaf0; background: rgba(13, 202, 240, 0.08); }
.dash-card.dash-primary { background: rgba(13, 110, 253, 0.08); }

.dash-complete-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.dash-complete-group {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(120, 82, 0, 0.12);
}

.dash-complete-group-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: #8a5b00;
  line-height: 1;
}

.dash-complete-group-label {
  font-size: 0.75rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(87, 60, 0, 0.76);
}

.dash-complete-item-disabled {
  background: color-mix(in srgb, var(--app-surface) 90%, var(--bs-body-color) 3%) !important;
  color: color-mix(in srgb, var(--bs-body-color) 62%, transparent) !important;
  border-color: color-mix(in srgb, var(--bs-border-color) 90%, transparent) !important;
  opacity: 1 !important;
}

.dash-complete-item-disabled .badge {
  opacity: 0.78;
}

.dash-complete-item-disabled i,
.dash-complete-item-disabled span {
  color: inherit;
}

.dash-complete-item-disabled.list-group-item-action:hover,
.dash-complete-item-disabled.list-group-item-action:focus {
  background: color-mix(in srgb, var(--app-surface) 90%, var(--bs-body-color) 3%) !important;
}

.dash-book-meta {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.dash-book-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.38rem 0.62rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(13, 110, 253, 0.12);
  color: rgba(18, 64, 117, 0.86);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1;
}

.dash-card-practice-main {
  position: relative;
  overflow: hidden;
  border-left-color: #ff8a00 !important;
  border-color: rgba(255, 138, 0, 0.28);
  background:
    radial-gradient(circle at top right, rgba(255, 214, 153, 0.42), transparent 34%),
    radial-gradient(circle at bottom left, rgba(255, 138, 0, 0.24), transparent 36%),
    linear-gradient(145deg, #fff1cc 0%, #ffe2a8 38%, #ffd089 100%);
  box-shadow: 0 16px 34px rgba(191, 101, 0, 0.18);
}

.dash-card-practice-main::after {
  content: "";
  position: absolute;
  inset: auto -40px -46px auto;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  background: rgba(176, 72, 0, 0.08);
  pointer-events: none;
}

.dash-card-practice-main .card-body {
  position: relative;
  z-index: 1;
}

.dash-shortcut-badge {
  position: absolute;
  bottom: 0.95rem;
  right: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(31, 41, 55, 0.08);
  color: rgba(31, 41, 55, 0.78);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  pointer-events: none;
}

.dash-shortcut-badge-practice {
  background: rgba(255, 255, 255, 0.56);
  color: #7d3300;
  border-color: rgba(125, 51, 0, 0.12);
}

.practice-card-main-trigger {
  color: inherit;
  background: transparent;
}

.practice-card-main-trigger:focus-visible {
  outline: 2px solid rgba(111, 47, 0, 0.4);
  outline-offset: 4px;
  border-radius: 1rem;
}

.dash-card-practice-main .dash-title,
.dash-card-practice-main .dash-value {
  color: #6f2f00;
}

.dash-card-practice-main .dash-icon {
  color: #9b3d00;
  opacity: 1;
}

.practice-card-kicker {
  color: rgba(111, 47, 0, 0.72);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.practice-card-title {
  font-size: 1.45rem !important;
  line-height: 1.05;
}

.practice-card-subtitle {
  max-width: 22rem;
  font-size: 0.95rem;
  line-height: 1.3;
  color: rgba(96, 47, 11, 0.82);
}

.practice-card-icon-wrap {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  flex: 0 0 auto;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(155, 61, 0, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.practice-card-definitive-trigger {
  position: absolute;
  top: 4.85rem;
  right: 1.25rem;
  z-index: 2;
}

.practice-error-pill {
  font-size: 0.82rem;
  font-weight: 700;
  background: #b42318;
  color: #fff;
  border: 1px solid rgba(122, 18, 18, 0.45);
  box-shadow: 0 6px 14px rgba(180, 35, 24, 0.2);
  padding: 0.34rem 0.62rem;
}

.practice-ok-pill {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f5132;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(15, 81, 50, 0.14);
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
}

.practice-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.practice-card-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(111, 47, 0, 0.1);
}

.practice-card-stat-link {
  color: inherit;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.practice-card-stat-link:hover,
.practice-card-stat-link:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(111, 47, 0, 0.22);
  box-shadow: 0 10px 18px rgba(125, 51, 0, 0.12);
  outline: none;
}

.practice-card-stat-value {
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 800;
  color: #7d3300;
}

.practice-card-stat-label {
  font-size: 0.74rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(96, 47, 11, 0.7);
}

@media (max-width: 575.98px) {
  .dash-complete-groups {
    gap: 0.45rem;
  }

  .dash-complete-group {
    padding: 0.58rem 0.62rem;
  }

  .dash-complete-group-value {
    font-size: 1rem;
  }

  .dash-complete-group-label,
  .dash-book-chip {
    font-size: 0.7rem;
  }

  .practice-card-title {
    font-size: 1.28rem !important;
  }

  .practice-card-stats {
    gap: 0.45rem;
  }

  .practice-card-stat {
    padding: 0.55rem 0.5rem;
  }

  .practice-card-stat-value {
    font-size: 1rem;
  }

  .practice-card-stat-label {
    font-size: 0.68rem;
    letter-spacing: 0.02em;
  }
}

.dash-reorder [data-dash-id] {
  cursor: grab;
  touch-action: none;
}
.dash-reorder [data-dash-id] a {
  pointer-events: none;
}
.dash-reorder [data-dash-id] button,
.dash-reorder [data-dash-id] input,
.dash-reorder [data-dash-id] select,
.dash-reorder [data-dash-id] textarea,
.dash-reorder [data-dash-id] [role="button"] {
  pointer-events: none;
}
.dash-reorder [data-dash-id] .card {
  outline: 2px dashed var(--bs-border-color);
  outline-offset: 2px;
}
.dash-reorder [data-dash-id].is-dragging {
  opacity: 0.65;
  cursor: grabbing;
}
.dash-reorder-mobile [data-dash-id] {
  cursor: pointer;
  touch-action: auto;
}
.dash-reorder-mobile [data-dash-id].is-selected .card {
  outline: 3px solid var(--bs-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.18);
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
}

.file-detail-page {
  margin-top: 0.5rem !important;
}

.file-detail-header {
  display: grid;
  gap: 0.35rem;
}

.file-detail-title-row {
  width: 100%;
}

.file-detail-title-block {
  flex: 1 1 auto;
}

.file-detail-title {
  line-height: 1.15;
}

.file-detail-breadcrumb {
  line-height: 1.2;
}

.file-detail-breadcrumb a {
  text-decoration: none;
}

.file-detail-nav-card {
  border-color: rgba(var(--bs-primary-rgb), 0.24);
  background: linear-gradient(180deg, rgba(var(--bs-primary-rgb), 0.07), rgba(0, 0, 0, 0));
}

.file-detail-nav-label {
  white-space: nowrap;
}

.file-detail-nav-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
}

.file-detail-nav-context {
  min-width: 0;
}

.file-detail-nav-title {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.file-detail-nav-subtitle {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.file-detail-nav-mode .btn {
  border-width: 1px;
  font-weight: 600;
}

.file-detail-nav-mode .btn.active {
  background: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
}

.file-detail-nav-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-detail-nav-select-label {
  flex: 0 0 auto;
}

.file-detail-nav-select {
  flex: 1 1 auto;
  min-width: 0;
}

.file-detail-nav-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.file-detail-nav-side {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
}

.file-detail-nav-side-left {
  justify-content: flex-start;
}

.file-detail-nav-side-right {
  justify-content: flex-end;
}

.file-detail-nav-btn {
  font-weight: 600;
  border-width: 1px;
}

.file-detail-nav-btn-primary {
  box-shadow: 0 6px 14px rgba(var(--bs-primary-rgb), 0.14);
}

.file-book-index-card {
  border-color: rgba(var(--bs-primary-rgb), 0.28);
  background: linear-gradient(180deg, rgba(var(--bs-primary-rgb), 0.06), rgba(0, 0, 0, 0));
}

.file-book-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.file-book-index-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.file-book-index-title {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.file-book-index-mode {
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--bs-primary);
  border: 1px solid rgba(var(--bs-primary-rgb), 0.28);
  font-weight: 600;
}

.file-book-index-meta {
  min-width: 0;
}

.file-book-index-book {
  display: inline-block;
  max-width: 100%;
  text-decoration: none;
  color: inherit;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-book-index-page-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-book-index-page-link {
  padding: 0.08rem 0.1rem;
  border: 0;
  font-size: 1.45rem !important;
  font-weight: 800 !important;
  line-height: 1.25;
  text-align: center;
  color: var(--bs-body-color);
  text-decoration: none;
}

.file-book-index-entry {
  border-radius: 999px;
  font-weight: 600;
  border-color: rgba(var(--bs-primary-rgb), 0.24) !important;
}

.file-book-index-open {
  width: 100%;
  border-style: dashed;
}

.file-book-index-head-btn {
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-book-index-empty {
  font-size: 0.78rem;
}

.file-pdf-outline-card {
  border-color: rgba(220, 53, 69, 0.24);
  background: linear-gradient(180deg, rgba(220, 53, 69, 0.05), rgba(0, 0, 0, 0));
}

.file-pdf-outline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.file-pdf-outline-title {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.file-pdf-outline-list {
  display: grid;
  gap: 0.2rem;
}

.file-pdf-outline-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  text-align: left;
}

.file-pdf-outline-item:hover,
.file-pdf-outline-item:focus {
  background: rgba(var(--bs-primary-rgb), 0.07);
  border-color: rgba(var(--bs-primary-rgb), 0.18);
  color: inherit;
  text-decoration: none;
}

.file-pdf-outline-item.is-current {
  background: rgba(var(--bs-primary-rgb), 0.12);
  border-color: rgba(var(--bs-primary-rgb), 0.28);
}

.file-pdf-outline-item.is-static {
  cursor: default;
}

.file-pdf-outline-item.is-static:hover,
.file-pdf-outline-item.is-static:focus {
  background: transparent;
  border-color: transparent;
}

.file-pdf-outline-item-title {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-pdf-outline-item-page {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
}

.book-toc-modal-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.book-toc-modal-left {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
}

.book-toc-modal-guides {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.book-toc-modal-guide,
.book-toc-modal-branch {
  width: 12px;
  height: 1.05em;
  display: inline-block;
  border-left: 1px solid var(--bs-border-color);
}

.book-toc-modal-branch {
  border-bottom: 1px solid var(--bs-border-color);
  margin-right: 3px;
}

.book-toc-modal-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-toc-modal-dots {
  flex: 1 1 auto;
  min-width: 10px;
  border-bottom: 1px dotted rgba(108, 117, 125, 0.7);
  transform: translateY(1px);
}

.book-toc-modal-page {
  min-width: 2.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--bs-secondary-color);
}

.book-toc-modal-current {
  background: rgba(var(--bs-primary-rgb), 0.12);
  border-color: transparent;
  box-shadow: none;
}

.book-toc-modal-current .book-toc-modal-title,
.book-toc-modal-current .book-toc-modal-page {
  color: var(--bs-primary);
  font-weight: 700;
}

@media (min-width: 992px) {
  .file-detail-sidebar {
    position: sticky;
    top: 78px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

}

.file-preview-shell {
  padding: 0.75rem;
}

.file-image-viewer {
  min-height: 240px;
  max-height: calc(100vh - 240px);
  overflow: hidden;
  display: block;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  position: relative;
}

.file-image-viewer-page {
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.file-image-viewer-page .file-image-stage {
  overflow: hidden;
}

.file-image-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
}

.file-page-jump-trigger {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit !important;
  font-weight: inherit;
  line-height: inherit;
  font-size: inherit;
  vertical-align: baseline;
  cursor: pointer;
}

.file-page-jump-trigger:hover,
.file-page-jump-trigger:focus {
  color: inherit !important;
}

.file-toolbar-reset-label {
  display: none;
}

.file-toolbar-reset-icon {
  display: inline-block !important;
  margin-right: 0 !important;
}

@media (min-width: 768px) {
  .file-image-toolbar,
  [data-pdf-page-toolbar] {
    overflow-x: auto;
  }
}

@media (max-width: 576px) {
  .file-toolbar-word-label,
  .file-toolbar-reset-label,
  .file-toolbar-go-label {
    display: none;
  }

  .file-toolbar-go-icon,
  .file-toolbar-reset-icon {
    display: inline-block !important;
  }

  .file-image-toolbar .input-group,
  [data-pdf-page-controls] .input-group {
    width: 5.5rem !important;
  }

  .file-image-toolbar .btn,
  [data-pdf-page-controls] .btn {
    padding-inline: 0.5rem;
  }
}

.file-image-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  padding: 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.collection-link-board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(5rem, 10vw) minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.collection-link-column {
  position: relative;
  z-index: 1;
}

.collection-link-column--exercises {
  grid-column: 1;
}

.collection-link-column--texts {
  grid-column: 3;
}

.collection-link-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}

.collection-link-card {
  width: 100%;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  background: var(--app-surface);
  color: inherit;
  padding: 0.9rem 1rem;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.collection-link-card:hover,
.collection-link-card.is-selected {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.12);
}

.collection-link-path {
  fill: none;
  stroke: rgba(13, 110, 253, 0.55);
  stroke-width: 3;
}

.practice-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.9rem;
}

.practice-quick-card {
  appearance: none;
  border: 1px solid var(--bs-border-color);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  color: inherit;
  min-height: 142px;
  padding: 1rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.practice-quick-card:hover,
.practice-quick-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(13, 110, 253, 0.45);
  box-shadow: 0 10px 24px rgba(13, 110, 253, 0.12);
  outline: none;
}

.practice-quick-card-icon {
  font-size: 1.4rem;
  color: var(--bs-primary);
}

.practice-quick-card-title {
  font-weight: 600;
  line-height: 1.2;
}

.practice-quick-card-meta {
  margin-top: auto;
  color: var(--bs-secondary-color);
  font-size: 0.9rem;
}

@media (max-width: 991px) {
  .collection-link-board {
    grid-template-columns: 1fr;
  }

  .collection-link-svg {
    display: none;
  }
}

.file-detail-image {
  display: block;
  margin: 0 auto;
  width: auto;
  max-width: 100%;
  height: auto;
  border: 0 !important;
}

.file-rotated-image {
  will-change: transform;
  transform-origin: center center;
}

.file-ocr-reader-view {
  min-height: 320px;
  max-height: 60vh;
  overflow: auto;
  background: #fffdf7;
  line-height: 1.9;
  white-space: pre-wrap;
}

.file-ocr-reader-token {
  display: inline;
  border: 0;
  background: transparent;
  padding: 0 0.08rem;
  border-radius: 0.2rem;
  color: inherit;
}

.file-ocr-reader-token:hover,
.file-ocr-reader-token:focus {
  background: rgba(13, 110, 253, 0.12);
  outline: none;
}

.file-ocr-reader-token.is-active {
  background: rgba(25, 135, 84, 0.16);
}

.file-ocr-reader-results {
  max-height: 300px;
  overflow: auto;
}

.file-ocr-vocab-text {
  min-height: 320px;
  max-height: 70vh;
  overflow: auto;
  white-space: pre-wrap;
  background: #fffdf7;
}

.file-practice-order-item {
  cursor: grab;
}

.file-practice-order-item.is-dragging {
  opacity: 0.65;
  cursor: grabbing;
}

.file-collection-open-btn {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.25;
}

.practice-text-cloze-inline {
  white-space: pre-wrap;
  line-height: 1.8;
}

.practice-cloze-gap {
  display: inline-block;
  min-width: 8ch;
  max-width: 28ch;
  padding: 0.12rem 0.35rem;
  margin: 0 0.12rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.35rem;
  vertical-align: baseline;
}

.practice-cloze-gap.is-correct {
  border-color: var(--bs-success);
  background: rgba(25, 135, 84, 0.12);
}

.practice-cloze-gap.is-wrong {
  border-color: var(--bs-danger);
  background: rgba(220, 53, 69, 0.12);
}

.book-folder-tree {
  display: grid;
  gap: 10px;
}

.book-folder-tree-item {
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.02);
}

.book-folder-tree-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.book-folder-tree-main {
  min-width: 0;
}

.book-folder-tree-children {
  margin-top: 10px;
  margin-left: 18px;
  padding-left: 12px;
  border-left: 2px solid var(--bs-border-color);
  display: grid;
  gap: 8px;
}

.practice-section .btn-group .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  font-weight: 600;
}
.practice-toggle .btn {
  border-width: 2px;
}
.practice-toggle .btn-check:checked + .btn {
  color: #fff;
  background: var(--bs-primary);
  border-color: var(--bs-primary);
  box-shadow: 0 8px 18px rgba(13, 110, 253, 0.2);
}
.practice-toggle .btn i {
  opacity: 0.85;
}

.practice-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.practice-toggle-grid .btn {
  width: 100%;
  min-height: 46px;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
}

@media (max-width: 575.98px) {
  .practice-toggle-grid {
    grid-template-columns: 1fr;
  }
}

.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1040;
  display: grid;
  justify-items: end;
  gap: 10px;
}
.fab-btn {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 0;
  background: var(--bs-primary);
  color: #fff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}
.fab-btn:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.35);
  outline-offset: 3px;
}
.fab-menu {
  display: none;
  background: var(--app-surface);
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  min-width: 220px;
}
.fab.is-open .fab-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 900px) {
  .fab.is-open .fab-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.fab-item {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 0.78rem;
  text-align: center;
}
.fab-item i {
  font-size: 1.1rem;
}
.fab-item:hover,
.fab-item:focus {
  background: rgba(13, 110, 253, 0.08);
  text-decoration: none;
}

.words-scroll {
  overflow: visible;
}

.badge-truncate {
  max-width: 160px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  text-overflow: ellipsis;
  line-height: 1.1;
  text-align: left;
}

.badge-tiny {
  font-size: 0.64rem;
  font-weight: 500;
}

.badge-outline {
  background-color: transparent !important;
  border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color) !important;
  --bs-badge-color: var(--bs-body-color);
}

.practice-collection-title {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
  margin-top: 0.25rem;
}

.practice-progress {
  font-weight: 700;
  letter-spacing: 0.01em;
}

#exercise-prompt {
  font-size: 1.2rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

#exercise-inputs .cloze-line {
  font-size: 1.2rem;
  line-height: 1.7;
  display: block;
  white-space: normal;
}

#exercise-inputs .cloze-line [data-cloze-input] {
  font-size: 0.95rem;
  line-height: 1.2;
  height: 2rem;
  padding: 0.15rem 0.35rem;
  vertical-align: baseline;
  margin: 0 0.12rem !important;
}

#exercise-inputs .cloze-line .cloze-select-compact {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: none !important;
  padding-right: 0.35rem;
}

#exercise-inputs .cloze-line .cloze-select-vowel {
  width: 3.4rem !important;
  min-width: 3.4rem !important;
  max-width: 3.4rem !important;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
  text-align: center;
}

@media (max-width: 767.98px) {
  #exercise-prompt {
    font-size: 1.05rem;
  }
  #exercise-inputs .cloze-line {
    font-size: 1.05rem;
    line-height: 1.6;
  }
}

@media (max-width: 600px) {
  .search-panel {
    position: absolute;
    width: calc(100vw - 24px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

@media (max-width: 991.98px) {
  .nav-compact { grid-template-columns: auto 1fr auto; }
  .navbar .container-fluid { flex-wrap: wrap; }
  .navbar-collapse { width: 100%; flex-basis: 100%; order: 3; }
  .navbar-collapse { display: none !important; }
  .navbar-collapse.show { display: block !important; }
  .navbar-toggler { display: inline-flex !important; }
  .navbar-nav { padding-top: 8px; }
  .navbar-nav .nav-link { padding-left: 0; padding-right: 0; }
  .navbar-collapse .navbar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .navbar-collapse .nav-item {
    width: 100%;
  }
  .navbar-collapse .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    padding: 10px 6px;
    border-radius: 10px;
    background: var(--app-surface);
    border: 1px solid var(--bs-border-color);
  }
  .navbar-collapse .nav-link i { margin: 0; }
  .navbar-collapse .nav-item .btn {
    width: 100%;
    justify-content: center;
  }
  .navbar-collapse .nav-more {
    width: 100%;
  }
  .navbar-collapse .nav-item-more {
    grid-column: 1 / -1;
  }
  .navbar-collapse .nav-more-toggle {
    width: 100%;
    justify-content: center;
  }
  .navbar-collapse .nav-more-menu {
    position: static;
    min-width: 0;
    width: 100%;
    margin-top: 6px;
    box-shadow: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }
  .navbar-collapse .nav-more[open] .nav-more-menu {
    display: grid;
  }
  .navbar-collapse .nav-more-item {
    text-align: center;
    border: 1px solid var(--bs-border-color);
    background: var(--app-surface);
  }
  .navbar-collapse .nav-more-button {
    width: 100%;
    border: 1px solid var(--bs-border-color);
    background: var(--app-surface);
  }
  .navbar-collapse .nav-more-item i {
    margin-right: 0 !important;
    display: block;
    margin-bottom: 4px;
  }
  .navbar-collapse .nav-more-item-admin {
    margin-top: 0;
    border-top: 1px solid var(--bs-border-color);
    padding-top: 8px;
  }
}

@media (max-width: 767.98px) {
  body {
    padding-top: 64px;
  }

  .navbar {
    padding: 10px 12px;
  }

  .file-detail-page {
    margin-top: 0.25rem !important;
  }

  .file-detail-header {
    gap: 0.25rem;
  }

  .file-detail-title-row {
    flex-direction: column;
    align-items: center !important;
    text-align: center;
    gap: 0.5rem;
  }

  .file-detail-title-block {
    width: 100%;
  }

  .file-detail-title {
    font-size: 1rem;
    line-height: 1.12;
    max-width: 100%;
    margin-inline: auto;
  }

  .file-detail-title-meta {
    margin-top: 0.2rem;
  }

  .file-detail-title-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .file-detail-nav-label {
    display: none;
  }

  .file-detail-nav-top {
    align-items: stretch;
    flex-direction: column;
  }

  .file-detail-nav-mode {
    width: 100%;
  }

  .file-detail-nav-mode .btn {
    flex: 1 1 0;
  }

  .file-detail-nav-select-label {
    display: none;
  }

  .file-detail-nav-actions {
    gap: 0.5rem;
  }

  .file-preview-shell {
    padding: 0.5rem;
  }

  .file-image-viewer {
    max-height: none;
    overflow: visible;
  }

  .file-detail-image {
    width: 100%;
    max-width: 100%;
    height: auto;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .navbar-collapse .navbar-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.file-dropzone {
  border: 2px dashed var(--bs-border-color);
  border-radius: 12px;
  padding: 14px;
  background: var(--app-surface);
}
.file-dropzone.is-dragover {
  border-color: var(--bs-primary);
  background: rgba(13, 110, 253, 0.08);
}
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.file-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.file-list {
  display: grid;
  gap: 10px;
}
.file-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  background: var(--app-surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 250px;
}
.file-card.is-selected,
.file-row.is-selected {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.18);
}
.file-card.is-drag-selecting,
.file-row.is-drag-selecting {
  background: rgba(13, 110, 253, 0.06);
}
.folder-marquee-selection {
  position: fixed;
  z-index: 1600;
  pointer-events: none;
  border: 1px solid rgba(13, 110, 253, 0.65);
  background: rgba(13, 110, 253, 0.12);
  border-radius: 8px;
}
.file-card-preview {
  aspect-ratio: 1 / 1;
  background: #f3f5f7;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--bs-border-color);
}
[data-theme="dark"] .file-card-preview {
  background: #20242c;
}
.file-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-pdf-thumb {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.file-pdf-thumb-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.file-card-link {
  color: inherit;
  text-decoration: none;
}
.file-card-link:hover,
.file-card-link:focus {
  color: inherit;
  text-decoration: none;
}
.file-icon {
  font-size: 2rem;
  color: var(--bs-secondary-color);
}
.file-card-body {
  padding: 10px;
}
.file-card-compact {
  min-height: 0;
  position: relative;
}
.file-card-preview-compact {
  aspect-ratio: 4 / 3;
}
.file-card-body-compact {
  padding: 8px;
}
.folder-card-preview {
  background: linear-gradient(180deg, #f8f2d6 0%, #efe3ad 100%);
}
.folder-card-icon {
  font-size: 2.2rem;
  color: #8b6b00;
}
[data-theme="dark"] .folder-card-preview {
  background: linear-gradient(180deg, #3a3219 0%, #4b401f 100%);
}
[data-theme="dark"] .folder-card-icon {
  color: #f0d37a;
}
.file-card-actions {
  padding: 0 8px 8px;
}
.file-row {
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  background: var(--app-surface);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  align-items: center;
}
.file-select-box {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 0 0 8px;
}
.file-card .file-select-box {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}
.file-row-preview {
  width: 92px;
  min-width: 92px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  overflow: hidden;
  background: #f3f5f7;
  display: grid;
  place-items: center;
}
[data-theme="dark"] .file-row-preview {
  background: #20242c;
}
.file-row-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.file-row .file-pdf-thumb,
.file-row .file-pdf-thumb-canvas {
  width: 100%;
  height: 100%;
}
.book-thumb {
  width: 92px;
  min-width: 92px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  overflow: hidden;
  background: #f3f5f7;
  display: grid;
  place-items: center;
}

[data-theme="dark"] .book-thumb {
  background: #20242c;
}

.book-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-thumb-placeholder {
  font-size: 1.5rem;
  color: var(--bs-secondary-color);
}
.file-row-body {
  min-width: 0;
  flex: 1;
}
.file-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.file-row-kind {
  text-transform: lowercase;
  white-space: nowrap;
}
.file-row-badges {
  min-width: 0;
}
.file-row .file-card-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}
.folder-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(13, 110, 253, 0.14);
  display: grid;
  place-items: center;
  padding: 24px;
}
.folder-drop-overlay-box {
  width: min(520px, 100%);
  border: 2px dashed var(--bs-primary);
  border-radius: 20px;
  background: var(--app-surface);
  padding: 28px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
}
.folder-drop-overlay.is-dragover {
  background: rgba(13, 110, 253, 0.22);
}
@media (max-width: 767px) {
  .file-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }
  .file-card-preview-compact {
    aspect-ratio: 1 / 1;
  }
  .file-card-body-compact {
    padding: 6px;
  }
  .folder-card-icon {
    font-size: 1.8rem;
  }
  .file-row {
    grid-template-columns: 1fr;
  }
  .file-row-meta {
    gap: 6px;
  }
}
.file-preview-frame {
  width: 100%;
  min-height: 72vh;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
}

.file-pdf-page-view {
  display: flex;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  position: relative;
}

.file-pdf-page-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  padding: 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.file-pdf-page-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  will-change: transform;
  transform-origin: center center;
  border: 0 !important;
}

.drive-sync-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--bs-body-bg);
}

.drive-sync-grid-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
}

.drive-sync-grid-cell {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--bs-border-color-translucent);
  min-width: 0;
}

.drive-sync-cell-match {
  background: rgba(25, 135, 84, 0.09);
}

.drive-sync-cell-missing {
  background: rgba(13, 110, 253, 0.11);
}

.drive-sync-cell-changed {
  background: rgba(255, 193, 7, 0.13);
}

.drive-sync-cell-rename {
  background: rgba(13, 202, 240, 0.11);
}

.drive-sync-cell-extra {
  background: rgba(108, 117, 125, 0.11);
}

.drive-sync-grid-cell-folder {
  background:
    linear-gradient(0deg, rgba(253, 126, 20, 0.12), rgba(253, 126, 20, 0.12)),
    var(--drive-sync-cell-bg, transparent);
  box-shadow: inset 3px 0 0 rgba(253, 126, 20, 0.4);
}

.drive-sync-grid-cell-folder.drive-sync-cell-match {
  --drive-sync-cell-bg: rgba(25, 135, 84, 0.09);
}

.drive-sync-grid-cell-folder.drive-sync-cell-missing {
  --drive-sync-cell-bg: rgba(13, 110, 253, 0.11);
}

.drive-sync-grid-cell-folder.drive-sync-cell-changed {
  --drive-sync-cell-bg: rgba(255, 193, 7, 0.13);
}

.drive-sync-grid-cell-folder.drive-sync-cell-rename {
  --drive-sync-cell-bg: rgba(13, 202, 240, 0.11);
}

.drive-sync-grid-cell-folder.drive-sync-cell-extra {
  --drive-sync-cell-bg: rgba(108, 117, 125, 0.11);
}

.drive-sync-grid-cell-folder .drive-sync-entry {
  font-weight: 600;
}

.drive-sync-grid-cell:nth-child(2n) {
  border-left: 1px solid var(--bs-border-color);
}

.drive-sync-entry {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-bottom: 0.2rem;
}

.drive-sync-entry > .text-break,
.drive-sync-entry > .fw-semibold {
  min-width: 0;
}

.drive-sync-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  border: 1px solid transparent;
}

.drive-sync-status-neutral {
  background: rgba(108, 117, 125, 0.08);
  color: rgba(73, 80, 87, 0.92);
  border-color: rgba(108, 117, 125, 0.12);
}

.drive-sync-status-match {
  background: rgba(25, 135, 84, 0.09);
  color: rgba(20, 108, 67, 0.92);
  border-color: rgba(25, 135, 84, 0.14);
}

.drive-sync-folder-toggle {
  color: inherit;
}

@media (max-width: 767.98px) {
  .drive-sync-grid {
    grid-template-columns: 1fr;
  }

  .drive-sync-grid-header:nth-child(2) {
    display: none;
  }

  .drive-sync-grid-cell:nth-child(2n) {
    border-left: 0;
  }

  .drive-sync-grid-cell[data-status="matched"][data-side="remote"],
  .drive-sync-grid-cell[data-status="changed"][data-side="remote"],
  .drive-sync-grid-cell[data-status="probable_rename"][data-side="remote"],
  .drive-sync-grid-cell[data-status="extra_local"][data-side="remote"],
  .drive-sync-grid-cell[data-status="missing"][data-side="local"] {
    display: none;
  }
}

.book-upload-dropzone {
  border: 1px dashed rgba(13, 110, 253, 0.35);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.book-upload-dropzone.is-dragover {
  background: rgba(13, 110, 253, 0.08);
  border-color: rgba(13, 110, 253, 0.75);
  box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.15);
}
.word-hero-card {
  background:
    radial-gradient(circle at top right, rgba(194, 224, 255, 0.35), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
}

.word-hero-translation {
  font-size: 1.05rem;
  color: var(--bs-secondary-color, #6c757d);
}

.word-lemma-breadcrumb,
.word-hero-lemma {
  font-size: 0.9rem;
  color: var(--bs-secondary-color, #6c757d);
}

.word-lemma-breadcrumb a,
.word-hero-lemma a {
  color: inherit;
}

.word-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.word-entry-line {
  margin-top: 0.35rem;
  font-size: 0.98rem;
  line-height: 1.45;
}

.word-entry-grammar {
  font-weight: 600;
  margin-right: 0.45rem;
}

.word-entry-definition {
  color: var(--bs-body-color);
}

.word-entry-examples {
  max-width: 62rem;
}

.word-example-button {
  white-space: normal;
  border-radius: 0.9rem;
}

.word-example-button:hover,
.word-example-button:focus {
  border-color: rgba(var(--bs-primary-rgb), 0.35);
  background: rgba(var(--bs-primary-rgb), 0.05);
}

.word-hero-grid > [class*='col-'] {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.85rem;
  background: rgba(255,255,255,0.82);
}

.word-section-nav-card {
  background: linear-gradient(180deg, rgba(248,249,250,0.96), rgba(255,255,255,0.96));
}

.word-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.word-section-nav-link {
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: inherit;
  font-size: 0.9rem;
}

.word-section-nav-link:hover {
  background: rgba(13,110,253,0.08);
  border-color: rgba(13,110,253,0.18);
}

#word-lemma-section,
#word-inflected-section,
#word-verb-form-section,
#word-conjugations-section,
#word-inflections-section,
#word-exercises-section,
#word-relations-section,
#word-tags-section,
#word-texts-section,
#word-collections-section {
  scroll-margin-top: 92px;
}

.word-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.95fr);
  gap: 1rem;
  align-items: start;
}

.word-detail-main,
.word-detail-side {
  min-width: 0;
}

.word-detail-side {
  position: sticky;
  top: 84px;
}

@media (max-width: 767.98px) {
  .word-hero-card .card-body {
    padding: 0.9rem;
  }

  .word-hero-card .page-title {
    font-size: 1.65rem;
    line-height: 1.1;
  }

  .word-hero-translation {
    font-size: 0.98rem;
  }

  .word-lemma-breadcrumb,
  .word-hero-lemma {
    font-size: 0.82rem;
  }

  .word-hero-chips {
    gap: 0.32rem;
  }

  .word-hero-chips .badge {
    font-size: 0.72rem;
    max-width: 100%;
  }

  .word-entry-line {
    font-size: 0.92rem;
  }

  .word-hero-grid {
    --bs-gutter-x: 0.55rem;
    --bs-gutter-y: 0.55rem;
  }

  .word-hero-grid > [class*='col-'] {
    flex: 0 0 50%;
    width: 50%;
    padding: 0.55rem 0.6rem;
  }

  .word-hero-grid > [class*='col-'] .btn.btn-link {
    white-space: normal;
    text-align: left;
  }

  .word-section-nav-card {
    position: static;
    top: auto;
    z-index: auto;
    border-top-left-radius: 0.85rem;
    border-top-right-radius: 0.85rem;
  }

  .word-section-nav {
    gap: 0.4rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .word-section-nav::-webkit-scrollbar {
    display: none;
  }

  .word-section-nav-link {
    font-size: 0.85rem;
    padding: 0.3rem 0.55rem;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .word-detail-main > .card,
  .word-detail-side > .card {
    margin-bottom: 0.75rem !important;
  }

  .word-detail-side .card-body,
  .word-detail-main .card-body {
    padding: 0.9rem;
  }

  #word-exercises-section .list-group-item,
  #word-relations-section .list-group-item,
  #word-texts-section .list-group-item,
  #word-collections-section .list-group-item {
    padding: 0.72rem 0.82rem;
  }

  #word-conjugations-section .table td,
  #word-conjugations-section .table th {
    padding: 0.38rem 0.45rem;
  }

  #word-conjugations-section .table td:first-child {
    white-space: nowrap;
    width: 1%;
  }

  #word-lemma-section ul {
    padding-left: 1rem;
  }

  #word-lemma-section,
  #word-inflected-section,
  #word-verb-form-section,
  #word-conjugations-section,
  #word-inflections-section,
  #word-exercises-section,
  #word-relations-section,
  #word-tags-section,
  #word-texts-section,
  #word-collections-section {
    scroll-margin-top: 74px;
  }
}

@media (max-width: 991.98px) {
  .word-detail-layout {
    grid-template-columns: 1fr;
  }

  .word-detail-side {
    position: static;
    top: auto;
  }

  .missing-diphthongs-actions .btn {
    width: 100%;
    justify-content: center;
  }
}
