/* =========================================================
   Learn – Irregular Verbs Trainer
   Design system: dark + violet (from Schrieftzug.gif)
   + yellow-green accent (from the textbook pages)
   ========================================================= */

:root {
  --bg: #0d0b14;
  --bg-2: #151122;
  --surface: #1b1630;
  --surface-2: #241d3d;
  --border: #332a55;
  --text: #f2eefc;
  --muted: #a79dc4;
  --violet: #8b6fc4;
  --violet-bright: #a98fe0;
  --accent: #c8e64a;
  --accent-dark: #9bb82e;
  --danger: #ff6b81;
  --success: #4ade80;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font-hand: "Caveat", "Segoe Script", cursive;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }

a { color: var(--violet-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.container { width: min(1100px, 92%); margin-inline: auto; }

.hand {
  font-family: var(--font-hand);
  font-weight: 700;
  color: var(--violet-bright);
  letter-spacing: .5px;
}

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(13, 11, 20, .82);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
}

.brand {
  font-family: var(--font-hand);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--violet-bright);
  line-height: 1;
}
.brand span { color: var(--accent); }

.nav { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.nav a {
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: .93rem;
  transition: .18s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--violet); color: #fff; }

.nav .user-chip {
  color: var(--accent);
  border: 1px solid var(--border);
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--violet), var(--violet-bright));
  color: #fff;
  box-shadow: 0 8px 22px rgba(139, 111, 196, .35);
}
.btn-accent { background: var(--accent); color: #1a1a06; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: rgba(255, 107, 129, .14); border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 7px 15px; font-size: .85rem; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  min-height: 78vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.hero video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero .overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(139, 111, 196, .35), transparent 60%),
    linear-gradient(180deg, rgba(13, 11, 20, .82), rgba(13, 11, 20, .94));
}

.hero .content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 60px 0;
}

.hero .learn-gif {
  width: min(420px, 74%);
  margin: 0 auto 8px;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 26px rgba(169, 143, 224, .55));
}

.hero h1 {
  font-family: var(--font-hand);
  font-size: clamp(2.6rem, 7vw, 5rem);
  margin: 0;
  color: #fff;
}
.hero h1 em { color: var(--accent); font-style: normal; }

.hero p.lead {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: var(--muted);
  max-width: 640px;
  margin: 14px auto 30px;
}

.hero .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.hero .stats-strip {
  display: flex;
  gap: 34px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 44px;
}
.hero .stats-strip div { text-align: center; }
.hero .stats-strip b {
  display: block;
  font-size: 2rem;
  color: var(--accent);
  font-family: var(--font-hand);
  font-weight: 700;
}
.hero .stats-strip span { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* ---------------- Sections ---------------- */
section { padding: 70px 0; }
section.alt { background: var(--bg-2); border-block: 1px solid var(--border); }

.section-title {
  font-family: var(--font-hand);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--violet-bright);
  text-align: center;
}
.section-sub { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 42px; }

/* ---------------- Cards ---------------- */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-4px); border-color: var(--violet); }
.card .icon { font-size: 2rem; margin-bottom: 10px; }
.card h3 { font-size: 1.18rem; }
.card p { color: var(--muted); font-size: .93rem; margin: 0 0 16px; }

/* ---------------- Forms ---------------- */
.form-card {
  width: min(430px, 92%);
  margin: 56px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  box-shadow: var(--shadow);
}

.form-card h1 {
  font-family: var(--font-hand);
  font-size: 2.4rem;
  color: var(--violet-bright);
  text-align: center;
  margin-bottom: 4px;
}
.form-card .sub { text-align: center; color: var(--muted); font-size: .92rem; margin-bottom: 24px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139, 111, 196, .22);
}
input::placeholder { color: #6b628a; }

.form-msg {
  min-height: 22px;
  font-size: .9rem;
  margin: 6px 0 12px;
  text-align: center;
}
.form-msg.err { color: var(--danger); }
.form-msg.ok { color: var(--success); }

.hint {
  background: rgba(200, 230, 74, .09);
  border: 1px dashed var(--accent-dark);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: .85rem;
  color: var(--muted);
  margin-top: 16px;
}

/* ---------------- Trainer ---------------- */
.trainer-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: .18s;
}
.tab:hover { color: var(--text); border-color: var(--violet); }
.tab.active { background: var(--violet); border-color: var(--violet); color: #fff; }

.progress-bar {
  flex: 1;
  min-width: 150px;
  height: 9px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--accent));
  border-radius: 999px;
  transition: width .35s ease;
}

.score-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 7px 15px;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
  white-space: nowrap;
}
.score-chip b { color: var(--accent); }

/* flashcard */
.flashcard {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  min-height: 300px;
  display: grid;
  place-items: center;
  padding: 40px 26px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .3s;
}
.flashcard:hover { transform: translateY(-4px); }
.flashcard .face-label {
  position: absolute;
  top: 16px;
  left: 20px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
}
.flashcard .word {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 700;
  word-break: break-word;
}
.flashcard .ipa { color: var(--violet-bright); font-size: 1.1rem; margin-top: 6px; }
.flashcard .back { display: none; }
.flashcard.flipped .front { display: none; }
.flashcard.flipped .back { display: block; }
.flashcard .back .row { margin: 8px 0; }
.flashcard .back .row small {
  display: block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}
.flashcard .back .row b { font-size: 1.5rem; }
.flashcard .back .german { color: var(--accent); font-size: 1.15rem; margin-top: 14px; }

.rate-row { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* quiz */
.quiz-stage { max-width: 640px; margin-inline: auto; }
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  text-align: center;
  box-shadow: var(--shadow);
}
.question-card .sentence {
  font-size: clamp(1.3rem, 3.5vw, 1.9rem);
  font-weight: 600;
  margin-bottom: 8px;
}
.question-card .sentence .blank {
  display: inline-block;
  min-width: 110px;
  border-bottom: 3px solid var(--violet);
  color: var(--accent);
}
.question-card .hint-ipa { color: var(--muted); font-size: .9rem; margin-bottom: 22px; }

.choices { display: grid; gap: 11px; }
.choice {
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: .15s;
  text-align: left;
}
.choice:hover:not(:disabled) { border-color: var(--violet); background: var(--surface-2); }
.choice:disabled { cursor: default; }
.choice.correct { background: rgba(74, 222, 128, .18); border-color: var(--success); }
.choice.wrong { background: rgba(255, 107, 129, .16); border-color: var(--danger); }

/* writing */
.write-input { font-size: 1.5rem; text-align: center; letter-spacing: 1px; }

.char-feedback { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-top: 16px; min-height: 40px; }
.char-feedback span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 44px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 1.2rem;
  font-weight: 600;
}
.char-feedback span.ok { background: rgba(74, 222, 128, .2); border-color: var(--success); }
.char-feedback span.bad { background: rgba(255, 107, 129, .2); border-color: var(--danger); }

.answer-line { margin-top: 14px; font-size: 1.05rem; }
.answer-line b { color: var(--success); }

.feedback-line { min-height: 28px; margin-top: 14px; font-weight: 600; }
.feedback-line.ok { color: var(--success); }
.feedback-line.bad { color: var(--danger); }

/* results panel */
.result-panel {
  background: var(--surface);
  border: 1px solid var(--violet);
  border-radius: var(--radius);
  padding: 40px 30px;
  text-align: center;
  box-shadow: var(--shadow);
}
.result-panel .big {
  font-family: var(--font-hand);
  font-size: 4.5rem;
  color: var(--accent);
  line-height: 1;
}
.result-panel .breakdown { display: flex; gap: 26px; justify-content: center; margin: 22px 0 26px; flex-wrap: wrap; }
.result-panel .breakdown div b { display: block; font-size: 1.7rem; }
.result-panel .breakdown div span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* ---------------- Table ---------------- */
.table-tools { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.table-tools input, .table-tools select { flex: 1; min-width: 190px; width: auto; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table { width: 100%; border-collapse: collapse; font-size: .94rem; }
thead th {
  background: var(--surface-2);
  text-align: left;
  padding: 14px 16px;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  position: sticky;
  top: 0;
}
tbody td { padding: 12px 16px; border-top: 1px solid var(--border); }
tbody tr:hover { background: rgba(139, 111, 196, .1); }
td .ipa { color: var(--violet-bright); font-size: .84rem; }
td.german { color: var(--accent); }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.pill.mastered { background: rgba(200, 230, 74, .18); color: var(--accent); }
.pill.learning { background: rgba(139, 111, 196, .22); color: var(--violet-bright); }
.pill.new { background: rgba(255, 255, 255, .08); color: var(--muted); }

.speak {
  background: none;
  border: none;
  color: var(--violet-bright);
  cursor: pointer;
  font-size: 1.05rem;
  padding: 2px 6px;
}
.speak:hover { color: var(--accent); }

/* ---------------- Leaderboard ---------------- */
.board-controls { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }

.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  font-weight: 700;
  font-size: .9rem;
}
.rank-badge.r1 { background: linear-gradient(135deg, #ffd700, #b8860b); color: #1a1a06; }
.rank-badge.r2 { background: linear-gradient(135deg, #e8e8e8, #9aa0a6); color: #1a1a06; }
.rank-badge.r3 { background: linear-gradient(135deg, #e0a374, #a4632c); color: #1a1a06; }

tr.you { background: rgba(200, 230, 74, .1); }
tr.you td { font-weight: 600; }

.my-rank {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.my-rank .stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 24px;
  text-align: center;
  min-width: 130px;
}
.my-rank .stat b { display: block; font-size: 1.6rem; color: var(--accent); font-family: var(--font-hand); }
.my-rank .stat span { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.admin-bar {
  background: rgba(255, 107, 129, .08);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-bar .grow { flex: 1; min-width: 200px; }
.admin-bar strong { color: var(--danger); }

.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty .big { font-size: 2.6rem; margin-bottom: 8px; }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 34px 0;
  color: var(--muted);
  font-size: .88rem;
  text-align: center;
}
.site-footer .brand { font-size: 1.5rem; }

/* ---------------- Toast ---------------- */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(140%);
  background: var(--surface-2);
  border: 1px solid var(--violet);
  color: var(--text);
  padding: 13px 24px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 200;
  transition: transform .3s ease;
  font-size: .93rem;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------------- Responsive ---------------- */
@media (max-width: 760px) {
  .site-header .inner { flex-direction: column; gap: 10px; }
  .nav { margin-left: 0; justify-content: center; }
  section { padding: 50px 0; }
  .hero { min-height: 62vh; }
  .flashcard { min-height: 250px; }
}
