/* ═══════════════════════════════════════════════════════════════════════════
   VOKABELTRAINER – LATEIN  |  Modern & Clean Design
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #f4f2ee;
  --bg-card: #ffffff;
  --bg-hover: #f9f8f5;
  --primary: #2c3e50;
  --primary-lt: #3d556e;
  --accent: #8B6F47;
  --accent-lt: #a8895e;
  --red: #c0392b;
  --green: #27ae60;
  --border: #e2ddd5;
  --text: #2c3e50;
  --text-muted: #8c8479;
  --shadow-sm: 0 1px 3px rgba(44, 62, 80, .08);
  --shadow-md: 0 4px 16px rgba(44, 62, 80, .12);
  --shadow-lg: 0 8px 32px rgba(44, 62, 80, .16);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --trans: .2s ease;
  --font: 'Inter', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  font-family: var(--font);
}

input {
  font-family: var(--font);
}

/* ── Animations ─────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .5
  }
}

@keyframes popIn {
  0% {
    transform: scale(.85);
    opacity: 0
  }

  100% {
    transform: scale(1);
    opacity: 1
  }
}

.fade-in {
  animation: fadeIn .35s ease both;
}

.fade-in-up {
  animation: fadeInUp .4s ease both;
}

.pop-in {
  animation: popIn .3s cubic-bezier(.34, 1.56, .64, 1) both;
}

/* ── Loader ─────────────────────────────────────────────────────────────────── */
.loader-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 64px);
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 600;
  font-size: 1.05rem;
  transition: opacity var(--trans);
}

.nav-brand:hover {
  opacity: .85;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: white;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .7);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--trans);
}

.nav-link:hover,
.nav-link.active {
  color: white;
  background: rgba(255, 255, 255, .1);
}

/* ── Main ───────────────────────────────────────────────────────────────────── */
#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ── Page Header ─────────────────────────────────────────────────────────────── */
.page-header {
  text-align: center;
  margin-bottom: 40px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--primary);
  font-weight: 400;
}

.page-title em {
  color: var(--accent);
  font-style: normal;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: 8px;
}

/* ── Back Bar ────────────────────────────────────────────────────────────────── */
.back-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.lektion-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  border: none;
  transition: all var(--trans);
  cursor: pointer;
}

.btn-icon {
  font-size: 1rem;
}

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

.btn-primary:hover {
  background: var(--accent-lt);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--primary);
  color: white;
}

.btn-secondary:hover {
  background: var(--primary-lt);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline-dark {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--border);
}

.btn-outline-dark:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: .875rem;
  transition: all var(--trans);
}

.btn-back:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  border: none;
  transition: all var(--trans);
}

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

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
}

/* ── Lektionen Grid ─────────────────────────────────────────────────────────── */
.lektionen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.lektion-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--trans);
  position: relative;
  overflow: hidden;
}

.lektion-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--trans);
}

.lektion-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.lektion-card:hover::before {
  transform: scaleX(1);
}

.lektion-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary);
}

.lektion-card-meta {
  margin-top: 8px;
  font-size: .85rem;
  color: var(--text-muted);
}

.lektion-card-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
  gap: 6px;
  background: var(--bg);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Kategorie Tabs ──────────────────────────────────────────────────────────── */
.kat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.kat-tab {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: .875rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--trans);
  user-select: none;
}

.kat-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.kat-tab:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Word List ───────────────────────────────────────────────────────────────── */
.word-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.wl-info {
  font-size: .875rem;
  color: var(--text-muted);
}

.wl-actions {
  display: flex;
  gap: 8px;
}

.word-list {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.word-item {
  display: grid;
  grid-template-columns: 40px 1fr 1.2fr 1.5fr 36px;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--trans);
  cursor: pointer;
}

.word-item:last-child {
  border-bottom: none;
}

.word-item:hover {
  background: var(--bg-hover);
}

.word-item.excluded {
  opacity: .4;
}

.word-item.excluded .word-latin {
  text-decoration: line-through;
}

.word-nr {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
}

.word-latin {
  font-weight: 600;
  color: var(--primary);
  font-size: .9rem;
}

.word-mitte {
  font-size: .85rem;
  color: var(--accent);
}

.word-deutsch {
  font-size: .85rem;
  color: var(--text-muted);
}

.word-toggle {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans);
  flex-shrink: 0;
}

.word-item:not(.excluded) .word-toggle {
  background: var(--green);
  border-color: var(--green);
  color: white;
  font-size: .7rem;
}

.word-list-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.word-list-header-row {
  display: grid;
  grid-template-columns: 40px 1fr 1.2fr 1.5fr 36px;
  gap: 12px;
  padding: 10px 16px;
  background: var(--primary);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(255, 255, 255, .7);
}

/* ── Action Bar ──────────────────────────────────────────────────────────────── */
.action-bar {
  position: sticky;
  bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  transition: all var(--trans);
}

.action-bar.disabled {
  opacity: .5;
  pointer-events: none;
}

.action-bar-info {
  font-size: .9rem;
  color: var(--text-muted);
}

.action-bar-info span {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
}

.action-bar-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Lernmodus ───────────────────────────────────────────────────────────────── */
.view-lernen {
  max-width: 680px;
  margin: 0 auto;
}

.lernen-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.lernen-progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}

.lernen-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.lernen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 4px;
  transition: width .5s ease;
}

.lernen-progress-text {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.lernen-stats {
  display: flex;
  gap: 8px;
}

.stat-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}

.stat-ok {
  background: #e8f5e9;
  color: var(--green);
}

.stat-nope {
  background: #fdecea;
  color: var(--red);
}

/* ── Karteikarte ─────────────────────────────────────────────────────────────── */
.karteikarte-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.karteikarte {
  width: 100%;
  max-width: 520px;
  height: 300px;
  perspective: 1200px;
  cursor: pointer;
}

.kk-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.4, 0, .2, 1);
}

.kk-inner.flipped {
  transform: rotateY(180deg);
}

.kk-front,
.kk-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border: 1px solid var(--border);
}

.kk-front {
  background: var(--bg-card);
}

.kk-back {
  background: #fffdf8;
  transform: rotateY(180deg);
}

.kk-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: .75rem;
  font-weight: 600;
}

.kk-word {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  line-height: 1.3;
}

.kk-hint {
  position: absolute;
  bottom: 16px;
  font-size: .8rem;
  color: var(--text-muted);
}

.kk-mitte {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
  text-align: center;
}

.kk-divider {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin: 16px 0;
}

.kk-deutsch {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  line-height: 1.4;
}

.kk-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  animation: fadeIn .3s ease;
}

.btn-ok {
  background: var(--green);
  color: white;
  min-width: 140px;
  justify-content: center;
}

.btn-ok:hover {
  background: #219a52;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(39, 174, 96, .3);
}

.btn-nope {
  background: var(--red);
  color: white;
  min-width: 140px;
  justify-content: center;
}

.btn-nope:hover {
  background: #a93226;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(192, 57, 43, .3);
}

.kk-counter {
  font-size: .875rem;
  color: var(--text-muted);
}

.kk-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── Ergebnis Screen ─────────────────────────────────────────────────────────── */
.ergebnis-screen {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, .7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.ergebnis-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp .4s ease;
}

.ergebnis-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.ergebnis-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.ergebnis-text {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.ergebnis-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.ergebnis-actions .btn {
  justify-content: center;
}

/* Donut chart */
.ergebnis-donut {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 20px 0;
}

.donut-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.donut-num {
  font-size: 2rem;
  font-weight: 700;
}

.donut-label {
  font-size: .8rem;
  color: var(--text-muted);
}

.donut-ok .donut-num {
  color: var(--green);
}

.donut-nope .donut-num {
  color: var(--red);
}

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 62, 80, .6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans);
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-footer .btn {
  flex: 1;
  justify-content: center;
}

.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 8px;
}

.form-hint {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
}

.form-note {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* Extra lessons section in test modal */
.extra-lek-section {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.extra-lek-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.extra-lek-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--trans);
  font-size: .875rem;
  color: var(--text);
}

.extra-lek-item:hover {
  background: var(--bg-hover);
}

.extra-lek-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.extra-lek-item em {
  color: var(--text-muted);
  font-style: normal;
  font-size: .8rem;
}

.number-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.num-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-hover);
  color: var(--text);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans);
}

.num-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.num-input {
  width: 80px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  outline: none;
  transition: border var(--trans);
}

.num-input:focus {
  border-color: var(--accent);
}

/* ── Admin ───────────────────────────────────────────────────────────────────── */
.view-admin {
  max-width: 760px;
  margin: 0 auto;
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 32px;
  max-width: 360px;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.auth-card h3 {
  font-size: 1.1rem;
  color: var(--primary);
}

.auth-hint {
  font-size: .8rem;
  color: var(--text-muted);
}

.auth-hint code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
}

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text);
  background: white;
  outline: none;
  transition: border var(--trans);
}

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

.admin-section {
  margin-bottom: 36px;
}

.admin-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--trans);
  background: var(--bg-card);
}

.upload-area:hover,
.upload-area.drag {
  border-color: var(--accent);
  background: #fdf9f5;
}

.upload-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.upload-area p {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.upload-hint {
  font-size: .8rem !important;
  color: #aaa !important;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.selected-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: #e8f5e9;
  color: var(--green);
  font-size: .85rem;
  font-weight: 500;
}

.upload-actions {
  display: flex;
  gap: 10px;
}

.upload-result {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
}

.upload-result.success {
  background: #e8f5e9;
  color: var(--green);
}

.upload-result.error {
  background: #fdecea;
  color: var(--red);
}

.admin-lektionen-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-lektion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.admin-lektion-name {
  font-weight: 500;
  color: var(--primary);
}

.admin-lektion-meta {
  font-size: .8rem;
  color: var(--text-muted);
}

.admin-lektion-actions {
  display: flex;
  gap: 8px;
}

.btn-danger {
  background: transparent;
  border: 1px solid #fcd0cd;
  color: var(--red);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: .8rem;
  transition: all var(--trans);
}

.btn-danger:hover {
  background: var(--red);
  color: white;
}

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: white;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: fadeInUp .3s ease;
  max-width: 320px;
}

.toast.error {
  background: var(--red);
}

.toast.success {
  background: var(--green);
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--primary);
  border-top: 1px solid rgba(255, 255, 255, .06);
  margin-top: auto;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-copy {
  font-size: .82rem;
  color: rgba(255, 255, 255, .45);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: .82rem;
  color: rgba(255, 255, 255, .55);
  transition: color var(--trans);
}

.footer-links a:hover {
  color: white;
}

/* ── Datenschutz / Legal Pages ───────────────────────────────────────────────── */
.view-datenschutz {
  max-width: 720px;
  margin: 0 auto;
}

.legal-intro {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 14px 18px;
  margin-bottom: 28px;
  font-size: .9rem;
  color: var(--text-muted);
}

.legal-intro a {
  color: var(--accent);
  text-decoration: underline;
}

.legal-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin: 24px 0 8px;
}

.legal-content h3:first-of-type {
  margin-top: 0;
}

.legal-content p {
  font-size: .9rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 10px;
}

.legal-content ul {
  padding-left: 20px;
  margin-bottom: 10px;
}

.legal-content li {
  font-size: .9rem;
  color: var(--text);
  line-height: 1.7;
}

.legal-content a {
  color: var(--accent);
  text-decoration: underline;
}

.legal-content code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: .85em;
}

.legal-date {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
/* Ensure body fills viewport for sticky footer */
body {
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 640px) {

  /* Layout */
  #app {
    padding: 16px 14px calc(260px + env(safe-area-inset-bottom));
  }

  .nav-inner {
    padding: 0 14px;
    height: 56px;
  }

  .footer-inner {
    padding: 14px 16px;
  }

  /* Back bar */
  .back-bar {
    gap: 10px;
    margin-bottom: 20px;
  }

  .lektion-title {
    font-size: 1.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60vw;
  }

  /* Word list: show Latin + mitte stacked, hide Deutsch */
  .word-item {
    grid-template-columns: 28px 1fr 32px;
    grid-template-rows: auto auto;
    row-gap: 1px;
    column-gap: 8px;
    padding: 10px 12px;
    align-items: start;
  }

  .word-nr {
    grid-row: 1 / 3;
    align-self: center;
  }

  .word-latin {
    grid-column: 2;
    grid-row: 1;
  }

  .word-mitte {
    grid-column: 2;
    grid-row: 2;
    font-size: .75rem;
    margin-top: 0;
  }

  .word-deutsch {
    display: none;
  }

  .word-toggle {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
  }

  .word-list-header-row {
    grid-template-columns: 28px 1fr 32px;
    gap: 8px;
    padding: 8px 12px;
  }

  .word-list-header-row span:nth-child(3),
  .word-list-header-row span:nth-child(4) {
    display: none;
  }

  /* Action bar: sticky full-width at bottom */
  .action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .action-bar-info {
    font-size: .85rem;
    text-align: center;
  }

  .action-bar-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .action-bar-btns .btn:last-child {
    grid-column: 1 / -1;
  }

  .action-bar-btns .btn {
    justify-content: center;
    font-size: .85rem;
    padding: 10px 12px;
  }

  /* Lernen view */
  .view-lernen {
    max-width: 100%;
  }

  .lernen-header {
    gap: 10px;
    margin-bottom: 20px;
  }

  .lernen-progress-wrap {
    min-width: 0;
    flex: 1;
  }

  .lernen-progress-text {
    font-size: .75rem;
  }

  .stat-badge {
    padding: 4px 8px;
    font-size: .75rem;
  }

  /* Flashcard */
  .karteikarte {
    height: 230px;
  }

  .kk-word {
    font-size: clamp(1.3rem, 6vw, 1.9rem);
  }

  .kk-buttons {
    gap: 10px;
  }

  .btn-ok,
  .btn-nope {
    min-width: 0;
    flex: 1;
    justify-content: center;
  }

  /* Modal: slide up from bottom */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: slideUp .3s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Ergebnis card */
  .ergebnis-card {
    padding: 28px 20px;
  }

  .ergebnis-actions .btn {
    font-size: .875rem;
  }

  /* Tabs */
  .kat-tabs {
    gap: 6px;
  }

  .kat-tab {
    padding: 6px 12px;
    font-size: .82rem;
  }

  /* Admin */
  .auth-card {
    padding: 24px 20px;
    margin: 24px auto;
  }

  .upload-area {
    padding: 24px 16px;
  }

  .admin-lektion-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}