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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0a;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #e0e0e0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    cursor: grab;
    position: fixed;
    top: 0;
    left: 0;
}

#canvas:active {
    cursor: grabbing;
}

.control-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: rgba(20, 20, 24, 0.8);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    user-select: none;
    z-index: 10;
    white-space: nowrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-size: 12px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.control-group select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.06);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 28px 6px 10px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.control-group select:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background-color: rgba(255, 255, 255, 0.1);
}

.control-group select:focus {
    border-color: #6a6;
}

.control-group input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 160px;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #6a6;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(100, 170, 100, 0.4);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #6a6;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.value-label {
    font-size: 13px;
    font-weight: 500;
    color: #ccc;
    min-width: 48px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.icon {
    flex-shrink: 0;
    color: #888;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #e0e0e0;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    padding: 0;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.15);
}

.icon-btn:active {
    background: rgba(255, 255, 255, 0.18);
}

.divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.fallback-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: rgba(90, 26, 26, 0.95);
    color: #ffaaaa;
    text-align: center;
    font-size: 14px;
    z-index: 100;
    backdrop-filter: blur(8px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (max-width: 700px) {
    .control-bar {
        bottom: 12px;
        padding: 8px 14px;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
        border-radius: 10px;
        max-width: calc(100vw - 24px);
    }

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

    .divider {
        display: none;
    }
}
