/* ============================= 5. Окно Прогрева, Тест, Мини-карта, Отчёт ============================= */
@keyframes wDrift1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(120px, 60px); } }
@keyframes wDrift2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-140px, -50px); } }
@keyframes wDrift3 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(60px, -90px); } }
@keyframes wGlow   { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.w-blob { position: absolute; border-radius: 50%; filter: blur(130px); opacity: .2; pointer-events: none; }
.w-b1 { animation: wDrift1 18s ease-in-out infinite; }
.w-b2 { animation: wDrift2 22s ease-in-out infinite; }
.w-b3 { animation: wDrift3 20s ease-in-out infinite; }
.w-ring-arc { transition: stroke-dashoffset 1s linear; }
.w-run circle.w-arc { filter: drop-shadow(0 0 10px rgba(242, 166, 90, .45)); }
.w-live { animation: wGlow 1.6s ease-in-out infinite; }

/* Сцена теста — 100% чистая, без декоративных слоёв */
.test-screen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
}
.test-screen.cursor-hidden, .test-screen.cursor-hidden * {
  cursor: none !important;
}
.stage, .test-stage, #testStage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  box-sizing: border-box;
}
.stage canvas, .stage svg, .stage video,
.test-stage canvas, .test-stage svg, .test-stage video {
  display: block;
  width: 100%;
  height: 100%;
}
.zone-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(242, 166, 90, .55) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(242, 166, 90, .55) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
}
.overlay-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 105;
}
.overlay-controls.hidden-ui {
  opacity: 0;
  pointer-events: none !important;
}
.overlay-controls.hidden-ui * {
  pointer-events: none !important;
}
.test-screen.clean-mode .overlay-controls,
.test-screen.clean-mode .info-panel,
.test-screen.clean-mode .restore-top-pill {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
.test-screen.clean-mode, .test-screen.clean-mode * {
  cursor: none !important;
}

/* Контролы внутри RENDERERS (совместимость со всеми 62 тестами) */
#testControls, .test-controls-bar, .controls-bar {
  position: relative;
  z-index: 35;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 16px;
  background: rgba(19, 17, 16, 0.9);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(243, 236, 227, 0.14);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 245, 230, 0.07);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13.5px;
  max-width: calc(100vw - 44px);
}
.slider-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-ui);
  padding: 5px 11px;
  min-height: 40px;
  border-radius: 11px;
  background: rgba(255, 248, 238, 0.045);
  border: 1px solid rgba(243, 236, 227, 0.085);
}
.slider-row label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text2);
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
}
.slider-row b,
.slider-row strong {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(242, 166, 90, 0.14);
  border: 1px solid rgba(242, 166, 90, 0.28);
  padding: 1px 7px;
  border-radius: 6px;
  margin: 0 2px;
  display: inline-block;
  line-height: 1.35;
}
.slider-row span {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  min-width: 34px;
  text-align: right;
}
.slider-row input[type=range],
#testControls input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 136px;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--val-pct, 50%), rgba(243, 236, 227, 0.14) var(--val-pct, 50%), rgba(243, 236, 227, 0.14) 100%);
  border: 1px solid rgba(243, 236, 227, 0.16);
  outline: none;
  cursor: pointer;
  margin: 0 2px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.slider-row input[type=range]:hover,
#testControls input[type=range]:hover {
  border-color: rgba(242, 166, 90, 0.45);
}
.slider-row input[type=range]::-webkit-slider-thumb,
#testControls input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid #24170a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), 0 0 0 3px rgba(242, 166, 90, 0.22);
  cursor: pointer;
  transition: transform .15s cubic-bezier(.2,.8,.2,1), box-shadow .15s ease, background-color .15s ease;
}
.slider-row input[type=range]::-webkit-slider-thumb:hover,
#testControls input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  background: #ffc17d;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.65), 0 0 0 5px rgba(242, 166, 90, 0.32);
}
.slider-row input[type=range]::-moz-range-thumb,
#testControls input[type=range]::-moz-range-thumb {
  width: 22px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid #24170a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), 0 0 0 3px rgba(242, 166, 90, 0.22);
  cursor: pointer;
  transition: transform .15s cubic-bezier(.2,.8,.2,1), box-shadow .15s ease;
}
.slider-row input[type=color] {
  width: 34px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  padding: 0;
}
.slider-row input[type=text], .slider-row select {
  background: var(--tile);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 6px 11px;
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
}
.slider-row input[type=text]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 166, 90, 0.18);
}

/* Кастомный селект «Вечерняя лампа» взамен системного <select> */
.cz-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.cz-select-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  padding: 5px 11px 5px 12px;
  border-radius: 9px;
  background: #25211c;
  color: var(--text);
  border: 1px solid rgba(243, 236, 227, 0.14);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.cz-select-trigger:hover {
  background: #2d2822;
  border-color: rgba(242, 166, 90, 0.45);
}
.cz-select-wrap.open .cz-select-trigger {
  background: #2a241e;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 166, 90, 0.18);
}
.cz-select-chevron {
  display: inline-flex;
  color: var(--muted);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), color .18s;
}
.cz-select-wrap.open .cz-select-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}
.cz-select-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 13px;
  background: rgba(24, 21, 18, 0.97);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(242, 166, 90, 0.28);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 245, 230, 0.08);
  z-index: 200;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: czMenu .18s cubic-bezier(.2,.8,.2,1) both;
}
.cz-select-wrap.open .cz-select-menu {
  display: flex;
}
.cz-select-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-family: var(--font-ui);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background-color .14s ease, color .14s ease;
}
.cz-select-opt:hover {
  background: rgba(243, 236, 227, 0.08);
  color: var(--text);
}
.cz-select-opt.active {
  background: rgba(242, 166, 90, 0.16);
  color: var(--accent);
  font-weight: 600;
}

/* Клавиши-иконки SVG под стиль «Вечерняя лампа» */
.cz-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, #2b2621 0%, #1d1916 100%);
  border: 1px solid rgba(243, 236, 227, 0.18);
  border-bottom: 2.5px solid #0e0c0a;
  box-shadow: inset 0 1px 0 rgba(255, 245, 230, 0.1), 0 1px 3px rgba(0, 0, 0, 0.4);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  letter-spacing: 0.02em;
  vertical-align: middle;
  flex-shrink: 0;
}
.cz-kbd svg {
  display: block;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--tile);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .18s, filter .18s, background-color .18s, border-color .18s;
}
.btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  border-color: rgba(242, 166, 90, 0.4);
}
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
.gamma-wrap { display: flex; flex-direction: column; width: 100%; height: 100%; }
.gamma-row  { flex: 1; display: flex; border-bottom: 1px solid rgba(0, 0, 0, .25); }
.gamma-row .patch {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  color: rgba(0, 0, 0, .45);
  font-size: 12px;
}

/* Мини-карта дефектов и Отчёт */
@keyframes dPing { 0% { transform: translate(-50%, -50%) scale(.6); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; } }
@keyframes dDrop { 0% { transform: translate(-50%, -50%) scale(0); } 70% { transform: translate(-50%, -50%) scale(1.15); } 100% { transform: translate(-50%, -50%) scale(1); } }
.d-mark {
  position: absolute;
  transform: translate(-50%, -50%);
  animation: dDrop .45s cubic-bezier(.3,1.5,.5,1) both;
}
.d-ping {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #e8836b;
  animation: dPing 1.8s ease-out infinite;
  pointer-events: none;
}
.d-map {
  cursor: crosshair;
  transition: border-color .2s;
}
.d-map:hover {
  border-color: rgba(232, 131, 107, 0.5) !important;
}

@keyframes rFill { from { stroke-dashoffset: 603.2; } }
@keyframes rGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rRise { from { transform: translateY(14px); } to { transform: none; } }
@keyframes rPing { 0% { transform: translate(-50%, -50%) scale(.6); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; } }
.r-arc  { animation: rFill 1.4s cubic-bezier(.2,.8,.2,1) both; }
.r-bar  { transform-origin: left center; animation: rGrow .9s cubic-bezier(.2,.8,.2,1) both; }
.r-rise { animation: rRise .6s cubic-bezier(.2,.8,.2,1) backwards; }
.r-ping {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #e8836b;
  animation: rPing 1.8s ease-out infinite;
  pointer-events: none;
}
.r-row { transition: background-color .2s; }
.r-row:hover { background: rgba(243, 236, 227, 0.035); }

@keyframes sPulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes sBlur  { 0%, 100% { filter: blur(0); } 50% { filter: blur(1.4px); } }
.s-pulse { animation: sPulse 1.8s ease-in-out infinite; }
.s-blur  { animation: sBlur 2.4s ease-in-out infinite; }

/* Доступность: отключение декоративных анимаций при prefers-reduced-motion: reduce */
@media (prefers-reduced-motion: reduce) {
  .mt-amb, .mt-orb, .cz-mark span, .cz-bars-track, .cz-glow-text,
  .cz-shimmer::after, .cz-screen, .cz-scan, .cz-live-dot,
  .cz-ring::before, .cz-ring::after, .cz-card, .cz-card::before,
  .cz-chip, .cz-live, .w-b1, .w-b2, .w-b3, .w-live,
  .d-mark, .d-ping, .r-arc, .r-bar, .r-rise, .r-ping,
  .s-pulse, .s-blur {
    animation: none !important;
    transition: none !important;
  }
}

/* Адаптивность */
@media (max-width: 1200px) {
  .report-grid {
    grid-template-columns: 1fr !important;
  }
  .warmup-card, .defect-card {
    flex-direction: column !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  .warmup-right {
    width: 100% !important;
  }
  .defect-left {
    flex: 1 1 auto !important;
    width: 100% !important;
  }
}
@media (max-width: 820px) {
  .test-top-bar {
    flex-wrap: wrap;
    top: 12px !important;
    left: 12px !important;
    right: 12px !important;
  }
  .info-panel-float {
    top: auto !important;
    bottom: 110px !important;
    right: 12px !important;
    left: 12px !important;
    width: auto !important;
  }
  .test-bottom-bar {
    left: 12px !important;
    right: 12px !important;
    transform: none !important;
    flex-wrap: wrap;
    justify-content: center;
    bottom: 12px !important;
  }
}

