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

:root {
    --bg-color: #000000;
    --panel-bg: rgba(20, 20, 25, 0.6);
    --panel-border: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.5);
    --accent-color: #4ECDC4;
    --hover-bg: rgba(255, 255, 255, 0.08);
    --active-bg: rgba(78, 205, 196, 0.15);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    --cursor-color: #4ECDC4;
    --hover-ring: rgba(78, 205, 196, 0.4);
    --dwell-color: #50E3C2;
    --glass-blur: 25px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

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

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(78, 205, 196, 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 24px;
    font-size: 16px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

#drawingCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: none;
    z-index: 1;
}

.video-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 240px;
    height: 180px;
    border-radius: 16px;
    overflow: hidden;
    z-index: 10;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow);
    background: rgba(0, 0, 0, 0.5);
}

#video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

#handOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
    pointer-events: none;
}

.video-label {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 12px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-icon {
    width: 12px;
    height: 12px;
    stroke-width: 2;
}

.mobile-blocker {
    display: none;
}

.hand-cursor {
    position: fixed;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 1001;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cursor-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--cursor-color);
    border-radius: 50%;
    transition: all 0.15s ease;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
}

.cursor-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--cursor-color);
    border-radius: 50%;
    transition: all 0.15s ease;
}

.hand-cursor.hovering .cursor-ring {
    transform: scale(1.3);
    border-color: var(--dwell-color);
    box-shadow: 0 0 30px rgba(80, 227, 194, 0.5);
}

.hand-cursor.pinched .cursor-dot {
    transform: scale(2);
    background: var(--dwell-color);
}

.hand-cursor.eraser-mode .cursor-ring {
    width: var(--eraser-size, 40px);
    height: var(--eraser-size, 40px);
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.hand-cursor.eraser-mode.pinched .cursor-ring {
    border-color: #FF6B6B;
    background: rgba(255, 107, 107, 0.15);
    box-shadow: 0 0 25px rgba(255, 107, 107, 0.4);
}

.dwell-progress {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: conic-gradient(
        var(--dwell-color) 0deg,
        var(--dwell-color) var(--progress, 0deg),
        transparent var(--progress, 0deg),
        transparent 360deg
    );
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.hand-cursor.dwell-active .dwell-progress {
    opacity: 0.8;
}

.toolbar {
    position: fixed;
    top: 40px;
    width: 130px;
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    padding: 24px 14px;
    z-index: 50;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    scrollbar-width: none;
}

.toolbar::-webkit-scrollbar {
    display: none;
}

@media (max-width: 768px) {
    .mobile-blocker {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: #000;
        z-index: 9999;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 20px;
        padding: 40px;
        text-align: center;
    }

    .toolbar,
    .video-container,
    .hand-cursor,
    #drawingCanvas,
    #loading {
        display: none !important;
    }
}

.mobile-blocker-icon {
    width: 56px;
    height: 56px;
    color: var(--accent-color);
    stroke-width: 1.5;
}

.mobile-blocker-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.mobile-blocker-text {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
}

.mobile-blocker-url {
    margin-top: 12px;
    font-size: 13px;
    color: var(--accent-color);
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.left-toolbar {
    left: 20px;
}

.right-toolbar {
    right: 20px;
    width: 176px;
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: center;
}

.tool-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-btn {
    width: 100%;
    height: 72px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tool-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.tool-btn.active {
    background: var(--active-bg);
    color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color), inset 0 0 20px rgba(78, 205, 196, 0.1);
}

.tool-btn.hovered {
    background: rgba(80, 227, 194, 0.1);
    transform: scale(1.02) translateY(-2px);
}

.tool-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.tool-btn.active {
    background: var(--active-bg);
    color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color), inset 0 0 20px rgba(78, 205, 196, 0.1);
}

.tool-btn.hovered {
    background: rgba(80, 227, 194, 0.15);
    transform: scale(1.05);
}

.tool-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.btn-label {
    font-size: 11px;
    font-weight: 500;
}

.hover-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    pointer-events: none;
}

[data-selectable="true"].hovered .hover-indicator {
    border-color: var(--dwell-color);
    box-shadow: inset 0 0 20px rgba(80, 227, 194, 0.3);
}

[data-selectable="true"].dwell-active .hover-indicator {
    border-color: var(--dwell-color);
    box-shadow: inset 0 0 30px rgba(80, 227, 194, 0.5);
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    gap: 10px;
    justify-content: center;
}

.color-btn {
    width: 44px;
    height: 44px;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

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

.color-btn.active {
    border-color: white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.color-btn.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

.color-btn.hovered {
    transform: scale(1.2);
    box-shadow: 0 0 0 3px var(--dwell-color), 0 6px 20px rgba(0, 0, 0, 0.4);
}

.size-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.size-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.size-preview {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    transition: transform 0.2s ease;
}

.action-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.action-btn.hovered {
    background: rgba(80, 227, 194, 0.15);
    transform: scale(1.05);
    color: var(--text-primary);
}

.action-btn.clear-btn.hovered {
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
}

.action-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.status-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: all 0.2s ease;
}

.status-dot.active {
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.status-text {
    font-size: 11px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.status-indicator.pinched .status-text {
    color: var(--accent-color);
    font-weight: 500;
}

.gesture-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: rgba(80, 227, 194, 0.08);
    border-radius: 14px;
    border: 1px solid rgba(80, 227, 194, 0.15);
}

.gesture-icon-lucide {
    width: 14px;
    height: 14px;
    stroke-width: 2;
    color: var(--dwell-color);
    flex-shrink: 0;
    margin-top: 2px;
}

.gesture-text {
    font-size: 11px;
    color: var(--dwell-color);
    line-height: 1.4;
    word-break: keep-all;
}
