/* Space Pioneers Original-Look (Blau-Violett-Theme, 2009/2010).
   Farbwerte aus Original-Screenshots gemessen – siehe konzept/optik.md Abschnitt 3. */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #080b2a;
  color: #c5c3f4;
  font-family: Verdana, Arial, sans-serif;
  font-size: 11px;
}

a {
  color: #d2d2f8;
}
a:hover {
  color: #ffffff;
}

.page {
  max-width: 1024px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Fixierter Kopfbereich (Topleiste + Ressourcen) ---- */
.kopfbereich {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #080b2a;
}
.resbox[data-tooltip] {
  cursor: help;
}

/* Dezenter Ladebalken für die Pjax-Navigation */
#ladebalken {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, #6ee76e, #7fd8f0);
  z-index: 500;
  opacity: 0;
  transition: width 0.3s ease, opacity 0.2s ease;
}
#ladebalken.aktiv {
  width: 80%;
  opacity: 1;
}

/* Anker-Ziele: Abstand zum fixierten Kopfbereich + kurzes Aufleuchten */
tr[id],
#zweigwahl {
  scroll-margin-top: 120px;
}
.anker-highlight {
  outline: 2px solid #ffd76e;
  animation: ankerPuls 2.2s ease-out forwards;
}
@keyframes ankerPuls {
  0% { outline-color: #ffd76e; }
  100% { outline-color: transparent; }
}
#tooltip {
  position: absolute;
  z-index: 1000;
  background: #191933;
  border: 1px solid #8f8fc0;
  color: #d2d2f8;
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-line;
  max-width: min(340px, calc(100vw - 16px));
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

/* ---- Topleiste: Meldungen + Serverzeit ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  background: #10142f;
  border: 1px solid #353456;
  padding: 3px 8px;
  color: #8f8fc0;
}
.topbar-meldung {
  color: #ff5c5c;
}
.topbar-zeit a {
  color: #8f8fc0;
}

/* ---- Ressourcenleiste ---- */
.resleiste {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  background: #414272;
  border: 1px solid #353456;
  border-top: none;
  padding: 5px 8px;
}
.resbox {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #49497b;
  border: 1px solid #353456;
  padding: 3px 8px;
}
.resname {
  color: #c5c3f4;
}
.reswert {
  background: #1e2039;
  border: 1px solid #353456;
  padding: 1px 8px;
  color: #ffffff;
  min-width: 60px;
  text-align: right;
}
.planetwahl {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ---- Grundlayout: Sidebar + Inhalt ---- */
.hauptbereich {
  display: flex;
  flex: 1;
  gap: 8px;
  padding: 8px 0;
}
.sidebar {
  width: 170px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inhalt {
  flex: 1;
  min-width: 0;
}
.inhalt-mittig {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---- Menüblöcke & Seitenboxen ---- */
.menublock,
.seitenbox {
  background: #414272;
  border: 1px solid #353456;
  padding: 4px;
}
.boxpill {
  background: #191933;
  border: 1px solid #5e6090;
  border-radius: 9px;
  color: #ffffff;
  text-align: center;
  padding: 2px 8px;
  margin-bottom: 4px;
  letter-spacing: 1px;
}
.menublock a {
  display: block;
  text-align: center;
  text-decoration: none;
  color: #ffffff;
  background: linear-gradient(#7b7a99, #3c3d6b);
  border: 1px solid #8f8fc0;
  margin: 2px 0;
  padding: 3px 4px;
}
.menublock a:hover {
  border-color: #ffffff;
}
.menublock a.gesperrt {
  color: #8f8fc0;
  background: linear-gradient(#56557d, #3c396e);
  border-color: #5e6090;
  cursor: default;
}
.menublock a.vote {
  font-weight: bold;
}
.boxinhalt {
  text-align: center;
  padding: 3px;
  color: #d2d2f8;
}
.boxinhalt .countdown {
  color: #ff5c5c;
  font-weight: bold;
}

/* ---- Titel-Pills & Panels ---- */
.titelpill {
  background: linear-gradient(#5e6090, #353456);
  border: 1px solid #8f8fc0;
  border-radius: 11px;
  color: #ffffff;
  text-align: center;
  padding: 3px 16px;
  margin: 0 auto 8px;
  max-width: 480px;
  letter-spacing: 1px;
}
.panel {
  background: #414272;
  border: 1px solid #353456;
  padding: 4px;
  margin-bottom: 8px;
}

/* ---- Tabellen ---- */
.tabelle {
  width: 100%;
  border-collapse: collapse;
}
.tabelle td {
  padding: 3px 8px;
  border: 1px solid #353456;
  vertical-align: top;
}
.tabelle tr.kopf td {
  background: #5e6090;
  color: #ffffff;
  font-weight: bold;
  letter-spacing: 1px;
}
.tabelle tr.unterkopf td {
  background: #49497b;
  color: #ffffff;
  font-weight: bold;
}
.tabelle tr:nth-child(even):not(.kopf):not(.unterkopf) td {
  background: #2e3144;
}
.tabelle tr:nth-child(odd):not(.kopf):not(.unterkopf) td {
  background: #323347;
}
.tabelle .zahl {
  text-align: right;
  white-space: nowrap;
}
.eigene-zeile td {
  color: #ffffff;
  font-weight: bold;
}
.fliesstext {
  background: #49497b !important;
  color: #d2d2f8;
  line-height: 1.5;
}

/* ---- Statistik-Footer ---- */
.statistik-panel {
  background: #414272;
  border: 1px solid #353456;
  padding: 4px;
  margin-top: 16px;
}
.statistik-tabelle {
  max-width: 360px;
  margin: 0 auto;
}

/* ---- Formulare, Buttons, Hinweise ---- */
button {
  background: linear-gradient(#7b7a99, #3c3d6b);
  border: 1px solid #8f8fc0;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  padding: 2px 10px;
  cursor: pointer;
}
button:hover:not(:disabled) {
  border-color: #ffffff;
}
button:disabled {
  color: #8f8fc0;
  background: #3c396e;
  border-color: #5e6090;
  cursor: default;
}
input[type="text"],
input[type="password"],
input[type="number"],
select {
  background: #0e0d1b;
  border: 1px solid #5e6090;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  padding: 2px 5px;
}
.prozentfeld {
  width: 52px;
  text-align: right;
}

.gruen {
  color: #6ee76e;
}
.rot {
  color: #ff5c5c;
}
.dezent {
  color: #8f8fc0;
}
.countdown {
  color: #6ee76e;
  font-weight: bold;
}
.fehler {
  background: #3a1420;
  border: 1px solid #7c2b3f;
  color: #ff9db1;
  padding: 6px 10px;
  margin-bottom: 8px;
}
.hinweis {
  margin-top: 8px;
  text-align: center;
}

/* ---- Tabs (Werft: Schiffe | Verteidigung) ---- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  justify-content: center;
}
.tab {
  background: #3c3d6b;
  border: 1px solid #5e6090;
  padding: 3px 16px;
  color: #aebedd;
  text-decoration: none;
}
.tab:hover {
  color: #ffffff;
  text-decoration: none;
}
.tab.aktiv {
  background: #5e6090;
  color: #ffffff;
  border-color: #8f8fc0;
}

/* ---- Icons & Bilder ---- */
.res-icon {
  width: 15px;
  height: 15px;
  display: block;
}
.gebaeude-zelle {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.gebaeude-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid #5e6090;
  background: #1e2039;
}
.gebaeude-icon.klein {
  width: 28px;
  height: 28px;
}
.planet-panel {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.bullauge {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.planet-panel .tabelle {
  flex: 1;
}

/* ---- Nachrichten & Sonnensystem ---- */
.nachricht-inhalt {
  white-space: pre-line;
  line-height: 1.5;
  background: #2e3144 !important;
}
.karte-panel {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
#systemkarte {
  border: 1px solid #5e6090;
  background: #3a3d4a;
  cursor: crosshair;
  flex-shrink: 0;
}
.karte-info {
  line-height: 1.7;
  padding-top: 4px;
}
.koordinaten-form {
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---- Mobile (≤ 768px): Sidebar als ☰-Overlay, Raster-Ressourcen, scrollende Tabellen ---- */
.menue-knopf {
  display: none;
  background: linear-gradient(#7b7a99, #3c3d6b);
  border: 1px solid #8f8fc0;
  color: #ffffff;
  font-family: inherit;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .page {
    max-width: 100%;
  }
  .hauptbereich {
    padding: 8px 6px;
    gap: 0;
  }
  .menue-knopf {
    display: block;
    flex: 1 1 100%;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 10px;
  }
  .resleiste {
    gap: 4px;
  }
  .resbox {
    flex: 1 1 42%;
    justify-content: space-between;
  }
  .reswert {
    min-width: 0;
  }
  .planetwahl {
    margin-left: 0;
    flex: 1 1 100%;
  }
  .planetwahl select {
    flex: 1;
  }
  .sidebar {
    display: none;
  }
  body.menue-offen .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 230px;
    z-index: 300;
    background: #0a0e1a;
    padding: 10px;
    overflow-y: auto;
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.7);
  }
  body.menue-offen::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 250;
  }
  .menublock a {
    padding: 9px 4px;
  }
  .inhalt {
    width: 100%;
  }
  .panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tabelle td {
    padding: 6px 6px;
  }
  button {
    padding: 7px 12px;
  }
  /* 16px verhindert den Auto-Zoom von iOS Safari beim Fokussieren */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  select {
    font-size: 16px;
  }
  input[type="text"],
  input[type="password"] {
    width: 140px;
  }
  .prozentfeld {
    width: 64px;
  }
  .gebaeude-icon {
    width: 34px;
    height: 34px;
  }
  .bullauge {
    width: 84px;
    height: 84px;
  }
  .auth-box {
    width: auto !important;
    margin: 24px 8px 0;
    padding: 14px;
  }
  .karte-panel {
    flex-direction: column;
  }
  #systemkarte {
    max-width: 100%;
    height: auto;
  }
  .statistik-tabelle {
    max-width: none;
  }
  .titelpill {
    max-width: none;
  }
  .koordinaten-form {
    gap: 4px;
  }

  /* Listen-Tabellen als Karten: Zeile = Karte, Infos als beschriftete Chips,
     Buttons in voller Breite darunter nebeneinander – kein Quer-Scrollen mehr */
  .karten-tabelle,
  .karten-tabelle tbody {
    display: block;
  }
  .karten-tabelle tr.kopf,
  .karten-tabelle tr.kopf td {
    display: block;
  }
  .karten-tabelle tr.unterkopf {
    display: none;
  }
  .karten-tabelle tr:not(.kopf):not(.unterkopf) {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 16px;
    border: 1px solid #353456;
    background: #323347;
    margin: 6px 0;
    padding: 8px;
  }
  .karten-tabelle tr:not(.kopf):not(.unterkopf) td {
    display: block;
    border: none !important;
    background: none !important;
    padding: 2px 0;
    text-align: left;
  }
  .karten-tabelle tr:not(.kopf):not(.unterkopf) td:first-child {
    flex: 1 1 100%;
  }
  .karten-tabelle td[data-label]::before {
    content: attr(data-label) ": ";
    color: #8f8fc0;
  }
  .karten-tabelle tr:not(.kopf):not(.unterkopf) td.aktionen {
    flex: 1 1 100%;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
  }
  .karten-tabelle tr:not(.kopf):not(.unterkopf) td.aktionen::before {
    content: none;
  }
  .karten-tabelle td.aktionen form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    max-width: 220px;
    justify-content: center;
  }
  .karten-tabelle td.aktionen button {
    flex: 1;
    padding: 11px 14px;
    font-size: 13px;
  }
}

/* ---- Login/Registrierung ---- */
.auth-box {
  width: 360px;
  background: #414272;
  border: 1px solid #353456;
  padding: 16px;
  margin: 80px auto 0;
}
.form-tabelle {
  margin: 0 auto;
}
.form-tabelle td {
  padding: 4px 6px;
}
.form-tabelle input {
  width: 180px;
}
