:root {
    --encom-black: #000000;
    --encom-surface: #05070a;
    --encom-panel: rgba(10, 15, 26, 0.85);
    --encom-neon: #00e5ff;
    --encom-blue: #00b8d9;
    --encom-cyan: #33f3ff;
    --encom-glow: #00ffff;
    --encom-text-primary: #e6ffff;
    --encom-text-secondary: #8fa6b2;
    --encom-border: rgba(0, 229, 255, 0.25);
    --encom-grid: rgba(0, 229, 255, 0.13);
    --shadow-panel: 0 0 10px rgba(0, 229, 255, 0.35), inset 0 0 6px rgba(0, 229, 255, 0.16);
    --shadow-card: 0 0 18px rgba(0, 229, 255, 0.22);
    --radius-panel: 20px;
    --radius-pill: 999px;
}

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

body {
    position: relative;
    overflow-x: hidden;
    font-family: 'Exo 2', sans-serif;
    background:
        radial-gradient(circle at top, rgba(0, 229, 255, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.98), rgba(5, 7, 10, 0.96));
    color: var(--encom-text-primary);
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(0, 229, 255, 0.03) 47%,
        rgba(0, 229, 255, 0.12) 50%,
        rgba(0, 229, 255, 0.03) 53%,
        transparent 100%
    );
    background-size: 100% 220px;
    opacity: 0.55;
    mix-blend-mode: screen;
    animation: scanline 12s linear infinite;
}

.background-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--encom-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--encom-grid) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

#app-container {
    position: relative;
    z-index: 1;
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 24px 96px;
}

h1, h2, h3 {
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

p, li, span, button, a {
    font-family: 'Exo 2', sans-serif;
}

.panel {
    position: relative;
    border: 1px solid var(--encom-border);
    border-radius: var(--radius-panel);
    background: var(--encom-panel);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(16px);
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(0, 229, 255, 0.08), transparent 18%),
        radial-gradient(circle at top right, rgba(0, 229, 255, 0.16), transparent 28%);
    pointer-events: none;
}

.scan-frame::after,
.panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 0%,
        rgba(0, 229, 255, 0.02) 42%,
        rgba(0, 229, 255, 0.12) 50%,
        transparent 58%
    );
    transform: translateX(-130%);
    animation: sweep 4.8s ease-in-out infinite;
    pointer-events: none;
}

.header {
    display: grid;
    gap: 24px;
    padding: 28px;
    margin-bottom: 24px;
}

.header-copy,
.panel-heading,
.scene-info,
.gesture-guide ul,
.system-card {
    position: relative;
    z-index: 1;
}

.header h1 {
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    color: var(--encom-text-primary);
    text-shadow: 0 0 18px rgba(0, 229, 255, 0.24);
}

.eyebrow,
.panel-label,
.panel-badge,
.status-chip,
.system-metrics span,
.btn {
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.eyebrow,
.panel-label {
    display: inline-block;
    color: var(--encom-cyan);
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.header-description {
    max-width: 760px;
    color: var(--encom-text-secondary);
    font-size: 1.02rem;
    line-height: 1.7;
}

.status-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.status-chip {
    padding: 10px 16px;
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: var(--radius-pill);
    background: rgba(0, 229, 255, 0.08);
    color: var(--encom-text-primary);
    font-size: 0.94rem;
    font-weight: 700;
}

.status-online {
    color: #6dffbf;
    border-color: rgba(109, 255, 191, 0.35);
}

.status-offline {
    color: #ff6f8a;
    border-color: rgba(255, 111, 138, 0.3);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 22px 0;
}

.panel-heading h2 {
    font-size: 1.15rem;
}

.panel-badge {
    border: 1px solid rgba(0, 229, 255, 0.24);
    border-radius: var(--radius-pill);
    padding: 8px 12px;
    font-size: 0.82rem;
    color: var(--encom-cyan);
    white-space: nowrap;
}

.video-container {
    position: relative;
    margin: 18px 22px 22px;
    border-radius: 18px;
    overflow: hidden;
    aspect-ratio: 4/3;
    border: 1px solid rgba(0, 229, 255, 0.16);
    background:
        radial-gradient(circle at top, rgba(0, 229, 255, 0.12), transparent 40%),
        rgba(0, 0, 0, 0.55);
}

#webcam {
    display: none;
}

#output-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: linear-gradient(180deg, rgba(0, 184, 217, 0.08), rgba(0, 0, 0, 0.32));
}

.controls-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.scene-container {
    position: relative;
    margin: 18px 22px 22px;
    border-radius: 18px;
    overflow: hidden;
    aspect-ratio: 4/3;
    border: 1px solid rgba(0, 229, 255, 0.16);
    background:
        radial-gradient(circle at top, rgba(0, 229, 255, 0.12), transparent 40%),
        rgba(0, 0, 0, 0.55);
}

#scene-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: radial-gradient(circle at top, rgba(0, 229, 255, 0.18), #020406 58%);
}

.scene-info {
    position: absolute;
    top: 14px;
    right: 14px;
    min-width: 220px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(0, 229, 255, 0.16);
    background: rgba(2, 4, 6, 0.72);
    font-size: 14px;
}

.telemetry-grid {
    display: grid;
    gap: 10px;
}

#object-info p {
    display: grid;
    gap: 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.08);
}

#object-info p:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

#object-info strong {
    color: var(--encom-text-secondary);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

#object-info span {
    color: var(--encom-text-primary);
    font-size: 1rem;
}

.lower-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .lower-grid {
        grid-template-columns: 1fr;
    }
}

.gesture-guide {
    padding: 22px;
}

.gesture-guide h3 {
    color: var(--encom-text-primary);
    margin-bottom: 15px;
}

.gesture-guide ul {
    list-style: none;
    display: grid;
    gap: 12px;
}

.gesture-guide li {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 229, 255, 0.14);
    border-radius: 16px;
    background: rgba(0, 229, 255, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.gesture-guide li:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
    border-color: rgba(0, 229, 255, 0.34);
}

.gesture-guide li strong {
    color: var(--encom-cyan);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.gesture-guide li span {
    color: var(--encom-text-secondary);
}

.system-card {
    display: grid;
    gap: 20px;
    padding: 22px;
}

.system-card p {
    position: relative;
    z-index: 1;
    color: var(--encom-text-secondary);
    line-height: 1.7;
}

.system-metrics {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.system-metrics span {
    padding: 10px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(0, 229, 255, 0.16);
    color: var(--encom-cyan);
    background: rgba(0, 229, 255, 0.06);
    font-size: 0.84rem;
    font-weight: 700;
}

.btn {
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid var(--encom-neon);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--encom-neon);
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: rgba(0, 229, 255, 0.12);
}

.btn-primary:hover:not(:disabled) {
    background: rgba(0, 229, 255, 0.18);
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.55);
}

.btn-danger {
    border-color: rgba(255, 111, 138, 0.55);
    color: #ff8ea3;
}

.btn-danger:hover:not(:disabled) {
    background: rgba(255, 111, 138, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(255, 111, 138, 0.4);
}

.footer {
    display: grid;
    gap: 8px;
    padding: 22px;
    border: 1px solid rgba(0, 229, 255, 0.16);
    border-radius: 18px;
    background: rgba(5, 7, 10, 0.68);
    text-align: center;
    box-shadow: var(--shadow-panel);
}

.footer p,
.footer a {
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--encom-neon);
    opacity: 0.92;
}

.footer a {
    display: inline-block;
    text-decoration: none;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.45);
}

.footer p strong {
    color: var(--encom-cyan);
}

@media (max-width: 640px) {
    .footer {
        padding: 18px 16px;
    }
}

.footer a:hover {
    text-decoration: underline;
}

.whatsapp-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34), 0 0 18px rgba(37, 211, 102, 0.32);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 0 0 24px rgba(37, 211, 102, 0.4);
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top: 3px solid var(--encom-neon);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes sweep {
    0% {
        transform: translateX(-130%);
    }
    100% {
        transform: translateX(130%);
    }
}

@keyframes scanline {
    0% {
        transform: translateY(-20%);
    }
    100% {
        transform: translateY(20%);
    }
}

@media (max-width: 768px) {
    #app-container {
        padding: 16px 16px 100px;
    }

    .header,
    .gesture-guide,
    .system-card {
        padding: 18px;
    }

    .panel-heading {
        padding: 18px 18px 0;
    }

    .video-container,
    .scene-container {
        margin: 16px 18px 18px;
    }

    .controls-overlay {
        width: calc(100% - 24px);
    }

    .controls-overlay .btn {
        width: 100%;
    }

    .scene-info {
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 12px;
        min-width: 0;
    }

    .whatsapp-button {
        right: 16px;
        bottom: 16px;
        width: 56px;
        height: 56px;
    }
}

/* ─── Gesture History Panel ──────────────────────────────────────────────── */

.history-panel { grid-column: 1 / -1; }

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color, #00ffff) transparent;
}

.history-list::-webkit-scrollbar       { width: 4px; }
.history-list::-webkit-scrollbar-thumb { background: var(--primary-color, #00ffff); border-radius: 2px; }

.history-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.08);
    animation: fadeInDown 0.2s ease;
}

.history-entry:last-child  { border-bottom: none; }

.history-gesture {
    color: var(--primary-color, #00ffff);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-meta {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.75rem;
}

.history-empty {
    color: rgba(255, 255, 255, 0.3);
    padding: 16px 10px;
    font-size: 0.85rem;
    text-align: center;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Keyboard Shortcuts Panel ───────────────────────────────────────────── */

.shortcuts-panel { grid-column: 1 / -1; }

.shortcuts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
}

.shortcuts-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

kbd {
    background: rgba(0, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 7px;
    font-family: 'Rajdhani', monospace;
    font-size: 0.78rem;
    color: var(--primary-color, #00ffff);
    white-space: nowrap;
}
