.live-monitor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 140;
  opacity: 0.98;
}

.live-monitor.editor-mode {
  width: 100vw;
  height: 100vh;
  z-index: 148;
}

.live-monitor-panel {
  position: fixed;
  pointer-events: none;
}

.live-monitor-wheel-panel {
  width: 380px;
  min-width: 380px;
}

.live-monitor.editor-mode .live-monitor-panel {
  pointer-events: auto;
  cursor: grab;
}

.live-monitor.editor-mode .live-monitor-panel:active {
  cursor: grabbing;
}

.live-monitor-aux {
  display: block;
  padding: 14px 16px 16px;
  border-radius: 18px;
  background: rgba(13, 18, 26, 0.96);
  border: 1px solid rgba(103, 180, 255, 0.24);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.live-monitor-panel.hidden,
.live-monitor-editor.hidden,
.live-monitor-debug.hidden {
  display: none;
}

.live-monitor-frame {
  position: relative;
}

.live-monitor-panel-head {
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #f4f8ff;
  letter-spacing: 0.06em;
}

.live-monitor-gear-panel {
  width: 260px;
}

.gear-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 18px;
  padding: 10px 4px 0;
}

.gear-cell {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  border-radius: 22px;
  background: #0d1117;
  border: 2px solid rgba(255, 234, 163, 0.18);
  color: #fbfcff;
  font-size: 42px;
  font-weight: 800;
  box-shadow: inset 0 -10px 18px rgba(255, 255, 255, 0.04);
  transition: transform 110ms ease, box-shadow 110ms ease, border-color 110ms ease, background 110ms ease;
}

.gear-cell.inert {
  opacity: 0.56;
}

.gear-cell.active {
  transform: scale(1.04);
  border-color: rgba(255, 255, 114, 0.9);
  background: linear-gradient(180deg, rgba(255, 240, 92, 0.34), rgba(255, 240, 92, 0.18));
  box-shadow:
    inset 0 0 16px rgba(255, 250, 201, 0.22),
    0 0 24px rgba(255, 238, 89, 0.36);
}

.live-monitor-pedal-panel {
  width: 300px;
}

.pedal-rack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-top: 6px;
}

.pedal-card {
  --pedal-press: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pedal-plate {
  width: 74px;
  height: 154px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 18px 18px, rgba(12, 12, 12, 0.96) 0 5px, transparent 6px) 0 0 / 36px 36px,
    linear-gradient(180deg, #f6f8fb 0%, #adb6c2 48%, #697281 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.45),
    0 10px 24px rgba(0, 0, 0, 0.34);
  transform-origin: 50% 100%;
  transform:
    perspective(320px)
    rotateX(calc(var(--pedal-press) * 18deg))
    translateY(calc(var(--pedal-press) * 14px))
    scale(calc(1 - var(--pedal-press) * 0.04));
  filter:
    brightness(calc(1 + var(--pedal-press) * 0.46))
    drop-shadow(0 0 calc(var(--pedal-press) * 24px) rgba(255, 228, 111, 0.56));
  transition: transform 90ms ease, filter 90ms ease, box-shadow 90ms ease;
}

.pedal-label {
  color: #edf4ff;
  font-size: 14px;
  font-weight: 700;
}

.pedal-card.pedal-active .pedal-label,
.pedal-card.active .pedal-label {
  color: #fff7ad;
  text-shadow: 0 0 12px rgba(255, 234, 132, 0.34);
}

.pedal-card.pedal-active .pedal-plate,
.pedal-card.active .pedal-plate {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.52),
    0 10px 24px rgba(0, 0, 0, 0.34),
    0 0 28px rgba(255, 222, 89, 0.26);
}

.live-monitor-debug {
  position: fixed;
  right: 18px;
  top: 18px;
  left: auto;
  transform: none;
  z-index: 149;
  pointer-events: none;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 15, 21, 0.9);
  border: 1px solid rgba(127, 214, 255, 0.28);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
  color: #dff4ff;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.live-monitor-debug.hidden {
  display: none;
}

.live-monitor-wheel {
  position: relative;
  width: 100%;
  aspect-ratio: var(--monitor-aspect, 4576 / 3680);
  --monitor-pulse-scale: 1.1;
  --steering-angle: 0deg;
  transform: rotate(var(--steering-angle));
  transform-origin: 50% 50%;
  transition: transform 32ms linear;
  will-change: transform;
}

.live-monitor-wheel::before {
  content: '';
  position: absolute;
  inset: 11% 11% 7%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(49, 83, 132, 0.18), rgba(49, 83, 132, 0.05) 45%, transparent 72%);
  filter: blur(16px);
  z-index: 0;
}

.live-monitor-wheel img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.44));
}

.live-monitor.disconnected {
  opacity: 0.5;
}

.monitor-hotspot {
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  opacity: 0;
  border: 1px solid transparent;
  background: transparent;
  transition:
    opacity 90ms ease,
    transform 110ms ease,
    box-shadow 110ms ease,
    background-color 110ms ease,
    border-color 110ms ease;
  --accent-rgb: 66, 166, 255;
  --fill-alpha: 0.28;
  --line-alpha: 0.84;
  --inner-alpha: 0.46;
  --outer-alpha: 0.48;
  --far-alpha: 0.26;
  --near-blur: 20px;
  --far-blur: 34px;
}

.monitor-hotspot.active {
  opacity: 1;
  background: rgba(var(--accent-rgb), var(--fill-alpha));
  border-color: rgba(var(--accent-rgb), var(--line-alpha));
}

.live-monitor-wheel[data-effect='bloom'] .monitor-hotspot.active {
  box-shadow:
    inset 0 0 12px rgba(var(--accent-rgb), var(--inner-alpha)),
    0 0 var(--near-blur) rgba(var(--accent-rgb), var(--outer-alpha)),
    0 0 var(--far-blur) rgba(var(--accent-rgb), var(--far-alpha));
}

.live-monitor-wheel[data-effect='solid'] .monitor-hotspot.active {
  box-shadow:
    inset 0 0 0 999px rgba(var(--accent-rgb), calc(var(--fill-alpha) * 0.78)),
    0 0 var(--near-blur) rgba(var(--accent-rgb), var(--outer-alpha));
}

.live-monitor-wheel[data-effect='outline'] .monitor-hotspot.active {
  background: rgba(var(--accent-rgb), calc(var(--fill-alpha) * 0.35));
  box-shadow:
    0 0 0 2px rgba(var(--accent-rgb), var(--line-alpha)),
    0 0 var(--far-blur) rgba(var(--accent-rgb), var(--outer-alpha));
}

.live-monitor-wheel[data-effect='laser'] .monitor-hotspot.active {
  background: rgba(var(--accent-rgb), calc(var(--fill-alpha) * 0.2));
  box-shadow:
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.95),
    inset 0 0 18px rgba(var(--accent-rgb), calc(var(--inner-alpha) + 0.12)),
    0 0 0 2px rgba(var(--accent-rgb), calc(var(--line-alpha) * 0.92)),
    0 0 calc(var(--near-blur) * 1.2) rgba(var(--accent-rgb), calc(var(--outer-alpha) + 0.08));
}

.live-monitor-wheel[data-effect='warning'] .monitor-hotspot.active {
  animation: live-monitor-warning 0.48s steps(2, end) infinite;
  box-shadow:
    inset 0 0 12px rgba(var(--accent-rgb), calc(var(--inner-alpha) + 0.1)),
    0 0 calc(var(--near-blur) * 1.05) rgba(var(--accent-rgb), calc(var(--outer-alpha) + 0.08)),
    0 0 calc(var(--far-blur) * 1.15) rgba(var(--accent-rgb), calc(var(--far-alpha) + 0.1));
}

.monitor-hotspot.editing {
  opacity: 0.92;
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed rgba(255, 255, 255, 0.86);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28), 0 0 14px rgba(255, 255, 255, 0.16);
}

.monitor-hotspot.face,
.monitor-hotspot.ps-key,
.monitor-hotspot.dpad-vert,
.monitor-hotspot.dpad-hori,
.monitor-hotspot.paddle-left,
.monitor-hotspot.paddle-right,
.monitor-hotspot.plus-top,
.monitor-hotspot.knob-left,
.monitor-hotspot.knob-right {
  border-radius: 999px;
  overflow: visible;
}

.monitor-hotspot.blue-cap {
  border-radius: 14% 14% 18% 18% / 18% 18% 28% 28%;
  clip-path: polygon(10% 6%, 90% 6%, 100% 78%, 82% 100%, 18% 100%, 0 78%);
}

.monitor-hotspot.blue-cap-wide {
  border-radius: 14% 14% 18% 18% / 18% 18% 28% 28%;
  clip-path: polygon(8% 8%, 92% 8%, 100% 74%, 78% 100%, 22% 100%, 0 74%);
}

.monitor-hotspot.paddle-left {
  transform: translate(-50%, -50%) rotate(17deg);
}

.monitor-hotspot.paddle-right {
  transform: translate(-50%, -50%) rotate(-17deg);
}

.monitor-hotspot.plus-top {
  border-radius: 999px 999px 34px 34px / 999px 999px 26px 26px;
  clip-path: inset(0 0 48% 0 round 999px 999px 18px 18px);
}

.monitor-hotspot.center-key {
  border-radius: 8px;
}

.monitor-hotspot.knob-left,
.monitor-hotspot.knob-right {
  clip-path: none;
}

.monitor-hotspot.knob-left::before,
.monitor-hotspot.knob-right::before {
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: 0;
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  color: rgba(var(--accent-rgb), 0.98);
  text-shadow:
    0 0 10px rgba(var(--accent-rgb), 0.6),
    0 0 20px rgba(var(--accent-rgb), 0.32);
  transform: translate(-50%, -50%) rotate(0deg) scale(0.96);
  transform-origin: 50% 50%;
  transition: none;
}

.monitor-hotspot.knob-left::before {
  content: '\21BA';
}

.monitor-hotspot.knob-right::before {
  content: '\21BB';
}

.monitor-hotspot.face.active,
.monitor-hotspot.ps-key.active,
.monitor-hotspot.dpad-vert.active,
.monitor-hotspot.dpad-hori.active,
.monitor-hotspot.center-key.active,
.monitor-hotspot.blue-cap.active,
.monitor-hotspot.blue-cap-wide.active,
.monitor-hotspot.plus-top.active {
  transform: translate(-50%, -50%) scale(var(--monitor-pulse-scale, 1.1));
}

.monitor-hotspot.knob-left.active,
.monitor-hotspot.knob-right.active {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%) scale(var(--monitor-pulse-scale, 1.08));
}

.monitor-hotspot.knob-left.active::before,
.monitor-hotspot.knob-right.active::before {
  opacity: 1;
}

.monitor-hotspot.knob-left.rotary-animating::before {
  animation: live-monitor-rotary-ccw 1s ease-out forwards;
}

.monitor-hotspot.knob-right.rotary-animating::before {
  animation: live-monitor-rotary-cw 1s ease-out forwards;
}

.monitor-hotspot.paddle-left.active {
  transform: translate(-50%, -50%) rotate(17deg) scale(calc(1 + (var(--monitor-pulse-scale, 1.1) - 1) * 0.72));
}

.monitor-hotspot.paddle-right.active {
  transform: translate(-50%, -50%) rotate(-17deg) scale(calc(1 + (var(--monitor-pulse-scale, 1.1) - 1) * 0.72));
}

.live-monitor-editor {
  position: fixed;
  left: 12px;
  top: 12px;
  bottom: auto;
  width: 340px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: rgba(17, 22, 29, 0.94);
  border: 1px solid rgba(83, 152, 232, 0.24);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  z-index: 150;
  pointer-events: auto;
}

.live-monitor-editor.hidden {
  display: none;
}

.live-monitor-editor-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.live-monitor-editor-head strong {
  font-size: 14px;
  color: #fff;
}

.live-monitor-editor-head span {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}

.live-monitor-editor-section {
  margin: 12px 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.live-monitor-editor-row {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.live-monitor-editor-row-select {
  grid-template-columns: 72px 1fr;
}

.live-monitor-editor-row label {
  color: var(--text-dim);
  font-size: 12px;
}

.live-monitor-editor-select,
.live-monitor-editor-number,
.live-monitor-editor-color {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
}

.live-monitor-editor-color {
  min-height: 34px;
  padding: 4px;
}

.live-monitor-editor-range {
  width: 100%;
}

.live-monitor-editor-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
}

.live-monitor-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

@keyframes live-monitor-warning {
  0% {
    opacity: 1;
    filter: brightness(1);
  }
  50% {
    opacity: 0.68;
    filter: brightness(1.35);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
  }
}

@keyframes live-monitor-rotary-ccw {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) rotate(-90deg) scale(1);
    opacity: 1;
  }
}

@keyframes live-monitor-rotary-cw {
  0% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) rotate(90deg) scale(1);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .live-monitor-wheel-panel {
    width: 300px;
    min-width: 300px;
  }

  .live-monitor-editor {
    left: 8px;
    top: 8px;
    bottom: auto;
    width: min(92vw, 340px);
  }
}
