:root {
    --bg-color: #05050a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #f59e0b; /* Amber 500 */
    --accent-glow: rgba(245, 158, 11, 0.4);
    --node-online: #10b981;
    --node-offline: #334155;
    --panel-bg: rgba(15, 23, 42, 0.7);
    --border-color: rgba(51, 65, 85, 0.5);
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.background-nebula {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #05050a 100%);
    opacity: 0.8;
    z-index: -1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(5, 5, 10, 0.8);
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tag {
    font-size: 0.7rem;
    background: var(--accent);
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
}

.stats {
    display: flex;
    gap: 2rem;
}

.stat {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat span {
    color: var(--text-primary);
    font-weight: 700;
}

.alive-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--node-online);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--node-online);
    animation: pulse 2s infinite;
}

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

main {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.canvas-container {
    display: flex;
    gap: 2rem;
    height: 400px;
}

#tesseract-container {
    flex: 1;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.tesseract {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.core {
    width: 60px;
    height: 60px;
    background: var(--accent);
    transform: rotate(45deg);
    animation: float 4s ease-in-out infinite;
    z-index: 2;
}

.core-glow {
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--accent-glow);
    filter: blur(20px);
    border-radius: 50%;
    animation: float 4s ease-in-out infinite reverse;
}

.label {
    margin-top: 50px;
    font-weight: 700;
    letter-spacing: 4px;
}

.sub-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

@keyframes float {
    0% { transform: translateY(0) rotate(45deg); }
    50% { transform: translateY(-10px) rotate(45deg); }
    100% { transform: translateY(0) rotate(45deg); }
}

#swarm-container {
    flex: 2;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.swarm-header {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
}

.swarm-loc {
    color: var(--accent);
}

.swarm-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 10px;
    flex: 1;
    align-content: center;
}

.army-node {
    aspect-ratio: 1;
    background: var(--node-online);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
}

.army-node.offline {
    background: var(--node-offline);
    box-shadow: none;
}

.bottom-panel {
    display: flex;
    gap: 2rem;
    height: 300px;
}

.telemetry, .logs {
    flex: 1;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.panel-header {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    letter-spacing: 2px;
}

.table-container {
    flex: 1;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    text-align: left;
    color: var(--text-secondary);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 10px 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.2);
}

.log-feed {
    flex: 1;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.log-entry {
    color: #4ade80;
}

.log-ts {
    color: var(--text-secondary);
    margin-right: 10px;
}

/* Custom Scrollbar for dark theme */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
