/* Netzkarten – Look wie unsere Plum-App (macOS 27): dunkles Fenster mit violettem Schimmer, Glas-Leisten,
   Kapsel-Buttons mit Lila-Verlauf, Squircle-Icons, SF-Schrift.
   Wichtig für das iPhone: Die ganze Seite scrollt, es gibt keine position:fixed-Hülle und keine inneren
   Scroll-Container. Kopf- und Fußleisten sind sticky. Buttons verschieben sich beim Drücken nicht. */
:root {
  color-scheme: dark;
  --bg: #1e1f26;
  --glass: rgba(36, 38, 47, .72);
  --surface: rgba(255, 255, 255, .055);
  --surface-2: rgba(255, 255, 255, .09);
  --hair: rgba(255, 255, 255, .09);
  --hair-2: rgba(255, 255, 255, .16);
  --text: #f3f1f8;
  --muted: #a29eb0;
  --faint: #6f6b7e;
  --accent: #8b5cf6;
  --accent-text: #b79bff;
  --accent-bg: rgba(139, 92, 246, .14);
  --accent-line: rgba(160, 120, 255, .38);
  --grad: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  --glow: 0 6px 22px rgba(124, 58, 237, .38);
  --green: #32d74b;
  --green-text: #6ee787;
  --green-bg: rgba(50, 215, 75, .13);
  --red: #ff453a;
  --red-text: #ff7b72;
  --red-bg: rgba(255, 69, 58, .13);
  --yellow: #ffd60a;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r: 14px;
  --r-lg: 20px;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--text); font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(900px 520px at 100% 0%, rgba(124, 58, 237, .20), transparent 62%),
    radial-gradient(700px 480px at 0% 100%, rgba(168, 85, 247, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
button {
  font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer;
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button:disabled { cursor: default; }
input { font: inherit; }
b, strong { font-weight: 600; }
#haptic { position: absolute; left: -100px; top: 0; opacity: 0; pointer-events: none; }
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding: 18px 16px 32px; }

/* ---------- Glas-Leisten ---------- */
.top, .foot {
  position: sticky; z-index: 10; background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
}
.top {
  top: 0; display: flex; align-items: center; gap: 6px; min-height: 56px;
  padding: calc(var(--safe-t) + 6px) 8px 6px; border-bottom: 1px solid var(--hair);
}
.top h1 { flex: 1; margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { flex: 1; display: flex; align-items: center; gap: 10px; padding-left: 8px; font-size: 17px; font-weight: 700; }
.brand .sq { width: 30px; height: 30px; border-radius: 8px; }
.brand .sq svg { width: 18px; height: 18px; }
.pill {
  padding: 6px 12px; margin-right: 6px; border-radius: 999px; white-space: nowrap; font-size: 13px; font-weight: 600;
  color: var(--accent-text); background: var(--accent-bg); border: 1px solid var(--accent-line);
}
.cnt { min-width: 48px; padding-right: 8px; text-align: right; color: var(--muted); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.foot { bottom: 0; padding: 12px 16px calc(var(--safe-b) + 12px); border-top: 1px solid var(--hair); transition: background .2s; }
.foot.ok { background: rgba(26, 52, 34, .82); }
.foot.bad { background: rgba(62, 28, 30, .82); }
.foot:empty { display: none; }

/* ---------- Buttons ---------- */
.icon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.icon svg { width: 22px; height: 22px; }
.icon:active:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon:disabled { opacity: .3; }
.icon.on { color: var(--accent-text); }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 12px 20px;
  border-radius: 999px; font-size: 16px; font-weight: 600; text-align: center; color: #fff;
  background: var(--grad); box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn svg { width: 19px; height: 19px; flex: none; }
.btn:active:not(:disabled) { filter: brightness(1.15); }
.btn:disabled { background: var(--surface-2); color: var(--faint); box-shadow: none; }
.btn.blue { background: linear-gradient(135deg, #5b5ff0 0%, #8b5cf6 100%); }
.btn.red { background: var(--red-bg); color: var(--red-text); border: 1px solid rgba(255, 69, 58, .4); box-shadow: none; }
.btn.green { background: var(--green-bg); color: var(--green-text); border: 1px solid rgba(50, 215, 75, .4); box-shadow: none; }
.btn.ghost { background: var(--accent-bg); color: var(--accent-text); border: 1px solid var(--accent-line); box-shadow: none; }
.btn.ghost:active:not(:disabled), .btn.red:active, .btn.green:active { filter: brightness(1.3); }
.link { display: block; margin: 14px auto 0; min-height: 44px; padding: 10px 18px; border-radius: 999px; color: var(--muted); font-size: 15px; font-weight: 500; }
.link:active { background: var(--surface); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
@media (hover: hover) {
  .btn:hover:not(:disabled) { filter: brightness(1.08); }
  .opt:hover:not(:disabled), .mode:hover, .set:hover, .chip:hover, .tile:hover:not(:disabled) { border-color: var(--hair-2); }
  .icon:hover:not(:disabled), .link:hover { background: var(--surface); }
}

/* ---------- Squircle-Icons ---------- */
.sq {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #fff;
  background: var(--g, var(--grad)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 14px rgba(0, 0, 0, .25);
}
.sq svg { width: 24px; height: 24px; }
.sq.big { width: 84px; height: 84px; border-radius: 24px; margin: 4px auto 16px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 10px 40px rgba(124, 58, 237, .45); }
.sq.big svg { width: 44px; height: 44px; }

/* ---------- Startseite ---------- */
.hero { padding: 26px 18px 20px; text-align: center; }
.hero h2 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.3px; }
.hero .when { margin: 4px 0 0; color: var(--accent-text); font-weight: 600; font-size: 15px; }
.hero .hint { margin: 10px auto 18px; max-width: 420px; color: var(--muted); font-size: 15px; }
.hero .bar { max-width: 360px; margin: 0 auto; }
.hero .meta { text-align: center; }
.hero-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.hero-btns .btn { width: auto; flex: 1 1 200px; max-width: 280px; }
.sec { margin: 26px 4px 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.set {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 14px 14px 16px; margin-bottom: 10px; text-align: left;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--hair);
}
.set:active { background: var(--surface-2); }
.set .tx { flex: 1; min-width: 0; }
.set .tx b { display: block; font-size: 17px; }
.set .tx small { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.set .tx .meta { margin-top: 6px; }
.chev { color: var(--faint); font-size: 24px; line-height: 1; }
.meta { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.card { padding: 6px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--hair); }
.card h3 { margin: 12px 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.card h3 + .chips { margin-bottom: 14px; }
.plan-i { display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 52px; padding: 11px 0; text-align: left; border-bottom: 1px solid var(--hair); font-size: 15px; }
.plan-i:last-child { border-bottom: 0; }
.plan-i small { display: block; color: var(--accent-text); font-size: 12px; font-weight: 600; }
.plan-i .box { flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--hair-2); display: grid; place-items: center; color: transparent; }
.plan-i .box svg { width: 14px; height: 14px; }
.plan-i.on .box { background: var(--grad); border-color: transparent; color: #fff; }
.plan-i.on > span:last-child { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.setting { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 52px; text-align: left; font-size: 15px; border-bottom: 1px solid var(--hair); }
.card .btn { margin: 12px 0; }
.switch { position: relative; flex: none; width: 51px; height: 31px; border-radius: 999px; background: rgba(120, 120, 128, .32); transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.note-src { color: var(--faint); font-size: 12px; margin: 26px 4px 0; }

/* ---------- Set-Seite ---------- */
.sub { margin: 0 4px 16px; color: var(--muted); font-size: 15px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 112px; padding: 14px; text-align: left;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--hair);
}
.mode:active { background: var(--surface-2); }
.mode .sq { width: 38px; height: 38px; border-radius: 11px; margin-bottom: 10px; }
.mode .sq svg { width: 21px; height: 21px; }
.mode b { font-size: 16px; }
.mode small { color: var(--muted); font-size: 13px; line-height: 1.3; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hair);
  color: var(--text); font-size: 14px; font-weight: 500;
}
.chip:active { background: var(--surface-2); }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; box-shadow: 0 3px 12px rgba(124, 58, 237, .35); }
.tk { margin: 20px 4px 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.group { border-radius: var(--r); background: var(--surface); border: 1px solid var(--hair); padding: 0 4px 0 14px; }
.term { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--hair); }
.term:last-child { border-bottom: 0; }
.term .tx { flex: 1; min-width: 0; padding: 2px 0; }
.term b { display: block; font-size: 15px; overflow-wrap: anywhere; }
.term span { display: block; color: var(--muted); font-size: 14px; }
.starb { color: var(--faint); }
.starb.on, .starb.on:active { color: var(--yellow); }

/* ---------- Fragen ---------- */
.bar { flex: 1; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--grad); transition: width .35s ease; }
.bar.green i { background: linear-gradient(90deg, #7c3aed, #a855f7 60%, #d08cff); }
.bar.dual { position: relative; }
.bar.dual i { position: absolute; left: 0; top: 0; bottom: 0; height: auto; }
.bar.dual .l1 { background: rgba(168, 85, 247, .42); }
.bar.dual .l2 { background: var(--grad); }
.pline { font-variant-numeric: tabular-nums; }
.pk { display: inline-block; width: 8px; height: 8px; margin: 0 5px 1px 10px; border-radius: 50%; vertical-align: middle; }
.pk:first-child { margin-left: 0; }
.pk.l1 { background: rgba(168, 85, 247, .55); }
.pk.l2 { background: #a855f7; }
.pof { color: var(--faint); }
.lstat { flex: 1; min-width: 0; padding: 4px 12px 2px 2px; }
.lstat .pline { margin: 5px 0 0; font-size: 12px; white-space: nowrap; }
.label { margin: 4px 0 6px; color: var(--accent-text); font-size: 13px; font-weight: 600; }
.label.again { color: var(--red-text); }
.q { margin: 0 0 20px; font-size: 21px; font-weight: 700; line-height: 1.3; letter-spacing: -.2px; overflow-wrap: anywhere; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 14px; text-align: left;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--hair); font-size: 16px; font-weight: 500; overflow-wrap: anywhere;
}
.opt:active:not(:disabled) { background: var(--surface-2); }
.opt .k { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; }
.opt.sel { background: var(--accent-bg); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt.sel .k { background: var(--grad); color: #fff; }
.opt.ok { background: var(--green-bg); border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.opt.ok .k { background: var(--green); color: #0b2a12; }
.opt.bad { background: var(--red-bg); border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.opt.bad .k { background: var(--red); color: #fff; }
.opt:disabled { color: inherit; }
.opt:disabled:not(.ok):not(.bad) { opacity: .45; }
.fb { margin-bottom: 12px; }
.fb h4 { margin: 0 0 2px; font-size: 18px; font-weight: 700; }
.fb.ok h4 { color: var(--green-text); }
.fb.bad h4 { color: var(--red-text); }
.fb p { margin: 4px 0 0; font-size: 15px; }
code { font: .9em var(--mono); background: rgba(255, 255, 255, .08); padding: 1px 6px; border-radius: 6px; color: var(--accent-text); }

/* ---------- Karteikarten ---------- */
.flash {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: min(52vh, 440px); padding: 30px 24px;
  border-radius: 24px; text-align: center; background: linear-gradient(160deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .04));
  border: 1px solid var(--hair-2); box-shadow: 0 18px 50px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.flash.back { background: linear-gradient(160deg, rgba(139, 92, 246, .20), rgba(139, 92, 246, .06)); border-color: var(--accent-line); }
.flash .inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.flash .inner.anim { animation: flip .22s ease; }
@keyframes flip { 50% { transform: scaleX(.05); opacity: .4; } }
.flash .side { color: var(--accent-text); font-size: 13px; font-weight: 600; }
.flash .face { font-size: 25px; font-weight: 700; letter-spacing: -.2px; overflow-wrap: anywhere; }
.flash.back .face { font-size: 21px; font-weight: 600; line-height: 1.4; }
.flash .hint { color: var(--faint); font-size: 13px; }
.flash-tools { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
.flash-tools .icon { background: var(--surface); border: 1px solid var(--hair); }

/* ---------- Zuordnen ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  display: flex; align-items: center; justify-content: center; min-height: 84px; padding: 10px; text-align: center;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--hair); font-size: 14px; font-weight: 500; overflow-wrap: anywhere;
}
.tile:active:not(:disabled) { background: var(--surface-2); }
.tile.sel { background: var(--accent-bg); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tile.ok { background: var(--green-bg); border-color: var(--green); }
.tile.bad { background: var(--red-bg); border-color: var(--red); }
.tile.gone { visibility: hidden; }

/* ---------- Ergebnis ---------- */
.result { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 0 4px; }
.result h2 { margin: 12px 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -.2px; }
.result p { margin: 0; color: var(--muted); }
.result .time { margin-top: 28px; font-size: 44px; }
.ring text { font-family: var(--font); }
.rev { padding: 12px 14px; margin-bottom: 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--hair); border-left: 3px solid var(--red); }
.rev.ok { border-left-color: var(--green); }
.rev .q-s { margin: 0 0 6px; font-weight: 600; }
.rev .ans { margin: 2px 0; font-size: 15px; }
.rev .ans.ok { color: var(--green-text); }
.rev .ans.bad { color: var(--red-text); }
.rev .ex { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
details.more { margin-top: 16px; }
details.more > summary, details.wh > summary { list-style: none; cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
details > summary::-webkit-details-marker { display: none; }
details.more > summary { min-height: 48px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hair); font-weight: 600; color: var(--muted); }
.hist { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--hair); font-size: 15px; }
.hist:last-child { border-bottom: 0; }

/* ---------- Lernzettel ---------- */
.note { margin-bottom: 14px; padding: 16px 16px 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--hair); scroll-margin-top: calc(var(--safe-t) + 70px); }
.note h2 { margin: 0 0 8px; font-size: 19px; font-weight: 700; letter-spacing: -.2px; }
.note h3 { margin: 18px 0 8px; font-size: 14px; font-weight: 600; color: var(--accent-text); }
.note p { margin: 8px 0; font-size: 15px; }
.note ul, .note ol { margin: 6px 0; padding-left: 22px; font-size: 15px; }
.note li { margin: 4px 0; }
.note li::marker { color: var(--accent-text); }
.note table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.note th { text-align: left; padding: 6px; color: var(--muted); font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--hair-2); }
.note td { padding: 8px 6px; vertical-align: top; border-bottom: 1px solid var(--hair); overflow-wrap: anywhere; }
.note tr:last-child td { border-bottom: 0; }
.note td:first-child { font-weight: 600; }
pre.cli { margin: 10px 0; padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, .38); border: 1px solid var(--hair); color: #d9ccff; font: 13px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.tip { margin: 12px 0; padding: 11px 14px; border-radius: 12px; background: var(--accent-bg); border: 1px solid var(--accent-line); font-size: 14px; }
.notes-nav { margin-bottom: 16px; }
details.wh { border-top: 1px solid var(--hair); }
details.wh > summary { display: flex; gap: 10px; align-items: flex-start; min-height: 48px; padding: 12px 0; font-weight: 600; }
details.wh > summary .n { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-bg); color: var(--accent-text); font-size: 13px; }
details.wh[open] > summary .n { background: var(--grad); color: #fff; }
.wh-a { margin: 0 0 14px 36px; padding: 11px 14px; border-radius: 12px; background: var(--green-bg); border: 1px solid rgba(50, 215, 75, .3); font-size: 15px; }

/* ---------- Rechentrainer ---------- */
.task { margin: 16px 0; padding: 16px; border-radius: var(--r); text-align: center; background: var(--surface); border: 1px solid var(--hair); }
.task small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.task b { font: 600 26px var(--mono); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; margin: 0 4px 5px; color: var(--muted); font-size: 13px; font-weight: 600; }
.field input {
  width: 100%; min-height: 50px; padding: 10px 14px; border-radius: 12px; background: rgba(0, 0, 0, .3); border: 1px solid var(--hair-2);
  color: var(--text); font: 17px var(--mono); -webkit-appearance: none; appearance: none;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .3); }
.field input.ok { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.field input.bad { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.field em { display: block; margin: 5px 4px 0; color: var(--green-text); font: normal 14px var(--mono); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 100px); transform: translateX(-50%); z-index: 50; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; white-space: nowrap; font-size: 15px; font-weight: 600;
  background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--hair-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: pop .2s;
}
@keyframes pop { from { opacity: 0; } }
