/* AR try-on — кнопка в окне 3D-модуля + inline AR */

.ar-tryon-host {
  position: relative;
}

.viewer-shell {
  position: relative;
}

.ar-tryon-btn {
  position: absolute;
  left: 50%;
  bottom: 58px;
  transform: translateX(-50%);
  z-index: 20;
  min-width: 72px;
  height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid rgba(224, 122, 40, 0.75);
  background: rgba(12, 10, 8, 0.9);
  color: #ffd7b0;
  font: 800 14px/1 "JetBrains Mono", monospace;
  letter-spacing: 0.08em;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.ar-tryon-btn:hover:not(:disabled) {
  background: rgba(224, 122, 40, 0.28);
  color: #fff;
}

.ar-tryon-btn--inline {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  min-width: 0;
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  box-shadow: none;
}

.viewer-shell:fullscreen .ar-tryon-btn,
.viewer-shell.viewer-maximized .ar-tryon-btn {
  bottom: max(72px, calc(env(safe-area-inset-bottom, 0px) + 64px));
  z-index: 100001;
}

/* Inline AR в том же shell */
.ar-inline {
  display: none;
  flex-direction: column;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.viewer-shell.ar-inline-active .ar-inline {
  display: flex;
}

.ar-inline-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  background: #0a0a0a;
  touch-action: none;
}

@media (orientation: landscape) {
  .ar-inline-stage {
    aspect-ratio: 16 / 9;
    max-height: min(72dvh, calc(100dvh - 120px));
  }

  .viewer-shell.ar-inline-active:not(:fullscreen):not(.viewer-maximized) {
    max-width: 100%;
  }

  .ar-inline .ar-joy-side {
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .ar-inline .ar-joystick-base {
    width: 88px;
    height: 88px;
  }

  .ar-inline .ar-joystick--vert .ar-joystick-base {
    width: 48px;
    height: 88px;
  }
}

.viewer-shell:fullscreen .ar-inline-stage,
.viewer-shell.viewer-maximized .ar-inline-stage {
  aspect-ratio: auto;
  flex: 1;
  height: auto;
  min-height: 0;
}

.ar-inline-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.ar-inline-stage canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  touch-action: none;
  pointer-events: none;
}

.ar-inline-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
}

.ar-inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ar-inline .ar-joy-side {
  z-index: 30;
  pointer-events: auto;
}

.ar-orbit-proxy {
  position: absolute;
  inset: 0;
  z-index: 8;
  touch-action: none;
  background: transparent;
  pointer-events: auto;
}

.ar-inline .ar-nudge {
  z-index: 30;
  pointer-events: auto;
}

.ar-inline .ar-exit-fs {
  display: none;
  z-index: 40;
}

.viewer-shell:fullscreen .ar-inline .ar-exit-fs:not([hidden]),
.viewer-shell.viewer-maximized .ar-inline .ar-exit-fs:not([hidden]),
body.viewer-fullscreen-active .ar-inline .ar-exit-fs:not([hidden]) {
  display: grid;
}

.viewer-shell:fullscreen .ar-inline .ar-joy-side,
.viewer-shell.viewer-maximized .ar-inline .ar-joy-side {
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  z-index: 40;
}

@media (max-width: 1200px) {
  .ar-tryon-btn {
    bottom: 52px;
    height: 42px;
    font-size: 13px;
  }
}
/* AR pilot вЂ” extends model.css layout */

.ar-page .viewer-shell {
  display: block !important;
}

.ar-page .model-copy h1 {
  color: var(--orange);
}

.ar-hint {
  max-width: 560px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.ar-stage {
  position: relative;
  overflow: hidden;
  background: #0a0a0a;
  touch-action: none;
}

.ar-stage video {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}

.ar-stage canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  touch-action: none;
}

.ar-exit-fs {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  z-index: 6;
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(224, 122, 40, 0.65);
  background: rgba(12, 10, 8, 0.85);
  color: #f5f0ea;
  cursor: pointer;
  touch-action: manipulation;
}

.ar-exit-fs svg {
  width: 20px;
  height: 20px;
}

.viewer-shell:fullscreen .ar-exit-fs,
.viewer-shell.viewer-maximized .ar-exit-fs,
body.viewer-fullscreen-active .ar-exit-fs {
  display: grid;
}

.ar-hud {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  pointer-events: none;
  justify-content: center;
}

.ar-hud-chip {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(12, 10, 8, 0.72);
  border: 1px solid rgba(224, 122, 40, 0.35);
  color: #f5f0ea;
  font: 600 12px/1.35 "JetBrains Mono", monospace;
}

.ar-hud-chip.is-warn {
  border-color: rgba(220, 80, 60, 0.55);
  color: #ffc9be;
}

.ar-hud-chip.is-ok {
  border-color: rgba(80, 180, 100, 0.45);
}

/* FIX + rotate вЂ” СЃРІРµСЂС…Сѓ РїРѕ С†РµРЅС‚СЂСѓ */
.ar-nudge {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.ar-nudge[hidden] {
  display: none !important;
}

.ar-nudge.is-fixed .ar-nudge-btn:not([data-nudge="front"]) {
  opacity: 0.35;
  pointer-events: none;
}

.ar-fix-btn {
  min-width: 72px;
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(80, 180, 100, 0.65);
  background: rgba(12, 10, 8, 0.85);
  color: #b8f0c4;
  font: 800 14px/1 "JetBrains Mono", monospace;
  letter-spacing: 0.06em;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.ar-fix-btn.is-fixed {
  border-color: rgba(224, 122, 40, 0.75);
  color: #ffd7b0;
  background: rgba(224, 122, 40, 0.22);
}

.ar-nudge-rot {
  display: flex;
  gap: 4px;
}

.ar-nudge-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(224, 122, 40, 0.55);
  background: rgba(12, 10, 8, 0.78);
  color: #f5f0ea;
  font: 700 13px/1 "JetBrains Mono", monospace;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.ar-nudge-btn:active {
  background: rgba(224, 122, 40, 0.35);
}

/* Р”Р¶РѕР№СЃС‚РёРєРё РїРѕ СЂР°Р·РЅС‹Рј СЃС‚РѕСЂРѕРЅР°Рј */
.ar-joy-side {
  position: absolute;
  bottom: max(56px, calc(env(safe-area-inset-bottom, 0px) + 48px));
  z-index: 4;
  pointer-events: auto;
}

.ar-joy-side[hidden] {
  display: none !important;
}

.ar-joy-side.is-fixed {
  opacity: 0.35;
  pointer-events: none;
}

.ar-joy-left {
  left: max(10px, env(safe-area-inset-left, 0px));
}

.ar-joy-right {
  right: max(10px, env(safe-area-inset-right, 0px));
}

.ar-joystick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  touch-action: none;
}

.ar-joystick-base {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(224, 122, 40, 0.5);
  background: rgba(12, 10, 8, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.ar-joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  border: 1px solid rgba(224, 122, 40, 0.85);
  background: rgba(224, 122, 40, 0.55);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  will-change: transform;
}

.ar-joystick-label {
  font: 700 10px/1 "JetBrains Mono", monospace;
  color: rgba(245, 240, 234, 0.7);
  letter-spacing: 0.08em;
}

.ar-joystick--vert .ar-joystick-base {
  width: 56px;
  height: 112px;
  border-radius: 28px;
}

.ar-inspect-hint {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(12, 10, 8, 0.55);
  color: rgba(245, 240, 234, 0.75);
  font: 600 11px/1.3 "JetBrains Mono", monospace;
  pointer-events: none;
  white-space: nowrap;
}

.ar-inspect-hint[hidden] {
  display: none !important;
}

.ar-controls .viewer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#arStopButton:not([hidden]) {
  display: inline-flex;
}

.viewer-shell:fullscreen .ar-controls,
.viewer-shell.viewer-maximized .ar-controls {
  flex-shrink: 0;
}

.ar-start-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: rgba(10, 8, 6, 0.82);
  color: #f5f0ea;
}

.ar-start-overlay[hidden] {
  display: none !important;
}

.ar-start-overlay p {
  max-width: 320px;
  margin: 0;
  color: var(--muted, #c4b8a8);
  font-size: 14px;
  line-height: 1.5;
}

.ar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.ar-status-line {
  font: 500 12px/1.4 "JetBrains Mono", monospace;
  color: var(--muted);
}

@media (orientation: landscape) {
  .ar-joy-side {
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  .ar-hud {
    bottom: 8px;
    max-width: 60%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

