/* =========================================================
   THE MAZE AWAITS — 로그인 / 회원가입
   이미지 에셋 (assets/ 폴더에 넣으면 자동 적용, 없으면 CSS 대체색 사용)
   - bg-main.jpg      : UI 없는 메인 배경 (PC용, 가로)
   - bg-main-m.jpg    : 모바일 세로 크롭 (선택)
   - btn-stone.jpg    : 돌 질감 버튼 텍스처
   - panel-stone.jpg  : 회원가입 패널 텍스처
   ========================================================= */

:root {
  color-scheme: dark;

  /* 색 */
  --ink: #e9e6df;          /* 기본 글자 */
  --ink-dim: #a29f98;      /* 보조 글자 */
  --ink-faint: #6f6c66;    /* 힌트, 영문 장식 */
  --line: rgba(233, 230, 223, 0.18);
  --line-strong: rgba(233, 230, 223, 0.42);
  --panel: rgba(14, 15, 14, 0.72);
  --field: rgba(8, 9, 8, 0.55);
  --danger: #d0826a;
  --ok: #9fb48e;

  /* 글꼴 */
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;

  /* 크기 */
  --field-h: 46px;
  --radius: 2px;

  /* 안전 영역 (노치) */
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #0d0f0e;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all; /* 한글 단어 중간에서 줄바꿈 방지 */
  overflow-x: hidden;
}
p, h1, h2 { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 배경 ---------- */
.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 70%, rgba(0,0,0,.45) 100%),
    url("../assets/bg-main.jpg") center 45% / cover no-repeat,
    radial-gradient(ellipse at 50% 30%, #3a3d39 0%, #151715 55%, #0b0c0b 100%);
}

/* ---------- 상단 ---------- */
.top {
  position: absolute; inset: 0 0 auto;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: clamp(24px, 4vw, 38px) clamp(20px, 4.4vw, 72px);
  padding-top: calc(clamp(24px, 4vw, 38px) + env(safe-area-inset-top, 0px));
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 26px; }
.brand__logo {
  width: 52px; height: 74px; flex: none;
  fill: rgba(233,230,223,.55); stroke: rgba(233,230,223,.25); stroke-width: .6;
}
.brand__title {
  font-size: 15px; font-weight: 400; letter-spacing: .32em; color: var(--ink-dim);
}
.brand__sub {
  margin-top: 14px;
  font-size: 11px; letter-spacing: .3em; color: var(--ink-faint);
}
.tagline {
  display: grid; gap: 14px; justify-items: end; margin-top: 18px;
  font-size: 11px; letter-spacing: .3em; color: var(--ink-faint);
}
.tagline span::after {
  content: ""; display: inline-block; width: 20px; height: 1px;
  margin-left: 14px; vertical-align: middle; background: var(--ink-faint);
}

/* ---------- 레이아웃 ---------- */
.stage {
  min-height: 100%;
  display: grid; justify-items: center; align-content: start;
  /* 시안처럼 화면 중앙보다 약간 아래 */
  padding: calc(54vh - 40px) 20px 40px;
}

/* ---------- 패널 공통 + 모서리 브래킷 ---------- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.panel::before {
  content: ""; position: absolute; inset: -7px; pointer-events: none;
  --c: var(--line-strong); --s: 14px;
  background:
    linear-gradient(var(--c) 0 0) top left    / var(--s) 1px,
    linear-gradient(var(--c) 0 0) top left    / 1px var(--s),
    linear-gradient(var(--c) 0 0) top right   / var(--s) 1px,
    linear-gradient(var(--c) 0 0) top right   / 1px var(--s),
    linear-gradient(var(--c) 0 0) bottom left / var(--s) 1px,
    linear-gradient(var(--c) 0 0) bottom left / 1px var(--s),
    linear-gradient(var(--c) 0 0) bottom right/ var(--s) 1px,
    linear-gradient(var(--c) 0 0) bottom right/ 1px var(--s);
  background-repeat: no-repeat;
}

/* ---------- 입력칸 ---------- */
.field {
  position: relative; display: flex; align-items: center;
  min-width: 0;
  height: var(--field-h);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.field:focus-within { border-color: var(--line-strong); }
.field.is-invalid { border-color: var(--danger); }
.field__icon {
  width: 20px; height: 20px; margin: 0 14px 0 16px; flex: none;
  fill: none; stroke: var(--ink-dim); stroke-width: 1.3;
}
.field input {
  flex: 1; min-width: 0; width: 100%; height: 100%;
  padding: 0 14px 0 0;
  background: none; border: 0; outline: 0;
  font-size: 16px; /* 16px 미만이면 iOS가 확대함 */
}
.field input::placeholder { color: var(--ink-dim); }
.field__hint {
  position: absolute; right: 16px;
  font-size: 13px; color: var(--ink-faint); pointer-events: none;
  transition: opacity .15s;
}
.field input:not(:placeholder-shown) ~ .field__hint:not(.field__hint--timer) { opacity: 0; }
.field:has(.field__eye) .field__hint { right: 52px; }
.field__eye {
  display: grid; place-items: center;
  width: 44px; height: 100%; margin-right: 2px;
  background: none; border: 0;
}
.field__eye svg {
  width: 20px; height: 20px; fill: none; stroke: var(--ink-dim); stroke-width: 1.3;
}
.field__hint--timer { font-variant-numeric: tabular-nums; color: var(--ink-dim); }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 18px;
  height: var(--field-h); padding: 0 20px;
  border-radius: var(--radius);
  font-size: 16px; font-weight: 500; letter-spacing: .02em;
  transition: filter .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn--stone {
  color: #fff; font-weight: 700;
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35), 0 2px 10px rgba(0,0,0,.4);
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  background:
    url("../assets/btn-stone.jpg") center / cover,
    radial-gradient(ellipse at 30% 30%, #6f6b63 0%, #4f4c46 60%, #3d3b37 100%);
}
.btn--stone:not(:disabled):hover { filter: brightness(1.12); }
.btn--ghost {
  background: rgba(10,10,10,.35);
  border: 1px solid var(--line-strong);
}
.btn--ghost:hover { background: rgba(255,255,255,.06); }
.btn--sm { font-size: 15px; padding: 0 16px; }
.btn--lg { width: 100%; height: 60px; font-size: 19px; letter-spacing: .06em; }
.btn__arrow { width: 24px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.btn.is-loading { pointer-events: none; opacity: .7; }

.textlink {
  background: none; border: 0; padding: 4px 0;
  font-size: 13px; color: var(--ink-dim);
}
.textlink:hover { color: var(--ink); }
.textlink--under { text-decoration: underline; text-underline-offset: 4px; color: var(--ink); font-size: 14px; }

:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.field input:focus-visible { outline: 0; }

/* ---------- 체크박스 ---------- */
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--ink-dim); }
.check input {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 15px; height: 15px; border: 1px solid var(--line-strong); border-radius: 1px;
  background: var(--field); display: grid; place-items: center; cursor: pointer;
}
.check input::after {
  content: ""; width: 7px; height: 4px; margin-top: -2px;
  border: solid var(--ink); border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg);
  opacity: 0;
}
.check input:checked { border-color: var(--ink-dim); }
.check input:checked::after { opacity: 1; }
.check input:checked + span { color: var(--ink); }

/* ---------- 메시지 ---------- */
.form-msg { min-height: 0; font-size: 13px; text-align: center; color: var(--danger); }
.form-msg:empty { display: none; }
.form-msg.is-ok { color: var(--ok); }

/* =========================================================
   로그인 패널
   ========================================================= */
.login {
  width: min(610px, 100%);
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 12px 26px;
  padding: 22px 22px 18px;
}
.login__fields, .login__actions { display: grid; gap: 12px; align-content: start; }
.login__actions .btn--stone { height: calc(var(--field-h) + 6px); font-size: 17px; }
.login__actions .btn--ghost { height: calc(var(--field-h) - 6px); }
.login__options {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 18px;
  margin-top: 4px;
}
.login__options .textlink { margin-left: auto; }
.login .form-msg { grid-column: 1 / -1; }
.panel__motto {
  grid-column: 1 / -1;
  margin-top: 4px;
  text-align: center; font-size: 11px; letter-spacing: .32em; color: var(--ink-faint);
}

/* =========================================================
   회원가입 모달
   ========================================================= */
.modal {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 7px; /* 브래킷이 잘리지 않도록 */
  margin: auto;
  background: none; border: 0; color: inherit;
  overflow: visible;
}
.modal::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.modal[open] { animation: rise .28s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.signup {
  max-height: calc(100dvh - 46px);
  overflow: hidden auto;
  padding: 40px clamp(20px, 6vw, 44px) 26px;
  text-align: center;
  background:
    url("../assets/panel-stone.jpg") center / cover,
    radial-gradient(ellipse at 50% 0%, #252623 0%, #151614 55%, #101110 100%);
  border-color: var(--line);
}
.signup__eyebrow { font-size: 11px; letter-spacing: .32em; color: var(--ink-faint); }
.signup__title {
  margin-top: 14px;
  font-size: clamp(32px, 7vw, 40px); font-weight: 700; letter-spacing: .14em;
  text-indent: .14em; /* 자간으로 생긴 오른쪽 여백 보정 */
}
.signup__lead { margin-top: 14px; font-size: 14px; letter-spacing: .12em; color: var(--ink-dim); line-height: 1.6; }
.rule { margin: 26px 0; height: 1px; border: 0; background: var(--line); }

.signup__fields { display: grid; gap: 14px; text-align: left; }
.signup .field { height: 50px; }
.field-row { display: grid; grid-template-columns: 1fr 150px; gap: 14px; }
.field-row .btn { height: 50px; }
.field-row.code-row { grid-template-columns: 1fr; gap: 8px; }
.code-row:not([hidden]) { animation: rise .25s ease-out; }
.reset-step { display: grid; gap: 14px; animation: rise .25s ease-out; }
.code-row__note { font-size: 12px; color: var(--ink-faint); padding-left: 2px; }

.signup .form-msg { margin-top: 16px; }
.signup .btn--lg { margin-top: 26px; }
.signup__foot { font-size: 14px; color: var(--ink-dim); }
.signup__foot .textlink { margin-left: 10px; }

/* =========================================================
   안내 모달
   ========================================================= */
.modal--notice { width: min(400px, calc(100% - 32px)); }
.notice {
  display: grid; gap: 14px;
  padding: 36px clamp(20px, 6vw, 32px) 28px;
  text-align: center;
  background:
    url("../assets/panel-stone.jpg") center / cover,
    radial-gradient(ellipse at 50% 0%, #252623 0%, #151614 55%, #101110 100%);
}
.notice__title { font-size: 24px; font-weight: 700; letter-spacing: .1em; text-indent: .1em; }
.notice__body { font-size: 14px; line-height: 1.7; color: var(--ink-dim); white-space: pre-line; }
.notice__btn { width: 100%; margin-top: 10px; }

/* =========================================================
   반응형
   ========================================================= */
@media (max-width: 900px) {
  .tagline { display: none; }
}

@media (max-width: 640px) {
  .bg {
    background:
      linear-gradient(180deg, rgba(0,0,0,.4) 0%, rgba(0,0,0,0) 25%, rgba(0,0,0,.2) 55%, rgba(0,0,0,.7) 100%),
      url("../assets/bg-main-m.jpg") center / cover no-repeat,
      url("../assets/bg-main.jpg") 50% 45% / cover no-repeat,
      radial-gradient(ellipse at 50% 30%, #3a3d39 0%, #151715 55%, #0b0c0b 100%);
  }
  .brand { gap: 16px; }
  .brand__logo { width: 34px; height: 48px; }
  .brand__title { font-size: 13px; letter-spacing: .26em; }
  .brand__sub { margin-top: 8px; font-size: 10px; letter-spacing: .2em; }

  .stage { padding-top: 38vh; align-content: start; }
  .login { grid-template-columns: 1fr; padding: 18px 16px 16px; }
  .login__actions .btn--stone,
  .login__actions .btn--ghost { height: var(--field-h); }
  .login__options { flex-wrap: wrap; gap: 14px; }

  .field-row { grid-template-columns: 1fr 112px; gap: 10px; }
  .signup .field__hint { font-size: 12px; }
}

@media (max-width: 360px) {
  .field-row { grid-template-columns: 1fr; }
  .signup .field__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 스크롤바 숨김 (스크롤은 그대로 가능) ---------- */
html, .signup {
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* 구형 Edge */
}
html::-webkit-scrollbar,
.signup::-webkit-scrollbar { display: none; }  /* Chrome, Safari, Whale */
