/* 로그인·회원가입 모달. 크기와 구조는 zxc 모달 실측을 따른다:
   머리줄 58px, 로그인 폭 456 / 가입 폭 560(높이 720 안에서 폼만 스크롤), 입력칸 43 / 가입 38, 제출 버튼 44,
   768px 이하에서는 로그인 344 / 가입 376 에 바깥 여백 8px. 색은 토끼카지노 것. */

html[data-modal="open"] { overflow: hidden; }

.auth-modal {
  width: min(456px, calc(100vw - 36px)); max-width: none; max-height: none;
  padding: 0; border: 0; background: none; color: var(--text); overflow: visible;
}
.auth-modal[data-tab="register"] { width: min(560px, calc(100vw - 36px)); }
.auth-modal::backdrop { background: rgba(12, 8, 18, .86); -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px); }
.am-box {
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 36px);
  background: var(--panel); border-radius: 20px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 28px 70px rgba(6, 3, 10, .6);
}
.auth-modal[data-tab="register"] .am-box { height: min(720px, calc(100dvh - 36px)); }

.am-head {
  flex: none; height: 58px; padding: 0 10px 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.am-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.am-brand { display: inline-flex; align-items: center; gap: 7px; }
.am-secure { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.am-brand .logo-mark { width: 26px; height: 29px; }
.am-brand .logo-word { flex-direction: row; font-size: 21px; }
.am-close {
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--tile); color: var(--text-2);
  transition: background .14s, color .14s;
}
.am-close:hover { background: var(--tile-hover); color: var(--text); }

.am-tabs {
  flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  margin: 16px 20px 0; padding: 4px; border-radius: 12px; background: var(--bg);
}
.am-tabs button { height: 38px; border-radius: 9px; font-size: 14px; font-weight: 800; color: var(--muted); transition: background .14s, color .14s; }
.am-tabs button:hover { color: var(--text-2); }
.am-tabs button.is-active { background: var(--carrot); color: var(--carrot-ink); }

.am-panel { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.am-panel[hidden] { display: none; }
.am-panel h2 { font-family: var(--f-display); font-weight: 400; font-size: 24px; line-height: 1.2; }
.am-sub { margin-top: -10px; font-size: 13.5px; color: var(--text-2); }

.am-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.am-label { padding: 0; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.am-input, .am-select {
  width: 100%; height: 43px; padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 15px; outline: 0;
  transition: border-color .14s, box-shadow .14s;
}
#am-register .am-input, #am-register .am-select { height: 38px; font-size: 14px; }
.am-input::placeholder { color: var(--muted); }
.am-input:focus-visible, .am-select:focus-visible { border-color: var(--carrot); box-shadow: 0 0 0 3px rgba(255, 138, 31, .2); border-radius: 8px; }
.am-input[readonly], .am-select:disabled { color: var(--text-2); background: rgba(27, 21, 36, .55); }
.am-input[aria-invalid="true"] { border-color: #ff8f8f; }
.am-select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.am-select:disabled { padding-right: 12px; background-image: none; }
.am-select option { background: var(--panel); color: var(--text); }
.am-hint { font-size: 12px; line-height: 1.45; color: var(--muted); }
.am-error { font-size: 12px; line-height: 1.45; color: #ff9d9d; }
.am-error:empty, .am-status:empty { display: none; }
.am-status { padding: 9px 12px; border-radius: 8px; background: rgba(255, 233, 184, .08); font-size: 12.5px; line-height: 1.45; color: var(--moon); }

/* 보안 확인 자리 */
.am-captcha {
  position: relative; display: grid; grid-template-columns: 22px 1fr; column-gap: 12px; align-items: center;
  padding: 11px 14px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 8px; background: var(--bg); cursor: pointer;
}
.am-captcha input { position: absolute; opacity: 0; width: 22px; height: 22px; left: 14px; top: 11px; margin: 0; cursor: pointer; }
.am-captcha i { grid-row: span 2; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--muted); display: grid; place-items: center; color: transparent; transition: background .14s, border-color .14s; }
.am-captcha .ico { width: 13px; height: 13px; }
.am-captcha input:checked + i { background: var(--leaf); border-color: var(--leaf); color: #10301a; }
.am-captcha input:focus-visible + i { outline: 2px solid var(--carrot); outline-offset: 2px; }
.am-captcha span { font-size: 14px; font-weight: 700; }
.am-captcha small { font-size: 11.5px; color: var(--muted); }

.am-forgot { align-self: flex-end; margin: -4px 0; font-size: 13px; color: var(--text-2); }
.am-forgot:hover, .am-link:hover, .am-switch button:hover { text-decoration: underline; }
.am-submit {
  flex: none; height: 44px; border-radius: 10px;
  background: var(--carrot); color: var(--carrot-ink); font-size: 15px; font-weight: 800;
  transition: background .14s, transform .14s;
}
.am-submit:hover:not(:disabled) { background: var(--carrot-hi); }
.am-submit:active:not(:disabled) { transform: scale(.985); }
.am-submit:disabled { background: var(--tile-solid); color: var(--muted); cursor: not-allowed; }
.am-switch { text-align: center; font-size: 13.5px; color: var(--text-2); }
.am-switch button, .am-link { color: var(--carrot); font-weight: 800; font-size: 13px; }
.am-switch button { font-size: 13.5px; }

/* 회원 유형 */
.am-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.am-type {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 56px; padding: 8px 12px 8px 38px;
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 10px; background: var(--bg); cursor: pointer;
  transition: border-color .14s, background .14s;
}
.am-type input { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin: -8px 0 0; accent-color: var(--carrot); cursor: pointer; }
.am-type span { font-size: 13.5px; font-weight: 700; }
.am-type small { font-size: 11.5px; color: var(--muted); }
.am-type:has(input:checked) { border-color: var(--carrot); background: var(--carrot-tint); }
.am-type:has(input:focus-visible) { outline: 2px solid var(--carrot); outline-offset: 2px; }

/* 비밀번호 강도 + 필수 조건 */
.am-meter { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.am-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.am-bars i { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .1); transition: background .16s; }
.am-meter-text { font-weight: 700; color: var(--text-2); }
.am-meter[data-level="1"] .am-bars i:nth-child(-n+1) { background: #ff9d9d; }
.am-meter[data-level="2"] .am-bars i:nth-child(-n+2) { background: var(--moon); }
.am-meter[data-level="3"] .am-bars i:nth-child(-n+3) { background: var(--leaf); }
.am-meter[data-level="4"] .am-bars i { background: var(--leaf); }
.am-meter[data-level="3"] .am-meter-text, .am-meter[data-level="4"] .am-meter-text { color: var(--leaf); }
.am-rules { padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 12px; }
.am-rules p { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: var(--muted); }
.am-rules p b { color: var(--text-2); }
.am-rules li { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.am-rules li i { width: 14px; text-align: center; font-style: normal; color: var(--muted); }
.am-rules li.is-ok { color: var(--leaf); }
.am-rules li.is-ok i { color: var(--leaf); }

/* 계좌·휴대전화·추천인 */
.am-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.am-wide { grid-column: 1 / -1; }
.am-phone { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 8px; }
.am-phone-code { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.am-phone-code[hidden] { display: none; }
.am-btn {
  height: 38px; padding: 0 14px; border-radius: 8px;
  background: var(--tile-solid); color: var(--text); font-size: 13.5px; font-weight: 700; white-space: nowrap;
  transition: background .14s;
}
.am-btn:hover:not(:disabled) { background: var(--tile-hover); }
.am-btn:disabled { color: var(--muted); cursor: not-allowed; }
.am-btn.is-done { background: rgba(115, 224, 127, .14); color: var(--leaf); }
.am-ref-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#am-ref-body { display: flex; flex-direction: column; gap: 6px; }
#am-ref-body[hidden] { display: none; }

@media (max-width: 768px) {
  .auth-modal { width: min(344px, calc(100vw - 16px)); }
  .auth-modal[data-tab="register"] { width: min(376px, calc(100vw - 16px)); }
  .am-box, .auth-modal[data-tab="register"] .am-box { max-height: calc(100dvh - 16px); border-radius: 15px; }
  .auth-modal[data-tab="register"] .am-box { height: min(760px, calc(100dvh - 16px)); }
  .am-head { height: 54px; padding-left: 18px; }
  .auth-modal[data-tab="login"] .am-head { height: 50px; }
  .am-close { width: 36px; height: 36px; }
  .am-tabs { margin: 14px 16px 0; }
  .am-panel { padding: 18px 16px 20px; }
  /* 아이폰이 입력칸을 확대하지 않게 16px */
  .am-input, .am-select, #am-register .am-input, #am-register .am-select { font-size: 16px; }
  .am-phone { grid-template-columns: 88px minmax(0, 1fr) auto; }
}
@media (max-width: 520px) {
  .am-types { grid-template-columns: 1fr; }
  /* 좁은 화면에서는 "은행을 선택해 주세요." 가 잘리지 않게 은행명·계좌번호를 한 줄씩 */
  .am-grid2 { grid-template-columns: 1fr; }
}
