/* Cockpit. Dunkel, weil es abends neben dem (dunklen) Spiel läuft.
   Zurückhaltend: getönte Neutraltöne, ein Akzent für Auswahl und Hauptaktion.
   Rangfarben R1–R5 sind die einzige weitere Farbsprache. */
:root {
  color-scheme: dark;
  --bg: oklch(0.175 0.012 280);
  --rail: oklch(0.155 0.012 280);
  --panel: oklch(0.205 0.013 280);
  --raise: oklch(0.235 0.015 280);
  --sink: oklch(0.15 0.01 280);
  --line: oklch(0.29 0.016 280);
  --line-soft: oklch(0.25 0.014 280);
  --hover: oklch(0.26 0.018 280);
  --text: oklch(0.95 0.006 280);
  --muted: oklch(0.75 0.015 280);
  --faint: oklch(0.62 0.015 280);
  --accent: oklch(0.66 0.24 302);
  --accent-ink: oklch(0.16 0.04 302);
  --accent-soft: oklch(0.66 0.24 302 / 0.16);
  --ok: oklch(0.78 0.15 152);
  --ok-soft: oklch(0.78 0.15 152 / 0.16);
  --danger: oklch(0.7 0.17 25);
  --danger-soft: oklch(0.7 0.17 25 / 0.16);
  --warn: oklch(0.84 0.14 90);
  --r5: oklch(0.86 0.15 92);
  --r4: oklch(0.74 0.16 312);
  --r3: oklch(0.76 0.12 245);
  --r2: oklch(0.8 0.15 152);
  --r1: oklch(0.73 0.16 32);
  --ink: oklch(0.2 0.02 280);
  /* SvS-Rollen im Schlachtplan */
  --role-hunt: oklch(0.72 0.19 25);
  --role-capitol: oklch(0.86 0.15 92);
  --role-prewave: oklch(0.8 0.15 60);
  --role-turret: oklch(0.76 0.12 245);
  --role-strike: oklch(0.8 0.12 190);
  --role-attack: oklch(0.8 0.15 152);
  --role-backup: oklch(0.75 0.015 280);
  --radius: 8px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --shadow-1: 0 1px 2px oklch(0 0 0 / 0.25), 0 2px 8px oklch(0 0 0 / 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---- Shell ---- */
#shell { display: flex; min-height: 100vh; }

#rail {
  width: 220px;
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px 12px;
  background: var(--rail);
  border-right: 1px solid var(--line-soft);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; padding: 0 8px; }
.mark { width: 32px; height: 32px; flex: none; display: block; }
.mark img { width: 100%; height: 100%; display: block; object-fit: contain; }
.wordmark { height: 34px; width: auto; max-width: 100%; display: block; }

#nav { display: flex; flex-direction: column; gap: 2px; }
.rail-note { margin: auto 8px 0; color: var(--faint); font-size: 11px; line-height: 1.4; }
#nav button {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  text-align: left;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
#nav button svg { width: 17px; height: 17px; flex: none; }
#nav button:hover { color: var(--text); background: var(--hover); }
#nav button.active { color: var(--text); background: var(--accent-soft); }
#nav button.active svg { color: var(--accent); }

#content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 56px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-soft);
}

.search {
  flex: 1;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sink);
  color: var(--faint);
}
.search { transition: border-color 150ms var(--ease); }
.search:focus-within { border-color: var(--accent); }
.search svg { width: 16px; height: 16px; flex: none; order: -1; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; padding: 0; }
.search input:focus { outline: none; }
.search input::placeholder { color: var(--faint); }

.account { display: flex; align-items: center; gap: 10px; }
.account b, .account small { display: block; line-height: 1.25; }
.account small { color: var(--faint); font-size: 12px; }

main { min-width: 0; padding: 24px 28px 48px; }

/* ---- Grundbausteine ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 0;
}
.panel h2, h2 { font-size: 14px; font-weight: 650; margin: 0 0 12px; letter-spacing: 0.005em; }

.stack { display: grid; gap: 12px; align-content: start; min-width: 0; }
.row { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(280px, 1.3fr); gap: 16px; }
.grid { display: grid; gap: 16px; }
.spacer { flex: 1; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.empty { color: var(--muted); padding: 32px 0; text-align: center; }
.back { cursor: pointer; color: var(--muted); margin-bottom: 14px; display: inline-block; }
.back:hover { color: var(--text); }

/* Kennzahlen als Leiste, nicht als Kartenraster */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.cards > .panel { border: 0; border-radius: 0; background: transparent; padding: 14px 18px; }
.cards > .panel + .panel { border-left: 1px solid var(--line-soft); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .lbl { color: var(--faint); font-size: 12px; }
.stat .big { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* ---- Buttons & Felder ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raise);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.btn:hover { background: var(--hover); border-color: oklch(0.36 0.02 280); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.primary:hover { background: oklch(0.71 0.22 302); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.icon { width: 32px; padding: 0; font-size: 16px; }
.btn.sel { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
select.btn { padding-right: 8px; }
input.btn { cursor: text; }

.seg { display: inline-flex; }
.seg > * { border-radius: 0; margin-left: -1px; }
.seg > :first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg > :last-child { border-radius: 0 6px 6px 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar h2 { margin: 0; flex: 1; }

.entry { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; margin-bottom: 14px; }
.entry label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.entry input, .entry select, textarea.notes, .find {
  width: 100%;
  height: 34px;
  background: var(--sink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}
.entry input:focus, .entry select:focus, textarea.notes:focus, .find:focus { outline: none; border-color: var(--accent); }
.entry input::placeholder, textarea::placeholder, .find::placeholder { color: var(--faint); opacity: 1; }
.entry .span2 { grid-column: span 2; }
.entry-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.entry-error, .msg[data-tone="err"] { color: var(--danger); margin: 0; grid-column: 1 / -1; }
.msg { margin: 0; grid-column: 1 / -1; min-height: 1.5em; color: var(--muted); }
.msg[data-tone="ok"] { color: var(--ok); }

textarea.notes { height: auto; min-height: 110px; padding: 10px; resize: vertical; line-height: 1.5; max-width: 75ch; display: block; }

.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; cursor: pointer; }
.check input { accent-color: var(--accent); margin: 0; }

.pill { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.sub { border-style: dashed; }
.pill.miss { color: var(--danger); border-color: var(--danger); }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.best { color: var(--ok); background: var(--ok-soft); border-color: transparent; }

/* ---- Tabellen ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--faint); font-weight: 550; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover, .sheet tbody tr:hover { background: var(--hover); }
.rank { color: var(--faint); width: 36px; font-variant-numeric: tabular-nums; }
th.sortable { cursor: pointer; user-select: none; transition: color 150ms var(--ease); }
th.sortable:hover { color: var(--text); }
th.sortable.on { color: var(--accent); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }

/* ---- Avatare, Badges ---- */
.ava {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-weight: 700; font-size: 11px; color: var(--ink); background: var(--accent);
}
.who { display: flex; align-items: center; gap: 10px; }
.rank-badge { width: 18px; height: auto; vertical-align: middle; flex: none; }
#nav button img { width: 20px; height: 20px; object-fit: contain; flex: none; filter: saturate(0.5); opacity: 0.75; transition: opacity 150ms var(--ease), filter 150ms var(--ease); }
#nav button:hover img, #nav button.active img { filter: none; opacity: 1; }
.note-dot { color: var(--faint); font-size: 12px; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; color: var(--ink); white-space: nowrap; }
.b-R5 { background: var(--r5); }
.b-R4 { background: var(--r4); }
.b-R3 { background: var(--r3); }
.b-R2 { background: var(--r2); }
.b-R1 { background: var(--r1); }

/* ---- Overview ---- */
.donut { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 0; }
.donut .hole { width: 106px; height: 106px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; text-align: center; }
.donut .hole b { font-size: 18px; }
.donut .hole span { font-size: 11px; color: var(--faint); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }


/* Alliance-Log im Terminal-Look: Monospace, dunkler Kasten, feste Spalten. */
.termlog { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--sink); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; max-height: 340px; overflow: auto; font-size: 12px; line-height: 1.65; }
.termlog .tl { display: grid; grid-template-columns: 92px 76px 1fr; gap: 12px; padding: 1px 0; }
.termlog .t { color: var(--faint); white-space: nowrap; }
.termlog .c { color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.termlog .d { color: var(--text); word-break: break-word; }

/* Activity window tabs */
.wtabs { display: inline-flex; gap: 4px; background: var(--sink); border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px; }
.wtab { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 4px 14px; border-radius: 999px; cursor: pointer; transition: background-color 180ms var(--ease), color 180ms var(--ease); }
.wtab:hover { color: var(--text); }
.wtab.on { background: var(--accent); color: var(--sink); }

/* Problemfälle auf der Activity-Seite */
.flag { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--danger-soft); color: var(--danger); white-space: nowrap; }
tbody tr.flagged { background: oklch(0.7 0.17 25 / 0.07); }
td.num b.under { color: var(--danger); }
tbody tr.flagged:hover { background: oklch(0.7 0.17 25 / 0.12); }

/* Event terms */
.eterms { display: grid; gap: 10px; margin-top: 12px; }
.eterm { border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; }
.eterm .ehead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.eterm .ehead .t { font-weight: 700; }
.echips { display: flex; flex-wrap: wrap; gap: 6px; }
.echip { background: var(--sink); border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px 10px; font-size: 12px; white-space: nowrap; }

svg.spark { width: 100%; height: 120px; }
.meter { height: 6px; border-radius: 999px; background: var(--sink); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; background: var(--accent); transition: width 500ms var(--ease); }

/* ====================================================================
   UI-Upgrade: Skeletons, Reveal-Motion, Tiefe, sticky Header.
   Produkt-Register: Motion nur für State, 150–250 ms, reduced-motion safe.
   ==================================================================== */

/* Lade-Skelett mit dezentem Shimmer statt Spinner/Text. */
.skel { position: relative; overflow: hidden; background: var(--line-soft); border-radius: 6px; }
.skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, oklch(1 0 0 / 0.045), transparent);
  animation: skel-shimmer 1.25s var(--ease) infinite;
}
@keyframes skel-shimmer { to { transform: translateX(100%); } }
.sk { pointer-events: none; }
.sk-hero { height: 112px; border-radius: var(--radius); }
.sk-panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-1); }
.sk-h2 { height: 14px; width: 160px; margin-bottom: 18px; }
.sk-row { height: 13px; margin: 14px 0; }
.sk-row:nth-child(2) { width: 92%; } .sk-row:nth-child(4) { width: 84%; }
.sk-row:nth-child(5) { width: 88%; } .sk-row:nth-child(7) { width: 80%; }

/* Reveal: ein ruhiger Fade beim Ansichtswechsel (State-Wechsel, keine Page-Load-Choreo). */
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#app.view-in { animation: view-in 240ms var(--ease) both; }

/* Tiefe: Panels bekommen eine weiche Schattenkante statt nur Rahmen. */
.panel, .cards, .hero { box-shadow: var(--shadow-1); }

/* Sticky Tabellen-Header in scrollenden Bereichen (dichte Activity-/Event-Tabellen). */
.scroll { position: relative; }
.scroll thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel);
  box-shadow: inset 0 -1px 0 var(--line-soft);
  border-bottom: 0;
}
.sheet-panel .scroll thead th { background: var(--panel); }

/* Zeilen-Hover ruhiger und mit sanftem Übergang. */
tbody tr { transition: background-color 140ms var(--ease); }
.echip { transition: border-color 140ms var(--ease), background-color 140ms var(--ease); }
.eterm { transition: border-color 140ms var(--ease); }
.eterm:hover { border-color: var(--line); }

/* Nav-Auswahl: weicher Übergang des aktiven Zustands (Icon + Hintergrund schon vorhanden). */
#nav button.active { font-weight: 600; }

/* Hero-Feinschliff: dezenter oberer Lichtsaum, etwas reichere Tönung, Kennzahlen mit feinem Rhythmus. */
.hero {
  box-shadow: var(--shadow-1);
  background: radial-gradient(ellipse 60% 120% at 0% 0%, oklch(0.66 0.24 302 / 0.13), transparent 70%), var(--panel);
  flex-wrap: wrap;
}
.hero-cp { display: flex; align-items: center; gap: 18px; padding-left: 24px; border-left: 1px solid var(--line-soft); }
.hero-cp .donut { width: 116px; height: 116px; margin: 0; }
.hero-cp .hole { width: 84px; height: 84px; }
.hero-cp .hole b { font-size: 15px; }
.hero-cp .hole span { font-size: 10px; }
.hero-cp .legend { flex-direction: column; align-items: flex-start; gap: 3px; margin: 0; }
.hero-cp .legend b { color: var(--text); font-weight: 650; margin-left: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .hero-cp { padding-left: 0; border-left: 0; } }
.crest { transition: transform 200ms var(--ease), box-shadow 200ms var(--ease); }
.hero:hover .crest { transform: translateY(-1px); box-shadow: 0 10px 26px oklch(0.66 0.24 302 / 0.42), inset 0 1px 0 oklch(1 0 0 / 0.3); }

/* ---- Wochenblatt ---- */
.sheet-panel { padding: 14px 0 6px; }
.sheet-panel > .toolbar { padding: 0 18px; margin-bottom: 8px; }
.scroll { overflow-x: auto; }
.sheet th, .sheet td { padding: 4px 8px; }
.sheet th:first-child, .sheet td:first-child { padding-left: 18px; }
.sheet th:last-child, .sheet td:last-child { padding-right: 18px; }
.sheet th small { display: block; font-weight: 400; color: var(--faint); font-size: 11px; }
.sheet .day { width: 96px; }
.sheet .day.today { background: var(--accent-soft); }
.sheet th.day.today { color: var(--accent); }
.sheet .total { font-weight: 700; padding-right: 14px; }
.sheet td.low { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.sheet td.ok { color: var(--ok); font-weight: 600; }
.sheet td.mark { white-space: nowrap; min-width: 108px; }
.sheet th.ev { text-align: center; border-left: 1px solid var(--line-soft); }
.sheet td.ev { text-align: center; width: 40px; padding: 4px 2px; }
.sheet td.ev:nth-last-child(2n) { border-left: 1px solid var(--line-soft); }
.cell {
  width: 100%;
  height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cell:hover { border-color: var(--line); }
.cell:focus { outline: none; border-color: var(--accent); background: var(--sink); }
.cell.bad { border-color: var(--danger); }
.att {
  width: 28px; height: 26px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  font-weight: 700;
}
.att:hover { border-color: var(--line); color: var(--text); }
.att[data-state="true"] { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.att[data-state="false"] { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.bars { display: flex; gap: 6px; align-items: flex-end; height: 140px; }
.bar { flex: 1; max-width: 56px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar i { display: block; width: 70%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--line); }
.bar.on i { background: var(--accent); }
.bar span { font-size: 10px; color: var(--faint); }

/* ---- Builder (Hive / BGB) ---- */
.builder { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.builder > * { min-width: 0; }
.builder.plan { grid-template-columns: 300px minmax(0, 1fr); }
.panel.side { position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.panel.side h2 { margin-bottom: 8px; }

.tools { display: grid; gap: 6px; }
.palette { display: flex; flex-direction: column; gap: 2px; overflow: auto; min-height: 0; margin: 0 -6px; padding: 0 6px; }
.panel.side .palette { flex: 1; min-height: 180px; }
.builder.plan .palette { max-height: 70vh; }

.ptile {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.ptile:hover { background: var(--hover); }
.ptile[draggable="true"] { cursor: grab; }
.ptile.tool { border-color: var(--line); background: var(--raise); }
.ptile.sel { border-color: var(--accent); background: var(--accent-soft); }
.ptile:disabled { opacity: 0.45; cursor: not-allowed; }
.ptile .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptile .faint { font-size: 12px; font-variant-numeric: tabular-nums; }
.ptile .placed { display: none; color: var(--ok); font-size: 12px; }
.ptile.is-placed .pname { color: var(--faint); }
.ptile.is-placed .placed { display: inline; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.group-label { font-size: 11px; color: var(--faint); padding: 10px 8px 4px; letter-spacing: 0.02em; }

.findbar { display: grid; gap: 8px; padding-bottom: 8px; }
.find { height: 32px; }
.find-empty { font-size: 12px; padding: 6px 8px; }
.side-note { font-size: 12px; margin: 0 0 10px; }
.stack-page { display: flex; flex-direction: column; gap: 22px; }
.stack-page .panel h2 { margin-bottom: 8px; }
.stack-page .cards { margin-bottom: 0; }

/* ---- Hero (Alliance, Member) ---- */
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  gap: 20px;
  align-items: center;
  background: var(--panel);
}
.crest {
  width: 76px; height: 76px; flex: none;
  border-radius: 16px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px; letter-spacing: -0.02em;
  align-content: center; line-height: 1.1; text-align: center;
  color: #fff;
  text-shadow: 0 1px 2px oklch(0 0 0 / 0.35);
  background: linear-gradient(145deg, oklch(0.64 0.26 304), oklch(0.42 0.22 296));
  box-shadow: 0 8px 22px oklch(0.55 0.26 302 / 0.32), inset 0 1px 0 oklch(1 0 0 / 0.22);
}
.hero-main { flex: 1; min-width: 0; }
.hero h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.hero h1 .tag { color: var(--accent); font-weight: 700; margin-left: 4px; }
.hero-sub { color: var(--muted); font-size: 13px; margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.hero-metrics { display: flex; flex-wrap: wrap; gap: 14px 0; margin-top: 18px; }
.hero-metrics .m { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 2px 24px; border-left: 1px solid var(--line-soft); }
.hero-metrics .m:first-child { padding-left: 0; border-left: 0; }
.hero-metrics .m .lbl { color: var(--faint); font-size: 11px; }
.hero-metrics .m .v { font-size: 21px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }

.progress { height: 6px; border-radius: 999px; background: oklch(0 0 0 / 0.3); overflow: hidden; margin-top: 7px; min-width: 130px; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), oklch(0.82 0.15 305)); }

/* ---- Abschnittsgruppen mit Icon-Kopf ---- */
.group { display: flex; flex-direction: column; gap: 14px; }
.group-head { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.group-head svg { width: 16px; height: 16px; flex: none; color: var(--accent); }
.group-head::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; align-items: stretch; }
.group-grid > .full { grid-column: 1 / -1; }
.group-grid.ranks { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1280px) { .group-grid.ranks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .group-grid.ranks { grid-template-columns: minmax(0, 1fr); } }

/* Kompakte Kennzahlen inline statt als breites Panel mit Leerraum */
.statline { display: flex; flex-wrap: wrap; gap: 8px; }
.statline > span { font-size: 12px; color: var(--muted); background: var(--sink); border: 1px solid var(--line-soft); border-radius: 6px; padding: 5px 10px; white-space: nowrap; }
.statline > span b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; margin-left: 5px; }

/* Ergebnis-Pills (Win/Loss) */
.res { font-size: 11px; font-weight: 700; padding: 1px 9px; border-radius: 999px; }
.res.win { color: var(--ok); background: var(--ok-soft); }
.res.loss { color: var(--danger); background: var(--danger-soft); }

/* VS-Wochenverlauf: gestapelte Us/Them-Balken pro Tag */
.vsrow { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.vsrow:last-child { border-bottom: 0; }
.vsrow .vday { font-size: 12px; color: var(--faint); }
.vsrow .vbars { display: grid; gap: 4px; min-width: 0; }
.vsrow .vbar { display: flex; align-items: center; gap: 8px; font-size: 11px; font-variant-numeric: tabular-nums; }
.vsrow .vbar .track { flex: 1; height: 9px; border-radius: 999px; background: var(--sink); overflow: hidden; }
.vsrow .vbar .track > i { display: block; height: 100%; border-radius: 999px; }
.vsrow .vbar.us .track > i { background: var(--accent); }
.vsrow .vbar.them .track > i { background: oklch(0.5 0.02 280); }
.vsrow .vbar .amt { width: 68px; text-align: right; color: var(--muted); }
.vsrow .vend { text-align: right; min-width: 0; }
.vsrow .vmvp { font-size: 11px; color: var(--faint); margin-top: 2px; }

/* Rang-Zeile mit Balken (unsere Position hervorgehoben) */
.rankbars { display: grid; gap: 6px; }
.rankrow { display: grid; grid-template-columns: 26px 1fr 72px; gap: 10px; align-items: center; font-size: 12px; }
.rankrow .rr-pos { color: var(--faint); font-variant-numeric: tabular-nums; }
.rankrow .rr-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rankrow .rr-bar { grid-column: 2 / -1; height: 7px; border-radius: 999px; background: var(--sink); overflow: hidden; margin-top: -2px; }
.rankrow .rr-bar > i { display: block; height: 100%; border-radius: 999px; background: oklch(0.5 0.02 280); }
.rankrow.me .rr-name { color: var(--accent); font-weight: 700; }
.rankrow.me .rr-bar > i { background: var(--accent); }
.rankrow .rr-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- Member-Detail ---- */
.member-hero .ava { width: 60px; height: 60px; font-size: 20px; box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--ring, var(--accent)); }
.member-hero .status { display: inline-flex; align-items: center; gap: 6px; }
.member-hero .status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.member-hero .status.on .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.member-hero .status.off .dot { background: var(--faint); }
.spark-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.spark-head h2 { margin: 0; }
.spark-head .now { font-size: 18px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.delta { font-size: 12px; font-weight: 700; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--faint); }
.substat { display: grid; grid-template-columns: repeat(auto-fit, minmax(86px, 1fr)); gap: 0; }
.substat > div { padding: 2px 14px 2px 0; }
.substat .lbl { color: var(--faint); font-size: 11px; }
.substat .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.hint {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 13px;
}
.hint.on { border-color: var(--accent); background: var(--accent-soft); }

.boardwrap {
  overflow: auto;
  max-height: calc(100vh - 230px);
  min-height: 320px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--sink);
  padding: 12px;
}
.board2 {
  position: relative;
  background-color: var(--sink);
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  border: 1px solid var(--line-soft);
}
.board2.armed { cursor: copy; }
/* Karte mit Spielboden (BGB: Sand, Hive: Gras); --ground und die Grundfarbe setzt die View. */
.board2.terrain {
  background-image: linear-gradient(oklch(0.3 0.05 60 / 0.14) 1px, transparent 1px), linear-gradient(90deg, oklch(0.3 0.05 60 / 0.14) 1px, transparent 1px), var(--ground);
}
.board2.terrain .tile.pic { box-shadow: none; overflow: visible; isolation: isolate; }
.board2.terrain .tile.pic::before { content: ''; position: absolute; inset: -32% -32% -12%; background: var(--img) center/contain no-repeat; filter: drop-shadow(0 2px 3px oklch(0 0 0 / 0.35)); z-index: -1; pointer-events: none; }
/* Capital-Gebiet auf dem Gras: eigener Boden, Rasterlinien wie aussen, goldener Rand. */
.board2.terrain .tile.zone {
  border-radius: 0; z-index: 0; cursor: default;
  background-color: #8d7766;
  background-image: linear-gradient(oklch(0.3 0.05 60 / 0.14) 1px, transparent 1px), linear-gradient(90deg, oklch(0.3 0.05 60 / 0.14) 1px, transparent 1px), url(capital/ground.jpg);
  background-size: var(--cell) var(--cell), var(--cell) var(--cell), 384px 384px;
  box-shadow: 0 0 0 2px oklch(0.85 0.12 85 / 0.8);
}
.board2.terrain .tile.pic:hover { box-shadow: inset 0 0 0 2px oklch(1 0 0 / 0.6); }
.board2.terrain .tile.pic .cap { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 140px; padding: 1px 0 0; background: none; }
.board2.terrain .tile.pic .tname { overflow: visible; }
/* Gebäude, an das direkt andere grenzen (Frank im Hive): bleibt in seinen Feldern. */
.board2.terrain .tile.pic.fit::before { inset: 0 0 14%; }
.board2.terrain .tile.pic.fit .cap { top: auto; bottom: 0; }
.boxes { position: absolute; inset: 0; pointer-events: none; }
.arrows { position: absolute; inset: 0; pointer-events: none; overflow: visible; }

.tile {
  position: absolute;
  pointer-events: auto;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  padding: 2px;
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
  color: var(--ink);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.25);
  transition: box-shadow 150ms var(--ease);
}
.tile[draggable="true"] { cursor: grab; }
.tile:hover { box-shadow: inset 0 0 0 2px oklch(1 0 0 / 0.5); }
.tile.selected { z-index: 2; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.tile.empty { color: oklch(0.9 0.01 280); }
.tile .tname { font-weight: 750; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .trow { display: flex; gap: 4px; align-items: center; font-size: 10px; font-weight: 650; opacity: 0.85; }
.tile .tpos { font-size: 9px; font-weight: 700; opacity: 0.85; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .faintink { opacity: 0.7; font-weight: 600; }
.tile.landmark { color: oklch(0.98 0.005 280); font-weight: 800; text-shadow: 0 1px 2px oklch(0 0 0 / 0.5); }
.tile.small { font-size: 9px; }
.tile.team { justify-content: flex-start; align-items: stretch; padding: 3px 4px; gap: 1px; text-align: left; overflow: visible; z-index: 1; }
.tile.team:hover, .tile.team.selected { z-index: 4; }
.tile.team .tname { font-size: 10.5px; font-weight: 800; line-height: 1.15; }
.tile.team .tcount { font-weight: 700; opacity: 0.6; font-size: 9.5px; }
.tile.team .ttext { font-size: 9px; font-weight: 600; line-height: 1.2; opacity: 0.9; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hint .pre { white-space: pre-wrap; color: var(--muted); }
.tile.team .tmembers { display: flex; flex-direction: column; font-size: 9.5px; font-weight: 800; line-height: 1.24; overflow: hidden; margin-top: 1px; }
.tile.team .tmembers span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.pic { justify-content: flex-end; padding: 0; text-shadow: 0 1px 2px oklch(0 0 0 / 0.8); }
.tile.pic .cap { width: 100%; padding: 10px 3px 3px; background: linear-gradient(transparent, oklch(0 0 0 / 0.7)); }
.tile.pic .tpos { opacity: 1; }
.tile.here { z-index: 2; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.ghost {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  border-radius: 5px;
  outline: 2px dashed var(--accent);
  background: var(--accent-soft);
}
.ghost.bad { outline-color: var(--danger); background: var(--danger-soft); }
.ghost .glabel {
  position: absolute; left: 3px; top: 3px;
  font-size: 10px; font-weight: 700; white-space: nowrap;
  color: var(--text); background: oklch(0.15 0.01 280 / 0.9); padding: 1px 4px; border-radius: 3px;
}
.spot { color: var(--text); font-weight: 650; }

.trash { border: 1px dashed var(--line); border-radius: 6px; height: 32px; padding: 0 12px; display: inline-flex; align-items: center; color: var(--faint); font-size: 12px; }
.trash.over { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* BGB-Teams */
/* Viele Teams dürfen die Seitenleiste nicht sprengen: eigener Scrollbereich. */
/* flex: none, sonst drückt eine lange Mitgliederliste die Teams in der Seitenleiste auf null. */
.teamlist { flex: none; display: grid; gap: 8px; margin-bottom: 8px; max-height: 42vh; overflow: auto; margin-left: -6px; margin-right: -6px; padding: 2px 6px; }
.add-team { margin-bottom: 10px; }
.squad { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--raise); cursor: pointer; }
.squad.sel { border-color: var(--accent); }
.squad .head { display: flex; align-items: center; gap: 8px; }
.squad .dot { width: 14px; height: 14px; border-radius: 4px; flex: none; cursor: grab; }
.squad .name { flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1px solid transparent; font-weight: 700; padding: 2px 0; }
.squad .name:focus { border-bottom-color: var(--accent); outline: none; }
.squad textarea { width: 100%; min-height: 4.2em; resize: vertical; background: var(--sink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px; line-height: 1.4; }
.squad textarea:focus { outline: none; border-color: var(--accent); }
.squad .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: 11px; background: var(--sink); border-radius: 4px; padding: 2px 2px 2px 7px; }
.chip button { border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 0 4px; }
.chip button:hover { color: var(--danger); }
.squad .meta { font-size: 11px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.squad .meta .faint { flex: 1 0 100%; }
.target {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; padding: 6px 8px;
  font-size: 12px; border: 1px dashed var(--line); border-radius: 6px;
}
.target.on { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.chip .sw { margin-right: 2px; }
.hint .chip { font-size: 12px; background: var(--raise); }
.mini { border: 0; background: transparent; color: var(--faint); font-size: 11px; cursor: pointer; padding: 0; text-align: left; }
.mini:hover { color: var(--text); }
.profile-btn { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.profile-btn:hover { color: var(--text); background: var(--hover); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  #app.view-in { animation: none !important; }
}

/* ---- Lokaler Spiel-Client (local/public/views/darkwar.js) ---- */
/* DarkWar-Client */
.dw { display: grid; gap: 18px; }
.dw-login { flex: 2; }
.dw-steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: grid; gap: 18px; }
.dw-steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; row-gap: 6px; }
.dw-steps li::before {
  content: counter(s); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  border: 1px solid var(--line); color: var(--muted);
}
.dw-steps li.active::before { background: var(--accent2); border-color: var(--accent2); color: var(--ink); }
.dw-steps label { font-size: 13px; color: var(--muted); }
.dw-field { display: flex; gap: 8px; flex-wrap: wrap; }
.dw-field .btn { min-width: 140px; }
.dw-field input {
  flex: 1; min-width: 180px; background: var(--sink); border: 1px solid var(--line);
  color: var(--text); padding: 9px 12px; border-radius: 10px; font: inherit;
}
.dw-field input:focus-visible, .dw .btn:focus-visible { outline: 2px solid var(--accent2); outline-offset: 1px; }
#dw-code { font-variant-numeric: tabular-nums; letter-spacing: .15em; }
.dw label { display: block; margin-top: 16px; color: var(--muted); font-size: 13px; }
.dw-conf {
  width: 100%; min-width: 0; min-height: 9em; margin-top: 8px; resize: vertical;
  background: var(--sink); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.dw-steps { margin-top: 16px; }
.dw-msg { min-height: 1.5em; margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.dw-msg[data-tone="ok"] { color: var(--ok); }
.dw-msg[data-tone="err"] { color: var(--danger); }
.dw-logpanel h2 .faint { text-transform: none; letter-spacing: 0; margin-left: 8px; }
.dw-log {
  margin: 0; height: 320px; overflow: auto; background: var(--sink); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; color: var(--muted);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all;
}


/* ---- Schmale Bildschirme ---- */
@media (max-width: 1000px) {
  .row, .builder, .builder.plan { grid-template-columns: 1fr; }
  /* Karte bekommt fast die volle Höhe; Finger-Scrollen in beide Richtungen. */
  .boardwrap { max-height: 72vh; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
  .panel.side { position: static; max-height: none; }
  .panel.side .palette { max-height: 40vh; }
}

/* Hamburger nur auf dem Handy; Backdrop dort hinter der Schublade. */
#menu-btn { display: none; }
#nav-backdrop { display: none; }

@media (max-width: 760px) {
  /* Sidebar als Schublade: von links einfahren, Hintergrund abdunkeln. */
  #rail {
    position: fixed; top: 0; left: 0; z-index: 50;
    width: 250px; max-width: 80vw; height: 100dvh;
    transform: translateX(-100%);
    transition: transform 220ms var(--ease);
    border-right: 1px solid var(--line-soft);
    overflow-y: auto;
  }
  .nav-open #rail { transform: none; box-shadow: 0 0 40px oklch(0 0 0 / 0.55); }
  #nav button { height: 44px; }

  #nav-backdrop {
    display: block;
    position: fixed; inset: 0; z-index: 40;
    background: oklch(0 0 0 / 0.5);
    opacity: 0; pointer-events: none;
    transition: opacity 220ms var(--ease);
  }
  .nav-open #nav-backdrop { opacity: 1; pointer-events: auto; }

  #menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex: none; margin-left: -8px;
    border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer;
  }
  #menu-btn svg { width: 22px; height: 22px; }

  #topbar { padding: 0 14px; height: 52px; gap: 10px; }
  main { padding: 16px 14px 48px; }
  .account b { display: none; }
  .entry { grid-template-columns: 1fr; }
  .entry .span2 { grid-column: auto; }
  .cards { grid-template-columns: 1fr 1fr; }
  .cards > .panel + .panel { border-left: 0; }
  .cards > .panel:nth-child(odd) { border-right: 1px solid var(--line-soft); }
  .cards > .panel:nth-child(n+3) { border-top: 1px solid var(--line-soft); }

  /* Eingaben mit 16px: iOS zoomt sonst bei jedem Antippen in das Feld. */
  .entry input, .entry select, textarea.notes, .find, .search input,
  select.btn, input.btn, .cell, .gate-form input, .notes { font-size: 16px; }
  .entry input, .entry select { height: 40px; }

  /* Fingerfreundliche Tap-Ziele. */
  .btn { min-height: 40px; }
  .btn.small, .mini { min-height: 34px; }
  .btn.icon { width: 40px; }
  #nav button { height: 40px; }
  .cell { height: 36px; }
  .att { width: 36px; height: 34px; }
  td.actions .btn + .btn { margin-left: 0; margin-top: 4px; }
  td.actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

  /* Die Rang-Nummer spart auf dem Handy Platz und ist dort entbehrlich. */
  .rank { display: none; }

  /* Hero schlanker: Wappen bleibt links, Metriken brechen um. */
  .hero { padding: 16px; gap: 14px; align-items: flex-start; }
  .crest { width: 54px; height: 54px; font-size: 15px; border-radius: 12px; }
  .hero h1 { font-size: 20px; }
  .hero-metrics { gap: 12px 22px; margin-top: 14px; }
  .hero-metrics .m { padding: 0; border-left: 0; }
  .hero-metrics .m .v { font-size: 18px; }

  /* Breite Tabellen: horizontal scrollen, aber die Namensspalte bleibt stehen. */
  th.sticky-col, td.sticky-col {
    position: sticky; left: 0; z-index: 1;
    background: var(--panel);
    box-shadow: 1px 0 0 var(--line-soft);
  }
  tbody tr.click:hover td.sticky-col, .sheet tbody tr:hover td.sticky-col { background: var(--hover); }
  /* Im Wochenblatt bleibt auch die Kopfzeile beim vertikalen Scrollen sichtbar. */
  .sheet thead th { position: sticky; top: 0; z-index: 2; background: var(--panel); }
  .sheet thead th.sticky-col { z-index: 3; }
  .sheet .day { width: 72px; }
  .sheet-panel .scroll { max-height: 72vh; overflow-y: auto; }
}

/* ---- Anmeldung ---- */
.gate {
  position: fixed; inset: 0; z-index: 2;
  display: grid; place-items: center;
  padding: 16px; overflow: auto;
  color: var(--text); background: var(--bg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.gate-card { width: min(380px, 100%); }
.gate .brand { flex-direction: column; gap: 14px; padding: 0 0 28px; }
.gate .mark { width: 140px; height: 140px; }
.gate .wordmark { height: auto; width: 260px; }
.gate h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.gate-lead { margin: 0 0 20px; color: var(--muted); }
.gate-form { display: grid; gap: 14px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; }
.gate-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.gate-form input { width: 100%; height: 38px; background: var(--sink); border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; }
.gate-form input:focus { outline: none; border-color: var(--accent); }
.gate-form input::placeholder { color: var(--faint); }
.gate-error { margin: 0; color: var(--danger); font-size: 13px; }
.gate .btn.primary { width: 100%; height: 38px; }
.gate-note { margin: 14px 0 0; color: var(--faint); font-size: 12px; text-align: center; }

/* Settings: Tabs, je Abschnitt links Erklärung, rechts Formular */
.settings-tabs { display: flex; gap: 24px; margin-bottom: 22px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.settings-tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; padding: 8px 0 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; cursor: pointer; }
.settings-tabs button:hover { color: var(--text); }
.settings-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.settings-pane { display: grid; gap: 18px; }
.setting { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 14px 40px; }
.setting-info p { margin: 0 0 8px; font-size: 13px; }
.setting-body .entry { margin-bottom: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 620px; }
.setting-body .entry-actions { grid-column: 1 / -1; }
.setting-body .setup-note { margin: 6px 0 0; max-width: 620px; }
@media (max-width: 760px) { .setting-body .entry { grid-template-columns: minmax(0, 1fr); } .setting-body .entry .span2 { grid-column: auto; } }
.entry .inline { display: flex; gap: 8px; }
.entry .inline input { flex: 1; min-width: 0; }
.entry .inline .btn { flex: none; }
.conn { grid-column: 1 / -1; margin: 0 0 2px; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.conn[data-tone="ok"] { color: var(--ok); }
.conn[data-tone="ok"]::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.setting-wide { grid-column: 1 / -1; }
@media (max-width: 760px) { .setting { grid-template-columns: minmax(0, 1fr); } }
details.more { margin-top: 12px; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 6px 0; }
details.more > summary:hover { color: var(--text); }

/* ---- Erste Schritte (Alliance-Seite, bis verbunden und gepullt) ---- */
.setup { border-color: oklch(0.66 0.24 302 / 0.45); }
.setup-steps { list-style: none; margin: 4px 0 16px; padding: 0; counter-reset: s; display: grid; gap: 14px; }
.setup-steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; }
.setup-steps li::before {
  content: counter(s); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  border: 1px solid var(--accent); color: var(--accent);
}
.setup-steps li.done::before { content: "✓"; background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.setup-steps li.done b { color: var(--muted); text-decoration: line-through; }
.setup-steps li span { color: var(--muted); font-size: 13px; }
.setup-note { margin: 0 0 16px; padding: 10px 12px; border-radius: 6px; background: var(--accent-soft); font-size: 13px; }

/* ---- Handy: Kopfzeile, Hero, Wochenblatt ---- */
@media (max-width: 760px) {
  .search { flex: 1 1 auto; min-width: 0; }
  .account { flex: none; gap: 6px; }
  .account .ava, .account span:has(> b) { display: none; }
  .profile-btn { padding: 0 8px; white-space: nowrap; }
  select.profile-btn { max-width: 74px; }
  .hero { padding: 18px 16px; gap: 14px 16px; }
  .hero-main { flex: 1 1 calc(100% - 92px); }
  .hero h1 { font-size: 21px; }
  .hero-metrics .m { padding: 2px 14px; }
  .hero-cp { flex: 1 1 100%; justify-content: center; }
  .sheet .cell { min-width: 100px; }
}

/* SvS-Rollen: gefüllter Chip für Leader, umrandet für Mitglieder; Farbstreifen an der Liste. */
.role { display: inline-block; font-size: 11px; font-weight: 600; line-height: 1.6; padding: 0 8px; border-radius: 999px; color: var(--ink); background: var(--c); white-space: nowrap; }
.role.member { background: transparent; color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.role-bar { border-left: 3px solid var(--c); padding-left: 10px; }
.role-hunt, .role-huntteam { --c: var(--role-hunt); }
.role-capitol { --c: var(--role-capitol); }
.role-prewave { --c: var(--role-prewave); }
.role-turret { --c: var(--role-turret); }
.role-strike { --c: var(--role-strike); }
.role-attack { --c: var(--role-attack); }
.role-backup { --c: var(--role-backup); }
.role-legend { display: flex; flex-wrap: wrap; gap: 6px; }
tr.role-bar { border-left: 0; padding-left: 0; }
tr.role-bar > td:first-child { box-shadow: inset 3px 0 0 var(--c); }

/* ---- Season 8 map ---- */
.s8-bar { gap: 8px; }
.s8-factions { display: flex; flex-wrap: wrap; gap: 6px; }
.s8-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 0 1px oklch(0 0 0 / 0.4); }
.s8-spacer { flex: 1; }
.s8-status { font-size: 12px; flex-basis: 100%; min-height: 1.5em; }
.s8-wrap { overflow: auto; touch-action: pan-x pan-y; max-height: calc(100dvh - 230px); min-height: 320px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sink); overscroll-behavior: contain; }
.s8-map { display: block; touch-action: pan-x pan-y; cursor: crosshair; }
.s8-info { margin: 10px 0 0; font-variant-numeric: tabular-nums; min-height: 1.5em; }
.s8-credit { font-size: 12px; margin: 0; }
.s8-credit a { color: inherit; }
