.fitmatch-scanner {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(24, 27, 44, 0.96), rgba(6, 8, 15, 1));
  color: #fff;
  overflow: hidden;
}

.fitmatch-scanner__shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.fitmatch-scanner__video,
.fitmatch-scanner__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fitmatch-scanner__canvas {
  display: none;
}

.fitmatch-scanner__overlay {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.fitmatch-scanner__crosshair,
.fitmatch-scanner__sidelines {
  position: absolute;
  inset: 0;
}

.fitmatch-scanner__crosshair::before,
.fitmatch-scanner__crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.22);
}

.fitmatch-scanner__crosshair::before {
  width: min(52vw, 240px);
  height: 2px;
}

.fitmatch-scanner__crosshair::after {
  width: 2px;
  height: min(60vh, 420px);
}

.fitmatch-scanner__sidelines::before,
.fitmatch-scanner__sidelines::after {
  content: "";
  position: absolute;
  top: 14%;
  bottom: 18%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, rgba(39, 201, 166, 0.8), transparent);
}

.fitmatch-scanner__sidelines::before {
  left: 18%;
}

.fitmatch-scanner__sidelines::after {
  right: 18%;
}

.fitmatch-scanner__frame {
  width: min(78vw, 360px);
  height: min(64vh, 620px);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.fitmatch-scanner__hint {
  position: absolute;
  top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
}

.fitmatch-scanner__guide {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: calc(100% - 2rem);
}

.fitmatch-scanner__guide span {
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
}

.fitmatch-scanner__guide .is-ok {
  background: rgba(39, 201, 166, 0.2);
  border-color: rgba(39, 201, 166, 0.55);
}

.fitmatch-scanner__hud,
.fitmatch-scanner__status,
.fitmatch-scanner__gallery {
  position: relative;
  z-index: 2;
}

.fitmatch-scanner__hud {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.76), rgba(0, 0, 0, 0));
}

.fitmatch-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 0.9rem;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 600;
}

.fitmatch-btn--primary {
  background: linear-gradient(135deg, #27c9a6, #1da0ff);
  color: #05111a;
}

.fitmatch-btn:disabled {
  opacity: 0.45;
}

.fitmatch-scanner__status {
  padding: 0 1rem 1rem;
  font-size: 0.95rem;
  opacity: 0.9;
}

.fitmatch-scanner__gallery {
  padding: 0 1rem 1rem;
}

.fitmatch-scanner__panel {
  margin: 0 1rem 0.75rem;
  padding: 1rem;
  border-radius: 24px;
  background: rgba(8, 13, 22, 0.72);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.fitmatch-field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.fitmatch-field input {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.fitmatch-scanner__metrics {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.fitmatch-scanner__results-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.fitmatch-metric,
.fitmatch-history-record {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
}

.fitmatch-metric span,
.fitmatch-history-record p {
  opacity: 0.75;
}

.fitmatch-history-card {
  border: 0;
  text-align: left;
  padding: 0.75rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.fitmatch-product-card,
.fitmatch-fit {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.fitmatch-product-card p,
.fitmatch-fit ul {
  margin: 0;
  opacity: 0.88;
}

.fitmatch-scanner__viewer {
  perspective: 1100px;
  overflow: hidden;
  border-radius: 24px;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  min-height: 320px;
  display: grid;
  place-items: center;
}

.fitmatch-body-model {
  width: min(100%, 340px);
  height: 420px;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
}

.fitmatch-body-model__stage {
  position: relative;
  width: 180px;
  height: var(--model-height, 300px);
  transform-style: preserve-3d;
  transition: transform 120ms ease-out;
  transform: rotateX(8deg) rotateY(0deg);
  user-select: none;
  touch-action: none;
}

.fitmatch-body-model__head,
.fitmatch-body-model__torso,
.fitmatch-body-model__hips,
.fitmatch-body-model__left-arm,
.fitmatch-body-model__right-arm,
.fitmatch-body-model__left-leg,
.fitmatch-body-model__right-leg {
  position: absolute;
  left: 50%;
  transform-style: preserve-3d;
  background: linear-gradient(180deg, rgba(39, 201, 166, 0.9), rgba(29, 160, 255, 0.6));
  box-shadow: 0 0 30px rgba(29, 160, 255, 0.2);
}

.fitmatch-body-model__head {
  width: calc(48px * var(--model-shoulder, 1));
  height: calc(48px * var(--model-shoulder, 1));
  border-radius: 50%;
  top: 0;
  transform: translateX(-50%) translateZ(20px);
}

.fitmatch-body-model__torso {
  width: calc(86px * var(--model-shoulder, 1));
  height: calc(112px * var(--model-waist, 1));
  border-radius: 28px;
  top: 56px;
  transform: translateX(-50%) translateZ(14px);
}

.fitmatch-body-model__hips {
  width: calc(92px * var(--model-hip, 1));
  height: calc(54px * var(--model-hip, 1));
  border-radius: 24px;
  top: 158px;
  transform: translateX(-50%) translateZ(10px);
}

.fitmatch-body-model__left-arm,
.fitmatch-body-model__right-arm {
  width: 30px;
  height: calc(124px * var(--model-shoulder, 1));
  top: 68px;
  border-radius: 999px;
}

.fitmatch-body-model__left-arm {
  transform: translateX(-92px) rotate(8deg) translateZ(6px);
}

.fitmatch-body-model__right-arm {
  transform: translateX(62px) rotate(-8deg) translateZ(6px);
}

.fitmatch-body-model__left-leg,
.fitmatch-body-model__right-leg {
  width: 34px;
  height: calc(150px * var(--model-leg, 1));
  top: 198px;
  border-radius: 999px;
}

.fitmatch-body-model__left-leg {
  transform: translateX(-34px) rotate(2deg) translateZ(4px);
}

.fitmatch-body-model__right-leg {
  transform: translateX(4px) rotate(-2deg) translateZ(4px);
}

.fitmatch-scanner__viewer-copy {
  opacity: 0.8;
  margin: 0.75rem 0 0;
}

.fitmatch-scanner__dialog {
  width: min(94vw, 760px);
  border: 0;
  border-radius: 24px;
  background: #07101a;
  color: #fff;
}

.fitmatch-scanner__dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.fitmatch-scanner__dialog-inner {
  padding: 1rem;
}

.fitmatch-scanner__dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fitmatch-scanner__history {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.fitmatch-scanner__thumbnails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.fitmatch-scanner__thumb {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.fitmatch-scanner__empty {
  opacity: 0.75;
}
