@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
    --bg-base: #0f0f23;
    --indigo: #6366f1;
    --purple: #8b5cf6;
    --amber: #f59e0b;
    --teal: #14b8a6;
    --rose: #f43f5e;

    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, #1a1a3e 0%, #2d1b4e 50%, #1e3a5f 100%);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {

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

    50% {
        background-position: 100% 50%;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--amber), var(--rose), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
}

.canvas-container {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    aspect-ratio: 4/3;
    overflow: hidden;
}

#webcam {
    position: absolute;
    top: 20px;
    left: 20px;
    width: calc(100% - 40px);
    height: calc(100% - 40px);
    object-fit: cover;
    border-radius: 12px;
    opacity: 0.3;
    filter: blur(2px);
}

#drawingCanvas {
    position: absolute;
    top: 20px;
    left: 20px;
    width: calc(100% - 40px);
    height: calc(100% - 40px);
    border-radius: 12px;
    cursor: crosshair;
}

.status {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    padding: 12px 20px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-family: 'Space Mono', monospace;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.active {
    background: #10b981;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-section {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.control-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--amber), var(--rose));
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

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

.color-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.color-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 12px currentColor;
}

.slider-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-control span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.slider-control input[type="range"] {
    width: 100%;
}

#brushSizeValue {
    font-family: 'Space Mono', monospace;
    color: var(--text-primary);
    text-align: right;
}

.instructions {
    list-style: none;
    padding: 0;
}

.instructions li {
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}

.instructions li:last-child {
    border-bottom: none;
}

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

    .canvas-container {
        aspect-ratio: 1;
    }
}