@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@700;800;900&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --hud-scale: 0.65;

  /* Pastel Pink & White Palette (Izumo Tenka - Mato Seihei no Slave) */
  --color-bg-white: #ffffff;
  --color-bg-softpink: #fff0f5;
  --color-pink-card: #ffe8f0;
  --color-pink-subtle: #fff5f8;
  --color-pink-border: #ffa6bf;
  --color-pink-accent: #ff4d79;
  --color-pink-deep: #e63966;
  --color-pink-glow: rgba(255, 77, 121, 0.32);

  --color-text-main: #361927;
  --color-text-pink: #ff4d79;
  --color-text-muted: #8e5871;
  --color-text-light: #ffffff;

  --color-mint: #34d399;
  --color-mint-dark: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ff3366;
  --color-blue-highbeam: #38bdf8;

  --icon-inactive: #b8869e;
  --icon-active: #ff4d79;
}

@media (max-width: 1400px) {
  :root {
    --hud-scale: 0.58;
  }
}

@media (min-width: 2200px) {
  :root {
    --hud-scale: 0.75;
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  font-family: 'Fredoka', 'Nunito', 'Inter', sans-serif;
  overflow: hidden;
}

/* JGVRP Compatibility Element layer (invisible) */
.template-compat-dl {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  pointer-events: none;
}

/* Speedometer App Root - Anchored in Bottom-Right Corner */
.speedometer-app {
  position: fixed;
  right: 24px;
  bottom: 20px;
  pointer-events: none;
  z-index: 99999;
}

/* Speedometer Stage: 400px wide x 680px tall (Square Console Base) */
.speedometer-stage {
  position: relative;
  width: 400px;
  height: 680px;
  transform-origin: bottom right;
  scale: var(--hud-scale);
  translate: 0 0;
  rotate: 0deg;
  pointer-events: auto;
}

/* ========================================================
   IZUMO TENKA CHIBI MASCOT (MATO SEIHEI NO SLAVE / CHAINED SOLDIER)
   Centered at X=200px (left: 65px on 400px square console stage)
   ======================================================== */
.character-area {
  position: absolute;
  left: 65px;
  top: 0;
  width: 270px;
  height: 270px;
  z-index: 10;
}

.character-wrap {
  position: absolute;
  inset: 0;
  transform-origin: 50% 249px;
  translate: 0 0;
  scale: 1;
  rotate: 0deg;
  animation: tenka-breath 4s ease-in-out infinite;
}

.character-wrap.noseatbelt,
.resting-hands.noseatbelt,
.resting-paws.noseatbelt {
  animation: tenka-seatbelt-remind 0.55s ease-in-out infinite alternate;
}

.character-wrap.excited,
.resting-hands.excited,
.resting-paws.excited,
.character-wrap.highspeed,
.resting-hands.highspeed,
.resting-paws.highspeed {
  animation: tenka-highspeed-rush 0.24s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 12px rgba(255, 77, 121, 0.45));
}

.character-wrap.damaged,
.resting-hands.damaged,
.resting-paws.damaged {
  animation: tenka-shiver 0.22s ease-in-out infinite;
}

@keyframes tenka-breath {
  0%, 100% { scale: 1 1; }
  50% { scale: 1 1.018; }
}

@keyframes tenka-seatbelt-remind {
  0% { scale: 1 1; rotate: -1.5deg; }
  100% { scale: 1.02 1.025; rotate: 1.5deg; }
}

@keyframes tenka-highspeed-rush {
  0% { scale: 1 1; translate: -1px 0; }
  50% { scale: 1.025 1.035; translate: 1px 0; }
  100% { scale: 1.01 1.02; translate: -0.5px 0; }
}

@keyframes tenka-shiver {
  0% { translate: -1.5px 0; }
  50% { translate: 1.5px 0; }
  100% { translate: -1.5px 0; }
}

.character-expression-img,
.tenka-expression-img,
.cat-expression-img {
  position: absolute;
  inset: 0;
  width: 270px;
  height: 270px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Izumo Tenka White Gloved Hands (resting over top square console rim at Y=250px) */
.resting-hands,
.resting-paws {
  position: absolute;
  left: 65px;
  top: 0;
  width: 270px;
  height: 270px;
  z-index: 25;
  pointer-events: none;
  transform-origin: 50% 249px;
  translate: 0 0;
  scale: 1;
  rotate: 0deg;
}

/* Floating Ambient Particles (Symmetric around 400px width) */
.floating-element {
  position: absolute;
  pointer-events: none;
  translate: 0 0;
  scale: 1;
  rotate: 0deg;
}

.star-1 { left: 14px; top: 44px; width: 22px; height: 30px; animation: sparkle-float 3s ease-in-out infinite; }
.star-2 { right: 14px; top: 44px; width: 22px; height: 30px; animation: sparkle-float 3.5s ease-in-out infinite 0.7s; }
.star-3 { left: 10px; top: 174px; width: 18px; height: 24px; animation: sparkle-float 2.8s ease-in-out infinite 1.2s; }
.heart-1 { left: 12px; top: 112px; width: 32px; height: 32px; animation: heart-bob 3s ease-in-out infinite; }
.heart-2 { right: 12px; top: 112px; width: 32px; height: 32px; animation: heart-bob 2.6s ease-in-out infinite 1s; }
.bubble-1 { left: 18px; top: 208px; width: 26px; height: 26px; animation: bubble-drift 4s ease-in-out infinite; }
.bubble-3 { right: 18px; top: 208px; width: 26px; height: 26px; animation: bubble-drift 4.2s ease-in-out infinite 1.4s; }

@keyframes sparkle-float {
  0%, 100% { translate: 0 0; scale: 1; rotate: 0deg; opacity: 0.85; }
  50% { translate: 0 -6px; scale: 1.15; rotate: 12deg; opacity: 1; }
}

@keyframes heart-bob {
  0%, 100% { translate: 0 0; scale: 1; }
  50% { translate: 0 -8px; scale: 1.08; }
}

@keyframes bubble-drift {
  0%, 100% { translate: 0 0; opacity: 0.7; }
  50% { translate: 3px -7px; opacity: 1; }
}

/* ========================================================
   DASHBOARD CONSOLE: ROUNDED SQUARE FRAME (400x400 - PERSEGI)
   Pastel pink background with subtle dot grid pattern
   ======================================================== */
.dashboard-console {
  position: absolute;
  left: 0;
  top: 250px;
  width: 400px;
  height: 400px;
  z-index: 20;
  filter: drop-shadow(0px 10px 24px rgba(255, 120, 160, 0.28));
}

.console-shell-bg {
  position: absolute;
  inset: 0;
  width: 400px;
  height: 400px;
  z-index: 1;
  pointer-events: none;
}

.console-content {
  position: absolute;
  inset: 0;
  z-index: 5;
}

/* Top Row: Turn Indicators & Gear Badge */
.console-top-row {
  position: absolute;
  top: 14px;
  left: 18px;
  right: 18px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

/* Round Turn Indicator Buttons */
.round-indicator-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #ffcad7;
  box-shadow: 0 4px 10px rgba(255, 140, 170, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: all 0.2s ease;
}

.indicator-arrow {
  width: 18px;
  height: 18px;
  color: #b8869e;
  transition: color 0.15s ease, filter 0.15s ease;
}

.round-indicator-btn.active {
  background: #e6fbf2;
  border-color: #34d399;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.65);
  animation: indicator-flash 0.5s infinite;
}

.round-indicator-btn.active .indicator-arrow {
  color: #10b981;
  filter: drop-shadow(0 0 4px #34d399);
}

@keyframes indicator-flash {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.96); }
}

/* Gear Badge */
.gear-badge {
  height: 24px;
  padding: 0 14px;
  background: #ffe3ec;
  border: 1.5px solid #ffaec0;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  color: #ff3366;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(255, 120, 160, 0.15);
}

/* ========================================================
   CENTERED ROUND DIGITAL SPEEDOMETER GAUGE
   Width: 180px, Height: 180px, dead-center at X=110..290px
   ======================================================== */
.instrument-speed.centered-round-gauge {
  position: absolute;
  left: 110px;
  top: 48px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: #ffffff;
  border: 3.5px solid #ffbacd;
  box-shadow: 
    0 10px 26px rgba(255, 100, 150, 0.22),
    inset 0 3px 8px rgba(255, 180, 205, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
  z-index: 8;
}

/* Circular SVG Progress Dial */
.speed-dial-svg {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  pointer-events: none;
  transform: rotate(140deg);
}

.speed-arc-track {
  fill: none;
  stroke: #ffe4ee;
  stroke-width: 6.5;
  stroke-linecap: round;
  stroke-dasharray: 335.8 465;
}

.speed-arc-progress {
  fill: none;
  stroke: url(#speedArcGrad);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 335.8 465;
  stroke-dashoffset: 335.8;
  filter: drop-shadow(0 0 6px rgba(255, 77, 121, 0.6));
  transition: stroke-dashoffset 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.round-gauge-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  z-index: 2;
  margin-top: -2px;
}

/* Speed Display Box */
.speed-display-box {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
}

/* Clear Modern Digital Typography (Displays "0 MPH") */
.speed-digital-number {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 58px;
  line-height: 58px;
  font-weight: 700;
  color: #361927;
  letter-spacing: -1px;
  text-shadow: 0 2px 4px rgba(255, 140, 170, 0.25);
  display: block;
}

/* Speed Unit */
.speed-unit {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #ff4d79;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ========================================================
   MIDDLE DUAL METERS ROW: FUEL & HEALTH BARS
   ======================================================== */
.console-meters-row {
  position: absolute;
  top: 236px;
  left: 18px;
  right: 18px;
  height: 48px;
  display: flex;
  gap: 10px;
  z-index: 8;
}

.instrument-fuel,
.instrument-engine {
  flex: 1;
  height: 48px;
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid #ffaec0;
  border-radius: 14px;
  padding: 5px 10px;
  box-shadow: 0 4px 12px rgba(255, 140, 170, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.status-header {
  height: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.round-icon-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.round-icon-badge.fuel-badge {
  background: #ffe5ee;
  color: #ff4d79;
  border: 1.5px solid #ffaec0;
}

.round-icon-badge.health-badge {
  background: #e6fbf2;
  color: #10b981;
  border: 1.5px solid #a7f3d0;
}

.badge-svg {
  width: 13px;
  height: 13px;
}

.status-meta {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.status-label {
  font-size: 9px;
  font-weight: 800;
  color: #ff5b84;
  letter-spacing: 0.5px;
}

.instrument-engine .status-label {
  color: #10b981;
}

.status-value {
  font-size: 13px;
  font-weight: 800;
  color: #361927;
  line-height: 14px;
}

/* Minimalist Flat Meter Tracks */
.meter-track {
  position: relative;
  width: 100%;
  height: 8px;
  background: #ffeef3;
  border: 1.5px solid #ffcad7;
  border-radius: 4px;
  overflow: hidden;
}

.instrument-engine .meter-track {
  background: #e6fbf2;
  border-color: #a7f3d0;
}

.meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff8da7 0%, #ff3e6c 100%);
  box-shadow: 0 0 8px rgba(255, 77, 121, 0.4);
  transition: width 0.3s ease, background 0.3s ease;
}

.meter-fill.warning {
  background: linear-gradient(90deg, #f59e0b 0%, #ff3366 100%);
}

.meter-fill.engine {
  background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
}

.meter-fill.engine.warning {
  background: linear-gradient(90deg, #f59e0b 0%, #ffd166 100%);
}

.meter-fill.engine.danger {
  background: linear-gradient(90deg, #ff4d79 0%, #ff1a4b 100%);
}

.meter-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
}

.meter-tick {
  width: 1.5px;
  height: 6px;
  background: #ffffff;
  opacity: 0.85;
}

/* ========================================================
   SUB-ROW: RPM & ODOMETER
   ======================================================== */
.console-sub-row {
  position: absolute;
  top: 290px;
  left: 18px;
  right: 18px;
  height: 38px;
  display: flex;
  gap: 10px;
  z-index: 8;
}

.instrument-rpm {
  flex: 1;
  height: 38px;
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid #ffaec0;
  border-radius: 12px;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.rpm-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 12px;
}

.rpm-label {
  font-size: 9px;
  font-weight: 800;
  color: #ff5b84;
  letter-spacing: 0.5px;
}

.rpm-unit {
  font-size: 8px;
  font-weight: 700;
  color: #b8869e;
}

.rpm-bars-container {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 14px;
}

.rpm-bar {
  flex: 1;
  border-radius: 3px;
  background: #ffe2eb;
  border: 1px solid #ffcad7;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.rpm-bar[data-index="1"] { height: 6px; }
.rpm-bar[data-index="2"] { height: 8px; }
.rpm-bar[data-index="3"] { height: 10px; }
.rpm-bar[data-index="4"] { height: 12px; }
.rpm-bar[data-index="5"] { height: 13px; }
.rpm-bar[data-index="6"] { height: 14px; }

.rpm-bar.active {
  background: linear-gradient(180deg, #ffd166 0%, #ff5b84 100%);
  border-color: #ffd166;
  box-shadow: 0 0 6px rgba(255, 91, 132, 0.6);
}

.rpm-bar.redline.active {
  background: linear-gradient(180deg, #ff7597 0%, #ff1a4b 100%);
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 26, 75, 0.8);
}

.instrument-odometer {
  flex: 1;
  height: 38px;
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid #ffaec0;
  border-radius: 12px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.odometer-header-row {
  display: flex;
  align-items: center;
}

.odo-label {
  font-size: 9px;
  font-weight: 800;
  color: #ff5b84;
  letter-spacing: 0.5px;
}

.odo-display-pill {
  height: 20px;
  padding: 0 8px;
  background: #ffeef3;
  border: 1.5px solid #ffcad7;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #361927;
}

/* ========================================================
   BOTTOM CONTROL STRIP: 6 MODERN FLAT ROUND ICON BUTTONS
   ======================================================== */
.control-strip {
  position: absolute;
  top: 336px;
  left: 16px;
  right: 16px;
  height: 48px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 2px solid #ffbacd;
  border-radius: 24px;
  box-shadow: 
    0 8px 20px rgba(255, 120, 160, 0.18),
    inset 0 2px 4px #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding: 0 6px;
  z-index: 10;
}

.round-control-item {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #ffcad7;
  box-shadow: 0 3px 8px rgba(255, 140, 170, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.round-control-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(255, 120, 160, 0.28);
  border-color: #ffaec0;
}

.ctrl-svg {
  width: 18px;
  height: 18px;
  color: var(--icon-inactive);
  display: block;
  transition: color 0.18s ease, filter 0.18s ease;
}

.control-dot {
  position: absolute;
  bottom: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffd3e0;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

/* Engine Active */
.round-control-item#control-key.active {
  background: #e6fbf2;
  border-color: #34d399;
}
.round-control-item#control-key.active .ctrl-svg {
  color: #10b981;
  filter: drop-shadow(0 0 4px #34d399);
}
.round-control-item#control-key.active .control-dot {
  background: #10b981;
  box-shadow: 0 0 6px #34d399;
}

/* Seatbelts Active / Buckled */
.round-control-item#control-belt.active {
  background: #e6fbf2;
  border-color: #34d399;
}
.round-control-item#control-belt.active .ctrl-svg {
  color: #10b981;
  filter: drop-shadow(0 0 4px #34d399);
}
.round-control-item#control-belt.active .control-dot {
  background: #10b981;
  box-shadow: 0 0 6px #34d399;
}

/* Seatbelts Alert (Unbuckled Warning) */
.round-control-item#control-belt.alert {
  background: #ffe8ee;
  border-color: #ff3366;
  animation: belt-alert-pulse 0.9s infinite alternate ease-in-out;
}
.round-control-item#control-belt.alert .ctrl-svg {
  color: #ff1a4b;
}
.round-control-item#control-belt.alert .control-dot {
  background: #ff1a4b;
  box-shadow: 0 0 8px #ff1a4b;
}

@keyframes belt-alert-pulse {
  0% { transform: scale(1); box-shadow: 0 0 4px rgba(255, 26, 75, 0.4); }
  100% { transform: scale(1.08); box-shadow: 0 0 14px rgba(255, 26, 75, 0.85); }
}

/* Engine Check Active */
.round-control-item#control-engine.active {
  background: #e6fbf2;
  border-color: #34d399;
}
.round-control-item#control-engine.active .ctrl-svg {
  color: #10b981;
  filter: drop-shadow(0 0 4px #34d399);
}
.round-control-item#control-engine.active .control-dot {
  background: #10b981;
  box-shadow: 0 0 6px #34d399;
}

/* Headlights Normal */
.round-control-item#control-light.active {
  background: #fef9c3;
  border-color: #facc15;
}
.round-control-item#control-light.active .ctrl-svg {
  color: #ca8a04;
  filter: drop-shadow(0 0 4px #facc15);
}
.round-control-item#control-light.active .control-dot {
  background: #ca8a04;
  box-shadow: 0 0 6px #facc15;
}

/* Headlights High Beam */
.round-control-item#control-light.highbeam {
  background: #e0f2fe;
  border-color: #38bdf8;
}
.round-control-item#control-light.highbeam .ctrl-svg {
  color: #0284c7;
  filter: drop-shadow(0 0 4px #38bdf8);
}
.round-control-item#control-light.highbeam .control-dot {
  background: #0284c7;
  box-shadow: 0 0 6px #38bdf8;
}

/* Music Control Button */
.round-control-item#control-music .ctrl-svg {
  color: #ff4d79;
}
.round-control-item#control-music:hover {
  background: #ffe8f0;
}

/* Tenka Crest Round Button (Settings / Move & Resize) */
.tenka-crest-button,
.paw-button-wrap {
  cursor: pointer;
}
.tenka-crest-img,
.paw-button-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tenka-crest-button:hover .tenka-crest-img,
.paw-button-wrap:hover .paw-button-img {
  transform: rotate(24deg) scale(1.18);
}

/* ========================================================
   SPEEDOMETER MOVE & RESIZE QUICK TOOLS & CONTROLLER
   Kawaii Pastel Pink & White Aesthetic
   ======================================================== */
.speedo-quick-tools {
  position: absolute;
  top: 214px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 40;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.speedo-tool-pill {
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  border: 1.5px solid #ffaec0;
  background: rgba(255, 255, 255, 0.95);
  color: #ff4d79;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(255, 140, 170, 0.25);
  backdrop-filter: blur(6px);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.speedo-tool-pill:hover {
  background: #ffeef3;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 12px rgba(255, 120, 160, 0.35);
}

.speedo-tool-pill.move-handle {
  cursor: grab;
}

.speedo-tool-pill.move-handle:active {
  cursor: grabbing;
}

.speedo-tool-pill.lock-toggle.active {
  background: #fff0f4;
  border-color: #ff7597;
  color: #ff2a5e;
}

.speedo-tool-pill.resize-toggle.active {
  background: #ffe3ec;
  border-color: #ff4d79;
  color: #ff3366;
}

/* Corner Resize Handles */
.speedo-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2.5px solid #ff4d79;
  background: #ffffff;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.15s ease;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(255, 77, 121, 0.35);
}

.dashboard-console:hover .speedo-resize-handle,
.speedometer-stage.edit-mode .speedo-resize-handle {
  opacity: 0.85;
  pointer-events: auto;
}

.speedo-resize-handle:hover {
  opacity: 1 !important;
  transform: scale(1.2);
  background: #ffeef3;
}

.speedo-resize-handle.nw { top: 4px; left: 4px; cursor: nwse-resize; }
.speedo-resize-handle.ne { top: 4px; right: 4px; cursor: nesw-resize; }
.speedo-resize-handle.sw { bottom: 4px; left: 4px; cursor: nesw-resize; }
.speedo-resize-handle.se { bottom: 4px; right: 4px; cursor: nwse-resize; }

.speedometer-stage.locked .speedo-resize-handle {
  display: none !important;
  pointer-events: none !important;
}

/* ========================================================
   SPEEDOMETER MOVE & RESIZE CONTROL BAR (DOCK)
   Docked cleanly at bottom of square speedometer console
   ======================================================== */
.speedo-transform-bar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  top: 658px;
  height: 44px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border: 2px solid #ffaec0;
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(255, 120, 160, 0.28);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.speedo-transform-bar.open,
.speedometer-stage.edit-mode .speedo-transform-bar {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.transform-drag-zone {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: grab;
  color: #ff4d79;
  font-size: 11px;
  font-weight: 800;
  user-select: none;
}

.transform-drag-zone:active {
  cursor: grabbing;
}

.transform-grip-icon {
  font-size: 14px;
}

.transform-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #a06e84;
}

.transform-pos-presets {
  display: flex;
  align-items: center;
  gap: 4px;
}

.speedo-pos-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  border: 1.5px solid #ffcad7;
  background: #ffffff;
  color: #ff4d79;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.speedo-pos-btn:hover {
  background: #fff0f5;
  border-color: #ff7597;
  transform: translateY(-1px);
}

.speedo-pos-btn.active {
  background: #ff4d79;
  color: #ffffff;
  border-color: #ff2a5e;
  box-shadow: 0 2px 8px rgba(255, 77, 121, 0.35);
}

.transform-divider {
  width: 1px;
  height: 22px;
  background: #ffd0dc;
}

.transform-resize-zone {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speedo-step-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #ffcad7;
  background: #ffffff;
  color: #ff4d79;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.speedo-step-btn:hover {
  background: #ff4d79;
  color: #ffffff;
  border-color: #ff2a5e;
  transform: scale(1.1);
}

.speedo-scale-slider {
  width: 80px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #ffe0e9;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.speedo-scale-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ff4d79;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(255, 77, 121, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.speedo-scale-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.speedo-scale-badge {
  font-size: 11px;
  font-weight: 800;
  color: #ff3366;
  min-width: 32px;
  text-align: center;
}

.speedo-lock-btn-bar,
.speedo-reset-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  border: 1.5px solid #ffcad7;
  background: #ffffff;
  color: #a06e84;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.speedo-lock-btn-bar:hover,
.speedo-reset-btn:hover {
  background: #fff0f5;
  color: #ff3366;
  border-color: #ff7597;
  transform: translateY(-1px);
}

.speedo-lock-btn-bar.active {
  background: #ffe3ec;
  color: #ff2a5e;
  border-color: #ff4d79;
}

/* Dragging & Resizing States */
.speedometer-stage.dragging {
  cursor: grabbing !important;
}

.speedometer-stage.dragging * {
  cursor: grabbing !important;
}

.speedometer-stage.resizing {
  user-select: none;
}

/* Speedometer Stage Locked State */
.speedometer-stage.locked .dashboard-console,
.speedometer-stage.locked .character-area {
  cursor: default;
}

/* ========================================================
   YOUTUBE MUSIC PLAYER POPUP (KAWAII PASTEL THEME)
   ======================================================== */
.music-popup-window {
  position: fixed;
  right: 24px;
  bottom: 480px;
  width: var(--music-popup-width, 380px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 2.5px solid #ffaec0;
  border-radius: 20px;
  box-shadow: 0 12px 36px rgba(255, 120, 160, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100000;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.music-popup-window.closed {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}

.music-popup-header {
  height: 38px;
  background: linear-gradient(90deg, #ff7597 0%, #ff4d79 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  cursor: grab;
}

.music-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
}

.music-action-btn {
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.music-action-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.music-search-section {
  padding: 10px 12px;
  background: #fff5f8;
  border-bottom: 1.5px solid #ffcad7;
}

.music-search-form {
  display: flex;
  gap: 6px;
}

.music-search-input {
  flex: 1;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  border: 1.5px solid #ffaec0;
  background: #ffffff;
  color: #361927;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

.music-search-input:focus {
  border-color: #ff4d79;
  box-shadow: 0 0 6px rgba(255, 77, 121, 0.35);
}

.music-play-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  border: none;
  background: #ff4d79;
  color: #ffffff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.music-play-btn:hover {
  background: #e63966;
}

.music-results-container {
  max-height: 220px;
  overflow-y: auto;
  background: #ffffff;
  border-bottom: 1.5px solid #ffcad7;
}

.music-results-container.hidden {
  display: none;
}

.music-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #ffeef3;
  font-size: 11px;
  font-weight: 800;
  color: #ff5b84;
}

.results-close-btn {
  background: none;
  border: none;
  color: #ff5b84;
  cursor: pointer;
  font-size: 12px;
}

.music-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid #fff0f5;
  transition: background 0.15s ease;
}

.music-result-item:hover {
  background: #fff0f5;
}

.music-result-thumb {
  width: 52px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
}

.music-result-info {
  flex: 1;
  overflow: hidden;
}

.music-result-title {
  font-size: 12px;
  font-weight: 700;
  color: #361927;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-result-meta {
  font-size: 10px;
  color: #8e5871;
}

.music-now-playing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #ffeef3;
  border-bottom: 1px solid #ffd3e0;
}

.music-now-playing.hidden {
  display: none;
}

.now-playing-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.now-playing-text {
  font-size: 11px;
  font-weight: 700;
  color: #ff4d79;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.change-video-btn {
  font-size: 10px;
  font-weight: 800;
  color: #ff4d79;
  background: #ffffff;
  border: 1px solid #ffaec0;
  border-radius: 10px;
  padding: 2px 8px;
  cursor: pointer;
}

.music-player-view {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #fff0f5;
}

.music-player-view iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.music-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: #8e5871;
  font-size: 12px;
  background: #fff5f8;
}

.music-placeholder.hidden {
  display: none;
}

.placeholder-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.music-customization-bar {
  padding: 8px 12px;
  background: #fff5f8;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1.5px solid #ffcad7;
}

.adjust-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #8e5871;
}

.music-slider {
  width: 100%;
  accent-color: #ff4d79;
}

.music-layout-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.adjust-label {
  font-size: 10px;
  font-weight: 800;
  color: #ff5b84;
}

.music-preset-btns {
  display: flex;
  gap: 4px;
}

.music-pos-btn {
  font-size: 10px;
  font-weight: 700;
  color: #8e5871;
  background: #ffffff;
  border: 1px solid #ffcad7;
  border-radius: 10px;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.music-pos-btn:hover {
  background: #ffeef3;
  color: #ff4d79;
}
