/* UX batch 2026-10-26, area: nav (one file per area so parallel work does not collide) */

/* --- course cards: the whole card opens the course, «Weiter ›» opens the next open exercise ---------- */
.course-card.is-linked { position: relative; }
.course-card-link { color: inherit; text-decoration: none; }
.course-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.course-card-link:focus-visible { outline: none; }
.course-card-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.course-card-next {
  position: relative; z-index: 1; flex: none; display: inline-flex; align-items: center;
  min-height: var(--tap); padding: 0 0.6rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.92rem; color: var(--accent); text-decoration: none; white-space: nowrap;
}
.course-card-next:hover { background: var(--accent-soft); }
@media (max-width: 560px) {
  .course-card.is-linked { flex-wrap: wrap; row-gap: 0.3rem; }
  .course-card.is-linked > div:first-child { flex: 1 1 100% !important; }
  .course-card.is-linked .progress { flex: 1 1 auto; width: auto; }
  .course-card.is-linked .course-card-next { order: 2; margin-right: -0.6rem; }
}

/* --- course page: «Hier starten» / «Weiter: …» ------------------------------------------------------ */
.course-resume { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.9rem; margin: 0.9rem 0 1rem; }
.course-resume-btn { white-space: normal; text-align: left; max-width: 100%; }
.course-resume-meta a { color: var(--muted); }
.course-resume-meta a:hover { color: var(--accent); }
/* «Alle Aufgaben» lands at the topic: keep the heading clear of the sticky header */
.topic { scroll-margin-top: 72px; }

/* --- overview «Weiter üben» ------------------------------------------------------------------------- */
.resume-card .resume-last { margin: 0.6rem 0 0; }

/* --- Verlauf ---------------------------------------------------------------------------------------- */
.history-pages { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin: 1rem 0; }

/* --- Statistik: «Theorie» and «Üben ›» per topic; untried topics ----------------------------------- */
.weak-links { display: inline-flex; gap: 0.9rem; justify-content: flex-end; white-space: nowrap; }
.weak-practice { font-weight: 600; }
.weak-untried { margin-top: 0.4rem; }
.weak-untried li { grid-template-columns: minmax(0, 1.4fr) auto auto; }
@media (max-width: 640px) {
  .weak-untried li { grid-template-columns: 1fr auto; }
  .weak-list li .weak-name { grid-column: 1 / -1; }
}

/* --- phone: compact exercise header (the question should start high up) --------------------------- */
@media (max-width: 560px) {
  .ex-crumbs { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; margin: 0.1rem 0 0; font-size: 0.85rem; gap: 0 0.25rem; }
  .ex-crumbs a { min-height: 36px; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 36px; }
  .ex-crumbs .sep { flex: none; }
  .ex-header h1 { font-size: 1.3rem; margin: 0.2rem 0 0.15rem; }
  .ex-header .ex-meta { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
  .ex-header .ex-meta .badge, .ex-header .ex-meta .status { font-size: 0.75rem; padding-top: 0.05rem; padding-bottom: 0.05rem; }
  .ex-header .theory-btn { margin: 0.15rem 0 0.2rem 0.6rem; min-height: 36px; padding: 0.25rem 0.65rem; font-size: 0.9rem; }
  /* Zurück / Weiter as small arrows on one line with the position */
  .ex-nav { grid-template-columns: auto 1fr auto; gap: 0.4rem; margin: 0.3rem 0 0.6rem; }
  .ex-nav .ex-nav-pos, .ex-nav .ex-nav-tasks { grid-column: 2; grid-row: 1; font-size: 0.85rem; }
  .ex-nav-step { min-width: 36px; }
  .ex-nav a.ex-nav-step {
    display: inline-grid; place-items: center; width: 36px; height: 36px; min-width: 36px; padding: 0;
    border: 1px solid var(--line); border-radius: 50%; text-decoration: none; font-size: 1.25rem; line-height: 1; color: var(--accent);
  }
  .ex-nav .ex-nav-word { display: none; }
}

/* --- phone: sticky «Nächste Aufgabe ›» on result pages (built by ux-nav.js) -------------------------- */
.next-bar { display: none; }
@media (max-width: 560px) {
  .next-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    padding: 0.5rem 16px calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
  }
  .next-bar .btn { flex: 1; }
  .next-bar.is-hidden { transform: translateY(110%); }
  body.has-next-bar main { padding-bottom: calc(5rem + 64px); }
  body.has-next-bar:not(.next-bar-off) .chat-fab { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 560px) and (prefers-reduced-motion: reduce) { .next-bar { transition: none; } }
@media print { .next-bar { display: none !important; } }
