/* Container and Canvas Layout */
#bboard-container {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 999998; pointer-events: none; transition: background 0.3s ease;
    touch-action: none; overscroll-behavior: none;
}
#bboard-container.bboard-active { pointer-events: auto; }
#bboard-container.bboard-scroll-mode { pointer-events: none !important; touch-action: auto !important; overscroll-behavior: auto !important; }

/* Modes */
#bboard-container.bboard-transparent-mode { background: transparent; }
#bboard-container.bboard-slate-mode { background: #1e1e1e; }
#bboard-container.bboard-split-mode { background: linear-gradient(to bottom, transparent 50%, #1e1e1e 50%); }

.bboard-main-canvas {
    display: block; width: 100%; height: 100%; cursor: crosshair; position: absolute; 
    top: 0; left: 0; z-index: 2; transition: opacity 0.2s ease; touch-action: none;
}
#bboard-canvas-laser { z-index: 5; pointer-events: none; }

/* Peek Mode */
#bboard-container.bboard-bg-hidden { background: transparent !important; }
#bboard-container.bboard-bg-hidden .bboard-main-canvas { opacity: 0; pointer-events: none; }

/* --- Responsive Mini Slate --- */
#bboard-mini-container {
    position: absolute; width: 85vw; max-width: 320px; height: 40vh; min-height: 250px; 
    background: #1e1e1e; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); 
    z-index: 10; overflow: hidden; transition: width 0.3s ease, height 0.3s ease, opacity 0.2s ease;
    touch-action: none;
}
#bboard-mini-header {
    position: absolute; top: 0; left: 0; width: 100%; height: 36px;
    background: #0073aa; border-radius: 12px 12px 0 0; display: flex; justify-content: space-between; align-items: center; z-index: 11; 
    cursor: grab; padding: 0 6px 0 12px; box-sizing: border-box;
}
#bboard-mini-header:active { cursor: grabbing; }
.bboard-drag-indicator { color: rgba(255,255,255,0.6); font-size: 14px; pointer-events: none; }

#bboard-mini-controls { display: flex; gap: 4px; }
#bboard-mini-controls button {
    background: rgba(255,255,255,0.2); border: none; color: white; border-radius: 4px; 
    width: 26px; height: 26px; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#bboard-mini-controls button:active { background: rgba(255,255,255,0.4); }

#bboard-mini-canvas { position: absolute; top: 36px; left: 0; width: 100%; height: calc(100% - 36px); cursor: crosshair; touch-action: none;}

.bboard-hidden { display: none !important; }

/* 🌟 VISUAL VIEWPORT WRAPPER 🌟 */
#bboard-ui {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none; z-index: 999999; transform-origin: top left;
}
#bboard-ui > * { pointer-events: auto; }

/* --- UI Controls --- */
#bboard-quick-tabs { position: fixed; right: 0; top: 15px; display: flex; flex-direction: column; gap: 5px; z-index: 999999; }
.bboard-quick-tab {
    width: 36px; height: 36px; background: #2c3338; color: white;
    border: 1px solid #646970; border-right: none; border-radius: 8px 0 0 8px; 
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 18px; box-shadow: -2px 2px 8px rgba(0,0,0,0.3); opacity: 0.4; transition: all 0.3s ease;
}
.bboard-quick-tab:hover, .bboard-quick-tab.bboard-tab-active { opacity: 0.9; }
.bboard-quick-tab.bboard-tab-active { background: #0073aa; border-color: #005177; }

#bboard-floating-btn {
    position: fixed; bottom: 15px; left: 15px; width: 45px; height: 45px; 
    border-radius: 50%; background-color: #0073aa; color: white; border: none;
    font-size: 20px; cursor: pointer; box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 999999; opacity: 0.5; transition: all 0.2s;
}
#bboard-floating-btn:active, #bboard-floating-btn:hover { opacity: 1; transform: scale(1.05); }

#bboard-quick-hide {
    position: fixed; right: 0; top: 60px; width: 36px; height: 36px; background: #2c3338; color: white;
    border: 1px solid #646970; border-right: none; border-radius: 8px 0 0 8px; 
    z-index: 999999; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; box-shadow: -2px 2px 8px rgba(0,0,0,0.3); opacity: 0.4; transition: all 0.3s ease;
}
#bboard-quick-hide:hover { opacity: 1; }

/* --- Toolbar --- */
#bboard-toolbar {
    position: fixed; bottom: 0; left: 0; width: 100vw; height: 50px;
    background: #ffffff; box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
    display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-start;
    padding: 0 4px; gap: 4px; box-sizing: border-box; z-index: 999999; 
    overflow-x: auto; white-space: nowrap;
}
#bboard-toolbar::-webkit-scrollbar { display: none; }

.bboard-custom-select { position: relative; }
#bboard-select-trigger {
    background: #f0f0f1; border: 1px solid #8c8f94; padding: 6px;
    border-radius: 6px; font-size: 14px; color: #2c3338; cursor: pointer; min-width: 46px; text-align: center;
}
#bboard-select-options {
    position: fixed; bottom: 55px; left: 10px; background: #ffffff; 
    border: 1px solid #8c8f94; border-radius: 6px; list-style: none; padding: 0; 
    margin: 0; box-shadow: 0 -4px 15px rgba(0,0,0,0.2); width: 140px; z-index: 1000000;
}
#bboard-select-options li { padding: 10px 12px; font-size: 14px; cursor: pointer; border-bottom: 1px solid #f0f0f1; color: #2c3338; }
#bboard-select-options li:active { background: #e2e4e7; }
.bboard-divider { width: 1px; height: 24px; background: #e2e4e7; margin: 0 2px; }

.bboard-tools { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.bboard-tools input[type="color"] { width: 28px; height: 28px; padding: 0; border: 1px solid #e2e4e7; border-radius: 4px; }
.bboard-tools input[type="range"] { width: 55px; }
.bboard-tools button { background: #f6f7f7; border: 1px solid #8c8f94; padding: 6px 8px; border-radius: 6px; font-size: 14px; cursor: pointer;}
.bboard-tools button.bboard-tool-active { background: #0073aa; color: white; border-color: #005177; }
#bboard-close { background: #ffebe8; border-color: #ffbba8; color: #d63638; }