/* ===========================================================
   FransWoordjes — gedeelde stijl
   =========================================================== */

:root {
  --blue: #2451ff;
  --blue-dark: #1638b0;
  --blue-light: #eaf0ff;
  --red: #ff4d5e;
  --red-light: #ffe8ea;
  --yellow: #ffc93c;
  --yellow-light: #fff6de;
  --green: #2ecc71;
  --green-light: #e6faee;
  --ink: #1f2437;
  --ink-soft: #5a6178;
  --paper: #fffdf9;
  --cloud: #f4f2fb;
  --line: #e6e3f5;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px -12px rgba(36, 81, 255, 0.25);
  --shadow-sm: 0 4px 14px -6px rgba(36, 81, 255, 0.2);
  --font: "Baloo 2", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2f1fb;
    --ink-soft: #b6b7cc;
    --paper: #171a2b;
    --cloud: #10121e;
    --line: #2b2f47;
    --blue-light: #1b2550;
    --red-light: #3a1f26;
    --yellow-light: #3a3118;
    --green-light: #163826;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--cloud);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0 0 0.4em;
  line-height: 1.15;
  font-weight: 800;
}

p {
  margin: 0 0 0.8em;
  color: var(--ink-soft);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 90px;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 8px;
  max-width: 720px;
  margin: 0 auto;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--ink);
}

.topbar .brand .flag {
  font-size: 1.6rem;
}

.topbar .back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--blue);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.topbar .spacer {
  flex: 1;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-family: var(--font);
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn-yellow {
  background: var(--yellow);
  color: #4a3300;
  box-shadow: 0 10px 30px -14px rgba(255, 201, 60, 0.7);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  padding: 10px 14px;
}

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

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
}

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

/* ---------- Cards ---------- */

.card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}

.list-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  transition: transform 0.12s ease;
}

.list-card:active {
  transform: scale(0.985);
}

.list-card .emoji {
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.list-card .meta {
  flex: 1;
  min-width: 0;
}

.list-card .meta h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-card .meta .sub {
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.due-badge {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ---------- Empty state ---------- */

.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-soft);
}

.empty .big-emoji {
  font-size: 3rem;
  margin-bottom: 10px;
}

/* ---------- Forms ---------- */

label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 0 6px;
  color: var(--ink-soft);
}

input[type="text"],
input[type="search"],
textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.field {
  margin-bottom: 16px;
}

/* ---------- Word pair table (scan review) ---------- */

.pair-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.pair-row input {
  padding: 10px 12px;
  font-size: 0.95rem;
}

.pair-row.flagged input {
  border-color: var(--yellow);
  background: var(--yellow-light);
}

.pair-row .remove-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--red-light);
  color: var(--red);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.col-headers {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  padding: 0 2px;
  margin-bottom: 2px;
}

.col-headers span {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

/* ---------- Photo capture ---------- */

.photo-drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
  color: var(--ink-soft);
}

.photo-drop .big-emoji {
  font-size: 2.6rem;
  margin-bottom: 8px;
}

.photo-preview {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.progress-bar-outer {
  background: var(--line);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin: 14px 0;
}

.progress-bar-inner {
  background: var(--blue);
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.ocr-status {
  text-align: center;
  font-weight: 700;
  color: var(--blue);
}

/* ---------- Mode picker ---------- */

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.mode-option,
.dir-option {
  border: 2px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
}

.mode-option .icon,
.dir-option .icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 6px;
}

.mode-option.selected,
.dir-option.selected {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue-dark);
}

.dir-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

/* ---------- Practice session ---------- */

.session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.session-progress {
  flex: 1;
}

.streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  color: var(--yellow);
  white-space: nowrap;
}

.flashcard-stage {
  perspective: 1200px;
  margin: 10px 0 20px;
}

.flashcard {
  position: relative;
  min-height: 220px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flash-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.flash-face.front {
  background: var(--blue);
  color: #fff;
}

.flash-face.back {
  background: var(--paper);
  color: var(--ink);
  transform: rotateY(180deg);
  border: 2px solid var(--blue-light);
}

.flash-face .lang-tag {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.75;
}

.flash-face .word {
  font-size: 1.7rem;
  font-weight: 800;
}

.flash-face .hint {
  margin-top: 14px;
  font-size: 0.8rem;
  opacity: 0.7;
  font-weight: 600;
}

.self-report {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quiz-word {
  text-align: center;
  padding: 30px 16px;
  margin-bottom: 18px;
}

.quiz-word .lang-tag {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.quiz-word .word {
  font-size: 2rem;
  font-weight: 800;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-btn {
  border: 2px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  color: var(--ink);
  transition: transform 0.1s ease;
}

.choice-btn:active {
  transform: scale(0.97);
}

.choice-btn.correct {
  border-color: var(--green);
  background: var(--green-light);
  color: #14803f;
}

.choice-btn.incorrect {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red);
}

.type-answer-row {
  display: flex;
  gap: 10px;
}

.type-answer-row input {
  flex: 1;
  font-size: 1.1rem;
  text-align: center;
}

.feedback-banner {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 14px 0;
  font-weight: 700;
  text-align: center;
}

.feedback-banner.correct {
  background: var(--green-light);
  color: #14803f;
}

.feedback-banner.incorrect {
  background: var(--red-light);
  color: var(--red);
}

.feedback-banner .correction {
  font-weight: 500;
  font-size: 0.9rem;
  margin-top: 4px;
  opacity: 0.85;
}

/* ---------- Session summary ---------- */

.summary-hero {
  text-align: center;
  padding: 30px 10px 10px;
}

.summary-hero .big-emoji {
  font-size: 3.4rem;
  margin-bottom: 6px;
}

.summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 20px 0;
}

.stat-tile {
  background: var(--paper);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-tile .num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--blue);
}

.stat-tile .label {
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 700;
}

/* ---------- Misc ---------- */

.hidden {
  display: none !important;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin: 22px 0 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}
