:root {
  --blue: #2563eb;
  --red: #dc2626;
  --green: #16a34a;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.4;
  padding-bottom: 40px;
  -webkit-tap-highlight-color: transparent;
}

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  background: var(--blue); color: #fff;
  padding: 10px 16px; min-height: 60px;
}
.topbar h1 {
  font-size: 21px; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-btn {
  background: none; border: none; color: #fff;
  font-size: 28px; width: 48px; height: 48px;
  border-radius: 50%; cursor: pointer;
}

main { padding: 16px; max-width: 640px; margin: 0 auto; }

/* Große Buttons */
.btn {
  display: block; width: 100%; min-height: 56px;
  padding: 12px 16px; margin: 8px 0;
  font-size: 18px; font-weight: 600; font-family: inherit;
  border: none; border-radius: var(--radius); cursor: pointer;
}
.btn.primary   { background: var(--blue); color: #fff; }
.btn.secondary { background: #e5e7eb; color: var(--text); }
.btn.danger    { background: #fee2e2; color: var(--red); }
.btn:active    { transform: scale(0.98); }

.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

/* Kacheln */
.tile {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin: 10px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.list-tile {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; text-align: left; border: none;
  font: inherit; color: inherit; cursor: pointer;
}
.list-name { font-weight: 700; font-size: 19px; }
.meta { color: var(--muted); font-size: 15px; }

.badge {
  display: inline-block;
  background: var(--blue); color: #fff;
  border-radius: 999px; padding: 6px 14px;
  font-weight: 700; font-size: 17px;
  min-width: 44px; text-align: center;
}
.badge.zero { background: #e5e7eb; color: var(--muted); }
.due { text-align: center; }
.due .meta { font-size: 13px; margin-top: 2px; }

/* Eingabefelder */
label { display: block; font-weight: 600; margin: 10px 0 4px; }
input {
  width: 100%; font-size: 18px; font-family: inherit;
  padding: 14px; margin-top: 4px;
  border: 2px solid #d1d5db; border-radius: 12px;
  background: #fff;
}
input:focus { outline: none; border-color: var(--blue); }

/* Überschriften und Hinweise */
h2 { font-size: 20px; margin: 24px 0 8px; }
.tile h2 { margin-top: 0; }
.empty { color: var(--muted); text-align: center; padding: 20px 8px; }

/* Zusammenfassung oben auf der Startseite */
.summary { text-align: center; }
.big-number { font-size: 44px; font-weight: 800; color: var(--blue); line-height: 1.1; }

/* Karten in der Liste */
.card-tile { display: flex; align-items: center; gap: 10px; }
.card-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-text .de { font-weight: 700; }
.card-text .en { color: var(--muted); }
.card-actions { display: flex; gap: 6px; }
.small-btn {
  width: 48px; height: 48px; font-size: 22px;
  border: none; border-radius: 12px;
  background: #f3f4f6; cursor: pointer;
}

/* Eingabefenster */
dialog {
  border: none; border-radius: 18px;
  padding: 20px; width: min(92vw, 480px);
  margin: 10vh auto auto;
}
dialog::backdrop { background: rgba(0,0,0,0.45); }
dialog h2 { margin-top: 0; }

/* Kopfzeile mit Zurück-Pfeil */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #2563eb;
  color: #fff;
  padding: 12px 16px;
}
header h1 { margin: 0; font-size: 20px; }
.back {
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  padding: 0 8px 0 0;
}
.back[hidden] { display: none; }
/* ---------- Lernmodus (Phase 2) ---------- */
.flashcard {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
  min-height: 260px;
  padding: 24px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.flashcard .lang { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: #6b7280; }
.flashcard .word { font-size: 30px; font-weight: 700; margin: 8px 0 16px; word-break: break-word; }
.flashcard .answer { border-top: 2px dashed #e5e7eb; padding-top: 16px; width: 100%; }
.flashcard .answer .word { color: #16a34a; }
.flashcard .hint { color: #2563eb; font-weight: 600; }
.answer[hidden], .hint[hidden], #rate[hidden] { display: none; }

.progress { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress-bar { height: 100%; background: #2563eb; transition: width .3s; }
.center { text-align: center; margin-top: 6px; }
.btn.success { background: #16a34a; color: #fff; }

/* ---------- 5 Schubladen ---------- */
.drawers { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.drawer {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; border: 2px solid #e5e7eb; border-radius: 12px;
  padding: 10px 14px; font-weight: 600;
}
.drawer b { font-size: 20px; color: #2563eb; }
.drawer.done { border-color: #16a34a; background: #f0fdf4; }
.drawer.done b { color: #16a34a; }
/* ---------- Foto-Scan (Phase 3) ---------- */
.scan-head, .scan-row {
  display: grid;
  grid-template-columns: 1fr 1fr 40px;
  gap: 6px;
  align-items: center;
}
.scan-head { font-size: 13px; color: #6b7280; font-weight: 600; margin: 8px 0 4px; }
.scan-row { margin-bottom: 6px; }
.scan-row input, .key-input {
  width: 100%; min-width: 0; box-sizing: border-box;
  padding: 10px; font-size: 16px;
  border: 1px solid #d1d5db; border-radius: 10px; background: #fff;
}
.key-input { margin-top: 10px; }
.scan-del { background: none; border: none; font-size: 20px; cursor: pointer; }
.spinner {
  width: 44px; height: 44px; margin: 8px auto 12px;
  border: 5px solid #e5e7eb; border-top-color: #2563eb;
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Fortschritt auf der Startseite ---------- */
.list-tile > div:first-child { flex: 1; min-width: 0; margin-right: 12px; text-align: left; }
.list-tile .list-progress { width: 100%; }

/* ---------- Beispielsätze ---------- */
.example { font-style: italic; color: #6b7280; font-size: 14px; margin-top: 4px; }

