:root {
    --bg-color: #0b1120;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary-color: #10b981;
    /* Emerald */
    --primary-hover: #059669;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --glass-blur: blur(12px);
}

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

body {
    font-family: 'Prompt', 'Outfit', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.08), transparent 25%);
    background-attachment: fixed;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography & Layout */
a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
}

ul {
    list-style: none;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Glassmorphism Utilities */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(11, 17, 32, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.navbar .logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    font-weight: 400;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links .btn-primary {
    padding: 0.5rem 1.25rem;
    font-weight: 600;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6rem 5% 2rem;
    gap: 2rem;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero .badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 999px;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero h1 .highlight {
    background: linear-gradient(to right, var(--primary-color), #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

/* Network Demo Diagram in Hero */
.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
}

.network-demo {
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
    width: 100%;
    max-width: 400px;
}

.network-demo .node {
    width: 60px;
    height: 60px;
    background: #1e293b;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.network-demo .node::before {
    content: '\f2ed';
    /* Trash icon */
    font-family: 'FontAwesome';
    color: var(--text-muted);
    font-size: 1.25rem;
}

.network-demo .node.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.network-demo .node.active::before {
    content: '\f1eb';
    /* Wifi icon */
    color: var(--primary-color);
}

.network-demo .node span {
    position: absolute;
    left: 80px;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.9rem;
}

.network-demo .line {
    width: 2px;
    height: 40px;
    background: var(--border-color);
    position: relative;
    overflow: hidden;
}

.network-demo .line::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--primary-color), transparent);
    animation: signalFlow 2s infinite linear;
}

@keyframes signalFlow {
    0% {
        top: -100%;
    }

    100% {
        top: 100%;
    }
}

.network-demo .cloud {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    z-index: 2;
    margin-top: 10px;
    font-weight: 600;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

/* Logic Details Section */
.features {
    padding: 5rem 5%;
    background: rgba(15, 23, 42, 0.5);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.feature-card .icon-wrapper {
    width: 60px;
    height: 60px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Dashboard Section */
.dashboard {
    padding: 5rem 5%;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    vertical-align: middle;
    margin-left: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
}

.pulse {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.bin-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.bin-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    opacity: 0.8;
}

.bin-card.warning::before {
    background: var(--warning);
}

.bin-card.danger::before {
    background: var(--danger);
}

.bin-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.bin-title {
    font-weight: 600;
    font-size: 1.25rem;
}

.bin-network-role {
    font-size: 0.75rem;
    padding: 2px 8px;
    background: #1e293b;
    border-radius: 4px;
    color: var(--text-muted);
}

/* Bin Visualizer */
.bin-visual {
    width: 120px;
    height: 150px;
    border: 3px solid #334155;
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    position: relative;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 5px;
}

.bin-visual::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -10px;
    right: -10px;
    height: 6px;
    background: #334155;
    border-radius: 4px;
}

.fill-level {
    width: 90%;
    height: 0%;
    background: var(--primary-color);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    transition: height 1s ease-in-out, background-color 0.5s;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
}

.fill-level::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
}

.percentage {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.5rem;
}

.status-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Data Flows / Logging */
.system-logs {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.system-logs h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-window {
    height: 200px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.9rem;
    color: #a7f3d0;
}

.log-entry {
    margin-bottom: 6px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
}

.log-entry span.time {
    color: var(--text-muted);
    margin-right: 10px;
}

.log-entry span.source {
    color: #818cf8;
    font-weight: bold;
}

.log-entry span.target {
    color: #f472b6;
    font-weight: bold;
}

.log-warn {
    color: #fcd34d;
}

.log-error {
    color: #fca5a5;
}

/* Custom Scrollbar for Logs */
.log-window::-webkit-scrollbar {
    width: 6px;
}

.log-window::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.log-window::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        flex-direction: column;
        padding-top: 8rem;
        text-align: center;
    }

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

    .hero-buttons {
        justify-content: center;
    }

    .network-demo .node span {
        left: -70px;
        text-align: right;
    }

    .network-demo .node:nth-child(even) span {
        left: 80px;
        text-align: left;
    }

    .nav-links {
        display: none;
    }
}

/* Mesh Visualizer */
.mesh-visualizer-container { background: #0f172a; padding: 2rem; border-radius: 12px; margin-bottom: 2rem; border: 1px solid var(--border-color); text-align: center; }
.mesh-visualizer { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 1rem; }
.mesh-node { width: 50px; height: 50px; border-radius: 50%; background: #1e293b; display: flex; align-items: center; justify-content: center; border: 2px solid #475569; position: relative; color: var(--text-color); transition: all 0.3s; box-shadow: 0 0 10px rgba(0,0,0,0.5); }
.mesh-node span { position: absolute; bottom: -25px; font-size: 0.8rem; font-weight: bold; white-space: nowrap; color: var(--text-muted); }
.mesh-node.active { border-color: var(--primary-color); background: rgba(16, 185, 129, 0.2); box-shadow: 0 0 20px rgba(16, 185, 129, 0.6); color: var(--primary-color); transform: scale(1.1); }
.mesh-node.firebase.active { border-color: #3b82f6; background: rgba(59, 130, 246, 0.2); box-shadow: 0 0 20px rgba(59, 130, 246, 0.6); color: #3b82f6; }
.mesh-link { width: 40px; height: 4px; background: #334155; position: relative; overflow: hidden; border-radius: 2px; }
.mesh-link::after { content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: var(--primary-color); box-shadow: 0 0 10px var(--primary-color); }
.mesh-link.active::after { animation: hopMesh 0.8s linear forwards; }
@keyframes hopMesh { 0% { left: -100%; } 100% { left: 100%; } }
.mesh-legend { font-size: 0.85rem; color: var(--text-muted); }
.battery-status { margin-top: 15px; font-size: 0.8rem; color: var(--text-muted); background: rgba(0,0,0,0.2); padding: 4px 12px; border-radius: 999px; }
.battery-status i { margin-right: 5px; color: var(--primary-color); }


/* --- Mini Game & Education Section --- */
.game-section { padding: 5rem 5%; background: rgba(15, 23, 42, 0.5); }
.game-container { display: grid; grid-template-columns: 1fr 2fr; gap: 2rem; align-items: start; }
@media (max-width: 992px) { .game-container { grid-template-columns: 1fr; } }
.edu-panel { padding: 2rem; }
.edu-panel h3 { font-size: 1.5rem; color: var(--primary-color); margin-bottom: 1rem; }
.game-instructions { margin: 2rem 0; background: rgba(0,0,0,0.2); padding: 1.5rem; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); }
.game-instructions h4 { margin-bottom: 1rem; color: #f8fafc; }
.game-instructions ul { margin-left: 0; }
.game-instructions li { margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-muted); display:flex; align-items:flex-start; gap: 10px; }
.text-primary { color: var(--primary-color); }
.game-controls { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.game-dropdown { padding: 0.75rem; background: rgba(15, 23, 42, 0.8); color: white; border: 1px solid var(--border-color); border-radius: 8px; font-family: inherit; }
.btn-full { width: 100%; text-align: center; }
.game-status { padding: 1rem; border-radius: 8px; text-align: center; font-weight: bold; font-size: 0.95rem; margin-top: 1rem; }
.game-status.waiting { background: rgba(59, 130, 246, 0.1); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.3); }
.game-status.playing { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.game-status.success { background: rgba(16, 185, 129, 0.1); color: var(--primary-color); border: 1px solid rgba(16, 185, 129, 0.3); }
.board-panel { padding: 2rem; display: flex; flex-direction: column; align-items: center; }
.game-header { width: 100%; display: flex; justify-content: space-between; margin-bottom: 1rem; font-weight: 600; }
.signal-indicator { color: var(--text-muted); transition: color 0.3s; }
.signal-indicator.strong { color: var(--primary-color); }
.signal-indicator.medium { color: var(--warning); }
.signal-indicator.weak { color: var(--danger); }
.game-grid { display: grid; grid-template-columns: repeat(10, 40px); grid-template-rows: repeat(10, 40px); gap: 2px; background: rgba(0,0,0,0.3); padding: 10px; border-radius: 12px; border: 2px solid #334155; position: relative; margin-bottom: 2rem; user-select: none; }
.grid-cell { width: 40px; height: 40px; background: rgba(255,255,255,0.05); border-radius: 4px; transition: background 0.2s; display: flex; align-items: center; justify-content: center; }
.grid-cell.drag-over { background: rgba(16, 185, 129, 0.3); }
.grid-cell.obstacle { background: #1e293b; border: 1px solid #334155; background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255,255,255,0.02) 5px, rgba(255,255,255,0.02) 10px); }
.inventory { width: 100%; padding: 1rem; background: rgba(0,0,0,0.2); border-radius: 12px; text-align: center; }
.inventory h5 { margin-bottom: 1rem; color: var(--text-muted); }
.bin-items { display: flex; justify-content: center; gap: 1rem; min-height: 50px; }
.game-bin { width: 40px; height: 40px; background: #1e293b; border: 2px solid var(--text-muted); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; cursor: grab; user-select: none; transition: transform 0.2s; z-index: 50; }
.game-bin:active { cursor: grabbing; transform: scale(1.1); }
.game-bin[data-id="1"] { border-color: #3b82f6; color: #3b82f6; }
.game-bin[data-id="4"] { border-color: #f43f5e; color: #f43f5e; }
.grid-cell .game-bin { width: 36px; height: 36px; font-size: 0.8rem; margin: 0; }
.wifi-target { position: absolute; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: var(--primary-color); font-size: 1.5rem; z-index: 10; opacity: 0; transition: opacity 0.5s; pointer-events: none; }
.wifi-target.revealed { opacity: 1; text-shadow: 0 0 10px var(--primary-color); }
.connection-line { position: absolute; background: var(--text-muted); height: 2px; transform-origin: 0 50%; z-index: 5; pointer-events: none; opacity: 0.5; transition: all 0.3s; }
.connection-line.valid { background: var(--primary-color); opacity: 1; box-shadow: 0 0 8px var(--primary-color); }
.connection-line.invalid { background: var(--danger); opacity: 0.8; }


/* Signal Hint Bars */
.signal-indicator { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: bold; }
.signal-bars { display: flex; align-items: flex-end; gap: 3px; height: 18px; margin-right: 5px; }
.s-bar { width: 5px; background: var(--text-muted); border-radius: 1px; opacity: 0.3; transition: all 0.3s; }
.bar-1 { height: 6px; }
.bar-2 { height: 10px; }
.bar-3 { height: 14px; }
.bar-4 { height: 18px; }

.signal-indicator.level-0 .signal-text { color: var(--text-muted); }

.signal-indicator.level-1 .bar-1 { background: var(--danger); opacity: 1; box-shadow: 0 0 5px var(--danger); }
.signal-indicator.level-1 .signal-text { color: var(--danger); }

.signal-indicator.level-2 .bar-1, .signal-indicator.level-2 .bar-2 { background: var(--warning); opacity: 1; box-shadow: 0 0 5px var(--warning); }
.signal-indicator.level-2 .signal-text { color: var(--warning); }

.signal-indicator.level-3 .bar-1, .signal-indicator.level-3 .bar-2, .signal-indicator.level-3 .bar-3 { background: #84cc16; opacity: 1; box-shadow: 0 0 5px #84cc16; }
.signal-indicator.level-3 .signal-text { color: #84cc16; }

.signal-indicator.level-4 .s-bar { background: var(--primary-color); opacity: 1; box-shadow: 0 0 5px var(--primary-color); }
.signal-indicator.level-4 .signal-text { color: var(--primary-color); }
