/* ============================================================================
 * 서명전에 — iOS Capture & Picker
 * ========================================================================== */

/* -------------------- 카메라 촬영 -------------------- */

.capture {
  position: absolute; inset: 0;
  background: #0b0b0c;
  color: #fff;
  display: flex; flex-direction: column;
  /* Safe Area: 풀스크린 카메라 UI가 노치·홈 인디케이터를 피하도록. */
  padding-top: max(54px, calc(var(--sa-top, 0px) + 10px));
  padding-bottom: max(34px, var(--sa-bottom, 0px));
  z-index: 40;
  overflow: hidden;
}

.capture__top {
  height: 48px;
  padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.capture__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
}
.capture__chip {
  width: 32px; height: 32px;
  border-radius: 16px;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-family: inherit;
  transition: background 180ms;
}
.capture__chip--on { background: var(--tds-yellow-500); color: #0b0b0c; }
.capture__chip:active { background: rgba(255,255,255,0.22); }

.capture__viewfinder {
  flex: 1;
  position: relative;
  overflow: hidden;
  /* 흐릿한 방 배경 느낌 */
  background:
    radial-gradient(80% 60% at 50% 40%, #1e1e22 0%, #0b0b0c 100%);
}

/* 가짜 종이 프리뷰 */
.capture__paper {
  position: absolute;
  top: 50%; left: 50%;
  width: 74%;
  aspect-ratio: 3 / 4.2;
  background: #f8f4ec;
  color: #1b1b1f;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  padding: 18px 16px;
  transform: translate(-50%, -50%) rotate(-2.4deg) scale(0.96);
  transition: transform 700ms cubic-bezier(0.22, 0.8, 0.3, 1);
  display: flex; flex-direction: column; gap: 9px;
  overflow: hidden;
}
.capture__paper--aligned {
  transform: translate(-50%, -50%) rotate(0.4deg) scale(1);
}
.capture__paper-head {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #1b1b1f;
  margin-bottom: 6px;
}
.capture__paper-line {
  height: 5px;
  border-radius: 2px;
  background: rgba(27, 27, 31, 0.22);
}

/* 격자 */
.capture__grid {
  position: absolute; inset: 0;
  pointer-events: none;
}
.capture__grid span {
  position: absolute;
  background: rgba(255,255,255,0.13);
}
.capture__grid span:nth-child(1) { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.capture__grid span:nth-child(2) { left: 66.66%; top: 0; bottom: 0; width: 1px; }
.capture__grid span:nth-child(3) { top: 33.33%; left: 0; right: 0; height: 1px; }
.capture__grid span:nth-child(4) { top: 66.66%; left: 0; right: 0; height: 1px; }

/* 감지 프레임 */
.capture__frame {
  position: absolute;
  top: 9%; left: 8%; right: 8%; bottom: 9%;
  pointer-events: none;
  transition: border-color 300ms;
}
.capture__corner {
  position: absolute;
  width: 22px; height: 22px;
  border: 3px solid var(--tds-yellow-500);
  transition: border-color 300ms;
}
.capture__corner--tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 3px 0 0 0; }
.capture__corner--tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 3px 0 0; }
.capture__corner--bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 3px; }
.capture__corner--br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 3px 0; }
.capture__frame--ok .capture__corner {
  border-color: var(--tds-green-500);
}

/* 토스트 */
.capture__toast {
  position: absolute;
  left: 50%; top: 20px;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: rgba(255,255,255,0.95);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background 300ms;
}
.capture__toast--ok {
  background: rgba(50, 215, 75, 0.85);
  color: #0b0b0c;
  font-weight: 600;
}

/* 플래시 */
.capture__flash {
  position: absolute; inset: 0;
  background: #fff;
  animation: cap-flash 180ms ease-out forwards;
  pointer-events: none;
}
@keyframes cap-flash {
  0%   { opacity: 0.9; }
  100% { opacity: 0; }
}

/* 하단 컨트롤 */
.capture__bottom {
  height: 110px;
  padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.capture__side {
  width: 44px; height: 44px; border-radius: 22px;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 180ms;
}
.capture__side:active { background: rgba(255,255,255,0.22); }
.capture__side--on { background: var(--tds-yellow-500); color: #0b0b0c; }

.capture__shutter {
  width: 70px; height: 70px; border-radius: 35px;
  border: 4px solid rgba(255,255,255,0.95);
  background: transparent;
  padding: 3px;
  cursor: pointer;
  transition: transform 120ms;
}
.capture__shutter:active { transform: scale(0.92); }
.capture__shutter-inner {
  display: block;
  width: 100%; height: 100%;
  background: #fff;
  border-radius: 50%;
}

.capture__hint {
  position: absolute;
  left: 0; right: 0;
  bottom: 124px;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  letter-spacing: -0.01em;
  pointer-events: none;
}

/* -------------------- 파일 / 사진 픽커 -------------------- */

.picker {
  position: absolute; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  /* Safe Area: 픽커 풀스크린에서도 노치·홈 인디케이터 보호. */
  padding-top: max(54px, calc(var(--sa-top, 0px) + 10px));
  padding-bottom: max(34px, var(--sa-bottom, 0px));
  z-index: 40;
}

.navbar__btn--primary { color: var(--brand); font-weight: 600; }

.picker__segment {
  margin: 4px 16px 14px;
  padding: 2px;
  background: var(--fill-2);
  border-radius: 9px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 2px;
  flex-shrink: 0;
}
.picker__seg {
  height: 30px;
  border: 0; background: transparent;
  font-family: inherit; font-size: 13px;
  font-weight: 500;
  color: var(--label);
  border-radius: 7px;
  cursor: pointer;
  transition: all 180ms;
}
.picker__seg--on {
  background: var(--surface);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 0 0 0.5px rgba(0,0,0,0.04);
}

.picker__scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.picker__section-h {
  padding: 0 16px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--label-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* 사진 앱 3칸 그리드 */
.picker__grid {
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.picker__thumb {
  position: relative;
  aspect-ratio: 1;
  border: 0; padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 140ms, box-shadow 140ms;
}
.picker__thumb:active { transform: scale(0.96); }
.picker__thumb--on {
  box-shadow: 0 0 0 3px var(--brand);
}
.picker__thumb-bg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.picker__doc-preview {
  width: 74%; height: 80%;
  background: #fff;
  border-radius: 3px;
  padding: 10px 8px 8px;
  display: flex; flex-direction: column; gap: 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.picker__doc-preview span {
  height: 3px;
  background: rgba(0,0,0,0.2);
  border-radius: 1.5px;
}
.picker__doc-preview span:first-child {
  width: 40%;
  height: 5px;
  background: rgba(0,0,0,0.55);
  margin-bottom: 4px;
}
.picker__check {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.picker__thumb-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 6px 5px;
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  text-align: left;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 하단 고정 액션 */
.picker__bottom {
  flex-shrink: 0;
  padding: 10px 16px 14px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-top: 0.5px solid var(--separator);
}

/* -------------------- Account wallet card (크레딧 충전 상단 이동) -------------------- */

.acct-wallet {
  margin: 4px 16px 18px;
  padding: 18px 18px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 80%, #000 20%) 100%);
  color: #fff;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 30%, transparent);
  position: relative;
  overflow: hidden;
}
/* 우상단 장식 — 기존엔 180px 흰 원이 떠 있어 "옅은 파란 원" 처럼 보였다.
   이중 라이트 라디얼(좌하단 → 우상단 글로우)로 카드에 깊이감만 주고 도형 형태는
   드러나지 않게 변경. mask 로 우상단 1/3 영역에만 적용 → 텍스트 가독성 유지. */
.acct-wallet::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 90% 12%, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 42%),
    radial-gradient(circle at 105% 0%, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 35%);
  pointer-events: none;
  border-radius: inherit;
}
/* 미세한 그리드 점 패턴 — 흰 도트 6px 간격. opacity 가 매우 낮아 그라디언트
   위로 살짝 텍스처만 더한다. (배경이 너무 평평해 보이는 걸 방지) */
.acct-wallet::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 60%; height: 100%;
  background-image: radial-gradient(rgba(255,255,255,0.18) 1px, transparent 1.2px);
  background-size: 14px 14px;
  background-position: 6px 6px;
  -webkit-mask-image: linear-gradient(225deg, rgba(0,0,0,0.55), rgba(0,0,0,0) 65%);
          mask-image: linear-gradient(225deg, rgba(0,0,0,0.55), rgba(0,0,0,0) 65%);
  pointer-events: none;
  border-radius: inherit;
}
.acct-wallet__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  position: relative; z-index: 1;
}
.acct-wallet__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.acct-wallet__val {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1;
}
.acct-wallet__label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.78);
  margin-bottom: 4px;
}
.acct-wallet__val {
  display: flex; align-items: baseline; gap: 4px;
}
.acct-wallet__val-num {
  font-family: var(--font-num);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.acct-wallet__val-unit {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.78);
}
.acct-wallet__expiry {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  white-space: nowrap;
}
.acct-wallet__cta {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.95);
  color: var(--brand);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  position: relative; z-index: 1;
  transition: background 180ms;
}
.acct-wallet__cta:active { background: rgba(255,255,255,0.85); }
