/* style.css */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    margin: 0;
    padding: 0;
}

h1,
h2,
h3,
h4 {
    color: #ffffff;
    margin-top: 0;
}

.top-bar {
    width: 100%;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
    padding: 0 1rem;
    box-sizing: border-box;
    border-bottom: 1px solid #333;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #ccc;
    font-size: 0.9rem;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.btn-logout {
    color: #ef5350;
    text-decoration: none;
    font-size: 0.8rem;
    border: 1px solid #ef5350;
    padding: 2px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #ef5350;
    color: white;
}

.container {
    padding: 60px 4px 2rem 4px;
    /* Reduced side padding to 4px per request */
    /* Top padding for fixed header */
    width: 100%;
    box-sizing: border-box;
}

/* Character Switcher List */
.chars-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

/* Character Card Image Hover */
.char-sidebar-link {
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
    width: 100%;
    /* Ensure it takes full width of sidebar */
}

.char-sidebar-link:hover {
    transform: scale(1.05);
}

.char-sidebar-link img {
    border-radius: 4px;
    border: 2px solid transparent;
    /* default invisible border */
    transition: all 0.3s ease;
    display: block;
    /* Remove inline gap */
}

.char-sidebar-link:hover img {
    border-color: #90caf9;
    box-shadow: 0 0 15px rgba(144, 202, 249, 0.6);
    /* Stronger glow */
}

.char-name {
    margin-top: 5px;
    font-weight: bold;
    text-align: center;
}

.char-chip {
    background: #333;
    color: #ccc;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.char-chip.active {
    background: #1e88e5;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.char-chip img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.btn-link {
    background: #444;
    color: white;
    text-decoration: none;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* New Profile Section (Full Page Style) */
.profile-section {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #333;
}

.profile-portrait img {
    width: 128px;
    /* 50% smaller than previous 256px */
    height: 128px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.profile-info {
    flex-grow: 1;
}

.profile-info h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #aaa;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    max-width: 800px;
}

.stats-row {
    display: flex;
    gap: 3rem;
}

.stat-group {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 500;
}

.stat-value.online {
    color: #66bb6a;
}

.stat-value.offline {
    color: #bdbdbd;
}

/* Planet List (Rows) */
.planet-row {
    background: #1e1e1e;
    margin-bottom: 8px;
    /* Slight gap between rows */
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.planet-row:hover {
    background: #252525;
}

.planet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.planet-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #90caf9;
}

.planet-meta {
    font-size: 0.9rem;
    color: #777;
}

.pi-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
}

.pi-label {
    min-width: 80px;
    color: #888;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: bold;
}

.pi-content {
    color: #ddd;
    flex-grow: 1;
}

.pi-tag {
    display: inline-flex;
    align-items: center;
    background: #333;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    border: 1px solid #444;
}

.pi-tag.active {
    border-color: #2e7d32;
    background: #1b5e20;
    color: #e8f5e9;
}

.pi-tag.stopped {
    border-color: #c62828;
    background: #b71c1c;
    color: #ffebee;
}

.pi-tag.factory {
    border-color: #0277bd;
    background: #01579b;
    color: #e1f5fe;
}

/* Login Box */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80vh;
}

.login-box {
    text-align: center;
    background: #252525;
    padding: 3rem;
    border-radius: 8px;
}

/* --- Monitor Page Styles --- */
.monitor-body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.monitor-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 4px;
    /* Reduced side padding to 4px */
}

.monitor-char-section {
    background: #1e1e1e;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #333;
}

/* Header Row: Micro Photo + Name + Status */
.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
}

.monitor-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.monitor-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #555;
}

.monitor-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
}

.monitor-status {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

.monitor-status.online {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
}

.monitor-status.offline {
    background: rgba(244, 67, 54, 0.2);
    color: #e57373;
}

.monitor-stats {
    font-size: 0.9rem;
    color: #aaa;
}

/* Planet Grid */
.monitor-planet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.8rem;
}

.monitor-planet-card {
    background: #252525;
    padding: 0.8rem;
    border-radius: 4px;
    border: 1px solid #333;
}

.mp-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: #ddd;
    border-bottom: 1px solid #3a3a3a;
    padding-bottom: 4px;
}

.mp-header .mp-type {
    color: #777;
    font-size: 0.75rem;
}

.mp-extractors {
    font-size: 0.8rem;
}

.mp-timer-row {
    display: flex;
    flex-direction: column;
    /* Stack Name top, Timer bottom for compactness */
    margin-bottom: 4px;
}

.mp-prod-name {
    color: #ccc;
    font-weight: 500;
}

.monitor-countdown {
    font-family: monospace;
    font-size: 0.9rem;
}

/* --- Landing Page / Login Redesign --- */
.landing-body {
    background: url('bg_login.jpg') no-repeat center center fixed;
    background-size: cover;
    color: #fff;
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    position: relative;
    overflow: hidden;
    height: 100vh;
    /* Force full height */
}

/* Ensure the flex centering works properly on the internal container */
.landing-body .container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 0 !important;
    /* Override default container padding */
}

/* Hide top bar if it exists in DOM, though it should be PHP-gated */
.landing-body .top-bar {
    display: none !important;
}

/* Removed full-screen dark overlay per user request */

.landing-container {
    background: rgba(20, 20, 20, 0.70);
    /* Darkbox base */
    padding: 3rem 4rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

    /* FROSTED GLASS EFFECT - BOX ONLY */
    backdrop-filter: blur(12px);

    /* Dropdown Menu */
    .dropdown {
        position: relative;
        display: inline-block;
    }

    .dropdown-content {
        display: none;
        position: absolute;
        right: 0;
        background-color: #252525;
        min-width: 200px;
        box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.5);
        z-index: 1001;
        border-radius: 4px;
        border: 1px solid #333;
    }

    .dropdown-content a {
        color: #e0e0e0;
        padding: 12px 16px;
        text-decoration: none;
        display: block;
        font-size: 0.95rem;
        border-bottom: 1px solid #333;
    }

    .dropdown-content a:last-child {
        border-bottom: none;
    }

    .dropdown-content a:hover {
        background-color: #333;
        color: #fff;
    }

    .show {
        display: block;
    }

    .hamburger {
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0 10px;
        user-select: none;
    }

    -webkit-backdrop-filter: blur(12px);

    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    max-width: 900px;
    width: 90%;
    animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.landing-hero h1 {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #121212;
    /* Dark Text */
    background: none;
    -webkit-text-fill-color: initial;
    text-shadow: none;
}

.landing-hero p.subtitle {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 3rem;
    font-weight: 400;
    /* Slightly heavier for dark text readability */
}

/* Feature Grid */
.landing-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 4rem;
    text-align: left;
}

.feature-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 8px;
    transition: transform 0.3s, background 0.3s;
    border-top: 2px solid transparent;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-top: 2px solid #2196f3;
}

.feature-card h3 {
    font-size: 1.1rem;
    color: #90caf9;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.feature-card p {
    font-size: 0.95rem;
    color: #ccc;
    line-height: 1.5;
    margin: 0;
}

/* Premium Login Button */
.btn-login-hero {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(21, 101, 192, 0.4);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-login-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(21, 101, 192, 0.6);
    background: linear-gradient(135deg, #1976d2, #1565c0);
}

/* --- Welcome Page / index.php Authenticated --- */
.welcome-hero {
    max-width: 900px;
    margin: 80px auto 20px;
    padding: 0 20px;
    text-align: center;
}

.welcome-text-highlight h1 {
    font-size: 3rem;
    font-family: 'Outfit', sans-serif;
    color: #121212;
    /* Dark Text */
    margin-bottom: 10px;
    background: none;
    -webkit-text-fill-color: initial;
}

.welcome-text-highlight p {
    font-size: 1.2rem;
    color: #333;
    /* Darker Subtext */
    margin-bottom: 40px;
}

.monitor-banner-link {
    text-decoration: none;
    display: block;
    margin-bottom: 40px;
}

.monitor-banner {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.4), rgba(13, 71, 161, 0.6));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(144, 202, 249, 0.5);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.monitor-banner:hover {
    transform: scale(1.02);
    border-color: rgba(144, 202, 249, 0.6);
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.15), rgba(13, 71, 161, 0.3));
    box-shadow: 0 0 30px rgba(33, 150, 243, 0.2);
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.banner-icon {
    font-size: 3rem;
}

.banner-text {
    flex-grow: 1;
    text-align: left;
}

.banner-text h2 {
    margin: 0;
    font-size: 1.8rem;
    letter-spacing: 2px;
    color: #fff;
}

.banner-text p {
    margin: 5px 0 0;
    color: #90caf9;
}

.banner-arrow {
    font-size: 2rem;
    color: #90caf9;
    transition: transform 0.3s;
}

.monitor-banner:hover .banner-arrow {
    transform: translateX(10px);
}

.help-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 40px;
}

.help-card {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: left;
}

.help-card h3 {
    color: #90caf9;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.help-card p {
    font-size: 0.9rem;
    color: #888;
    line-height: 1.6;
}

/* Landing Hero (Unauthenticated) */
.landing-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 0 20px;
}

.cyber-outline {
    padding: 4rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.2);
    /* Semi-transparent light background */
    backdrop-filter: blur(10px);
    border-radius: 4px;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Language Switcher */
.lang-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 10002;
    background: rgba(255, 255, 255, 0.3);
    padding: 6px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.lang-flag {
    width: 24px;
    height: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.lang-flag:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.lang-flag.active {
    border-color: #1565c0;
    box-shadow: 0 0 8px rgba(21, 101, 192, 0.4);
}

.cyber-outline h1 {
    font-size: 4rem;
    letter-spacing: 8px;
    margin-bottom: 0px;
    font-family: 'Outfit', sans-serif;
}

.cyber-outline .divider {
    height: 2px;
    width: 60px;
    background: #1565c0;
    margin: 20px auto 30px;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #252525;
    min-width: 200px;
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.5);
    z-index: 10001;
    /* High Z-Index */
    border-radius: 4px;
    border: 1px solid #333;
    flex-direction: column;
    /* Ensure vertical stacking */
}

/* Ensure display block when shown to override any flex parent interference */
.dropdown-content.show {
    display: block;
}

/* Style links */
.dropdown-content a {
    color: #e0e0e0;
    padding: 12px 16px;
    text-decoration: none;
    display: block !important;
    /* Force block to be distinct rows */
    font-size: 1rem;
    border-bottom: 1px solid #333;
    white-space: nowrap;
    /* Prevent wrapping */
    text-align: left;
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: #333;
    color: #fff;
}

/* Cyberpunk Badge / Timer Shared Style */
.cyber-timer {
    display: inline-block;
    font-family: 'Segoe UI Mono', 'Roboto Mono', monospace;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 2px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border: 1px solid currentColor;
    border-left-width: 3px;
    box-sizing: border-box;
}

.cyber-timer.timer-clean {
    border: none;
    font-weight: normal;
    text-shadow: none;
}

.cyber-timer.timer-compact {
    padding-left: 2px;
    padding-right: 2px;
    margin-right: -10px !important;
    border-right: 0px;
    border-top-right-radius: 0px;
    border-bottom-right-radius: 0px;
    font-size: 0.75rem;
    font-weight: normal;
    text-shadow: none !important;
}

.hamburger {
    font-size: 2rem;
    /* Initial size increased */
    cursor: pointer;
    padding: 5px 15px;
    user-select: none;
    color: #fff;
    display: flex;
    align-items: center;
}


.hamburger:hover {
    color: #90caf9;
}

/* Strict 3-column grid for planets */
/* Character Card Layout */
/* Character Card Layout */
/* Character Card Layout */
.compact-char-card {
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 0;
    /* Remove padding to allow edge-to-edge header */
    gap: 0;
    /* Handle spacing via padding in children */
    margin-bottom: 20px;
    overflow: hidden;
    /* Ensure border radius works */
}

/* Header Section */
.char-header {
    width: 100%;
    box-sizing: border-box;
    /* Include padding in width */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 15px;
    /* Reduced vertical padding */
    background-color: #2a2a2a;
    /* Lighter header like diagram */
    border-bottom: 1px solid #333;
    gap: 12px;
}

.char-header-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    /* Don't shrink */
}

.char-header img {
    border-radius: 50%;
    width: 36px;
    /* Reduced from 50px */
    height: 36px;
    border: 2px solid #444;
    display: block;
}

.char-name {
    margin: 0;
    font-size: 0.95rem;
    /* Reduced from 1.1rem */
    font-weight: normal;
    /* Removed bold */
    text-align: left;
    white-space: nowrap;
}

.char-status {
    margin-left: 0;
    font-weight: normal;
    /* Removed bold */
    font-size: 0.75rem;
    /* Reduced */
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    display: inline-block;
    /* Prevent full width */
    width: auto;
    /* Force auto width */
    white-space: nowrap;
}

.timer-active {
    color: #66bb6a;
    /* Green (> 6h) */
    text-shadow: 0 0 5px #66bb6a;
}

.timer-caution {
    color: #ffd54f;
    /* Yellow (3-6h) */
    text-shadow: 0 0 5px #ffd54f;
}

.timer-warning {
    color: #ffa726;
    /* Orange (1-3h) */
    text-shadow: 0 0 5px #ffa726;
}

.timer-danger {
    color: #ef5350;
    /* Red (< 1h) */
    text-shadow: 0 0 5px #ef5350;
}

.timer-expired {
    color: #880e4f;
    /* Dark Red / Vinho (Expired) */
    text-shadow: 0 0 5px #880e4f;
}

/* Planet Grid Adjustment */
/* Planet Grid Adjustment */
/* Planet Grid Adjustment */
.planet-grid {
    flex-grow: 1;
    padding: 2px;
    /* Minimum padding */
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    /* Tiny gap to fit more items */
    align-content: flex-start;
    /* Pack rows to top */
}

/* Tablet: REMOVED fixed column rules */
/* Desktop: REMOVED fixed column rules */

.compact-planet {
    background: transparent;
    /* Changed from #252525 to transparent */
    padding: 2px;
    /* Reduced from 4px to act as tight spacing */
    border-radius: 4px;
    border: none;
    /* Changed from 1px solid #3c3c3c to none */
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 140px;
    max-width: 320px;
    gap: 0 !important;
    line-height: normal;
}

.planet-title {
    font-size: 0.95rem;
    /* Reduced */
    font-weight: normal;
    /* Removed bold */
    color: #90caf9;
}

.category-title {
    font-weight: normal;
    /* Removed bold */
    color: #ccc;
    font-size: 0.8rem;
    /* Reduced */
}

/* Added .cp-row from deleted inline styles, kept small */
.cp-row {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    /* Match category-title */
    margin-bottom: 2px;
    color: #ccc;
}

.item-icon {
    width: 20px;
    /* Reduced from 24px per user request */
    height: 20px;
    vertical-align: middle;
    margin-right: 6px;
    /* Spacing */
}

/* Responsive Sidebar for small mobile */
@media (max-width: 500px) {
    .compact-char-card {
        padding: 10px;
    }

    .char-header {
        flex-direction: row;
        justify-content: space-between;
        gap: 10px;
        align-items: center;
        text-align: left;
    }

    /* If img needs adjustment */
    .char-header img {
        width: 32px;
        height: 32px;
    }
}


/* Placeholder for empty planet slots */
.compact-planet.placeholder {
    border: 1px dashed #444;
    background: rgba(255, 255, 255, 0.02);
    align-items: center;
    justify-content: center;
    color: #444;
}

.placeholder-icon {
    font-size: 1.5rem;
    /* Reduced from 2rem */
    opacity: 0.3;
}

.char-loader {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.5);
    border-top: 4px solid #00f3ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;

    position: absolute;
    /* 40px / 2 = 20px offset */
    top: calc(50% - 20px);
    left: calc(50% - 20px);
    /* Removed transform to avoid conflict with animation */
    z-index: 10;
    margin: 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Main Container acts as the Grid Parent */
#monitor-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 55px 2px 2px 2px;
    /* Top padding restored to clear fixed header */
    align-content: flex-start;
}

/* Character Wrapper - Transparent to Grid */
.compact-char-card {
    display: contents;
    /* IMPORTANT: This makes the wrapper invisible to the flex layout. 
       Children (InfoBlock + Planets) become direct children of #monitor-container */
}

/* Character Info Block - Looks like a Planet Card */
.char-info-block {
    background: #2a2a2a;
    padding: 4px;
    border-radius: 4px;
    border: 1px solid #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 140px;
    max-width: 320px;
    text-align: center;
}

.char-info-block .char-portrait {
    border-radius: 50%;
    margin-bottom: 0;
    width: 100%;
    /* Fill wrapper */
    height: 100%;
    /* Fill wrapper */
    display: block;
    /* Remove inline quirks */
}

.char-portrait-wrapper {
    position: relative;
    display: block;
    /* Changed from inline-block to block */
    width: 96px;
    /* Explicit width */
    height: 96px;
    /* Explicit height */
    margin: 0 auto 5px auto;
    /* Centered in parent, bottom margin 5px */
    padding: 0;
}

/* Restore spacing to name is handled by margin-bottom in wrapper */
/* Restore spacing to name is handled by margin-bottom in wrapper */

.char-link {
    display: block;
    text-decoration: none;
    color: #fff !important;
    /* Force white color even if visited */
}

.char-link:visited,
.char-link:hover,
.char-link:active {
    color: #fff !important;
}

.char-info-block .char-name {
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 2px;
}

.char-info-block .char-status {
    font-size: 0.75rem;
    margin-bottom: 0;
}



/* --- CYBERPUNK THEMES --- */
/* Base Planet Card Styling */
.compact-planet {
    background: transparent;
    /* Deep black for contrast */
    padding: 0;
    /* Padding handled by children or inner spacing */
    border-radius: 4px;
    border: 1px solid #333;
    /* Default fallback */
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 140px;
    max-width: 320px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    /* Subtle shadow */
    overflow: hidden;
    /* Keep children inside corners */
}

/* Header Styling - Integrated Look */
.planet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: transparent;
    border-bottom: 1px solid #333;
}

.planet-title {
    color: #fff !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
}

.category-title {
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Content Area Padding */
.compact-planet>.cp-row {
    padding-left: 10px;
    padding-right: 10px;
}

.compact-planet>.cp-row:first-of-type {
    margin-top: 8px;
    /* Space after header */
}

.compact-planet>.cp-row:last-child {
    margin-bottom: 8px;
    /* Space at bottom */
}


/* --- THEME DEFINITIONS --- */
/* Common Theme Behaviors */
.char-info-block,
.compact-planet {
    transition: all 0.3s ease;
}

/* Theme 0: Cyber Cyan (Netrunner) */
.theme-0.char-info-block,
.theme-0.compact-planet {
    border-color: #00f3ff;
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.1);
}

.theme-0.compact-planet,
.theme-0.char-info-block {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.1) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.theme-0 .planet-header {
    border-bottom: 1px solid rgba(0, 243, 255, 0.3);
}

.theme-0 .planet-title {
    color: #00f3ff !important;
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.6);
}


/* Theme 1: Neon Magenta (Synthwave) */
.theme-1.char-info-block,
.theme-1.compact-planet {
    border-color: #ff00ff;
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.1);
}

.theme-1.compact-planet,
.theme-1.char-info-block {
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.1) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.theme-1 .planet-header {
    border-bottom: 1px solid rgba(255, 0, 255, 0.3);
}

.theme-1 .planet-title {
    color: #ff00ff !important;
    text-shadow: 0 0 5px rgba(255, 0, 255, 0.6);
}


/* Theme 2: Toxic Green (Biohazard) */
.theme-2.char-info-block,
.theme-2.compact-planet {
    border-color: #39ff14;
    box-shadow: 0 0 8px rgba(57, 255, 20, 0.1);
}

.theme-2.compact-planet,
.theme-2.char-info-block {
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.1) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.theme-2 .planet-header {
    border-bottom: 1px solid rgba(57, 255, 20, 0.3);
}

.theme-2 .planet-title {
    color: #39ff14 !important;
    text-shadow: 0 0 5px rgba(57, 255, 20, 0.6);
}


/* Theme 3: High Voltage Red (Arasaka) */
.theme-3.char-info-block,
.theme-3.compact-planet {
    border-color: #ff073a;
    box-shadow: 0 0 8px rgba(255, 7, 58, 0.1);
}

.theme-3.compact-planet,
.theme-3.char-info-block {
    background: linear-gradient(135deg, rgba(255, 7, 58, 0.1) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.theme-3 .planet-header {
    border-bottom: 1px solid rgba(255, 7, 58, 0.3);
}

.theme-3 .planet-title {
    color: #ff073a !important;
    text-shadow: 0 0 5px rgba(255, 7, 58, 0.6);
}


/* Theme 4: Industrial Amber (Wasteland) */
.theme-4.char-info-block,
.theme-4.compact-planet {
    border-color: #ffb300;
    box-shadow: 0 0 8px rgba(255, 179, 0, 0.1);
}

.theme-4.compact-planet,
.theme-4.char-info-block {
    background: linear-gradient(135deg, rgba(255, 179, 0, 0.1) 0%, rgba(0, 0, 0, 0.9) 100%);
}

.theme-4 .planet-header {
    border-bottom: 1px solid rgba(255, 179, 0, 0.3);
}

.theme-4 .planet-title {
    color: #ffb300 !important;
    text-shadow: 0 0 5px rgba(255, 179, 0, 0.6);
}

/* Remove old specific tweaks that conflict */
.char-info-block {
    /* Reset background so gradient shows */
    background-color: transparent;
}

/* --- MONITOR FOOTER & LEGENDS (PREMIUM REFINEMENT) --- */
.monitor-footer {
    max-width: 1400px;
    margin: 60px auto 40px auto;
    padding: 2px;
    /* For the double border effect */
    background: linear-gradient(180deg, rgba(40, 40, 40, 0.4) 0%, rgba(20, 20, 20, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(144, 202, 249, 0.3);
    position: relative;
}

.footer-inner {
    background: rgba(15, 15, 15, 0.9);
    backdrop-filter: blur(15px);
    padding: 25px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    border: 1px solid rgba(0, 0, 0, 0.5);
}

.footer-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #90caf9;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.8;
}

.footer-section h3::after {
    content: "";
    height: 1px;
    flex-grow: 1;
    background: linear-gradient(90deg, rgba(144, 202, 249, 0.3), transparent);
}

.legend-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: #aaa;
}

.legend-item .timer-badge {
    width: 65px;
    /* Standardized width */
    text-align: center;
    padding: 3px 0;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.4);
}

.cache-info-box {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #888;
    background: rgba(255, 255, 255, 0.02);
    padding: 15px;
    border-radius: 2px;
    border-left: 2px solid rgba(144, 202, 249, 0.2);
}

.cache-info-box ul {
    margin: 10px 0 0 15px;
    padding: 0;
}

.cache-info-box li {
    margin-bottom: 8px;
}

.cache-info-box b {
    color: #bbb;
    font-family: monospace;
}

.footer-decorator {
    position: absolute;
    top: -10px;
    right: 20px;
    font-family: monospace;
    font-size: 0.65rem;
    color: #555;
    letter-spacing: 1px;
    pointer-events: none;
}

/* Notched corner effect for sections */
.tech-panel {
    clip-path: polygon(0 0,
            calc(100% - 10px) 0, 100% 10px,
            100% 100%,
            10px 100%, 0 calc(100% - 10px));
}

@media (max-width: 1250px) {
    .footer-inner {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-section.full-width {
        grid-column: span 2;
    }
}

@media (max-width: 700px) {
    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-section.full-width {
        grid-column: span 1;
    }
}