/* ================= GENERAL ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    padding: 15px;
    display: flex;
    flex-direction: column;
    color: #fff;
}

/* Background GIF */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("assets/pixelated\ mini-dump.gif") no-repeat center center fixed;
    background-size: cover;
    z-index: -1;
    filter: brightness(0.45); /* darken GIF so UI text is visible */
}


/* Glass Panel */
.glass-panel {
    backdrop-filter: blur(15px);
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
}

/* Text Bar */
.text-bar {
    padding: 15px 20px;
    margin-bottom: 15px;
}
.text-bar h3 {
    margin-bottom: 8px;
    font-size: 14px;
    color: #00f9ff;
    text-shadow: 0 0 8px #00f9ff;
}
#recognizedText {
    width: 100%;
    border: none;
    font-size: 18px;
    font-weight: 600;
    padding: 10px 15px;
    border-radius: 12px;
    outline: none;
    background: rgba(255,255,255,0.1);
    color: #fff;
    box-shadow: 0 0 15px rgba(0,255,255,0.3);
}

/* Mode Switch */
.mode-switch {
    display: flex;
    gap: 10px;
    padding: 8px;
    margin-bottom: 20px;
}
.mode-btn {
    flex: 1;
    padding: 14px 18px;
    border: none;
    border-radius: 15px;
    font-size: 15px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}
.mode-btn.active {
    background: rgba(0,255,255,0.2);
    color: #00f9ff;
    box-shadow: 0 0 15px #00f9ff;
}

/* Controls */
.controls-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}
.control-group {
    padding: 12px;
}
.group-label { font-size: 12px; font-weight: 600; margin-bottom: 8px; color: #00f9ff; text-shadow: 0 0 6px #00f9ff; }
.group-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
button {
    flex: 1;
    min-width: 80px;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: rgba(0,255,255,0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(0,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
button:hover { box-shadow: 0 0 15px #00f9ff; transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, #00f9ff, #00d4ff); }
.btn-secondary { background: linear-gradient(135deg, #4b6cb7, #182848); }
.btn-accent { background: linear-gradient(135deg, #00f9ff, #00c3ff); }
.btn-danger { background: linear-gradient(135deg, #ff0033, #cc0022); }

/* Main Panels */
.main-container { display: flex; gap: 15px; flex-wrap: wrap; }
.panel { flex: 1 1 300px; min-width: 300px; display: flex; flex-direction: column; border-radius: 15px; overflow: hidden; }
.panel-header { padding: 12px 18px; font-size: 14px; font-weight: 600; color: #00f9ff; text-shadow: 0 0 8px #00f9ff; background: rgba(0,0,0,0.2); }
.left-panel { flex: 1 1 35%; max-width: 500px; }
.right-panel { flex: 1 1 60%; }

.video-container { position: relative; background: #000; aspect-ratio: 4/3; overflow: hidden; }
#video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#skeletonCanvas { position: absolute; top:0; left:0; width:100%; height:100%; transform: scaleX(-1); }

.canvas-container, .keyboard-container { flex: 1; position: relative; overflow: hidden; min-height: 400px; }
#drawCanvas, #pointerCanvas, #keyboardCanvas, #keyboardPointerCanvas { width: 100%; height: 100%; position: absolute; top:0; left:0; }
#drawCanvas { cursor: crosshair; background: rgba(255,255,255,0.05); }
#keyboardCanvas { background: rgba(255,255,255,0.05); }
#pointerCanvas, #keyboardPointerCanvas { pointer-events: none; }

.status { padding: 10px 20px; font-size: 13px; text-align:center; }
.status.active { color: #00f9ff; }

/* Responsive */
@media (max-width: 968px) { .controls-wrapper { grid-template-columns: 1fr; } }
@media (max-width: 768px) { 
    .main-container { flex-direction: column; } 
    .left-panel, .right-panel { flex: 1 1 100%; max-width:100%; }
}
