/* Base Reset & Variables */
html, body { 
    margin: 0; 
    padding: 0; 
    width: 100%; 
    background: #f4f7f6; 
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }

:root { 
    --billy-orange: #F5A623; 
    --billy-dark: #333; 
    --billy-blue: #008080; 
    --bg-light: #f9f9f9; 
    --slate-200: #e2e8f0;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-800: #1e293b;
}

#billy-notes-wrapper {
    line-height: 1.6; 
    color: #333; 
    width: 100%; 
    max-width: 900px;
    margin: 0 auto; 
    padding: 20px; 
    background: #fff;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* 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; 
}
.zh-text { color: #666; font-size: 0.85em; display: block; margin-top: 4px; font-weight: normal; }
span.zh-text.inline { display: inline; margin-left: 4px; }

/* Cards & Layout */
.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;
}

.card-header {
    padding: 15px 25px;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.status-display {
    display: flex;
    gap: 20px;
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--slate-800);
}
.status-display span { font-weight: bold; color: var(--billy-blue); }

/* Diagram Area */
.diagram-container {
    position: relative;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid var(--slate-200);
    padding: 0;
    line-height: 0;
    height: 200px;
    margin: 0;
}
canvas#motion-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}
.zoom-btn {
    width: 30px; height: 30px;
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--slate-200);
    border-radius: 4px;
    font-weight: bold;
    color: var(--slate-800);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.zoom-btn:hover { background: var(--slate-200); }

/* Sliders */
.sliders-wrapper {
    padding: 20px 25px;
    background: #fff;
    border-bottom: 1px solid var(--slate-200);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--slate-800);
}
.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;
}
.val-badge.vel { color: #ef4444; border-color: #fecaca; background: #fef2f2; }
.val-badge.acc { color: #3b82f6; border-color: #bfdbfe; background: #eff6ff; }

input[type=range] {
    -webkit-appearance: none; 
    width: 100%; 
    background: transparent; 
    margin-top: 5px;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 22px;
    width: 22px;
    border-radius: 50%;
    background: var(--billy-blue);
    cursor: pointer;
    margin-top: -8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    border: 2px solid white;
}
.slider-vel::-webkit-slider-thumb { background: #ef4444 !important; }
.slider-acc::-webkit-slider-thumb { background: #3b82f6 !important; }

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--slate-200);
    border-radius: 3px;
}

/* Slider Ticks */
.ticks {
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
    margin-top: 4px;
}
.tick {
    position: relative;
    width: 1px;
    background: var(--slate-400);
    height: 5px;
}
.tick:after {
    content: attr(data-tick);
    position: absolute;
    top: 6px;
    font-size: 10px;
    color: var(--slate-500);
    transform: translateX(-50%);
}

/* Controls */
.controls {
    padding: 20px 25px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
    background: #fff;
}

button.billy-btn {
    padding: 12px;
    border-radius: 10px;
    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;
}

.btn-start {
    background: linear-gradient(135deg, #F5A623 0%, #F76B1C 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(245, 166, 35, 0.3);
}
.btn-start.paused {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.3);
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15); }
.btn-start:active { transform: scale(0.98); }
.btn-start .zh-text { color: rgba(255,255,255,0.9); margin-top: 0; }

.btn-reset {
    background: white;
    border: 2px solid var(--billy-blue);
    color: var(--billy-blue);
}
.btn-reset:hover { background: #f0f8f8; transform: translateY(-2px); }
.btn-reset:active { transform: scale(0.98); }
.btn-reset .zh-text { color: var(--billy-blue); margin-top: 0; }

/* Tabs */
.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--slate-200);
    background: #fff;
    border: none;
    padding: 0;
}
.tab {
    flex: 1;
    text-align: center;
    padding: 12px 5px;
    cursor: pointer;
    font-weight: bold;
    color: var(--slate-500);
    transition: all 0.3s;
    font-size: 0.95rem;
    border: none;
    background: transparent;
    border-bottom: 3px solid transparent;
}
.tab.active {
    color: var(--billy-blue);
    border-bottom: 3px solid var(--billy-orange);
    background: #f4f9f9;
}
.tab-content { display: none; padding: 20px; background: #fff; }
.tab-content.active { display: block; }
.chart-container { position: relative; height: 250px; width: 100%; }

/* Mobile Optimization */
@media (max-width: 600px) {
    #billy-notes-wrapper { padding: 10px; }
    .sliders-wrapper { grid-template-columns: 1fr; gap: 20px; }
    .controls { grid-template-columns: 1fr; gap: 10px; }
    .status-display { flex-direction: column; gap: 5px; font-size: 0.95rem; }
    .chart-container { height: 200px; }
}