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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    overflow: hidden;
    height: 100vh;
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
}

#video-container {
    position: relative;
    flex: 1;
    overflow: hidden;
}

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

#drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.toolbox {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    transition: all 0.3s ease;
}

.toolbox-toggle {
    position: absolute;
    right: 0;
    top: 0;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    z-index: 6;
}

.toolbox-toggle:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: scale(1.1);
}

.toolbox-content {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    min-width: 240px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    margin-right: 70px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.toolbox.expanded .toolbox-content {
    transform: translateX(0);
}

.tool-section {
    margin-bottom: 20px;
}

.tool-section:last-child {
    margin-bottom: 0;
}

.tool-section h3 {
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.brush-sizes {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.brush-size {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(221, 221, 221, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 3px solid transparent;
    backdrop-filter: blur(5px);
}

.brush-size::after {
    content: '';
    background: #333;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.brush-size[data-size="2"]::after {
    width: 2px;
    height: 2px;
}

.brush-size[data-size="5"]::after {
    width: 5px;
    height: 5px;
}

.brush-size[data-size="10"]::after {
    width: 10px;
    height: 10px;
}

.brush-size[data-size="20"]::after {
    width: 20px;
    height: 20px;
}

.brush-size.active {
    background: #007acc;
    transform: scale(1.2);
}

.brush-size.active::after {
    background: white;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    justify-items: center;
}

.color {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color.active {
    border-color: #007acc;
    transform: scale(1.2);
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3);
}

.shapes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    justify-items: center;
    margin-bottom: 15px;
}

.shape {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 10px;
    background: rgba(245, 245, 245, 0.8);
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.shape:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.shape.active {
    border-color: #007acc;
    background: rgba(0, 122, 204, 0.1);
    transform: scale(1.1);
}

.fill-toggle, .drawing-toggle {
    display: flex;
    justify-content: center;
}

.toggle-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.toggle-btn-compact {
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(240, 240, 240, 0.8);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    flex: 1;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.toggle-btn-compact:hover {
    background: rgba(224, 224, 224, 0.8);
}

.toggle-btn-compact.active {
    background: rgba(0, 122, 204, 0.9);
    color: white;
}

.toggle-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(240, 240, 240, 0.8);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 45px;
    backdrop-filter: blur(5px);
}

.toggle-btn:hover {
    background: #e0e0e0;
}

.toggle-btn.active {
    background: #007acc;
    color: white;
}

.gesture-modes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gesture-mode {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(240, 240, 240, 0.8);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
    min-height: 45px;
    backdrop-filter: blur(5px);
}

.gesture-mode:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.gesture-mode.active {
    background: #007acc;
    color: white;
    font-weight: 600;
}

.tools {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool {
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    background: rgba(240, 240, 240, 0.8);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    backdrop-filter: blur(5px);
}

.tool:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.tool.active {
    background: #007acc;
    color: white;
}

.finger-indicator {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #ff0000;
    border-radius: 50%;
    pointer-events: none;
    z-index: 15;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.toolbox-item-hover {
    background: rgba(0, 122, 204, 0.2) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 0 15px rgba(0, 122, 204, 0.4) !important;
}

.toolbox-item-dwell {
    background: rgba(0, 122, 204, 0.4) !important;
    transform: scale(1.15) !important;
    box-shadow: 0 0 20px rgba(0, 122, 204, 0.6) !important;
    animation: dwell-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes dwell-pulse {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

.dwell-progress {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px solid transparent;
    border-radius: inherit;
    border-top-color: #007acc;
    animation: dwell-progress 1s linear;
}

@keyframes dwell-progress {
    from {
        transform: rotate(0deg);
        border-top-color: #007acc;
        border-right-color: transparent;
        border-bottom-color: transparent;
        border-left-color: transparent;
    }
    25% {
        border-right-color: #007acc;
    }
    50% {
        border-bottom-color: #007acc;
    }
    75% {
        border-left-color: #007acc;
    }
    to {
        transform: rotate(360deg);
        border-color: #007acc;
    }
}

@media (max-width: 768px) {
    .toolbox {
        right: 10px;
    }
    
    .toolbox-content {
        min-width: 180px;
        padding: 15px;
    }
    
    .toolbox-toggle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}