:root {
  --bg: #f4f1ea;
  --surface: #fffef9;
  --ink: #1a1c1e;
  --muted: #5c5f64;
  --de: #0d3b2c;
  --en: #4a3d6b;
  --accent: #c45c26;
  --accent-soft: rgba(196, 92, 38, 0.12);
  --border: #d8d2c6;
  --radius: 12px;
  --font-de: "Literata", Georgia, serif;
  --font-ui: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 100% -20%, rgba(196, 92, 38, 0.08), transparent),
    radial-gradient(ellipse 80% 60% at 0% 100%, rgba(74, 61, 107, 0.06), transparent);
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(255, 254, 249, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.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;
}

.search {
  position: relative;
  flex: 1 1 14rem;
  max-width: 22rem;
  min-width: 10rem;
}

.search__input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--ink);
}

.search__input::placeholder {
  color: var(--muted);
}

.search__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search__results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(70vh, 22rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  z-index: 50;
}

.search__list {
  padding: 0.35rem;
}

.search__hit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  color: inherit;
}

.search__hit:hover,
.search__hit:focus-visible {
  background: var(--accent-soft);
}

.search__lemma {
  grid-column: 1;
  font-family: var(--font-de);
  font-weight: 600;
  color: var(--de);
}

.search__mean {
  grid-column: 1;
  font-size: 0.8rem;
  color: var(--muted);
}

.search__kind {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  white-space: nowrap;
}

.search__empty {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.vocab-card--flash {
  animation: vocabFlash 1.4s ease;
}

@keyframes vocabFlash {
  0%,
  40% {
    box-shadow: 0 0 0 3px var(--accent);
    background: var(--accent-soft);
  }
  100% {
    box-shadow: none;
    background: var(--surface);
  }
}

.brand__title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.brand__sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  max-width: min(100%, 28rem);
}

@media (min-width: 900px) {
  .top {
    flex-wrap: nowrap;
  }

  .pager {
    max-width: none;
  }
}

.pager__btn {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pager__btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pager__btn[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sheet {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.page {
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page__head {
  margin-bottom: 1.5rem;
}

.page__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.page__title {
  font-family: var(--font-de);
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.page__title .cont {
  font-weight: 400;
  font-size: 0.85em;
  color: var(--muted);
  font-style: italic;
}

.bilingual .de {
  font-family: var(--font-de);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  line-height: 1.4;
  color: var(--de);
}

.bilingual .en {
  margin: 0;
  color: var(--en);
  font-size: 0.95rem;
  font-style: italic;
}

.de {
  color: var(--de);
}

.en {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.page .en.intro-en {
  margin-top: 0.25rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cefr {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.cefr__levels {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
}

.cefr__levels li {
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.toc {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.toc li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.toc li:last-child {
  border-bottom: none;
}

.toc .num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
  min-width: 1.5rem;
}

.prose p {
  margin: 0 0 0.85rem;
  line-height: 1.65;
}

.prose .de {
  font-family: var(--font-de);
  font-size: 1.02rem;
}

.prose p:has(.de) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
}

.prose p .de {
  flex: 1 1 16rem;
}

.signature {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.signature .de {
  display: block;
  font-family: var(--font-de);
  font-weight: 600;
}

.signature .en {
  display: block;
  margin-top: 0.25rem;
}

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  font-family: var(--font-de);
  font-size: 1.05rem;
  color: var(--de);
}

.topic-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 640px) {
  .topic-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.topic-block {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.topic-block h2 {
  font-size: 0.95rem;
  margin: 0 0 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.topic-block .en {
  font-size: 0.78rem;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.topic-list li {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.35rem 0.5rem;
  align-items: start;
  padding: 0.4rem 0;
  border-top: 1px dashed var(--border);
  font-size: 0.88rem;
}

.topic-list li:first-child {
  border-top: none;
  padding-top: 0;
}

.topic-list .en {
  font-size: 0.82rem;
}

.bullets-de {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.bullets-de li {
  margin-bottom: 0.35rem;
}

.refs {
  margin: 0 0 1rem;
  padding-left: 1rem;
}

.refs li {
  margin-bottom: 0.5rem;
}

.speak {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.65rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s;
}

.speak:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.05);
}

.speak:active {
  transform: scale(0.96);
}

.speak.sm {
  width: 1.85rem;
  height: 1.85rem;
  font-size: 0.55rem;
}

.num-section {
  margin-bottom: 2rem;
}

.num-section h2 {
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.pair-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.pair-table th,
.pair-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.pair-table th {
  background: var(--accent-soft);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.pair-table tr:last-child td {
  border-bottom: none;
}

.pair-table .mono {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  width: 3.5rem;
}

.date-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.date-list li {
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.date-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.date-row .de {
  flex: 1;
  margin: 0;
  font-family: var(--font-de);
  font-size: 0.95rem;
  line-height: 1.5;
}

.foot {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Pages 9–12: alphabetical vocabulary */
.vocab-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.vocab-card {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
}

.vocab-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border);
}

.vocab-card__lemma {
  font-family: var(--font-de);
  font-weight: 600;
  font-size: 1.05rem;
}

.vocab-card__mean {
  font-size: 0.88rem;
  flex: 1 1 12rem;
}

.vocab-ex {
  margin-top: 0.65rem;
}

.vocab-ex:first-of-type {
  margin-top: 0;
}

.vocab-ex__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
}

.vocab-ex__row .de {
  flex: 1 1 14rem;
  margin: 0;
  font-family: var(--font-de);
  font-size: 0.98rem;
  line-height: 1.5;
}

.vocab-ex .en {
  margin: 0.35rem 0 0;
  padding-left: 0;
  font-size: 0.9rem;
}

.letter-anchor {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 1.25rem 0 0.25rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--accent);
}

.letter-anchor:first-child {
  margin-top: 0;
}

.letter-anchor__l {
  font-family: var(--font-de);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.letter-anchor__en {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pair-table td.small {
  font-size: 0.82rem;
  line-height: 1.45;
}

.pair-table--dense td {
  vertical-align: top;
}

/* Literature & end pages */
.lit-root {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.lit-block {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lit-block__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.lit-block__row .de {
  flex: 1 1 14rem;
  margin: 0;
  font-family: var(--font-de);
  font-size: 0.92rem;
  line-height: 1.55;
}

.lit-block .en {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.end-card {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--de);
}

.end-card__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.end-card .de {
  flex: 1 1 16rem;
  margin: 0;
  font-family: var(--font-de);
  font-size: 1.05rem;
  line-height: 1.55;
}

.end-card .en {
  margin: 0;
  font-size: 0.95rem;
}

@media (max-width: 480px) {
  .topic-list li {
    grid-template-columns: 1fr auto;
  }

  .topic-list .en {
    grid-column: 1 / -1;
  }
}
