/* 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: 800px;
    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; 
}
#billy-notes-wrapper .zh-text { color: #666; font-size: 0.9em; display: block; margin-top: 4px; font-weight: normal; }

/* 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: 20px 25px;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #fff;
    gap: 15px;
}

/* Status Badge */
#billy-notes-wrapper .status-badge {
    padding: 6px 24px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}
#billy-notes-wrapper .status-running { 
    background: #fee2e2; color: #b91c1c; border-color: #fecaca; animation: pulse 2s infinite; 
}

/* Display Area */
#billy-notes-wrapper .hud-display {
    text-align: center;
    width: 100%;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--slate-200);
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
#billy-notes-wrapper .hud-display::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--billy-blue), var(--billy-orange));
}
#billy-notes-wrapper .hud-val {
    font-size: 2rem;
    font-family: monospace;
    font-weight: bold;
    color: var(--slate-800);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

/* Diagram Area - 調整為 4:3 比例以容納按鈕 */
#billy-notes-wrapper .diagram-container {
    position: relative;
    width: 100%;
    background: #0f172a;
    border-bottom: 1px solid var(--slate-200);
    padding: 0;
    line-height: 0;
    aspect-ratio: 4/3; /* 讓高度更高，避免按鈕擋住太多空間 */
    max-height: 600px;
    min-height: 350px;
    overflow: hidden;
    contain: strict;
}

/* Sliders */
#billy-notes-wrapper .sliders-wrapper {
    padding: 25px;
    background: #fff;
    border-bottom: 1px solid var(--slate-200);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 600px) {
    #billy-notes-wrapper .sliders-wrapper {
        grid-template-columns: 1fr;
    }
}
#billy-notes-wrapper .slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#billy-notes-wrapper .slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--slate-800);
}
#billy-notes-wrapper .val-badge {
    background: var(--bg-light);
    border: 1px solid var(--slate-200);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}
#billy-notes-wrapper .val-badge.mass { color: #ef4444; border-color: #fecaca; background: #fef2f2; }
#billy-notes-wrapper .val-badge.res { color: #3b82f6; border-color: #bfdbfe; background: #eff6ff; }

#billy-notes-wrapper input[type=range] {
    -webkit-appearance: none; 
    width: 100%; 
    background: transparent; 
}
#billy-notes-wrapper input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--billy-blue);
    cursor: pointer;
    margin-top: -6px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    border: 2px solid white;
}
#billy-notes-wrapper .slider-mass::-webkit-slider-thumb { background: #ef4444 !important; }
#billy-notes-wrapper .slider-res::-webkit-slider-thumb { background: #3b82f6 !important; }

#billy-notes-wrapper input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--slate-200);
    border-radius: 3px;
}

/* Button Active States (疊加按鈕的點擊狀態) */
#billy-notes-wrapper .thrust-btn.active {
    background-color: #0d9488 !important; /* teal-600 */
    color: white !important;
    border-color: #0d9488 !important;
    transform: scale(0.92);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#billy-notes-wrapper .no-select { 
    user-select: none; 
    -webkit-user-select: none; 
}