:root {
  --bg: #0b0d12;
  --surface: #12161f;
  --surface2: #1a2030;
  --line: #232a38;
  --line2: #2a3345;
  --text: #e8ecf3;
  --muted: #9aa4b5;
  --accent: #f5e216;
  --cyan: #2dd4e8;
  --danger: #ff4d6d;
  --ok: #2dd4e8;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Layout */
.shell { min-height: 100dvh; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: #0f131b; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500; position: relative;
}
.nav a.active { color: var(--accent); font-weight: 600; }
.nav .brand, .nav .nav-foot { display: none; }
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #0b0d12; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.content { padding: 12px 16px 96px; max-width: 980px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0 14px; }
.topbar .right { display: flex; gap: 8px; align-items: center; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

@media (min-width: 900px) {
  .shell { display: flex; }
  .nav {
    position: sticky; top: 0; height: 100dvh; width: 232px; flex: none; flex-direction: column; justify-content: flex-start; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line); padding: 24px 12px;
  }
  .nav .brand { display: block; font-weight: 800; font-size: 20px; letter-spacing: 0.03em; padding: 0 10px 20px; }
  .nav .brand span { color: var(--accent); }
  .nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 8px; font-size: 15px; }
  .nav a.active { background: var(--surface2); color: var(--text); }
  .nav a.active svg { color: var(--accent); }
  .nav .badge { position: static; margin-left: auto; }
  .nav .nav-foot { display: block; margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 10px; line-height: 1.5; }
  .content { flex: 1; min-width: 0; padding: 20px 32px 48px; margin: 0; max-width: none; }
  .content > * { max-width: 1000px; }
}

/* Elemente */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.flat { padding: 0; overflow: hidden; }
.card.accent { border-color: var(--accent); }
.card.cyan { border-color: var(--cyan); }
.card h2 { margin-bottom: 10px; }
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; cursor: pointer;
  font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b0d12; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.iconbtn { width: 44px; height: 44px; padding: 0; border-radius: 10px; border: 1px solid var(--line2); background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.iconbtn .badge { top: 2px; left: auto; right: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; color: var(--muted); }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='search'], select, textarea {
  width: 100%; min-height: 46px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--text);
}
textarea { padding: 12px 14px; min-height: 90px; resize: vertical; }
select { appearance: auto; }
input[type='checkbox'] { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; cursor: pointer; font-size: 14px; font-weight: 500;
}
.chip.on { background: var(--surface2); border-color: var(--accent); color: var(--text); }
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; border: 1px solid var(--line2); color: var(--muted); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill.ok { border-color: var(--cyan); color: var(--cyan); }
.pill.warn { border-color: var(--accent); color: var(--accent); }
.pill.bad { border-color: var(--danger); color: var(--danger); }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.seg button { min-height: 40px; padding: 0 14px; background: transparent; border: 0; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--accent); color: #0b0d12; font-weight: 700; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.tabs a { white-space: nowrap; padding: 10px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; border: 1px solid transparent; }
.tabs a.on { background: var(--surface2); color: var(--text); border-color: var(--line2); }
.notice { border: 1px solid var(--line2); background: var(--surface); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--muted); }
.notice.warn { border-color: var(--accent); color: var(--text); }
.notice.bad { border-color: var(--danger); color: var(--text); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }

/* Listen */
.list > * { border-bottom: 1px solid var(--surface2); }
.list > *:last-child { border-bottom: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.item .title { font-weight: 600; }
.item .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.thumb { flex: none; width: 44px; height: 62px; border: 1px solid var(--line2); border-radius: 4px; background: #0b0d12; overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.price { font-weight: 700; white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; cursor: pointer; font-size: 18px; }
.stepper span { min-width: 28px; text-align: center; font-weight: 700; }

/* Kennzahlen und Balken */
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-size: 26px; font-weight: 800; margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: var(--line2); overflow: hidden; display: flex; gap: 2px; }
.bar > i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c, var(--muted)); margin-right: 6px; }
.cols { display: flex; align-items: flex-end; gap: 12px; height: 150px; }
.cols > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; font-size: 12px; }
.cols .col { width: 100%; max-width: 52px; border-radius: 6px 6px 0 0; background: var(--line2); min-height: 2px; }
.cols > div:last-child .col { background: var(--cyan); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--surface2); vertical-align: middle; }
td.num, th.num { text-align: right; }

/* Scan */
.camera { position: relative; background: #05070a; border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); width: 100%; }
.camera.off { aspect-ratio: 4 / 3; }
.camera video { display: block; width: 100%; height: auto; max-height: 72dvh; object-fit: contain; }
.camera.off video { height: 100%; }
.camera .torch { position: absolute; top: 10px; right: 10px; }
.camera .torch.on { background: var(--accent); color: #0b0d12; border-color: var(--accent); }
.camera .frame { position: absolute; width: 38%; aspect-ratio: 5 / 7; border: 2px solid var(--cyan); border-radius: 12px; pointer-events: none; }
.camera .status { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; justify-content: space-between; gap: 8px; }
.camera .status .pill { background: rgba(18, 22, 31, 0.92); color: var(--text); border-color: var(--line2); }
.reviewphoto { width: 100%; max-width: 280px; max-height: 360px; object-fit: contain; border-radius: 10px; background: #05070a; border: 1px solid var(--line2); }
.option { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 10px; background: var(--surface); cursor: pointer; width: 100%; text-align: left; }
.option.on { border-color: var(--accent); background: var(--surface2); }
.dot { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line2); }
.option.on .dot { border-color: var(--accent); background: var(--accent); }

/* Tausch */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0; }
.steps div { font-size: 12px; color: var(--muted); }
.steps div::before { content: ''; display: block; height: 4px; border-radius: 2px; background: var(--line2); margin-bottom: 6px; }
.steps div.done { color: var(--text); }
.steps div.done::before { background: var(--cyan); }

/* Modal und Toast */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); border: 1px solid var(--line2); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px; max-height: 90dvh; overflow-y: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .overlay { align-items: center; } .modal { border-radius: 16px; } }
.modal h2 { margin-bottom: 12px; }
#toasts { position: fixed; left: 0; right: 0; bottom: 84px; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--surface2); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 16px; max-width: 460px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); }
.toast.bad { border-color: var(--danger); }
.toast.ok { border-color: var(--cyan); }

/* Anmeldung */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 24px; max-width: 420px; margin: 0 auto; }
.logo { font-weight: 800; font-size: 26px; letter-spacing: 0.03em; }
.logo span { color: var(--accent); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: 0.06em; font-weight: 700; }

/* Kartenliste und Detailansicht */
.item.clickable { cursor: pointer; }
.item.clickable:hover { background: var(--surface2); }
.item.plain { width: 100%; background: transparent; border: 0; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.item.plain.current { background: var(--surface2); cursor: default; }
.filters select { flex: 1 1 130px; min-width: 0; }
.stack.tight { gap: 8px; }
.cardimg { display: flex; justify-content: center; }
.cardimg img { width: 100%; max-width: 300px; aspect-ratio: 5 / 7; object-fit: contain; border-radius: 12px; background: #05070a; border: 1px solid var(--line2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.stat { border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; background: var(--surface); }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .v { font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.cardtext { white-space: pre-line; line-height: 1.5; border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; }
.flavor { font-style: italic; color: var(--muted); }
.pill.tag { text-transform: uppercase; letter-spacing: 0.03em; font-size: 12px; }
.pill.kw { border-color: var(--cyan); color: var(--cyan); }
.faq { border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.faq .q { font-weight: 600; }
.faq .a { margin-top: 4px; color: var(--muted); }
.spark { width: 100%; height: 36px; color: var(--cyan); }

/* Regeln */
.ask { display: flex; flex-direction: column; gap: 10px; }
.ask textarea { width: 100%; min-height: 84px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line2); background: var(--surface); color: var(--text); border-radius: 999px; padding: 8px 12px; cursor: pointer; font: inherit; font-size: 14px; min-height: 40px; }
.chip:hover { border-color: var(--accent); }
.bubble { border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line2); background: var(--surface); }
.bubble.me { background: var(--surface2); align-self: flex-end; max-width: 92%; }
.answer { white-space: pre-wrap; line-height: 1.55; }
.rulecite { border: 1px solid var(--line2); border-radius: 10px; padding: 8px 12px; background: #0b0d12; font-size: 14px; }
.rulecite summary { cursor: pointer; font-weight: 600; }
.rulecite p { margin-top: 6px; color: var(--muted); white-space: pre-wrap; }
.ruleline { padding: 8px 0; border-bottom: 1px solid var(--surface2); }
.ruleline .n { display: inline-block; min-width: 54px; font-weight: 700; color: var(--accent); }
.ruleline.d3 { padding-left: 14px; } .ruleline.d4 { padding-left: 28px; } .ruleline.d5 { padding-left: 42px; }
details.section > summary { cursor: pointer; font-weight: 700; padding: 12px 14px; }
mark { background: rgba(255, 196, 0, 0.3); color: inherit; border-radius: 3px; }

.kpis { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpis .kpi { padding: 10px 12px; }
.kpis .kpi .value { font-size: 20px; }
.item .stepper button { width: 36px; height: 36px; }
.item .stepper span { min-width: 22px; }
@media (max-width: 420px) { .item { gap: 10px; padding: 10px 12px; } .kpis .kpi .label, .kpis .kpi .sub { font-size: 11px; } }
