/* ============================================================================
   PLANET GENERATOR v4.1 - Enhanced UI
   Liquid glass styling, proper sizing, improved layout
   ============================================================================ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000000;
    color: #e0e0e0;
    overflow-x: hidden;
    position: relative;
}

/* ============================================================================
   ANIMATED BACKGROUND
   ============================================================================ */

.background-stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(2px 2px at 10% 15%, white, transparent),
        radial-gradient(1px 1px at 15% 25%, white, transparent),
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(1px 1px at 25% 40%, rgba(200, 220, 255, 0.9), transparent),
        radial-gradient(2px 2px at 35% 55%, white, transparent),
        radial-gradient(1px 1px at 40% 65%, rgba(255, 240, 220, 0.9), transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 65% 20%, rgba(200, 220, 255, 0.9), transparent),
        radial-gradient(1px 1px at 70% 85%, white, transparent),
        radial-gradient(2px 2px at 75% 45%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(1px 1px at 85% 75%, rgba(255, 240, 220, 0.9), transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent),
        radial-gradient(1px 1px at 33% 80%, white, transparent),
        radial-gradient(1px 1px at 15% 90%, white, transparent),
        radial-gradient(1px 1px at 5% 50%, white, transparent),
        radial-gradient(2px 2px at 95% 35%, white, transparent);
    background-size: 250% 250%;
    background-position: 0% 0%;
    animation: starsFloat 180s ease-in-out infinite;
    z-index: -2;
    opacity: 0.6;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 80%, rgba(60, 30, 90, 0.5) 0%, transparent 35%),
        radial-gradient(ellipse at 80% 20%, rgba(120, 45, 75, 0.45) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(30, 45, 90, 0.4) 0%, transparent 45%),
        radial-gradient(ellipse at 10% 30%, rgba(45, 60, 105, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 70%, rgba(75, 30, 60, 0.38) 0%, transparent 45%),
        linear-gradient(180deg, rgba(10, 5, 20, 0.5) 0%, rgba(15, 15, 30, 0.7) 50%, rgba(5, 5, 15, 0.8) 100%);
    animation: gradientShift 90s ease-in-out infinite;
    z-index: -1;
}

@keyframes starsFloat {
    0% { background-position: 0% 0%; }
    25% { background-position: 30% 40%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 70% 60%; }
    100% { background-position: 0% 0%; }
}

@keyframes gradientShift {
    0%, 100% { opacity: 0.8; transform: scale(1) rotate(0deg); }
    33% { opacity: 0.5; transform: scale(1.05) rotate(1deg); }
    66% { opacity: 0.6; transform: scale(1.1) rotate(-1deg); }
}

/* ============================================================================
   FIXED CONTROL PANEL
   ============================================================================ */

.control-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.98) 0%, rgba(15, 15, 15, 0.95) 100%);
    border-bottom: 2px solid rgba(255, 80, 40, 0.3);
    padding: 16px 24px;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.control-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative; /* Needed for absolute positioning of dropdowns */
}

.control-group label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    font-weight: 600;
    line-height: 1.2; /* Explicit line height for consistent spacing */
}

/* Seed input - 5x smaller */
.control-group-seed {
    flex: 0 0 100px;
}

/* Mass class - 50% wider */
.control-group-mass {
    flex: 0 0 270px;
}

/* Planet type - 50% wider */
.control-group-type {
    flex: 0 0 270px;
}

.control-group input[type="text"] {
    padding: 8px 12px;
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.control-group input[type="text"]:focus {
    outline: none;
    border-color: #ff5028;
    background: rgba(50, 50, 50, 0.8);
    box-shadow: 0 0 10px rgba(255, 80, 40, 0.3);
}

/* ============================================================================
   FILTER INPUT
   ============================================================================ */

.filter-input {
    position: relative;
    padding: 8px 12px;
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    min-height: 36px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    width: 100%; /* Ensure it takes full width of parent control-group */
}

.filter-input.active {
    border-color: #ff5028;
    background: rgba(50, 50, 50, 0.8);
}

.filter-placeholder {
    color: #666;
    font-size: 13px;
}

.filter-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    background: rgba(255, 80, 40, 0.2);
    border: 1px solid rgba(255, 80, 40, 0.4);
    border-radius: 3px;
    font-size: 11px;
    color: #ff9070;
}

.filter-tag.habitable {
    background: rgba(80, 200, 120, 0.2);
    border-color: rgba(80, 200, 120, 0.4);
    color: #70e0a0;
}

.tag-remove {
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tag-remove:hover {
    opacity: 1;
}

.filter-dropdown {
    position: absolute;
    /* Position below label (12px) + gap (6px) + filter-input (36px min-height + padding) */
    top: 62px;
    left: 0;
    right: 0; /* Match the control-group width */
    background: rgba(30, 30, 30, 0.98);
    border: 1px solid rgba(255, 80, 40, 0.3);
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.filter-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-item:last-child {
    border-bottom: none;
}

.filter-item:hover {
    background: rgba(255, 80, 40, 0.15);
}

.filter-item.selected {
    background: rgba(255, 80, 40, 0.3);
    color: #ff9070;
    font-weight: 600;
}

.filter-item.habitable {
    color: #70e0a0;
}

/* ============================================================================
   5x5 GRID DROPDOWN
   ============================================================================ */

.type-grid-dropdown {
    padding: 10px;
    max-height: none;
    width: 270px; /* Match parent control-group-type width */
    left: 0 !important;
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    width: 100%;
}

.grid-cell {
    width: 44px; /* Scaled up to fit 270px width */
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.08s ease; /* Faster hover response */
    position: relative;
    overflow: hidden; /* Prevent gradient underside from showing */
    background-clip: padding-box; /* Ensure gradient stays within border */
    background-size: 200% 200%; /* Scale gradient to prevent edge issues */
    background-position: center;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2), inset 0 0 8px rgba(255, 255, 255, 0.1);
}

.grid-cell::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.95), rgba(30, 30, 40, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.grid-cell::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(30, 30, 40, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.grid-cell:hover {
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4), inset 0 0 12px rgba(255, 255, 255, 0.2);
    z-index: 10;
}

.grid-cell:hover::after,
.grid-cell:hover::before {
    opacity: 1;
    visibility: visible;
}

.grid-cell.selected {
    border: 3px solid #ff5028;
    box-shadow: 0 0 15px rgba(255, 80, 40, 0.8);
    transform: scale(1.15);
}

/* ============================================================================
   CHECKBOXES
   ============================================================================ */

.control-checkboxes {
    flex-direction: row;
    gap: 14px;
    align-items: center;
    align-self: flex-end; /* Align to bottom */
    padding-bottom: 6px;
}

.control-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-transform: none;
    font-size: 11px;
    color: #ccc;
}

.control-checkboxes input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ============================================================================
   LIQUID GLASS BUTTONS
   ============================================================================ */

.control-buttons {
    flex-direction: row;
    gap: 10px;
    align-self: flex-end;
    padding-bottom: 0;
}

.btn-primary, .btn-system, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, 
        rgba(255, 80, 40, 0.8), 
        rgba(255, 120, 80, 0.8));
    color: #fff;
    border: 1px solid rgba(255, 120, 80, 0.6);
}

.btn-primary:hover {
    background: linear-gradient(135deg, 
        rgba(255, 100, 60, 0.9), 
        rgba(255, 140, 100, 0.9));
    box-shadow: 
        0 6px 20px rgba(255, 80, 40, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-system {
    background: linear-gradient(135deg, 
        rgba(100, 150, 255, 0.7), 
        rgba(140, 180, 255, 0.7));
    color: #fff;
    border: 1px solid rgba(140, 180, 255, 0.6);
}

.btn-system:hover {
    background: linear-gradient(135deg, 
        rgba(120, 170, 255, 0.8), 
        rgba(160, 200, 255, 0.8));
    box-shadow: 
        0 6px 20px rgba(100, 150, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, 
        rgba(80, 80, 90, 0.6), 
        rgba(100, 100, 110, 0.6));
    color: #ddd;
    border: 1px solid rgba(120, 120, 130, 0.5);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, 
        rgba(100, 100, 110, 0.7), 
        rgba(120, 120, 130, 0.7));
    box-shadow: 
        0 6px 20px rgba(100, 100, 110, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn-secondary.active {
    background: linear-gradient(135deg, 
        rgba(255, 80, 40, 0.5), 
        rgba(255, 120, 80, 0.5));
    color: #fff;
    border-color: rgba(255, 80, 40, 0.7);
}

.btn-primary:active, .btn-system:active, .btn-secondary:active {
    transform: translateY(0);
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.main-content {
    margin-top: 100px;
    padding: 40px 20px;
    min-height: calc(100vh - 100px);
}

.planet-display-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.welcome-message {
    text-align: center;
    max-width: 600px;
    margin: 100px auto;
}

.welcome-message h2 {
    font-size: 36px;
    margin-bottom: 16px;
    color: #ff7050;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.welcome-message p {
    font-size: 16px;
    color: #aaa;
    margin-bottom: 8px;
}

.welcome-subtitle {
    font-size: 13px;
    color: #666;
}

/* ============================================================================
   SYSTEM DISPLAY
   ============================================================================ */

.system-display {
    display: flex;
    gap: 20px;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px;
    padding-top: 150px; /* Space for star halo to not be cut off */
    padding-left: 60px; /* Space for star halo on left */
    overflow-x: auto;
    overflow-y: visible;
}

/* Star display */
.star-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    flex: 0 0 auto;
    width: 280px;
    position: relative;
}

.star-visual {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    animation: starPulse 4s ease-in-out infinite;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-visual:hover {
    transform: scale(1.05);
}

.star-visual:active {
    transform: scale(0.98);
    transition: all 0.1s ease;
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

.star-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 70px; /* Minimal margin to align cards at top */
}

.asteroid-belt-name {
    margin-top: 70px !important; /* Align asteroid belt cards with planet cards */
}

.star-card {
    width: 100%;
    background: linear-gradient(135deg, rgba(30, 30, 35, 0.25), rgba(20, 20, 25, 0.25));
    backdrop-filter: blur(12px) saturate(1.5);
    -webkit-backdrop-filter: blur(12px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(255, 180, 50, 0.2);
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.star-card:not(.hidden) {
    animation: cardSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-card.hidden {
    max-height: 0;
    padding: 0;
    opacity: 0;
    border-width: 0;
    overflow: hidden;
}

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

.system-planet {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    flex: 0 0 auto;
    width: 320px; /* Constant width for all planets */
    position: relative;
}

.planet-visual {
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    top: 0;
}

/* Visual size based on mass - centered on center */
.planet-visual.size-tiny { width: 80px; height: 80px; margin-top: 60px; }
.planet-visual.size-small { width: 120px; height: 120px; margin-top: 40px; }
.planet-visual.size-medium { width: 160px; height: 160px; margin-top: 20px; }
.planet-visual.size-large { width: 220px; height: 220px; margin-top: 0; }
.planet-visual.size-xlarge { width: 250px; height: 250px; margin-top: -15px; }
.planet-visual.size-huge { width: 280px; height: 280px; margin-top: -30px; }

.planet-visual:hover {
    transform: scale(1.1);
    box-shadow: 
        0 12px 40px rgba(255, 255, 255, 0.2),
        inset 0 -50px 100px rgba(0, 0, 0, 0.2);
}

.planet-visual:active {
    transform: scale(0.95);
    transition: all 0.1s ease;
}

/* Asteroid belt visual */
.asteroid-belt-visual {
    width: 120px;
    height: 180px;
    margin-top: 20px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.asteroid-belt-visual::before,
.asteroid-belt-visual::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, transparent, rgba(150, 150, 160, 0.6), rgba(180, 180, 190, 0.8), rgba(150, 150, 160, 0.6), transparent);
    box-shadow: 0 0 15px rgba(180, 180, 190, 0.4);
    border-radius: 50%;
}

.asteroid-belt-visual::before {
    top: 40%;
    animation: beltRotate 8s linear infinite;
}

.asteroid-belt-visual::after {
    top: 55%;
    animation: beltRotate 10s linear infinite reverse;
    opacity: 0.7;
}

@keyframes beltRotate {
    0% { transform: translateX(-50%) scaleX(1); }
    50% { transform: translateX(-50%) scaleX(0.95); }
    100% { transform: translateX(-50%) scaleX(1); }
}

.asteroid-belt-visual:hover {
    transform: scale(1.05);
}

.planet-system-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    min-height: 50px; /* Fixed height for alignment */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* All names should start at y=270px from container top (below largest planet) */
/* Visual end positions: tiny=140, small=160, medium=180, large=220, xlarge=235, huge=250 */
.size-tiny + .planet-system-name { margin-top: 130px; } /* 140+130 = 270 */
.size-small + .planet-system-name { margin-top: 110px; } /* 160+110 = 270 */
.size-medium + .planet-system-name { margin-top: 90px; } /* 180+90 = 270 */
.size-large + .planet-system-name { margin-top: 50px; } /* 220+50 = 270 */
.size-xlarge + .planet-system-name { margin-top: 35px; } /* 235+35 = 270 */
.size-huge + .planet-system-name { margin-top: 20px; } /* 250+20 = 270 */

/* ============================================================================
   PLANET CARD - More detailed
   ============================================================================ */

.planet-system-card {
    width: 100%;
    background: linear-gradient(135deg, rgba(30, 30, 35, 0.25), rgba(20, 20, 25, 0.25));
    backdrop-filter: blur(12px) saturate(1.5);
    -webkit-backdrop-filter: blur(12px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 18px;
    transition: all 0.3s ease;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(255, 80, 40, 0.2);
    transform-style: preserve-3d;
    perspective: 1000px;
    /* No max-height or scrollbar - description takes as much space as needed */
}

.planet-system-card:not(.hidden) {
    animation: cardSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.planet-system-card.hidden {
    max-height: 0;
    padding: 0;
    opacity: 0;
    border-width: 0;
    overflow: hidden;
}

.system-card-section {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.system-card-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.system-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #999;
    margin-bottom: 8px;
    font-weight: 700;
}

.system-property-value {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
}

.system-property-small {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 3px;
}

.system-property-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    color: #bbb;
}

.system-property-row span:first-child {
    color: #888;
    font-weight: 500;
}

/* ============================================================================
   LIQUID GLASS BADGES
   ============================================================================ */

.system-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.system-feature-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    cursor: help;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px) saturate(1.5);
    -webkit-backdrop-filter: blur(8px) saturate(1.5);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Agriculture - Green liquid glass */
.system-feature-badge.agriculture.value-1 {
    background: linear-gradient(135deg, 
        rgba(100, 200, 120, 0.6), 
        rgba(120, 220, 140, 0.6));
    border: 1px solid rgba(120, 220, 140, 0.8);
    color: #fff;
}

.system-feature-badge.agriculture.value-2 {
    background: linear-gradient(135deg, 
        rgba(80, 220, 100, 0.7), 
        rgba(100, 240, 120, 0.7));
    border: 1px solid rgba(100, 240, 120, 0.9);
    color: #fff;
}

.system-feature-badge.agriculture.value-3 {
    background: linear-gradient(135deg, 
        rgba(60, 240, 80, 0.8), 
        rgba(80, 255, 100, 0.8));
    border: 1px solid rgba(80, 255, 100, 1);
    color: #fff;
    box-shadow: 
        0 2px 12px rgba(60, 240, 80, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Energy - Orange liquid glass */
.system-feature-badge.energy.value-1 {
    background: linear-gradient(135deg, 
        rgba(255, 200, 100, 0.6), 
        rgba(255, 220, 120, 0.6));
    border: 1px solid rgba(255, 220, 120, 0.8);
    color: #fff;
}

.system-feature-badge.energy.value-2 {
    background: linear-gradient(135deg, 
        rgba(255, 180, 80, 0.7), 
        rgba(255, 200, 100, 0.7));
    border: 1px solid rgba(255, 200, 100, 0.9);
    color: #fff;
}

.system-feature-badge.energy.value-3 {
    background: linear-gradient(135deg, 
        rgba(255, 140, 60, 0.8), 
        rgba(255, 160, 80, 0.8));
    border: 1px solid rgba(255, 160, 80, 1);
    color: #fff;
    box-shadow: 
        0 2px 12px rgba(255, 140, 60, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Resources - Blue liquid glass */
.system-feature-badge.resources.value-1 {
    background: linear-gradient(135deg, 
        rgba(100, 180, 255, 0.6), 
        rgba(120, 200, 255, 0.6));
    border: 1px solid rgba(120, 200, 255, 0.8);
    color: #fff;
}

.system-feature-badge.resources.value-2 {
    background: linear-gradient(135deg, 
        rgba(80, 160, 255, 0.7), 
        rgba(100, 180, 255, 0.7));
    border: 1px solid rgba(100, 180, 255, 0.9);
    color: #fff;
}

.system-feature-badge.resources.value-3 {
    background: linear-gradient(135deg, 
        rgba(60, 140, 255, 0.8), 
        rgba(80, 160, 255, 0.8));
    border: 1px solid rgba(80, 160, 255, 1);
    color: #fff;
}

.system-feature-badge.resources.value-4 {
    background: linear-gradient(135deg, 
        rgba(40, 120, 255, 0.9), 
        rgba(60, 140, 255, 0.9));
    border: 1px solid rgba(60, 140, 255, 1);
    color: #fff;
    box-shadow: 
        0 2px 12px rgba(40, 120, 255, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.system-feature-badge {
    position: relative;
}

.system-feature-badge::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.95), rgba(30, 30, 40, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.system-feature-badge::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(30, 30, 40, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.system-feature-badge:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 4px 15px rgba(255, 255, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.system-feature-badge:hover::after,
.system-feature-badge:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Anomaly badges - Purple/Magenta liquid glass */
.system-feature-badge.anomaly {
    background: linear-gradient(135deg, 
        rgba(180, 80, 255, 0.7), 
        rgba(220, 120, 255, 0.7));
    border: 1px solid rgba(220, 120, 255, 0.9);
    color: #fff;
    box-shadow: 
        0 2px 12px rgba(180, 80, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Gas giant and ice giant features - cyan/teal liquid glass */
.system-feature-badge.gas_giant {
    background: linear-gradient(135deg, 
        rgba(255, 100, 130, 0.7), 
        rgba(255, 140, 160, 0.7));
    border: 1px solid rgba(255, 140, 160, 0.9);
    color: #fff;
    box-shadow: 
        0 2px 12px rgba(255, 100, 130, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.system-feature-badge.ice_giant {
    background: linear-gradient(135deg, 
        rgba(100, 200, 255, 0.7), 
        rgba(140, 220, 255, 0.7));
    border: 1px solid rgba(140, 220, 255, 0.9);
    color: #fff;
    box-shadow: 
        0 2px 12px rgba(100, 200, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ============================================================================
   HABITABILITY BADGES - Liquid glass
   ============================================================================ */

.system-habitability {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.system-hab-score {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.habitability-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    backdrop-filter: blur(8px) saturate(1.5);
    -webkit-backdrop-filter: blur(8px) saturate(1.5);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.habitability-badge.excellent {
    background: linear-gradient(135deg, 
        rgba(60, 240, 80, 0.7), 
        rgba(80, 255, 100, 0.7));
    border: 1px solid rgba(80, 255, 100, 0.9);
    color: #fff;
}

.habitability-badge.good {
    background: linear-gradient(135deg, 
        rgba(120, 220, 100, 0.7), 
        rgba(140, 240, 120, 0.7));
    border: 1px solid rgba(140, 240, 120, 0.9);
    color: #fff;
}

.habitability-badge.moderate {
    background: linear-gradient(135deg, 
        rgba(255, 200, 80, 0.7), 
        rgba(255, 220, 100, 0.7));
    border: 1px solid rgba(255, 220, 100, 0.9);
    color: #fff;
}

.habitability-badge.poor {
    background: linear-gradient(135deg, 
        rgba(255, 150, 70, 0.7), 
        rgba(255, 170, 90, 0.7));
    border: 1px solid rgba(255, 170, 90, 0.9);
    color: #fff;
}

.habitability-badge.hostile {
    background: linear-gradient(135deg, 
        rgba(255, 80, 80, 0.7), 
        rgba(255, 100, 100, 0.7));
    border: 1px solid rgba(255, 100, 100, 0.9);
    color: #fff;
}

.tomb-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    background: linear-gradient(135deg, 
        rgba(80, 80, 80, 0.7), 
        rgba(100, 100, 100, 0.7));
    border: 1px solid rgba(120, 120, 120, 0.8);
    color: #ccc;
    backdrop-filter: blur(8px) saturate(1.5);
    -webkit-backdrop-filter: blur(8px) saturate(1.5);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ============================================================================
   LANIAKEIA SECTION
   ============================================================================ */

.laniakeia-section {
    background: linear-gradient(135deg, rgba(40, 30, 60, 0.3), rgba(30, 20, 50, 0.3));
    border: 1px solid rgba(150, 100, 200, 0.3);
    border-radius: 6px;
    padding: 12px !important;
}

.dev-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.dev-badge.dev-0, .dev-badge.dev-1, .dev-badge.dev-2 { background: rgba(255, 80, 80, 0.3); color: #ff9090; }
.dev-badge.dev-3, .dev-badge.dev-4 { background: rgba(255, 150, 80, 0.3); color: #ffb090; }
.dev-badge.dev-5, .dev-badge.dev-6 { background: rgba(255, 200, 80, 0.3); color: #ffd090; }
.dev-badge.dev-7, .dev-badge.dev-8 { background: rgba(150, 255, 100, 0.3); color: #b0ff90; }
.dev-badge.dev-9, .dev-badge.dev-10 { background: rgba(80, 255, 120, 0.3); color: #90ff90; }

/* Moon entries */
.moon-entry {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.moon-entry:last-child {
    border-bottom: none;
}

.moon-name {
    font-size: 12px;
    font-weight: 600;
    color: #a0d0ff;
    margin-bottom: 2px;
}

.moon-details {
    font-size: 10px;
    color: #888;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1200px) {
    .control-row {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .control-panel {
        padding: 12px 16px;
    }
    
    .main-content {
        margin-top: 120px;
        padding: 20px 10px;
    }
}

/* ============================================================================
   SCROLLBAR STYLING
   ============================================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(20, 20, 20, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 80, 40, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 80, 40, 0.6);
}

/* ============================================
   3D VIEWER STYLES
   ============================================ */

.viewer-3d-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    z-index: 10000;
}

#viewer-3d-canvas {
    width: 100%;
    height: 100%;
}

.viewer-controls {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(30, 30, 35, 0.6), rgba(20, 20, 25, 0.6));
    backdrop-filter: blur(12px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.viewer-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(255, 80, 40, 0.8), rgba(200, 60, 30, 0.8));
    color: white;
    border: 1px solid rgba(255, 100, 60, 0.5);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.viewer-btn:hover {
    background: linear-gradient(135deg, rgba(255, 100, 60, 0.9), rgba(220, 80, 50, 0.9));
    box-shadow: 0 0 10px rgba(255, 80, 40, 0.5);
}

.viewer-speed-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#viewer-speed-slider {
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, rgba(255, 80, 40, 0.3), rgba(255, 180, 40, 0.5), rgba(100, 255, 100, 0.5));
    outline: none;
    border-radius: 10px;
    height: 8px;
    cursor: pointer;
}

#viewer-speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 150, 80, 1), rgba(255, 80, 40, 1));
    border: 2px solid white;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 80, 40, 0.8);
}

#viewer-speed-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 150, 80, 1), rgba(255, 80, 40, 1));
    border: 2px solid white;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 80, 40, 0.8);
}

#viewer-speed-display {
    min-width: 60px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.viewer-help {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.viewer-description-panel {
    position: absolute;
    top: 80px;
    right: -420px;
    width: 400px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(135deg, rgba(30, 30, 35, 0.85), rgba(20, 20, 25, 0.85));
    backdrop-filter: blur(12px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: right 0.3s ease;
    z-index: 10001;
    padding: 10px;
}

.viewer-description-panel.visible {
    right: 10px;
}

.viewer-description-panel .planet-system-card {
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    max-width: 100%;
    overflow: visible;
}

.viewer-description-panel .system-card-section {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.btn-3d-viewer:hover {
    background: linear-gradient(135deg, rgba(120, 170, 255, 0.9), rgba(80, 120, 220, 0.9)) !important;
    box-shadow: 0 0 15px rgba(100, 150, 255, 0.6) !important;
    transform: translateY(-2px);
    transition: all 0.2s;
}
