/* ---------- Tokens: Clean Monochrome ---------- */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --soft: #f0f0f0;
  --text: #0a0a0a;
  --muted: #737373;
  --faint: #a3a3a3;
  --line: #e5e5e5;
  --invert-bg: #0a0a0a;
  --invert-text: #fafafa;
  --danger: #e5484d;
  --radius: 14px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --surface: #141414;
    --soft: #1c1c1c;
    --text: #fafafa;
    --muted: #8a8a8a;
    --faint: #5c5c5c;
    --line: #262626;
    --invert-bg: #fafafa;
    --invert-text: #0a0a0a;
    --danger: #ff6369;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #141414;
  --soft: #1c1c1c;
  --text: #fafafa;
  --muted: #8a8a8a;
  --faint: #5c5c5c;
  --line: #262626;
  --invert-bg: #fafafa;
  --invert-text: #0a0a0a;
  --danger: #ff6369;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

[hidden] { display: none !important; }

.muted { color: var(--muted); }

.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Kopfzeile ---------- */

.top {
  padding: calc(var(--safe-t) + 6px) 16px 10px;
  border-bottom: 1px solid var(--line);
}

.hud {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.hud-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hud-col.right { align-items: flex-end; text-align: right; }

.hud-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hud-rate {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tag {
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--invert-bg);
  color: var(--invert-text);
  font-size: 10px;
  font-weight: 700;
}

.tag.low { background: var(--danger); color: #fff; }

.needs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}

.need {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.need svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.need-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.need-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--text);
  transition: width .4s ease, background-color .3s;
}

.need-chip {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.need.low .need-chip { color: var(--text); }
.need.critical .need-bar i { background: var(--danger); }
.need.critical .need-chip,
.need.critical svg { color: var(--danger); }

/* ---------- Tabs / Inhalt ---------- */

main {
  flex: 1;
  min-height: 0;
  position: relative;
}

.tab {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 14px 16px calc(var(--tabbar-h) + var(--safe-b) + 16px);
  -webkit-overflow-scrolling: touch;
}

.tab.active { display: block; animation: fade-in .18s ease; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
}

#tab-train.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Training ---------- */

.rank-row {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.rank-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.rank-next { font-size: 12px; color: var(--muted); }

.rank-sub { margin-top: 6px; }

.status-chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--text);
}

.status-chip:empty { display: none; }

/* ---------- Luxus ---------- */

.status-card {
  padding: 18px 16px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--invert-bg);
  color: var(--invert-text);
}

.status-card .hud-label { color: inherit; opacity: .6; }

.status-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 2px 0 8px;
}

.status-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.status-card .bar { background: rgba(127, 127, 127, .35); }
.status-card .bar-fill { background: var(--invert-text); }

.status-next {
  margin: 8px 0 0;
  font-size: 12px;
  opacity: .6;
}

.lux-cat { margin-bottom: 18px; }

.lux-cat h3 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint.center { text-align: center; }

/* ---------- Quests ---------- */

.quest {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.quest-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 600;
}

.quest-num { font-size: 12px; color: var(--muted); white-space: nowrap; }

.quest-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  min-height: 30px;
}

.quest-reward { font-size: 12px; font-weight: 700; }

.quest-claim {
  height: 30px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--invert-bg);
  color: var(--invert-text);
  font-size: 13px;
  font-weight: 700;
}

.quest-claim:disabled { background: var(--soft); color: var(--faint); cursor: default; }

.quest.done { opacity: .55; }

.banner-col { flex-direction: column; gap: 2px; }
.banner-col span:last-child { font-weight: 500; opacity: .7; }

/* ---------- Rangliste ---------- */

.rivals {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.rival {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.rival:first-child { border-top: 0; }

.rival-place { width: 22px; font-size: 13px; font-weight: 700; color: var(--muted); }

.rival-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rival-main b { font-size: 14px; }
.rival-main small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rival-kraft { font-size: 13px; font-weight: 700; }

.rival.passed { opacity: .45; }

.rival.me {
  background: var(--invert-bg);
  color: var(--invert-text);
}

.rival.me .rival-place,
.rival.me small { color: inherit; opacity: .7; }

.rival-empty { margin: 0; padding: 12px 14px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }

.friend-del {
  width: 28px;
  height: 28px;
  margin-right: -6px;
  border-radius: 8px;
  font-size: 18px;
  color: var(--muted);
}

.section-title {
  margin: 18px 0 8px;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title:first-child { margin-top: 4px; }
.btn-row + .section-title { margin-top: 22px; }

.setting.setting-col { flex-direction: column; align-items: stretch; gap: 6px; padding: 6px 0; }

/* ---------- Ereignis-Pille ---------- */

.event-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--invert-bg);
  color: var(--invert-text);
  font-size: 13px;
  animation: pill-pulse 1.6s ease-in-out infinite;
}

.event-pill span { font-size: 11px; opacity: .7; }

@keyframes pill-pulse {
  50% { transform: scale(1.04); }
}

/* ---------- Turnier ---------- */

.meet-lifts { margin: 0 0 12px; border-top: 1px solid var(--line); }

.meet-lift {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.meet-lift span { color: var(--muted); }
.meet-prizes { font-size: 12px !important; color: var(--muted); }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--bg);
}

.overlay-box { width: 100%; max-width: 400px; }

.meet-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.meet-title {
  margin: 8px 0 28px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
}

.meet-bar {
  position: relative;
  height: 56px;
  border-radius: 14px;
  background: var(--soft);
  overflow: hidden;
  transition: background-color .2s;
}

.meet-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--line);
  border-left: 2px solid var(--text);
  border-right: 2px solid var(--text);
}

.meet-perfect { position: absolute; top: 0; bottom: 0; background: var(--text); opacity: .25; }

.meet-marker {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 4px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--text);
}

.meet-bar.hit-perfect { background: var(--text); }
.meet-bar.hit-perfect .meet-zone { background: var(--invert-text); }
.meet-bar.hit-perfect .meet-marker { background: var(--danger); }
.meet-bar.miss { background: color-mix(in srgb, var(--danger) 25%, var(--soft)); }

.meet-feedback {
  min-height: 24px;
  margin: 16px 0 24px;
  text-align: center;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
}

.meet-btn {
  width: 100%;
  height: 120px;
  border-radius: 24px;
  background: var(--invert-bg);
  color: var(--invert-text);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: .06em;
  touch-action: none;
}

.meet-btn:active:not(:disabled) { transform: scale(.98); }
.meet-btn:disabled { opacity: .4; }

.meet-reward {
  margin: 16px 0 20px;
  text-align: center;
  font-weight: 600;
}

.bar {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: var(--text);
  transition: width .3s ease;
}

.tap-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.tap-wrap {
  position: relative;
  width: min(58vw, 240px);
  aspect-ratio: 1;
}

.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 1.5;
}

.ring-bg { stroke: var(--line); }

.ring-fg {
  stroke: var(--text);
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  transition: stroke-dasharray .4s ease;
}

.tap {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  touch-action: none;
  transition: opacity .3s, background-color .3s;
}

.tap svg {
  height: 66%;
  grid-area: 1 / 1;
  transition: opacity .3s;
}

/* Körper */
.tap .bp { fill: var(--faint); transition: fill .2s; }
.tap .bp.on { fill: var(--text); }
.tap .pec { stroke: var(--surface); stroke-width: 1.5; }
.tap .acc { fill: none; stroke: var(--surface); stroke-width: 1.6; stroke-linecap: round; }
.tap .chain { stroke-dasharray: 1.6 1.2; }
.tap .acc-fill { fill: var(--surface); }


.status-label {
  grid-area: 1 / 1;
  display: none;
  flex-direction: column;
  align-items: center;
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: .1em;
}

.status-label small {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0;
  margin-top: 4px;
}

body.busy .tap { background: var(--soft); cursor: default; }
body.busy .tap svg { opacity: .12; }
body.busy .status-label { display: flex; }

.tap-info {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
}

.actions {
  width: 100%;
  max-width: 420px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.action {
  position: relative;
  overflow: hidden;
  height: 52px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.action svg {
  position: relative;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action span { position: relative; }

.action span small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  opacity: .6;
  line-height: 1.2;
}

.action.dim { color: var(--faint); }

.action.primary-ish {
  background: var(--invert-bg);
  color: var(--invert-text);
  border-color: var(--invert-bg);
}

.action:disabled { color: var(--faint); cursor: default; }

.action-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--soft);
}

.float {
  position: fixed;
  pointer-events: none;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  transform: translate(-50%, -50%);
  animation: float-up .8s cubic-bezier(.2, .7, .3, 1) forwards;
  z-index: 20;
}

@keyframes float-up {
  to { transform: translate(-50%, -160%); opacity: 0; }
}

/* ---------- Segment-Umschalter ---------- */

.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--soft);
  border-radius: 12px;
  margin-bottom: 12px;
}

.seg button {
  position: relative;
  flex: 1;
  height: 36px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: background-color .15s, color .15s;
}

.seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

.seg-small button { height: 30px; font-size: 13px; }

/* ---------- Listen ---------- */

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .08s ease, border-color .15s;
}

.item:active:not(:disabled) { transform: scale(.98); }

.item-main { flex: 1; min-width: 0; }

.item-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.item-count {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.item-cost {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--invert-bg);
  color: var(--invert-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.item-cost:empty { display: none; }

.item:disabled { cursor: default; }
.item:disabled .item-cost { background: var(--soft); color: var(--faint); }
.item:disabled .item-name { color: var(--muted); }

.item.locked { border-style: dashed; background: transparent; }
.item.done .item-name { color: var(--text); }
.item.static { cursor: default; }
.item.static:active { transform: none; }
.item.done .item-cost { background: transparent; color: var(--text); padding-right: 0; }
.item.locked .item-name { color: var(--faint); }

.empty {
  text-align: center;
  color: var(--muted);
  margin-top: 40px;
}

.banner {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--invert-bg);
  color: var(--invert-text);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

/* ---------- Brands ---------- */

.brand {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.brand.locked { border-style: dashed; background: transparent; }

.brand-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }

.brand-level {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.brand-desc { margin: 2px 0 12px; font-size: 13px; color: var(--muted); }

.brand-levelbar {
  display: grid;
  grid-template-columns: repeat(25, 1fr);
  gap: 2px;
  margin-bottom: 12px;
}

.brand-levelbar i {
  height: 6px;
  border-radius: 1px;
  background: var(--line);
}

.brand-levelbar i.on { background: var(--text); }

.brand-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.brand-stat {
  padding: 10px;
  border-radius: 10px;
  background: var(--soft);
}

.brand-stat small {
  display: block;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.brand-stat b {
  font-family: var(--mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.brand-synergy { margin: 0 0 12px; font-size: 12px; color: var(--muted); }

.brand-lines {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.brand-lines h4 {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-lines .item { padding: 10px 12px; }

/* ---------- Profil ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.card p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
}

.stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  margin: 0;
  font-size: 14px;
}

.stats dt { color: var(--muted); }
.stats dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.primary {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  background: var(--invert-bg);
  color: var(--invert-text);
  font-weight: 700;
}

.primary:disabled {
  background: var(--soft);
  color: var(--faint);
  cursor: default;
}

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  font-size: 14px;
}

.setting .seg { margin: 0; flex: 0 1 230px; }

.switch {
  width: 46px;
  height: 28px;
  border-radius: 14px;
  background: var(--line);
  position: relative;
  transition: background-color .2s;
}

.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s;
}

.switch[aria-checked="true"] { background: var(--text); }
.switch[aria-checked="true"] i { transform: translateX(18px); background: var(--bg); }

.danger-link {
  display: block;
  margin: 14px auto 0;
  font-size: 13px;
  color: var(--danger);
}

/* ---------- Tab-Leiste ---------- */

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--bg);
  border-top: 1px solid var(--line);
  z-index: 10;
}

.tabs button {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--faint);
  transition: color .15s;
}

.tabs svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tabs button.on { color: var(--text); }

.tabs button.on::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 30%;
  right: 30%;
  height: 2px;
  background: var(--text);
}

.dot {
  position: absolute;
  top: 10px;
  left: calc(50% + 9px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text);
}

.dot.alert { background: var(--danger); }

.dot-inline {
  position: static;
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---------- Toast & Modal ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  transform: translate(-50%, 20px);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--invert-bg);
  color: var(--invert-text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .5);
  z-index: 40;
}

.modal-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 18px;
  padding: 20px;
}

.modal-box h3 { margin: 0 0 8px; }
.modal-box p { margin: 0 0 18px; color: var(--muted); line-height: 1.45; font-size: 14px; }

.modal-actions {
  display: flex;
  gap: 8px;
}

.modal-actions button {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  font-weight: 600;
}

.modal-actions button:not(.primary) { background: var(--soft); }
.modal-actions.stack { flex-direction: column; }
.modal-actions.stack button { flex: none; width: 100%; }

.modal-box ul { margin: 0 0 18px; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.modal-box li + li { margin-top: 6px; }
.modal-box textarea, .modal-box input { margin-bottom: 14px; }

/* ---------- Eingaben ---------- */

input, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* verhindert Zoom beim Fokus auf iOS */
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  user-select: text;
  -webkit-user-select: text;
  outline: none;
}

input:focus, textarea:focus { border-color: var(--text); }

textarea {
  font-family: var(--mono);
  font-size: 12px;
  min-height: 110px;
  resize: none;
  word-break: break-all;
}

textarea:not([readonly]) { font-size: 16px; }

.btn-secondary {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
}

.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

/* ---------- Übersicht & Onboarding ---------- */

.intro {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.seg.solo { display: none; }

#needHunger { cursor: pointer; }

/* Aktionen: Icon über Label, 3–4 nebeneinander */
.actions { display: flex; gap: 6px; }

.action {
  flex: 1 1 0;
  min-width: 0;
  height: 60px;
  flex-direction: column;
  gap: 2px;
  padding: 0 4px;
  font-size: 12px;
}

.action span { text-align: center; }
.action .dot { top: 6px; left: auto; right: 8px; }

/* NEU-Abzeichen */
.is-new::after {
  content: "NEU";
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .06em;
  vertical-align: middle;
}

.tabs button.is-new::after,
.action.is-new::after {
  position: absolute;
  top: 5px;
  right: 6px;
}

.seg button.is-new::after { margin-left: 6px; }

/* Erste Schritte */
.ob-card {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-bottom: 12px;
  padding: 12px 14px;
  text-align: left;
  border-radius: var(--radius);
  background: var(--invert-bg);
  color: var(--invert-text);
}

.ob-top {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .7;
}

.ob-top .num { letter-spacing: 0; }

.ob-text {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 8px;
  font-size: 15px;
}

.ob-text .num { font-size: 13px; opacity: .8; white-space: nowrap; }

.ob-bar {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: rgba(127, 127, 127, .4);
  overflow: hidden;
}

.ob-bar i { display: block; height: 100%; width: 0; background: currentColor; transition: width .3s; }

/* Essen-Sheet */
.sheet { position: fixed; inset: 0; z-index: 25; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  animation: fade-in .2s ease;
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82vh;
  overflow-y: auto;
  padding: 10px 16px calc(var(--safe-b) + 20px);
  border-radius: 20px 20px 0 0;
  background: var(--bg);
  animation: sheet-up .25s ease;
}

.sheet-panel::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 2px;
  background: var(--line);
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.sheet-head h3 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }

.sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--soft);
  font-size: 18px;
}

/* Tour */
.tour { position: fixed; inset: 0; z-index: 60; }

.tour-spot {
  position: fixed;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .72);
  transition: left .3s ease, top .3s ease, width .3s ease, height .3s ease;
  pointer-events: none;
}

.tour-bubble {
  position: fixed;
  left: 16px;
  right: 16px;
  max-width: 380px;
  margin: 0 auto;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}

.tour-step { font-size: 11px; font-weight: 700; color: var(--muted); }
.tour-bubble h3 { margin: 4px 0 6px; font-size: 18px; }
.tour-bubble p { margin: 0 0 14px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.tour-actions { display: flex; gap: 8px; }
.tour-actions button { flex: 1; height: 42px; border-radius: 12px; font-weight: 700; }
#tourSkip { background: var(--soft); }

.tour-again { margin-top: 8px; }

/* ---------- Zahnrad & Einstellungen ---------- */

.hud-col { flex: 1; }

.gear {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: color .15s, transform .3s;
}

.gear:active { transform: rotate(45deg); }

.gear svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-group {
  padding: 4px 0 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.settings-group:last-of-type { border-bottom: 0; }

.app-version {
  margin: 6px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--faint);
}

/* ---------- Gesperrte Bereiche ---------- */

/* Schloss-Symbol an Segment-/Tab-/Aktions-Buttons und gesperrten Listeneinträgen */
.seg button.locked::after,
.tabs button.locked::after,
.action.locked::after,
.item.locked::after {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 5px;
  vertical-align: -1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' fill='none' stroke='black' stroke-width='2.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' fill='none' stroke='black' stroke-width='2.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.seg button.locked:not(.on) { opacity: .6; }
.tabs button.locked { opacity: .6; }

.tabs button.locked::after {
  position: absolute;
  top: 8px;
  left: calc(50% + 7px);
  margin: 0;
}

.action.locked { opacity: .55; }

.action.locked::after {
  position: absolute;
  top: 6px;
  right: 7px;
  margin: 0;
}

/* Ansicht gesperrt: Inhalt verschwommen, Karte mit Hinweis darüber */
[data-lock] { position: relative; }

.lock-overlay,
.lock-ghost { display: none; }

.pane-locked { min-height: 380px; }

.pane-locked > :not(.lock-overlay) {
  filter: blur(5px);
  opacity: .45;
  pointer-events: none;
  user-select: none;
}

.pane-locked > .lock-overlay {
  display: flex;
  position: absolute;
  inset: 0;
  z-index: 2;
  justify-content: center;
  align-items: flex-start;
  padding-top: 56px;
}

.pane-locked > .lock-ghost {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.lock-ghost i {
  display: block;
  height: 64px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.lock-card {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 20px 18px;
  text-align: center;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .14);
}

.lock-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--invert-bg);
  color: var(--invert-text);
}

.lock-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lock-card b { font-size: 18px; letter-spacing: -0.01em; }
.lock-hint { font-size: 13px; line-height: 1.4; color: var(--muted); }
.lock-card .bar { width: 100%; margin-top: 10px; }
.lock-card small { font-size: 11px; color: var(--muted); }

/* ---------- Rang-Karte ---------- */

.rank-card {
  display: block;
  width: 100%;
  max-width: 420px;
  padding: 12px 14px;
  text-align: left;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform .08s ease;
}

.rank-card:active { transform: scale(.98); }

.rank-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.rank-card-more { font-size: 18px; line-height: 1; letter-spacing: 0; }

.rank-card-names {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 2px 0 8px;
}

.rank-card-names b {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.rank-card-names span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.rank-card-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-card-bar .bar { flex: 1; height: 6px; border-radius: 3px; }
.rank-card-bar .bar-fill { display: block; border-radius: 3px; }
.rank-card-bar .num { font-size: 12px; font-weight: 700; min-width: 34px; text-align: right; }

.rank-card-nums {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Rang-Übersicht ---------- */

.rank-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.rank-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.rank-item:first-child { border-top: 0; }

.rank-item-no {
  width: 22px;
  padding-top: 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.rank-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rank-item-main b { font-size: 15px; }
.rank-item-main small { font-size: 11px; color: var(--muted); }
.rank-item-rewards { font-size: 12px; line-height: 1.4; color: var(--muted); }
.rank-item-rewards:empty { display: none; }

.rank-item-state {
  flex-shrink: 0;
  padding-top: 2px;
  font-size: 12px;
  font-weight: 700;
}

.rank-item.upcoming .rank-item-main b { color: var(--muted); }

.rank-item.current {
  background: var(--invert-bg);
  color: var(--invert-text);
}

.rank-item.current .rank-item-no,
.rank-item.current small,
.rank-item.current .rank-item-rewards { color: inherit; opacity: .75; }

/* ---------- Aufstiegs-Fenster ---------- */

.rankup {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 14px;
  text-align: center;
}

.rankup-step {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.rankup-name {
  margin: 2px 0 10px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  animation: rankup-pop .5s cubic-bezier(.2, 1.4, .4, 1);
}

@keyframes rankup-pop {
  from { transform: scale(.6); opacity: 0; }
}

.rankup p { margin: 0 0 6px !important; }
.rankup ul { align-self: stretch; text-align: left; margin: 0 !important; }

/* Lange Fenster (z. B. viele Freischaltungen) scrollen statt überzulaufen */
.modal-box { max-height: 86vh; overflow-y: auto; }

/* ---------- Freundes-Code ---------- */

.friend-code {
  margin-bottom: 14px;
  padding: 16px 12px;
  border-radius: 12px;
  background: var(--soft);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: .08em;
  text-align: center;
  user-select: text;
  -webkit-user-select: text;
}

.rival.waiting { opacity: .6; }

/* ---------- Figur: Details ---------- */

.tap .line-sep { stroke: var(--surface); stroke-width: 1.2; }
.tap .detail { fill: none; stroke: var(--surface); stroke-width: .9; stroke-linecap: round; opacity: .8; }

/* ---------- Pump-Meter ---------- */

.ring circle { stroke-width: 3.2; }
.ring-fg { transition: stroke-dasharray .15s linear, opacity .2s; }

.pump-info {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.pump-info + .tap-info { margin-top: 4px; }

/* PUMP aktiv: Kreis invertiert und pulsiert */
body.pumping .tap {
  background: var(--invert-bg);
  border-color: var(--invert-bg);
  animation: pump-pulse .7s ease-in-out infinite;
}

body.pumping .tap .bp { fill: var(--faint); }
body.pumping .tap .bp.on { fill: var(--invert-text); }
body.pumping .tap .pec,
body.pumping .tap .line-sep { stroke: var(--invert-bg); }
body.pumping .tap .detail,
body.pumping .tap .acc { stroke: var(--invert-bg); }
body.pumping .tap .acc-fill { fill: var(--invert-bg); }
body.pumping .pump-info { color: var(--text); }

@keyframes pump-pulse {
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--text) 12%, transparent); }
}

.float.big { font-size: 26px; }

/* Klick-Bereich darf nicht zusammengedrückt werden – lieber scrollt das Training leicht */
#tab-train .tap-area { flex: 1 0 auto; min-height: 0; padding: 14px 0 10px; }
.tap-wrap { width: min(54vw, 220px); }

/* Training kompakter, damit auch mit Checkliste alles ohne Scrollen passt */
.ob-card { padding: 9px 12px; margin-bottom: 8px; }
.ob-text { margin: 2px 0 6px; font-size: 14px; }
.rank-card { padding: 10px 12px; }
.rank-card-names { margin: 0 0 6px; }
.rank-card-names b { font-size: 21px; }
.rank-card-nums { margin-top: 4px; }
.rank-sub { margin-top: 4px; }
.event-pill { margin-top: 8px; padding: 6px 14px; }
.tap-wrap { width: min(66vw, 250px); }
#tab-train .tap-area { padding: 10px 0 8px; }
.pump-info { margin-top: 8px; }

/* ---------- Willkommen zurück ---------- */

.offline-stats {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  margin: 4px 0 14px;
}

.offline-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 8px;
  border-radius: 14px;
  background: var(--invert-bg);
  color: var(--invert-text);
}

.offline-stat b {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.offline-stat small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .7;
}

.offline p { margin: 0 0 10px !important; }
.offline .offline-rank { color: var(--text) !important; font-weight: 700; }
.offline .offline-hint { color: var(--danger) !important; font-weight: 600; }
.offline .offline-bonus { margin-top: -6px !important; font-size: 12px; text-align: center; }
.offline .offline-missed {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  font-size: 13px;
}

/* ---------- Icons & Visualisierung ---------- */

.ic {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Icon links in Listeneinträgen; gefüllt, sobald man es besitzt */
.item-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--text);
  transition: background .2s, color .2s;
}

.item.owned .item-icon,
.item.done .item-icon { background: var(--invert-bg); color: var(--invert-text); }
.item:disabled:not(.owned):not(.done) .item-icon { color: var(--muted); }
.item.locked .item-icon { background: transparent; border: 1px dashed var(--line); color: var(--faint); }

/* Meilenstein-Balken unter dem Untertext */
.item-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.item-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--soft);
  overflow: hidden;
}

.item-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--text);
  transition: width .35s ease;
}

.item-progress span {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

/* Anteils-Karte (Kraft/s, Einkommen) */
.share-card {
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.share-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.share-head span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.share-head b { font-size: 15px; }

.share-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--soft);
}

.share-bar i { display: block; height: 100%; transition: width .4s ease; }

.share-card .s0, .share-card .s1, .share-card .s2,
.share-card .s3, .share-card .s4, .share-card .s5 { background: var(--text); }
.share-card .s1 { opacity: .72; }
.share-card .s2 { opacity: .5; }
.share-card .s3 { opacity: .34; }
.share-card .s4 { opacity: .22; }
.share-card .s5 { opacity: .13; }

.share-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
}

.share-leg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.share-leg > i { width: 8px; height: 8px; border-radius: 2px; }
.share-leg .ic { width: 16px; height: 16px; }
.share-leg b { font-family: var(--mono); font-size: 11px; }
.share-leg small { color: var(--muted); }

/* Brand-Kopf mit Icon */
.brand-head { align-items: center; justify-content: flex-start; }
.brand-head .brand-name { flex: 1; }

.brand-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--invert-bg);
  color: var(--invert-text);
}

.brand.locked .brand-icon { background: var(--soft); color: var(--faint); }

/* Luxus-Sammlung */
.lux-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lux-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 12px 6px 10px;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .08s ease, background .2s, color .2s;
}

.lux-tile:active:not(:disabled) { transform: scale(.96); }

.lux-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px dashed var(--line);
}

.lux-icon .ic { width: 24px; height: 24px; }

.lux-tile b {
  display: -webkit-box;
  min-height: 2.4em;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.lux-tile small {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

/* kaufbar: durchgezogener Rahmen */
.lux-tile:not(:disabled):not(.own) .lux-icon { border-style: solid; border-color: var(--text); }
.lux-tile:not(:disabled):not(.own) small { color: var(--text); }

/* noch zu teuer */
.lux-tile:disabled:not(.own) { cursor: default; }
.lux-tile:disabled:not(.own) .lux-icon,
.lux-tile:disabled:not(.own) b { opacity: .45; }

/* gekauft: gefüllt */
.lux-tile.own { background: var(--invert-bg); color: var(--invert-text); border-color: var(--invert-bg); }
.lux-tile.own .lux-icon { border: 1.5px solid currentColor; }
.lux-tile.own small { color: inherit; opacity: .7; }
.lux-tile.pop { animation: luxPop .4s ease; }

@keyframes luxPop { 50% { transform: scale(1.08); } }

/* Profil: Kacheln statt Tabelle */
.stat-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--soft);
}

.stat-tile .ic { width: 18px; height: 18px; margin-bottom: 6px; color: var(--muted); }

.stat-tile b {
  overflow: hidden;
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stat-tile small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-tile.wide { grid-column: 1 / -1; background: var(--invert-bg); color: var(--invert-text); }
.stat-tile.wide .ic,
.stat-tile.wide small { color: inherit; opacity: .65; }
.stat-tile.wide b { font-family: inherit; font-size: 22px; letter-spacing: -0.01em; }

/* Bonus-Aufbau */
.bonus-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.bonus-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.bonus-head span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.bonus-head b { font-size: 22px; font-weight: 800; }

.bonus-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.bonus-row .ic { width: 18px; height: 18px; }

.bonus-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}

.bonus-label small {
  overflow: hidden;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bonus-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--soft);
  overflow: hidden;
}

.bonus-bar i { display: block; height: 100%; border-radius: 3px; background: var(--text); }
.bonus-row b { min-width: 44px; font-size: 13px; text-align: right; }

/* Wettkampf: Fortschritt bis zum nächsten Pokal */
.prestige-next { margin: -4px 0 12px; }
.prestige-next .bar { height: 6px; border-radius: 3px; }
.prestige-next small {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.league-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin: -2px 0 6px;
}

.league-head b { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.league-head span { font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ---------- Combo & Krits ---------- */

.combo {
  position: absolute;
  top: 1%;
  right: -3%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 46px;
  padding: 6px 8px 5px;
  border-radius: 12px;
  background: var(--invert-bg);
  color: var(--invert-text);
  line-height: 1;
  pointer-events: none;
  transition: opacity .35s, transform .35s;
}

.combo b { font-size: 19px; font-weight: 800; }
.combo small { margin-top: 3px; font-size: 8px; font-weight: 700; letter-spacing: .16em; opacity: .7; }
.combo.off { opacity: 0; transform: scale(.7); }
.combo.max { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--invert-bg); }
.combo.pop { animation: combo-pop .4s ease; }

@keyframes combo-pop {
  40% { transform: scale(1.4) rotate(-6deg); }
}

.float.crit {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  animation-duration: 1.1s;
}

.float.crit small {
  display: block;
  font-size: 11px;
  letter-spacing: .24em;
}

/* ---------- Belohnungskisten ---------- */

.chest-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 420px;
  margin: 8px 0 0;
  padding: 7px 16px;
  font-weight: 700;
  font-size: 13px;
  color: var(--invert-text);
  background: var(--invert-bg);
  border: 0;
  border-radius: 999px;
  animation: chest-nudge 2.4s ease-in-out infinite;
}

.chest-pill .ic { width: 20px; height: 20px; }

@keyframes chest-nudge {
  0%, 80%, 100% { transform: none; }
  85% { transform: rotate(-2deg) scale(1.02); }
  90% { transform: rotate(2deg) scale(1.02); }
  95% { transform: rotate(-1deg); }
}

.chest-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 0 4px;
}

.chest-box {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 2px solid var(--text);
  background: var(--surface);
  color: var(--text);
  animation: chest-wobble 1.4s ease-in-out infinite;
}

.chest-box .ic { width: 52px; height: 52px; stroke-width: 1.5; }
.chest-box.rare { background: linear-gradient(to top, var(--soft) 50%, var(--surface) 50%); border-width: 3px; }
.chest-box.epic {
  background: var(--invert-bg);
  color: var(--invert-text);
  border-color: var(--invert-bg);
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--invert-bg);
}

.chest-box.opened { animation: chest-burst .5s ease-out forwards; }

@keyframes chest-wobble {
  0%, 60%, 100% { transform: rotate(0); }
  70% { transform: rotate(-7deg); }
  80% { transform: rotate(7deg); }
  90% { transform: rotate(-4deg); }
}

@keyframes chest-burst {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); box-shadow: 0 0 0 14px color-mix(in srgb, var(--text) 12%, transparent); }
  100% { transform: scale(.9); opacity: .55; }
}

.chest-rarity {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.chest-rewards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-height: 20px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.chest-rewards li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--soft);
  font-weight: 700;
  animation: chest-reward .35s ease-out;
}

.chest-rewards li.special { background: var(--invert-bg); color: var(--invert-text); }
.chest-rewards .ic { width: 20px; height: 20px; }

@keyframes chest-reward {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
}

/* ---------- Wochen-Challenge ---------- */

.weekly-card {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--invert-bg);
  color: var(--invert-text);
}

.weekly-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.weekly-head .num { letter-spacing: 0; opacity: .7; text-transform: none; }

.weekly-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid color-mix(in srgb, var(--invert-text) 15%, transparent);
  font-size: 14px;
}

.weekly-row b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.weekly-row.me b { font-weight: 800; }
.weekly-row.me b::after { content: " ●"; font-size: 9px; vertical-align: 2px; }
.weekly-row .num:last-child { font-weight: 700; }

.weekly-prizes {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  opacity: .75;
}
.bonus-note { font-size: 11px; color: var(--muted); }
.bonus-row.title { margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* Training als Hauptbildschirm in der Mitte der Leiste */
.tabs button[data-tab="train"] svg {
  box-sizing: border-box;
  width: 42px;
  height: 42px;
  margin-top: -12px;
  padding: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: background .15s, color .15s;
}

.tabs button[data-tab="train"].on svg {
  color: var(--invert-text);
  background: var(--invert-bg);
  border-color: var(--invert-bg);
}

.tabs button[data-tab="train"].on::before { display: none; }

.meet-level { color: var(--muted); }

/* ---------- Dev-Modus ---------- */


.dev-badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  color: #fff;
  background: var(--danger);
}

.dev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.dev-grid .btn-secondary { min-height: 44px; font-size: 13px; }
.dev-grid .btn-secondary.on { background: var(--invert-bg); color: var(--invert-text); }

#devCodeInput {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

#devCodeInput.wrong { border-color: var(--danger); }

/* ---------- Kopfzeile: Name links, Cloud-Status und Zahnrad rechts ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  margin-bottom: 6px;
}

.topbar .app-name {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
  color: var(--muted);
}

.topbar-space { flex: 1; }
.topbar .gear { width: 32px; height: 32px; }

.cloud-status {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--muted);
}

.cloud-status svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cloud-status .cloud-mark { opacity: 0; }
.cloud-status.ok { color: var(--text); }
.cloud-status.ok .cloud-mark { opacity: 1; }
.cloud-status.busy svg { animation: cloud-pulse 1s ease-in-out infinite; }
.cloud-status.error { color: var(--danger); }

@keyframes cloud-pulse { 50% { opacity: .35; } }

/* Kraft und Geld haben jetzt die volle Breite */
.hud { gap: 16px; }

/* ---------- Account ---------- */

.acc-form { display: flex; flex-direction: column; gap: 2px; }
.acc-form .acc-intro { margin: 0 0 10px; font-size: 13px; line-height: 1.45; }

.acc-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.acc-form input { width: 100%; margin-bottom: 10px; font-size: 16px; }

.acc-error {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
}

.acc-hidden-submit { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.acc-link {
  align-self: flex-start;
  padding: 2px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
}

.acc-code { text-align: center; }
.acc-code p { margin: 0 0 12px; font-size: 13px; line-height: 1.45; }

.acc-code code {
  display: block;
  margin: 0 0 12px;
  padding: 14px 10px;
  border-radius: 12px;
  background: var(--invert-bg);
  color: var(--invert-text);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .08em;
  user-select: all;
}

.acc-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 4px;
}

.acc-side {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
}

.acc-side small:first-child {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.acc-side b { font-size: 16px; }
.acc-side small:last-child { color: var(--muted); }

#accountGroup .danger-link { display: block; margin: 8px auto 0; }

/* ×2-Upgrade freigeschaltet, aber noch nicht gekauft */
.item-progress.ready .item-bar { display: none; }
.item-progress.ready span { color: var(--text); white-space: normal; line-height: 1.35; }

/* ---------- Wischen zwischen Tabs ---------- */

.tab { touch-action: pan-y; }
.tab.active.slide-right { animation: slide-from-right .22s ease-out; }
.tab.active.slide-left { animation: slide-from-left .22s ease-out; }

@keyframes slide-from-right { from { transform: translateX(28%); opacity: .4; } }
@keyframes slide-from-left { from { transform: translateX(-28%); opacity: .4; } }

/* Ereignis und Kisten nebeneinander, damit der Trainings-Bildschirm nicht überläuft */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 8px;
  max-width: 420px;
}

/* Kompakt-Modus, wenn selbst der kleinste Kreis nicht reicht */
#tab-train.tight .rank-card-nums,
#tab-train.tight .tap-info { display: none; }
#tab-train.tight .rank-card-names { margin-bottom: 4px; }
