/* Ozean-Entsalzer – Stil von Hand, ohne Framework.
   Farbwelt: Hafenbehörde. Dunkles Meerblau für die Bedienung, Papier für Memos, Signalgelb für Aktionen. */
:root {
  --tinte: #17252e;
  --papier: #fbf7ee;
  --papier-2: #f1ead9;
  --linie: #d4c9b0;
  --meer: #1f5f7a;
  --meer-tief: #0e2c3d;
  --meer-nacht: #0a1f2b;
  --panel: #13394d;
  --panel-2: #194a63;
  --panel-linie: #2b6280;
  --text-hell: #eef4f6;
  --text-matt: #a9c3cf;
  --gelb: #ffd54a;
  --gelb-dunkel: #e8b81f;
  --gruen: #5ac878;
  --rot: #e0574c;
  --orange: #e8932c;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tinte);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
button { font: inherit; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ Knöpfe */
.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--panel-linie);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text-hell);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  transition: background 0.12s, transform 0.06s;
}
.knopf:hover:not(:disabled) { background: #22607f; }
.knopf:active:not(:disabled) { transform: translateY(1px); }
.knopf:disabled { opacity: 0.45; cursor: not-allowed; }
.knopf.aktiv { background: var(--gelb); color: var(--tinte); border-color: var(--gelb-dunkel); }
.knopf.kauf { background: var(--gelb); color: var(--tinte); border-color: var(--gelb-dunkel); font-weight: 600; }
.knopf.kauf:hover:not(:disabled) { background: #ffe07a; }
.knopf.gefahr { background: transparent; border-color: #9c4a42; color: #ffb3a8; }
.knopf.gefahr:hover:not(:disabled) { background: #5a2722; }
.knopf.gross { padding: 0.65rem 1.1rem; font-size: 1.02rem; }
.knopf.klein { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
:focus-visible { outline: 2px solid var(--gelb); outline-offset: 2px; }

/* ------------------------------------------------------------------ Startseite */
body.landing {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 1.5rem;
  background:
    repeating-linear-gradient(170deg, transparent 0 22px, rgb(255 255 255 / 0.035) 22px 24px),
    linear-gradient(180deg, var(--meer) 0%, var(--meer-tief) 100%);
}
.memo {
  max-width: 36rem;
  padding: 2rem 2.25rem;
  background: var(--papier);
  border: 1px solid var(--linie);
  box-shadow: 0 14px 44px rgb(0 0 0 / 0.38);
  line-height: 1.55;
  color: var(--tinte);
}
.memo h1 { margin: 0.25rem 0 1rem; font-size: 1.9rem; letter-spacing: 0.01em; }
.memo h2 { margin: 0.4rem 0 0.9rem; font-size: 1.15rem; line-height: 1.35; }
.memo h2 .lbl { font-weight: 400; color: #6b6150; }
.memo-kopf, .memo-fuss {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b6150;
}
.memo-fuss { margin-top: 1.5rem; border-top: 1px dashed var(--linie); padding-top: 0.75rem; }
.memo .aktion { margin: 1.5rem 0 0.5rem; }
.memo .knopf.gross { background: var(--meer); border-color: var(--meer-tief); }
.memo .knopf.gross:hover { background: #26718f; }
.memo .knopf.kauf { background: var(--gelb); color: var(--tinte); border-color: var(--gelb-dunkel); }
.memo .frei { background: var(--papier-2); padding: 0.5rem 0.7rem; border-left: 3px solid var(--gelb-dunkel); }
.memo-unterschrift { font-style: italic; color: #6b6150; margin-top: 1.2rem; }
.hinweis { padding: 0.6rem 0.8rem; background: #e7f1f5; border-left: 3px solid var(--meer); }
.hinweis.fehler { background: #fbe9e6; border-left-color: var(--rot); }

/* ------------------------------------------------------------------ Spiel: Raster-Layout */
body.spiel {
  --seite: 52px;
  background: var(--meer-nacht);
  color: var(--text-hell);
  overflow: hidden;
  overscroll-behavior: none;
}
body.spiel.seite-offen { --seite: 230px; }
#app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--seite) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "kopf kopf" "seite karte";
}
#kopf { grid-area: kopf; }
#seite { grid-area: seite; }
#karte-wrap { grid-area: karte; }

/* Kopfleiste */
#kopf {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.45rem 0.8rem;
  background: var(--meer-tief);
  border-bottom: 1px solid #0a2230;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.3);
  z-index: 8;
}
.marke { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.logo { width: 26px; height: 26px; border-radius: 6px; background: url("/favicon.svg") center / cover; }
.werte { display: flex; gap: 0.35rem 1.1rem; flex: 1; flex-wrap: wrap; align-items: center; min-width: 0; }
.wert { display: grid; grid-template-columns: auto; line-height: 1.15; min-width: 4.5rem; }
.wert .lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-matt); }
.wert b { font-size: 1.02rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wert small { font-size: 0.72rem; color: var(--text-matt); font-variant-numeric: tabular-nums; white-space: nowrap; }
#w-geld b { color: var(--gelb); }
.wert.lager { min-width: 8.5rem; }
.wert.voll .balken i { background: var(--rot); }
.wert.voll small { color: #ffb3a8; }
.wert.warnung b { color: var(--orange); }
.balken { height: 7px; background: rgb(255 255 255 / 0.12); border-radius: 4px; overflow: hidden; margin: 3px 0 2px; }
.balken i { display: block; height: 100%; width: 0; background: #4ea6cf; border-radius: 4px; transition: width 0.25s; }
.knopf.verkaufen {
  flex-direction: column;
  gap: 0;
  min-width: 8.5rem;
  background: var(--gelb);
  color: var(--tinte);
  border-color: var(--gelb-dunkel);
  font-weight: 700;
  padding: 0.35rem 0.9rem;
}
.knopf.verkaufen small { font-weight: 400; font-size: 0.74rem; }
.knopf.verkaufen:hover:not(:disabled) { background: #ffe07a; }

/* Menü-Knöpfe oben (öffnen die Fenster über der Karte) */
.menue { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: rgb(0 0 0 / 0.22); }
.menue-knopf {
  padding: 0.4rem 0.7rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-matt);
  cursor: pointer;
  font-size: 0.88rem;
  white-space: nowrap;
}
.menue-knopf:hover { color: var(--text-hell); background: rgb(255 255 255 / 0.08); }
.menue-knopf.aktiv { background: var(--panel-2); color: var(--text-hell); box-shadow: inset 0 -2px 0 var(--gelb); }

/* Freies Spiel */
.frei-box { position: relative; display: flex; align-items: center; gap: 0.4rem; }
.frei-marke {
  padding: 0.2rem 0.5rem;
  border: 1px dashed var(--orange);
  border-radius: 5px;
  color: #ffc98a;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.geld-menue {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 0.35rem;
  min-width: 13rem;
  padding: 0.6rem;
  border: 1px solid var(--panel-linie);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.45);
}
.geld-menue .lbl { margin: 0 0 0.1rem; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-matt); }
.geld-menue .knopf { justify-content: flex-start; }

/* Seitenleiste: schmale Pegelsäule, ausklappbar zum Querschnitt */
#seite {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #0c2433;
  border-right: 1px solid #0a1c27;
  min-height: 0;
  min-width: 0;
  z-index: 6;
}
.seite-griff {
  flex: none;
  height: 30px;
  border: 0;
  border-bottom: 1px solid #1b3d50;
  background: #0f2d3f;
  color: var(--text-matt);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.seite-griff:hover { color: var(--text-hell); background: #143a50; }
.seite-griff span { display: inline-block; transition: transform 0.2s; }
body.seite-offen .seite-griff span { transform: rotate(180deg); }
#schnitt { flex: 1; width: 100%; min-height: 0; display: block; cursor: pointer; }
body.seite-offen #schnitt { cursor: default; }
#zoneninfo { display: none; padding: 0.7rem 0.8rem 0.9rem; border-top: 1px solid #1b3d50; font-size: 0.86rem; }
body.seite-offen #zoneninfo { display: block; }
#zoneninfo p { margin: 0.15rem 0; }
.zone-jetzt { display: grid; }
.zone-jetzt .lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-matt); }
.zone-naechst { color: var(--text-matt); }
.zone-balken i { background: var(--gelb); }

/* Karte */
#karte-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #0b2232; }
#karte { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
body[data-modus="schoepfen"] #karte { cursor: default; }
.laden {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-matt); background: var(--meer-nacht); font-size: 1.05rem;
}

/* Schnellleiste unten: Hand (schöpfen), kürzlich gebaute Gebäude, Bauinventar */
.leiste {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: stretch;
  gap: 4px;
  max-width: calc(100% - 24px);
  padding: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgb(10 31 43 / 0.9);
  border: 1px solid #23536c;
  border-radius: 12px;
  backdrop-filter: blur(4px);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.35);
}
.leiste .trenner { flex: none; width: 1px; background: #23536c; margin: 6px 2px; }
.slot {
  position: relative;
  flex: none;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1px;
  width: 58px;
  height: 58px;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: rgb(255 255 255 / 0.05);
  color: var(--text-hell);
  cursor: pointer;
}
.slot:hover:not(:disabled) { background: rgb(255 255 255 / 0.12); }
.slot.aktiv { border-color: var(--gelb); background: rgb(255 213 74 / 0.16); box-shadow: inset 0 0 0 1px var(--gelb); }
.slot:disabled { opacity: 0.35; cursor: not-allowed; }
.slot .ikon { width: 34px; height: 34px; pointer-events: none; }
.slot-name, .slot-preis { font-size: 0.64rem; line-height: 1; white-space: nowrap; color: var(--text-matt); }
.slot-preis { color: var(--gelb); font-variant-numeric: tabular-nums; }
.slot.teuer .slot-preis { color: #ff9c8f; }
.slot .taste {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.62rem;
  color: var(--text-matt);
}

.hinweiszeile {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 4;
  max-width: min(92%, 720px);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  background: rgb(10 31 43 / 0.72);
  color: var(--text-matt);
  font-size: 0.8rem;
  text-align: center;
  pointer-events: none;
}
.hinweiszeile:empty { display: none; }

/* Bauinventar */
.inventar {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  width: min(820px, calc(100% - 24px));
  height: min(460px, calc(100% - 110px));
  background: var(--panel);
  border: 1px solid var(--panel-linie);
  border-radius: 12px;
  box-shadow: 0 16px 44px rgb(0 0 0 / 0.5);
  overflow: hidden;
  animation: auf 0.14s ease-out;
}
@keyframes auf { from { opacity: 0; transform: translate(-50%, 8px); } }
.inv-kopf { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.8rem; border-bottom: 1px solid #0d2c3c; background: #0f3244; }
.inv-koerper { flex: 1; min-height: 0; display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 15.5rem; }
.inv-kat { display: flex; flex-direction: column; gap: 2px; padding: 0.5rem; border-right: 1px solid #0d2c3c; background: #10364a; overflow-y: auto; }
.kat {
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-matt);
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
}
.kat:hover { color: var(--text-hell); background: rgb(255 255 255 / 0.06); }
.kat.aktiv { color: var(--tinte); background: var(--gelb); font-weight: 600; }
.inv-raster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  grid-auto-rows: max-content;
  gap: 6px;
  padding: 0.6rem;
  overflow-y: auto;
  align-content: start;
}
.feld {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 0.45rem 0.3rem 0.4rem;
  border: 1px solid #275a74;
  border-radius: 9px;
  background: #174559;
  color: var(--text-hell);
  cursor: pointer;
}
.feld:hover { background: #1d5370; }
.feld.gewaehlt { border-color: var(--gelb); box-shadow: inset 0 0 0 1px var(--gelb); }
.feld.in-hand { background: #22607f; }
.feld.gesperrt .feld-bild .ikon { filter: grayscale(1) brightness(0.55); }
.feld.gesperrt .feld-name { color: var(--text-matt); }
.feld-bild { position: relative; width: 48px; height: 48px; }
.feld-bild .ikon { width: 48px; height: 48px; }
.feld-bild .schloss { position: absolute; right: -6px; bottom: -4px; width: 24px; height: 24px; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.6)); }
.feld-name { font-size: 0.74rem; line-height: 1.15; text-align: center; overflow-wrap: anywhere; hyphens: auto; }
.feld-preis { font-size: 0.72rem; color: var(--gelb); font-variant-numeric: tabular-nums; min-height: 0.9em; }
.feld.teuer .feld-preis { color: #ff9c8f; }
.inv-info { padding: 0.7rem 0.85rem; border-left: 1px solid #0d2c3c; overflow-y: auto; background: #123c52; }
.inv-info h3 { margin: 0.3rem 0 0.2rem; font-size: 1.05rem; }
.inv-info p { margin: 0.2rem 0 0.5rem; font-size: 0.85rem; line-height: 1.4; color: var(--text-matt); }
.info-bild { display: grid; place-items: center; height: 84px; border-radius: 9px; background: rgb(0 0 0 / 0.18); }
.info-bild .gross { width: 72px; height: 72px; }
.fakten { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.6rem; margin: 0.4rem 0 0.7rem; font-size: 0.82rem; }
.fakten dt { color: var(--text-matt); }
.fakten dd { margin: 0; font-variant-numeric: tabular-nums; }
.inv-aktion { display: grid; gap: 0.4rem; }
.sperre { display: flex; align-items: center; gap: 0.3rem; color: #ffc9b8 !important; font-size: 0.84rem !important; }
img.mini { width: 20px; height: 20px; }
.inv-fuss { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.35rem 0.8rem; border-top: 1px solid #0d2c3c; background: #0f3244; }

/* Info-Karte und Ereignis */
.info, .ereignis {
  position: absolute;
  z-index: 6;
  max-width: 300px;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}
.info { left: 12px; top: 12px; background: rgb(15 45 61 / 0.95); border: 1px solid #2b6280; }
.info p { margin: 0.35rem 0; }
.info-kopf { display: flex; align-items: center; gap: 0.45rem; }
.info-kopf b { flex: 1; }
.puffer { margin: 0.45rem 0 0.55rem; padding: 0.45rem 0.55rem; border-radius: 7px; background: rgb(0 0 0 / 0.2); }
.puffer-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.puffer-kopf .lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-matt); }
.puffer-modus { font-size: 0.8rem; text-align: right; }
.puffer-modus.liefert { color: var(--gruen); }
.puffer-modus.speichert { color: var(--orange); }
.puffer-modus.voll { color: #ff8a7a; }
.puffer-modus.leer { color: var(--text-matt); }
.puffer-zeile { display: grid; grid-template-columns: 6.5rem 1fr auto; align-items: center; gap: 0.5rem; margin-top: 0.3rem; font-size: 0.8rem; }
.puffer-zeile .balken { margin: 0; }
.puffer-zeile small { color: var(--text-matt); font-variant-numeric: tabular-nums; white-space: nowrap; }
.balken i.liefert { background: var(--gruen); }
.balken i.speichert { background: var(--orange); }
.balken i.voll { background: var(--rot); }
.zu { border: 0; background: transparent; color: var(--text-hell); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 0.2rem; }
.ereignis { right: 12px; top: 12px; background: var(--papier); color: var(--tinte); border: 1px solid var(--linie); }
.ereignis p { margin: 0.3rem 0; }
.ereignis .balken { background: var(--papier-2); }
.ereignis .balken i { background: var(--meer); }

/* Menüfenster (Betrieb, Forschung, Logistik, Optionen) – schwebt rechts über der Karte */
.panel {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100% - 20px));
  background: var(--panel);
  border: 1px solid var(--panel-linie);
  border-radius: 12px;
  box-shadow: 0 16px 44px rgb(0 0 0 / 0.5);
  overflow: hidden;
  animation: rein 0.14s ease-out;
}
@keyframes rein { from { opacity: 0; transform: translateX(10px); } }
.panel-kopf { display: flex; align-items: stretch; border-bottom: 1px solid #0d2c3c; background: #0f3244; }
.panel-kopf .zu { padding: 0 0.7rem; }
.panel-titel { flex: 1; margin: 0; padding: 0.6rem 0.9rem; font-size: 0.95rem; font-weight: 600; color: var(--text-hell); }
#inhalt { flex: 1; overflow-y: auto; padding: 0.4rem 0.8rem 1.5rem; overscroll-behavior: contain; }
.block { padding: 0.75rem 0 0.9rem; border-bottom: 1px solid #1f4d64; }
.block:last-child { border-bottom: 0; }
.block h3 { margin: 0 0 0.55rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-matt); }
.block p { margin: 0.4rem 0; line-height: 1.45; font-size: 0.9rem; }
.block.hervor { background: rgb(255 213 74 / 0.08); margin: 0.5rem -0.8rem; padding: 0.75rem 0.8rem; border: 1px solid rgb(255 213 74 / 0.3); border-radius: 0; }
.klein { font-size: 0.8rem !important; color: var(--text-matt); }
.zeile { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.zeile.rechts { justify-content: flex-end; margin-top: 1rem; }
.fertig { color: var(--gruen); font-size: 0.85rem; }

table.liste { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.liste th { text-align: left; font-weight: 500; color: var(--text-matt); font-size: 0.74rem; padding: 0.2rem 0.3rem; }
.liste td { padding: 0.3rem; border-top: 1px solid #1f4d64; }
.liste .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.liste .mitte { text-align: center; }
.liste input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--gelb); }

.stufe { display: grid; gap: 0.35rem; padding: 0.55rem 0; border-top: 1px solid #1f4d64; }
.stufe:first-of-type { border-top: 0; }
.stufe > div:first-child { display: grid; }
.stufe .lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-matt); }
.stufe small { color: var(--text-matt); font-size: 0.8rem; }
.naechste { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.4rem; }

.aeste { display: grid; gap: 0.6rem; padding-top: 0.6rem; }
.ast h3 { margin: 0.4rem 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-matt); }
.forschung {
  display: grid;
  gap: 0.25rem;
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.35rem;
  border-radius: 7px;
  background: #174559;
  border: 1px solid #275a74;
  border-left-width: 4px;
}
.forschung small { color: var(--text-matt); font-size: 0.8rem; }
.forschung.fertig { border-left-color: var(--gruen); }
.forschung.offen { border-left-color: var(--gelb); }
.forschung.gesperrt { opacity: 0.6; }
.forschung .knopf { justify-self: start; }

.schiffe { display: grid; gap: 0.5rem; margin-top: 0.6rem; }
.schiff { display: grid; gap: 0.1rem; }
.schiff small { color: var(--text-matt); font-size: 0.8rem; }

.schalter { display: flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0; cursor: pointer; font-size: 0.92rem; }
.schalter input { width: 1.05rem; height: 1.05rem; accent-color: var(--gelb); }
.inv-fuss .schalter { font-size: 0.84rem; }
.block.debug { border: 1px dashed var(--orange) !important; padding: 0.6rem !important; margin-top: 0.6rem; }

/* Memo-Fenster */
.memo-huelle {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(5 15 22 / 0.6);
  backdrop-filter: blur(2px);
}
.memo-huelle .memo { width: min(36rem, 100%); max-height: 90vh; overflow-y: auto; animation: memo-ein 0.25s ease-out; }
@keyframes memo-ein { from { transform: translateY(12px) rotate(-0.6deg); opacity: 0; } }

/* Meldungen */
.toasts {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 15;
  display: grid;
  gap: 6px;
  justify-items: center;
  pointer-events: none;
  width: min(92vw, 520px);
}
.toast {
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: rgb(250 246 236 / 0.97);
  color: var(--tinte);
  font-size: 0.9rem;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.3);
  transition: opacity 0.5s, transform 0.5s;
  text-align: center;
}
.toast.warnung { background: #fde3dc; }
.toast.erfolg { background: #dff5e3; }
.toast.weg { opacity: 0; transform: translateY(-6px); }

/* Zahl offener Angebote am Menüknopf */
.menue-knopf { position: relative; }
.menue-knopf[data-badge]:not([data-badge=""])::after {
  content: attr(data-badge);
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--gelb);
  color: var(--tinte);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
  animation: puls 1.6s ease-in-out infinite;
}
@keyframes puls { 50% { transform: scale(1.15); } }

/* Laufender Auftrag über der Karte */
.auftrag-karte {
  position: absolute;
  left: 12px;
  bottom: 140px; /* über der Hinweiszeile */
  z-index: 6;
  width: 250px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  background: rgb(15 45 61 / 0.94);
  border: 1px solid #2b6280;
  border-left: 4px solid var(--gelb);
  font-size: 0.85rem;
  cursor: pointer;
}
.auftrag-karte .lbl { margin: 0; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-matt); }
.auftrag-karte b { display: block; margin: 0.1rem 0 0.25rem; }
.auftrag-karte small { color: var(--text-matt); font-variant-numeric: tabular-nums; }
.auftrag-karte .balken i { background: var(--gelb); }
.auftrag-karte.knapp { border-left-color: var(--rot); }

/* Angebote, Ausrichtung, Meeresarten */
.angebote { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.5rem; margin: 0.5rem 0; }
.angebot {
  display: grid;
  align-content: start;
  gap: 0.3rem;
  padding: 0.6rem 0.65rem;
  border: 1px solid #2b6280;
  border-radius: 8px;
  background: #174559;
  color: var(--text-hell);
  text-align: left;
  font: inherit;
}
.angebot small { color: var(--text-matt); font-size: 0.8rem; }
.angebot .lohn { margin: 0; color: var(--gelb); font-weight: 600; }
.angebot .knopf, .angebot .fertig { justify-self: start; }
.angebot.gewaehlt { border-color: var(--gelb); box-shadow: inset 0 0 0 1px var(--gelb); }
button.angebot.wahl { cursor: pointer; }
button.angebot.wahl:hover { border-color: #4f93b8; }
.balken.gross { height: 12px; }

/* Statistik */
.wahl { flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; }
.knopf.aktiv { box-shadow: inset 0 0 0 2px var(--gelb); }
.diagramm { display: block; width: 100%; height: 200px; margin-top: 0.3rem; border-radius: 7px; background: rgb(0 0 0 / 0.2); }
.diagramm.klein { height: 110px; }
.legende { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 0.35rem 0; font-size: 0.8rem; color: var(--text-matt); }
.legende i { display: inline-block; width: 12px; height: 4px; margin-right: 0.3rem; vertical-align: middle; border-radius: 2px; }
.bremsen { display: grid; gap: 0.35rem; }
.bremse { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.45rem 0.55rem; border-radius: 7px; background: rgb(0 0 0 / 0.2); border-left: 4px solid var(--orange); font-size: 0.86rem; }
.bremse.rot { border-left-color: var(--rot); }
.bremse .knopf { flex: none; }
.alles-gut { color: var(--gruen); }

/* Aktionärsladen */
.aktien-laden { display: grid; gap: 0.35rem; }
.laden-zeile { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.4rem 0.5rem; border-radius: 7px; background: rgb(0 0 0 / 0.18); }
.laden-zeile small { display: block; color: var(--text-matt); font-size: 0.8rem; }
.schalter.regler input { flex: 1; max-width: 220px; }

/* Neue Zone: Banner quer über die Karte */
.zonen-banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 32%;
  z-index: 15;
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  padding: 1.1rem 1rem;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgb(8 30 44 / 0.88) 20%, rgb(8 30 44 / 0.88) 80%, transparent);
  color: var(--text-hell);
  text-align: center;
  opacity: 0;
}
.zonen-banner .lbl { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--gelb); }
.zonen-banner b { font-size: clamp(1.6rem, 4vw, 2.6rem); letter-spacing: 0.02em; }
.zonen-banner .tiefe { font-size: 1.05rem; color: #9fd4ea; font-variant-numeric: tabular-nums; }
.zonen-banner.zeigen { animation: banner 2.5s ease-out forwards; }
.zonen-banner.zeigen b { animation: banner-text 2.5s ease-out forwards; }
@keyframes banner {
  0% { opacity: 0; transform: scaleY(0.2); }
  12% { opacity: 1; transform: scaleY(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes banner-text {
  0% { letter-spacing: 0.4em; }
  25% { letter-spacing: 0.02em; }
}
@media (prefers-reduced-motion: reduce) {
  .zonen-banner.zeigen, .zonen-banner.zeigen b, .menue-knopf[data-badge]::after { animation: none; opacity: 1; }
}

/* ------------------------------------------------------------------ Mittelgrosse Bildschirme */
@media (max-width: 1280px) {
  .marke .name { display: none; }
  .wert.lager { min-width: 7rem; }
}
@media (max-width: 1060px) {
  .inv-koerper { grid-template-columns: 8rem minmax(0, 1fr) 13.5rem; }
}

/* ------------------------------------------------------------------ Smartphone und schmale Fenster */
@media (max-width: 820px) {
  body.spiel { --seite: 40px; }
  body.spiel.seite-offen { --seite: 40px; }
  #kopf { flex-wrap: wrap; gap: 0.35rem 0.6rem; padding: 0.35rem 0.5rem; padding-top: max(0.35rem, env(safe-area-inset-top)); padding-right: 7.5rem; }
  .marke { display: none; }
  .werte { gap: 0.25rem 0.8rem; order: 1; flex-basis: 100%; }
  .wert { min-width: 0; }
  .wert b { font-size: 0.92rem; }
  .wert.lager { min-width: 6.5rem; }
  #w-strom, #w-berg { display: none; }
  .menue { order: 2; }
  .frei-box { order: 3; }
  .menue-knopf { padding: 0.35rem 0.5rem; font-size: 0.82rem; }
  .knopf.verkaufen { position: absolute; right: 0.5rem; top: 0.4rem; min-width: 0; padding: 0.3rem 0.7rem; z-index: 4; }
  /* Ausgeklappter Querschnitt liegt über der Karte */
  body.seite-offen #seite {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(78vw, 270px);
    z-index: 25;
    box-shadow: 8px 0 24px rgb(0 0 0 / 0.4);
  }
  .seite-griff { height: 36px; }
  .slot { width: 50px; height: 52px; }
  .slot .ikon { width: 30px; height: 30px; }
  .leiste { bottom: max(8px, env(safe-area-inset-bottom)); }
  .hinweiszeile { bottom: 72px; font-size: 0.74rem; }
  .auftrag-karte { top: 8px; bottom: auto; left: 8px; right: 8px; width: auto; }
  .toasts { top: 8px; }
  .inventar { bottom: 72px; height: calc(100% - 84px); width: calc(100% - 12px); }
  .inv-koerper { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .inv-kat { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid #0d2c3c; padding: 0.35rem; scrollbar-width: none; }
  .kat { white-space: nowrap; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
  .inv-raster { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
  .inv-info { border-left: 0; border-top: 1px solid #0d2c3c; max-height: 42vh; display: grid; grid-template-columns: 64px 1fr; gap: 0 0.7rem; align-items: start; }
  .inv-info .info-bild { grid-row: span 2; height: 64px; }
  .inv-info .info-bild .gross { width: 54px; height: 54px; }
  .inv-info > :not(.info-bild):not(h3) { grid-column: 1 / -1; }
  .panel { top: auto; left: 6px; right: 6px; bottom: 6px; width: auto; height: 70%; }
  .info { right: 12px; max-width: none; }
  .ereignis { left: 12px; max-width: none; top: auto; bottom: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
