/* =============================================================
   DYNATECH - Modern UI
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg-0: #0a0e1a;
    --bg-1: #131829;
    --bg-2: #1c2238;
    --bg-3: #252b44;
    --line: #2d3552;
    --text: #e6ecff;
    --muted: #8a93b3;
    --accent: #4dd2ff;
    --accent-2: #7d4dff;
    --ok: #56e398;
    --warn: #f5b948;
    --error: #f86d6d;
    --tier-1: #5c8dff;
    --tier-2: #ad7dff;
    --tier-3: #ff8dd2;
    --tier-4: #ffb84d;
    --shadow: 0 6px 24px rgba(0,0,0,.4);
    --radius: 14px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-0);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Sternenfeld */
.starfield {
    position: fixed; inset: 0; z-index: -1;
    background:
        radial-gradient(1.5px 1.5px at 20% 30%, #ffffff88 50%, transparent 100%),
        radial-gradient(1px 1px at 70% 80%, #ffffffaa 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 50% 50%, #ffffff66 50%, transparent 100%),
        radial-gradient(1px 1px at 90% 20%, #ffffff77 50%, transparent 100%),
        radial-gradient(1px 1px at 10% 70%, #ffffff66 50%, transparent 100%),
        radial-gradient(2px 2px at 35% 80%, #ffffff44 50%, transparent 100%),
        radial-gradient(circle at 30% 30%, #1a2150 0%, #0a0e1a 60%);
    background-size: 100% 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #aef0ff; }
small { color: var(--muted); }

/* =========================================================
   LOGIN
   ========================================================= */
.login-page .login-shell {
    max-width: 1100px;
    margin: 60px auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 40px;
    align-items: start;
}
.login-hero { grid-column: 1 / -1; text-align: center; }
.logo {
    display: inline-block;
    font-size: 64px;
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1;
}
.logo.small { font-size: 22px; letter-spacing: -1px; }
.logo .accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.tagline { color: var(--muted); font-size: 18px; margin-top: 8px; }

.card {
    background: linear-gradient(140deg, var(--bg-1), var(--bg-2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.login-card { padding: 32px; }
.features ul { padding-left: 20px; line-height: 2; }

.tab-buttons { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg-0); padding: 4px; border-radius: 10px; }
.tab-btn {
    flex: 1; background: transparent; color: var(--muted); border: 0;
    padding: 10px 16px; border-radius: 8px; cursor: pointer; font-weight: 600;
    transition: all .15s;
}
.tab-btn.active { background: var(--bg-2); color: var(--text); box-shadow: 0 1px 0 var(--line); }
.tab-btn:hover { color: var(--text); }

label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 14px; }
input, select, textarea {
    display: block; width: 100%;
    margin-top: 6px; padding: 10px 12px;
    border-radius: 8px; border: 1px solid var(--line);
    background: var(--bg-0); color: var(--text);
    font-size: 15px;
    font-family: inherit;
}
/* Checkboxen / Radios sind keine "Felder" - kein 100% width, kein block-display */
input[type="checkbox"], input[type="radio"] {
    display: inline-block; width: auto;
    margin: 0; padding: 0;
    flex: 0 0 auto;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg-3);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 14px;
    transition: all .15s;
    text-align: center;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(77,210,255,.2); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #0a0e1a;
    border-color: transparent;
}
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert.error { background: #f86d6d22; border: 1px solid var(--error); color: #ffb6b6; }
.alert.info  { background: #4dd2ff22; border: 1px solid var(--accent); color: #cef0ff; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* =========================================================
   GAME LAYOUT
   ========================================================= */
.game-page { padding: 0; }

.topbar {
    position: sticky; top: 0; z-index: 100;
    /* Sci-Fi-Hintergrundbild mit Overlay-Gradient. Overlay deutlich abgeschwächt
       damit das Bild auch sichtbar wird, aber Text noch gut lesbar bleibt. */
    background-color: var(--bg-1, #0d121e);
    background-image:
        linear-gradient(180deg, rgba(13,18,30,0.30) 0%, rgba(13,18,30,0.55) 100%),
        url('img/header-bg.svg');
    background-size: auto, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    border-bottom: 1px solid var(--line);
    padding: 8px 14px;
    margin: 0;
    display: flex; flex-direction: column; gap: 6px;
    /* Dezente Innen-Glow-Linie für mehr Tiefe */
    box-shadow: inset 0 -1px 0 rgba(122, 223, 255, 0.06);
}
.topbar-row1 {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.topbar-left { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.topbar-user {
    display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.topbar-resources {
    display: flex; gap: 4px; flex-wrap: wrap;
    justify-content: flex-start;
    min-width: 0;
}
.user-info { color: var(--muted); }
/* Profil-Button: sieht aus wie der alte Username-Span, ist aber klickbar */
.user-info-btn {
    background: transparent; border: 1px solid transparent;
    color: var(--muted);
    padding: 4px 9px; border-radius: 999px;
    cursor: pointer; font: inherit;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.user-info-btn:hover {
    background: rgba(122, 223, 255, 0.08);
    border-color: rgba(122, 223, 255, 0.3);
    color: var(--text, #dde);
}
.user-info-btn:focus-visible { outline: 2px solid var(--accent, #56e398); outline-offset: 2px; }

.res-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 9px; background: var(--bg-1);
    border: 1px solid var(--line); border-radius: 999px;
    font-size: 12px; font-variant-numeric: tabular-nums;
    transition: border-color .2s, background .2s;
    white-space: nowrap;
}
.res-pill .ico { font-size: 14px; }
.res-pill .cap { color: var(--muted); font-size: 10px; opacity: .85; }
.res-pill.near-full { border-color: var(--warn); }
.res-pill.full      { border-color: var(--error); background: #f86d6d11; }
.res-pill.full .cap { color: var(--error); opacity: 1; }
.res-pill.credits {
    background: linear-gradient(135deg, #2d2200, #2d2a00);
    border-color: #4d3f00;
    font-weight: 600;
}

/* Mobile-Burger im Header — auf Desktop versteckt */
.mobile-menu-btn {
    display: none;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 10px;
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
}

.sidebar {
    position: fixed;
    top: var(--header-h, 64px); left: 0; bottom: 0; width: 240px;
    background: var(--bg-1);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    padding: 18px 14px;
    /* Keine top-Transition — sonst hängt die Sidebar bei Scroll/Resize hinter dem Header her */
}
.sidebar h3 { margin: 0 0 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.planet-switcher ul { list-style: none; padding: 0; margin: 0 0 18px; }
.planet-switcher li { margin-bottom: 2px; }
.planet-switcher a {
    display: block; padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
}
.planet-switcher a:hover { background: var(--bg-2); }
.planet-switcher li.active a { background: var(--bg-3); border: 1px solid var(--line); }
.planet-switcher .ico { display: inline-block; margin-right: 8px; font-size: 18px; }
.planet-switcher .name { font-weight: 600; }
.planet-switcher small { display: block; color: var(--muted); margin-left: 26px; font-size: 11px; }

.main-nav { display: flex; flex-direction: column; gap: 2px; }
.main-nav a {
    display: block; padding: 10px 14px;
    border-radius: 10px; color: var(--text);
    font-size: 14px;
}
.main-nav a:hover { background: var(--bg-2); }
.main-nav a.active { background: linear-gradient(90deg, var(--accent)22, transparent); border-left: 3px solid var(--accent); }

.content {
    margin-left: 240px;
    padding: 22px;
    min-height: calc(100vh - 100px);
}

.footer {
    margin-left: 240px;
    padding: 12px 22px;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--line);
    display: flex; justify-content: space-between; align-items: center;
}

.card-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 16px; flex-wrap: wrap;
}
.card-head h2 { margin: 0; font-size: 22px; }
.pill {
    display: inline-block; padding: 4px 12px;
    border-radius: 999px; font-size: 12px; font-weight: 600;
    background: var(--bg-3); color: var(--muted);
    border: 1px solid var(--line);
}
.pill.ok { color: #5fffa0; background: #56e39822; border-color: var(--ok); }
.pill.warn { color: #ffd680; background: #f5b94822; border-color: var(--warn); }
.pill.lack { color: #ff7e89; background: #ff445733; border-color: #ff4457; }

.cost-overview {
    background: var(--bg-2); border: 1px solid var(--line);
    border-radius: 10px; padding: 12px 16px; margin: 14px 0;
}
.cost-overview > summary {
    cursor: pointer; list-style: none;
    font-size: 14px; line-height: 1.5;
}
.cost-overview > summary::-webkit-details-marker { display: none; }
.cost-overview > summary::before {
    content: '▶'; display: inline-block;
    margin-right: 8px; transition: transform .15s;
    color: var(--muted);
}
.cost-overview[open] > summary::before { transform: rotate(90deg); }

/* =========================================================
   ROHSTOFF-GRID
   ========================================================= */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px; margin-bottom: 24px;
}
.res-card {
    background: var(--bg-2); border: 1px solid var(--line);
    border-radius: 10px; padding: 12px;
}
.res-card.tier-1 { border-left: 3px solid var(--tier-1); }
.res-card.tier-2 { border-left: 3px solid var(--tier-2); }
.res-card.tier-3 { border-left: 3px solid var(--tier-3); }
.res-card.tier-4 { border-left: 3px solid var(--tier-4); }
.res-head { display: flex; align-items: center; gap: 6px; }
.res-head .ico { font-size: 22px; }
.res-head .lbl { font-size: 13px; color: var(--muted); }
.res-val { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.res-val small { color: var(--muted); font-size: 12px; font-weight: 400; }

.bar { height: 4px; background: var(--bg-0); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar .fill { height: 100%; background: var(--accent); transition: width .3s; }
.bar .fill.ok { background: var(--ok); }
.bar .fill.warn { background: var(--warn); }

/* =========================================================
   GEBÄUDE-GRID
   ========================================================= */
.building-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.building-card {
    background: var(--bg-2); border: 1px solid var(--line);
    border-radius: 12px; padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    transition: transform .15s, box-shadow .15s;
    position: relative;
    overflow: hidden;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}
.building-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.building-card.cat-raw {
    border-top: 3px solid #6affb0;
    background-image: linear-gradient(180deg, rgba(10,14,26,0.55) 0%, rgba(10,14,26,0.85) 100%), url('img/card-raw-bg.svg');
}
.building-card.cat-processing {
    border-top: 3px solid #c46aff;
    background-image: linear-gradient(180deg, rgba(10,14,26,0.55) 0%, rgba(10,14,26,0.85) 100%), url('img/card-processing-bg.svg');
}
.building-card.cat-logistics {
    border-top: 3px solid #ffb95a;
    background-image: linear-gradient(180deg, rgba(10,14,26,0.55) 0%, rgba(10,14,26,0.85) 100%), url('img/card-logistics-bg.svg');
}
.building-card.cat-special {
    border-top: 3px solid #6abaff;
    background-image: linear-gradient(180deg, rgba(10,14,26,0.55) 0%, rgba(10,14,26,0.85) 100%), url('img/card-special-bg.svg');
}
.building-card.cat-ship {
    border-top: 3px solid #b67dff;
    background-image: linear-gradient(180deg, rgba(10,14,26,0.55) 0%, rgba(10,14,26,0.85) 100%), url('img/card-ship-bg.svg');
}
/* Schiffstyp-spezifische Hintergründe — überschreiben das generische ship-bg */
.building-card.ship-img-kurier       { background-image: linear-gradient(180deg, rgba(10,14,26,0.55), rgba(10,14,26,0.85)), url('img/ship-kurier.svg'); }
.building-card.ship-img-frachter     { background-image: linear-gradient(180deg, rgba(10,14,26,0.55), rgba(10,14,26,0.85)), url('img/ship-frachter.svg'); }
.building-card.ship-img-general      { background-image: linear-gradient(180deg, rgba(10,14,26,0.55), rgba(10,14,26,0.85)), url('img/ship-general.svg'); }
.building-card.ship-img-liquid       { background-image: linear-gradient(180deg, rgba(10,14,26,0.55), rgba(10,14,26,0.85)), url('img/ship-liquid.svg'); }
.building-card.ship-img-bulk         { background-image: linear-gradient(180deg, rgba(10,14,26,0.55), rgba(10,14,26,0.85)), url('img/ship-bulk.svg'); }
.building-card.ship-img-livestock    { background-image: linear-gradient(180deg, rgba(10,14,26,0.55), rgba(10,14,26,0.85)), url('img/ship-livestock.svg'); }
.building-card.ship-img-refrigerated { background-image: linear-gradient(180deg, rgba(10,14,26,0.55), rgba(10,14,26,0.85)), url('img/ship-refrigerated.svg'); }
.building-card.ship-img-universal    { background-image: linear-gradient(180deg, rgba(10,14,26,0.55), rgba(10,14,26,0.85)), url('img/ship-universal.svg'); }
.building-card.cat-research { border-top: 3px solid #ff6ad5; }
/* Inhalt deutlich auf das Hintergrundbild legen */
.building-card > * { position: relative; z-index: 1; }
.building-card.maxed { opacity: .6; }
.bld-head { display: flex; align-items: center; gap: 12px; }
.bld-head .ico { font-size: 32px; }
.bld-head strong { display: block; font-size: 15px; }
.bld-head small { color: var(--muted); }
.bld-actions { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.cost-list {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-wrap: wrap; gap: 6px;
    font-size: 12px; color: var(--muted);
}
.cost-list li {
    padding: 3px 8px;
    background: var(--bg-0);
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}
.cost-list li.lack { color: var(--error); border: 1px solid var(--error); background: #f86d6d11; }
.cost-list li.ok-cost { color: var(--ok); border: 1px solid #56e39844; background: #56e39811; }
.cost-list li small { color: inherit; opacity: .6; margin-left: 2px; }
.upgrade-info { padding: 8px; background: var(--bg-0); border-radius: 8px; }
.upgrade-info small { display: block; margin-bottom: 6px; }
.recipe .ing.lack { background: #f86d6d22; color: var(--error); border: 1px solid var(--error); }
.cargo-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.cargo-tags .pill { font-size: 11px; padding: 3px 8px; }

.extras-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 240px; overflow-y: auto; }
.extras-list label {
    display: flex; gap: 8px; align-items: center;
    padding: 8px 10px; background: var(--bg-2);
    border: 1px solid var(--line); border-radius: 6px;
    cursor: pointer; font-size: 13px;
}
.extras-list label:hover { background: var(--bg-3); }
.extras-list input { margin: 0; }
.extras-list small { color: var(--muted); }

/* Admin Bot-Übersicht */
.bot-card {
    background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
    margin-bottom: 8px; overflow: hidden;
}
.bot-card[open] { border-color: var(--accent); }
.bot-card summary {
    padding: 10px 14px; cursor: pointer;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    list-style: none;
}
.bot-card summary::-webkit-details-marker { display: none; }
.bot-card summary:hover { background: var(--bg-3); }
.bot-card .bot-icon { font-size: 24px; }
.bot-card .bot-stats { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.bot-detail { padding: 14px; border-top: 1px solid var(--line); background: var(--bg-1); }
.bot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 14px; }
@media (max-width: 800px) { .bot-grid { grid-template-columns: 1fr; } }
.bot-detail h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.bot-planet { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.bot-planet:last-child { border-bottom: 0; }
.bld-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.bld-row .pill { font-size: 11px; padding: 3px 8px; }

.progress {
    display: flex; align-items: center; gap: 8px; font-size: 12px;
}
.progress .bar { flex: 1; height: 6px; }
.progress .cd { font-variant-numeric: tabular-nums; color: var(--accent); min-width: 50px; text-align: right; }

.recipe {
    display: flex; align-items: center; gap: 10px;
    padding: 10px;
    background: var(--bg-0); border-radius: 8px;
    font-size: 14px; flex-wrap: wrap;
}
.recipe .ing { padding: 2px 6px; background: var(--bg-2); border-radius: 5px; margin-right: 4px; }
.recipe .arrow { color: var(--accent); font-size: 18px; }
.recipe .out { font-weight: 700; }
.recipe .out.byproduct {
    font-weight: 500; color: var(--muted); font-size: 13px;
    padding: 2px 6px; background: var(--bg-2); border-radius: 5px;
}

.building-card.paused { opacity: 0.65; border-style: dashed; }
.building-card.paused .recipe { opacity: 0.7; }

.output-stocks { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.stock-row {
    display: grid; grid-template-columns: 1fr 100px auto; gap: 8px;
    align-items: center; font-size: 12px;
}
.stock-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-bar { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.stock-fill { height: 100%; transition: width .3s ease; }
.stock-fill.ok { background: var(--ok); }
.stock-fill.warn { background: var(--warn); }
.stock-fill.lack { background: #ff4457; }
.stock-num { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stock-arrow { display: inline-block; width: 14px; opacity: .6; font-size: 11px; }
.stock-row.stock-in .stock-arrow { color: #ffd680; }
.stock-row.stock-out .stock-arrow { color: #5fffa0; }

/* =========================================================
   TABELLEN
   ========================================================= */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 12px 0 22px;
    font-size: 14px;
}
.data-table th, .data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}
.data-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.data-table tr:hover td { background: var(--bg-2); }
.data-table tr.active td { background: var(--bg-3); }
.cd-cell .cd { font-variant-numeric: tabular-nums; color: var(--accent); }

/* =========================================================
   FLOTTEN-GRID (Schiffsübersicht als Karten)
   ========================================================= */
.fleet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    margin: 12px 0 22px;
}
.fleet-card {
    position: relative;
    background-color: var(--bg-2);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}
.fleet-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.fleet-card > * { position: relative; z-index: 1; }
/* Hintergrundbild pro Cargo-Klasse — selbe Bilder wie der Bauhof */
.fleet-card.ship-img-kurier       { background-image: linear-gradient(180deg, rgba(10,14,26,0.62), rgba(10,14,26,0.88)), url('img/ship-kurier.svg'); }
.fleet-card.ship-img-frachter     { background-image: linear-gradient(180deg, rgba(10,14,26,0.62), rgba(10,14,26,0.88)), url('img/ship-frachter.svg'); }
.fleet-card.ship-img-general      { background-image: linear-gradient(180deg, rgba(10,14,26,0.62), rgba(10,14,26,0.88)), url('img/ship-general.svg'); }
.fleet-card.ship-img-liquid       { background-image: linear-gradient(180deg, rgba(10,14,26,0.62), rgba(10,14,26,0.88)), url('img/ship-liquid.svg'); }
.fleet-card.ship-img-bulk         { background-image: linear-gradient(180deg, rgba(10,14,26,0.62), rgba(10,14,26,0.88)), url('img/ship-bulk.svg'); }
.fleet-card.ship-img-livestock    { background-image: linear-gradient(180deg, rgba(10,14,26,0.62), rgba(10,14,26,0.88)), url('img/ship-livestock.svg'); }
.fleet-card.ship-img-refrigerated { background-image: linear-gradient(180deg, rgba(10,14,26,0.62), rgba(10,14,26,0.88)), url('img/ship-refrigerated.svg'); }
.fleet-card.ship-img-universal    { background-image: linear-gradient(180deg, rgba(10,14,26,0.62), rgba(10,14,26,0.88)), url('img/ship-universal.svg'); }

.fleet-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.fleet-head .ico { font-size: 28px; line-height: 1; }
.fleet-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.fleet-title strong {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fleet-title small { font-size: 11px; }
.fleet-status { flex-shrink: 0; }

.fleet-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.fleet-pills .pill {
    font-size: 11px;
    padding: 3px 8px;
}

.fleet-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12.5px;
    background: rgba(10,14,26,0.45);
    border-radius: 8px;
    padding: 8px 10px;
}
.fleet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.fleet-row > span:last-child {
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fleet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}
.fleet-actions .btn { flex: 1 1 auto; }

/* =========================================================
   KARTE
   ========================================================= */
.map-wrap {
    background: radial-gradient(ellipse at center, #1a213e 0%, #050818 100%);
    border-radius: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    margin-bottom: 16px;
}
.map { position: relative; width: 100%; min-height: 400px; }
/* WICHTIG: .planet-dot ist KEIN Block-Container mit translate(-50%, -50%).
   Der eigentliche Marker-Punkt (.dot) wird selbst absolut am Anker zentriert, das Label
   hängt darunter. So liegt der sichtbare Punkt exakt auf der Koordinate — Routen-Endpunkte
   in der SVG-Layer treffen den sichtbaren Marker ohne Versatz. */
.planet-dot {
    position: absolute;
    width: 0; height: 0;            /* nur Anker, keine Boundingbox */
    cursor: pointer;
}
.planet-dot .dot {
    position: absolute;
    left: 0; top: 0;
    width: 8px; height: 8px;
    margin: -4px 0 0 -4px;          /* halb-Größe als negativer Margin → Mittelpunkt am Anker */
    border-radius: 50%;
    background: #555;
    border: 1px solid #aaa;
    transition: background .15s, border-color .15s, box-shadow .15s;
    transform: scale(var(--marker-scale, 1));
    transform-origin: center center;
}
.planet-dot.me .dot   { background: var(--ok); border-color: #fff; box-shadow: 0 0 8px var(--ok); }
.planet-dot.other .dot{ background: var(--accent); border-color: #fff; }
.planet-dot.npc .dot  { background: #888; }
.planet-dot.active .dot { animation: pulse 1.5s infinite; }
.planet-dot .lbl {
    position: absolute;
    left: 0; top: 6px;              /* unterhalb des Dot-Mittelpunkts (4 px Radius + 2 px Abstand) */
    font-size: 9px;
    background: rgba(0,0,0,.5); padding: 1px 4px; border-radius: 3px;
    white-space: nowrap;
    transform: translateX(-50%) scale(var(--marker-scale, 1));
    transform-origin: top center;
    pointer-events: none;
}
/* Terra-Sonderfall: deutlich größer */
.planet-dot.terra .dot {
    width: 16px; height: 16px; border-width: 2px;
    margin: -8px 0 0 -8px;          /* halb-Größe für 16-px-Marker */
}
.planet-dot.terra .lbl { font-size: 11px; font-weight: 600; top: 10px; }
@keyframes pulse {
    0%, 100% { transform: scale(var(--marker-scale, 1)); }
    50%      { transform: scale(calc(var(--marker-scale, 1) * 1.4)); }
}

/* Reicher Hover-Tooltip auf der Sternenkarte — Anker (.planet-dot) ist 0x0, Tooltip wird
   relativ zur Anker-Position (= Marker-Mittelpunkt) positioniert und nach oben ausgelegt. */
.planet-dot .planet-tooltip {
    display: none;
    position: absolute;
    left: 0; bottom: 12px;          /* 12 px über dem Anker → bleibt knapp über dem Marker */
    transform: translateX(-50%);
    min-width: 220px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,.6);
    z-index: 100;
    text-align: left;
    pointer-events: none;
    font-size: 12px;
    line-height: 1.4;
}
.planet-dot:hover .planet-tooltip { display: block; }
.planet-dot:hover { z-index: 200; }
.planet-tooltip::after {
    content: '';
    position: absolute;
    top: 100%; left: 50%; transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--line);
}
.planet-tooltip .pt-name {
    font-size: 14px; margin-bottom: 6px;
    padding-bottom: 6px; border-bottom: 1px solid var(--line);
    color: var(--text);
}
.planet-tooltip .pt-row {
    display: flex; justify-content: space-between; gap: 12px;
    color: var(--text);
}
.planet-tooltip .pt-k { color: var(--muted); }
.planet-tooltip .pt-divider { height: 1px; background: var(--line); margin: 6px 0; }
.planet-tooltip .pt-bonus-title { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.planet-tooltip .pt-bonus { color: #5fffa0; font-size: 11px; }

/* =========================================================
   EVENTS
   ========================================================= */
.event-list { list-style: none; padding: 0; margin: 0; }
.event-list li {
    padding: 10px 14px; border-left: 3px solid var(--line);
    margin-bottom: 4px; background: var(--bg-2); border-radius: 0 8px 8px 0;
    display: flex; align-items: center; gap: 12px;
}
.event-list .time { color: var(--muted); font-size: 12px; min-width: 100px; }
.event-list .evt-build { border-left-color: var(--accent); }
.event-list .evt-upgrade { border-left-color: var(--accent-2); }
.event-list .evt-production { border-left-color: var(--ok); }
.event-list .evt-transport { border-left-color: var(--warn); }
.event-list .evt-order_done { border-left-color: var(--ok); }
.event-list .evt-order_failed { border-left-color: var(--error); }
.event-list .evt-trade { border-left-color: #ff8dd2; }
.event-list .evt-research { border-left-color: #c46aff; }

/* =========================================================
   MODAL
   ========================================================= */
.modal {
    position: fixed; inset: 0;
    background: rgba(5,8,20,.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; backdrop-filter: blur(6px);
}
.modal.hidden { display: none; }
.modal-body {
    background: var(--bg-1); border: 1px solid var(--line);
    border-radius: 14px; padding: 26px; max-width: 480px; width: 90%;
    box-shadow: var(--shadow);
    max-height: 90vh; overflow-y: auto;
}
/* Breitere Variante für komplexere Formulare (z.B. Versorgungsrouten mit Schiff-Pool) */
.modal-body.modal-wide { max-width: 640px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.inline-form {
    display: flex; gap: 12px; flex-wrap: wrap;
    align-items: end; margin-bottom: 16px;
    background: var(--bg-2); border: 1px solid var(--line);
    border-radius: 12px; padding: 14px;
}
.inline-form label { margin-bottom: 0; flex: 1 1 140px; }

.toast-host { position: fixed; right: 16px; top: 80px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 14px; box-shadow: var(--shadow); min-width: 220px;
    animation: slideIn .25s ease-out;
}
.toast.ok { border-left: 4px solid var(--ok); }
.toast.error { border-left: 4px solid var(--error); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =========================================================
   RESPONSIVE — Tablet (≤1100px) → kompaktere Pills, weniger Padding
   ========================================================= */
@media (max-width: 1100px) {
    .topbar { padding: 8px 10px; gap: 8px; }
    .res-pill { padding: 3px 7px; font-size: 11px; }
    .res-pill .ico { font-size: 13px; }
    .res-pill .cap { font-size: 9px; }
    .logo.small { font-size: 18px; }
}

/* =========================================================
   RESPONSIVE — Mobile (≤900px) → Sidebar als Overlay, Tabs scrollbar
   ========================================================= */
@media (max-width: 900px) {
    .login-page .login-shell { grid-template-columns: 1fr; }

    /* Header: Burger zeigen, Pills horizontal scrollbar */
    .mobile-menu-btn { display: inline-flex; align-items: center; }
    .topbar-left { gap: 6px; }
    .topbar-resources {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .topbar-resources::-webkit-scrollbar { height: 4px; }
    .topbar-resources::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
    .topbar-user .user-info { display: none; }   /* Username versteckt auf Mobile — Platz sparen */
    .topbar-user .btn { padding: 5px 10px; font-size: 12px; }

    /* Sidebar: Overlay statt Fixed, ein-/ausklappbar via .sidebar-open auf <body> */
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: 80%; max-width: 300px;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,.5);
        padding-top: 60px;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open::after {
        content: ''; position: fixed; inset: 0; z-index: 150;
        background: rgba(0,0,0,.5);
    }

    /* Content: keine linke Margin mehr */
    .content { margin-left: 0; padding: 14px 12px; }
    .footer { margin-left: 0; padding: 10px 12px; }

    /* Cards & Grids: voller Breite */
    .card { padding: 14px; border-radius: 10px; margin-bottom: 12px; }
    .card-head h2 { font-size: 18px; }
    .resource-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
    .res-card { padding: 10px; }
    .building-grid { grid-template-columns: 1fr; }
    .bot-grid { grid-template-columns: 1fr; }

    /* Tabellen: horizontal scrollbar machen */
    .data-table { font-size: 12px; }
    .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Tabs: horizontal scrollbar */
    .admin-tabs, .bank-tabs {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }
    .admin-tab, .bank-tab { white-space: nowrap; flex-shrink: 0; }

    /* Modals: voller Bildschirm minus Rand */
    .modal-body { width: calc(100vw - 24px); max-width: 480px; padding: 18px; }

    /* Karte (Sternenkarte) — kleiner */
    .star-map { height: 60vw !important; min-height: 320px; }
}

/* =========================================================
   RESPONSIVE — Smartphone (≤480px) → noch kompakter
   ========================================================= */
@media (max-width: 480px) {
    .topbar { padding: 6px 8px; gap: 6px; }
    .res-pill { padding: 3px 6px; font-size: 10px; gap: 3px; }
    .res-pill .ico { font-size: 12px; }
    .res-pill .cap { display: none; }                   /* nur noch Wert, kein /cap */
    .logo.small { font-size: 14px; }
    .topbar-user .btn { font-size: 11px; padding: 4px 8px; }
    .card-head h2 { font-size: 16px; }
    .resource-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .res-card .res-val { font-size: 14px; }
    .data-table th, .data-table td { padding: 6px 4px; font-size: 11px; }
}
