/* ==========================================================================
   NYIRONGO FAMILY LINE - COSMIC SPACE THEME DESIGN SYSTEM
   ========================================================================== */

:root {
    --bg-space-deep: #02040d;
    --bg-space-dark: #070c1e;
    --bg-card-glass: rgba(11, 18, 42, 0.88);
    --bg-card-hover: rgba(18, 28, 64, 0.95);
    --bg-hud-glass: rgba(8, 14, 32, 0.85);
    
    --primary-cyan: #38bdf8;
    --primary-cyan-glow: rgba(56, 189, 248, 0.45);
    --patriarch-gold: #fbbf24;
    --patriarch-gold-glow: rgba(251, 191, 36, 0.55);
    --female-rose: #f472b6;
    --female-rose-glow: rgba(244, 114, 182, 0.45);
    --accent-purple: #a855f7;
    --accent-purple-glow: rgba(168, 85, 247, 0.45);
    --living-green: #34d399;
    
    --text-pure: #ffffff;
    --text-bright: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --border-glass: rgba(148, 163, 184, 0.18);
    --border-gold: rgba(251, 191, 36, 0.4);
    --border-cyan: rgba(56, 189, 248, 0.35);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --transition-smooth: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-space-deep);
    color: var(--text-bright);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
}

/* 3D Scene Viewport Containers */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 1;
}

#webgl-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#css3d-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* Ambient Deep Cosmic Vignette */
.space-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, transparent 60%, rgba(2, 4, 13, 0.85) 100%);
    pointer-events: none;
    z-index: 3;
}

/* ==========================================================================
   2D NORMAL SCROLLABLE TREE VIEWPORT (DEFAULT VIEW)
   ========================================================================== */
.tree-2d-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    padding-top: 100px;
    padding-bottom: 120px;
    background: radial-gradient(circle at 50% 25%, #080f2d 0%, #030617 65%, #01030b 100%);
    z-index: 2;
    cursor: grab;
    display: block;
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 189, 248, 0.4) rgba(8, 14, 32, 0.7);
}

.tree-2d-viewport.dragging {
    cursor: grabbing;
    user-select: none;
}

.tree-2d-viewport::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.tree-2d-viewport::-webkit-scrollbar-track {
    background: rgba(8, 14, 32, 0.85);
}

.tree-2d-viewport::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.5), rgba(168, 85, 247, 0.5));
    border-radius: 6px;
    border: 2px solid rgba(8, 14, 32, 0.85);
}

.tree-2d-viewport::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.8);
}

.tree-2d-content {
    position: relative;
    margin: 0 auto;
    transition: transform 0.25s ease-out;
}

.tree-2d-svg-connectors {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.tree-2d-nodes-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* View Mode Switcher Pill */
.view-mode-pill {
    display: inline-flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 3px;
}

.mode-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.mode-toggle-btn:hover {
    color: #fff;
}

.mode-toggle-btn.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(168, 85, 247, 0.35));
    color: #fff;
    border: 1px solid var(--border-cyan);
    box-shadow: 0 0 12px var(--primary-cyan-glow);
}

/* ==========================================================================
   TOP NAVIGATION HUD
   ========================================================================== */
.top-nav {
    position: absolute;
    top: 18px;
    left: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: var(--bg-hud-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.08);
    z-index: 10;
    transition: var(--transition-smooth);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
}

.brand-emblem {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid var(--border-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--patriarch-gold);
    font-size: 22px;
    box-shadow: 0 0 16px var(--patriarch-gold-glow);
    animation: pulseEmblem 4s infinite ease-in-out;
}

@keyframes pulseEmblem {
    0%, 100% { box-shadow: 0 0 14px var(--patriarch-gold-glow); }
    50% { box-shadow: 0 0 24px var(--patriarch-gold-glow), 0 0 8px #fff; }
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #fff, #fbbf24, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text p {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.8px;
}

/* Search Bar in Header */
.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 380px;
}

.search-input-box {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    transition: var(--transition-smooth);
}

.search-input-box:focus-within {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 14px var(--primary-cyan-glow);
    background: rgba(15, 23, 42, 0.95);
}

.search-icon {
    color: var(--text-muted);
    margin-right: 10px;
    font-size: 14px;
}

.search-input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: var(--font-body);
    font-size: 13px;
    width: 100%;
}

.search-input::placeholder {
    color: var(--text-dim);
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: rgba(10, 16, 38, 0.96);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-cyan);
    border-radius: var(--radius-md);
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 20;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.search-result-item:hover {
    background: rgba(56, 189, 248, 0.15);
}

.search-result-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    object-fit: cover;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.search-result-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* Generation Filters Bar */
.gen-filter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.6);
    padding: 4px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
}

.gen-chip {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.gen-chip:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.gen-chip.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(168, 85, 247, 0.35));
    color: #fff;
    border: 1px solid var(--border-cyan);
    box-shadow: 0 0 12px var(--primary-cyan-glow);
}

/* Header Action Buttons */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-cosmic {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
    text-decoration: none;
    user-select: none;
}

.btn-cyan {
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    color: #030712;
    font-weight: 700;
    box-shadow: 0 0 16px var(--primary-cyan-glow);
}

.btn-cyan:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 24px var(--primary-cyan-glow);
}

.btn-gold {
    background: linear-gradient(135deg, #d97706, #fbbf24);
    color: #030712;
    font-weight: 700;
    box-shadow: 0 0 16px var(--patriarch-gold-glow);
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 24px var(--patriarch-gold-glow);
}

.btn-glass {
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-bright);
    border: 1px solid var(--border-glass);
}

.btn-glass:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* User Profile Badge */
.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 6px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    cursor: pointer;
}

.user-badge-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-cyan);
    color: #030712;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.user-badge-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

/* ==========================================================================
   FLOATING 3D NAVIGATION CONTROLS HUD (BOTTOM LEFT & RIGHT)
   ========================================================================== */
.controls-hud {
    position: absolute;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-hud-glass);
    backdrop-filter: blur(16px);
    padding: 10px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.hud-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-glass);
    color: var(--text-bright);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.hud-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
    box-shadow: 0 0 14px var(--primary-cyan-glow);
    transform: scale(1.08);
}

.hud-btn.active {
    background: var(--primary-cyan);
    color: #030712;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 16px var(--primary-cyan-glow);
}

.hud-tooltip {
    position: relative;
}

.hud-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 16, 38, 0.95);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    border: 1px solid var(--border-glass);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 30;
}

/* Bottom Right Info & Statistics Widget */
.stats-hud {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-hud-glass);
    backdrop-filter: blur(16px);
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   3D PORTRAIT CARDS (RENDERED IN CSS3D)
   ========================================================================== */
.portrait-card {
    width: 250px;
    height: 330px;
    background: var(--bg-card-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border-glass);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.65), 0 0 20px rgba(56, 189, 248, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 14px 16px;
    text-align: center;
    cursor: grab;
    user-select: none;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.portrait-card.dragging-card {
    cursor: grabbing !important;
    transition: none !important;
    z-index: 9999 !important;
    transform: scale(1.05) !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.95), 0 0 45px var(--primary-cyan-glow) !important;
    border-color: var(--primary-cyan) !important;
}

.card-drag-indicator {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
    pointer-events: none;
    opacity: 0.5;
    transition: var(--transition-smooth);
}

.portrait-card:hover .card-drag-indicator {
    opacity: 1;
    color: var(--primary-cyan);
}

.portrait-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    pointer-events: none;
}

.portrait-card:hover {
    transform: scale(1.04) translateY(-6px);
    background: var(--bg-card-hover);
    border-color: var(--primary-cyan);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.8), 0 0 30px var(--primary-cyan-glow);
    z-index: 100;
}

/* Card Themes by Gender & Status */
.portrait-card.patriarch {
    border-color: var(--border-gold);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.65), 0 0 25px var(--patriarch-gold-glow);
}

.portrait-card.patriarch:hover {
    border-color: var(--patriarch-gold);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 45px var(--patriarch-gold-glow);
}

.portrait-card.female {
    border-color: rgba(244, 114, 182, 0.3);
}

.portrait-card.female:hover {
    border-color: var(--female-rose);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.8), 0 0 30px var(--female-rose-glow);
}

.portrait-card.focused-card {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.6), 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 40px var(--primary-cyan-glow) !important;
    animation: focusedPulse 2.5s infinite alternate ease-in-out;
}

@keyframes focusedPulse {
    0% { transform: scale(1.02); }
    100% { transform: scale(1.06); }
}

/* Card Generation & Relation Badge */
.card-badge {
    position: absolute;
    top: 10px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
}

.card-badge.gold {
    background: rgba(217, 119, 6, 0.25);
    border-color: var(--patriarch-gold);
    color: var(--patriarch-gold);
    box-shadow: 0 0 10px var(--patriarch-gold-glow);
}

.card-badge.cyan {
    background: rgba(2, 132, 199, 0.25);
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
}

.card-badge.rose {
    background: rgba(219, 39, 119, 0.25);
    border-color: var(--female-rose);
    color: var(--female-rose);
}

/* Portrait Frame & Avatar */
.portrait-frame {
    position: relative;
    width: 105px;
    height: 105px;
    margin-top: 18px;
    margin-bottom: 12px;
}

.portrait-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid var(--border-cyan);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    transition: var(--transition-smooth);
    background: #0f172a;
}

.portrait-card.patriarch .portrait-circle {
    border-color: var(--patriarch-gold);
    box-shadow: 0 0 16px var(--patriarch-gold-glow);
}

.portrait-card.female .portrait-circle {
    border-color: var(--female-rose);
}

.portrait-card:hover .portrait-circle {
    transform: scale(1.05);
}

/* Default SVG Avatar if no image */
.avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 2px solid var(--border-cyan);
    color: var(--primary-cyan);
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
}

.avatar-placeholder.patriarch {
    border-color: var(--patriarch-gold);
    color: var(--patriarch-gold);
}

.avatar-placeholder.female {
    border-color: var(--female-rose);
    color: var(--female-rose);
}

/* Vital Status Indicator (Living or Ancestor Star) */
.vital-status-dot {
    position: absolute;
    bottom: 2px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--living-green);
    border: 2px solid var(--bg-space-dark);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
}

.vital-status-dot.deceased {
    background: var(--patriarch-gold);
    box-shadow: 0 0 10px var(--patriarch-gold-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #030712;
}

/* Card Text Info */
.card-name {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.card-relation {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-cyan);
    margin-bottom: 6px;
}

.portrait-card.patriarch .card-relation {
    color: var(--patriarch-gold);
}

.portrait-card.female .card-relation {
    color: var(--female-rose);
}

.card-dates {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.card-location {
    font-size: 10px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 12px;
}

/* Visible Biography Snippet on Portrait Card */
.card-bio-snippet {
    width: 100%;
    font-size: 11px;
    line-height: 1.35;
    color: #cbd5e1;
    font-style: italic;
    background: rgba(15, 23, 42, 0.6);
    border-left: 2.5px solid var(--primary-cyan);
    padding: 5px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    box-sizing: border-box;
    text-align: left;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    transition: var(--transition-smooth);
}

.portrait-card.patriarch .card-bio-snippet {
    border-left-color: var(--patriarch-gold);
    color: #fde68a;
    background: rgba(217, 119, 6, 0.15);
}

.portrait-card.female .card-bio-snippet {
    border-left-color: var(--female-rose);
    color: #fbcfe8;
    background: rgba(219, 39, 119, 0.15);
}

.portrait-card:hover .card-bio-snippet {
    color: #fff;
    background: rgba(15, 23, 42, 0.9);
}

/* Card Action Buttons */
.card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: auto;
}

.card-btn {
    flex: 1;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-glass);
    background: rgba(30, 41, 59, 0.7);
    color: var(--text-bright);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.card-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: var(--primary-cyan);
    color: #fff;
}

.card-btn.add-btn {
    flex: 0 0 34px;
    padding: 6px 0;
}

.card-btn.add-btn:hover {
    background: rgba(52, 211, 153, 0.25);
    border-color: var(--living-green);
    color: var(--living-green);
}

.card-btn.delete-btn {
    flex: 0 0 32px;
    padding: 6px 0;
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.12);
    font-size: 13px;
}

.card-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.35);
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
    transform: scale(1.08);
}

/* Danger Button (Admin / Creator Delete) */
.btn-danger {
    background: linear-gradient(135deg, #b91c1c, #ef4444) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.4) !important;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.7) !important;
}

/* ==========================================================================
   TREE CONNECTOR GLOW & 3D HELPERS
   ========================================================================== */
.tree-breadcrumb-nav {
    position: absolute;
    top: 90px;
    left: 24px;
    background: var(--bg-hud-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.breadcrumb-item {
    color: var(--text-muted);
    cursor: pointer;
}

.breadcrumb-item:hover {
    color: var(--primary-cyan);
}

.breadcrumb-separator {
    color: var(--text-dim);
}

.breadcrumb-item.current {
    color: #fff;
    font-weight: 600;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: rgba(10, 16, 38, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-cyan);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.success {
    border-color: var(--living-green);
}

.toast.error {
    border-color: #ef4444;
}

@keyframes slideInToast {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Loading Overlay */
#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-space-deep);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-constellation {
    width: 80px;
    height: 80px;
    position: relative;
    margin-bottom: 24px;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--primary-cyan);
    animation: spinRing 1.5s linear infinite;
}

.loader-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-top-color: var(--patriarch-gold);
    animation: spinRing 2.2s linear infinite reverse;
}

.loader-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 20px;
    left: 20px;
    border-top-color: var(--female-rose);
    animation: spinRing 1s linear infinite;
}

@keyframes spinRing {
    to { transform: rotate(360deg); }
}

.loader-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #fbbf24, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.loader-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE CREATIVE DOCK
   ========================================================================== */
.mobile-bottom-dock {
    display: none;
}

@media (max-width: 900px) {
    .gen-filter-bar {
        display: none;
    }

    .stats-hud {
        display: none;
    }
}

@media (max-width: 768px) {
    .top-nav {
        padding: 8px 14px;
        gap: 8px;
    }

    .brand-logo-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .brand-text h1 {
        font-size: 14px;
        letter-spacing: 1px;
    }

    .brand-text p {
        display: none;
    }

    .search-wrapper {
        display: none;
        width: 100%;
        margin-top: 6px;
        order: 4;
    }

    .search-wrapper.mobile-expanded {
        display: flex;
    }

    .nav-actions {
        gap: 6px;
    }

    .nav-actions .btn-cosmic {
        padding: 6px 10px;
        font-size: 11px;
    }

    .tree-breadcrumb-nav {
        top: 68px;
        left: 14px;
        padding: 4px 10px;
        font-size: 11px;
    }

    /* Reposition desktop controls HUD above the mobile dock */
    .controls-hud {
        bottom: 84px;
        left: 14px;
        padding: 6px;
        gap: 6px;
    }

    .hud-btn {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    /* Sleek Floating Mobile Bottom Dock */
    .mobile-bottom-dock {
        position: fixed;
        bottom: 12px;
        left: 12px;
        right: 12px;
        height: 60px;
        background: rgba(10, 16, 38, 0.94);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1.5px solid var(--border-cyan);
        border-radius: 30px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.25);
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 0 8px;
        z-index: 990;
    }

    .dock-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 600;
        cursor: pointer;
        padding: 6px 8px;
        border-radius: 16px;
        transition: var(--transition-smooth);
        min-width: 50px;
    }

    .dock-btn .dock-icon {
        font-size: 18px;
        line-height: 1;
        transition: transform 0.2s ease;
    }

    .dock-btn:hover, .dock-btn:active, .dock-btn.active {
        color: var(--primary-cyan);
    }

    .dock-btn:active .dock-icon {
        transform: scale(1.15);
    }

    .dock-btn.dock-btn-main {
        background: linear-gradient(135deg, #0284c7, #38bdf8);
        color: #030712;
        box-shadow: 0 0 16px var(--primary-cyan-glow);
        transform: translateY(-8px);
        height: 48px;
        width: 48px;
        border-radius: 50%;
        padding: 0;
        border: 2px solid rgba(255, 255, 255, 0.4);
    }

    .dock-btn.dock-btn-main .dock-icon {
        font-size: 24px;
        color: #030712;
    }
}
