/* Speedometer Kucing - JGVRP Theme
   Designed for 1920x1080 resolution (bottom-right corner)
   Original Figma Canvas: 1024px x 572px
*/

:root {
    /* 
       Base HUD scale: 0.42 scales 1024x572 down to ~430px x 240px,
       which is the golden ratio size for a 1920x1080 screen HUD.
    */
    --hud-scale: 0.42;
    --straw-y: 0px;
    --heartbeat-speed: 1.2s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

body {
    background-color: transparent !important;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    position: relative;
}

/* Master container anchored to bottom right */
.hud-container {
    position: fixed;
    right: 25px;
    bottom: 25px;
    width: 1024px;
    height: 572px;
    transform-origin: bottom right;
    /* Responsive auto-scaling relative to 1920x1080 */
    transform: scale(calc(var(--hud-scale) * min(100vw / 1920, 100vh / 1080)));
    pointer-events: none;
}

/* Dashboard Board Canvas */
.speedometer-board {
    position: relative;
    width: 1024px;
    height: 572px;
    overflow: visible;
}

/* Common Image asset styling */
.asset-img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    pointer-events: none;
}

/* ========================================================
   ILLUSTRATION LAYERS (Dashboard SVG Components)
   ======================================================== */
.dashboard-illustration {
    position: absolute;
    left: 0;
    top: 0;
    width: 1024px;
    height: 572px;
}

/* 1. RPM Dial (Left) */
.rpm-dial-box {
    position: absolute;
    left: 60px;
    top: 105.2px;
    width: 258.4px;
    height: 284.8px;
    z-index: 10;
}

/* RPM Arc Fill */
#rpm-arc-fill {
    transition: stroke-dashoffset 0.16s cubic-bezier(0.18, 0.89, 0.32, 1.15);
}

/* Cat Face in RPM Dial */
.cat-face-rpm {
    transition: transform 0.2s ease;
}
.cat-face-rpm.excited {
    animation: cat-rev-bounce 0.35s infinite alternate;
}
.cat-face-rpm.excited .rpm-cheek {
    filter: drop-shadow(0 0 6px #ff4081);
}
@keyframes cat-rev-bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-2.5px) scale(1.02); }
}

/* 2. Cat Speedometer Housing (Center Main Frame) */
.cat-housing-box {
    position: absolute;
    left: 298.2px;
    top: 34.6px;
    width: 421.6px;
    height: 375.4px;
    z-index: 20;
}

/* Cat Ears tremor during high speed */
.cat-housing-box.fast-wind .cat-ear {
    animation: ear-flutter 0.12s infinite alternate ease-in-out;
}
@keyframes ear-flutter {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-1.5deg) translateY(-1px); }
}

/* 3. Dial Face */
.dial-face-box {
    position: absolute;
    left: 335px;
    top: 86px;
    width: 353px;
    height: 291px;
    z-index: 21;
}

/* 4. Dial Ticks */
.dial-ticks-box {
    position: absolute;
    left: 341.8px;
    top: 98.8px;
    width: 336.5px;
    height: 253.4px;
    z-index: 22;
}

/* 5. Heart HP Badge (Right Top) with Dynamic Heartbeat */
.heart-hp-box {
    position: absolute;
    left: 843.4px;
    top: 64.8px;
    width: 159.5px;
    height: 138.2px;
    z-index: 10;
    transition: filter 0.3s ease;
}

.heart-pulse {
    animation: heart-pulse-beat var(--heartbeat-speed, 1.2s) infinite ease-in-out;
    transform-origin: 50% 50%;
}

.heart-hp-box.low-health .heart-pulse {
    animation: heart-panic-beat 0.55s infinite ease-in-out;
    filter: drop-shadow(0 0 14px #ff1744);
}

@keyframes heart-pulse-beat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.07); }
    28% { transform: scale(1); }
    42% { transform: scale(1.04); }
    70% { transform: scale(1); }
}

@keyframes heart-panic-beat {
    0%, 100% { transform: scale(1); }
    20% { transform: scale(1.12); }
    40% { transform: scale(1); }
    60% { transform: scale(1.08); }
    80% { transform: scale(1); }
}

/* 6. Fuel Bottle (Right Bottom) with Dynamic Milk Level & Floating Strawberry */
.fuel-bottle-box {
    position: absolute;
    left: 731px;
    top: 165px;
    width: 113px;
    height: 217.8px;
    z-index: 10;
    transform-origin: 50% 90%;
    transition: transform 0.3s ease;
}

/* Liquid level clip rect transition */
#fuel-clip-rect {
    transition: y 0.35s ease-out, height 0.35s ease-out;
}

/* Liquid surface wave */
.waving-liquid {
    animation: milk-wave 3s infinite ease-in-out;
}
@keyframes milk-wave {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1.5px); }
}

/* Floating strawberry follows milk level with bobbing motion */
.floating-strawberry {
    transform-origin: 55px 95px;
    animation: strawberry-bob 2.4s infinite ease-in-out alternate;
    transition: transform 0.35s ease-out;
}
@keyframes strawberry-bob {
    0%   { transform: translateY(var(--straw-y, 0px)) rotate(-2deg); }
    50%  { transform: translateY(calc(var(--straw-y, 0px) - 3.5px)) rotate(2.5deg); }
    100% { transform: translateY(var(--straw-y, 0px)) rotate(-2deg); }
}

/* Shivering bottle when fuel is critically low */
.fuel-bottle-box.low-fuel-shiver {
    animation: bottle-shiver 0.35s infinite ease-in-out;
    filter: drop-shadow(0 0 10px rgba(255, 64, 129, 0.8));
}
@keyframes bottle-shiver {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-1.5deg) translateY(-1px); }
    75% { transform: rotate(1.5deg) translateY(1px); }
}

/* Animated crying tear/sweat drop */
.sweat-drop {
    animation: tear-drip 1.2s infinite ease-in;
}
@keyframes tear-drip {
    0%   { opacity: 0; transform: translateY(-2px) scale(0.6); }
    30%  { opacity: 1; transform: translateY(1px) scale(1); }
    80%  { opacity: 0.9; transform: translateY(4px) scale(1); }
    100% { opacity: 0; transform: translateY(7px) scale(0.4); }
}

/* Common Blinking eyes across all characters */
.blinking-eyes {
    transform-origin: center;
    animation: universal-blink 4s infinite;
}
@keyframes universal-blink {
    0%, 93%, 97%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.08); }
}

/* Blushing cheek pulse */
.blushing-cheek {
    animation: cheek-pulse 2.5s infinite alternate ease-in-out;
}
@keyframes cheek-pulse {
    0% { opacity: 0.85; }
    100% { opacity: 1; }
}

/* ========================================================
   BOTTOM INDICATOR ICONS & PHYSICAL SEATBELT LATCH
   ======================================================== */
.indicator-box {
    position: absolute;
    opacity: 0.28;
    transition: opacity 0.25s ease, filter 0.25s ease, transform 0.25s ease;
    z-index: 15;
}

/* Active indicator style */
.indicator-box.active {
    opacity: 1;
}

/* ==================== SEATBELT ==================== */
.seatbelt-box {
    left: 186.5px;
    top: 416.7px;
    width: 100px;
    height: 101.6px;
    opacity: 0.95;
}

/* The two movable buckle halves */
.seatbelt-part {
    transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* When ON / Buckled (Nyambung / Connected) */
.seatbelt-box.buckled .sb-top {
    transform: translate(0, 0) rotate(0deg);
}
.seatbelt-box.buckled .sb-bottom {
    transform: translate(0, 0) rotate(0deg);
}
.seatbelt-box.buckled {
    opacity: 0.32;
    filter: none;
}

/* When OFF / Unbuckled (Lepas / Detached & Warning Alert) */
.seatbelt-box.unbuckled .sb-top {
    transform: translate(14px, -14px) rotate(8deg);
}
.seatbelt-box.unbuckled .sb-bottom {
    transform: translate(-10px, 10px) rotate(-6deg);
}
.seatbelt-box.unbuckled.warning {
    opacity: 1;
    animation: blink-seatbelt-alert 1s infinite ease-in-out;
}
@keyframes blink-seatbelt-alert {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 12px rgba(255, 90, 130, 0.95)); }
    50% { opacity: 0.35; filter: none; }
}

/* ==================== ENGINE ==================== */
.engine-box {
    left: 315.5px;
    top: 427.2px;
    width: 141.1px;
    height: 85.8px;
}
.engine-box.active {
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(255, 209, 157, 0.9));
}
.engine-box.active .engine-body-shake {
    animation: engine-purr 0.18s infinite ease-in-out;
}
.engine-box.off {
    opacity: 0.25;
    filter: grayscale(1);
}
.engine-box.off #engine-smoke-puffs {
    opacity: 0;
}

@keyframes engine-purr {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1.4px); }
}

/* Exhaust smoke puffs float up smoothly */
.engine-smoke-active .smoke-puff {
    transform-origin: 125px 25px;
    transition: opacity 0.3s ease;
}
.engine-smoke-active .puff-1 {
    animation: smoke-float-1 1.8s infinite ease-in-out;
}
.engine-smoke-active .puff-2 {
    animation: smoke-float-2 2.2s infinite 0.4s ease-in-out;
}
@keyframes smoke-float-1 {
    0%, 100% { transform: translate(0, 0) scale(0.9); opacity: 0.7; }
    50% { transform: translate(4px, -5px) scale(1.15); opacity: 1; }
}
@keyframes smoke-float-2 {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.8; }
    50% { transform: translate(-3px, -4px) scale(1.2); opacity: 1; }
}

/* ==================== TURN INDICATORS ==================== */
.left-arrow-box {
    left: 484.5px;
    top: 434.9px;
    width: 85.5px;
    height: 77.3px;
    transform-origin: center;
}
.left-arrow-box.active {
    animation: indicator-flash 0.65s infinite ease-in-out;
}

.right-arrow-box {
    left: 610px;
    top: 435.8px;
    width: 86.8px;
    height: 76.3px;
    transform-origin: center;
}
.right-arrow-box.active {
    animation: indicator-flash 0.65s infinite ease-in-out;
}

@keyframes indicator-flash {
    0%, 100% { opacity: 1; transform: scale(1.08); filter: drop-shadow(0 0 14px rgba(166, 229, 202, 1)); }
    50% { opacity: 0.2; transform: scale(0.98); filter: none; }
}

/* ==================== HEADLIGHTS ==================== */
.headlights-box {
    left: 732px;
    top: 436.8px;
    width: 110px;
    height: 74.2px;
}
.headlights-box.normal {
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(255, 226, 141, 0.9));
}
.headlights-box.highbeam {
    opacity: 1;
    filter: drop-shadow(0 0 16px rgba(105, 163, 200, 1)) brightness(1.25);
    animation: highbeam-radiance 1.5s infinite alternate ease-in-out;
}
@keyframes highbeam-radiance {
    0% { filter: drop-shadow(0 0 12px rgba(105, 163, 200, 0.9)) brightness(1.15); }
    100% { filter: drop-shadow(0 0 20px rgba(105, 163, 200, 1)) brightness(1.35); }
}

/* ==================== YOUTUBE ==================== */
.youtube-box {
    left: 874px;
    top: 434.5px;
    width: 103.1px;
    height: 79.1px;
    opacity: 0.9;
}
.youtube-bounce {
    animation: youtube-beat 1.8s infinite ease-in-out;
    transform-origin: center;
}
@keyframes youtube-beat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04) translateY(-1.5px); filter: drop-shadow(0 0 8px rgba(246, 139, 166, 0.7)); }
}

/* ========================================================
   LABELS & NUMBERS LAYER
   ======================================================== */
.labels-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 1024px;
    height: 572px;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    z-index: 30;
}

/* Stroke styling for outlined cream text matching Figma */
.stroke-outlined {
    color: #fff3d1;
    -webkit-text-stroke: 3.5px #211D38;
    paint-order: stroke fill;
}

/* Dial Speed Numbers (0, 10, 20 ... 100) */
.dial-num {
    position: absolute;
    color: #181738;
    font-size: 31px;
    font-weight: 800;
}
.num-0   { left: 396.5px; top: 323px; }
.num-10  { left: 369px;   top: 275px; }
.num-20  { left: 369px;   top: 219px; }
.num-30  { left: 397px;   top: 171px; }
.num-40  { left: 437px;   top: 137px; }
.num-50  { left: 493px;   top: 122px; }
.num-60  { left: 549px;   top: 137px; }
.num-70  { left: 589px;   top: 171px; }
.num-80  { left: 613px;   top: 219px; }
.num-90  { left: 613px;   top: 275px; }
.num-100 { left: 576px;   top: 323px; }

/* Digital Speed (Under Cat Forehead) */
.digital-speed {
    position: absolute;
    left: 510px;
    top: 92px;
    transform: translateX(-50%);
    font-size: 22px;
    font-weight: 800;
    color: #181738;
    text-align: center;
    min-width: 40px;
    transition: color 0.2s ease, transform 0.15s ease;
}
.digital-speed.overspeed {
    color: #ff1744;
    transform: translateX(-50%) scale(1.15);
}

/* Speed Unit Badge (Inside Purple Pill) */
.speed-unit-pill {
    position: absolute;
    left: 512px;
    top: 320px;
    transform: translateX(-50%);
    font-size: 32px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

/* RPM Display */
.rpm-value {
    position: absolute;
    left: 124.5px;
    top: 321px;
    font-size: 31px;
    font-weight: 800;
    color: #181738;
    min-width: 30px;
    text-align: right;
}
.rpm-label {
    position: absolute;
    left: 174.5px;
    top: 323.5px;
    font-size: 34px;
    font-weight: 800;
}

/* Health (HP) */
.hp-label {
    position: absolute;
    left: 896px;
    top: 100px;
    font-size: 29px;
    font-weight: 800;
}
.hp-value {
    position: absolute;
    left: 878px;
    top: 132.5px;
    font-size: 28px;
    font-weight: 800;
    min-width: 60px;
    text-align: center;
}

/* Fuel */
.fuel-label {
    position: absolute;
    left: 753px;
    top: 300.5px;
    font-size: 28px;
    font-weight: 800;
}
.fuel-value {
    position: absolute;
    left: 755.5px;
    top: 330.5px;
    font-size: 30px;
    font-weight: 800;
    min-width: 60px;
    text-align: center;
}

/* Current Gear */
.gear-display {
    position: absolute;
    left: 512px;
    top: 286px;
    transform: translateX(-50%);
    font-size: 19px;
    font-weight: 900;
    color: #fff3d1;
    -webkit-text-stroke: 2.5px #211D38;
    paint-order: stroke fill;
    letter-spacing: 0.5px;
}

/* Odometer */
.odometer-display {
    position: absolute;
    left: 512px;
    top: 372px;
    transform: translateX(-50%);
    font-size: 15px;
    font-weight: 800;
    color: #fff3d1;
    -webkit-text-stroke: 2.5px #211D38;
    paint-order: stroke fill;
    text-shadow: 0 1px 3px rgba(33, 29, 56, 0.8);
    opacity: 0.95;
}

/* Bottom Label Texts (Under Indicator Icons) */
.bottom-label {
    position: absolute;
    top: 524px;
    font-size: 25px;
    font-weight: 800;
    color: #fff3d1;
    opacity: 0.65;
    text-align: center;
    transform: translateX(-50%);
}
.label-seatbelt   { left: 236px; }
.label-engine     { left: 386px; }
.label-left       { left: 527px; }
.label-right      { left: 653px; }
.label-headlights { left: 787px; }
.label-youtube    { left: 925px; }

/* ========================================================
   NEEDLE (Jarum • Pivot at 510, 258)
   ======================================================== */
.needle-pivot-frame {
    position: absolute;
    left: 360px;
    top: 108px;
    width: 300px;
    height: 300px;
    transform-origin: 50% 50%; /* Center pivot point (150px, 150px) -> (510, 258) on canvas */
    transition: transform 0.14s cubic-bezier(0.18, 0.89, 0.32, 1.15);
    pointer-events: none;
    z-index: 40;
}

.needle-subframe {
    position: absolute;
    left: 0;
    top: 0;
    width: 300px;
    height: 300px;
    overflow: visible;
}

.needle-img {
    position: absolute;
    left: 59.88px;
    top: 119.73px;
    width: 132.3px;
    height: 109.5px;
    display: block;
}
