/* ============================================================
   Camera Overlay
   ------------------------------------------------------------
   폰 외부의 iOS 홈스크린 카메라 앱 아이콘 + 폰 내부의 iOS 카메라 UI.
   styles.css / apple-theme.css 뒤에 로드.
   ============================================================ */

/* ============================================================
   1) 폰 외부 — iOS 홈스크린 스타일 카메라 앱 아이콘
   ============================================================ */
.ios-app-icon-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-left: 56px;
  user-select: none;
}

.ios-app-icon {
  width: 88px;
  height: 88px;
  border: none;
  border-radius: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #2a2a2c;
  /* iOS 시스템 카메라 아이콘 — 다크 그라데이션 */
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.10), transparent 55%),
    linear-gradient(160deg, #3a3a3c 0%, #1c1c1e 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 8px 20px rgba(0,0,0,0.45);
  transition: transform 150ms cubic-bezier(0.4,0,0.2,1);
}

.ios-app-icon:hover { transform: scale(1.04); }
.ios-app-icon:active { transform: scale(0.95); }
.ios-app-icon.is-active {
  outline: 3px solid #FFB000;
  outline-offset: 4px;
}

.ios-app-icon-label {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}

.ios-app-icon-hint {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
  text-align: center;
  margin-top: 6px;
  max-width: 140px;
  line-height: 1.35;
}

/* 모바일 / 좁은 화면: 폰 아래로 이동 + 작게 */
@media (max-width: 640px) {
  #root {
    flex-direction: column;
  }
  .ios-app-icon-stage {
    margin-left: 0;
    margin-top: 24px;
  }
  .ios-app-icon-hint { display: none; }
}

/* ============================================================
   2) 폰 내부 — iOS 카메라 화면
   ============================================================ */

/* 카메라가 활성화되면 status-bar 배경을 검정으로 (iOS 카메라는 풀스크린 검정) */
.phone.is-camera {
  background: #000;
}
.phone.is-camera .status-bar {
  background: rgba(0,0,0,0);
  color: #fff;
}
.phone.is-camera .status-bar .battery { border-color: #fff; }
.phone.is-camera .status-bar .battery-fill { background: #fff; }
.phone.is-camera .tabbar { display: none !important; }

.ios-camera-screen {
  position: absolute;
  inset: 0;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* status-bar 영역을 덮지 않고 그 아래에서 시작 */
  padding-top: 44px;
}

/* 닫기 버튼 */
.ios-cam-close {
  position: absolute;
  top: 50px;
  left: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 18px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.ios-cam-close:active { transform: scale(0.92); }

/* 상단 컨트롤 */
.ios-cam-top {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 14px;
}
.ios-cam-pill {
  height: 32px;
  min-width: 44px;
  padding: 0 10px;
  border: none;
  border-radius: 16px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(8px);
}
.ios-cam-flash-a {
  background: #FFB000;
  color: #000;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: 2px;
}

/* 뷰파인더 — 카메라가 비추는 영역 (밝은 회색 = 종이 위 QR 느낌) */
.ios-cam-viewfinder {
  flex: 1;
  position: relative;
  margin: 12px 12px 0;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 20%, #d4d4d6 0%, #b8b8ba 50%, #9c9c9e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* QR 이미지 영역 */
.ios-cam-qr-wrap {
  position: relative;
  width: 76%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ios-cam-qr-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* 노란 모서리 마커 — 인식 후 등장 */
.ios-cam-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: #FFB000;
  border-style: solid;
  border-width: 0;
  pointer-events: none;
  animation: corner-pop 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ios-cam-corner.tl { top: -10px; left: -10px;  border-top-width: 4px; border-left-width: 4px;  border-top-left-radius: 6px; }
.ios-cam-corner.tr { top: -10px; right: -10px; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 6px; }
.ios-cam-corner.bl { bottom: -10px; left: -10px;  border-bottom-width: 4px; border-left-width: 4px;  border-bottom-left-radius: 6px; }
.ios-cam-corner.br { bottom: -10px; right: -10px; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 6px; }

@keyframes corner-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* 노란 URL 인식 칩 */
.ios-cam-detect-chip {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  border: none;
  border-radius: 999px;
  background: #FFB000;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  animation: chip-rise 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 120ms ease;
}
.ios-cam-detect-chip:active { transform: translateX(-50%) scale(0.96); }
.ios-cam-detect-chip.pulse {
  animation: chip-pulse 1500ms ease-in-out infinite 800ms;
}

@keyframes chip-rise {
  0%   { transform: translate(-50%, 14px); opacity: 0; }
  100% { transform: translate(-50%, 0);    opacity: 1; }
}
@keyframes chip-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
  50%      { box-shadow: 0 4px 24px rgba(255,176,0,0.5), 0 0 0 6px rgba(255,176,0,0.18); }
}

.ios-cam-chip-leading {
  color: #1a1a1a;
  flex-shrink: 0;
}
.ios-cam-chip-text {
  font-family: var(--font-sans);
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.ios-cam-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 9px;
  color: rgba(0,0,0,0.55);
  flex-shrink: 0;
  margin-left: 2px;
}

/* 우하단 QR 스캔 토글 (시각만) */
.ios-cam-scan-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 20px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.ios-cam-scan-toggle:active { transform: scale(0.94); }

/* ============================================================
   3) 하단 컨트롤 — 사진/비디오 모드 + 셔터 + 전환
   ============================================================ */
.ios-cam-bottom {
  background: #000;
  padding: 14px 16px 22px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 8px;
}

.ios-cam-thumb {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #93b5e1 0%, #b5a8d4 50%, #e1b5c9 100%);
  border: 1px solid rgba(255,255,255,0.2);
  justify-self: start;
}

.ios-cam-modes {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  justify-self: center;
}
.ios-cam-mode { padding: 6px 8px; }
.ios-cam-mode.active {
  color: #FFB000;
  font-weight: 700;
}

.ios-cam-shutter {
  width: 64px;
  height: 64px;
  border-radius: 32px;
  border: 4px solid #fff;
  background: transparent;
  cursor: default;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  /* 셔터는 가운데 정렬을 위해 grid-row 한 칸 가로지름 */
  justify-self: center;
  grid-column: 2;
  grid-row: 1;
}
.ios-cam-shutter-inner {
  width: 52px;
  height: 52px;
  border-radius: 26px;
  background: #fff;
  display: block;
}

.ios-cam-flip {
  width: 38px;
  height: 38px;
  border-radius: 19px;
  border: none;
  background: rgba(255,255,255,0.18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  justify-self: end;
}
.ios-cam-flip:active { transform: scale(0.92); }
