/* ════════════════════════════════════════════════
   AIRLOG 로그인 화면 (v2.76.0 — B 브랜드 분할형 + C 현장 빠른 로그인)
   - 처음(body.lg-full): 남색 브랜드 판 + 이름·PIN 6칸
   - 다시 온 사람(body.lg-back): "○○ 님" + PIN 점 6개 + 숫자판(터치 화면)·키보드(PC), 6자리면 바로 로그인
   - 폰: 위 남색 띠 + 아래 흰 판(위 모서리 둥금) / PC(1024~): 왼쪽 남색 판 + 오른쪽 입력
   - 남색 판은 다크 모드에서도 같은 색, 흰 판은 앱 토큰(--surface 등)을 따른다
   ════════════════════════════════════════════════ */

/* 위 = 남색(당겨 내리면 보이는 곳), 아래 = 흰 판 — 판 가장자리 틈으로 남색이 비치지 않게 */
body.login-page { background: linear-gradient(#0B2440 50%, var(--surface) 50%); }

.lg {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;   /* 숫자판을 빠르게 두 번 눌러도 아이폰 화면이 확대되지 않게 (v2.76.1) */
}

/* ── 브랜드 판 ── */
.lg-brand {
  position: relative;
  overflow: hidden;
  flex: none;
  background: #0B2440;
  color: #fff;
  padding: calc(56px + env(safe-area-inset-top)) 28px 56px;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 0 #0B2440;   /* 화면 배율이 소수(2.625 등)인 폰에서 오른쪽 끝 반 픽셀 틈 가리기 */
}
.lg-flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.lg-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lg-logo-mark { width: 48px; height: auto; display: block; }
.lg-logo-full { display: none; }
.lg-word {
  font-size: var(--fs-hero);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}
.lg-tag {
  font-size: var(--fs-md);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
}
.lg-tag-more { display: none; }
.lg-chips { display: none; }
.lg-foot { display: none; }

/* ── 입력 판 ── */
.lg-panel {
  position: relative;
  flex: 1;
  margin-top: -24px;
  background: var(--surface);
  color: var(--text);
  border-radius: 24px 24px 0 0;
  box-shadow: 2px 0 0 var(--surface);   /* 오른쪽 끝 반 픽셀 틈 가리기 */
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}
.lg-form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.lg-h { font-size: var(--fs-title); font-weight: 700; }
.lg-sub { font-size: var(--fs-sm); color: var(--text-3); }
.lg-sub.err { color: var(--red); font-weight: 600; }
.lg-head { display: flex; flex-direction: column; gap: 4px; }

.lg-field { display: flex; flex-direction: column; gap: 8px; }
.lg-field label { font-size: var(--fs-label); font-weight: 700; color: var(--text-2); }
.lg-field input[type=text] {
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 16px;               /* 아이폰 자동 확대 방지 */
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.lg-field input[type=text]::placeholder { color: var(--text-3); }
.lg-field input[type=text]:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); background: var(--surface); }

/* PIN 6칸: 보이는 칸은 그림, 실제 입력은 위에 겹친 투명 입력칸 */
.lg-pin { position: relative; }
.lg-pin-boxes {
  user-select: none;
  -webkit-user-select: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.lg-pin-boxes span {
  height: 54px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.lg-pin-boxes span.on::after {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--text);
}
.lg-pin-boxes span.cur { border: 2px solid var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); background: var(--surface); animation: lg-glow 1.6s ease-in-out infinite; }
/* 지금 입력할 칸: 깜빡이는 세로 커서 (v2.76.1) */
.lg-pin-boxes span.cur::before {
  content: '';
  width: 2px;
  height: 22px;
  border-radius: 1px;
  background: var(--blue);
  animation: lg-caret 1s steps(1) infinite;
}
@keyframes lg-caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes lg-glow { 0%, 100% { box-shadow: 0 0 0 3px var(--blue-bg); } 50% { box-shadow: 0 0 0 6px var(--blue-bg); } }
.lg-pin-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  letter-spacing: 1em;
  outline: none;
  cursor: pointer;
  opacity: 0;   /* 브라우저 비밀번호 자동 채우기의 회색 배경·점이 칸 위에 겹치지 않게 (v2.76.1) */
}
.lg-pin-input::selection { background: transparent; }
.lg-pin.shake { animation: lg-shake .36s; }
@keyframes lg-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.lg-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  cursor: pointer;
  width: fit-content;
}
.lg-remember input { width: 18px; height: 18px; accent-color: var(--blue); }

.lg-btn {
  height: 54px;
  border: 0;
  border-radius: 12px;
  background: #185FA5;   /* 브랜드 파랑 고정 — 다크 모드의 밝은 --blue에 흰 글자는 잘 안 보임 */
  color: #fff;
  font-size: var(--fs-md);
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.lg-btn:hover { opacity: .9; }
.lg-btn:disabled { opacity: .6; cursor: default; }

.lg-err { min-height: 18px; margin-top: -8px; font-size: var(--fs-label); color: var(--red); text-align: center; }
.lg-err:empty { min-height: 0; margin-top: -18px; }

.lg-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-3);
  text-align: center;
}
.lg-link {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
}

/* 모드별 보이기 */
body.lg-full .lg-only-back,
body.lg-back .lg-only-full { display: none; }

/* ── 다시 온 사람 ── */
.lg-who {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.lg-avatar {
  width: 72px;
  height: 72px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: var(--blue);
  font-size: var(--fs-num);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lg-who-name { font-size: var(--fs-lg); }
.lg-who-name b { font-weight: 700; }
/* 다시 온 사람: 터치 화면은 점 6개(숫자판), PC는 처음 화면과 같은 6칸 상자 (v2.76.1) */
@media (pointer: coarse) {
  body.lg-back .lg-pin { width: 232px; align-self: center; }
  body.lg-back .lg-pin-boxes { gap: 0; }
  body.lg-back .lg-pin-boxes span {
    height: 40px;
    border: 0;
    background: none;
    box-shadow: none;
  }
  body.lg-back .lg-pin-boxes span::after {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid var(--border);
    background: none;
    transition: background .12s, border-color .12s;
  }
  body.lg-back .lg-pin-boxes span.on::after { background: var(--blue); border-color: var(--blue); }
  body.lg-back .lg-pin-boxes span.cur::after { border-color: var(--blue); }
  body.lg-back .lg-pin-boxes span.cur { animation: none; }
  body.lg-back .lg-pin-boxes span.cur::before { display: none; }
}
body.lg-back .lg-links { flex-direction: row; justify-content: center; align-items: center; flex-wrap: wrap; gap: 0 4px; }

/* 숫자판 — 터치 화면에서만 (PC는 키보드) */
.lg-keypad {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.lg-keypad button {
  height: 64px;
  border: 0;
  border-radius: 14px;
  background: var(--bg);
  font-size: var(--fs-num);
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.lg-keypad button { user-select: none; -webkit-user-select: none; transition: background .1s, transform .08s; }
.lg-keypad button:active { background: var(--border); transform: scale(.96); }
.lg-keypad .lg-key-del { background: none; color: var(--text-2); display: flex; align-items: center; justify-content: center; }
@media (pointer: coarse) {
  body.lg-back .lg-keypad { display: grid; margin-top: auto; }   /* 엄지 닿는 아래쪽 */
  body.lg-back .lg-btn { display: none; }   /* 6자리 누르면 바로 로그인 */
  body.lg-back .lg-form { gap: 14px; }
}

/* 폰 — 다시 온 사람: 브랜드 띠를 낮게 */
@media (max-width: 1023px) {
  body.lg-back .lg-brand { padding: calc(28px + env(safe-area-inset-top)) 24px 48px; }
  body.lg-back .lg-hero { flex-direction: row; align-items: center; gap: 10px; }
  body.lg-back .lg-logo-mark { width: 30px; }
  body.lg-back .lg-word { font-size: var(--fs-lg); }
  body.lg-back .lg-tag { display: none; }
  body.lg-back .lg-panel { padding-top: 32px; }
}
/* 키 작은 폰(아이폰 SE 등 667px) — 한 화면에 다 들어오게 */
@media (max-width: 1023px) and (max-height: 700px) {
  .lg-brand { padding-top: calc(28px + env(safe-area-inset-top)); padding-bottom: 40px; }
  .lg-hero { gap: 10px; }
  .lg-logo-mark { width: 40px; }
  .lg-panel { padding-top: 22px; }
  .lg-form { gap: 14px; }
  .lg-field input[type=text] { height: 48px; }
  .lg-pin-boxes span { height: 48px; }
  .lg-btn { height: 50px; }
  body.lg-back .lg-panel { padding-top: 22px; }
  body.lg-back .lg-avatar { display: none; }
  body.lg-back .lg-form { gap: 10px; }
  .lg-keypad { gap: 8px; }
  .lg-keypad button { height: 52px; }
}

/* ── PC: 왼쪽 브랜드 판 + 오른쪽 입력 ── */
@media (min-width: 1024px) {
  .lg { flex-direction: row; }
  .lg-brand {
    width: min(44%, 640px);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 56px 64px;
    justify-content: space-between;
  }
  .lg-logo-full { display: block; position: relative; height: 56px; width: auto; align-self: flex-start; }
  .lg-logo-mark { display: none; }
  .lg-hero { gap: 20px; }
  .lg-word { font-size: 56px; }   /* 브랜드 글자 — 장식 크기(36px 이상) 예외 */
  .lg-tag { font-size: var(--fs-lg); color: rgba(255, 255, 255, 0.82); }
  .lg-tag-more { display: block; }
  .lg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    list-style: none;
  }
  .lg-chips li {
    height: 32px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    display: flex;
    align-items: center;
    font-size: var(--fs-sm);
    color: rgba(255, 255, 255, 0.88);
  }
  .lg-foot { display: block; position: relative; font-size: var(--fs-label); color: rgba(255, 255, 255, 0.7); }
  .lg-panel {
    margin-top: 0;
    border-radius: 0;
    align-items: center;
    padding: 48px;
  }
  .lg-h { font-size: var(--fs-num); font-weight: 800; }
  .lg-head .lg-sub { font-size: var(--fs-md); }
  .lg-head { margin-bottom: 8px; }
  .lg-field input[type=text] { height: 48px; }   /* 글씨는 16px 유지 — iPad 가로(PC 배치)에서 확대 방지 */
  .lg-pin-boxes span { height: 52px; }
  .lg-btn { height: 48px; }
  .lg-links { align-items: flex-start; text-align: left; }
  body.lg-back .lg-links { justify-content: center; align-items: center; text-align: center; }
}

/* ── 움직임 (v2.76.1) — 위치·투명도만 바꿔 폰에서도 끊김 없이 ── */
.lg-hero { animation: lg-fadein .45s ease-out both; }
.lg-panel { animation: lg-rise .34s cubic-bezier(.2, .8, .2, 1) both; }
.lg-form.lg-fade { animation: lg-fadein .22s ease-out; }
@keyframes lg-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes lg-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* 확인 중: 숫자판 잠금 + 점이 차례로 숨쉬기 */
.lg-keypad { transition: opacity .15s; }
body.lg-busy .lg-keypad { opacity: .45; pointer-events: none; }
body.lg-busy.lg-back .lg-pin-boxes span.on::after { animation: lg-pulse .9s ease-in-out infinite; }
body.lg-busy.lg-back .lg-pin-boxes span:nth-child(2)::after { animation-delay: .1s; }
body.lg-busy.lg-back .lg-pin-boxes span:nth-child(3)::after { animation-delay: .2s; }
body.lg-busy.lg-back .lg-pin-boxes span:nth-child(4)::after { animation-delay: .3s; }
body.lg-busy.lg-back .lg-pin-boxes span:nth-child(5)::after { animation-delay: .4s; }
body.lg-busy.lg-back .lg-pin-boxes span:nth-child(6)::after { animation-delay: .5s; }
@keyframes lg-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

/* 터치 화면의 다시 온 사람: 숨은 입력칸이 눌리지 않게 (자판·자동완성 막대가 뜨지 않게) */
@media (pointer: coarse) {
  body.lg-back .lg-pin-input { pointer-events: none; }
}

/* 움직임 줄이기 설정을 켠 사람 */
@media (prefers-reduced-motion: reduce) {
  .lg-hero, .lg-panel, .lg-form.lg-fade, .lg-pin.shake,
  body.lg-busy.lg-back .lg-pin-boxes span.on::after,
  .lg-pin-boxes span.cur, .lg-pin-boxes span.cur::before { animation: none; }
  .lg-keypad button:active { transform: none; }
}
