/* Base Reset & Variables scoped to wrapper */
#billy-notes-wrapper {
    --billy-orange: #F5A623; 
    --billy-dark: #333; 
    --billy-blue: #008080; 
    --bg-light: #f9f9f9; 
    --slate-200: #e2e8f0;
    --slate-500: #64748b;
    --slate-800: #1e293b;
    --red-500: #ef4444;
    --green-500: #22c55e;
    
    line-height: 1.6; 
    color: #333; 
    width: 100%; 
    max-width: 800px;
    margin: 0 auto; 
    background: #fff;
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

#billy-notes-wrapper * { 
    box-sizing: border-box; 
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 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: 15px 25px;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
}

/* 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-heating { background: #fee2e2; color: #b91c1c; border-color: #fecaca; animation: pulse 2s infinite; }
#billy-notes-wrapper .status-ready { background: #e6f4f4; color: var(--billy-blue); border-color: #b2d8d8; }
#billy-notes-wrapper .status-tripped { background: #f1f5f9; color: var(--slate-500); border-color: var(--slate-200); }

/* Diagram Area */
#billy-notes-wrapper .diagram-container {
    position: relative;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid var(--slate-200);
    padding: 0;
    margin: 0;
    line-height: 0;
}
#billy-notes-wrapper svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 450px;
}

/* Controls */
#billy-notes-wrapper .controls {
    padding: 25px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: #fff;
}

#billy-notes-wrapper button {
    padding: 15px;
    border-radius: 12px;
    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: 4px;
}

#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:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(245, 166, 35, 0.4); }
#billy-notes-wrapper .btn-start:active:not(:disabled) { transform: scale(0.98); }
#billy-notes-wrapper .btn-start:disabled { background: var(--slate-200); color: var(--slate-500); cursor: not-allowed; box-shadow: none; }
#billy-notes-wrapper .btn-start .zh-text { color: rgba(255,255,255,0.9); margin-top: 0; }
#billy-notes-wrapper .btn-start:disabled .zh-text { color: var(--slate-500); }

#billy-notes-wrapper .btn-reset {
    background: white;
    border: 2px solid var(--billy-blue);
    color: var(--billy-blue);
}
#billy-notes-wrapper .btn-reset:hover:not(:disabled) { background: #f0f8f8; transform: translateY(-2px); }
#billy-notes-wrapper .btn-reset:active:not(:disabled) { transform: scale(0.98); }
#billy-notes-wrapper .btn-reset:disabled { border-color: var(--slate-200); color: #94a3b8; cursor: not-allowed; }
#billy-notes-wrapper .btn-reset .zh-text { color: var(--billy-blue); margin-top: 0; }
#billy-notes-wrapper .btn-reset:disabled .zh-text { color: #94a3b8; }

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
@keyframes rise {
    0% { transform: translateY(0); opacity: 0; }
    50% { opacity: 0.8; }
    100% { transform: translateY(-40px); opacity: 0; }
}
#billy-notes-wrapper .bubble { animation: rise 1.2s infinite ease-in; }
#billy-notes-wrapper .bubble:nth-child(2) { animation-delay: 0.4s; }
#billy-notes-wrapper .bubble:nth-child(3) { animation-delay: 0.8s; }

#billy-notes-wrapper .steam-path {
    stroke-dasharray: 6;
    animation: dash 0.8s linear infinite;
}
@keyframes dash {
    to { stroke-dashoffset: -12; }
}

/* SVG Specific Transitions - Removed the 'd' transition to fix rendering bugs */
#billy-notes-wrapper #latch-group { transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Mobile Optimization */
@media (max-width: 600px) {
    #billy-notes-wrapper .controls { grid-template-columns: 1fr; gap: 15px; padding: 20px; }
}