/* =============================================================================
   계이득 웹 — 가입·로그인 페이지 (WSA)
   site.css 토큰만 사용. 새 토큰 발명 금지 (DESIGN.md).
   ============================================================================= */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 헤더: 홈과 같은 골격, 중앙 메뉴 없이 로고/액션만 */
.auth-header {
  grid-template-columns: auto 1fr;
}

.auth-header .header-actions {
  justify-self: end;
}

.auth-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px 16px 56px;
}

[data-auth-page="signup"] {
  --muted: var(--ink-soft);
  background:
    radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--blue) 14%, transparent), transparent 28rem),
    radial-gradient(circle at 88% 78%, color-mix(in srgb, var(--yellow) 10%, transparent), transparent 30rem),
    var(--page);
}

[data-auth-page="signup"] .auth-main {
  width: min(1080px, calc(100% - 40px));
  grid-template-columns: minmax(280px, 0.86fr) minmax(480px, 1.14fr);
  gap: clamp(40px, 7vw, 88px);
  align-items: center;
  justify-items: stretch;
  margin: 0 auto;
  padding: 48px 0 72px;
}

.auth-intro {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: clamp(28px, 4vw, 44px);
  border: var(--border);
  border-radius: var(--radius-big);
  background: var(--yellow);
  box-shadow: 8px 8px 0 var(--hard);
  color: var(--ink-fix);
  transform: rotate(-1deg);
}

.auth-intro::after {
  position: absolute;
  right: -54px;
  bottom: -54px;
  width: 144px;
  height: 144px;
  content: "";
  border: var(--border);
  border-radius: 50%;
  background: var(--pink);
}

.auth-intro-kicker {
  margin: 0 0 18px;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.auth-intro-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--font-fun);
  font-weight: 400;
  color: var(--ink-fix);
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 1.06;
  text-wrap: balance;
}

.auth-intro-title span {
  color: var(--blue);
}

.auth-intro-copy {
  position: relative;
  z-index: 1;
  max-width: 42ch;
  margin: 22px 0 24px;
  font-weight: 700;
  line-height: 1.7;
  text-wrap: pretty;
}

.auth-benefits {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-benefits li {
  display: grid;
  grid-template-columns: minmax(96px, 0.72fr) minmax(0, 1.28fr);
  gap: 12px;
  padding: 12px 0;
  border-top: var(--bw-sm) dashed color-mix(in srgb, var(--ink-fix) 42%, transparent);
}

.auth-benefits strong {
  font-family: var(--font-fun);
  font-weight: 400;
}

.auth-benefits span {
  font-size: 0.9rem;
  font-weight: 650;
}

.auth-intro-note {
  position: relative;
  z-index: 1;
  display: inline-flex;
  margin: 22px 0 0;
  padding: 7px 12px;
  border: var(--border-sm);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 850;
  box-shadow: 3px 3px 0 var(--hard);
}

.auth-card {
  width: min(480px, 100%);
  display: grid;
  gap: 20px;
  padding: 28px 24px;
  border: 1px solid var(--gw-border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

[data-auth-page="signup"] .auth-card {
  width: 100%;
  max-width: 520px;
  justify-self: end;
  gap: 24px;
  padding: 32px;
  border: var(--border);
  border-radius: var(--radius-big);
  box-shadow: 8px 8px 0 var(--hard);
}

.auth-heading {
  display: grid;
  gap: 6px;
}

.auth-heading h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 930;
  line-height: 1.12;
}

.auth-heading .eyebrow {
  margin: 0;
  color: var(--blue-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

[data-auth-page="signup"] .auth-heading .eyebrow {
  width: auto;
  justify-self: start;
  padding: 5px 12px;
  border: var(--border-sm);
  border-radius: 999px;
  background: var(--mint);
  box-shadow: 2px 2px 0 var(--hard);
  color: var(--ink-fix);
  transform: none;
}

[data-auth-page="signup"] .auth-heading h1 {
  font-size: clamp(2rem, 4vw, 2.55rem);
  line-height: 1.08;
  text-wrap: balance;
}

.auth-lead {
  margin: 0;
  color: var(--secondary);
  font-size: 14px;
}

/* 단계 표시 */
.auth-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-steps li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--gw-border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.auth-steps li span {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--secondary);
  font-size: 11px;
}

.auth-steps li.is-active {
  border-color: var(--blue);
  color: var(--primary);
}

.auth-steps li.is-active span {
  background: var(--blue);
  color: var(--on-blue);
}

.auth-steps li.is-done {
  color: var(--secondary);
}

.auth-steps li.is-done span {
  background: color-mix(in srgb, var(--green) 65%, var(--ink-fix));
  color: var(--on-blue);
}

:root[data-theme="dark"] [data-auth-page="signup"] .auth-steps li.is-active span,
:root[data-theme="dark"] [data-auth-page="signup"] .button.primary {
  background: var(--blue-deep);
  color: var(--ink-fix);
}

[data-auth-page="signup"] .button.primary:disabled {
  border-color: var(--edge);
  background: var(--surface-3);
  box-shadow: 2px 2px 0 var(--hard-soft);
  color: var(--ink-soft);
  opacity: 1;
}

:root[data-theme="dark"] [data-auth-page="signup"] .button.primary:disabled {
  background: var(--surface-3);
  color: var(--ink-soft);
}

.auth-step {
  display: grid;
  gap: 16px;
}

.auth-substep-note {
  margin: 0;
  color: var(--secondary);
  font-size: 14px;
}

/* 역할 카드 */
.role-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.role-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 18px 16px;
  border: 1px solid var(--gw-border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--primary);
  text-align: left;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--hard-soft);
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 160ms ease;
}

.role-card::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transform: scaleX(0);
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 120ms ease;
}

.role-card[data-role="streamer"]::before {
  background: color-mix(in srgb, var(--mint) 36%, var(--surface-2));
  transform-origin: left center;
}

.role-card[data-role="viewer"]::before {
  background: color-mix(in srgb, var(--lav) 36%, var(--surface-2));
  transform-origin: right center;
}

.role-card:hover,
.role-card:focus-visible {
  transform: translateY(-4px) scale(1.015);
  box-shadow: 6px 7px 0 var(--hard-soft);
}

.role-card:hover::before,
.role-card:focus-visible::before {
  opacity: 1;
  transform: scaleX(1);
}

.role-card[data-role="streamer"]:hover,
.role-card[data-role="streamer"]:focus-visible {
  border-color: var(--green);
}

.role-card[data-role="viewer"]:hover,
.role-card[data-role="viewer"]:focus-visible {
  border-color: var(--blue);
}

.role-card:active {
  transform: translate(1px, 1px) scale(0.985);
  box-shadow: 1px 1px 0 var(--hard-soft);
}

.role-card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.role-card strong {
  position: relative;
  z-index: 1;
  font-size: 16px;
  font-weight: 900;
}

.role-card span {
  position: relative;
  z-index: 1;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.5;
}

.role-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* 폼 (auth-card 안이므로 카드 테두리 없이 — 카드 안 카드 금지) */
.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 900;
}

.auth-form input {
  width: 100%;
  min-height: 48px; /* 터치 타깃 44px+ */
  padding: 10px 12px;
  border: 1px solid var(--gw-border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--primary);
  font-size: 16px; /* iOS 포커스 확대 방지 */
}

.auth-form input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.auth-consents {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--gw-border);
  border-radius: var(--radius);
}

.auth-consents label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  line-height: 1.5;
}

.auth-consents input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px;
  min-height: 18px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--blue);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-actions .button {
  flex: 1;
  min-width: 120px;
  min-height: 48px; /* 터치 타깃 44px+ */
}

/* 핸들 입력 */
.handle-field {
  display: flex;
  align-items: stretch;
}

.handle-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--gw-border);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--surface-3);
  color: var(--secondary);
  font-weight: 900;
}

.handle-field input {
  flex: 1;
  min-width: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.handle-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.handle-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.handle-status.is-ok {
  color: var(--green);
}

.handle-status.is-bad {
  color: var(--danger);
}

/* 소셜 로그인 [예약] */
.social-block {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.social-title {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.social-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.social-button {
  min-height: 44px; /* 터치 타깃 44px+ */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--gw-border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--secondary);
  font-size: 14px;
  font-weight: 850;
  cursor: not-allowed;
  opacity: 1;
  flex-direction: column;
}

.soon-badge {
  padding: 2px 8px;
  border: 1px solid var(--gw-border);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.auth-alt {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--secondary);
  font-size: 14px;
}

.auth-alt a {
  color: var(--blue-2);
  font-weight: 850;
  text-decoration: none;
}

.auth-alt a:hover {
  text-decoration: underline;
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 20px 16px 32px;
  border-top: 1px solid var(--line);
}

.auth-footer a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--primary);
}

/* =============================================================================
   /login 역할 탭 (login.html 전용 — role-split login 레인)
   ⚠ login.html은 web-tokens.css 없이 site.css만 로드한다(브리지의 --border 색상
   재정의가 site.css의 --border 보더 축약형과 충돌하기 때문). 따라서 이 구획은
   site.css 원 토큰(--bw-sm/--edge/--radius-sm/--surface-2/--blue/--hard-soft…)만
   사용한다. 위쪽 .auth-* 구획과 토큰 이름을 섞지 말 것.
   ============================================================================= */

.login-role-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 22px;
  padding: 6px;
  border: var(--bw-sm) solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.login-role-tab {
  min-height: 44px; /* 터치 타깃 44px+ */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: var(--bw-sm) solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 800;
  word-break: keep-all;
  cursor: pointer;
}

.login-role-tab[aria-selected="true"] {
  border-color: var(--edge);
  background: var(--blue);
  color: var(--on-blue);
  box-shadow: 3px 3px 0 var(--hard-soft);
}

.login-role-tab:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.viewer-login-links {
  margin: 2px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
  font-size: 0.9rem;
  font-weight: 800;
}

.viewer-login-links a {
  min-height: 44px; /* 터치 타깃 44px+ */
  display: inline-flex;
  align-items: center;
  color: var(--blue-deep);
  text-decoration: none;
  word-break: keep-all;
}

.viewer-login-links a:hover,
.viewer-login-links a:focus-visible {
  text-decoration: underline;
}

/* 모바일 360px */
@media (max-width: 480px) {
  .auth-main {
    padding: 24px 12px 40px;
    align-items: start;
  }

  .auth-card {
    padding: 22px 16px;
  }

  [data-auth-page="signup"] .auth-main {
    width: min(100% - 24px, 640px);
    padding: 24px 0 48px;
  }

  .auth-intro {
    padding: 24px 20px 28px;
    border-radius: var(--radius);
  }

  .auth-intro-title {
    font-size: 2.25rem;
  }

  .auth-intro-copy {
    margin: 16px 0 18px;
  }

  .auth-benefits li {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 9px 0;
  }

  .auth-intro-note {
    max-width: calc(100% - 28px);
    border-radius: var(--radius-sm);
  }

  [data-auth-page="signup"] .auth-card {
    padding: 24px 16px;
    border-radius: var(--radius);
  }

  .role-cards {
    grid-template-columns: 1fr;
  }

  .auth-actions .button {
    min-width: 100%;
  }

  .social-row {
    grid-template-columns: 1fr;
  }

  .social-button {
    flex-direction: row;
  }
}

@media (max-width: 900px) {
  [data-auth-page="signup"] .auth-main {
    width: min(640px, calc(100% - 32px));
    grid-template-columns: 1fr;
    gap: 32px;
    align-items: start;
  }

  [data-auth-page="signup"] .auth-card {
    max-width: none;
    justify-self: stretch;
  }

  .auth-intro {
    transform: none;
  }
}

/* 스트리머 탭 무요금제 폴백 — 같은 아이디로 시청자 로그인 원클릭 */
.viewer-fallback {
  margin-top: 12px;
  padding: 12px;
  border: 2px dashed var(--surface-3, rgba(23, 38, 92, 0.16));
  border-radius: 10px;
}
.viewer-fallback-note {
  margin: 0 0 10px;
  font-size: 14px;
  word-break: keep-all;
}
.viewer-fallback .button {
  min-height: 44px;
}
