:root {
  --bg: #f6f3ee;
  --ink: #1c1917;
  --muted: #78716c;
  --accent: #0f766e;
  --line: #e7e5e4;
  --card: #fffcf7;
  /* PT Serif/Sans : diacritiques cyrilliques (U+0301) correctement placés */
  --font: "PT Serif", "Noto Serif", "DejaVu Serif", "Liberation Serif", serif;
  --sans: "PT Sans", "Noto Sans", "DejaVu Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(ellipse at top left, #efe8dc 0%, transparent 50%),
    linear-gradient(180deg, #faf7f2, var(--bg));
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: relative;
  z-index: 20;
}
@media (hover: hover) and (pointer: fine) {
  .site-header {
    position: sticky;
    top: 0;
    background: rgba(255, 252, 247, 0.92);
    backdrop-filter: blur(8px);
  }
}
.brand {
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.site-header nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 1;
  min-width: 0;
}
.site-header nav .nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  color: var(--muted);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1.2;
  box-sizing: border-box;
}
.site-header nav a.nav-link:hover,
.site-header nav .nav-logout .nav-link:hover {
  background: #f0ebe3;
  text-decoration: none;
  color: var(--ink);
}
.nav-ico {
  display: none;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.nav-label {
  min-width: 0;
}
.site-header nav a.nav-user {
  color: var(--ink);
  font-weight: 600;
  max-width: 11rem;
}
.site-header nav a.nav-user .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-avatar {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0ebe3;
}
.site-header nav .nav-logout {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.site-header nav .nav-logout .nav-link {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.message {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 0.95rem;
}
.auth-card {
  max-width: 22rem;
  margin: 1.5rem auto 0;
  padding: 1.25rem 1.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.auth-card h1 {
  font-family: var(--font);
  font-size: 1.35rem;
  margin: 0 0 1rem;
}
.auth-error {
  margin: 0 0 0.85rem;
  color: #b91c1c;
  font-size: 0.95rem;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="email"] {
  font-size: 16px;
  line-height: 1.25;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  width: 100%;
}
.auth-form input {
  font-size: 16px;
  line-height: 1.25;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  width: 100%;
}
.field-help {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}
.auth-switch {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}
.profile-page h1 {
  font-family: var(--font);
  font-size: 1.75rem;
  margin: 0 0 0.35rem;
}
.profile-page h2 {
  font-family: var(--font);
  font-size: 1.15rem;
  margin: 0 0 0.85rem;
}
.profile-card {
  margin: 1.25rem 0 0;
  padding: 1.1rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  max-width: 28rem;
}
.profile-links {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
}
.plan-line {
  margin: 0 0 0.5rem;
}
.plan-badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
}
.plan-badge.plan-free {
  background: #f0ebe3;
  color: var(--ink);
}
.plan-badge.plan-pro {
  background: var(--accent);
  color: #fff;
}
.avatar-preview {
  margin: 0 0 1rem;
}
.avatar-preview img,
.avatar-placeholder {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0ebe3;
  border: 1px solid var(--line);
}
.avatar-placeholder {
  font-family: var(--font);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--muted);
}
.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
}
.checkbox-label input {
  width: auto;
  min-height: auto;
  margin: 0;
}
.lang-toggle-field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.lang-toggle-field legend {
  padding: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.lang-toggle {
  display: inline-flex;
  margin-top: 0.35rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f0ebe3;
  gap: 0.15rem;
}
.lang-toggle-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  min-height: 2.1rem;
  margin: 0;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  flex-direction: row !important;
  gap: 0 !important;
}
.lang-toggle-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.lang-toggle-option.is-active {
  background: var(--accent);
  color: #fff;
}
.lang-toggle-option:not(.is-active):hover {
  color: var(--ink);
}
.file-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.file-field-label {
  font-size: 0.9rem;
  color: var(--muted);
}
.file-picker {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
}
.file-picker-btn:hover {
  background: var(--accent);
  color: #fff;
}
.file-picker input[type="file"]:focus-visible + .file-picker-btn {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.file-picker-name {
  font-size: 0.9rem;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-form button[type="submit"] {
  margin-top: 0.25rem;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.auth-form button[type="submit"]:hover {
  filter: brightness(0.95);
}
main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2rem;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}
.site-footer {
  max-width: 52rem;
  margin: 1rem auto 0;
  padding: 1rem 1.25rem max(2rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.55rem;
}
.footer-nav a {
  color: var(--ink);
  font-weight: 600;
}
.footer-provider {
  margin: 0 0 0.45rem;
  line-height: 1.45;
  color: var(--ink);
}
.footer-credits {
  margin: 0;
  line-height: 1.45;
}
.legal-page h1 {
  font-family: var(--font);
  font-size: 1.75rem;
  margin: 0 0 0.35rem;
}
.legal-page h2 {
  font-family: var(--font);
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem;
}
.legal-page section p,
.legal-page section ul {
  margin: 0 0 0.65rem;
  max-width: 42rem;
}
.legal-page ul {
  padding-left: 1.2rem;
}
.legal-page li {
  margin: 0.35rem 0;
}

.hero-search h1,
.word-card h1,
section > h1 {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}
.meta { color: var(--muted); font-size: 0.95rem; }
.jump-btn {
  display: inline-block;
  margin-left: 0.55rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  vertical-align: middle;
  line-height: 1.2;
}
.jump-btn:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.conjugation {
  scroll-margin-top: 1rem;
}
.search-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.search-form input {
  flex: 1;
  font-size: 16px; /* exact 16px: évite zoom + bugs IME Android */
  line-height: 1.25;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  touch-action: manipulation;
}
.search-form button,
.filters button {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
}
.suggest {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}
.suggest li a {
  display: block;
  padding: 0.55rem 0.9rem;
  color: var(--ink);
}
.suggest li a:hover { background: #f0ebe3; text-decoration: none; }

.word-list { list-style: none; padding: 0; margin: 1rem 0; }
.word-list li { border-bottom: 1px solid var(--line); }
.word-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1rem;
  padding: 0.7rem 0.15rem;
  color: var(--ink);
}
.word-list .lemma,
.lemma {
  font-family: var(--font);
  font-size: 1.15rem;
  font-feature-settings: "kern" 1;
}
h1.lemma { font-size: 2rem; }
/* Voyelle accentuée : le combining acute reste collé à la lettre */
.stress {
  display: inline;
  font-family: var(--font);
}
button.play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--accent);
  font-size: 0.7rem;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
}
button.play:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
a.play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-size: 0.7rem;
  vertical-align: middle;
  line-height: 1;
  text-decoration: none;
  position: relative;
}
a.play-locked:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.play-pro {
  position: absolute;
  right: -0.55rem;
  bottom: -0.45rem;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0.12rem 0.22rem;
  border-radius: 0.25rem;
  background: var(--accent);
  color: #fff;
}
.lemma button.play,
.lemma a.play {
  width: 2rem;
  height: 2rem;
  font-size: 0.8rem;
}
.subscribe-page { max-width: 36rem; }
.subscribe-lead { color: var(--muted); margin-bottom: 1.25rem; }
.subscribe-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.2rem;
}
.subscribe-list li { margin: 0.35rem 0; }
.subscribe-payment {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}
.word-list .type { color: var(--muted); font-size: 0.85rem; text-align: right; }
.word-list .gloss {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.9rem;
}
.word-list .rank {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.levels-hub,
.level-path {
  margin-top: 0.25rem;
}
.levels-intro {
  max-width: 40rem;
  margin-bottom: 1.5rem;
}
.crumb {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}
.crumb a { color: var(--accent); }
.level-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  vertical-align: middle;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}
.levels-hub .level-grid {
  gap: 1.1rem;
}
.level-card {
  --level-tone: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 8.5rem;
  padding: 1.15rem 1.2rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(
      165deg,
      color-mix(in srgb, var(--level-tone) 10%, var(--card)) 0%,
      var(--card) 42%
    );
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 4%, transparent);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.level-card:hover,
.level-card:focus-visible {
  border-color: color-mix(in srgb, var(--level-tone) 55%, var(--line));
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--level-tone) 12%, transparent);
  outline: none;
}
.level-card[data-level="A1"] { --level-tone: #0f766e; }
.level-card[data-level="A2"] { --level-tone: #0e7490; }
.level-card[data-level="B1"] { --level-tone: #047857; }
.level-card[data-level="B2"] { --level-tone: #0f766e; }
.level-card[data-level="C1"] { --level-tone: #b45309; }
.level-card[data-level="C2"] { --level-tone: #9f1239; }
.level-code {
  font-family: var(--font);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--level-tone, var(--accent));
  letter-spacing: 0.02em;
}
.level-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}
.level-count {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 0.35rem;
}
.level-cta {
  margin-top: 0.15rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--level-tone, var(--accent));
}
.level-card-compact {
  min-height: 0;
  padding: 0.85rem 0.95rem;
}
.level-card-compact .level-code {
  font-size: 1.35rem;
}
.level-grid-browse {
  margin-bottom: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}
.home-levels {
  margin-top: 1.75rem;
}
.home-levels-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.home-levels-head h2 {
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}
.home-levels-more {
  font-size: 0.9rem;
  color: var(--accent);
  white-space: nowrap;
}
.level-grid-home {
  margin-top: 0;
}

.word-card section { margin-top: 1.75rem; }
.word-card h2 {
  font-family: var(--font);
  font-size: 1.15rem;
  margin: 0 0 0.6rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.25rem;
}
.translations { list-style: none; padding: 0; }
.translations li { margin: 0.25rem 0; }
.sense-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: none;
}
.sense {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.sense .gloss {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.sense-num {
  color: var(--muted);
  font-weight: 600;
  margin-right: 0.25rem;
}
.sense-info {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-style: italic;
}
.sense-ex {
  margin: 0.55rem 0 0.15rem;
  font-family: var(--font);
  font-size: 1.05rem;
}
.sense-ex + .tr {
  margin-bottom: 0.15rem;
}
.ru-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}
.ru-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}
.word-family .rel-group { margin: 0 0 1rem; }
.word-family .rel-label {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--muted);
}
.rel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.rel {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  font-family: var(--font);
}
.rel-prefix {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 2.2rem;
}
.rel-lemma {
  font-weight: 600;
  color: var(--ink);
}
a.rel-lemma:hover { color: var(--accent); }
.rel-gloss {
  font-family: var(--sans);
  color: var(--muted);
  font-size: 0.92rem;
}
.rel-note {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
}
.collocations .collo-group { margin: 0 0 1.25rem; }
.collocations .collo-label {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--muted);
}
.collo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.collo {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.collo-ru {
  margin: 0;
  font-family: var(--font);
  font-size: 1.08rem;
  font-weight: 600;
}
.collo-en {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.collo-ex { margin-top: 0.45rem !important; }
.sense .tr {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.sense-pending,
.tr-pending {
  color: var(--muted);
  font-style: italic;
  font-size: 0.9rem;
}
.tr-pending { margin: 0.15rem 0 0; }
.lang {
  display: inline-block;
  min-width: 2rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}
.forms {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  font-family: var(--font);
}
.forms th, .forms td {
  border: 1px solid var(--line);
  padding: 0.4rem 0.55rem;
  text-align: left;
}
.forms thead th { background: #efe8dc; }
/* Horizontal scroll for wide declension / conjugation tables on phones */
.word-card section:has(table.forms) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.conjugation h3 {
  font-family: var(--font);
  font-size: 1.05rem;
  margin: 1.25rem 0 0.45rem;
  font-weight: 600;
}
.conjugation .conj-persons { margin-top: 0.75rem; }
.conjugation .conj-persons th:first-child,
.conjugation .conj-side th {
  width: 7.5rem;
  color: var(--muted);
  font-weight: 600;
  font-family: var(--sans);
  font-size: 0.85rem;
}
.conjugation td.empty {
  color: var(--muted);
  text-align: center;
}
.conjugation .conj-side {
  max-width: 28rem;
}
.examples { list-style: none; padding: 0; }
.examples li {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.examples .ru { margin: 0 0 0.35rem; font-family: var(--font); font-size: 1.05rem; }
.examples .tr { margin: 0; color: var(--muted); font-size: 0.95rem; }
.examples .tr .lang {
  display: inline-block;
  min-width: 2.1rem;
  margin-right: 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.home-sentences {
  margin-top: 2rem;
}
.home-sentences h2 {
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.85rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin: 1rem 0;
}
.filters label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.filters select {
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
}
.pager { display: flex; gap: 1rem; margin-top: 1rem; }

.pwa-install-bar {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 12%, transparent);
}
.pwa-install-bar[hidden] { display: none !important; }
.pwa-install-btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.pwa-install-hint {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.pwa-install-dismiss {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
}

@media (max-width: 640px) {
  .brand { font-size: 1.05rem; }
  .site-header {
    gap: 0.35rem;
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }
  .site-header nav {
    gap: 0.05rem;
  }
  .site-header nav .nav-link {
    min-width: 2.6rem;
    min-height: 2.6rem;
    padding: 0.45rem;
  }
  .nav-ico {
    display: block;
  }
  .site-header nav .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .site-header nav a.nav-user {
    max-width: none;
  }
  .nav-avatar {
    width: 1.45rem;
    height: 1.45rem;
  }
  main { padding-top: 1rem; }
  .search-form { flex-direction: column; }
  .search-form button,
  .filters button {
    min-height: 2.75rem;
    width: 100%;
  }
  .word-list a {
    grid-template-columns: 1fr;
    padding: 0.85rem 0.1rem;
  }
  .word-list .type { text-align: left; }
  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .levels-hub .level-card {
    min-height: 7.75rem;
    padding: 1rem 1.05rem 0.95rem;
  }
  .level-code {
    font-size: 1.55rem;
  }
  .home-levels-head {
    flex-wrap: wrap;
  }
  h1.lemma { font-size: 1.65rem; }
  .word-card section { margin-top: 1.35rem; }
  .sense, .collo, .examples li {
    padding: 0.75rem 0.8rem;
  }
  .forms {
    font-size: 0.88rem;
  }
  .forms th, .forms td {
    padding: 0.45rem 0.5rem;
    white-space: nowrap;
  }
  .conjugation .conj-persons th:first-child,
  .conjugation .conj-side th {
    width: auto;
    min-width: 4.5rem;
  }
  button.play {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 0.75rem;
    /* easier thumb tap */
  }
  .lemma button.play {
    width: 2.35rem;
    height: 2.35rem;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  .filters select {
    min-height: 2.5rem;
    font-size: 1rem;
  }
  .pager {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .pager a {
    display: inline-block;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
  }
}

@media (hover: none) {
  /* Touch: show link underline affordance lightly */
  .ru-link {
    border-bottom-color: color-mix(in srgb, var(--accent) 35%, transparent);
  }
  button.play:active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
  }
}
