/* --- Design System & CSS Variables --- */
:root {
    --bg-darker: #090d16;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #223049;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.35);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.4);
    
    /* Light Colors */
    --light-near: #eab308;
    --light-near-glow: rgba(234, 179, 8, 0.25);
    --light-far: #3b82f6;
    --light-far-glow: rgba(59, 130, 246, 0.45);
    --light-width: #10b981;
    --light-width-glow: rgba(16, 185, 129, 0.3);
    --light-turn: #f97316;
    --light-turn-glow: rgba(249, 115, 22, 0.4);
}

/* --- Base Reset & Scrollbar --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-darker);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Layout Grid --- */
.app-container {
    width: 100%;
    max-width: 1280px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Header Section --- */
.app-header {
    background: var(--bg-card);
    border: 1px stroke var(--border-color);
    border: 1px solid var(--border-color);
    padding: 15px 24px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.title-text h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.title-text .subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-darker);
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.status-dot.green {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}
.status-dot.red {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.audio-toggle-btn {
    cursor: pointer;
    transition: all 0.2s ease;
}
.audio-toggle-btn:hover {
    background-color: var(--border-color);
    transform: scale(1.05);
}

/* --- Layout Main Grid --- */
.app-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
}

@media (max-width: 992px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
}

.left-column, .right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Card Base Styles --- */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: #475569;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.live-badge {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* --- Car Visualizer Section --- */
.visualizer-content {
    background-color: var(--bg-darker);
    border-radius: 12px;
    height: 300px;
    overflow: hidden;
    position: relative;
    border: 1px solid #1e293b;
}

/* Road Styling */
.road-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #090e1a 0%, #151e2d 100%);
}

.road-marks {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 120px;
    background: #111827;
    clip-path: polygon(45% 0, 55% 0, 100% 100%, 0 100%);
    border-top: 1px solid var(--border-color);
}
.road-marks::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    width: 4px;
    height: 100%;
    background: repeating-linear-gradient(to bottom, #f59e0b 0, #f59e0b 15px, transparent 15px, transparent 35px);
}

.car-container {
    position: absolute;
    bottom: 15px;
    width: 280px;
    height: 140px;
    z-index: 10;
}

.car-front-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 15px 15px rgba(0,0,0,0.5));
}

/* Light Beams Cones (CSS Gradients) */
.light-beams {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.beam {
    position: absolute;
    bottom: 120px;
    height: 180px;
    opacity: 0;
    transform-origin: bottom center;
    transition: opacity 0.25s ease;
}

/* Near Beams (Low Beam) */
.beam-left-near {
    left: 95px;
    width: 90px;
    transform: translateX(-50%) rotate(-4deg);
    background: linear-gradient(to top, var(--light-near-glow) 0%, transparent 80%);
    clip-path: polygon(40% 100%, 60% 100%, 100% 0, 0 0);
}
.beam-right-near {
    right: 95px;
    width: 90px;
    transform: translateX(50%) rotate(4deg);
    background: linear-gradient(to top, var(--light-near-glow) 0%, transparent 80%);
    clip-path: polygon(40% 100%, 60% 100%, 100% 0, 0 0);
}

/* Far Beams (High Beam) */
.beam-left-far {
    left: 95px;
    width: 140px;
    height: 220px;
    bottom: 120px;
    transform: translateX(-50%) rotate(-2deg);
    background: linear-gradient(to top, var(--light-far-glow) 0%, transparent 100%);
    clip-path: polygon(45% 100%, 55% 100%, 100% 0, 0 0);
}
.beam-right-far {
    right: 95px;
    width: 140px;
    height: 220px;
    bottom: 120px;
    transform: translateX(50%) rotate(2deg);
    background: linear-gradient(to top, var(--light-far-glow) 0%, transparent 100%);
    clip-path: polygon(45% 100%, 55% 100%, 100% 0, 0 0);
}

/* --- SVG Light Status --- */
#svgWidthLeft.active, #svgWidthRight.active {
    fill: #10b981;
    filter: drop-shadow(0 0 5px #10b981);
}
#svgHeadlightLeft.active-near, #svgHeadlightRight.active-near {
    fill: #facc15;
    filter: drop-shadow(0 0 8px #facc15);
}
#svgHeadlightLeft.active-far, #svgHeadlightRight.active-far {
    fill: #3b82f6;
    filter: drop-shadow(0 0 12px #3b82f6) drop-shadow(0 0 20px #3b82f6);
}

/* Blinking Animation for Turn Signals & Hazards */
.blink-turn {
    animation: turnBlinkAnimation 0.6s infinite alternate;
}
@keyframes turnBlinkAnimation {
    0% {
        fill: #334155;
        filter: none;
    }
    100% {
        fill: #f97316;
        filter: drop-shadow(0 0 8px #f97316);
    }
}

.blink-hazard {
    animation: hazardBlinkAnimation 0.6s infinite alternate;
}
@keyframes hazardBlinkAnimation {
    0% {
        fill: #334155;
        filter: none;
    }
    100% {
        fill: #ef4444;
        filter: drop-shadow(0 0 8px #ef4444);
    }
}

/* --- Dashboard Indicators Styling --- */
.dashboard-indicators {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    background-color: var(--bg-darker);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

@media (max-width: 576px) {
    .dashboard-indicators {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

.indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: 8px;
    background-color: #111827;
    border: 1px solid #1f2937;
    opacity: 0.3;
    transition: all 0.25s ease;
}

.indicator.active {
    opacity: 1;
    background-color: #1e293b;
    border-color: #475569;
}

.ind-icon {
    width: 24px;
    height: 24px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: filter 0.2s ease;
}

/* SVG icons coded directly as CSS backgrounds */
/* Width Light Icon (Green) */
.width-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2310b981" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/></svg>');
}
.indicator.active #indWidth .ind-icon {
    filter: drop-shadow(0 0 4px var(--light-width));
}

/* Near Light Icon (Green/Yellow) */
.near-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23eab308" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12c0-4.4 3.6-8 8-8h2v16h-2c-4.4 0-8-3.6-8-8z"/><path d="M18 7l4 2M18 12l4 0M18 17l4-2"/></svg>');
}
.indicator.active #indNear .ind-icon {
    filter: drop-shadow(0 0 5px var(--light-near));
}

/* Far Light Icon (Blue) */
.far-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%233b82f6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12c0-4.4 3.6-8 8-8h2v16h-2c-4.4 0-8-3.6-8-8z"/><path d="M18 6h5M18 10h5M18 14h5M18 18h5"/></svg>');
}
.indicator.active #indFar .ind-icon {
    filter: drop-shadow(0 0 6px var(--light-far));
}

/* Left Turn Icon (Green) */
.left-turn-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2310b981" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>');
}
.indicator.active #indLeftTurn .ind-icon {
    filter: drop-shadow(0 0 5px var(--success));
}

/* Right Turn Icon (Green) */
.right-turn-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%2310b981" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg>');
}
.indicator.active #indRightTurn .ind-icon {
    filter: drop-shadow(0 0 5px var(--success));
}

/* Hazard Warning Icon (Red) */
.hazard-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23ef4444" stroke-width="2.5" stroke-linejoin="round"><polygon points="12 2 2 22 22 22"/><line x1="12" y1="9" x2="12" y2="13"/><circle cx="12" cy="17" r="1" fill="%23ef4444"/></svg>');
}
.indicator.active #indHazard .ind-icon {
    animation: alertBlink 0.6s infinite alternate;
}
@keyframes alertBlink {
    0% { filter: none; }
    100% { filter: drop-shadow(0 0 6px var(--danger)); }
}

.ind-name {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}
.indicator.active .ind-name {
    color: var(--text-primary);
    font-weight: 600;
}

/* --- Interactive Physical Controls Section --- */
.controls-layout {
    display: grid;
    grid-template-columns: 1fr 1.8fr 1fr;
    gap: 20px;
}

@media (max-width: 992px) {
    .controls-layout {
        grid-template-columns: 1fr;
    }
}

.control-group {
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.tip-text {
    font-size: 11px;
    color: var(--text-muted);
}

/* Stalk Visualizer (Steering Column Left Stalk) */
.stalk-visualizer {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 50%, #152033 0%, #090e1a 100%);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.6);
}

/* Steering Column connection block */
.stalk-column-base {
    position: absolute;
    right: 0;
    top: 25px;
    width: 50px;
    height: 70px;
    background: radial-gradient(circle at 0% 50%, #334155 0%, #0f172a 80%, #020617 100%);
    border-radius: 35px 0 0 35px;
    border: 1px solid #1e293b;
    border-right: none;
    box-shadow: -4px 0 10px rgba(0,0,0,0.5), inset 2px 0 5px rgba(255,255,255,0.05);
    z-index: 4;
}

.stalk-lever-container {
    position: absolute;
    right: 42px;
    top: 45px;
    width: 150px;
    height: 30px;
    transform-origin: right center;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.2);
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    z-index: 5;
}

/* Stalk 3D Positions (Adjusted for right-side pivot) */
.stalk-lever-container.turn-left {
    transform: rotate(-14deg);
}
.stalk-lever-container.turn-right {
    transform: rotate(14deg);
}
.stalk-lever-container.flash-pull {
    transform: scaleX(0.85) rotate(2deg);
}
.stalk-lever-container.push-far {
    transform: scaleX(0.92) translate(6px, 0);
}

/* Lever Arm / Shaft */
.lever-shaft {
    width: 85px;
    height: 12px;
    background: linear-gradient(to bottom, #111827 0%, #374151 30%, #1f2937 60%, #030712 100%);
    border: 1px solid #111827;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.4);
}

/* Chrome Collar Detail */
.lever-collar {
    width: 8px;
    height: 16px;
    background: linear-gradient(to bottom, #ffffff 0%, #cbd5e1 30%, #475569 70%, #94a3b8 100%);
    border-radius: 2px;
    position: absolute;
    right: -2px;
    left: auto;
    top: -3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Rotary Switch on Stalk Tip */
.lever-tip-rotary {
    width: 25px;
    height: 22px;
    background: repeating-linear-gradient(
        90deg,
        #111827,
        #111827 2px,
        #1e293b 2px,
        #1e293b 4px
    );
    border: 1px solid #090d16;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

/* Pointer Line on Stalk Rotary Dial */
.rotary-ring-pointer {
    position: absolute;
    left: 4px;
    width: 8px;
    height: 3px;
    background-color: #e2e8f0;
    border-radius: 1px;
    transition: all 0.3s ease;
}

/* Highlight Indicator colors on stalk tip switch */
.lever-tip-rotary.ring-off .rotary-ring-pointer {
    top: 3px;
    background-color: var(--text-muted);
}
.lever-tip-rotary.ring-width .rotary-ring-pointer {
    top: 9px;
    background-color: var(--success);
    box-shadow: 0 0 4px var(--success);
}
.lever-tip-rotary.ring-on .rotary-ring-pointer {
    top: 15px;
    background-color: var(--warning);
    box-shadow: 0 0 4px var(--warning);
}

/* Outer Handle/Cap */
.lever-tip-cap {
    width: 32px;
    height: 22px;
    background: linear-gradient(to bottom, #374151 0%, #1f2937 40%, #0f172a 100%);
    border: 1px solid #111827;
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -3px 4px 8px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 2px 0;
}

.stalk-icon-arrows {
    font-size: 7px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.stalk-icon-lights {
    font-size: 8px;
    color: var(--text-secondary);
}

/* Click Hotspot Overlays */
.hotspot {
    position: absolute;
    z-index: 20;
    cursor: pointer;
    opacity: 0;
    background-color: rgba(59, 130, 246, 0.03);
    transition: all 0.2s ease;
    border-radius: 4px;
}

.stalk-visualizer:hover .hotspot {
    opacity: 0.15;
}

.hotspot:hover {
    opacity: 1 !important;
    background-color: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.5);
    box-shadow: inset 0 0 8px rgba(59, 130, 246, 0.4);
}

/* Tooltip definitions */
.hotspot::after {
    content: attr(title);
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    background-color: rgba(9, 13, 22, 0.95);
    border: 1px solid var(--border-color);
    color: #ffffff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 10px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    z-index: 99;
}

.hotspot:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Precise Hotspot positions (Right-anchored to follow the stalk lever) */
#hsUp {
    top: 5px;
    height: 38px;
    right: 40px;
    width: 150px;
}
#hsDown {
    bottom: 5px;
    height: 38px;
    right: 40px;
    width: 150px;
}
#hsPush {
    top: 45px;
    height: 30px;
    right: 42px;
    width: 85px;
}
#hsRotary {
    top: 42px;
    height: 36px;
    right: 125px;
    width: 30px;
}
#hsPull {
    top: 45px;
    height: 30px;
    right: 150px;
    width: 45px;
}

/* Control Buttons & Inputs */
.button-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.btn {
    flex: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    outline: none;
}

.btn:hover:not(:disabled) {
    background-color: var(--bg-card-hover);
    border-color: #64748b;
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn.active {
    background-color: var(--primary);
    border-color: #60a5fa;
    box-shadow: 0 0 10px var(--primary-glow);
    font-weight: 600;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 11px;
}

.btn-primary {
    background-color: var(--success);
    border-color: #34d399;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 18px;
    box-shadow: 0 4px 12px var(--success-glow);
}
.btn-primary:hover:not(:disabled) {
    background-color: #059669;
    border-color: #10b981;
}

.btn-secondary {
    background-color: var(--danger);
    border-color: #f87171;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 18px;
    box-shadow: 0 4px 12px var(--danger-glow);
}
.btn-secondary:hover:not(:disabled) {
    background-color: #dc2626;
    border-color: #ef4444;
}

.btn-clear {
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 4px 8px;
    font-size: 12px;
}
.btn-clear:hover {
    color: var(--text-primary);
    background-color: rgba(255,255,255,0.05);
}

/* Switches Details */
.switches-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    padding: 10px 0;
}

@media (max-width: 576px) {
    .switches-container {
        flex-direction: column;
        gap: 20px;
    }
}

/* Rotary Switch Switch Dial */
.rotary-switch-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 120px;
    gap: 8px;
}

.switch-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.rotary-switch {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b 0%, #090d16 100%);
    border: 3px solid #475569;
    position: relative;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(0,0,0,0.5), inset 0 2px 5px rgba(255,255,255,0.1);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rotary-pointer {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 24px;
    background-color: #cbd5e1;
    border-radius: 3px;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}
.rotary-pointer::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
}

.rotary-labels {
    display: flex;
    gap: 12px;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

.rotary-lbl.active {
    color: var(--text-primary);
    font-weight: 700;
}

.rotary-buttons-fallback {
    display: none; /* Can show on mobile/fallback if dial rotation is complex to click */
    gap: 4px;
    margin-top: 4px;
}

/* Hazard Switch Button */
.hazard-button-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 120px;
    gap: 8px;
}

.hazard-btn {
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.2s ease;
    border-radius: 50%;
    padding: 5px;
    background-color: #0f172a;
    border: 2px solid #334155;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.hazard-btn:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

.hazard-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.hazard-btn.active {
    background-color: #7f1d1d;
    border-color: #ef4444;
    animation: hazardButtonPulse 1.2s infinite;
}

@keyframes hazardButtonPulse {
    0% { box-shadow: 0 0 5px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.8); }
    100% { box-shadow: 0 0 5px rgba(239, 68, 68, 0.4); }
}

.hazard-status-label {
    font-size: 11px;
    color: var(--text-muted);
}
.hazard-btn.active + .hazard-status-label {
    color: var(--danger);
    font-weight: 700;
}

/* --- Exam Display Panel Section --- */
.exam-status-indicator {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background-color: #334155;
    color: var(--text-secondary);
    border: 1px solid #475569;
}
.exam-status-indicator.ready {
    background-color: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.3);
}
.exam-status-indicator.testing {
    background-color: rgba(245, 158, 11, 0.15);
    color: #fde047;
    border-color: rgba(245, 158, 11, 0.3);
    animation: blinker 1.5s linear infinite;
}
.exam-status-indicator.passed {
    background-color: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}
.exam-status-indicator.failed {
    background-color: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

@keyframes blinker {
    50% { opacity: 0.5; }
}

.exam-display {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: var(--bg-darker);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.voice-box {
    background-color: #111827;
    border-left: 4px solid var(--primary);
    padding: 12px;
    border-radius: 0 8px 8px 0;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.voice-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.voice-text {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
}

/* Timer and Progress bar */
.timer-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timer-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: #111827;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #1f2937;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background-color: var(--primary);
    border-radius: 4px;
    transition: width 0.1s linear, background-color 0.3s ease;
}
.progress-bar-fill.warning {
    background-color: var(--warning);
}
.progress-bar-fill.danger {
    background-color: var(--danger);
}

/* Exam Result Card popup/display inside console */
.exam-result-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    background-color: #1e293b;
    border: 2px solid var(--border-color);
    animation: slideInResult 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.exam-result-box.passed {
    border-color: var(--success);
    background-color: rgba(16, 185, 129, 0.05);
}
.exam-result-box.failed {
    border-color: var(--danger);
    background-color: rgba(239, 68, 68, 0.05);
}

@keyframes slideInResult {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.result-icon {
    font-size: 36px;
    margin-bottom: 8px;
}
.result-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}
.exam-result-box.passed .result-title { color: var(--success); }
.exam-result-box.failed .result-title { color: var(--danger); }

.result-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.exam-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.practice-select-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.practice-select-wrapper label {
    font-size: 12px;
    color: var(--text-secondary);
}

.form-select {
    width: 100%;
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}
.form-select:focus {
    border-color: var(--primary);
}

/* --- Logs Panel Section --- */
.logs-card {
    flex-grow: 1;
}

.logs-container {
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: monospace;
    font-size: 12px;
}

.log-entry {
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1.4;
    word-break: break-all;
}

.log-entry.system {
    color: var(--text-muted);
    border-left: 2px solid var(--text-muted);
    padding-left: 6px;
}
.log-entry.op {
    color: #e2e8f0;
    border-left: 2px solid #cbd5e1;
    padding-left: 6px;
}
.log-entry.success {
    color: #34d399;
    background-color: rgba(16, 185, 129, 0.08);
    border-left: 2px solid var(--success);
    padding-left: 6px;
}
.log-entry.error {
    color: #f87171;
    background-color: rgba(239, 68, 68, 0.08);
    border-left: 2px solid var(--danger);
    padding-left: 6px;
}

/* --- Cheatsheet / Rule Reference Table Section --- */
.cheatsheet-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.cheatsheet-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}
.cheatsheet-header:hover {
    background-color: var(--bg-card-hover);
}

.cheatsheet-header h2 {
    font-size: 15px;
    font-weight: 600;
    flex-grow: 1;
}

.toggle-arrow {
    font-size: 12px;
    color: var(--text-secondary);
}

.cheatsheet-content {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeInSlide 0.3s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cheatsheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.cheatsheet-table th, .cheatsheet-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.cheatsheet-table th {
    background-color: var(--bg-darker);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.cheatsheet-table tr:hover {
    background-color: rgba(255,255,255,0.02);
}

.cheatsheet-table td strong {
    color: #ffffff;
}

.highlight-text {
    color: #fde047;
    font-weight: 600;
}

.highlight-row {
    background-color: rgba(59, 130, 246, 0.02);
}

.special-row {
    background-color: rgba(245, 158, 11, 0.03);
}

.note-box {
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    font-size: 12px;
    line-height: 1.6;
}

.note-box p {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.note-box ul {
    padding-left: 20px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Helper utility class */
.hidden {
    display: none !important;
}
