.home-panel[hidden],
.ar-panel[hidden] {
  display: none !important;
}

body.ar-mode {
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 4%, rgba(7, 88, 143, 0.1), transparent 31rem),
    radial-gradient(circle at 92% 96%, rgba(245, 130, 0, 0.09), transparent 28rem),
    var(--page);
}

body.ar-mode .app-viewport {
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
}

.ar-panel {
  width: min(100%, 700px);
  height: min(980px, calc(100svh - 20px));
  min-height: 560px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(190, 211, 225, 0.9);
  border-radius: clamp(22px, 3.8vw, 34px);
  background: #fff;
  box-shadow: var(--shadow);
}

.ar-header {
  min-height: 72px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  padding: 10px 16px 8px;
}

.ar-back-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0 0 5px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--interojo-blue-deep);
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ar-back-button:hover {
  background: #edf5fa;
}

.ar-back-button:focus-visible {
  outline: 3px solid rgba(7, 88, 143, 0.2);
  outline-offset: 2px;
}

.ar-home-button {
  justify-self: center;
  width: min(55%, 220px);
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ar-home-button:focus-visible {
  outline: 3px solid rgba(7, 88, 143, 0.2);
  outline-offset: 5px;
  border-radius: 8px;
}

.ar-brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.ar-stage {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  margin: 0 16px;
  overflow: hidden;
  border-radius: 19px;
  background: #000;
}

#cameraVideo {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#arCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

.ar-status {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  width: min(82%, 420px);
  padding: 14px 16px;
  color: #fff;
  font-size: clamp(0.9rem, 2.6vw, 1.12rem);
  font-weight: 750;
  line-height: 1.5;
  text-align: center;
  word-break: keep-all;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease;
}

.ar-status.ready {
  opacity: 0;
  pointer-events: none;
}

.ar-selected-name {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  min-width: 52px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(7, 30, 47, 0.58);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  backdrop-filter: blur(8px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.camera-shot {
  position: absolute;
  left: 18px;
  bottom: 20px;
  z-index: 4;
  width: 50px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.camera-shot img {
  width: 42px;
  height: 34px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
}

.camera-shot span {
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.camera-shot:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.72);
  outline-offset: 3px;
  border-radius: 12px;
}

.camera-shot:active {
  transform: scale(0.96);
}

.ar-opacity-controls {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.ar-opacity-button {
  width: 44px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding: 5px 3px 4px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ar-opacity-button.active {
  color: #fff;
}

.ar-opacity-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.ar-opacity-button > span:last-child {
  font-size: 0.64rem;
  font-weight: 850;
  line-height: 1;
}

.ar-drop-icon {
  width: 24px;
  height: 24px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 60% 0 60% 60%;
  background-repeat: no-repeat;
  transform: rotate(-45deg);
}

.ar-drop-icon.fill-one-third {
  background-image: linear-gradient(45deg, currentColor 0 33.333%, transparent 33.333% 100%);
}

.ar-drop-icon.fill-two-thirds {
  background-image: linear-gradient(45deg, currentColor 0 66.667%, transparent 66.667% 100%);
}

.intensity-control {
  position: absolute;
  left: 78px;
  right: 22px;
  bottom: 34px;
  z-index: 4;
  display: flex;
  align-items: center;
}

.intensity-control input {
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  --slider-value: 85%;
  --track-fill: #fff;
  --track-rest: rgba(255, 255, 255, 0.42);
  --track-height: 4px;
  --thumb-size: 20px;
}

.intensity-control input::-webkit-slider-runnable-track {
  height: var(--track-height);
  border-radius: 999px;
  background: linear-gradient(to right, var(--track-fill) 0 var(--slider-value), var(--track-rest) var(--slider-value) 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.42);
}

.intensity-control input::-webkit-slider-thumb {
  width: var(--thumb-size);
  height: var(--thumb-size);
  margin-top: calc((var(--track-height) - var(--thumb-size)) / 2);
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  -webkit-appearance: none;
}

.intensity-control input::-moz-range-track {
  height: var(--track-height);
  border: 0;
  border-radius: 999px;
  background: var(--track-rest);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.42);
}

.intensity-control input::-moz-range-progress {
  height: var(--track-height);
  border-radius: 999px;
  background: var(--track-fill);
}

.intensity-control input::-moz-range-thumb {
  width: var(--thumb-size);
  height: var(--thumb-size);
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.capture-feedback {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: #fff;
  animation: captureFlash 420ms ease-out both;
}

.capture-feedback[hidden],
.capture-review[hidden] {
  display: none;
}

.capture-feedback span {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  font-size: 0.95rem;
  font-weight: 850;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  animation: captureMessage 760ms ease-out both;
}

.capture-review {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 12px;
  background: rgba(12, 17, 24, 0.82);
}

.capture-review-frame {
  min-height: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

.capture-review-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.capture-review-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}

.capture-review-location {
  margin: 0;
  color: #fff;
  font-size: clamp(0.72rem, 2.2vw, 0.9rem);
  font-weight: 750;
  line-height: 1.4;
  text-align: center;
  text-wrap: balance;
}

.capture-review-button {
  min-width: 96px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 850;
  cursor: pointer;
}

.capture-review-button.secondary {
  color: #11283b;
  background: rgba(255, 255, 255, 0.94);
}

.capture-review-button.primary {
  color: #fff;
  background: var(--interojo-blue);
}

@keyframes captureFlash {
  0% { background: rgba(255, 255, 255, 0.72); }
  100% { background: rgba(255, 255, 255, 0); }
}

@keyframes captureMessage {
  0% { opacity: 0; transform: translateY(8px) scale(0.96); }
  18% { opacity: 1; transform: translateY(0) scale(1); }
  76% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-5px) scale(0.98); }
}

.lens-dock {
  flex: 0 0 auto;
  padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  background: #fff;
}

.ar-lens-dock {
  max-height: min(42svh, 390px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: #9aa7af #eef2f4;
}

.ar-lens-dock::-webkit-scrollbar {
  width: 6px;
}

.ar-lens-dock::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #eef2f4;
}

.ar-lens-dock::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #9aa7af;
}

.lens-groups {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.lens-group {
  min-width: 0;
}

.lens-group + .lens-group {
  padding-top: 12px;
  border-top: 1px solid #e3ebf0;
}

.lens-group-title {
  margin: 0 0 6px 2px;
  color: #34566d;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.13em;
}

.lens-group[data-category="fixing"] .lens-group-title {
  color: #b86a00;
}

.lens-group[data-category="iris"] .lens-group-title {
  color: #675b9b;
}

.lens-strip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 1px 8px;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #9aa7af #eef2f4;
  -webkit-overflow-scrolling: touch;
}

.lens-strip::-webkit-scrollbar {
  height: 6px;
}

.lens-strip::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #eef2f4;
}

.lens-strip::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #9aa7af;
}

.lens-tile {
  width: 82px;
  flex: 0 0 82px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px 5px 7px;
  overflow: hidden;
  border: 1px solid #d6e2ea;
  border-radius: 13px;
  background: #fff;
  color: #233b4d;
  cursor: pointer;
  scroll-snap-align: center;
  -webkit-tap-highlight-color: transparent;
}

.lens-tile:hover {
  border-color: rgba(7, 88, 143, 0.55);
}

.lens-tile:focus-visible {
  outline: 3px solid rgba(7, 88, 143, 0.2);
  outline-offset: 2px;
}

.lens-tile.active {
  border-width: 2px;
  border-color: var(--interojo-blue);
  box-shadow: 0 0 0 2px rgba(7, 88, 143, 0.28);
}

.lens-tile img {
  width: 70px;
  height: 70px;
  display: block;
  object-fit: contain;
  border-radius: 9px;
  background: #fff;
}

.lens-tile span {
  overflow: hidden;
  font-size: 0.69rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 700px) {
  .ar-header {
    min-height: 82px;
    padding-inline: 22px;
  }

  .ar-stage {
    margin-inline: 22px;
    border-radius: 23px;
  }

  .lens-dock {
    padding: 16px 22px max(18px, env(safe-area-inset-bottom));
  }

  .lens-tile {
    width: 92px;
    flex-basis: 92px;
  }

  .lens-tile img {
    width: 80px;
    height: 80px;
  }
}

@media (min-width: 1024px) {
  body.ar-mode .app-viewport {
    padding: 20px 28px;
  }

  .ar-panel {
    width: min(1440px, calc(100vw - 56px));
    height: min(900px, calc(100svh - 40px));
    min-height: min(720px, calc(100svh - 40px));
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(420px, 1fr);
    grid-template-rows: 116px minmax(0, 1fr);
    border-radius: 30px;
    background:
      radial-gradient(circle at 100% 0%, rgba(7, 88, 143, 0.065) 0 145px, transparent 146px),
      radial-gradient(circle at 0% 100%, rgba(245, 130, 0, 0.06) 0 128px, transparent 129px),
      #fff;
  }

  .ar-header {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 116px;
    padding: 14px 28px 10px;
  }

  .ar-home-button {
    align-self: end;
    width: min(42%, 240px);
  }

  .ar-stage {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    margin: 18px 0 24px 24px;
    border-radius: 22px;
  }

  .ar-lens-dock {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    max-height: none;
    margin: 18px 24px 24px 18px;
    padding: 16px 14px 18px;
    overflow-y: auto;
    border: 1px solid #dbe7ee;
    border-radius: 20px;
    background: #fbfdff;
  }

  .ar-lens-dock .lens-groups {
    gap: 14px;
  }

  .ar-lens-dock .lens-tile {
    width: 84px;
    flex-basis: 84px;
  }

  .ar-lens-dock .lens-tile img {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 520px) {
  body.ar-mode .app-viewport {
    padding: 0;
  }

  .ar-panel {
    width: 100%;
    height: 100svh;
    min-height: 520px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .ar-header {
    min-height: 62px;
    padding: max(5px, env(safe-area-inset-top)) 10px 5px;
  }

  .ar-home-button {
    width: min(52%, 190px);
  }

  .ar-stage {
    margin: 0 10px;
    border-radius: 14px;
  }

  .camera-shot {
    left: 12px;
    bottom: 14px;
  }

  .ar-opacity-controls {
    right: 10px;
    bottom: 9px;
    gap: 7px;
  }

  .ar-opacity-button {
    width: 40px;
    min-height: 52px;
  }

  .ar-drop-icon {
    width: 22px;
    height: 22px;
  }

  .intensity-control {
    left: 70px;
    right: 16px;
    bottom: 29px;
  }

  .lens-dock {
    padding: 11px 10px max(10px, env(safe-area-inset-bottom));
  }

  .lens-tile {
    width: 76px;
    flex-basis: 76px;
    padding-inline: 4px;
    border-radius: 11px;
  }

  .lens-tile img {
    width: 66px;
    height: 66px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ar-status,
  .lens-strip {
    scroll-behavior: auto;
    transition: none;
  }
}
