/* Base Reset & Variables scoped to wrapper to prevent bleeding */
#billy-notes-wrapper {
    --billy-orange: #F5A623; 
    --billy-dark: #333; 
    --billy-blue: #008080; 
    --bg-light: #f9f9f9; 
    --slate-200: #e2e8f0;
    --slate-500: #64748b;
    --slate-800: #1e293b;
    
    line-height: 1.6; 
    color: #333; 
    width: 100%; 
    max-width: 1000px;
    margin: 0 auto; 
    padding: 20px; 
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

#billy-notes-wrapper * { 
    box-sizing: border-box; 
}

/* Typography */
#billy-notes-wrapper h1 { 
    color: var(--billy-blue); 
    border-bottom: 3px solid var(--billy-orange); 
    padding-bottom: 10px; 
    font-size: 2em; 
    text-align: center; 
    margin-bottom: 20px; 
    margin-top: 0; 
    font-weight: bold;
}
#billy-notes-wrapper .zh-text { color: #666; font-size: 0.85em; display: block; margin-top: 2px; font-weight: normal; }
#billy-notes-wrapper span.zh-text.inline { display: inline; margin-left: 4px; }

/* Cards & Layout */
#billy-notes-wrapper .note-card { 
    background: var(--bg-light); 
    border-radius: 12px; 
    padding: 0; 
    margin: 20px 0; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    border-top: 4px solid var(--billy-blue); 
    overflow: hidden;
}

#billy-notes-wrapper .card-header {
    padding: 15px 25px;
    border-bottom: 1px solid var(--slate-200);
    background: #fff;
}

/* Diagram Area */
#billy-notes-wrapper .diagram-container {
    position: relative;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid var(--slate-200);
    padding: 0;
    line-height: 0;
}
#billy-notes-wrapper canvas#vectorCanvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: grab;
    touch-action: none; /* Prevent scrolling while dragging on mobile */
}
#billy-notes-wrapper canvas#vectorCanvas:active {
    cursor: grabbing;
}

/* Controls */
#billy-notes-wrapper .controls-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: #fff;
}

#billy-notes-wrapper button.billy-btn {
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
}

#billy-notes-wrapper .btn-start {
    background: linear-gradient(135deg, #F5A623 0%, #F76B1C 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(245, 166, 35, 0.3);
}
#billy-notes-wrapper .btn-start.active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.3);
}
#billy-notes-wrapper .btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15); }
#billy-notes-wrapper .btn-start:active { transform: scale(0.98); }
#billy-notes-wrapper .btn-start .zh-text { color: rgba(255,255,255,0.9); margin-top: 0; }

#billy-notes-wrapper .btn-reset {
    background: white;
    border: 2px solid var(--billy-blue);
    color: var(--billy-blue);
}
#billy-notes-wrapper .btn-reset:hover { background: #f0f8f8; transform: translateY(-2px); }
#billy-notes-wrapper .btn-reset:active { transform: scale(0.98); }
#billy-notes-wrapper .btn-reset .zh-text { color: var(--billy-blue); margin-top: 0; }

/* Info Box */
#billy-notes-wrapper .info-box {
    margin: 0 20px 20px 20px;
    padding: 15px;
    background: #fffbf0;
    border-left: 5px solid var(--billy-orange);
    border-radius: 0 8px 8px 0;
    color: #333;
    font-size: 0.95rem;
}

#billy-notes-wrapper .method-btn, 
#billy-notes-wrapper .vector-count-btn {
    transition: all 0.2s;
}
#billy-notes-wrapper .method-btn.active, 
#billy-notes-wrapper .vector-count-btn.active {
    background-color: var(--billy-blue);
    color: white;
}

@media (max-width: 768px) {
    #billy-notes-wrapper .controls-grid { grid-template-columns: 1fr; }
    #billy-notes-wrapper { padding: 10px; }
}