/* YTA v122 Complete Mobile Compositor, Sensitivity, HUD Editor, Driving Mode & Trainer CSS */

@media (max-width: 980px), (hover: none) and (pointer: coarse) {
  html.pav-mobile *,
  html.pav-mobile *::before,
  html.pav-mobile *::after,
  body * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .pav-embers,
  .pav-bg-particles,
  .pav-noise,
  .pav-ambient-glow,
  .gta-bg-glow {
    display: none !important;
    animation: none !important;
  }

  html.pav-mobile .pav-card,
  html.pav-mobile .pav-modal,
  html.pav-mobile .pav-panel,
  html.pav-mobile .pav-hud-box,
  html.pav-mobile [class*="glass"] {
    background-color: rgba(12, 11, 20, 0.94) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55) !important;
  }

  html.pav-mobile #canvas,
  body.yta-is-mobile #canvas {
    image-rendering: optimizeSpeed;
    touch-action: none;
    contain: strict;
  }

  html.pav-mobile #hint,
  body.yta-is-mobile #hint {
    display: none !important;
  }
}

/* Top Performance + Settings + Trainer + Fullscreen Pill */
#yta-mobile-perf-pill {
  position: fixed;
  top: max(5px, env(safe-area-inset-top, 5px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483000;
  display: none;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(10, 10, 16, 0.92);
  border: 1px solid rgba(255, 130, 195, 0.35);
  color: #f6edf8;
  font: 600 10px/1.2 system-ui, -apple-system, sans-serif;
  max-width: 96vw;
  overflow-x: auto;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  contain: layout style paint;
}

html.pav-mobile #yta-mobile-perf-pill,
body.yta-is-mobile #yta-mobile-perf-pill {
  display: inline-flex;
}

#yta-mobile-perf-pill button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 3px 6px;
  background: transparent;
  color: rgba(246, 237, 248, 0.74);
  font: 700 9.5px/1 system-ui, -apple-system, sans-serif;
  cursor: pointer;
}

#yta-mobile-perf-pill button.active {
  background: linear-gradient(90deg, #ff5ca8, #ffb347);
  color: #140b18 !important;
}

#yta-mobile-perf-pill button.yta-sens-toggle,
#yta-mobile-perf-pill button.yta-trainer-toggle,
#yta-mobile-perf-pill button.yta-skip-toggle,
#yta-mobile-perf-pill button.yta-fs-toggle,
#yta-mobile-perf-pill button.yta-pad-toggle {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  padding-left: 6px;
}

#yta-mobile-perf-pill button.yta-sens-toggle { color: #ffd479; }
#yta-mobile-perf-pill button.yta-trainer-toggle { color: #ff8ae2; }
#yta-mobile-perf-pill button.yta-skip-toggle { color: #ffb347; }
#yta-mobile-perf-pill button.yta-fs-toggle { color: #b8ffda; }
#yta-mobile-perf-pill button.yta-pad-toggle { color: #8ce0ff; border-radius: 0 999px 999px 0; }

#yta-mobile-perf-fps {
  color: #7ef7b8;
  font-variant-numeric: tabular-nums;
  padding-right: 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

/* Toast Notification */
#yta-mobile-toast {
  position: fixed;
  top: calc(max(6px, env(safe-area-inset-top, 6px)) + 34px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 2147483005;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(14, 18, 28, 0.95);
  border: 1px solid rgba(126, 247, 184, 0.55);
  color: #dfffe9;
  font: 700 11px/1.2 system-ui, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#yta-mobile-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* HUD Drag-Edit Mode Banner */
#yta-hud-edit-banner {
  position: fixed;
  top: calc(max(6px, env(safe-area-inset-top, 6px)) + 32px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483004;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(24, 16, 8, 0.96);
  border: 1.5px solid #ffb347;
  color: #ffe2b0;
  font: 700 11px/1.1 system-ui, sans-serif;
}

#yta-hud-edit-banner.show { display: inline-flex; }

#yta-hud-edit-banner button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 700 10.5px/1 system-ui, sans-serif;
}

#yta-hud-edit-banner button.primary {
  background: #2ed573;
  border-color: #9fffe0;
  color: #072112;
}

/* Sensitivity & Layout Panel + Trainer Panel */
#yta-sens-panel,
#yta-trainer-panel {
  position: fixed;
  top: calc(max(6px, env(safe-area-inset-top, 6px)) + 30px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483002;
  width: min(330px, 94vw);
  max-height: calc(100dvh - 46px);
  overflow-y: auto;
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(12, 12, 22, 0.96);
  border: 1px solid rgba(255, 160, 210, 0.44);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.74);
  color: #f6edf8;
  font: 600 11px/1.25 system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

#yta-trainer-panel {
  width: min(390px, 95vw);
}

#yta-sens-panel.open,
#yta-trainer-panel.open {
  display: flex;
}

.yta-sp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.yta-sp-head b {
  font-size: 11.5px;
  color: #ffd479;
}

.yta-sp-close,
.yta-tr-close {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #f6edf8;
  border-radius: 8px;
  width: 24px;
  height: 24px;
  font-weight: 700;
  cursor: pointer;
}

.yta-sp-row { display: flex; flex-direction: column; gap: 3px; }
.yta-sp-lbl { display: flex; justify-content: space-between; font-size: 10.5px; color: rgba(246, 237, 248, 0.88); }
.yta-sp-lbl strong { color: #7ef7b8; font-variant-numeric: tabular-nums; }
.yta-sp-ctrl { display: flex; align-items: center; gap: 6px; }
.yta-sp-ctrl button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #f6edf8;
  border-radius: 8px;
  width: 26px;
  height: 26px;
  font: 700 14px/1 system-ui, sans-serif;
}

#yta-sens-panel input[type="range"] {
  flex: 1;
  accent-color: #ff6eb4;
  height: 20px;
  margin: 0;
}

.yta-sp-foot { display: flex; gap: 6px; flex-wrap: wrap; }
.yta-sp-mode,
.yta-sp-layout,
.yta-sp-fs,
.yta-sp-reset {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #f6edf8;
  font: 700 10px/1.15 system-ui, sans-serif;
}

.yta-sp-mode { flex: 1; }
.yta-sp-mode.on { background: rgba(62, 224, 143, 0.25); border-color: rgba(110, 247, 178, 0.72); color: #9fffe0; }
.yta-sp-layout { flex: 1; background: rgba(255, 179, 71, 0.2); border-color: rgba(255, 179, 71, 0.55); color: #ffe0a3; }
.yta-sp-fs { background: rgba(100, 210, 255, 0.16); color: #b8efff; }
.yta-sp-reset { background: rgba(255, 92, 168, 0.18); color: #ffc2df; }

/* Trainer Tabs & Grid */
.yta-tr-tabs { display: flex; gap: 5px; }
.yta-tr-tabs button {
  flex: 1;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  padding: 5px 6px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(246, 237, 248, 0.8);
  font: 700 10px/1.1 system-ui, sans-serif;
}
.yta-tr-tabs button.active {
  background: linear-gradient(90deg, #ff5ca8, #ffb347);
  border-color: transparent;
  color: #140b18;
}

.yta-tr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.yta-tr-grid button {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f6edf8;
  font: 700 10px/1.15 system-ui, sans-serif;
  text-align: left;
}
.yta-tr-grid button:active { background: rgba(255, 130, 195, 0.45); }
.yta-tr-grid button small { font-size: 8.5px; color: #8ce0ff; opacity: 0.82; letter-spacing: 0.04em; }

.yta-tr-custom { display: flex; gap: 6px; padding-top: 2px; }
.yta-tr-custom input {
  flex: 1;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  padding: 5px 8px;
  font: 600 11px/1.2 system-ui, sans-serif;
}
.yta-tr-custom button {
  appearance: none;
  border: 0;
  border-radius: 9px;
  padding: 5px 11px;
  background: #2ed573;
  color: #062011;
  font: 700 10.5px/1 system-ui, sans-serif;
}
.yta-tr-hint { font-size: 9.5px; color: rgba(246, 237, 248, 0.6); }

/* Story Mode Mobile Touch Controller (#yta119-story-touch) */
#yta119-story-touch {
  position: fixed;
  inset: 0;
  z-index: 2147482500;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#yta119-story-touch.yta-hidden { display: none !important; }

/* On-Foot vs Driving Visibility */
#yta119-story-touch .yta-drive-only { display: none !important; }
#yta119-story-touch.yta-driving .yta-foot-only { display: none !important; }
#yta119-story-touch.yta-driving .yta-drive-only { display: flex !important; }

/* HUD Drag-Edit Highlighting */
#yta119-story-touch.yta-editing [data-hud-group],
.pav-touch.yta-editing [data-hud-group] {
  outline: 2px dashed #ffb347 !important;
  outline-offset: 4px;
  background-color: rgba(255, 179, 71, 0.14);
  border-radius: 14px;
  cursor: move;
}

#yta119-story-touch .yta-st-top {
  position: absolute;
  top: calc(max(6px, env(safe-area-inset-top, 6px)) + 28px);
  right: max(10px, env(safe-area-inset-right, 10px));
  display: flex;
  gap: 5px;
  pointer-events: auto;
  transform-origin: top right;
}

#yta119-story-touch .yta-st-zoombar {
  position: absolute;
  right: max(14px, env(safe-area-inset-right, 14px));
  bottom: calc(max(16px, env(safe-area-inset-bottom, 16px)) + 104px);
  display: flex;
  gap: 6px;
  pointer-events: auto;
  transform-origin: bottom right;
}

#yta119-story-touch .yta-st-zoombar button {
  min-height: 33px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10px;
  background: rgba(16, 22, 36, 0.66);
}

#yta119-story-touch .yta-st-zoombar button.yta-wep-wheel {
  background: rgba(142, 92, 255, 0.55);
  border-color: rgba(190, 160, 255, 0.6);
}

#yta119-story-touch .yta-st-stick {
  position: absolute;
  left: max(20px, env(safe-area-inset-left, 20px));
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(14, 14, 24, 0.42);
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  pointer-events: auto;
  touch-action: none;
  transform-origin: bottom left;
}

#yta119-story-touch .yta-st-stick i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(255, 140, 198, 0.72);
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  pointer-events: none;
}

/* Driving Mode Left Steering */
#yta119-story-touch .yta-st-steer {
  position: absolute;
  left: max(18px, env(safe-area-inset-left, 18px));
  bottom: max(22px, env(safe-area-inset-bottom, 22px));
  gap: 10px;
  pointer-events: auto;
  transform-origin: bottom left;
}

#yta119-story-touch .yta-steer-btn {
  width: 68px;
  height: 64px;
  border-radius: 16px;
  font-size: 12px !important;
  background: rgba(14, 20, 32, 0.68);
  border: 1.5px solid rgba(140, 224, 255, 0.45);
}

/* On-Foot Right Actions */
#yta119-story-touch .yta-st-actions {
  position: absolute;
  right: max(14px, env(safe-area-inset-right, 14px));
  bottom: max(14px, env(safe-area-inset-bottom, 14px));
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 7px;
  pointer-events: auto;
  transform-origin: bottom right;
}

/* Driving Mode Right Pedals & Aux */
#yta119-story-touch .yta-st-pedals {
  position: absolute;
  right: max(14px, env(safe-area-inset-right, 14px));
  bottom: max(14px, env(safe-area-inset-bottom, 14px));
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  pointer-events: auto;
  transform-origin: bottom right;
}

#yta119-story-touch .yta-veh-aux {
  display: flex;
  gap: 5px;
}

#yta119-story-touch .yta-veh-aux button {
  min-height: 31px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9.5px;
}

#yta119-story-touch .yta-veh-main {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#yta119-story-touch button.yta-hbrake {
  height: 50px;
  padding: 4px 9px;
  background: rgba(255, 179, 71, 0.52);
  border-color: rgba(255, 210, 130, 0.6);
}

#yta119-story-touch button.yta-brake {
  width: 66px;
  height: 60px;
  background: rgba(255, 71, 87, 0.62);
  border-color: rgba(255, 150, 160, 0.65);
}

#yta119-story-touch button.yta-gas {
  width: 68px;
  height: 78px;
  background: rgba(46, 213, 115, 0.66);
  border-color: rgba(140, 255, 190, 0.7);
  font-size: 12px;
}

#yta119-story-touch button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  background: rgba(12, 12, 22, 0.58);
  color: #f6edf8;
  font: 700 10.5px/1.1 system-ui, -apple-system, sans-serif;
  min-height: 42px;
  padding: 4px 5px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#yta119-story-touch .yta-st-top button {
  min-height: 29px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9.5px;
}

#yta119-story-touch button.yta-skip-btn {
  background: rgba(255, 179, 71, 0.56);
  border-color: rgba(255, 218, 140, 0.72);
  color: #fff6e0;
}

#yta119-story-touch button.yta-drive-switch {
  background: rgba(64, 156, 255, 0.48);
  border-color: rgba(140, 210, 255, 0.65);
}

#yta119-story-touch button.yta-drive-switch.yta-drive-active {
  background: rgba(46, 213, 115, 0.82);
  color: #072012;
}

#yta119-story-touch button.yta-fire {
  background: rgba(255, 76, 125, 0.62);
  border-color: rgba(255, 150, 185, 0.6);
}

#yta119-story-touch button.yta-aim {
  background: rgba(255, 179, 71, 0.5);
  border-color: rgba(255, 210, 130, 0.55);
}

#yta119-story-touch button.yta-aim.yta-aim-locked,
.pav-touch button.pav-aim-locked {
  background: rgba(46, 213, 115, 0.88) !important;
  border-color: #b8ffda !important;
  color: #091d12 !important;
  box-shadow: 0 0 0 2px rgba(126, 247, 184, 0.55) !important;
}

#yta119-story-touch button:active,
#yta119-story-touch button.yta-pressed {
  background: rgba(255, 130, 195, 0.85);
  color: #140b18;
}
