/* ===================================================
   Void Colonies – Sci-Fi UI v0.3
   Modernes, verspieltes Weltraum-Design
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Exo+2:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-deep: #02050e;
    --bg-primary: #070c1a;
    --bg-secondary: #0b1225;
    --bg-card: rgba(15, 25, 55, 0.7);
    --bg-card-hover: rgba(20, 35, 70, 0.85);
    --bg-card-solid: #0f1937;
    --border-color: rgba(59, 130, 246, 0.15);
    --border-glow: rgba(0, 200, 255, 0.25);
    --border-active: rgba(0, 200, 255, 0.5);
    --text-primary: #e8f0fe;
    --text-secondary: #8899bb;
    --text-muted: #4a5a7a;
    --accent: #00c8ff;
    --accent-hover: #33ddff;
    --accent-dim: rgba(0, 200, 255, 0.12);
    --success: #00e676;
    --success-bg: rgba(0, 230, 118, 0.1);
    --success-glow: rgba(0, 230, 118, 0.3);
    --warning: #ffd740;
    --warning-bg: rgba(255, 215, 64, 0.1);
    --warning-glow: rgba(255, 215, 64, 0.3);
    --error: #ff5252;
    --error-bg: rgba(255, 82, 82, 0.1);
    --error-glow: rgba(255, 82, 82, 0.3);
    --info: #40c4ff;
    --info-bg: rgba(64, 196, 255, 0.1);
    --purple: #b388ff;
    --gold: #ffd740;
    --pink: #ff80ab;
    --sidebar-width: 210px;
    --topbar-height: 52px;
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Exo 2', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow-glow: 0 0 30px rgba(0, 200, 255, 0.05);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(0, 100, 200, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(100, 0, 200, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0, 200, 255, 0.03) 0%, transparent 50%);
}

/* ---- Scanline Overlay ---- */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 200, 255, 0.008) 2px,
        rgba(0, 200, 255, 0.008) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

a { color: var(--accent); text-decoration: none; transition: all 0.3s; }
a:hover { color: var(--accent-hover); text-shadow: 0 0 8px rgba(0, 200, 255, 0.4); }

::selection {
    background: var(--accent);
    color: var(--bg-deep);
}

.container { max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; }

/* ---- Galaktischer Hintergrund (Canvas) ---- */
.galaxy-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

/* ---- Layout ---- */
.main-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-wrapper.with-sidebar {
    margin-left: var(--sidebar-width);
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #080e20 0%, #0a1228 100%);
    border-right: 1px solid var(--border-color);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 30px rgba(0, 0, 0, 0.5);
}

.sidebar-brand {
    padding: 1rem 1.25rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    position: relative;
}

.sidebar-brand::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 20%;
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.sidebar-brand a {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-primary) !important;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sidebar-player-name {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.25rem;
    color: var(--text-secondary) !important;
    font-size: 0.85rem;
    font-weight: 400;
    transition: all 0.25s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(0, 200, 255, 0.06), transparent);
    transition: width 0.3s ease;
}

.sidebar-link:hover {
    background: rgba(0, 200, 255, 0.04);
    color: var(--text-primary) !important;
}

.sidebar-link:hover::before { width: 100%; }

.sidebar-link.active {
    background: rgba(0, 200, 255, 0.06);
    color: var(--accent) !important;
    border-left-color: var(--accent);
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.2);
}

.sidebar-icon {
    font-size: 1.1rem;
    width: 1.6rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.sidebar-label {
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.sidebar-spacer { flex: 1; }

.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

/* ---- Topbar ---- */
.topbar {
    background: linear-gradient(180deg, rgba(8, 14, 32, 0.95), rgba(10, 18, 40, 0.9));
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
    max-width: 1140px;
    margin: 0 auto;
}

.with-sidebar .topbar-inner { max-width: 100%; }

.topbar-brand {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary) !important;
    letter-spacing: 0.1em;
    text-shadow: 0 0 15px rgba(0, 200, 255, 0.2);
}

.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

.topbar-link {
    font-size: 0.82rem;
    color: var(--text-secondary) !important;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    transition: all 0.25s;
    border: 1px solid transparent;
}

.topbar-link:hover {
    color: var(--text-primary) !important;
    background: rgba(0, 200, 255, 0.06);
    border-color: rgba(0, 200, 255, 0.15);
}

.topbar-link-primary {
    background: linear-gradient(135deg, var(--accent), #0099ff);
    color: #fff !important;
    border-color: var(--accent);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.topbar-link-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #00bbff);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.3);
}

/* ---- Topbar Resource Display ---- */
.topbar-resources {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(0, 200, 255, 0.08);
}

.topbar-resources .resource-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-right: 1px solid rgba(0, 200, 255, 0.08);
    cursor: default;
    transition: all 0.2s;
}

.topbar-resources .resource-item:last-child { border-right: none; }

.topbar-resources .resource-item:hover {
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(0, 200, 255, 0.2);
}

.topbar-resources .resource-metal span { color: #90a4ae; }
.topbar-resources .resource-crystal span { color: #b388ff; }
.topbar-resources .resource-fuel span { color: #ffab40; }
.topbar-resources .resource-energy span { color: #ffd740; }
.topbar-resources .resource-credits span { color: #ffd740; }

/* ---- Flash Messages ---- */
.flash-messages { margin-top: 0.75rem; }

.flash {
    padding: 0.7rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    border: 1px solid transparent;
    animation: flashSlide 0.4s ease-out;
    backdrop-filter: blur(8px);
}

@keyframes flashSlide {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-error {
    background: rgba(255, 82, 82, 0.12);
    border-color: rgba(255, 82, 82, 0.25);
    color: #ff8a80;
    box-shadow: 0 0 15px rgba(255, 82, 82, 0.08);
}

.flash-success {
    background: rgba(0, 230, 118, 0.1);
    border-color: rgba(0, 230, 118, 0.2);
    color: #69f0ae;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.06);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.25s ease;
    text-align: center;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.4s ease, height 0.4s ease;
    transform: translate(-50%, -50%);
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #0099ff);
    color: #fff !important;
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(0, 200, 255, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), #00bbff);
    box-shadow: 0 4px 20px rgba(0, 200, 255, 0.35);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(0, 200, 255, 0.04);
    color: var(--text-secondary) !important;
    border-color: rgba(0, 200, 255, 0.12);
}

.btn-secondary:hover {
    background: rgba(0, 200, 255, 0.08);
    color: var(--text-primary) !important;
    border-color: rgba(0, 200, 255, 0.25);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.06);
}

.btn-secondary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-danger {
    background: linear-gradient(135deg, #ff5252, #d32f2f);
    color: #fff !important;
    border-color: #ff5252;
    box-shadow: 0 2px 12px rgba(255, 82, 82, 0.2);
}

.btn-danger:hover {
    box-shadow: 0 4px 20px rgba(255, 82, 82, 0.35);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #ffd740, #ffaa00);
    color: #1a1a2e !important;
    border-color: #ffd740;
    box-shadow: 0 2px 12px rgba(255, 215, 64, 0.2);
}

.btn-warning:hover {
    box-shadow: 0 4px 20px rgba(255, 215, 64, 0.35);
    transform: translateY(-1px);
    color: #0a0a1a !important;
}

.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.78rem; border-radius: 6px; }
.btn-lg { padding: 0.85rem 2.2rem; font-size: 1rem; border-radius: 10px; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-card);
}

.card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-card), 0 0 30px rgba(0, 200, 255, 0.04);
}

.card-header {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: rgba(0, 200, 255, 0.02);
}

.card-header h2 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.card-body { padding: 1.25rem; }

/* ---- Card Grid ---- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1rem;
}

.card-grid .card { margin-bottom: 0; }

/* ---- Glass Cards ---- */
.glass-card {
    background: rgba(15, 25, 55, 0.4);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 200, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.glass-card:hover {
    border-color: rgba(0, 200, 255, 0.2);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 200, 255, 0.04);
}

/* ---- Forms ---- */
.form-group { margin-bottom: 0.9rem; }

.form-group label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.form-control {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: rgba(2, 5, 14, 0.8);
    border: 1px solid rgba(0, 200, 255, 0.12);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: all 0.25s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.1), 0 0 20px rgba(0, 200, 255, 0.04);
    background: rgba(2, 5, 14, 0.95);
}

.form-control-sm { padding: 0.35rem 0.55rem; font-size: 0.8rem; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238899bb' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    padding-right: 2.2rem;
}

.form-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group { flex: 1; min-width: 140px; }
.form-group-submit { flex: 0 0 auto; min-width: auto !important; }

/* ---- Auth Pages ---- */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 85vh;
    position: relative;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 60px rgba(0, 200, 255, 0.03);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--purple), transparent);
}

.auth-card h1 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.75rem; }
.auth-link { text-align: center; margin-top: 1.25rem; font-size: 0.85rem; color: var(--text-muted); }

/* ---- Hero ---- */
.hero {
    text-align: center;
    padding: 6rem 0 3rem;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 2rem; left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 200, 255, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    background: linear-gradient(135deg, var(--accent) 0%, #60a5fa 30%, var(--purple) 60%, var(--pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: heroPulse 4s ease-in-out infinite alternate;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(0, 200, 255, 0.15));
}

@keyframes heroPulse {
    0% { filter: drop-shadow(0 0 20px rgba(0, 200, 255, 0.1)); }
    100% { filter: drop-shadow(0 0 40px rgba(0, 200, 255, 0.25)); }
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.05em;
}

.hero-text {
    color: var(--text-muted);
    max-width: 620px;
    margin: 1rem auto 2.5rem;
    font-size: 0.9rem;
    line-height: 1.7;
}

.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---- Features ---- */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    padding: 2rem 0 4rem;
}

.feature-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.75rem 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover {
    border-color: rgba(0, 200, 255, 0.3);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 30px rgba(0, 200, 255, 0.04);
}

.feature-card:hover::before { opacity: 1; }

.feature-card h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.04em;
}

.feature-card p { color: var(--text-muted); font-size: 0.85rem; line-height: 1.6; }

/* ---- Page Headers ---- */
.page-header {
    margin: 1.25rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    text-shadow: 0 0 15px rgba(0, 200, 255, 0.1);
}

.dashboard-header {
    margin: 1.25rem 0 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dashboard-header h1 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-shadow: 0 0 15px rgba(0, 200, 255, 0.1);
}

/* ---- HUD Resource Bar ---- */
.resource-bar {
    display: flex;
    gap: 0;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0;
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: var(--shadow-card), inset 0 1px 0 rgba(0, 200, 255, 0.04);
}

.resource-bar .resource-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.65rem 0.5rem;
    border-right: 1px solid rgba(0, 200, 255, 0.06);
    position: relative;
    transition: background 0.2s;
}

.resource-bar .resource-item:last-child { border-right: none; }

.resource-bar .resource-item:hover {
    background: rgba(0, 200, 255, 0.03);
}

.resource-bar .resource-item::after {
    content: '';
    position: absolute;
    bottom: 0; left: 10%;
    width: 80%;
    height: 2px;
    border-radius: 2px;
    opacity: 0.4;
}

.resource-bar .resource-item:nth-child(1)::after { background: #90a4ae; }
.resource-bar .resource-item:nth-child(2)::after { background: #b388ff; }
.resource-bar .resource-item:nth-child(3)::after { background: #ffab40; }
.resource-bar .resource-item:nth-child(4)::after { background: #ffd740; }

.resource-bar .resource-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.resource-bar .resource-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}

.resource-bar .resource-rate {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.8;
}

.resource-bar .resource-item:nth-child(1) .resource-value { color: #90a4ae; }
.resource-bar .resource-item:nth-child(2) .resource-value { color: #b388ff; }
.resource-bar .resource-item:nth-child(3) .resource-value { color: #ffab40; }
.resource-bar .resource-item:nth-child(4) .resource-value { color: #ffd740; }

/* ---- Resource Colors for Rates ---- */
.resource-bar .resource-item:nth-child(1) .resource-rate { color: #90a4ae; }
.resource-bar .resource-item:nth-child(2) .resource-rate { color: #b388ff; }
.resource-bar .resource-item:nth-child(3) .resource-rate { color: #ffab40; }
.resource-bar .resource-item:nth-child(4) .resource-rate { color: #ffd740; }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    background: rgba(10, 18, 40, 0.8);
    color: var(--text-muted);
    border: 1px solid rgba(0, 200, 255, 0.08);
    white-space: nowrap;
}

.badge-success {
    background: var(--success-bg);
    color: #69f0ae;
    border-color: rgba(0, 230, 118, 0.2);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.06);
}

.badge-warning {
    background: var(--warning-bg);
    color: #ffd740;
    border-color: rgba(255, 215, 64, 0.2);
    box-shadow: 0 0 8px rgba(255, 215, 64, 0.06);
}

.badge-info {
    background: var(--info-bg);
    color: #40c4ff;
    border-color: rgba(64, 196, 255, 0.2);
    box-shadow: 0 0 8px rgba(64, 196, 255, 0.06);
}

.badge-error {
    background: var(--error-bg);
    color: #ff8a80;
    border-color: rgba(255, 82, 82, 0.2);
}

.badge-muted {
    background: rgba(74, 90, 122, 0.1);
    color: var(--text-muted);
}

/* ---- Tables ---- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }

.table th, .table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(0, 200, 255, 0.06);
    font-size: 0.85rem;
}

.table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-display);
}

.table tr:last-child td { border-bottom: none; }

.table tbody tr { transition: background 0.2s; }
.table tbody tr:hover { background: rgba(0, 200, 255, 0.03); }

.building-row {
    cursor: pointer;
    transition: background 0.2s;
}

.building-upgrading {
    background: rgba(255, 215, 64, 0.04) !important;
    border-left: 3px solid var(--warning);
}

.building-locked {
    opacity: 0.6;
}

.building-locked:hover {
    opacity: 0.8;
}

.building-prereq {
    font-size: 0.72rem;
    color: var(--error);
    margin-top: 2px;
}

.btn-muted {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: not-allowed;
    opacity: 0.5;
}

.building-level {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    color: var(--accent);
}

.building-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.building-icon {
    font-size: 1.3rem;
    width: 2rem;
    text-align: center;
}

.building-info { line-height: 1.3; }

.building-desc {
    font-size: 0.75rem !important;
}

.building-production .resource-rate {
    color: var(--success);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

/* ---- Costs ---- */
.costs-cell { line-height: 1.8; }
.cost {
    font-size: 0.78rem;
    margin-right: 0.3rem;
    white-space: nowrap;
    transition: color 0.3s;
    font-family: var(--font-mono);
}
.cost-ok { color: var(--text-secondary); }
.cost-low { color: var(--error); opacity: 0.7; }

.build-time {
    display: block;
    font-size: 0.7rem;
    margin-top: 0.15rem;
}

/* ---- Events ---- */
.event-list { display: flex; flex-direction: column; gap: 0.6rem; }

.event-item {
    padding: 0.65rem 0.85rem;
    background: rgba(2, 5, 14, 0.5);
    border-radius: 8px;
    border-left: 3px solid var(--border-color);
    transition: background 0.2s;
}

.event-item:hover { background: rgba(2, 5, 14, 0.7); }

.event-info { border-left-color: var(--info); }
.event-success { border-left-color: var(--success); }
.event-warning { border-left-color: var(--warning); }
.event-error { border-left-color: var(--error); }

.event-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.25rem; }
.event-meta small { color: var(--text-muted); font-size: 0.72rem; font-family: var(--font-mono); }
.event-item p { font-size: 0.8rem; color: var(--text-secondary); }

/* ---- Full Event List ---- */
.event-list-full {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.event-card {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    align-items: flex-start;
}

.event-icon {
    font-size: 1.3rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
    background: rgba(0, 200, 255, 0.06);
}

.event- .event-icon { background: var(--info-bg); }
.event-success .event-icon { background: var(--success-bg); color: var(--success); }
.event-warning .event-icon { background: var(--warning-bg); color: var(--warning); }
.event-error .event-icon { background: var(--error-bg); color: var(--error); }

.event-body { flex: 1; }
.event-body p { color: var(--text-secondary); font-size: 0.82rem; margin-top: 0.25rem; }

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.event-date {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-family: var(--font-mono);
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding: 0.75rem;
}

.pagination-info {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ---- System List ---- */
.system-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.4rem;
}

.system-list li {
    padding: 0.5rem 0.75rem;
    background: rgba(2, 5, 14, 0.5);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--accent);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.system-list li:hover {
    background: rgba(0, 200, 255, 0.04);
    border-color: rgba(0, 200, 255, 0.1);
}

/* ---- Ship Grid ---- */
.ship-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1rem;
}

.ship-card {
    background: rgba(2, 5, 14, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ship-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.ship-card:hover {
    border-color: rgba(0, 200, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.ship-card:hover::before { opacity: 1; }

.ship-card-locked { opacity: 0.6; }
.ship-card-locked:hover { transform: none; }
.ship-card-locked::before { display: none; }

.ship-icon {
    font-size: 2.8rem;
    margin-bottom: 0.6rem;
    display: block;
}

.ship-card h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    letter-spacing: 0.04em;
}

.ship-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    min-height: 2.5em;
}

.ship-stats {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.ship-stats span {
    padding: 0.2rem 0.5rem;
    background: rgba(0, 200, 255, 0.04);
    border-radius: 4px;
    border: 1px solid rgba(0, 200, 255, 0.06);
}

.ship-costs { margin-bottom: 0.75rem; }
.ship-name-input { margin-bottom: 0.5rem; }

/* ---- Player Ship Table ---- */
.player-ships .table th:nth-child(2),
.player-ships .table td:nth-child(2) { text-align: center; }

.ship-link {
    color: var(--accent) !important;
    font-weight: 600;
    transition: all 0.2s;
}

.ship-link:hover {
    color: var(--accent-hover) !important;
    text-shadow: 0 0 8px rgba(0, 200, 255, 0.3);
}

/* ---- Starmap: System Grid ---- */
.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 1.25rem;
}

.system-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-card);
}

.system-card:hover {
    border-color: rgba(0, 200, 255, 0.2);
    box-shadow: var(--shadow-card), 0 0 30px rgba(0, 200, 255, 0.04);
    transform: translateY(-2px);
}

.system-card-home {
    border-color: rgba(0, 230, 118, 0.2);
    box-shadow: var(--shadow-card), 0 0 20px rgba(0, 230, 118, 0.04);
}

.system-card-home:hover {
    border-color: rgba(0, 230, 118, 0.35);
    box-shadow: var(--shadow-card), 0 0 30px rgba(0, 230, 118, 0.06);
}

.system-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.system-star-icon {
    font-size: 1.2rem;
    color: #ffd54f;
    text-shadow: 0 0 10px rgba(255, 213, 79, 0.4);
}

.system-card-header h2 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    flex: 1;
    letter-spacing: 0.05em;
}

.system-canvas {
    display: block;
    width: 100%;
    height: 270px;
    cursor: default;
}

.system-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.system-legend { display: flex; gap: 0.4rem; }

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
}

.legend-planet { background: #4fc3f7; color: #4fc3f7; }
.legend-moon   { background: #b0bec5; color: #b0bec5; }
.legend-asteroid { background: #a1887f; color: #a1887f; }
.legend-station  { background: #80cbc4; color: #80cbc4; }
.legend-ruin     { background: #ce93d8; color: #ce93d8; }

/* ---- Info Cards ---- */
.info-card { margin-top: 0.5rem; }

.info-card .card-header h2 {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.info-item strong {
    display: block;
    font-size: 0.88rem;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.info-item p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---- Mission Form ---- */
.mission-form .form-row { align-items: flex-end; }

/* ---- Mission List ---- */
.mission-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* ---- Trade Route Cards ---- */
.trade-route-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s;
}
.trade-route-card:hover {
    border-color: rgba(0, 200, 255, 0.3);
}
.trade-route-card-completed {
    opacity: 0.65;
}
.trade-route-timer {
    font-family: var(--font-mono);
    color: var(--accent);
}
.route-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.route-detail-item {
    background: rgba(0,0,0,0.2);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}
.route-detail-item .detail-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.route-detail-item .detail-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}
/* ---- Trade List ---- */
.trade-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .trade-grid { grid-template-columns: 1fr; }
}

/* ---- Text utilities ---- */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.credit-display { color: var(--gold); font-weight: 600; }

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

/* ---- Main Content ---- */
.main-content {
    padding-top: 1rem;
    min-height: calc(100vh - var(--topbar-height) - 80px);
}

/* ---- Loading / Placeholder ---- */
.loading-pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ---- Admin Stats ---- */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
    transition: border-color 0.3s;
}

.stat-card:hover {
    border-color: rgba(0, 200, 255, 0.2);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.25rem;
    display: block;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 200, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 200, 255, 0.3);
}

/* ---- Form Row (für nebeneinander) ---- */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    flex: 1 1 180px;
    min-width: 140px;
}

.form-row .form-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

.form-row .form-group select,
.form-row .form-group input {
    width: 100%;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.inline-form label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.inline-form select,
.inline-form input[type="text"] {
    padding: 0.5rem 0.75rem;
}

/* ---- Progress-Bar ---- */
.progress-bar {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    height: 22px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 6px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.3);
}

/* ---- Card Actions ---- */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ---- Info Grid in Karten (Verhaltensweisen) ---- */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.info-item {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.info-item strong {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--accent);
}

.info-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---- Badge variants ---- */
.badge-accent {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(0, 200, 255, 0.3);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(255, 82, 82, 0.3);
}

/* ---- Card Warning (aktives Gefecht) ---- */
.card-warning {
    border-color: var(--warning-glow) !important;
    box-shadow: 0 0 20px rgba(255, 215, 64, 0.08);
}

/* ---- Form group for inline forms ---- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
}

.form-group textarea {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.15);
}

/* ===================================================
   Routen-UI – visuelle Routenkarten
   =================================================== */

/* ---- Route-Formular: Schritt-für-Schritt ---- */
.route-form {
    width: 100%;
}

.route-form-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.route-form-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 1px solid rgba(0, 200, 255, 0.3);
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

.step-content select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.step-content select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.15);
}

.route-form-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0 0 0 40px;
}

.connector-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.4;
}

.connector-line {
    width: 2px;
    height: 20px;
    background: linear-gradient(180deg, rgba(0, 200, 255, 0.3), rgba(0, 200, 255, 0.1));
}

.route-form-planets {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-route-start {
    width: 100%;
    padding: 0.85rem !important;
    font-size: 1rem !important;
}

/* ---- Verhalten-Selektoren ---- */
.behavior-select-wrapper select {
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
}

/* ---- Route-Cards ---- */
.route-cards-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0;
}

.route-card {
    background: linear-gradient(135deg, var(--bg-card), rgba(15, 25, 55, 0.9));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.route-card:hover {
    border-color: rgba(0, 200, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.06);
}

.route-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.route-ship-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.route-ship-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.route-ship-details {
    display: flex;
    flex-direction: column;
}

.route-ship-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent) !important;
    text-decoration: none;
    transition: text-shadow 0.2s;
}

.route-ship-name:hover {
    text-shadow: 0 0 8px rgba(0, 200, 255, 0.4);
}

.route-ship-type {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ---- Behavior-Badge ---- */
.route-behavior-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-body);
    white-space: nowrap;
}

.behavior-pass {
    background: rgba(74, 90, 122, 0.2);
    color: var(--text-muted);
    border: 1px solid rgba(74, 90, 122, 0.3);
}

.behavior-attack {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(255, 82, 82, 0.3);
}

.behavior-trade {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

.behavior-ask {
    background: rgba(180, 136, 255, 0.1);
    color: var(--purple);
    border: 1px solid rgba(180, 136, 255, 0.3);
}

/* ---- Route-Path (visuelle Strecke) ---- */
.route-path {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.route-planet {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.planet-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.planet-marker-from {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(0, 200, 255, 0.5);
}

.planet-marker-to {
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.5);
}

.planet-label {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.planet-label strong {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.planet-label small {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* --- Route-Linie mit animiertem Schiff ---- */
.route-line-wrapper {
    flex: 1;
    padding: 0 0.2rem;
}

.route-line {
    position: relative;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 2px;
    opacity: 0.4;
}

.route-ship-anim {
    position: absolute;
    top: 50%;
    left: 10%;
    font-size: 1rem;
    transform: translateY(-50%);
    animation: shipMove 4s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(0, 200, 255, 0.4));
}

@keyframes shipMove {
    0%   { left: 5%; }
    50%  { left: 85%; }
    100% { left: 5%; }
}

/* ---- Route-Card Footer ---- */
.route-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.route-meta {
    display: flex;
    gap: 0.75rem;
}

.meta-item {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.route-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.behavior-form {
    display: inline;
}

.behavior-select {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-body);
}

.behavior-select:focus {
    outline: none;
    border-color: var(--accent);
}

.stop-form {
    display: inline;
}

.btn-stop-route {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* ---- Leerer Zustand ---- */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ---- Verhaltensweisen – visuelle Karten ---- */
.behaviors-visual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}

.behavior-visual-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
    transition: border-color 0.2s;
}

.behavior-visual-card:hover {
    border-color: rgba(0, 200, 255, 0.2);
}

.behavior-visual-icon {
    font-size: 1.4rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.behavior-pass .behavior-visual-icon {
    background: rgba(74, 90, 122, 0.15);
}

.behavior-attack .behavior-visual-icon {
    background: var(--error-bg);
    color: var(--error);
}

.behavior-trade .behavior-visual-icon {
    background: var(--success-bg);
    color: var(--success);
}

.behavior-ask .behavior-visual-icon {
    background: rgba(180, 136, 255, 0.1);
    color: var(--purple);
}

.behavior-visual-content strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.behavior-visual-content p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---- Responsive: Route-Cards auf schmalen Bildschirmen ---- */
@media (max-width: 768px) {
    .route-path {
        flex-direction: column;
        gap: 0.5rem;
    }

    .route-line-wrapper {
        width: 100%;
        padding: 0.5rem 0;
    }

    .route-line {
        height: 3px;
    }

    .route-card-top {
        flex-direction: column;
        gap: 0.5rem;
    }

    .route-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .route-actions {
        justify-content: flex-end;
    }

    .route-form-planets {
        flex-direction: column;
    }

    .route-form-connector {
        flex-direction: row;
        padding: 0;
        gap: 4px;
    }

    .connector-line {
        width: 20px;
        height: 2px;
        background: linear-gradient(90deg, rgba(0, 200, 255, 0.3), rgba(0, 200, 255, 0.1));
    }
}

/* ===================================================
   Hilfe-Popup-System (?-Icons)
   =================================================== */
.help-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 200, 255, 0.12);
    border: 1px solid rgba(0, 200, 255, 0.25);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-display);
    cursor: pointer;
    vertical-align: middle;
    margin-left: 0.4rem;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    line-height: 1;
    user-select: none;
}

.help-trigger:hover {
    background: rgba(0, 200, 255, 0.25);
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(0, 200, 255, 0.3);
}

.help-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: none;
}
.help-overlay.active { display: block; }

.help-popup {
    position: fixed;
    z-index: 1000;
    width: 340px;
    max-width: calc(100vw - 40px);
    background: var(--bg-card-solid);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 200, 255, 0.08);
    display: none;
    overflow: hidden;
}
.help-popup.active { display: block; }

.help-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 200, 255, 0.04);
}

.help-popup-title {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
}

.help-popup-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.2rem;
    transition: color 0.2s;
}

.help-popup-close:hover {
    color: var(--text-primary);
}

.help-popup-body {
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-popup-body strong {
    color: var(--text-primary);
}

.help-popup-body br {
    display: block;
    content: '';
    margin: 0.3rem 0;
}

/* ===================================================
   Anleitung-Seite
   =================================================== */
.page-guide .page-header {
    margin-bottom: 1.5rem;
}

.guide-search-wrapper {
    margin-bottom: 1.5rem;
}

.guide-search {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.guide-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(0, 200, 255, 0.12);
}

.guide-search::placeholder {
    color: var(--text-muted);
}

.guide-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.guide-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.guide-section:hover {
    border-color: rgba(0, 200, 255, 0.2);
}

.guide-section-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.guide-section-title:hover {
    background: rgba(0, 200, 255, 0.04);
}

.guide-section-body {
    padding: 0 1.25rem 1.25rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.guide-section-body p {
    margin-bottom: 0.6rem;
}

.guide-section-body ol,
.guide-section-body ul {
    margin: 0.5rem 0 0.8rem 1.5rem;
}

.guide-section-body li {
    margin-bottom: 0.3rem;
}

.guide-section-body .table {
    margin: 0.5rem 0 0.8rem;
}

/* ===================================================
   3D-Ressourcen-Gems (Kristall-Icons)
   =================================================== */
.resource-gem {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    position: relative;
    flex-shrink: 0;
}

.resource-gem::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transform: perspective(400px) rotateX(10deg) rotateY(-5deg);
    transition: transform 0.3s;
}

.resource-gem:hover::before {
    transform: perspective(400px) rotateX(0deg) rotateY(0deg) scale(1.1);
}

.resource-gem::after {
    content: attr(data-icon);
    position: relative;
    z-index: 1;
    font-size: 11px;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
}

/* Metall – silbergrauer Kristall */
.gem-metal::before {
    background: linear-gradient(135deg, #cfd8dc, #78909c 40%, #546e7a 70%, #90a4ae);
    box-shadow: 0 0 12px rgba(144, 164, 174, 0.4), inset 0 0 20px rgba(255,255,255,0.1);
    border: 1px solid rgba(144, 164, 174, 0.3);
}

/* Kristalle – lila Kristall */
.gem-crystal::before {
    background: linear-gradient(135deg, #ea80fc, #b388ff 40%, #7c4dff 70%, #b388ff);
    box-shadow: 0 0 12px rgba(179, 136, 255, 0.5), inset 0 0 20px rgba(255,255,255,0.15);
    border: 1px solid rgba(179, 136, 255, 0.3);
}

/* Treibstoff – goldener Kristall */
.gem-fuel::before {
    background: linear-gradient(135deg, #ffe082, #ffab40 40%, #ff8f00 70%, #ffca28);
    box-shadow: 0 0 12px rgba(255, 171, 64, 0.5), inset 0 0 20px rgba(255,255,255,0.15);
    border: 1px solid rgba(255, 171, 64, 0.3);
}

/* Energie – grüner Kristall */
.gem-energy::before {
    background: linear-gradient(135deg, #b9f6ca, #69f0ae 40%, #00e676 70%, #00c853);
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.5), inset 0 0 20px rgba(255,255,255,0.15);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

/* Credits – cyan Kristall */
.gem-credits::before {
    background: linear-gradient(135deg, #80d8ff, #40c4ff 40%, #0091ea 70%, #00b8d4);
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.5), inset 0 0 20px rgba(255,255,255,0.15);
    border: 1px solid rgba(0, 200, 255, 0.3);
}

/* Gem-Größen */
.gem-sm { width: 20px; height: 20px; }
.gem-sm::after { font-size: 8px; }

.gem-lg { width: 38px; height: 38px; }
.gem-lg::after { font-size: 14px; }

/* ---- Topbar mit Gems ---- */
.topbar-resources .resource-item {
    gap: 0.35rem;
}

.topbar-resources .resource-item span {
    font-weight: 600;
}

/* ---- Resource Bar mit Gems ---- */
.resource-bar .resource-item {
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
}

.resource-bar .resource-item .resource-gem {
    width: 24px;
    height: 24px;
}

.resource-bar .resource-label-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.resource-bar .resource-label {
    font-size: 0.6rem;
    margin-bottom: 0.1rem;
}

.resource-bar .resource-value {
    font-size: 0.95rem;
}

.resource-bar .resource-rate {
    font-size: 0.6rem;
    margin-left: auto;
    white-space: nowrap;
}

/* ===================================================
   3D-Gebäude-Icons (isometrische CSS-Blöcke)
   =================================================== */
.building-icon-3d {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    position: relative;
    flex-shrink: 0;
    transform-style: preserve-3d;
}

.building-icon-3d .icon-base {
    position: absolute;
    width: 32px;
    height: 32px;
    background: var(--bg-card-solid);
    border: 1px solid rgba(0, 200, 255, 0.15);
    transform: perspective(500px) rotateX(35deg) rotateY(-15deg);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.building-icon-3d .icon-top {
    position: absolute;
    width: 24px;
    height: 20px;
    bottom: 12px;
    transform: perspective(500px) rotateX(35deg) rotateY(-15deg) translateZ(6px);
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.building-icon-3d .icon-emblem {
    position: relative;
    z-index: 2;
    font-size: 16px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
    transform: perspective(500px) rotateX(10deg);
}

/* Gebäude-spezifische Farben */
.building-mine .icon-base { background: linear-gradient(135deg, #37474f, #546e7a); border-color: rgba(144,164,174,0.3); }
.building-mine .icon-top { background: linear-gradient(135deg, #546e7a, #78909c); }
.building-crystal_extractor .icon-base { background: linear-gradient(135deg, #4a148c, #7c4dff); border-color: rgba(179,136,255,0.3); }
.building-crystal_extractor .icon-top { background: linear-gradient(135deg, #7c4dff, #b388ff); }
.building-refinery .icon-base { background: linear-gradient(135deg, #e65100, #ff8f00); border-color: rgba(255,171,64,0.3); }
.building-refinery .icon-top { background: linear-gradient(135deg, #ff8f00, #ffca28); }
.building-solar_field .icon-base { background: linear-gradient(135deg, #1b5e20, #00e676); border-color: rgba(0,230,118,0.3); }
.building-solar_field .icon-top { background: linear-gradient(135deg, #00e676, #69f0ae); }
.building-storage .icon-base { background: linear-gradient(135deg, #263238, #607d8b); border-color: rgba(96,125,139,0.3); }
.building-storage .icon-top { background: linear-gradient(135deg, #607d8b, #90a4ae); }
.building-command_center .icon-base { background: linear-gradient(135deg, #01579b, #40c4ff); border-color: rgba(0,200,255,0.3); }
.building-command_center .icon-top { background: linear-gradient(135deg, #40c4ff, #80d8ff); }
.building-shipyard .icon-base { background: linear-gradient(135deg, #311b92, #7c4dff); border-color: rgba(124,77,255,0.3); }
.building-shipyard .icon-top { background: linear-gradient(135deg, #7c4dff, #b388ff); }
.building-trade_dock .icon-base { background: linear-gradient(135deg, #00695c, #00e676); border-color: rgba(0,230,118,0.3); }
.building-trade_dock .icon-top { background: linear-gradient(135deg, #00e676, #69f0ae); }

/* ===================================================
   3D-Schiff-Icons (isometrische Schiffs-Silhouetten)
   =================================================== */
.ship-icon-3d {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 32px;
    position: relative;
}

.ship-icon-3d .ship-hull {
    position: absolute;
    width: 34px;
    height: 14px;
    background: linear-gradient(135deg, var(--bg-card-solid), rgba(0,200,255,0.1));
    border: 1px solid rgba(0,200,255,0.2);
    border-radius: 50% 50% 30% 30% / 60% 60% 20% 20%;
    transform: perspective(400px) rotateX(30deg);
    box-shadow: 0 -2px 8px rgba(0,200,255,0.1);
}

.ship-icon-3d .ship-wing {
    position: absolute;
    width: 16px;
    height: 6px;
    background: rgba(0,200,255,0.08);
    border: 1px solid rgba(0,200,255,0.15);
    border-radius: 4px;
}

.ship-icon-3d .ship-wing-l {
    transform: perspective(400px) rotateX(20deg) rotateY(-30deg);
    left: 2px;
    bottom: 2px;
}

.ship-icon-3d .ship-wing-r {
    transform: perspective(400px) rotateX(20deg) rotateY(30deg);
    right: 2px;
    bottom: 2px;
}

.ship-icon-3d .ship-cockpit {
    position: absolute;
    width: 10px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.6;
    top: 6px;
    box-shadow: 0 0 6px rgba(0,200,255,0.4);
}

.ship-icon-3d .ship-emblem {
    position: relative;
    z-index: 2;
    font-size: 13px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}

/* ===================================================
   3D-Event/Trade Icons
   =================================================== */
.event-icon-3d {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    position: relative;
    flex-shrink: 0;
}

.event-icon-3d::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    transform: perspective(400px) rotateX(10deg) rotateY(5deg);
    transition: transform 0.3s;
}

.event-icon-3d:hover::before {
    transform: perspective(400px) rotateX(0deg) rotateY(0deg);
}

.event-icon-3d .icon-symbol {
    position: relative;
    z-index: 1;
    font-size: 16px;
}

.ev-icon-info::before {
    background: linear-gradient(135deg, rgba(0,200,255,0.15), rgba(0,200,255,0.05));
    border: 1px solid rgba(0,200,255,0.2);
    box-shadow: 0 0 10px rgba(0,200,255,0.1), inset 0 0 15px rgba(0,200,255,0.05);
}

.ev-icon-success::before {
    background: linear-gradient(135deg, rgba(0,230,118,0.15), rgba(0,230,118,0.05));
    border: 1px solid rgba(0,230,118,0.2);
    box-shadow: 0 0 10px rgba(0,230,118,0.1), inset 0 0 15px rgba(0,230,118,0.05);
}

.ev-icon-warning::before {
    background: linear-gradient(135deg, rgba(255,215,64,0.15), rgba(255,215,64,0.05));
    border: 1px solid rgba(255,215,64,0.2);
    box-shadow: 0 0 10px rgba(255,215,64,0.1), inset 0 0 15px rgba(255,215,64,0.05);
}

.ev-icon-error::before {
    background: linear-gradient(135deg, rgba(255,82,82,0.15), rgba(255,82,82,0.05));
    border: 1px solid rgba(255,82,82,0.2);
    box-shadow: 0 0 10px rgba(255,82,82,0.1), inset 0 0 15px rgba(255,82,82,0.05);
}

.trade-icon-3d {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.trade-icon-3d::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0,230,118,0.12), rgba(0,200,255,0.05));
    border: 1px solid rgba(0,230,118,0.2);
    transform: perspective(400px) rotateX(15deg);
    box-shadow: 0 0 15px rgba(0,230,118,0.1), inset 0 0 20px rgba(0,200,255,0.05);
    transition: transform 0.3s;
}

.trade-icon-3d:hover::before {
    transform: perspective(400px) rotateX(0deg);
}

.trade-icon-3d .icon-symbol {
    position: relative;
    z-index: 1;
    font-size: 18px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* ===================================================
   Modul-Visualisierungen
   =================================================== */
.module-vis-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-deep);
    border: 1px solid var(--border-color);
}

.module-vis-wrapper canvas {
    display: block;
    width: 100%;
    height: auto;
}

.module-vis-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}

/* ===================================================
   Mobile Responsive Design
   =================================================== */

/* Hamburger Toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}
.sidebar-toggle:hover {
    color: var(--text-primary);
    background: rgba(0, 200, 255, 0.06);
}

/* Sidebar Overlay (mobile only) */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.sidebar-overlay.active { display: block; }

/* ---- Breakpoint: Tablet & Mobile (< 1024px) ---- */
@media (max-width: 1024px) {
    .sidebar-toggle { display: inline-flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 101;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.6);
    }

    .main-wrapper.with-sidebar {
        margin-left: 0;
    }

    .system-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- Breakpoint: Mobile (< 768px) ---- */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 220px;
        --topbar-height: 48px;
    }

    .topbar-inner {
        padding: 0 0.75rem;
    }

    .topbar-brand {
        font-size: 0.82rem;
    }

    .topbar-right {
        gap: 0.4rem;
    }

    .topbar-resources {
        gap: 0.15rem;
        padding: 0.15rem 0.3rem;
    }

    .topbar-resources .resource-item {
        padding: 0.1rem 0.3rem;
        font-size: 0.65rem;
        gap: 0.15rem;
    }

    .resource-gem.gem-sm {
        width: 16px;
        height: 16px;
    }

    .resource-gem.gem-sm::after {
        font-size: 6px;
    }

    .container {
        padding: 0 0.75rem;
    }

    .page-header h1,
    .dashboard-header h1 {
        font-size: 1.05rem;
    }

    .card-header h2 {
        font-size: 0.8rem;
    }

    .card-body {
        padding: 0.85rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .resource-bar {
        flex-wrap: wrap;
    }

    .resource-bar .resource-item {
        flex: 1 1 45%;
        min-width: 0;
        padding: 0.4rem 0.5rem;
    }

    .resource-bar .resource-value {
        font-size: 0.82rem;
    }

    .resource-bar .resource-label {
        font-size: 0.55rem;
    }

    /* Table → Card-Stack on Mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-stack thead {
        display: none;
    }

    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }

    .table-stack tr {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 0.65rem 0.75rem;
        margin-bottom: 0.6rem;
    }

    .table-stack td {
        padding: 0.25rem 0;
        border-bottom: none;
        font-size: 0.82rem;
        text-align: left !important;
    }

    .table-stack td::before {
        content: attr(data-label);
        display: inline-block;
        font-family: var(--font-display);
        font-size: 0.6rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.06em;
        margin-right: 0.5rem;
        min-width: 80px;
    }

    .table-stack .building-level {
        text-align: left;
    }

    .table-stack .costs-cell {
        line-height: 1.7;
    }

    /* Ship cards on mobile */
    .ship-grid {
        grid-template-columns: 1fr;
    }

    .system-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .form-row .form-group {
        flex: 1 1 100%;
        min-width: 0;
    }

    .ship-stats {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .ship-stats span {
        font-size: 0.7rem;
    }

    .behaviors-visual-grid {
        grid-template-columns: 1fr;
    }

    .trade-grid {
        gap: 0.75rem;
    }

    .route-cards-wrapper {
        gap: 0.75rem;
    }

    /* Event cards */
    .event-card {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Guide */
    .guide-section-title {
        font-size: 0.88rem;
        padding: 0.75rem 1rem;
    }

    .guide-section-body {
        padding: 0 1rem 1rem;
        font-size: 0.82rem;
    }

    .system-card-footer {
        flex-direction: column;
        gap: 0.4rem;
        align-items: flex-start;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .auth-card h1 {
        font-size: 1.15rem;
    }

    /* Help popup narrower */
    .help-popup {
        width: 300px;
        left: 50% !important;
        transform: translateX(-50%) !important;
        top: 15% !important;
    }

    .module-vis-wrapper canvas {
        min-height: 100px;
    }

    .footer p {
        font-size: 0.6rem;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Sidebar on mobile */
    .sidebar-brand a {
        font-size: 1rem;
    }

    .sidebar-link {
        padding: 0.6rem 1rem;
        font-size: 0.82rem;
    }
}

/* ---- Breakpoint: Small Mobile (< 480px) ---- */
@media (max-width: 480px) {
    .topbar-resources .resource-item {
        font-size: 0.6rem;
        padding: 0.1rem 0.2rem;
    }

    .topbar-resources {
        gap: 0.1rem;
    }

    .resource-gem.gem-sm {
        width: 14px;
        height: 14px;
    }

    .resource-gem.gem-sm::after {
        font-size: 5px;
    }

    .topbar-link {
        font-size: 0.72rem;
        padding: 0.25rem 0.5rem;
    }

    .btn {
        font-size: 0.78rem;
        padding: 0.45rem 0.9rem;
    }

    .btn-lg {
        padding: 0.65rem 1.5rem;
        font-size: 0.9rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 0.65rem;
    }

    .page-header h1,
    .dashboard-header h1 {
        font-size: 0.9rem;
    }

    .admin-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .system-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .resource-bar .resource-item {
        flex: 1 1 100%;
    }

    .table-stack td {
        font-size: 0.78rem;
    }

    .table-stack td::before {
        min-width: 65px;
        font-size: 0.55rem;
    }
}

/* ===================================================
   Player Avatar Badge
   =================================================== */
.player-avatar {
    border-radius: 50%;
    border: 2px solid var(--accent-primary, #2a6f97);
    object-fit: cover;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(42, 111, 151, 0.4);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.player-avatar:hover {
    border-color: var(--accent-glow, #4a9fd5);
    box-shadow: 0 0 12px rgba(74, 159, 213, 0.6);
}
.player-avatar-sm {
    width: 28px;
    height: 28px;
    border-width: 1.5px;
}
.player-avatar-lg {
    width: 80px;
    height: 80px;
    border-width: 3px;
    box-shadow: 0 0 10px rgba(42, 111, 151, 0.5);
}
.player-avatar-xl {
    width: 120px;
    height: 120px;
    border-width: 4px;
    box-shadow: 0 0 15px rgba(42, 111, 151, 0.6);
}

.avatar-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.avatar-upload-preview {
    flex-shrink: 0;
}
