:root {
  --bg: #F7F7F5;
  --panel: #FFFFFF;
  --card: #FFFFFF;
  --fg: #37352F;
  --muted: #787774;
  --faint: #A5A29A;
  --line: #E9E9E7;
  --soft: #F1F1EF;
  --hover: #EFEFED;
  --accent: #2383E2;
  --rule: #E16259;
  --blue-bg: #E7F3F8; --blue: #337EA9;
  --green-bg: #EDF3EC; --green: #448361;
  --red-bg: #FDEBEC; --red: #D44C47;
  --shadow-panel: 0 0 0 1px rgba(15, 15, 15, .04), 0 2px 4px rgba(15, 15, 15, .04), 0 8px 20px rgba(15, 15, 15, .06);
  --shadow-card: 0 0 0 1px rgba(15, 15, 15, .05), 0 3px 6px rgba(15, 15, 15, .08), 0 12px 32px rgba(15, 15, 15, .14);
  --shadow-lift: 0 0 0 1px rgba(15, 15, 15, .05), 0 10px 20px rgba(15, 15, 15, .10), 0 28px 64px rgba(15, 15, 15, .24);
  --f: "Figtree", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --size: 55;
  color-scheme: light;
}
:root[data-kk="dark"] {
  --bg: #191919;
  --panel: #202020;
  --card: #252525;
  --fg: #D4D4D4;
  --muted: #9B9B9B;
  --faint: #6F6F6F;
  --line: #2F2F2F;
  --soft: #2C2C2C;
  --hover: #2F2F2F;
  --accent: #529CCA;
  --rule: #E16259;
  --blue-bg: #1F3A4D; --blue: #7DB8E0;
  --green-bg: #213A2C; --green: #75C28F;
  --red-bg: #4A2624; --red: #EB8F89;
  --shadow-panel: 0 0 0 1px rgba(255, 255, 255, .05), 0 2px 4px rgba(0, 0, 0, .25), 0 8px 20px rgba(0, 0, 0, .3);
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, .06), 0 3px 6px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .45);
  --shadow-lift: 0 0 0 1px rgba(255, 255, 255, .07), 0 10px 20px rgba(0, 0, 0, .35), 0 28px 64px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--f); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  min-height: 100%; max-width: 1760px; margin: 0 auto;
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start;
  padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Seitenleiste */
.side {
  position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px; padding: 22px 18px;
  background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-panel);
}
.brand h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); }
.cur { display: flex; flex-direction: column; gap: 4px; }
.cur h2 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.25; text-wrap: balance; overflow-wrap: anywhere; }
.cur .src { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.stats { margin: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.stats .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 34px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; padding-right: 7px; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.tag { display: inline-flex; align-items: center; height: 21px; padding: 0 7px; border-radius: 4px; background: var(--soft); font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats dd .tag { margin-right: -7px; }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.red { background: var(--red-bg); color: var(--red); }
.bar { width: 70px; height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .25s; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: var(--soft); border-radius: 8px; }
.seg button { padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--fg); box-shadow: 0 0 0 1px rgba(15, 15, 15, .05), 0 1px 2px rgba(15, 15, 15, .1); }

.decknav summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 2px 0; }
.decknav summary::-webkit-details-marker { display: none; }
.decknav summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); margin-right: 4px; }
.decknav[open] summary::after { transform: rotate(-135deg); margin-top: 5px; }
.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.nav h3 { margin: 10px 0 2px; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.nav button {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 30px;
  padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; cursor: pointer;
}
.nav button:hover { background: var(--hover); }
.nav button[aria-current="true"] { background: var(--hover); font-weight: 700; }
.nav button.pack { padding-left: 22px; min-height: 26px; font-size: 13px; color: var(--muted); }
.nav button.pack[aria-current="true"] { color: var(--fg); }
.nav .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .ct { flex: none; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav .ct.due { color: var(--blue); font-weight: 700; }
.nav .empty { padding: 4px 8px; color: var(--faint); }

.side-foot { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); margin-top: auto; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.setting output { color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.switch { position: relative; width: 32px; height: 18px; border: 0; border-radius: 999px; background: var(--faint); cursor: pointer; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(14px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 4px 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--red); }
.btn.danger.armed { background: var(--red); border-color: var(--red); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }

/* Kartenbereich */
.main { min-width: 0; }
.learn { min-height: calc(100vh - 32px); display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.stage { display: grid; place-items: center; padding-block: 12px 22px; perspective: 1400px; container-type: inline-size; }
.stack {
  position: relative;
  width: min(calc(var(--size) * 1cqi), calc((100vh - 230px) * 1.4095), calc(100% - 20px));
  min-width: min(280px, calc(100% - 20px));
}
.stack::before, .stack::after { content: ""; position: absolute; inset: 0; background: var(--card); border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.stack::before { transform: translateY(9px) scale(.965); z-index: 1; box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(15, 15, 15, .06); }
.stack::after { transform: translateY(18px) scale(.93); z-index: 0; opacity: .6; }
.stack[data-depth="1"]::after, .stack[data-depth="0"]::after, .stack[data-depth="0"]::before { display: none; }

.card {
  position: relative; z-index: 2; display: flex; flex-direction: column;
  aspect-ratio: 148 / 105; max-width: 100%;
  background: var(--card); border-radius: 8px; box-shadow: var(--shadow-card);
  container-type: inline-size; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  will-change: transform; transition: box-shadow .2s;
}
.card.lifted { box-shadow: var(--shadow-lift); cursor: grabbing; }
.card-meta {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 3.2cqi 5cqi 2cqi; border-bottom: 1px solid var(--rule);
  font-size: clamp(11px, 1.8cqi, 15px); color: var(--muted); font-variant-numeric: tabular-nums;
}
.card-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-body { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; gap: 2.6cqi; padding: 4cqi 5.5cqi 4.4cqi; }
.q, .a { white-space: pre-wrap; overflow-wrap: anywhere; }
.q { font-weight: 700; font-size: clamp(17px, 4.5cqi, 46px); line-height: 1.24; letter-spacing: -0.01em; text-wrap: balance; }
.a { font-size: clamp(15px, 3.6cqi, 38px); line-height: 1.42; padding-top: 2.8cqi; border-top: 1px solid var(--line); }
.card.revealed .card-body { justify-content: flex-start; }
.card.revealed .q { font-size: clamp(14px, 3cqi, 30px); color: var(--muted); }
.card-src { margin-top: auto; font-size: clamp(11px, 1.7cqi, 14px); color: var(--faint); }
.stamp {
  position: absolute; top: 12%; right: 5%; padding: .6cqi 1.8cqi; border-radius: 4px;
  font-size: clamp(12px, 2.6cqi, 24px); font-weight: 800;
  transform: rotate(-6deg); opacity: 0; pointer-events: none; transition: opacity .12s;
}
.card.lean-right .stamp, .card.is-ok .stamp { opacity: 1; background: var(--green-bg); color: var(--green); }
.card.lean-left .stamp, .card.is-bad .stamp { opacity: 1; background: var(--red-bg); color: var(--red); }
.card.lean-left .stamp { left: 5%; right: auto; transform: rotate(6deg); }
.card.auto { cursor: default; }
.card.checked .card-body { justify-content: flex-start; }
.card.checked .q { font-size: clamp(15px, 3.4cqi, 34px); }
.card.checked .a, .card.revealed .a { font-size: clamp(14px, 3.1cqi, 32px); }
.card input { user-select: text; -webkit-user-select: text; }

/* Kartentypen und Lernstufen */
.cimg { display: block; max-width: 100%; max-height: 42cqi; margin: 0 auto; object-fit: contain; border-radius: 4px; }
.hint { padding: 1.6cqi 2.2cqi; border-radius: 6px; background: var(--soft); font-size: clamp(14px, 3cqi, 30px); line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.hint-k { margin-right: .5em; font-weight: 700; color: var(--muted); }
.note { font-size: clamp(12px, 2.2cqi, 20px); color: var(--muted); }
.blank { display: inline-block; height: 1em; margin: 0 .1em; vertical-align: -0.12em; border-bottom: 2px solid var(--faint); border-radius: 3px 3px 0 0; background: var(--soft); }
.term { font-weight: 700; }
.ans { display: flex; flex-direction: column; gap: 2.2cqi; }
.opts { display: grid; gap: 1cqi; }
.opt {
  display: flex; align-items: center; gap: 1.8cqi; width: 100%; padding: 1.1cqi 1.8cqi;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card); text-align: left;
  font-size: clamp(12px, 2.3cqi, 22px); line-height: 1.3; cursor: pointer; transition: background .1s, border-color .1s;
}
.opt:hover:not(:disabled) { background: var(--hover); }
.opt .num { flex: none; display: grid; place-items: center; min-width: 1.6em; height: 1.6em; border-radius: 4px; background: var(--soft); font-size: .8em; font-weight: 700; color: var(--muted); }
.opt .ot { min-width: 0; overflow-wrap: anywhere; }
.opt.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.opt.right { border-color: var(--green); background: var(--green-bg); color: var(--green); box-shadow: none; }
.opt.wrong { border-color: var(--red); background: var(--red-bg); color: var(--red); box-shadow: none; }
.opt:disabled { cursor: default; }
.field {
  padding: .15em .45em; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg);
  font: inherit; line-height: 1.25; outline: none; transition: border-color .12s, box-shadow .12s, background .12s;
}
.field:focus { background: var(--card); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent); }
.field.ok { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.field.bad { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.cloze { font-size: clamp(15px, 3.2cqi, 32px); line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; }
.gap { margin: 0 .15em; padding: .02em .35em; max-width: 100%; font-size: .85em; vertical-align: baseline; border-radius: 4px; }
.sol { margin-left: .25em; font-weight: 700; color: var(--green); }
.calc { display: flex; flex-wrap: wrap; align-items: center; gap: 1.6cqi; font-size: clamp(15px, 3.4cqi, 34px); }
.calc .num { width: min(100%, 9em); font-variant-numeric: tabular-nums; }
.calc-k, .unit { color: var(--muted); }
.res { font-size: clamp(15px, 3.4cqi, 34px); font-weight: 700; font-variant-numeric: tabular-nums; }
.ans-foot { display: flex; justify-content: space-between; align-items: center; gap: 2cqi; margin-top: auto; }
.ans-foot .card-src { margin-top: 0; min-width: 0; }
.xbtn {
  flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: .4em; padding: .35em .8em;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg);
  font-size: clamp(12px, 2cqi, 16px); font-weight: 600; cursor: pointer;
}
.xbtn:hover:not(:disabled) { background: var(--hover); }
.xbtn:disabled { color: var(--muted); cursor: default; }
.xbtn kbd { min-width: 0; padding: 0 .35em; font-size: .85em; }
.explain { padding: 1.8cqi 2.4cqi; border-radius: 6px; background: var(--blue-bg); color: var(--fg); display: flex; flex-direction: column; gap: 1cqi; }
.explain .xk { font-size: clamp(11px, 1.8cqi, 14px); font-weight: 700; color: var(--blue); }
.explain .xt { font-size: clamp(13px, 2.7cqi, 24px); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.explain .xm { padding-top: 1cqi; border-top: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); }
.meta-r { display: flex; align-items: center; gap: 1.6cqi; min-width: 0; }
.flagbtn { flex: none; padding: .1em .45em; border: 0; border-radius: 4px; background: none; color: var(--faint); font: inherit; cursor: pointer; }
.flagbtn:hover { background: var(--red-bg); color: var(--red); }
.report { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 1.6cqi 5cqi; background: var(--red-bg); }
.report .field { flex: 1; min-width: min(14em, 100%); font-size: 14px; }
.report .btn { min-height: 30px; }
.flagnote { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--red); font-size: 13px; }
.help { min-height: 1.4em; text-align: center; font-size: 12px; color: var(--faint); }
#k-right.neutral .lbl { color: var(--accent); }

.types { display: flex; flex-direction: column; gap: 1px; }
.chk { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.chk:hover { background: var(--hover); }
.chk input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.chk .nm { flex: 1; }
.chk .ct { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.card.lean-right { box-shadow: 0 0 0 2px var(--green), var(--shadow-lift); }
.card.lean-left { box-shadow: 0 0 0 2px var(--red), var(--shadow-lift); }
.card.enter { animation: enter .2s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(12px) scale(.985); } }

.state {
  width: min(520px, 100%); padding: 26px 28px; display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border-radius: 8px; box-shadow: var(--shadow-card);
}
.state h2 { margin: 0; font-size: 20px; font-weight: 800; text-wrap: balance; }
.state p { margin: 0; color: var(--muted); max-width: 60ch; }
.state .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.state code { padding: 1px 5px; border-radius: 4px; background: var(--soft); color: var(--red); font-size: 13px; }

/* Steuerkreuz */
.pad { display: grid; grid-template-columns: repeat(5, minmax(0, 116px)); justify-content: center; gap: 6px; }
.key {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 6px;
  border: 0; border-radius: 8px; background: var(--panel); box-shadow: var(--shadow-panel); cursor: pointer;
  transition: background .1s, transform .08s;
}
.key:hover:not(:disabled) { background: var(--hover); }
.key .keys { display: flex; gap: 4px; }
kbd {
  min-width: 22px; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: var(--bg); font-family: var(--f); font-size: 12px; text-align: center; color: var(--muted);
}
.key .lbl { font-size: 13px; font-weight: 700; }
#k-up { grid-column: 3; grid-row: 1; }
#k-left { grid-column: 2; grid-row: 2; }
#k-down { grid-column: 3; grid-row: 2; }
#k-right { grid-column: 4; grid-row: 2; }
#k-skip { grid-column: 5; grid-row: 2; }
#k-skip .lbl { color: var(--muted); font-weight: 600; }
kbd.ghost { visibility: hidden; }
#k-left .lbl { color: var(--red); }
#k-right .lbl { color: var(--green); }
.key.hit { background: var(--hover); transform: translateY(1px); }
.key:disabled { opacity: .4; cursor: default; }
@media (pointer: coarse) { .key .keys { display: none; } }

/* Verwalten */
.manage { display: flex; flex-direction: column; gap: 18px; padding: 6px 4px; }
.manage-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.manage-head h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.panel { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-panel); padding: 6px 16px; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; }
.tbl tr.open td { background: var(--bg); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.link { padding: 0; border: 0; background: none; font-weight: 700; cursor: pointer; text-align: left; border-bottom: 1px solid var(--line); }
.link:hover { border-bottom-color: currentColor; }
.muted { color: var(--muted); }
.detail-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; padding: 12px 0 6px; }
.detail-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.ci { display: grid; grid-template-columns: 3ch minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px 18px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.ci .no { color: var(--faint); font-variant-numeric: tabular-nums; }
.ci .f, .ci .b { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.ci .f { font-weight: 700; }
.ci .meta { grid-column: 2 / 4; font-size: 12px; color: var(--faint); }
.ci textarea { width: 100%; min-height: 96px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); resize: vertical; }
.ci textarea:focus { outline: none; border-color: transparent; box-shadow: 0 0 0 2px var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 20;
  max-width: calc(100% - 32px); padding: 9px 14px; border-radius: 8px; background: var(--card); color: var(--fg); box-shadow: var(--shadow-card); font-weight: 600;
}

@media (max-width: 1100px) { .app { grid-template-columns: 250px minmax(0, 1fr); gap: 16px; } .side { padding: 18px 14px; gap: 16px; } }
@media (max-width: 680px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; }
  .learn { min-height: 0; }
  .stack { width: min(calc(100% - 20px), calc((100vh - 230px) * 1.4095)); }
  .ci { grid-template-columns: 3ch minmax(0, 1fr); }
  .ci .b, .ci .row-actions, .ci .meta { grid-column: 2; }
  .ci .row-actions { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .card.enter { animation: none; }
  .bar div, .switch, .switch::after, .card { transition: none; }
}

/* ---------- Ergänzungen Hirnkastl ---------- */
[hidden] { display: none !important; }
.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-top: -6px; }
.menu button {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 30px;
  padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; cursor: pointer; font-weight: 500; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu button:hover { background: var(--hover); }
.menu button[aria-current="true"] { background: var(--hover); font-weight: 700; }
.who { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.who b { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbtn { padding: 0; border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:hover { color: var(--fg); }

.page { display: flex; flex-direction: column; gap: 18px; padding: 6px 4px; max-width: 980px; }
.page > h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.page .lead { margin: -8px 0 0; color: var(--muted); max-width: 70ch; }
.box { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-panel); padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.box h3 { margin: 0; font-size: 16px; font-weight: 700; }
.box p { margin: 0; }
.box .muted { font-size: 13px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.in, select.in, textarea.in {
  width: 100%; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.in { min-height: 72px; resize: vertical; line-height: 1.45; }
textarea.in.mono { min-height: 180px; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent); }
input[type="file"].in { padding: 5px 8px; }
.radios, .checks { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.radios .chk, .checks .chk { padding: 3px 10px 3px 6px; border: 1px solid var(--line); }
.radios input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.msg { padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.msg.info { background: var(--blue-bg); color: var(--blue); }
.msg.ok { background: var(--green-bg); color: var(--green); }
.msg.err { background: var(--red-bg); color: var(--red); }
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kv b { color: var(--fg); font-weight: 600; }
.review { display: flex; flex-direction: column; }
.rv { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr); gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.rv input { width: 15px; height: 15px; margin: 3px 0 0; accent-color: var(--accent); cursor: pointer; }
.rv .f { font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; }
.rv .b { white-space: pre-wrap; overflow-wrap: anywhere; }
.rv .meta { grid-column: 2 / 4; font-size: 12px; color: var(--faint); }
.rv.off .f, .rv.off .b { opacity: .4; text-decoration: line-through; }
.deckform { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 4px 0 14px; }
.deckform .fld { flex: 1 1 160px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ulist .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.ulist .row:first-child { border-top: 0; }
.prompt-pre { margin: 0; max-height: 220px; overflow: auto; padding: 10px 12px; border-radius: 8px; background: var(--soft); font-family: ui-monospace, Consolas, monospace; font-size: 12px; white-space: pre-wrap; }
@media (max-width: 680px) {
  .rv { grid-template-columns: 22px minmax(0, 1fr); }
  .rv .b, .rv .meta { grid-column: 2; }
}

/* Anmeldung */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px 26px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-card); }
.login h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.login p { margin: -8px 0 4px; color: var(--muted); }
.login .btn { min-height: 38px; }
