/* Tokens: verbindlich beschrieben in DESIGN.md. Hier nur über Variablen verwenden. */
@font-face {
  font-family: "Cherry Cream Soda";
  src: url("./fonts/cherry-cream-soda-latin-400-normal.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;

  --space-950: #060b1a;
  --space-900: #081226;
  --space-800: #0f2142;
  --space-700: #17325e;
  --panel: rgb(20 40 78 / 0.72);
  --panel-edge: rgb(140 186 255 / 0.28);
  --panel-edge-strong: rgb(160 205 255 / 0.55);

  --text: #eef4ff;
  --text-muted: #a9bddf;
  --blue-500: #2f8fff;
  --blue-600: #1a6fe0;
  --blue-300: #8cc8ff;
  --gold-400: #ffc94a;
  --gold-500: #f7a21b;
  --gold-800: #a35a00;
  --ink-on-gold: #2b1600;
  --good: #69db7c;
  --bad: #ff8787;
  --stripe-1: #ffc94a;
  --stripe-2: #ff7a3d;
  --stripe-3: #e8457a;

  --font-display: "Cherry Cream Soda", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-chip: 999px;
  --radius-field: 14px;
  --radius-button: 18px;
  --gutter: 20px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

/* Fokussierte Felder scrollen über die Knopfleiste, nicht dahinter. */
html {
  scroll-padding-bottom: 110px;
}

body {
  background:
    radial-gradient(
        120% 55% at 50% 0%,
        var(--space-700) 0%,
        var(--space-900) 55%,
        var(--space-950) 100%
      )
      fixed,
    var(--space-950);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

::selection {
  background: var(--blue-500);
  color: #fff;
}

:focus-visible {
  outline: 3px solid var(--blue-300);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.status {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: max(16px, env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.6);
  pointer-events: none;
}

.status:empty {
  display: none;
}

/* ---------- Logo mit Retro-Streifen ---------- */
.logo {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--gold-400);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  -webkit-text-stroke: 3px var(--space-950);
  paint-order: stroke fill;
}

.logo::after {
  content: "";
  flex: 1;
  max-width: 120px;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    var(--stripe-1) 0 33%,
    var(--stripe-2) 33% 66%,
    var(--stripe-3) 66%
  );
}

/* ---------- Editor ---------- */
.editor {
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) var(--gutter) 0;
  display: flex;
  flex-direction: column;
}

.editor__header {
  display: grid;
  gap: 16px;
}

.editor__heading {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 8vw, 34px);
  line-height: 1.1;
  letter-spacing: 0;
  text-wrap: balance;
  color: #fff;
  -webkit-text-stroke: 4px var(--space-950);
  paint-order: stroke fill;
  text-shadow: 0 5px 12px rgb(0 0 0 / 0.5);
}

.editor__stage {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 8px 0 14px;
}

.editor__summary {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  text-wrap: balance;
}

.editor__fields {
  display: grid;
  gap: 12px;
  padding-bottom: 24px;
}

.editor__footer {
  position: sticky;
  bottom: 0;
  margin: auto calc(-1 * var(--gutter)) 0;
  padding: 12px var(--gutter) max(14px, env(safe-area-inset-bottom));
  background: var(--space-950);
  border-top: 1px solid var(--panel-edge);
  box-shadow: 0 -12px 24px -12px rgb(0 0 0 / 0.6);
  display: grid;
  gap: 10px;
}

.editor__error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgb(255 107 107 / 0.14);
  border: 1px solid rgb(255 135 135 / 0.5);
  color: #ffd6d6;
  font-size: 14px;
}

/* ---------- Planet (Retro-Akzent: Airbrush-Randlicht) ---------- */
.planet {
  --core: #2d7fd0;
  --light: #9be7ff;
  --deep: #0b2a5c;
  --rim: #ffd28a;
  --surface: rgb(214 226 160 / 0.7);
  /* Ozean: verstreute kleine Inseln. Jede Heimatwelt setzt eigene Formen. */
  --land:
    radial-gradient(ellipse 12% 8% at 38% 52%, var(--surface) 0 55%, transparent 75%),
    radial-gradient(ellipse 9% 6% at 60% 36%, var(--surface) 0 55%, transparent 75%),
    radial-gradient(ellipse 10% 7% at 54% 72%, var(--surface) 0 55%, transparent 75%),
    radial-gradient(ellipse 7% 5% at 28% 70%, var(--surface) 0 55%, transparent 75%);
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background:
    var(--land),
    radial-gradient(circle at 34% 30%, var(--light) 0%, var(--core) 42%, var(--deep) 82%);
  box-shadow:
    inset -30px -26px 46px rgb(3 6 20 / 0.88),
    0 22px 40px -14px rgb(0 0 0 / 0.7);
  transition: background 600ms var(--ease-out);
}

/* Airbrush-Randlicht entlang der beleuchteten Kante (Retro-Akzent). */
.planet::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 38% 34%,
    transparent 56%,
    color-mix(in srgb, var(--rim) 40%, transparent) 70%,
    transparent 76%
  );
  filter: blur(2.5px);
  mix-blend-mode: screen;
}

/* Dünne Atmosphäre: weicher Saum, zur Lichtquelle hin heller. */
.planet::after {
  content: "";
  position: absolute;
  inset: -7px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(
    circle at 40% 38%,
    color-mix(in srgb, var(--light) 30%, transparent) 50%,
    transparent 72%
  );
  filter: blur(3px);
}

/* Spezies-Schicht: Lichter, Krater, Waben oder Orbitalring. */
.planet__layer {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  transition: opacity 400ms var(--ease-out);
}

.planet[data-species="humanoid"] .planet__layer {
  background:
    radial-gradient(circle at 62% 70%, #ffe7a8 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 70% 58%, #ffe7a8 0 1px, transparent 2px),
    radial-gradient(circle at 54% 80%, #ffe7a8 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 76% 76%, #ffe7a8 0 1px, transparent 2px),
    radial-gradient(circle at 66% 84%, #ffe7a8 0 1px, transparent 2px);
}

.planet[data-species="reptilian"] .planet__layer {
  background:
    radial-gradient(circle at 60% 66%, rgb(255 120 60 / 0.9) 0 2px, transparent 5px),
    radial-gradient(circle at 74% 52%, rgb(255 120 60 / 0.8) 0 1.5px, transparent 4px),
    radial-gradient(circle at 50% 82%, rgb(255 120 60 / 0.8) 0 1.5px, transparent 4px);
}

.planet[data-species="insectoid"] .planet__layer {
  background:
    radial-gradient(circle at 58% 64%, rgb(190 255 120 / 0.85) 0 1.5px, transparent 3px),
    radial-gradient(circle at 64% 70%, rgb(190 255 120 / 0.85) 0 1.5px, transparent 3px),
    radial-gradient(circle at 70% 64%, rgb(190 255 120 / 0.85) 0 1.5px, transparent 3px),
    radial-gradient(circle at 64% 58%, rgb(190 255 120 / 0.85) 0 1.5px, transparent 3px),
    radial-gradient(circle at 64% 64%, rgb(190 255 120 / 0.35) 0 4px, transparent 12px);
}

/* Orbitalring: vordere Hälfte über dem Planeten, hintere Hälfte (.planet__ring) dahinter. */
.planet[data-species="synthetic"] .planet__layer,
.planet[data-species="synthetic"] .planet__ring {
  inset: 38% -30%;
  border-radius: 50%;
  border: 3px solid rgb(180 220 255 / 0.8);
  transform: rotate(-14deg);
}

.planet[data-species="synthetic"] .planet__layer {
  border-top-color: transparent;
}

.planet__ring {
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.planet[data-species="synthetic"] .planet__ring {
  border-bottom-color: transparent;
  opacity: 0.55;
}

.planet[data-homeworld="ice"] {
  --core: #7fb8d9;
  --light: #f1fbff;
  --deep: #2b4f73;
  --surface: rgb(255 255 255 / 0.55);
  /* Eis: Polkappen oben und unten. */
  --land:
    radial-gradient(ellipse 46% 16% at 50% 4%, var(--surface) 0 60%, transparent 80%),
    radial-gradient(ellipse 40% 14% at 50% 96%, var(--surface) 0 60%, transparent 80%);
}
.planet[data-homeworld="desert"] {
  --core: #d98c3f;
  --light: #ffe1a8;
  --deep: #6b2e12;
  --surface: rgb(120 50 10 / 0.3);
  /* Wüste: lange, flache Dünenbänder. */
  --land:
    radial-gradient(ellipse 60% 6% at 46% 40%, var(--surface) 0 50%, transparent 80%),
    radial-gradient(ellipse 54% 5% at 52% 56%, var(--surface) 0 50%, transparent 80%),
    radial-gradient(ellipse 44% 5% at 48% 72%, var(--surface) 0 50%, transparent 80%);
}
.planet[data-homeworld="forest"] {
  --core: #3f9b5c;
  --light: #b8f0a0;
  --deep: #123d2a;
  --surface: rgb(20 60 30 / 0.5);
  /* Wald: zwei große zusammenhängende Landmassen. */
  --land:
    radial-gradient(ellipse 30% 26% at 34% 46%, var(--surface) 0 58%, transparent 74%),
    radial-gradient(ellipse 24% 30% at 66% 64%, var(--surface) 0 58%, transparent 74%);
}

/* ---------- Felder ---------- */
.field {
  display: grid;
}

.field__label {
  display: block;
  padding: 0;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field__input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-field);
  border: 1.5px solid var(--panel-edge);
  background: var(--panel);
  color: var(--text);
  font: 600 18px var(--font-ui);
  caret-color: var(--gold-400);
  transition: border-color 160ms var(--ease-out);
}

.field__input::placeholder {
  color: #7f95bd;
  font-weight: 400;
}

.field__input:focus-visible {
  outline: none;
  border-color: var(--blue-300);
  box-shadow: 0 0 0 3px rgb(140 200 255 / 0.3);
}

.field__input[aria-invalid="true"] {
  border-color: var(--bad);
}

.field__hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.field__hint--error {
  color: var(--bad);
}

/* ---------- Chips (Radio-Buttons) ---------- */
.field {
  margin: 0 0 4px;
}

.chips {
  border: 1px solid var(--panel-edge);
  border-radius: 20px;
  margin: 0;
  padding: 12px 12px 14px;
  min-width: 0;
  background: linear-gradient(rgb(23 50 94 / 0.55), rgb(10 22 46 / 0.65));
  box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.7);
}

.chips > legend {
  float: left;
  width: 100%;
}

.chips > legend + * {
  clear: both;
}

.chips__list {
  display: grid;
  grid-template-columns: repeat(var(--columns, 2), minmax(0, 1fr));
  gap: 8px;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 12px;
  text-align: center;
  border-radius: var(--radius-chip);
  border: 1.5px solid var(--panel-edge);
  background: var(--panel);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition:
    background 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.chip:active {
  transform: scale(0.96);
}

.chip__input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.chip:has(.chip__input:checked) {
  background: linear-gradient(var(--blue-500), var(--blue-600));
  border-color: var(--blue-300);
  color: #fff;
  box-shadow: 0 3px 0 #0d3f86;
}

.chip:has(.chip__input:focus-visible) {
  outline: 3px solid var(--blue-300);
  outline-offset: 2px;
}

/* Eigenschaften als breite Karten: Name links, Wirkung rechts. */
.chip--card:not(:has(.chip__input:checked)) {
  background: transparent;
  border-color: transparent;
}

.chip--card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  min-height: 58px;
  padding: 8px 16px;
  border-radius: var(--radius-field);
  text-align: left;
}

.chip--card .effects {
  flex-direction: column;
  align-items: flex-end;
}

.chip:has(.chip__input:checked) .effect--good {
  color: #c3ffcf;
}

.chip:has(.chip__input:checked) .effect--bad {
  color: #ffd1d1;
}

@media (max-width: 359px) {
  .chips__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chips__list--cards {
    grid-template-columns: minmax(0, 1fr);
  }
  .chip--card {
    grid-template-columns: 1fr;
    padding-block: 10px;
  }
  .chip--card .effects {
    flex-direction: row;
    justify-content: flex-start;
  }
}

.effects {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px 10px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.effect--good {
  color: var(--good);
}

.effect--bad {
  color: var(--bad);
}

/* ---------- Knöpfe: dicke Unterkante als 3D-Andeutung ---------- */
.button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.button--primary {
  height: 60px;
  border-radius: var(--radius-button);
  background: linear-gradient(var(--gold-400), var(--gold-500));
  color: var(--ink-on-gold);
  font-size: 21px;
  box-shadow:
    0 6px 0 var(--gold-800),
    0 14px 24px -6px rgb(0 0 0 / 0.55);
  transform: translateY(0);
  transition:
    transform 90ms var(--ease-out),
    box-shadow 90ms var(--ease-out),
    filter 160ms var(--ease-out);
}

.button--primary:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow:
    0 1px 0 var(--gold-800),
    0 6px 14px -6px rgb(0 0 0 / 0.55);
}

.button--primary:disabled {
  cursor: progress;
  filter: saturate(0.4) brightness(0.85);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
  }
}

/* ---------- Heimatwelt ---------- */
.home {
  max-width: 440px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) var(--gutter) max(28px, env(safe-area-inset-bottom));
  display: grid;
  gap: 16px;
}

.home__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.home__header > div {
  min-width: 0;
  flex: 1 1 180px;
}

.home__header .button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 15px;
  white-space: nowrap;
}

.logo--small {
  font-size: 15px;
  white-space: nowrap;
  -webkit-text-stroke: 2px var(--space-950);
}

.logo--small::after {
  max-width: 48px;
  height: 6px;
}

.home__name {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.1;
  color: #fff;
  -webkit-text-stroke: 4px var(--space-950);
  paint-order: stroke fill;
  overflow-wrap: anywhere;
}

.home__section {
  display: grid;
  gap: 8px;
}

.home__section-title {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Ressourcenleiste */
.resources {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.resource {
  display: grid;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  font-variant-numeric: tabular-nums;
}

.resource--workforce {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
}

.resource--workforce .resource__rate {
  color: var(--text-muted);
}

.resource__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.resource__amount {
  font-size: 19px;
  font-weight: 700;
}

.resource__rate {
  font-size: 12px;
  color: var(--good);
}

/* Guide: Platzhalter-Figur plus Sprechblase */
.guide {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: start;
}

.guide__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px dashed var(--panel-edge-strong);
  /* Neutrale Silhouette (Kopf und Schultern) als Platzhalter für die spätere Figur. */
  background:
    radial-gradient(circle at 50% 38%, var(--space-700) 0 22%, transparent 23%),
    radial-gradient(ellipse 46% 30% at 50% 92%, var(--space-700) 0 98%, transparent 100%),
    var(--space-900);
}

.guide__bubble {
  position: relative;
  padding: 12px 14px;
  border-radius: 4px 18px 18px 18px;
  background: #f4f7ff;
  color: #13203d;
  box-shadow: 0 10px 22px -12px rgb(0 0 0 / 0.7);
}

.guide__name {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--blue-600);
}

.guide__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.guide__error {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #b42318;
}

/* Gebäude-, Forschungs- und Schiffskarten */
.item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid var(--panel-edge);
  background: linear-gradient(rgb(23 50 94 / 0.55), rgb(10 22 46 / 0.65));
  box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.7);
}

.item--guided {
  border-color: var(--gold-400);
  box-shadow:
    0 0 0 1px var(--gold-400),
    0 10px 24px -14px rgb(0 0 0 / 0.7);
}

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

.item__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.item__level {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-300);
}

.item__info,
.item__done {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.item__done {
  color: var(--good);
  font-weight: 700;
}

.item__note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.item__note--locked {
  margin-top: 4px;
  font-weight: 700;
  color: var(--blue-300);
}

.item__note svg {
  flex: none;
}

.item__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.item__cost {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cost--missing {
  color: var(--bad);
}

.cost--time {
  color: var(--text-muted);
}

/* Fortschritt eines laufenden Auftrags */
.progress {
  display: grid;
  gap: 4px;
}

.progress__bar {
  --share: 0;
  display: block;
  height: 10px;
  border-radius: 5px;
  background:
    linear-gradient(90deg, var(--blue-500), var(--blue-300)) 0 0 / calc(var(--share) * 100%) 100%
      no-repeat,
    rgb(255 255 255 / 0.1);
}

.progress--paused .progress__bar {
  filter: grayscale(1);
  opacity: 0.6;
}

.order {
  display: grid;
  gap: 8px;
}

.order__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.order__crew {
  font-size: 13px;
  color: var(--text-muted);
}

.progress__time {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-300);
  font-variant-numeric: tabular-nums;
}

/* Kleinere Knöpfe auf Karten; der vom Guide gemeinte ist golden (Goldregel). */
.button--action,
.button--secondary {
  flex: none;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(var(--blue-500), var(--blue-600));
  box-shadow: 0 4px 0 #0d3f86;
  transition:
    transform 90ms var(--ease-out),
    box-shadow 90ms var(--ease-out);
}

.button--secondary {
  background: var(--panel);
  border: 1.5px solid var(--panel-edge-strong);
  box-shadow: 0 4px 0 rgb(0 0 0 / 0.45);
}

.button--gold {
  background: linear-gradient(var(--gold-400), var(--gold-500));
  color: var(--ink-on-gold);
  box-shadow: 0 4px 0 var(--gold-800);
}

.button--action:active:not(:disabled),
.button--secondary:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.45);
}

.button--secondary:disabled,
.button--danger:disabled,
.button--action:disabled {
  cursor: not-allowed;
  background: rgb(255 255 255 / 0.08);
  color: #7f95bd;
  box-shadow: none;
}

/* Funkspruch: hebt sich als einzige Karte mit Warnkante ab */
.radio {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  border: 2px solid var(--bad);
  background: var(--panel);
}

.radio__label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bad);
}

.radio__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
}

.radio__text,
.radio__risk,
.radio__deadline {
  margin: 0;
}

.radio__deadline {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-300);
  font-variant-numeric: tabular-nums;
}

.radio__risk {
  font-size: 13px;
  color: var(--text-muted);
}

.radio__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* Riskante Aktion (Angreifen): bad-Ton mit dunkler Schrift für ausreichenden Kontrast. */
.radio__actions .button {
  padding: 0 8px;
}

.button--danger {
  background: var(--bad);
  color: var(--ink-on-gold);
  box-shadow: 0 4px 0 rgb(0 0 0 / 0.45);
}

.sheet__subheading {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bad);
}

/* Auswahl der Standardantwort */
.response {
  display: grid;
  gap: 4px;
}

.response__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.response__select {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1.5px solid var(--panel-edge-strong);
  background: var(--space-900);
  color: inherit;
  font: inherit;
}

.response__select:focus-visible {
  outline: 3px solid var(--blue-300);
  outline-offset: 2px;
}

/* Späherberichte unter den Zielen */
.reports__title {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.reports {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 14px;
}

.report--empty {
  color: var(--text-muted);
}

/* Erkundungsziele */
.targets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.target__label {
  display: grid;
}

.target__name {
  font-weight: 700;
}

.target__status {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.target__status--done {
  color: var(--blue-300);
  font-weight: 700;
}

/* ---------- Menüleiste ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px max(4px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom));
  background: var(--space-950);
  border-top: 1px solid var(--panel-edge);
  box-shadow: 0 -12px 24px -12px rgb(0 0 0 / 0.6);
}

.tabbar__tab {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 52px;
  padding: 6px 4px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: var(--text-muted);
  font: 600 11px var(--font-ui);
  min-width: 0;
  cursor: pointer;
}

.tabbar__tab[aria-current="page"] {
  color: #fff;
  background: rgb(47 143 255 / 0.18);
}

.tabbar__tab[aria-current="page"] svg {
  color: var(--blue-300);
}

.tabbar__dot {
  position: absolute;
  top: 6px;
  right: calc(50% - 20px);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold-400);
  border: 2px solid var(--space-950);
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity 200ms var(--ease-out),
    transform 200ms var(--ease-out);
}

.tabbar__tab--hint .tabbar__dot {
  opacity: 1;
  transform: scale(1);
}

/* Platz für die Menüleiste unter scrollenden Bildschirmen */
body[data-screen="home"] .home,
body[data-screen="build"] .home,
body[data-screen="fleet"] .home,
body[data-screen="settings"] .home,
body[data-screen="research"] .research {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.screen-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 7vw, 32px);
  color: #fff;
  -webkit-text-stroke: 4px var(--space-950);
  paint-order: stroke fill;
}

.screen-intro {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
}

/* ---------- Forschungsbaum ---------- */
.research {
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) var(--gutter) 0;
  display: grid;
  gap: 12px;
}

.tree {
  position: relative;
  display: grid;
  gap: 36px;
  margin-top: 8px;
}

.tree__lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.tree__line,
.tree__line--later {
  fill: none;
  stroke-width: 2;
}

.tree__line {
  stroke: var(--blue-300);
}

.tree__line--later {
  stroke: var(--panel-edge-strong);
  stroke-dasharray: 4 5;
}

.tree__tier {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--count, 3), minmax(0, 1fr));
  gap: 8px;
}

/* Schmale Baumknoten: Arbeitskraft und Pausieren untereinander. */
.node .order__footer {
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}

.node {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px 10px;
  border-radius: 16px;
  border: 1px solid var(--panel-edge);
  background: linear-gradient(rgb(23 50 94 / 0.85), rgb(10 22 46 / 0.95));
  box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.7);
  text-align: center;
}

.node__badge {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--space-800);
  color: var(--blue-300);
}

.node__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  hyphens: auto;
  overflow-wrap: break-word;
}

.node__text {
  margin: 0;
  hyphens: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.node__status {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-300);
  /* Lange Voraussetzungen („Forschungslabor Stufe 2“) passen auch in schmale Knoten. */
  hyphens: auto;
  overflow-wrap: break-word;
}

.node--done .node__badge {
  background: rgb(105 219 124 / 0.18);
  color: var(--good);
}

.node--done .node__status {
  color: var(--good);
}

.node--later,
.node--locked {
  border-style: dashed;
  background: rgb(10 22 46 / 0.75);
}

.node--later .node__title,
.node--later .node__badge {
  color: #7f95bd;
}

.node--later .node__status,
.node--locked .node__status {
  color: #7f95bd;
}

.node--guided {
  border-color: var(--gold-400);
  box-shadow:
    0 0 0 1px var(--gold-400),
    0 10px 24px -14px rgb(0 0 0 / 0.7);
}

.node .item__cost {
  justify-content: center;
}

.node .button {
  margin-top: 6px;
  justify-self: center;
}

/* ---------- Galaxie-Bildschirm ---------- */
.map-screen {
  position: fixed;
  inset: 0 0 calc(66px + env(safe-area-inset-bottom));
}

.map-screen__canvas {
  position: absolute;
  inset: 0;
}

.map-controls {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(var(--gutter), env(safe-area-inset-right));
  display: grid;
  gap: 8px;
}

.map-controls__button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1.5px solid var(--panel-edge-strong);
  background: rgb(15 33 66 / 0.92);
  color: #fff;
  box-shadow: 0 4px 0 rgb(0 0 0 / 0.45);
  cursor: pointer;
}

.map-controls__button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.45);
}

.sheet {
  position: absolute;
  left: max(var(--gutter), env(safe-area-inset-left));
  right: max(var(--gutter), env(safe-area-inset-right));
  bottom: 12px;
  max-width: 440px;
  margin: 0 auto;
  padding: 14px 16px 16px;
  border-radius: 20px;
  border: 1px solid var(--panel-edge);
  background: linear-gradient(rgb(23 50 94 / 0.94), rgb(10 22 46 / 0.97));
  box-shadow: 0 16px 30px -12px rgb(0 0 0 / 0.75);
  display: grid;
  gap: 10px;
}

.sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.sheet__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.1;
  color: var(--gold-400);
  -webkit-text-stroke: 3px var(--space-950);
  paint-order: stroke fill;
}

.sheet__subtitle,
.sheet__text,
.sheet__note {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

.sheet__error {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--bad);
}

.sheet__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--panel-edge);
  background: var(--space-900);
  color: var(--text-muted);
  cursor: pointer;
}

.sheet__action {
  width: 100%;
}

.facts {
  margin: 0;
  display: grid;
  gap: 4px;
}

.facts__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.facts dt {
  color: var(--text-muted);
}

.facts dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .tabbar__dot {
    transition: none;
  }
}

/* Zahnrad in der Kopfzeile der Übersicht und Bereichsname in den anderen Bereichen */
.home__gear {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1.5px solid var(--panel-edge);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
}

.home__gear:focus-visible {
  outline: 3px solid var(--blue-300);
  outline-offset: 2px;
}

.home__view {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-300);
}

/* Anmeldung: nutzt das Editor-Layout, darunter der Wechsel zwischen Anmelden und Konto anlegen */
.login__toggle {
  min-height: 44px;
  margin-top: 4px;
  border: 0;
  background: none;
  color: var(--blue-300);
  font: 600 14px var(--font-ui);
  text-decoration: underline;
  cursor: pointer;
}

.admin__check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 8px;
  font-weight: 600;
}

.admin__check input {
  width: 22px;
  height: 22px;
  accent-color: var(--blue-500);
}

/* Anomalien: je Erscheinung ein abgesetzter Block */
.anomaly {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-edge);
}

.anomaly:first-of-type {
  padding-top: 0;
  border-top: 0;
}

/* Kampftaktik: drei Auswahlfelder untereinander */
.tactics {
  display: grid;
  gap: 10px;
}

/* Belohnung bereit: goldene Kante, damit sie auffällt */
.item--reward {
  border-color: var(--gold-400);
  box-shadow:
    0 0 0 1px rgb(255 201 74 / 0.35),
    0 10px 30px -12px rgb(255 201 74 / 0.45);
}

/* Saison-Uhr: fünf Phasen als Leiste */
.season__label {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue-300);
}

.season__steps {
  list-style: none;
  margin: 4px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.season__step {
  height: 8px;
  border-radius: 4px;
  background: var(--space-700);
}

.season__step--done {
  background: var(--blue-500);
}

.season__step--now {
  background: var(--gold-400);
}

/* ARCHON: Fragmente untereinander, je mit Teilen */
.fragment {
  display: grid;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-edge);
}

/* Schmale Baumknoten (drei je Reihe auf dem Handy): nichts ragt über die Karte hinaus. */
.node {
  min-width: 0;
}

.node .item__cost {
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 8px;
}

.node .button {
  width: 100%;
  min-width: 0;
  padding-inline: 4px;
  font-size: 13px;
  white-space: nowrap;
}

/* Konto und Feedback in den Einstellungen */
.account__form {
  display: grid;
  gap: 10px;
}

.account__text {
  min-height: 96px;
  resize: vertical;
  font: inherit;
}

/* Admin: Einladungen, Spieler, Feedback */
.admin__row,
.admin__player {
  display: grid;
  gap: 6px;
}

.admin__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.admin__danger {
  color: var(--bad);
}

.admin__notice {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--gold-400);
  background: rgb(255 201 74 / 0.08);
}

.admin__code {
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-400);
  user-select: all;
}

.admin__feedback {
  display: grid;
  gap: 10px;
}

.admin__entry {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--panel-edge);
}

.admin__text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Auswahlfelder nie breiter als ihr Platz (lange Optionen würden sonst die Seite verbreitern). */
.response,
.field {
  min-width: 0;
}

.response__select {
  min-width: 0;
  max-width: 100%;
}
