:root {
    --bg-color: #050505;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-glow: #6366f1;
    --accent-glow-secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Background Orbs */
.background-effect {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    filter: blur(80px);
    z-index: 0;
    animation: float 20s ease-in-out infinite alternate;
}

.background-effect.effect-2 {
    top: auto;
    bottom: -20%;
    left: auto;
    right: -10%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    animation: float 25s ease-in-out infinite alternate-reverse;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.1); }
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 4rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.pulse {
    width: 8px;
    height: 8px;
    background-color: var(--warning);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--warning);
    animation: pulsing 1.5s infinite;
}

.pulse.connected {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

@keyframes pulsing {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Loading State */
.loading-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 4rem 0;
}

.loading-state.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-glow);
    animation: spin 1s ease-in-out infinite;
}

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

/* Data Grid */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.data-grid.hidden {
    display: none;
    opacity: 0;
}

/* Glass Cards */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 20px rgba(99, 102, 241, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-icon {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.03);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-content h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.card-content p {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.card-content .sub-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bot-alert {
    color: var(--danger) !important;
}

.bot-safe {
    color: var(--success) !important;
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: var(--delay);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* DB Status Indicator */
.db-status {
    margin-top: 3rem;
    text-align: center;
    padding: 1rem;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.db-status.hidden {
    display: none;
}

.db-status.success {
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.db-status.error {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

@media (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    .data-grid { grid-template-columns: 1fr; }
}

/* PUZZLE OVERLAY */
.puzzle-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.puzzle-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.puzzle-box {
    width: 320px;
    padding: 2rem;
    text-align: center;
    flex-direction: column;
    align-items: center;
}

.puzzle-box h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.puzzle-box p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.puzzle-area {
    width: 100%;
    height: 150px;
    background: url('https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?q=80&w=600&auto=format&fit=crop') no-repeat left top;
    background-size: 256px 150px;
    border-radius: 8px;
    position: relative;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.puzzle-target {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    position: absolute;
    top: 55px;
    left: 200px; /* Target location */
    border-radius: 4px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.8);
}

.puzzle-piece {
    width: 40px;
    height: 40px;
    background: url('https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?q=80&w=600&auto=format&fit=crop') no-repeat left top;
    background-size: 256px 150px;
    position: absolute;
    top: 55px;
    left: 10px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.5);
    background-position: -200px -55px; /* Matches the target area */
}

.slider-container {
    width: 100%;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    position: relative;
}

.slider-track {
    width: 100%;
    height: 100%;
    position: absolute;
}

.slider-fill {
    height: 100%;
    width: 0;
    background: rgba(99, 102, 241, 0.5);
    border-radius: 20px 0 0 20px;
    position: absolute;
    top: 0; left: 0;
}

.slider-thumb {
    width: 40px;
    height: 40px;
    background: var(--accent-glow);
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    cursor: grab;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: background 0.2s;
}

.slider-thumb:active {
    cursor: grabbing;
}

.puzzle-status {
    margin-top: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}
.puzzle-status.success {
    color: var(--success);
}
.puzzle-status.error {
    color: var(--danger);
}
