@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0f;
    font-family: 'Inter', sans-serif;
    color: #ffffff;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

#camera-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    display: block;
}

#draw-canvas,
#skeleton-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#skeleton-canvas {
    z-index: 2;
}

#draw-canvas {
    z-index: 1;
}

#toolbar {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    background: rgba(15, 15, 25, 0.75);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

#btn-clear {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

#btn-clear:hover {
    background: rgba(255, 56, 96, 0.25);
    border-color: rgba(255, 56, 96, 0.5);
    color: #FF3860;
    transform: scale(1.1);
}

#color-picker {
    display: flex;
    gap: 6px;
    padding: 0 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 14px;
    padding-right: 14px;
}

.color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
}

.color-swatch:hover {
    transform: scale(1.2);
}

.color-swatch.active {
    border-color: #ffffff;
    box-shadow: 0 0 12px currentColor;
    transform: scale(1.15);
}

#stroke-control {
    display: flex;
    align-items: center;
}

#stroke-size {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

#stroke-size::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease;
}

#stroke-size::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#stroke-size::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

#status-indicator {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(15, 15, 25, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.4s ease;
}

#status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffaa00;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

#status-dot.active {
    background: #00F5D4;
    animation: pulse-dot-active 2s ease-in-out infinite;
}

#status-dot.writing {
    background: #FFD700;
    animation: pulse-dot-writing 0.8s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

@keyframes pulse-dot-active {
    0%, 100% { opacity: 0.7; transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 245, 212, 0.4); }
    50% { opacity: 1; transform: scale(1.1); box-shadow: 0 0 8px 2px rgba(0, 245, 212, 0.3); }
}

@keyframes pulse-dot-writing {
    0%, 100% { opacity: 0.8; transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4); }
    50% { opacity: 1; transform: scale(1.4); box-shadow: 0 0 10px 3px rgba(255, 215, 0, 0.4); }
}

#gesture-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10;
    padding: 8px 18px;
    background: rgba(15, 15, 25, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 30px;
    font-size: 22px;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.35s ease;
}

#gesture-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #0a0a0f;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#loading-overlay p {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
}

.loader-ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: #FFD700;
    animation: spin 0.9s linear infinite;
}

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

@media (max-width: 600px) {
    #toolbar {
        bottom: 16px;
        padding: 8px 14px;
        gap: 8px;
    }

    .color-swatch {
        width: 22px;
        height: 22px;
    }

    #stroke-size {
        width: 55px;
    }

    #status-indicator {
        top: 12px;
        left: 12px;
        font-size: 11px;
        padding: 6px 12px;
    }

    #gesture-indicator {
        top: 12px;
        right: 12px;
        font-size: 18px;
        padding: 6px 14px;
    }
}
