/* ===== 요원 등록 (전면 카메라 얼굴 AR) =====
 * 실제 신분 인증 장비처럼 절제된 스타일: 얇은 선, 낮은 채도, 발광 최소화.
 * data-cap 이 붙은 요소는 촬영 이미지에도 같은 위치·글꼴로 그려진다(js/agent/compose.js).
 */
.agent-intro__title { margin: 0 0 8px; font-size: 20px; word-break: keep-all; }
.agent-intro__msg { margin: 10px 0 0; min-height: 1.2em; color: var(--t-warn, #ffb547); font-size: 14px; }

.agent-cam {
  --ag-ink: #d7ecf6;
  --ag-sub: rgba(215, 236, 246, .62);
  --ag-line: rgba(215, 236, 246, .24);
  --ag-ok: #7fe0b3;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000a14;
  color: var(--ag-ink);
  font-family: var(--font, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif);
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.agent-stage { position: absolute; inset: 0; overflow: hidden; }
.agent-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* 셀카처럼 좌우 반전 */
  background: #000a14;
}
.agent-helmet {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  will-change: transform;
}
.agent-helmet.is-on { visibility: visible; }
.agent-cam.is-equip .agent-helmet { animation: helmet-equip 1s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes helmet-equip {
  0% { clip-path: inset(0 0 100% 0); filter: brightness(2.2) saturate(.3); }
  60% { clip-path: inset(0 0 0 0); filter: brightness(1.4) saturate(.7); }
  100% { clip-path: inset(0 0 0 0); filter: none; }
}
.agent-scanline {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(215, 236, 246, .85), transparent);
  opacity: 0;
  pointer-events: none;
}
.agent-cam.is-equip .agent-scanline { animation: agent-scan 1s ease-in-out both; }
@keyframes agent-scan { 0% { top: 12%; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { top: 78%; opacity: 0; } }
.agent-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.agent-frame path { fill: none; stroke: rgba(215, 236, 246, .85); stroke-width: 2; transition: opacity .2s linear; }

/* 상단 */
.agent-top {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 16px; right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}
.agent-top__l { display: grid; gap: 3px; }
.agent-top__cmd { font-size: 11px; letter-spacing: .26em; color: var(--ag-sub); white-space: nowrap; }
.agent-top__title { font-size: 15px; font-weight: 700; letter-spacing: .14em; white-space: nowrap; }
.agent-status {
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--ag-line);
  border-radius: 3px;
  background: rgba(0, 10, 20, .55);
  font-size: 12px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.agent-cam[data-state="tracking"] .agent-status { border-color: rgba(127, 224, 179, .55); color: var(--ag-ok); }

.agent-verified {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 70px);
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border: 1px solid rgba(127, 224, 179, .7);
  border-radius: 2px;
  background: rgba(0, 10, 20, .6);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.agent-verified span { display: block; font-size: 13px; font-weight: 700; letter-spacing: .3em; color: var(--ag-ok); white-space: nowrap; padding-left: .3em; text-align: center; }
.agent-cam.is-verified .agent-verified { opacity: 1; }

/* Compact viewfinder credential: the person and helmet remain the hero. */
.agent-hud {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 110px);
  display: grid;
  gap: 4px;
  padding: 14px 16px 13px;
  border: 1px solid rgba(235, 246, 249, .22);
  border-top: 2px solid rgba(139, 222, 190, .8);
  border-radius: 2px;
  background: linear-gradient(110deg, rgba(7, 20, 33, .88), rgba(7, 20, 33, .56));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: none;
  box-sizing: border-box;
}
.agent-hud__tag { color: #86D1B7; font-size: 10px; font-weight: 700; letter-spacing: .19em; }
.agent-hud__name { color: #F5F9FB; font-size: clamp(24px, 7vw, 34px); line-height: 1.12; font-weight: 800; letter-spacing: .065em; }
.agent-hud__foot { display: flex; justify-content: space-between; gap: 10px; color: #9DB4C4; font-size: 9px; font-weight: 650; letter-spacing: .12em; }
.agent-hud__foot [data-hud-status] { color: #B5C5D2; }
.agent-cam.is-verified [data-hud-status] { color: #8EE5B8; }

.agent-guide {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 48px);
  margin: 0;
  padding: 8px 14px;
  border-radius: 3px;
  background: rgba(0, 10, 20, .7);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  word-break: keep-all;
  pointer-events: none;
}
.agent-guide:empty { display: none; }
.agent-cam.is-manual .agent-guide { top: calc(env(safe-area-inset-top, 0px) + 120px); transform: translateX(-50%); }

/* 하단 조작 */
.agent-controls {
  position: absolute;
  left: 16px; right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 12px;
}
.agent-btn {
  min-height: 52px;
  border: 1px solid var(--ag-line);
  border-radius: 4px;
  background: rgba(0, 10, 20, .6);
  color: var(--ag-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.agent-btn[aria-pressed="true"] { border-color: var(--ag-ink); }
.agent-shutter {
  min-height: 62px;
  border: 2px solid var(--ag-ink);
  border-radius: 999px;
  background: rgba(215, 236, 246, .14);
  color: var(--ag-ink);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
}
.agent-shutter:active { transform: scale(.97); background: rgba(215, 236, 246, .3); }
.agent-shutter:disabled { opacity: .4; }

.agent-adjust {
  position: absolute;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 100px);
  padding: 8px;
  border: 1px solid var(--ag-line);
  border-radius: 4px;
  background: rgba(0, 10, 20, .75);
}
.agent-adjust[hidden] { display: none; }
.agent-adjust__grid { display: grid; grid-template-columns: repeat(4, 48px); gap: 6px; }
.agent-adjust button {
  min-height: 48px;
  border: 1px solid var(--ag-line);
  border-radius: 3px;
  background: transparent;
  color: var(--ag-ink);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.agent-adjust__reset { grid-column: 1 / -1; font-size: 13px !important; }

.agent-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.agent-flash.is-on { animation: agent-flash .38s ease-out; }
@keyframes agent-flash { 0% { opacity: .9; } 100% { opacity: 0; } }

.agent-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 16px;
  padding: 24px;
  background: rgba(0, 10, 20, .9);
  text-align: center;
  z-index: 3;
}
.agent-error[hidden] { display: none; }
.agent-error p { margin: 0; line-height: 1.6; word-break: keep-all; }
.agent-error__actions { display: grid; gap: 10px; min-width: 220px; }
.agent-error__actions .btn-term + .btn-term { margin-top: 0; }

/* 촬영 결과 */
.agent-result {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 18px calc(env(safe-area-inset-bottom, 0px) + 24px);
  background: #000a14;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  touch-action: pan-y;
}
.agent-result[hidden] { display: none; }
.agent-result__head { width: 100%; max-width: 420px; display: flex; justify-content: space-between; align-items: baseline; }
.agent-result__head span { font-size: 11px; letter-spacing: .26em; color: var(--ag-sub); }
.agent-result__head strong { font-size: 14px; letter-spacing: .18em; }
.agent-result__card {
  margin: 0;
  width: 100%;
  max-width: 420px;
  padding: 10px 10px 12px;
  border: 1px solid var(--ag-line);
  border-radius: 6px;
  background: rgba(215, 236, 246, .04);
}
.agent-result__card img {
  display: block;
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  border-radius: 3px;
  background: #000;
  -webkit-user-select: auto;
  user-select: auto;
  -webkit-touch-callout: default;
}
.agent-result__card figcaption { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11px; letter-spacing: .16em; color: var(--ag-sub); }
.agent-result__msg { margin: 0; min-height: 1.2em; font-size: 14px; text-align: center; word-break: keep-all; }
.agent-result__actions { width: 100%; max-width: 420px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.agent-result__actions .btn-term + .btn-term { margin-top: 0; }
.agent-result__note { max-width: 420px; margin: 0; font-size: 12px; line-height: 1.6; color: var(--ag-sub); text-align: center; word-break: keep-all; }

@media (prefers-reduced-motion: reduce) {
  .agent-cam.is-equip .agent-helmet, .agent-cam.is-equip .agent-scanline { animation: none; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .agent-hud { bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); padding: 8px 10px; }
  .agent-controls { left: auto; width: 320px; }
  .agent-verified { top: calc(env(safe-area-inset-top, 0px) + 54px); }
  .agent-result__card img { max-height: 50vh; }
}

/* v2: completed credential is a designed portrait, not a screenshot wrapped in another card. */
.agent-frame { opacity: .28; }
.agent-result { background: #06121F; gap: 17px; }
.agent-result__head { padding: 5px 1px 1px; }
.agent-result__head span { color: #8BABB9; font-size: 10px; }
.agent-result__head strong { color: #B9D2DE; font-size: 11px; letter-spacing: .15em; }
.agent-result__card {
  padding: 0;
  border: 1px solid #365164;
  border-radius: 3px;
  background: #091725;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .35);
}
.agent-result__card img {
  width: 100%;
  max-height: none;
  border-radius: 0;
  background: #091725;
}
.agent-result__card figcaption { display: none; }
.agent-result__actions { gap: 8px; }
.agent-result__actions .btn-term {
  min-height: 50px;
  padding: 10px 12px;
  border-radius: 5px;
  font-size: 14px;
  letter-spacing: 0;
}
@media (max-width: 350px) {
  .agent-hud__foot { font-size: 8px; letter-spacing: .06em; }
  .agent-result__actions .btn-term { font-size: 13px; }
}
