:root {
  --bg: #070b18;
  --bg-panel: #0d1428;
  --bg-panel2: #111a33;
  --border: #1e2a4d;
  --text: #dbe4ff;
  --muted: #8391b5;
  --accent: #4f7cff;
  --accent2: #9d5cff;
  --cyan: #38d6f5;
  --green: #3ddc85;
  --orange: #ffab49;
  --red: #ff5c72;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}
/* Fixiertes Hintergrundbild als Pseudo-Element statt background-attachment:fixed,
   weil Letzteres auf iOS/Android fehlerhaft rendert. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg) url('/assets/ui/background.webp?v=2') center / cover no-repeat;
}
/* Hochkant (Handys): eigene Portrait-Variante – kleiner und ohne den starken
   Beschnitt, der beim 16:9-Bild die Leiterbahnen an den Rändern wegschneiden würde. */
@media (max-width: 900px) and (orientation: portrait) {
  body::before {
    background-image: url('/assets/ui/background-mobile.webp?v=2');
  }
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(1200px 600px at 80% -10%, rgba(79,124,255,.12), transparent),
                    radial-gradient(900px 500px at -10% 110%, rgba(157,92,255,.10), transparent);
}
a { color: var(--cyan); text-decoration: none; }
h1 { font-size: 1.5rem; margin-bottom: 16px; }
h2 { font-size: 1.05rem; margin-bottom: 10px; color: var(--text); }
.muted { color: var(--muted); font-size: .85rem; }
.inline { display: inline; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; background: rgba(13,20,40,.92);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(8px);
}
.logo {
  display: flex; align-items: center; flex-shrink: 0; text-decoration: none;
  font-size: 1.25rem; font-weight: 700; letter-spacing: .3px; line-height: 1;
}
.logo-letter { height: 1.35em; width: auto; display: block; }
.logo-eta { color: var(--text); margin-left: -1px; }
.logo-forge { color: var(--accent); margin-left: -1px; }
.resources { display: flex; gap: 16px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.resources::-webkit-scrollbar { display: none; }
.res { display: flex; align-items: center; gap: 7px; white-space: nowrap; font-size: .9rem; }
.res b { font-weight: 600; line-height: 1.1; }
.res-txt { display: flex; flex-direction: column; }
.res-txt small { color: var(--muted); font-size: .6rem; text-transform: uppercase; letter-spacing: .5px; line-height: 1.2; }
.res img.ri { width: 22px; height: 22px; display: inline-block; object-fit: contain; flex-shrink: 0; }
.res-timer { color: var(--text); text-decoration: none; padding: 2px 8px; border-radius: 8px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); }
.res-timer:hover { background: rgba(255,255,255,.1); }
.res-timer .ri-timer { width: auto; height: auto; background: none; font-size: .85rem; }
.res-timer.timer-done { background: rgba(61,220,151,.18); border-color: rgba(61,220,151,.5); }
.res-timer.timer-done b { color: var(--green, #3ddc97); }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: .95rem;
}
.icon-btn:hover { border-color: var(--accent); }
.lang-btn { font-size: .72rem; font-weight: 700; letter-spacing: .5px; display: inline-flex; align-items: center; }

/* Shell / Sidebar */
.shell { display: flex; min-height: calc(100vh - 53px); }
.sidebar {
  width: 210px; flex-shrink: 0; padding: 16px 10px;
  border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px;
}
.sidebar a {
  color: var(--muted); padding: 9px 14px; border-radius: 8px; font-size: .95rem;
}
.sidebar a:hover { color: var(--text); background: var(--bg-panel); }
.sidebar a.active { color: var(--text); background: linear-gradient(90deg, rgba(79,124,255,.25), rgba(157,92,255,.12)); border-left: 3px solid var(--accent); }
.sidebar .admin-link { color: var(--orange); margin-top: 8px; }
.sidebar-footer { margin-top: auto; padding: 14px; border-top: 1px solid var(--border); font-size: .85rem; }
.company-name { font-weight: 600; margin-bottom: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }

.content { flex: 1; padding: 22px; max-width: 1500px; }
.content-plain { padding: 22px; }

/* Cards / Grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  /* Leicht transparent, damit das Hintergrundbild dezent durchscheint */
  background: linear-gradient(160deg, rgba(13,20,40,.93), rgba(17,26,51,.93));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.card h2 { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; }
.card-banner {
  width: calc(100% + 32px); margin: -16px -16px 12px; display: block;
  border-radius: var(--radius) var(--radius) 0 0; object-fit: cover; height: 120px;
}
.page-banner {
  width: 100%; height: 140px; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 16px; display: block;
}
.card .sub { font-size: .85rem; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-block; border: none; cursor: pointer; border-radius: 8px;
  padding: 9px 16px; font-size: .92rem; font-weight: 600; color: #fff;
  background: var(--bg-panel2); border: 1px solid var(--border); min-height: 40px;
}
.btn:hover { filter: brightness(1.15); }
.btn-primary { background: linear-gradient(90deg, var(--accent), var(--accent2)); border: none; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-sm { padding: 5px 12px; min-height: 32px; font-size: .85rem; }
.btn-block { display: block; width: 100%; }

/* Forms */
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font-size: .95rem; min-height: 42px;
  color-scheme: dark;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* Number-Spinner: dunkel statt weißer Browser-Standard */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  opacity: 1;
  background: var(--bg-panel2);
  border-left: 1px solid var(--border);
  border-radius: 0 7px 7px 0;
  cursor: pointer;
}
input[type=number]::-webkit-inner-spin-button:hover {
  background: var(--border);
}

/* Range-Slider: Farben passend zum UI */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  min-height: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent) var(--range-pct, 0%), var(--bg) var(--range-pct, 0%));
  cursor: pointer;
  accent-color: var(--accent);
}
input[type=range]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 124, 255, .18);
}
input[type=range]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 5px;
  background: transparent;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 2px solid rgba(219, 228, 255, .85);
  box-shadow: 0 0 8px rgba(79, 124, 255, .4);
  cursor: pointer;
}
input[type=range]::-moz-range-track {
  height: 8px;
  border-radius: 5px;
  background: var(--bg);
  border: none;
}
input[type=range]::-moz-range-progress {
  height: 8px;
  border-radius: 5px 0 0 5px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
}
input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 2px solid rgba(219, 228, 255, .85);
  box-shadow: 0 0 8px rgba(79, 124, 255, .4);
  cursor: pointer;
}
.form-row { display: flex; gap: 12px; }
.form-row > div { flex: 1; }

/* Tables -> mobile cards */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 9px 10px; border-bottom: 1px solid rgba(30,42,77,.5); }
tr.highlight td { background: rgba(79,124,255,.12); }
.num { text-align: right; }

/* Progress */
.progress { background: var(--bg); border-radius: 6px; height: 10px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width 1s linear; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .75rem; border: 1px solid var(--border); color: var(--muted); }
.badge-Einfach { color: var(--muted); }
.badge-Fortgeschritten { color: var(--cyan); border-color: var(--cyan); }
.badge-Selten { color: var(--accent); border-color: var(--accent); }
.badge-Episch { color: var(--accent2); border-color: var(--accent2); }
.badge-Legend\E4r, .badge-Legendaer { color: var(--orange); border-color: var(--orange); }
.badge-ok { color: var(--green); border-color: var(--green); }
.badge-warn { color: var(--orange); border-color: var(--orange); }
.badge-err { color: var(--red); border-color: var(--red); }

/* Blueprint-Stufen: grün / blau / lila */
.badge-tier-standard { color: #4ade80; border-color: #4ade80; background: rgba(74, 222, 128, .08); }
.badge-tier-selten { color: #60a5fa; border-color: #60a5fa; background: rgba(96, 165, 250, .08); }
.badge-tier-episch { color: #c084fc; border-color: #c084fc; background: rgba(192, 132, 252, .12); box-shadow: 0 0 8px rgba(192, 132, 252, .35); }
/* KI-Sterne (Konsortiums-Ansehen): schwarzer Bildhintergrund verschwindet
   auf dunklem UI durch Screen-Blending. */
.ki-stars { display: flex; gap: 2px; }
.ki-stars img { width: 26px; height: 26px; mix-blend-mode: screen; }
@media (max-width: 600px) { .ki-stars img { width: 20px; height: 20px; } }

.card-tier-standard { border-color: rgba(74, 222, 128, .55); }
.card-tier-selten { border-color: rgba(96, 165, 250, .55); }
.card-tier-episch { border-color: rgba(192, 132, 252, .65); box-shadow: 0 0 12px rgba(192, 132, 252, .18); }

/* Server-Shop: links Titel/Beschreibung, rechts [Bild | Stats+Buy] */
.server-shop-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 14px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.server-shop-item--locked { opacity: .55; }
.server-shop-main { min-width: 0; }
.server-shop-aside {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  justify-self: end;
}
.server-shop-stats { flex-shrink: 0; }
.server-shop-stats .row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px; margin-bottom: 6px; min-width: 170px;
}
.server-shop-stats .row span:first-child { color: var(--muted); white-space: nowrap; }
.server-shop-stats .row span:last-child,
.server-shop-stats .row b { text-align: right; }
.server-shop-thumb {
  flex: 0 0 96px; width: 96px; height: 96px;
  object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.25);
}
.server-shop-thumb--missing { display: none; }
@media (max-width: 560px) {
  .server-shop-item { grid-template-columns: 1fr; }
  .server-shop-aside { justify-self: end; }
  .server-shop-thumb { flex: 0 0 72px; width: 72px; height: 72px; }
}

/* Tabs */
.tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
  background: rgba(13,18,45,.55); border: 1px solid var(--border);
  border-radius: 14px; padding: 8px;
}
.tab-btn {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  border-radius: 10px; padding: 8px 14px; cursor: pointer; white-space: nowrap;
  font-size: .88rem; font-weight: 500; line-height: 1;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s, color .15s, border-color .15s;
}
.tab-btn:hover { background: rgba(79,124,255,.12); color: var(--text); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: #fff; border-color: rgba(255,255,255,.15);
  box-shadow: 0 2px 12px rgba(79,124,255,.35);
}
.tab-count {
  background: rgba(255,255,255,.22); border-radius: 999px; padding: 2px 8px;
  font-size: .72rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.tab-btn:not(.active) .tab-count { background: rgba(79,124,255,.16); color: var(--accent); }
/* Bewerbungs-Zähler: rot hervorgehoben, solange Bewerbungen offen sind. */
.tab-btn .tab-count-alert,
.tab-btn:not(.active) .tab-count-alert { background: var(--red); color: #fff; }
@media (max-width: 700px) {
  .tabs { gap: 6px; padding: 6px; border-radius: 12px; }
  .tab-btn { padding: 7px 10px; font-size: .82rem; gap: 5px; }
  .tab-count { padding: 1px 6px; font-size: .68rem; }
}

/* Flash */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: .92rem; }
.flash-success { background: rgba(61,220,133,.12); border: 1px solid var(--green); color: var(--green); }
.flash-error { background: rgba(255,92,114,.12); border: 1px solid var(--red); color: var(--red); }
.flash-warning { background: rgba(255,184,77,.12); border: 1px solid var(--orange); color: var(--orange); }

/* Timer */
.timer { font-variant-numeric: tabular-nums; color: var(--cyan); font-weight: 600; }

/* Stat rows */
.stat-list { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.stat-list .row { display: flex; justify-content: space-between; gap: 10px; }
.stat-list .row span:first-child { color: var(--muted); }

/* Auth */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand-logo {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 0; line-height: 1; margin-bottom: 4px;
}
.brand-letter { height: 2.5rem; width: auto; display: block; }
.brand-eta { font-size: 2.2rem; font-weight: 700; color: var(--text); margin-left: -2px; }
.brand-forge { font-size: 2.2rem; font-weight: 700; color: var(--accent); margin-left: -2px; }
.auth-pitch { color: var(--muted); font-size: .92rem; margin-top: 8px; }
.auth-card { background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel2)); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: .88rem; }
.auth-legal { text-align: center; color: var(--muted); font-size: .75rem; margin-top: 18px; }
.social-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 16px 0 4px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Bottom nav (mobile) */
.bottom-nav { display: none; }
.mobile-menu { display: none; }
.pwa-bar {
  position: fixed; bottom: 70px; left: 12px; right: 12px; z-index: 90;
  background: var(--bg-panel2); border: 1px solid var(--accent); border-radius: 12px;
  padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-size: .85rem;
}
.pwa-bar[hidden] { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { padding: 14px; padding-bottom: 84px; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .logo { font-size: 1.05rem; }
  .logo-letter { height: 1.3em; }
  .resources {
    order: 3; width: 100%;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px;
    overflow: visible;
  }
  .res { font-size: .82rem; }
  .res-txt small { font-size: .58rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(13,20,40,.97); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; text-align: center; color: var(--muted); font-size: .8rem; padding: 10px 2px;
    background: none; border: none; cursor: pointer; border-radius: 8px;
  }
  .bottom-nav a.active { color: var(--accent); }
  .mobile-menu {
    position: fixed; bottom: 58px; left: 12px; right: 12px; z-index: 99;
    background: var(--bg-panel2); border: 1px solid var(--border); border-radius: 12px;
    padding: 10px; flex-direction: column; gap: 4px;
    /* Im Browser (sichtbare Adressleiste) ist das Menü höher als der Viewport:
       Höhe begrenzen und selbst scrollbar machen. dvh = dynamische Viewport-
       Höhe inkl. ein-/ausblendender Browser-UI; vh-Zeile ist der Fallback. */
    max-height: calc(100vh - 140px);
    max-height: calc(100dvh - 58px - 12px - env(safe-area-inset-top));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-menu.open { display: flex; }
  body.menu-open { overflow: hidden; }
  .mobile-menu a, .mobile-menu button {
    color: var(--text); padding: 12px; border-radius: 8px; background: none; border: none;
    text-align: left; font-size: .95rem; cursor: pointer; width: 100%;
  }
  .mobile-menu a:active, .mobile-menu button:active { background: var(--bg-panel); }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 8px; }
  table.responsive td { display: flex; justify-content: space-between; border: none; padding: 6px 8px; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); margin-right: 12px; }
}

/* Server: freie Slots + Upgrade-Vorschau */
.server-slot-empty {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  background: rgba(7, 11, 24, .4);
}
.server-upgrade-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(79, 124, 255, .07);
  border: 1px solid rgba(79, 124, 255, .22);
}

/* Meine Server: Thumbnail links neben den Stats */
.server-owned-main { display: flex; align-items: flex-start; gap: 12px; }
.server-owned-thumb {
  flex: 0 0 88px; width: 88px; height: 88px;
  object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.25);
}
.server-owned-thumb--missing { display: none; }
@media (max-width: 560px) {
  .server-owned-thumb { flex: 0 0 64px; width: 64px; height: 64px; }
}

/* Modellkarten: Bild passend zur Qualitätsstufe (6 Stufen, Fusion 4 Stufen) */
.model-thumb {
  display: block;
  width: 100%; height: 150px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.25);
  margin-bottom: 10px;
}
.model-thumb--missing { display: none; }
@media (max-width: 560px) {
  .model-thumb { height: 120px; }
}

/* Trainingsseite: Hero-Vorschau des gewählten Modelltyps */
.tr-hero {
  display: block; width: 100%; height: 170px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0,0,0,.25); margin: 10px 0 4px;
}
@media (max-width: 560px) {
  .tr-hero { height: 130px; }
}

/* Erst-Login-Onboarding: Overlay mit 4 Karten */
.onb-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(7, 11, 26, .82); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.onb-card {
  position: relative; width: 100%; max-width: 440px;
  background: linear-gradient(160deg, #101833, #141b3d);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 18px 60px rgba(0,0,0,.55);
}
.onb-card img {
  width: 100%; height: 150px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--border); margin-bottom: 12px;
}
.onb-card h2 { margin: 0 0 8px; }
.onb-card p { color: var(--muted); line-height: 1.5; min-height: 70px; }
.onb-skip {
  position: absolute; top: 10px; right: 12px; z-index: 1;
  background: rgba(0,0,0,.35); border: none; color: var(--muted);
  font-size: .8rem; cursor: pointer; padding: 4px 10px; border-radius: 8px;
}
.onb-skip:hover { color: var(--text); }
.onb-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.onb-dots { display: flex; gap: 6px; }
.onb-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.2); }
.onb-dot.active { background: var(--accent); }
.onb-btns { display: flex; gap: 8px; }
@media (max-width: 560px) {
  .onb-card img { height: 110px; }
  .onb-card p { min-height: 90px; }
}

/* Upgrade-Stufe als Sterne (gefüllt = aktuelle Stufe) */
.server-level-stars { display: inline-flex; gap: 3px; }
.server-level-stars .star {
  width: 12px; height: 12px;
  background: rgba(255, 255, 255, .18);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.server-level-stars .star--filled { background: var(--orange); }

/* Support-Tickets */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ticket-list-item {
  display: block; padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); text-decoration: none;
  transition: border-color .15s, background .15s;
}
.ticket-list-item:hover { border-color: var(--accent); background: rgba(79,124,255,.07); }
.ticket-list-item .row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ticket-thread { display: flex; flex-direction: column; gap: 10px; }
.ticket-msg {
  padding: 10px 12px; border-radius: 10px; max-width: 85%;
  border: 1px solid var(--border); background: rgba(7, 11, 24, .4);
}
.ticket-msg--admin {
  align-self: flex-start;
  background: rgba(79, 124, 255, .1);
  border-color: rgba(79, 124, 255, .3);
}
.ticket-msg--player { align-self: flex-end; }
.ticket-msg-head { display: flex; justify-content: space-between; gap: 14px; font-size: .8rem; margin-bottom: 4px; }
.ticket-msg-body { font-size: .92rem; white-space: pre-wrap; word-break: break-word; }

/* Dashboard: XP-Fortschritt hervorgehoben */
.xp-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(79, 124, 255, .08);
  border: 1px solid rgba(79, 124, 255, .28);
}
.xp-box-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; font-size: .88rem; margin-bottom: 6px;
}
.xp-box-head b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Verkaufszeile unter der Server-Karte */
.server-sell-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-top: 10px; font-size: .82rem;
}
table.upgrade-table { font-size: .82rem; width: 100%; }
table.upgrade-table th, table.upgrade-table td { padding: 5px 6px; }

/* ---- Chat: Weltchat-Panel (schwebend) + Konsortium-Chat (eingebettet) ---- */
.chat-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 1.3rem; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
}
.chat-fab:hover { filter: brightness(1.1); }
.chat-fab-hidden { display: none; }

.chat-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 61;
  width: 340px; height: 440px; max-height: calc(100dvh - 90px);
  display: flex; flex-direction: column;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 8px 28px rgba(0,0,0,.5);
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: rgba(79,124,255,.08);
}
.chat-msgs {
  flex: 1; overflow-y: auto; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  overscroll-behavior: contain;
}
.chat-msg { font-size: .88rem; line-height: 1.35; }
.chat-meta { display: flex; align-items: baseline; gap: 8px; }
.chat-meta b { font-size: .82rem; color: var(--accent); }
.chat-own .chat-meta b { color: var(--green, #3ddc85); }
.chat-meta span { font-size: .7rem; color: var(--muted); }
.chat-del {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: .9rem; padding: 0 4px; margin-left: auto;
}
.chat-del:hover { color: var(--red, #ff5c72); }
.chat-text { word-break: break-word; white-space: pre-wrap; }
.chat-form { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; min-width: 0; }
.chat-error {
  padding: 6px 12px; font-size: .8rem; color: var(--red, #ff5c72);
  border-top: 1px solid var(--border);
}

/* Konsortium-Chat im Tab: gleiche Optik, aber im Seitenfluss */
.chat-embed { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.chat-embed .chat-msgs { height: 320px; }

@media (max-width: 900px) {
  /* Mobil: FAB oberhalb der Bottom-Nav, Panel fast vollflaechig */
  .chat-fab { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .chat-panel {
    left: 10px; right: 10px; width: auto;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    height: min(420px, calc(100dvh - 140px));
  }
}
