/* StrategieSpiel – Styles im GameHub-Look (Nunito, Navy/Gelb, Karten mit dickem Rand unten, Pills).
   Handy zuerst: Die Grundregeln gelten fürs Handy hochkant, darunter folgen Handy quer und PC.
   Farben nur über Tokens; Dark ist Standard, Light über <html data-theme="light">. */

:root {
  --page: #0e1a2b;
  --navy: #e9eef6;
  --muted: #94a3bd;
  --card: #1a2b45;
  --card-2: #213656;
  --line: #2f4366;
  --yellow: #ffd43b;
  --yellow-dark: #f59f00;
  --blue: #74c0fc;
  --on-accent: #183153;
  --ok: #69db7c;
  --danger: #fa5252;
  --danger-text: #ff8787;
  --glass: rgba(14, 26, 43, 0.82);
  --radius: 18px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Sichere Ränder (Notch, Home-Leiste) */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --page: #f0f1f3;
  --navy: #183153;
  --muted: #616d8a;
  --card: #ffffff;
  --card-2: #f4f6fa;
  --line: #c3c6d1;
  --ok: #2b8a3e;
  --danger-text: #c92a2a;
  --glass: rgba(255, 255, 255, 0.86);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--navy);
  font-family: var(--font);
  font-weight: 500;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Logo, Knöpfe, Pills (wie GameHub) ---------- */
.logo { font-size: 1.45rem; font-weight: 900; letter-spacing: -0.02em; white-space: nowrap; }
.logo span {
  display: inline-block;
  margin-left: 3px;
  padding: 0 9px;
  border-radius: 10px;
  background: var(--yellow);
  color: var(--on-accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 2px solid var(--navy);
  background: var(--card);
  color: var(--navy);
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--navy);
  transition: transform 0.1s, box-shadow 0.1s;
  user-select: none;
  -webkit-user-select: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--navy); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: 0 3px 0 var(--navy); }
.btn--primary { background: var(--yellow); color: var(--on-accent); border-color: var(--on-accent); box-shadow: 0 3px 0 var(--on-accent); }
.btn--primary:hover { box-shadow: 0 4px 0 var(--on-accent); }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: 0.9rem; }
.btn--block { width: 100%; }
.btn svg { width: 20px; height: 20px; flex: none; }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--navy); }
.icon-btn svg { width: 22px; height: 22px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill--muted { background: var(--card-2); color: var(--muted); }

.star { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.star svg { width: 18px; height: 18px; flex: none; }

/* ---------- Ladebildschirm ---------- */
.boot { min-height: 100dvh; display: grid; place-content: center; gap: 10px; text-align: center; color: var(--muted); font-weight: 800; }
.boot .logo { color: var(--navy); font-size: 2rem; }

/* ---------- Startbildschirm ---------- */
.start {
  min-height: 100dvh;
  padding: calc(var(--sat) + 12px) calc(var(--sar) + 16px) calc(var(--sab) + 96px) calc(var(--sal) + 16px);
}
.start-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.start-tools { display: flex; gap: 8px; }
.start-hero { margin: 26px 0 18px; }
.start-hero h1 { margin: 0; font-size: 2.1rem; font-weight: 900; line-height: 1.05; letter-spacing: -0.02em; }
.start-hero p { margin: 8px 0 0; color: var(--muted); font-size: 1.05rem; font-weight: 700; }
.section-title { margin: 26px 0 10px; font-size: 1.05rem; font-weight: 900; }

.continue {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 6px 0 var(--yellow-dark);
  text-align: left;
  cursor: pointer;
}
.continue img { width: 64px; height: 64px; flex: none; border-radius: 14px; background: var(--card-2); }
.continue b { display: block; font-size: 1.1rem; font-weight: 900; }
.continue small { color: var(--muted); font-weight: 700; }
.continue .btn { margin-left: auto; pointer-events: none; }

/* Hinweis „Als App installieren“ */
.install {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 6px 12px 12px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.install img { width: 48px; height: 48px; flex: none; border-radius: 12px; }
.install-text { flex: 1; min-width: 0; }
.install-text > b { display: block; font-weight: 900; }
.install-text small { display: block; color: var(--muted); font-size: 0.88rem; font-weight: 700; line-height: 1.4; }
.install-text small b { color: var(--navy); }
.install-text small svg { width: 17px; height: 17px; vertical-align: -3px; color: var(--blue); }
.install-text .btn { margin-top: 10px; }
.install-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  margin-top: -4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.install-close:hover { color: var(--navy); }
.install-close svg { width: 16px; height: 16px; }

/* Stamm-Karten: Bild oben in der Stammfarbe, Text darunter eine Stufe dunkler (wie GameHub-Kacheln) */
.tribes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tribe {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--tribe);
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--tribe-dark);
  transition: transform 0.15s, box-shadow 0.15s;
}
.tribe:hover { transform: translateY(-2px); }
.tribe.is-selected { box-shadow: 0 0 0 4px var(--navy), 0 6px 0 var(--tribe-dark); }
.tribe img, .tribe .tribe-art { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.tribe-foot { flex: 1; padding: 8px 12px 12px; background: color-mix(in srgb, var(--tribe) 62%, var(--tribe-dark)); }
.tribe-foot b { display: block; font-size: 1.05rem; font-weight: 900; }
.tribe-foot small { display: block; font-size: 0.8rem; font-weight: 700; opacity: 0.9; line-height: 1.3; }
.tribe-check {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  color: var(--tribe-dark);
  font-weight: 900;
}
.tribe.is-selected .tribe-check { display: grid; }

.options { display: grid; gap: 14px; }
.option-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.75rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px; border-radius: 22px; background: var(--card); border: 2px solid var(--line); }
.seg button {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 38px;
  padding: 6px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.seg button.is-active { background: var(--yellow); color: var(--on-accent); }
.option-note { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; font-weight: 700; }

/* Kleiner Hinweis auf den Macher (Startbildschirm unten, Menü) */
.credit { margin: 26px 0 0; text-align: center; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.credit b { color: var(--navy); font-weight: 900; }
.credit--menu { margin: 12px 0 0; font-size: 0.76rem; }

.start-go {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 12px calc(var(--sar) + 16px) calc(var(--sab) + 12px) calc(var(--sal) + 16px);
  background: linear-gradient(transparent, var(--page) 35%);
}
.start-go .btn { width: 100%; min-height: 54px; font-size: 1.15rem; }

/* ---------- Spielbildschirm ---------- */
.game {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #1d5f8f;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.game canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; outline: none; }

/* Beschriftungen über der 3D-Karte (Lebenspunkte, Städtenamen) */
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; will-change: transform; white-space: nowrap; font-weight: 900; }
.lbl-hp {
  min-width: 26px;
  padding: 0 6px;
  border-radius: 999px;
  border: 2px solid var(--c);
  background: rgba(255, 255, 255, 0.95);
  color: #183153;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
}
.lbl-hp.is-low { color: #c92a2a; }
.lbl-hp.is-vet::before { content: "★"; margin-right: 2px; color: #f59f00; }
/* Schild: Einheit steht geschützt (Berg, Wald, Stadt, Wasser) – Farbe des Stamms */
.lbl-hp.is-guarded::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 11px;
  margin-left: 3px;
  vertical-align: -1px;
  background: var(--c);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M12 2.5 4.5 5.4v6c0 4.9 3.2 9 7.5 10.6 4.3-1.6 7.5-5.7 7.5-10.6v-6Z%27/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M12 2.5 4.5 5.4v6c0 4.9 3.2 9 7.5 10.6 4.3-1.6 7.5-5.7 7.5-10.6v-6Z%27/%3E%3C/svg%3E") center / contain no-repeat;
}
.lbl-hp.is-spent { opacity: 0.55; }
/* „Erobern“ direkt über einer Einheit, die jetzt einnehmen kann (antippbar, wippt sanft) */
.lbl-capture { pointer-events: auto; padding: 0 0 4px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.lbl-capture span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px 8px 11px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--on-accent);
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 3px 0 var(--yellow-dark), 0 6px 16px rgba(0, 0, 0, 0.32);
  animation: capture-bob 1.8s ease-in-out infinite;
}
.lbl-capture svg { width: 17px; height: 17px; }
.lbl-capture:hover span { filter: brightness(1.06); }
.lbl-capture:active span { animation: none; transform: translateY(2px); box-shadow: 0 1px 0 var(--yellow-dark), 0 3px 8px rgba(0, 0, 0, 0.3); }
.lbl-capture:focus-visible { outline: none; }
.lbl-capture:focus-visible span { outline: 3px solid #fff; outline-offset: 2px; }
@keyframes capture-bob { 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .lbl-capture span { animation: none; } }
.lbl-city { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.lbl-city-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px 1px 4px;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.5;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}
.lbl-city-name i {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 999px;
  background: #fff;
  color: #183153;
  font-style: normal;
  font-size: 0.72rem;
}
.lbl-city-name.is-capital::after { content: "♛"; font-size: 0.8rem; color: #ffe066; }
.lbl-pop { display: flex; gap: 2px; }
.lbl-pop span { width: 9px; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6); }
.lbl-pop span.is-full { background: #ffd43b; }
.lbl-village {
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(24, 49, 83, 0.75);
  color: #fff;
  font-size: 0.72rem;
}
.lbl-float { font-size: 1.05rem; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 6px rgba(0, 0, 0, 0.5); }
.lbl-float.is-dmg { color: #ff8787; }
.lbl-float.is-heal { color: #8ce99a; }
.lbl-float.is-star { color: #ffe066; }

/* Kopfzeile im Spiel: Sterne, Runde, Punkte, Menü */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(var(--sat) + 8px) calc(var(--sar) + 10px) 8px calc(var(--sal) + 10px);
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-box {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hud-box small { color: var(--muted); font-weight: 800; }
.hud-box svg { width: 18px; height: 18px; flex: none; }
.hud-stars { font-size: 1.05rem; }
.hud-spacer { flex: 1; }
.hud .icon-btn { width: 40px; height: 40px; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hud-turn-label { display: none; }
.hud-tribe { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7); }

/* Untere Leiste: Forschung, Runde beenden */
.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px calc(var(--sar) + 10px) calc(var(--sab) + 8px) calc(var(--sal) + 10px);
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.dock .btn { min-height: 44px; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dock .btn--primary { background: var(--yellow); }
.dock-end { margin-left: auto; }
.dock-end.is-ready { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  50% { box-shadow: 0 3px 0 var(--on-accent), 0 0 0 8px rgba(255, 212, 59, 0.25); }
}
.dock .btn .badge {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--on-accent);
  font-size: 0.75rem;
}

/* Auswahl-Karte (Einheit, Stadt, Kachel): unten über der Leiste, auf dem PC rechts */
.sheet {
  position: absolute;
  left: calc(var(--sal) + 8px);
  right: calc(var(--sar) + 8px);
  bottom: calc(var(--sab) + 66px);
  z-index: 4;
  max-height: 34dvh;
  overflow: auto;
  padding: 8px 12px 10px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 6px 0 var(--c, var(--line)), 0 10px 30px rgba(0, 0, 0, 0.35);
  overscroll-behavior: contain;
  touch-action: pan-y;
  animation: sheet-in 0.18s ease-out;
}
@keyframes sheet-in {
  from { transform: translateY(12px); opacity: 0; }
}
.sheet-head { display: flex; align-items: center; gap: 10px; padding-right: 110px; }
.sheet-head img { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--card-2); }
.sheet-head h2 { margin: 0; font-size: 1.05rem; font-weight: 900; line-height: 1.15; }
.sheet-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.sheet-close, .sheet-info, .sheet-fold {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.sheet-fold { right: 42px; }
.sheet-info { right: 78px; }
.sheet-close svg, .sheet-info svg, .sheet-fold svg { width: 20px; height: 20px; }
.sheet-fold svg { transition: transform 0.18s; }
/* Anweisung unter dem Namen (früher Blase oben) */
.sheet-hint { margin: 3px 0 0; color: var(--yellow); font-size: 0.82rem; font-weight: 800; line-height: 1.25; }
:root[data-theme="light"] .sheet-hint { color: #b35c00; }
.mark { display: inline-block; width: 11px; height: 11px; margin: 0 1px; border-radius: 50%; vertical-align: -1px; }
.sheet-head .hp { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.sheet-head .hp svg { width: 14px; height: 14px; color: #fa5252; }
.mark--move { background: #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.35); }
.mark--attack { border: 2.5px solid #fa5252; }
/* Eingeklappt: nur die Kopfzeile, Pfeil zeigt nach oben */
.sheet.is-folded > :not(.sheet-head):not(button), .sheet.is-folded .sheet-hint { display: none; }
.sheet.is-folded .sheet-head { cursor: pointer; }
.sheet.is-folded .sheet-fold svg { transform: rotate(180deg); }
/* Handy hochkant: Werte und Hinweise nur über den Info-Knopf, Karte bleibt klein */
.sheet .sheet-detail, .sheet .sheet-label { display: none; }
/* Handy hochkant: Bei einer Auswahl verschwindet die untere Leiste, die Karte rückt nach unten */
.has-sheet .dock { display: none; }
.has-sheet .sheet { bottom: calc(var(--sab) + 8px); }
.modal--info .stats { margin-bottom: 4px; }
.modal--info .sheet-note:first-child { margin-top: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.stat { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px 4px 8px; border-radius: 10px; background: var(--card-2); font-size: 0.82rem; font-weight: 800; }
.stat b { font-weight: 900; font-size: 0.95rem; }
/* Symbole der Werte: kräftige Mitteltöne, lesbar auf hellem und dunklem Grund */
.stat svg { width: 17px; height: 17px; flex: none; color: var(--navy); }
.stat[data-stat="sword"] svg { color: #e8590c; }
.stat[data-stat="shield"] svg { color: #228be6; }
.stat[data-stat="boot"] svg { color: #2f9e44; }
.stat[data-stat="road"] svg { color: #a0785a; }
.stat[data-stat="target"] svg { color: #cc5de8; }
.stat[data-stat="swords"] svg { color: #c77700; }
.stat[data-stat="people"] svg { color: #099268; }
.help-stats .stat { margin: 3px 2px 0 0; padding: 2px 9px 2px 6px; font-weight: 700; }
.help-stats .stat svg { width: 15px; height: 15px; }
/* nur für Screenreader */
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sheet-note { margin: 10px 0 0; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.sheet-note.is-warn { color: var(--danger-text); }
.sheet-guard { display: flex; align-items: flex-start; gap: 6px; color: var(--navy); }
.sheet-guard svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--blue); }

/* Knöpfe als eine waagerecht scrollbare Reihe (bis an den Kartenrand) */
.actions {
  display: flex;
  gap: 6px;
  margin: 6px -12px 0;
  padding: 2px 12px 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding: 0 12px;
  scrollbar-width: thin;
  touch-action: pan-x pan-y;
}
.actions:empty { display: none; }
.actions .act { flex: 0 0 82px; scroll-snap-align: start; }
.act {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 0;
  padding: 4px 2px 3px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--navy);
  text-align: center;
  cursor: pointer;
}
.act:active:not(:disabled) { transform: translateY(2px); }
.act:disabled { cursor: not-allowed; opacity: 0.5; }
.act img, .act-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--card-2); box-shadow: 0 0 0 3px var(--c, var(--line)); }
.act img { padding: 3px; box-sizing: border-box; }
.act-icon { display: grid; place-items: center; font-size: 1.6rem; }
.act-icon svg { width: 30px; height: 30px; }
.act b { max-width: 100%; margin-top: 3px; overflow: hidden; font-size: 0.76rem; font-weight: 900; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.act small { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 0.7rem; font-weight: 800; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.act small br { display: none; }
.act .cost { color: var(--navy); }
.act.is-primary img, .act.is-primary .act-icon { box-shadow: 0 0 0 3px var(--yellow); }
.act.is-locked { opacity: 0.4; }

.progress { display: flex; gap: 3px; margin-top: 8px; }
.progress span { flex: 1; height: 8px; border-radius: 4px; background: var(--card-2); box-shadow: inset 0 0 0 2px var(--line); }
.progress span.is-full { background: var(--yellow); box-shadow: none; }

/* Zug der Computergegner */
.ai-banner {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sab) + 70px);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 900;
  transform: translateX(-50%);
  white-space: nowrap;
}
.ai-banner .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); animation: blink 0.9s ease-in-out infinite; }
@keyframes blink {
  50% { opacity: 0.3; }
}

/* ---------- Fenster (unten als Blatt, auf dem PC mittig) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(8, 14, 26, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade 0.18s ease-out;
}
.modal-backdrop.is-out { opacity: 0; transition: opacity 0.18s; }
@keyframes fade {
  from { opacity: 0; }
}
.modal {
  position: relative;
  width: 100%;
  max-height: calc(100dvh - var(--sat) - 24px);
  overflow: auto;
  padding: 22px calc(var(--sar) + 18px) calc(var(--sab) + 20px) calc(var(--sal) + 18px);
  border-radius: 24px 24px 0 0;
  background: var(--card);
  color: var(--navy);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
  animation: sheet-up 0.22s ease-out;
  overscroll-behavior: contain;
}
@keyframes sheet-up {
  from { transform: translateY(40px); }
}
.modal h2 { margin: 0 0 4px; padding-right: 40px; font-size: 1.45rem; font-weight: 900; line-height: 1.15; }
.modal-text { margin: 0 0 16px; color: var(--muted); font-weight: 700; }
.modal-close {
  position: absolute;
  top: 12px;
  right: calc(var(--sar) + 12px);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}
.modal-close svg { width: 22px; height: 22px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1 1 140px; }

/* Belohnungswahl: zwei große Karten */
.rewards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reward {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px 14px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--card-2);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--line);
}
.reward:hover { border-color: var(--yellow-dark); box-shadow: 0 4px 0 var(--yellow-dark); }
.reward-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--yellow); color: var(--on-accent); font-size: 2rem; }
.reward-icon svg { width: 36px; height: 36px; }
.reward b { font-size: 1.05rem; font-weight: 900; }
.reward small { color: var(--muted); font-weight: 700; }

/* ---------- Vollbild-Ebene ---------- */
.layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--navy);
  animation: fade 0.18s ease-out;
}
.layer.is-out { opacity: 0; transition: opacity 0.18s; }

/* ---------- Forschungsbaum: Stern um den Stamm, Knöpfe mit 3D-Bildern ---------- */
.techtree {
  --tt-glow: #1b3a60;
  --tt-glow-out: #0b1524;
  --tt-orbit: rgba(233, 238, 246, 0.07);
  --tt-edge-open: rgba(233, 238, 246, 0.45);
  --tt-edge-locked: #22344f;
  --tt-locked-face: #1b2c47;
  --tt-locked-ink: #6f7f99;
  background: var(--tt-glow-out);
}
:root[data-theme="light"] .techtree {
  --tt-glow: #ffffff;
  --tt-glow-out: #dde4ee;
  --tt-orbit: rgba(24, 49, 83, 0.09);
  --tt-edge-open: rgba(24, 49, 83, 0.32);
  --tt-edge-locked: #c3cbd8;
  --tt-locked-face: #cfd6e1;
  --tt-locked-ink: #7a8599;
}
.tt-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--sat) + 10px) calc(var(--sar) + 12px) 10px calc(var(--sal) + 12px);
}
.tt-head h2 { margin: 0; font-size: 1.3rem; font-weight: 900; }
.tt-spacer { flex: 1; }
.tt-view {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.tt-view:active { cursor: grabbing; }
.tt-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.tt-glow-in { stop-color: var(--tt-glow); }
.tt-glow-out { stop-color: var(--tt-glow-out); }
.tt-orbit { fill: none; stroke: var(--tt-orbit); stroke-width: 2; stroke-dasharray: 4 10; }
.tt-edge { stroke-width: 7; stroke-linecap: round; }
.tt-edge.is-done { stroke: var(--tribe); }
.tt-edge.is-open { stroke: var(--tt-edge-open); }
.tt-edge.is-locked { stroke: var(--tt-edge-locked); }
.tt-center-face { fill: var(--card); stroke: var(--tribe); stroke-width: 6; }
.tt-node { cursor: pointer; outline: none; }
.tt-node.is-done { --tt-face: var(--tribe); --tt-ink: #fff; }
.tt-node.is-available { --tt-face: #eef2f8; --tt-ink: #183153; }
.tt-node.is-expensive { --tt-face: #b9c3d3; --tt-ink: #3a475e; }
.tt-node.is-locked { --tt-face: var(--tt-locked-face); --tt-ink: var(--tt-locked-ink); }
.tt-face { fill: var(--tt-face); }
.tt-node:hover .tt-face { filter: brightness(1.06); }
.tt-node.is-locked .tt-icon { opacity: 0.3; }
.tt-name { fill: var(--tt-ink); font-family: var(--font); font-weight: 900; letter-spacing: -0.01em; }
.tt-ring { display: none; fill: none; stroke: var(--yellow); stroke-width: 5; }
.tt-node.is-picked .tt-ring,
.tt-node:focus-visible .tt-ring { display: inline; }
.tt-check, .tt-lock, .tt-price { display: none; }
.tt-node.is-done .tt-check,
.tt-node.is-locked .tt-lock,
.tt-node.is-available .tt-price,
.tt-node.is-expensive .tt-price { display: inline; }
.tt-check circle { fill: #fff; }
.tt-check path { fill: none; stroke: var(--tribe-dark); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.tt-lock circle { fill: #2f4366; }
.tt-lock rect { fill: #94a3bd; }
.tt-lock path { fill: none; stroke: #94a3bd; stroke-width: 2.2; }
.tt-price-face { fill: var(--yellow); }
.tt-node.is-expensive .tt-price-face { fill: #8592a8; }
.tt-price-text { fill: var(--on-accent); font-family: var(--font); font-size: 12px; font-weight: 900; }
.tt-zoom {
  position: absolute;
  top: calc(var(--sat) + 72px);
  right: calc(var(--sar) + 12px);
  z-index: 2;
  display: grid;
  gap: 8px;
}
.tt-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sab) + 14px);
  z-index: 2;
  width: max-content;
  max-width: min(92%, 560px);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--glass);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}
.tt-sheet {
  position: absolute;
  left: calc(var(--sal) + 10px);
  right: calc(var(--sar) + 10px);
  bottom: calc(var(--sab) + 10px);
  z-index: 3;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px 14px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25), 0 -6px 24px rgba(0, 0, 0, 0.3);
  animation: sheet-up 0.2s ease-out;
}
.tt-sheet-icon { width: 54px; height: 54px; }
.tt-sheet h3 { margin: 0; font-size: 1.1rem; font-weight: 900; }
.tt-sheet p { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; font-weight: 700; }
.tt-sheet .tt-note { color: var(--navy); }
.tt-more { grid-column: 1 / -1; }
.tt-more summary { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.85rem; font-weight: 800; cursor: pointer; list-style: none; }
.tt-more summary::-webkit-details-marker { display: none; }
.tt-more summary svg { width: 16px; height: 16px; }
.tt-unlocks {
  display: grid;
  gap: 9px;
  max-height: min(34vh, 280px);
  margin: 8px 0 0;
  padding: 10px 2px 2px 0;
  overflow: auto;
  overscroll-behavior: contain;
  border-top: 2px solid var(--line);
  list-style: none;
}
.tt-unlocks li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.tt-kind {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tt-unlocks b { font-weight: 900; }
.tt-cost { color: var(--yellow); font-size: 0.85rem; font-weight: 900; }
:root[data-theme="light"] .tt-cost { color: #b35c00; }
.tt-unlocks small { flex-basis: 100%; color: var(--muted); font-size: 0.85rem; font-weight: 700; line-height: 1.4; }
.tt-sheet .btn { grid-column: 1 / -1; width: 100%; }
.tt-sheet .pill { grid-column: 1 / -1; justify-self: start; }
.tt-sheet .pill svg { width: 14px; height: 14px; }

/* ---------- Spielende ---------- */
.ranking { display: grid; gap: 8px; margin: 6px 0 4px; }
.rank { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--card-2); font-weight: 800; }
.rank i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.rank b { margin-left: auto; font-variant-numeric: tabular-nums; }
.rank.is-you { box-shadow: inset 0 0 0 2px var(--yellow); }
.rank.is-out { opacity: 0.5; }
.rank-name { display: flex; flex-direction: column; min-width: 0; }
.rank-you { color: var(--yellow); font-size: 0.72rem; font-weight: 900; }
.rank-sub { display: flex; gap: 10px; color: var(--muted); font-size: 0.78rem; font-weight: 800; }
.rank-sub span { display: inline-flex; align-items: center; gap: 3px; }
.rank-sub svg { width: 14px; height: 14px; }
.modal-sub { margin: 16px 0 6px; font-size: 1rem; font-weight: 900; }
.stats--game { margin-top: 8px; }
.stats--game svg { color: var(--muted); }
/* Punkte oben: antippen öffnet die Statistik */
.hud-score { color: inherit; font: inherit; cursor: pointer; }
.score-parts { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin: 12px 0 0; font-size: 0.9rem; font-weight: 700; }
.score-parts dd { margin: 0; text-align: right; font-weight: 900; }
.score-parts dt { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.score-parts dt svg { width: 15px; height: 15px; flex: none; }

.menu-list { display: grid; gap: 10px; }

/* Kompaktes Menü: zwei Knöpfe oben, darunter Einstellungen als schlanke Liste mit Schaltern */
.menu-top { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.menu-top .btn { min-height: 42px; padding: 8px 10px; font-size: 0.92rem; }
.menu-top .btn--primary { grid-column: 1 / -1; }
.menu-top .btn svg { width: 17px; height: 17px; }
.menu-settings { display: grid; margin: 14px 0 12px; padding: 0 14px; border-radius: 16px; background: var(--card-2); }
.set-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  min-height: 48px;
  padding: 7px 0;
  font-weight: 800;
  cursor: pointer;
}
.set-row + .set-row { border-top: 1px solid var(--line); }
.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.switch:checked { background: var(--yellow); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.seg--sm { margin-left: auto; padding: 3px; border-width: 1px; }
.seg--sm button { min-height: 30px; padding: 3px 10px; font-size: 0.82rem; }
.menu-home { width: 100%; }
.help h3 { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-size: 1rem; font-weight: 900; }
.help h3 svg { width: 20px; height: 20px; flex: none; color: var(--yellow); }
.help p, .help li { margin: 0 0 6px; color: var(--muted); font-weight: 700; }
.help ul { display: grid; gap: 6px; padding: 0; margin: 0; list-style: none; }
.help li { display: flex; align-items: center; gap: 10px; margin: 0; line-height: 1.35; }
.help-ico { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--card-2); color: var(--navy); }
.help-ico svg { width: 17px; height: 17px; }
.help li.help-stats { display: block; }
.help b { color: var(--navy); }
/* Menü: Symbol vor jeder Einstellung */
.set-label { display: flex; align-items: center; gap: 9px; }
.set-label svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
/* Fähigkeiten in den Einheiten-Details */
.skill-list { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.skill-list li { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.skill-list svg { width: 18px; height: 18px; flex: none; color: var(--yellow); }
.skill-list b { color: var(--navy); }

/* ---------- Einblendungen ---------- */
.toasts {
  position: fixed;
  top: calc(var(--sat) + 56px);
  left: 50%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 420px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  font-weight: 800;
  animation: toast-in 0.25s ease-out;
  pointer-events: auto;
}
.toast.is-out { opacity: 0; transform: translateY(-8px); transition: opacity 0.25s, transform 0.25s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
}
.toast-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--yellow); color: var(--on-accent); font-size: 1.1rem; }
.toast-icon svg { width: 20px; height: 20px; }
.toast b { display: block; font-weight: 900; }
.toast small { display: block; color: var(--muted); font-weight: 700; }
.toast--bad { border-color: var(--danger); }
.toast--bad .toast-icon { background: var(--danger); color: #fff; }
.toast--good { border-color: var(--ok); }

/* ==================== Handy quer: Auswahl-Karte rechts, alles kompakter ==================== */
@media (orientation: landscape) and (max-height: 540px) {
  .start { padding-bottom: calc(var(--sab) + 84px); }
  .start-hero { margin: 12px 0 8px; }
  .start-hero h1 { font-size: 1.7rem; }
  .tribes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .options { grid-template-columns: 1fr 1fr; }
  .start-go { left: auto; width: min(360px, 50vw); background: none; }

  .hud { padding-top: calc(var(--sat) + 6px); }
  .hud-box, .hud .icon-btn { height: 36px; }
  .hud .icon-btn { width: 36px; }
  .sheet {
    left: auto;
    top: calc(var(--sat) + 52px);
    bottom: calc(var(--sab) + 66px);
    width: min(330px, 46vw);
    max-height: none;
  }
  .sheet .sheet-detail { display: block; }
  .sheet-info { display: none; }
  .has-sheet .dock { display: flex; }
  .has-sheet .sheet { bottom: calc(var(--sab) + 66px); }
  .sheet-head { padding-right: 74px; }
  .sheet-fold { right: 42px; }
  .actions { gap: 8px; }
  .dock .btn { min-height: 42px; }
  .modal { max-width: 640px; border-radius: 24px 24px 0 0; }
  .rewards { grid-template-columns: 1fr 1fr; }
  .toasts { top: calc(var(--sat) + 50px); }
  .ai-banner { bottom: calc(var(--sab) + 66px); }
}

/* ==================== PC / Tablet ==================== */
@media (min-width: 900px) and (min-height: 560px) {
  .start { max-width: 1200px; margin: 0 auto; padding-bottom: 48px; }
  .start-hero { margin: 40px 0 26px; }
  .start-hero h1 { font-size: 3rem; }
  .tribes { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; }
  .start-go { position: static; padding: 26px 0 0; background: none; }
  .start-go .btn { width: auto; min-width: 280px; }

  .hud { gap: 10px; padding: 14px 18px; }
  .hud-box { height: 46px; padding: 0 16px; }
  .hud .icon-btn { width: 46px; height: 46px; }
  .hud-turn-label { display: inline; }
  .dock { padding: 14px 18px 18px; gap: 12px; }
  .dock .btn { min-height: 52px; padding: 10px 22px; }
  .sheet {
    left: auto;
    top: 76px;
    right: 18px;
    bottom: 96px;
    width: 360px;
    max-height: none;
    height: max-content;
    max-height: calc(100dvh - 76px - 96px);
  }
  .sheet .sheet-detail { display: block; }
  .sheet-info { display: none; }
  .has-sheet .dock { display: flex; }
  .has-sheet .sheet { bottom: 96px; }
  .sheet-head { padding-right: 74px; }
  .sheet-fold { right: 42px; }
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { width: min(100%, 560px); border-radius: 24px; padding: 26px; box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25); }
  .modal--menu { width: min(100%, 400px); padding: 22px; }
  .modal--confirm { width: min(100%, 400px); }
  .toasts { top: 80px; }
  .ai-banner { bottom: 100px; }
}
