/* ---------- Design-Tokens ---------- */
:root {
  --bg: #0a1424; --bg2: #11264a;
  --card: rgba(255, 255, 255, .055); --card-solid: #14233b; --tile: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .09);
  --text: #eef3fb; --muted: #8fa3bf;
  --accent: #ff8a3d; --accent2: #ff6a3d; --on-accent: #1a0e04;
  --teal: #19b3c4; --blue: #3b9eff; --violet: #9b8cff; --yellow: #ffd34d; --green: #35c27a; --red: #ff5d6c;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --r: 20px; --r-sm: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef3fa; --bg2: #dfe9f6;
    --card: rgba(255, 255, 255, .85); --card-solid: #fff; --tile: #eaf0f8;
    --line: rgba(20, 40, 80, .1);
    --text: #0f2038; --muted: #5b6f8a;
    --accent: #f26b1d; --accent2: #ff8a3d; --on-accent: #fff;
    --yellow: #c98a00; --blue: #1f7fe0; --teal: #0e93a3; --violet: #6f5de8; --green: #218a55; --red: #d6334a;
    --shadow: 0 8px 24px rgba(20, 40, 80, .1);
    color-scheme: light;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, var(--bg2), transparent 60%), var(--bg);
  background-attachment: fixed;
}

/* ---------- Header ---------- */
header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
header .brand { display: flex; align-items: center; gap: 9px; margin-right: auto; text-decoration: none; color: var(--text); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
header .brand b { color: var(--accent); font-weight: 800; }
.logo { width: 26px; height: 26px; border-radius: 9px; background: conic-gradient(from 210deg, var(--accent), var(--accent2), var(--teal), var(--accent)); box-shadow: inset 0 0 0 6px var(--bg); }
header .who { color: var(--muted); font-size: 14px; }
header a:not(.brand) { color: var(--muted); text-decoration: none; font-size: 14px; padding: 8px 10px; border-radius: 10px; }
header a:not(.brand):hover { background: var(--card); }
header button { padding: 8px 14px; font-size: 14px; min-height: 38px; }

main { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); }
h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 14px; letter-spacing: -.02em; }
h2 { font-size: 20px; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 17px; margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 14px; }
main > a[href^="#/"]:first-child { display: inline-block; text-decoration: none; color: var(--muted); font-size: 15px; padding: 6px 0; }

/* ---------- Karten ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.hero { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--card-solid)), var(--card-solid) 70%); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.hero h1 { margin: 0 0 2px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip { background: var(--tile); border: 1px solid var(--line); border-radius: 999px; padding: 4px 13px; font-size: 13px; font-weight: 600; }
.chip.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }

/* ---------- Formular ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.grid.w2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
label.f small { font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--tile);
  border: 1px solid transparent; border-radius: var(--r-sm); padding: 12px 14px; min-height: 46px; width: 100%; min-width: 0;
  text-transform: none; letter-spacing: 0; font-weight: 400; appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
button, a.btn {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 46px; padding: 10px 18px;
  color: var(--text); background: var(--tile); border: 1px solid var(--line); border-radius: var(--r-sm);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; transition: transform .08s, background .15s;
}
button:active, a.btn:active { transform: scale(.97); }
button.primary, a.btn.primary { color: var(--on-accent); border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
button.danger { color: var(--red); }
button.link { background: none; border: 0; color: var(--accent); min-height: 40px; padding: 4px 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.sub { margin: 20px 0 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.err { color: var(--red); margin: 8px 0 0; font-size: 14px; }
.inline { display: flex; gap: 8px; }
.inline select.unit { width: 84px; flex: none; }
textarea { resize: vertical; }

/* ---------- Navigation innerhalb der Seite ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; min-height: 40px; padding: 8px 16px; border-radius: 999px; background: var(--tile); color: var(--muted); border: 1px solid transparent; }
.tabs button.on { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.bikes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.bike { text-decoration: none; color: var(--text); display: block; margin: 0; }
.bike b { font-size: 19px; display: block; margin-bottom: 2px; }
.bike:active { transform: scale(.98); }

/* ---------- Setup-Liste ---------- */
.srowlink { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.srowlink:last-child { border-bottom: 0; padding-bottom: 2px; } .srowlink:first-child { padding-top: 2px; }
.srowlink a { flex: 1; min-width: 0; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.srowlink b { font-size: 18px; }
.srowlink small { font-size: 13px; }
button.check { width: 38px; min-height: 38px; height: 38px; border-radius: 50%; padding: 0; flex: none; background: none; border: 2px solid var(--line); color: var(--yellow); font-size: 18px; }
button.check.on { border-color: var(--yellow); background: color-mix(in srgb, var(--yellow) 14%, transparent); }

/* ---------- Aufklappbare Karten ---------- */
details.acc > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 40px; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: ''; width: 10px; height: 10px; margin-right: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
details.acc[open] > summary::after { transform: rotate(-135deg); }
details.acc > summary span { display: flex; flex-direction: column; }
details.acc > summary b { font-size: 21px; letter-spacing: -.01em; }
details.acc[open] > summary { margin-bottom: 8px; }
.title-input { font-size: 22px; font-weight: 700; flex: 1; min-width: 180px; }

/* ---------- Kacheln (Luftdruck, Sag, Tokens) ---------- */
.group { display: flex; align-items: center; gap: 12px; margin: 22px 0 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.group::before { content: ''; flex: 1; height: 1px; background: var(--line); }
.group span { order: 2; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tiles > label.f, .tiles > div > label.f { background: var(--tile); border-radius: var(--r-sm); padding: 12px 14px 10px; border: 1px solid var(--line); }
.tiles input, .tiles select { background: transparent; border: 0; padding: 0; min-height: 40px; color: var(--yellow); font-size: 26px; font-weight: 700; box-shadow: none; }
.tiles select.unit { font-size: 15px; color: var(--muted); font-weight: 600; background-color: transparent; width: 70px; }
.tiles .inline { align-items: center; }
.tiles label.f small { color: var(--muted); }
.tiles > div > small { display: block; margin-top: 6px; padding: 0 4px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, 1fr); } .tiles:has(> div) { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Regler ---------- */
.slider { margin: 16px 0 20px; }
.shead { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 4px; }
.sl { font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.sv { display: inline-flex; align-items: baseline; gap: 7px; }
.sv small { color: var(--muted); font-size: 13px; }
input.bignum { width: 64px; min-height: 38px; padding: 0; text-align: right; background: transparent; border: 0; font-size: 28px; font-weight: 800; color: var(--yellow); box-shadow: none; -moz-appearance: textfield; }
input.bignum::-webkit-outer-spin-button, input.bignum::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.strack { display: flex; align-items: center; gap: 12px; }
.strack .end { width: 22px; text-align: center; font-size: 13px; color: var(--muted); }
input.rng {
  --c: var(--blue); --p: 0%;
  flex: 1; padding: 0; min-height: 40px; height: 40px; border: 0; background: none; box-shadow: none; cursor: pointer;
}
input.rng.teal { --c: var(--teal); } input.rng.orange { --c: var(--accent); } input.rng.violet { --c: var(--violet); }
input.rng::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: linear-gradient(to right, var(--c) var(--p), var(--tile) var(--p)); border: 1px solid var(--line); }
input.rng::-moz-range-track { height: 8px; border-radius: 99px; background: var(--tile); border: 1px solid var(--line); }
input.rng::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--c); }
input.rng::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 32px; height: 32px; margin-top: -13px; border-radius: 50%;
  background: radial-gradient(circle, transparent 0 8px, color-mix(in srgb, var(--c) 55%, #8a94a6) 8px 9.5px, transparent 9.5px), #eef1f6;
  border: 0; box-shadow: 0 3px 10px rgba(0, 0, 0, .45);
}
input.rng::-moz-range-thumb {
  width: 32px; height: 32px; border-radius: 50%; border: 0; box-shadow: 0 3px 10px rgba(0, 0, 0, .45);
  background: radial-gradient(circle, transparent 0 8px, color-mix(in srgb, var(--c) 55%, #8a94a6) 8px 9.5px, transparent 9.5px), #eef1f6;
}
input.rng:focus { box-shadow: none; }
input.rng:focus-visible::-webkit-slider-thumb { outline: 3px solid color-mix(in srgb, var(--c) 45%, transparent); }

/* ---------- Info, Tipps, Sheet ---------- */
button.i { width: 22px; min-height: 22px; height: 22px; padding: 0; border-radius: 50%; font-size: 12px; font-style: italic; font-family: Georgia, serif; font-weight: 700; color: var(--blue); background: none; border: 1.5px solid var(--blue); }
details.tip { background: var(--tile); border-radius: var(--r-sm); padding: 4px 14px; margin: 4px 0 6px; font-size: 14px; }
details.tip summary { cursor: pointer; font-weight: 600; color: var(--muted); min-height: 40px; display: flex; align-items: center; }
details.tip ul { margin: 0 0 10px; padding-left: 20px; color: var(--muted); }
details.tip li { margin-bottom: 6px; }
.backdrop { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: rgba(4, 10, 20, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .2s; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--card-solid); border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0; padding: 12px 22px calc(22px + env(safe-area-inset-bottom)); animation: up .25s ease-out; }
.sheet .grab { width: 44px; height: 5px; background: var(--line); border-radius: 3px; margin: 0 auto 16px; }
.sheet h3 { font-size: 21px; }
.sheet h4 { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.sheet p, .sheet ul { margin: 0; color: var(--muted); } .sheet ul { padding-left: 20px; } .sheet li { margin: 5px 0; } .sheet li b { color: var(--text); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Speichern-Leiste ---------- */
.savebar { position: sticky; bottom: 0; z-index: 8; display: flex; gap: 8px; justify-content: flex-end; margin: 0 -16px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); }
.savebar .primary { flex: 1; max-width: 220px; }

/* ---------- Vergleich ---------- */
.cmpsel { margin-bottom: 14px; flex-wrap: nowrap; } .cmpsel select { flex: 1; } .cmpsel button { width: 46px; padding: 0; flex: none; border-radius: 50%; }
.cmp { padding: 12px 0; border-bottom: 1px solid var(--line); } .cmp:last-child { border-bottom: 0; padding-bottom: 0; }
.cmphead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.cmpvals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pill { background: var(--tile); border-radius: var(--r-sm); padding: 10px 14px; font-weight: 700; font-size: 17px; }
.pill.a { color: var(--yellow); } .pill.b { color: var(--blue); }
.diff { font-size: 12px; font-weight: 700; padding: 3px 11px; border-radius: 999px; background: var(--tile); color: var(--muted); }
.diff.up { background: color-mix(in srgb, var(--green) 25%, transparent); color: var(--green); }
.diff.down { background: color-mix(in srgb, var(--red) 25%, transparent); color: var(--red); }

/* ---------- Login ---------- */
.auth { max-width: 400px; margin: 8vh auto 0; padding: 26px 22px; }
.auth h2 { font-size: 26px; }
.auth .grid { grid-template-columns: 1fr; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--card-solid); color: var(--text); border: 1px solid var(--line); padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; transition: .25s; pointer-events: none; z-index: 40; font-weight: 600; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); color: #fff; border-color: transparent; }

/* ---------- Mobil ---------- */
@media (max-width: 520px) {
  main { padding: 14px 14px calc(40px + env(safe-area-inset-bottom)); }
  .card { padding: 16px; border-radius: 18px; }
  header .who { display: none; }
  .grid { grid-template-columns: 1fr 1fr; }
  .grid.w2 { grid-template-columns: 1fr; }
  .tabs { margin: 0 -14px 14px; padding: 0 14px 2px; }
  .savebar { margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
  h1 { font-size: 25px; }
}

/* ---------- Umschaltung Einstellungen / Produkte ---------- */
.mode { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 4px 0 16px; background: var(--tile); border: 1px solid var(--line); border-radius: 999px; }
.mode a { text-align: center; text-decoration: none; color: var(--muted); font-weight: 700; padding: 11px 8px; border-radius: 999px; }
.mode a.on { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
