/* Franz Unité 1 – Neon Dark */
@font-face {
  font-family: "Orbitron";
  src: url("fonts/orbitron.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --bg: #07070f;
  --bg-2: #120f2a;
  --surface: rgba(18, 16, 40, 0.82);
  --surface-2: rgba(30, 24, 66, 0.9);
  --line: rgba(139, 120, 255, 0.28);
  --line-strong: rgba(139, 120, 255, 0.55);
  --ink: #eef0ff;
  --muted: #9a97c2;
  --cyan: #22e5ff;
  --cyan-dim: rgba(34, 229, 255, 0.16);
  --magenta: #ff3df2;
  --violet: #8b5cf6;
  --green: #3dffa0;
  --green-dim: rgba(61, 255, 160, 0.14);
  --red: #ff4d6d;
  --red-dim: rgba(255, 77, 109, 0.16);
  --glow-cyan: 0 0 18px rgba(34, 229, 255, 0.45), 0 0 2px rgba(34, 229, 255, 0.9);
  --glow-violet: 0 0 22px rgba(139, 92, 246, 0.45);
  --radius: 14px;
  --tap: 48px;
  --display: "Orbitron", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

html { background: var(--bg); }

body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 50% -120px, rgba(139, 92, 246, 0.35), transparent 70%),
    radial-gradient(600px 400px at 110% 100%, rgba(34, 229, 255, 0.12), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 40%);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 100dvh;
}

/* feines Raster im Hintergrund */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(139, 120, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 120, 255, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), rgba(0,0,0,0.25));
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), rgba(0,0,0,0.25));
  z-index: 0;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

[hidden] { display: none !important; }

/* Kopfzeile */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: var(--tap) 1fr var(--tap);
  align-items: center;
  height: calc(var(--tap) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: rgba(7, 7, 15, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(34, 229, 255, 0.25), 0 8px 30px rgba(0, 0, 0, 0.4);
  color: var(--ink);
}

.topbar h1 {
  grid-column: 2;
  margin: 0;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(34, 229, 255, 0.6);
}

.topbar .back {
  grid-column: 1;
  height: var(--tap);
  width: var(--tap);
  background: none;
  border: 0;
  color: var(--cyan);
  font-size: 34px;
  line-height: 1;
  padding-bottom: 6px;
}

.topbar .counter {
  grid-column: 3;
  font-family: var(--display);
  font-size: 13px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

main {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

h2 {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 8px;
}

/* Segment-Schalter */
.segment {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
}

.segment button {
  flex: 1;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  padding: 0 6px;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.segment button.active {
  background: var(--cyan-dim);
  border-color: rgba(34, 229, 255, 0.6);
  color: var(--cyan);
  font-weight: 600;
  box-shadow: var(--glow-cyan);
}

/* Fortschritt */
.progress {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  gap: 10px;
}

.progress-row {
  display: grid;
  grid-template-columns: 74px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.progress-row .bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(139, 120, 255, 0.15);
  overflow: hidden;
  display: flex;
}

.progress-row .bar .sure { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); height: 100%; }
.progress-row .bar .unsure { background: var(--magenta); box-shadow: 0 0 10px var(--magenta); height: 100%; }
.progress-row .pct {
  text-align: right;
  font-family: var(--display);
  font-size: 13px;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

/* Modus-Knöpfe */
.modes { display: grid; gap: 10px; }

.mode {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  min-height: 68px;
  padding: 12px 16px 12px 20px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mode::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--cyan), var(--magenta));
  box-shadow: 0 0 12px rgba(34, 229, 255, 0.7);
}

.mode:active { border-color: var(--line-strong); box-shadow: var(--glow-violet); }
.mode-name { font-family: var(--display); font-size: 16px; font-weight: 700; letter-spacing: 0.06em; }
.mode-hint { font-size: 14px; color: var(--muted); }

/* Allgemeine Knöpfe */
.primary, .secondary {
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: 100%;
}

.primary {
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  color: #060612;
  border: 0;
  box-shadow: var(--glow-cyan);
}

.primary:active { filter: brightness(1.15); }

.secondary {
  background: transparent;
  color: var(--cyan);
  border: 1px solid rgba(34, 229, 255, 0.6);
  margin-top: 16px;
}

.secondary:active { background: var(--cyan-dim); }
.actions .secondary { margin-top: 0; }

.link {
  background: none;
  border: 0;
  color: var(--cyan);
  min-height: 44px;
  padding: 0 8px;
  font-size: 15px;
}

.link.danger { color: var(--muted); width: 100%; margin-top: 12px; }

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

/* Hinweis-Banner */
.banner {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px 4px;
  margin-bottom: 4px;
  font-size: 15px;
  box-shadow: var(--glow-violet);
}

.banner strong { color: var(--cyan); }
.banner p { margin: 6px 0; }
.banner .link { padding-left: 0; }
.ios-share {
  display: inline-block;
  border: 1.5px solid var(--cyan);
  border-radius: 4px;
  padding: 0 5px;
  line-height: 1.2;
  font-size: 14px;
  color: var(--cyan);
}

/* Karteikarte */
.card-wrap { position: relative; margin-top: 8px; }

.card {
  width: 100%;
  min-height: 300px;
  height: 46vh;
  max-height: 420px;
  perspective: 1200px;
  background: transparent;
  border: 0;
  padding: 0;
  display: block;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.45s;
  transform-style: preserve-3d;
}

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

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: 0 0 0 1px rgba(34, 229, 255, 0.12), 0 0 40px rgba(139, 92, 246, 0.25), inset 0 0 60px rgba(139, 92, 246, 0.08);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Ecken-Markierungen */
.card-face::before, .card-face::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--cyan);
  border-style: solid;
  opacity: 0.8;
}

.card-face::before { top: 12px; left: 12px; border-width: 2px 0 0 2px; border-radius: 6px 0 0 0; }
.card-face::after { bottom: 12px; right: 12px; border-width: 0 2px 2px 0; border-radius: 0 0 6px 0; }

.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.35), rgba(18, 16, 40, 0.9) 60%);
  border-color: rgba(255, 61, 242, 0.5);
  box-shadow: 0 0 0 1px rgba(255, 61, 242, 0.15), 0 0 40px rgba(255, 61, 242, 0.25);
}

.card-back::before, .card-back::after { border-color: var(--magenta); }

.card-lang {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-text {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 0 20px rgba(238, 240, 255, 0.25);
}

.card-ex {
  font-size: 16px;
  color: #d9c8ff;
  text-align: center;
  font-style: italic;
}

.card-tip {
  position: absolute;
  bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}

.speak {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: 1px solid rgba(34, 229, 255, 0.5);
  background: rgba(7, 7, 15, 0.7);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: var(--glow-cyan);
}

/* Abfrage + Schreiben */
.prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 20px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  margin-top: 8px;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.2);
}

.prompt-text {
  font-size: 26px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.choices { display: grid; gap: 10px; margin-top: 16px; }

.choice {
  min-height: 56px;
  padding: 10px 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 17px;
  line-height: 1.3;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.choice:active { border-color: var(--cyan); }
.choice.correct { background: var(--green-dim); border-color: var(--green); color: var(--green); font-weight: 600; box-shadow: 0 0 16px rgba(61, 255, 160, 0.35); }
.choice.wrong { background: var(--red-dim); border-color: var(--red); color: var(--red); box-shadow: 0 0 16px rgba(255, 77, 109, 0.3); }
.choice:disabled { opacity: 0.9; }

#write-form { margin-top: 16px; }

#write-input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(7, 7, 15, 0.7);
  color: var(--ink);
  font-size: 19px;
  caret-color: var(--cyan);
}

#write-input::placeholder { color: var(--muted); }
#write-input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--glow-cyan); }

.feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.feedback.ok { background: var(--green-dim); border-color: var(--green); box-shadow: 0 0 20px rgba(61, 255, 160, 0.25); }
.feedback.nok { background: var(--red-dim); border-color: var(--red); box-shadow: 0 0 20px rgba(255, 77, 109, 0.25); }
.feedback p { margin: 0 0 6px; }
.feedback-title { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; }
.feedback.ok .feedback-title { color: var(--green); }
.feedback.nok .feedback-title { color: var(--red); }
.feedback-answer { font-size: 20px; font-weight: 600; }
.feedback-hint { font-size: 15px; color: var(--muted); }
.feedback .primary { margin-top: 10px; }

/* Ergebnis */
.result { text-align: center; padding: 30px 16px 10px; }

.result-score {
  font-family: var(--display);
  font-size: 44px;
  font-weight: 700;
  margin: 0;
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(34, 229, 255, 0.7);
  letter-spacing: 0.04em;
}

.result-msg { font-size: 18px; margin: 8px 0 0; }

.wrong-list { display: grid; gap: 6px; margin-top: 16px; }

.wrong-list h3, .list h3 {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px;
}

.wrong-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--magenta);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 15px;
}

.wrong-item b { display: block; }

/* Liste */
.list { display: grid; gap: 0; }
.list h3 { margin: 18px 0 6px; }

.entry {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

.entry .dot {
  width: 10px;
  height: 10px;
  border-radius: 5px;
  margin-top: 7px;
  background: rgba(139, 120, 255, 0.25);
}

.entry .dot.l1 { background: var(--magenta); box-shadow: 0 0 8px var(--magenta); }
.entry .dot.l2 { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.entry .fr { font-weight: 600; }
.entry .de { color: var(--ink); }
.entry .ex { font-size: 14px; color: #d9c8ff; font-style: italic; }

.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 6px; }

.legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 5px;
  margin-right: 5px;
  background: rgba(139, 120, 255, 0.25);
}

.legend .l1::before { background: var(--magenta); }
.legend .l2::before { background: var(--cyan); }

@media (prefers-reduced-motion: reduce) {
  .card-inner { transition: none; }
}
