/* ============================================
   QCD FIELD LIVE WALLPAPER — DESIGN SYSTEM
   Lattice QCD, Bubble Chamber, Feynman, Flux Tubes
   ============================================ */

:root {
    --bg-void: #020209;
    --bg-field: #080818;
    --lattice-line: rgba(60, 130, 220, 0.07);
    --lattice-node: rgba(80, 180, 255, 0.5);
    --flux-red: #ff2244;
    --flux-green: #22ff88;
    --flux-blue: #2266ff;
    --flux-gluon: #ffaa11;
    --pair-matter: #44ddff;
    --pair-anti: #ff44aa;
    --accent-1: #44ccff;
    --accent-2: #8855ff;
    --accent-3: #ff4488;
    --glow-1: rgba(68, 204, 255, 0.35);
    --glow-2: rgba(136, 85, 255, 0.3);
    --text-primary: rgba(230, 240, 255, 0.92);
    --text-secondary: rgba(140, 170, 210, 0.5);
    --text-accent: #44ccff;
    --glass-bg: rgba(8, 12, 35, 0.55);
    --glass-border: rgba(68, 140, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.6);

    --font-display: 'Space Grotesk', 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ============================================
   BASE
   ============================================ */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-void);
    font-family: var(--font-body);
    color: var(--text-primary);
    cursor: crosshair;
}

/* ============================================
   CANVASES
   ============================================ */

#field-canvas,
#fx-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    contain: strict;
}

#field-canvas { z-index: 1; }
#fx-canvas { z-index: 2; pointer-events: none; }

/* ============================================
   GLASS CARDS
   ============================================ */

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(28px) saturate(1.3);
    -webkit-backdrop-filter: blur(28px) saturate(1.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 6px 28px var(--glass-shadow),
                inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.glass-card:hover {
    background: rgba(15, 22, 50, 0.6);
    border-color: rgba(68, 140, 255, 0.15);
    box-shadow: 0 10px 40px var(--glass-shadow),
                0 0 18px rgba(68, 140, 255, 0.06);
    transform: translateY(-1px);
}

/* ============================================
   UI OVERLAY
   ============================================ */

.ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.ui-overlay > * {
    pointer-events: auto;
}

.ui-overlay.hidden > *:not(.toggle-ui) {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    pointer-events: none;
}

/* ============================================
   CLOCK
   ============================================ */

.clock-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 32px 52px;
    text-align: center;
    min-width: 300px;
}

.clock-time {
    font-family: var(--font-display);
    font-size: 6rem;
    font-weight: 300;
    letter-spacing: -2px;
    line-height: 1;
    background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradShift 8s ease infinite;
}

@keyframes gradShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.clock-date {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-top: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.clock-meta {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
}

.meta-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.meta-tag sub {
    font-size: 0.5rem;
}

.meta-sep {
    color: rgba(100, 150, 200, 0.2);
    font-size: 0.5rem;
}

/* ============================================
   STATS PANEL
   ============================================ */

.stats-panel {
    position: absolute;
    top: 28px;
    left: 28px;
    padding: 18px 22px;
    width: 210px;
}

.stats-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(68, 140, 255, 0.06);
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-1);
    box-shadow: 0 0 8px var(--glow-1);
    animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

.stats-title {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-accent);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-key {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.stat-key sub {
    font-size: 0.45rem;
}

.stat-val {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-accent);
}

.stat-unit {
    font-family: var(--font-mono);
    font-size: 0.5rem;
    color: var(--text-secondary);
}

/* ============================================
   MODE PANEL
   ============================================ */

.mode-panel {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.mode-title {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.mode-options {
    display: flex;
    gap: 6px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.mode-btn:hover {
    background: rgba(68, 140, 255, 0.06);
    border-color: rgba(68, 140, 255, 0.1);
}

.mode-btn.active {
    background: rgba(68, 140, 255, 0.1);
    border-color: var(--accent-1);
    box-shadow: 0 0 12px rgba(68, 204, 255, 0.15);
}

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

.mode-btn.active .mode-icon {
    color: var(--accent-1);
}

.mode-name {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.mode-btn.active .mode-name {
    color: var(--text-accent);
}

/* ============================================
   CONTROLS PANEL
   ============================================ */

.controls-panel {
    position: absolute;
    top: 28px;
    right: 28px;
    padding: 20px;
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: rgba(68, 140, 255, 0.08);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent-1);
    cursor: pointer;
    box-shadow: 0 0 10px var(--glow-1);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

input[type="range"]::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent-1);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--glow-1);
}

/* ============================================
   INFO WIDGETS
   ============================================ */

.info-widgets {
    position: absolute;
    bottom: 28px;
    left: 28px;
    display: flex;
    gap: 8px;
}

.widget {
    padding: 9px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 58px;
}

.widget-label {
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.widget-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-accent);
}

/* ============================================
   BUTTONS
   ============================================ */

.toggle-ui {
    position: absolute;
    bottom: 28px;
    right: 28px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    color: var(--text-primary);
    z-index: 200;
}

.toggle-ui:hover { color: var(--accent-1); }

.fullscreen-btn {
    position: absolute;
    bottom: 28px;
    right: 80px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    color: var(--text-primary);
    z-index: 200;
}

.fullscreen-btn:hover { color: var(--accent-1); }

/* ============================================
   ENTRANCE ANIMATIONS
   ============================================ */

.glass-card {
    animation: enterCard 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.stats-panel { animation-delay: 0.1s; }
.mode-panel { animation-delay: 0.25s; }
.controls-panel { animation-delay: 0.4s; }
.info-widgets .widget:nth-child(1) { animation-delay: 0.5s; }
.info-widgets .widget:nth-child(2) { animation-delay: 0.6s; }

@keyframes enterCard {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; }
}

.clock-card {
    animation: enterClock 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s both;
}

@keyframes enterClock {
    from { opacity: 0; transform: translate(-50%, -40%) scale(0.97); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

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

@media (max-width: 900px) {
    .mode-panel {
        flex-direction: column;
        gap: 8px;
    }
    .mode-options {
        flex-wrap: wrap;
        justify-content: center;
    }
    .clock-time { font-size: 3.5rem; }
    .clock-card { padding: 22px 26px; min-width: auto; width: 88%; }
    .controls-panel { top: auto; bottom: 100px; right: 10px; width: 200px; }
    .stats-panel { top: 10px; left: 10px; width: 170px; }
}
