/* Układ strony i komponenty. Kolory wyłącznie ze zmiennych z theme.css. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* Atrybut hidden ma zawsze wygrywać z display: flex/grid z klas komponentów. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 8px;
}

h2 {
  font-size: 1.25rem;
  margin: 0 0 12px;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px calc(var(--nav-height) + 24px);
}

.muted {
  color: var(--text-muted);
}

/* Karty */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

/* Przyciski */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 10px 20px;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-secondary {
  background: var(--accent-tint);
  color: var(--accent-text);
}

.btn-block {
  width: 100%;
}

/* Nawigacja: na telefonie dolny pasek (5 pozycji), na komputerze boczny panel (wszystkie). */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: var(--nav);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-items {
  display: flex;
  height: var(--nav-height);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: var(--tap);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.nav-item[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}

.nav-item svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Elementy tylko dla bocznego panelu (komputer). */
.nav-brand,
.nav-desktop,
.nav-footer {
  display: none;
}

/* Elementy tylko dla telefonu. */
@media (min-width: 1024px) {
  .mobile-only {
    display: none;
  }
}

/* Logo z napisem (nagłówek strony na telefonie, logowanie) */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ===================== Komputer: boczny panel i szeroka treść ===================== */
@media (min-width: 1024px) {
  :root {
    --sidebar: 256px;
  }

  .nav {
    top: 0;
    right: auto;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    border-top: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }

  .nav-brand {
    display: block;
    padding: 0 12px 16px;
  }

  .nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
  }

  .nav-items {
    flex-direction: column;
    gap: 4px;
    height: auto;
  }

  .nav-item,
  .nav-desktop {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.98rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .nav-item:hover {
    background: var(--surface);
    color: var(--text);
  }

  .nav-item[aria-current="page"] {
    background: var(--accent-tint);
    color: var(--accent-text);
    font-weight: 700;
  }

  .nav-item svg {
    width: 22px;
    height: 22px;
  }

  .nav-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .nav-level {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 600;
  }

  .nav-level:hover {
    background: var(--surface);
  }

  .nav-level .level-badge {
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 0.9rem;
  }

  .nav-logout {
    width: 100%;
    min-height: var(--tap);
    padding: 0 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-muted);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .nav-logout:hover {
    background: var(--surface);
    color: var(--text);
  }

  /* Panel zajmuje lewą część ekranu – reszta strony to obszar treści. */
  body.with-nav {
    padding-left: var(--sidebar);
  }

  /* Treść wyśrodkowana w obszarze obok panelu: szeroka na pulpitach i listach,
     węższa na stronach do czytania. Na dużych monitorach nie „ucieka” w lewo. */
  .page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 48px 56px;
  }

  .page-narrow {
    max-width: 900px;
  }

  /* Strony bez panelu (ćwiczenie, test, logowanie) – wyśrodkowana kolumna. */
  .page-exercise {
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 24px 56px;
  }

  .page-brand {
    display: none;
  }


  h1 {
    font-size: 2.4rem;
    letter-spacing: -0.02em;
  }

  .card {
    padding: 24px 28px;
  }
}

/* Formularze */
.field {
  display: block;
  margin-bottom: 16px;
}

.field span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.field input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Komunikat o błędzie (np. złe hasło) */
.alert-warn {
  background: var(--warn-tint);
  color: var(--warn-text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* Ekran logowania bez nawigacji – mniejszy dolny margines */
.page-auth {
  padding-bottom: 24px;
}

/* Listy z linkami (np. tematy w Podstawach) */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li + li {
  border-top: 1px solid var(--border);
}

.list-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
  padding: 10px 0;
  color: var(--text);
}

/* Plakietka, np. poziom B1 */
.badge {
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Nagłówki pomocnicze i nawigacja wstecz */
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  margin-bottom: 8px;
}

/* Tekst ciągły: wyjaśnienia teorii */
.prose p {
  margin: 0 0 12px;
}

.prose p:last-child {
  margin-bottom: 0;
}

.bullets {
  margin: 0;
  padding-left: 20px;
}

.bullets li + li {
  margin-top: 6px;
}

/* Tabela / schemat */
.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table thead th {
  color: var(--text-muted);
  font-weight: 600;
}

.table tbody th {
  color: var(--text-muted);
  font-weight: 400;
}

/* Przykłady i typowe błędy */
.example + .example {
  margin-top: 14px;
}

.example p {
  margin: 0;
}

.example-en {
  font-weight: 600;
}

.wrong {
  color: var(--text-muted);
}

.correct {
  color: var(--accent-text);
}

/* Szybki test */
.quiz-question {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.quiz-question legend {
  margin-bottom: 10px;
  font-weight: 600;
}

.quiz-option {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin-bottom: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option.is-correct {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-text);
}

.quiz-option.is-wrong {
  background: var(--warn-tint);
  border-color: var(--warn);
  color: var(--warn-text);
}

.quiz-explanation {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.quiz-score {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}

/* Słowa klikalne (otwierają hasło w okienku) */
.w {
  cursor: pointer;
  border-radius: 4px;
}

.w:hover {
  background: var(--accent-tint);
  color: var(--accent-text);
}

/* Karta hasła słownika */
.entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.entry-word {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.entry-meta {
  margin: 0;
}

.entry-translations {
  margin: 12px 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.label {
  margin: 18px 0 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.forms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
}

.forms div {
  display: flex;
  gap: 6px;
}

.forms dt {
  color: var(--text-muted);
}

.forms dd {
  margin: 0;
  font-weight: 600;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.status {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
}

.status strong {
  color: var(--text);
}

.status-good {
  background: var(--accent-tint);
  color: var(--accent-text);
}

.status-good strong {
  color: var(--accent-text);
}

.status-weak {
  background: var(--warn-tint);
  color: var(--warn-text);
}

.status-weak strong {
  color: var(--warn-text);
}

mark {
  background: none;
  color: var(--accent);
  font-weight: 700;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.btn.is-static {
  cursor: default;
}

.source {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Okrągły przycisk z ikoną (głośnik, zamknij) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  cursor: pointer;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

/* Okienko (dialog) – na telefonie wysuwa się od dołu */
.dialog {
  width: min(560px, 100%);
  max-height: 85vh;
  margin: auto auto 0;
  padding: 20px 20px 28px;
  border: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
}

.dialog::backdrop {
  background: rgb(0 0 0 / 0.6);
}

.dialog-close {
  float: right;
  margin: -4px -4px 8px 8px;
  background: var(--surface-2);
  color: var(--text);
}

@media (min-width: 640px) {
  .dialog {
    margin: auto;
    border-radius: var(--radius);
  }
}

.search .field {
  margin-bottom: 16px;
}

.small {
  font-size: 0.85rem;
}

/* Karta będąca w całości linkiem (np. jednostka na liście) */
.card-link {
  display: block;
  color: var(--text);
}

.card-link:hover {
  outline: 1px solid var(--border);
}

/* Pasek postępu */
.progress {
  flex: 1;
  height: 10px;
  margin: 12px 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.word-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Ekran ćwiczenia */
.page-exercise {
  padding-bottom: 24px;
}

.exercise-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.exercise-top .progress {
  margin: 0;
}

.icon-btn-plain {
  background: none;
  color: var(--text);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tag-accent {
  border-color: transparent;
  background: var(--accent-tint);
  color: var(--accent-text);
  font-weight: 700;
}

.exercise-title {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.reading {
  font-size: 1.1rem;
  line-height: 1.7;
}

details.card summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

details.card[open] summary {
  margin-bottom: 8px;
}

.field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1.1rem;
  resize: vertical;
}

.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field textarea.is-ok {
  border-color: var(--accent);
}

.field textarea.is-warn {
  border-color: var(--warn);
}

/* Odpowiedź w pytaniach zamkniętych */
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  margin-bottom: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}

.choice input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
}

.choice.is-correct {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent-text);
}

.choice.is-wrong {
  border-color: var(--warn);
  background: var(--warn-tint);
  color: var(--warn-text);
}

.audio-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.sentence-btn {
  margin: 0 8px 8px 0;
}

.btn-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

.btn-ghost {
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Informacja zwrotna */
.feedback h3.label:first-child {
  margin-top: 0;
}

.feedback-title {
  display: flex;
  align-items: center;
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
}

.feedback-title.is-ok {
  color: var(--accent);
}

.feedback-title.is-warn,
.feedback-title.is-pending {
  color: var(--warn);
}

.diff {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 1.1rem;
}

.diff s {
  color: var(--text-muted);
}

.diff-typo,
.diff-wrong {
  color: var(--accent-text);
}

.diff-missing {
  color: var(--warn-text);
  text-decoration: underline;
}

.diff-extra {
  color: var(--text-muted);
}

.exercise-bottom {
  margin-top: 24px;
}

/* Fiszki */
.flashcard-front {
  margin: 8px 0 20px;
  font-size: 1.6rem;
  font-weight: 700;
}

.flashcard details summary {
  list-style: none;
}

.flashcard details summary::-webkit-details-marker {
  display: none;
}

.flashcard details[open] summary {
  display: none;
}

.flashcard-back {
  margin-bottom: 20px;
}

.flashcard-back .entry-word {
  margin-bottom: 4px;
}

.rating {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Ekran Start */
.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.home-date {
  margin: 0;
}

.home-head h1 {
  margin: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-text);
  font-weight: 600;
}

.card-hero {
  background: var(--accent-tint);
  border: 1px solid var(--border);
}

.card-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.card-row h2 {
  margin: 0;
}

.hero-title {
  font-size: 1.6rem;
  margin: 4px 0 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

.hero-second {
  margin-top: 8px;
}

.skill-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr 3rem;
  align-items: center;
  gap: 12px;
  min-height: 36px;
}

.skill-row .progress {
  margin: 0;
}

.skill-percent {
  text-align: right;
  color: var(--text-muted);
}

.skill-row.is-weakest {
  font-weight: 700;
}

.skill-row.is-weakest .progress {
  background: var(--warn-tint);
}

.skill-row.is-weakest .progress span {
  background: var(--warn);
}

.skill-row.is-weakest .skill-percent {
  color: var(--warn-text);
}

/* Filtry (Mój słownik, Dziennik błędów) */
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
}

.badge-muted {
  background: var(--surface-2);
  color: var(--text-muted);
}

/* Dziennik błędów */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}

.filter-chip[aria-current="page"] {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.mistake-title {
  margin: 0;
}

.trend {
  margin: 2px 0 0;
  font-weight: 600;
}

.trend-down {
  color: var(--accent-text);
}

.trend-up {
  color: var(--warn-text);
}

.trend-same {
  color: var(--text-muted);
}

.big-count {
  font-size: 2rem;
  font-weight: 700;
}

.last-example {
  margin: 8px 0 0;
}

.actions-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* Wynik AI */
.corrected {
  font-size: 1.15rem;
}

.corrected mark {
  padding: 0 4px;
  border-radius: 6px;
  background: var(--accent-tint);
  color: var(--accent-text);
}

.divider {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.mistake + .mistake {
  margin-top: 16px;
}

.mistake p {
  margin: 0 0 4px;
}

.mistake-category {
  color: var(--warn-text);
  font-size: 0.9rem;
  font-weight: 700;
}

/* Nagrywanie */
.recorder audio {
  width: 100%;
  margin: 8px 0;
}

/* Karta „czeka na sprawdzenie przez AI” na ekranie Start */
.notice {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--accent-tint);
  color: var(--accent-text);
  margin-bottom: 16px;
}

/* Przełącznik z kilkoma opcjami (np. Uczę się / Znam / Pomiń) */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 16px;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
}

.segmented input:checked + span {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent-text);
  font-weight: 700;
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Ścieżka A1–C2 */
.path {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.path-level details summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--tap);
  cursor: pointer;
  list-style: none;
}

.path-level details summary::-webkit-details-marker {
  display: none;
}

.path-level details[open] summary {
  margin-bottom: 12px;
}

.path-title {
  display: flex;
  flex-direction: column;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 700;
}

.path-current .level-badge {
  background: var(--accent);
  color: var(--on-accent);
}

.path-passed .level-badge {
  background: var(--accent-tint);
  color: var(--accent-text);
}

.path-locked .card {
  opacity: 0.75;
}

.badge-warn {
  background: var(--warn-tint);
  color: var(--warn-text);
}

.choice-muted {
  color: var(--text-muted);
}

.level-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.level-card .level-badge {
  background: var(--accent);
  color: var(--on-accent);
}

.card-link.is-locked {
  opacity: 0.7;
}

a.chip {
  color: var(--accent-text);
  font-weight: 600;
}

.field input.is-ok {
  border-color: var(--accent);
}

.field input.is-warn {
  border-color: var(--warn);
}

.field-note {
  margin: -8px 0 16px;
}

.small-word {
  font-size: 1.4rem;
  align-self: center;
}

/* ===================== Przyjazne detale: tło, fokus, przejścia ===================== */
body {
  /* Tło: gałązki oliwne w stylu logo (static/img/branch-*.svg, mocno przygaszone)
     i delikatna oliwkowa poświata w rogu. Na telefonie dolna gałązka nad paskiem nawigacji. */
  background:
    url("../img/branch-top.svg") right top / min(62vw, 760px) auto no-repeat,
    url("../img/branch-bottom.svg") left 0 bottom var(--nav-height) / min(55vw, 420px) auto no-repeat,
    radial-gradient(900px 520px at 100% -8%, var(--accent-tint), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

@media (min-width: 1024px) {
  /* Na komputerze dolna gałązka wyrasta przy krawędzi panelu bocznego. */
  body.with-nav {
    background-position: right top, left var(--sidebar) bottom 0, 0 0, 0 0;
  }

  body.no-nav {
    background-position: right top, left bottom 0, 0 0, 0 0;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  transition: filter 0.15s ease, transform 0.1s ease, background-color 0.15s ease;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: scale(0.98);
}

.card-link,
.shortcut,
.list-link {
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.card {
  border: 1px solid transparent;
}

.card-link:hover,
.shortcut:hover {
  transform: translateY(-2px);
  border-color: var(--border);
  outline: 0;
}

a.list-link:hover {
  color: var(--accent-text);
}

/* Kafelki skrótów na ekranie Start */
.shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.shortcut {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.shortcut svg {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  padding: 9px;
  border-radius: 12px;
  background: var(--accent-tint);
  color: var(--accent);
}

/* Siatka kart (jednostki, Podstawy, dziennik błędów) */
.card-grid {
  display: grid;
  gap: 16px;
}

.card-grid > .card {
  margin-bottom: 0;
}

/* Słownik: karta hasła obok listy wyników */
.dict-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}

@media (min-width: 1024px) {
  .dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
    gap: 24px;
    align-items: start;
  }

  .shortcuts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .home-head h1 {
    font-size: 2.8rem;
  }

  .card-hero {
    padding: 32px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    margin-bottom: 16px;
  }

  .dict-layout.has-entry {
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  }

  .search .field input {
    min-height: 56px;
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* Odpowiedzi: podświetlenie po najechaniu (tylko aktywne) */
.choice:hover:has(input:not(:disabled)) {
  border-color: var(--accent);
}

.choice:has(input:checked:not(:disabled)) {
  border-color: var(--accent);
  background: var(--accent-tint);
}

@media (min-width: 1024px) {
  /* Pytania zamknięte: każde w karcie, odpowiedzi obok siebie. */
  form > .quiz-question {
    margin-bottom: 16px;
    padding: 20px 24px 12px;
    border-radius: var(--radius);
    background: var(--surface);
  }

  /* Odpowiedzi w jednym wierszu, po równo – niezależnie od ich liczby. */
  form > .quiz-question {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  form > .quiz-question .choice {
    flex: 1 1 0;
    min-width: 150px;
  }

  form > .quiz-question > legend {
    /* float wyjmuje legend z ramki fieldsetu – staje się zwykłym, pełnym wierszem. */
    float: left;
    width: 100%;
    margin-bottom: 6px;
    font-size: 1.05rem;
  }

  form > .quiz-question .choice {
    margin-bottom: 0;
  }

  form > .quiz-question .quiz-explanation,
  form > .quiz-question .audio-controls {
    flex-basis: 100%;
  }
}

/* Wersja i autor pod logo */
.page-brand {
  margin-bottom: 16px;
}

.page-brand .logo {
  margin-bottom: 0;
}

.app-credits {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

.nav-brand .app-credits {
  padding-left: 43px;
}


.page-brand .app-credits {
  padding-left: 40px;
}

/* Twórca aplikacji (nad „Wyloguj”) */
.app-author {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.app-author strong {
  color: var(--text);
  font-weight: 600;
}

.nav-footer .app-author {
  margin: 4px 0 0;
  padding: 0 14px;
  text-align: left;
}

/* ===================== Strona powitalna z logowaniem ===================== */
.page-landing {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.landing-top {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}

.landing-top .logo {
  margin-bottom: 0;
}

.landing-top .app-credits {
  padding: 0;
}

.landing-grid {
  display: grid;
  gap: 24px;
}

.landing-title {
  margin: 4px 0 16px;
  font-size: clamp(2.1rem, 4.2vw, 3.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.landing-title span {
  display: block;
  color: var(--accent);
}

.landing-lead {
  max-width: 34em;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1.6;
}

.landing-form h2 {
  margin-bottom: 6px;
  font-size: 1.5rem;
}

.landing-form form {
  margin-top: 20px;
}

.btn-large {
  min-height: 52px;
  font-size: 1.05rem;
}

/* Przykład poprawki pod formularzem */
.sample {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.sample p {
  margin: 0 0 4px;
}

.sample-label {
  color: var(--accent-text);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sample-prompt {
  font-weight: 600;
}

.sample-fix mark {
  padding: 0 4px;
  border-radius: 6px;
  background: var(--accent-tint);
  color: var(--accent-text);
}

/* Atuty */
.features {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.features li {
  display: grid;
  grid-template-columns: 48px 1fr;
  column-gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
}

.features strong {
  align-self: end;
}

.features .muted {
  grid-column: 2;
  font-size: 0.95rem;
}

.feature-icon {
  grid-row: span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-tint);
  color: var(--accent);
}

.feature-icon svg {
  width: 24px;
  height: 24px;
}

/* Liczby */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0 0;
}

.stats div {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stats dt {
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 800;
}

.stats dd {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.motto {
  margin: 24px 0 0;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 1.05rem;
  font-style: italic;
}

.landing-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.landing-footer p {
  margin: 0 0 4px;
}

@media (min-width: 1024px) {
  .page-landing {
    padding: 40px 48px 48px;
  }

  .landing-top {
    margin-bottom: 48px;
  }

  /* Tekst i atuty po lewej, formularz po prawej. */
  .landing-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.9fr);
    grid-template-areas:
      "intro form"
      "features form";
    column-gap: 56px;
    row-gap: 32px;
    align-items: start;
  }

  .landing-intro {
    grid-area: intro;
    padding-top: 16px;
  }

  .landing-form {
    grid-area: form;
    position: sticky;
    top: 32px;
    padding: 32px;
  }

  .landing-features {
    grid-area: features;
  }

  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Panel boczny: sekcja administracji, licznik, imię przy poziomie */
.nav-section {
  display: none;
}

@media (min-width: 1024px) {
  .nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .nav-heading {
    margin: 0 0 4px;
    padding: 0 14px;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .nav-count {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--warn);
    color: var(--on-accent);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
  }

  .nav-footer .nav-item {
    padding: 6px 14px;
  }

  .nav-level span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
  }

  .nav-level small {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 400;
  }

  .nav-footer .app-author {
    margin: 6px 0 0;
  }
}

/* Komunikaty, przyciski niebezpieczne i małe */
.alert-ok {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  color: var(--accent-text);
}

.btn-danger {
  background: var(--warn-tint);
  color: var(--warn-text);
  border: 1px solid var(--warn);
}

.btn-small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.9rem;
}

.card-danger {
  border-color: var(--warn-tint);
}

/* Przełącznik Zaloguj się / Załóż konto */
.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.auth-switch a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 9px;
  color: var(--text-muted);
  font-weight: 600;
}

.auth-switch a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--text);
}

/* Zgłoszenia */
.feedback-item + .feedback-item {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.feedback-message {
  white-space: pre-line;
}

.feedback-reply {
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--bg);
}

.report-link {
  margin: 16px 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.report-link a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* Tabela kont */
.accounts td,
.accounts th {
  vertical-align: middle;
}

.accounts tr.is-blocked {
  opacity: 0.7;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.danger-zone summary {
  list-style: none;
}

.danger-zone summary::-webkit-details-marker {
  display: none;
}

.danger-zone[open] form {
  margin-top: 8px;
}
