:root {
  --pink: #ff84cd;
  --pink-hover: #ff69c1;
  --pink-light: #fff0f8;
  --text: #2b2b2b;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --kakao: #fee500;
  --kakao-hover: #fddc3f;
  --radius: 12px;
  --radius-lg: 32px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: 0 20px 50px rgba(17, 24, 39, 0.08);
}

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
  touch-action: manipulation;
}

.back-home:hover {
  color: var(--pink);
}

.back-home.hidden {
  display: none;
}

.brand h1 {
  margin: 0 0 12px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.brand .accent {
  color: var(--pink);
}

.brand p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.required {
  color: #ef4444;
}

.field input[type='text'],
.field input[type='email'],
.field input[type='password'] {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f9fafb;
  font-size: 16px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.field input::placeholder {
  color: #9ca3af;
}

.field input:focus {
  outline: none;
  border-color: var(--pink);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 132, 205, 0.15);
}

.field-row {
  display: flex;
  gap: 8px;
}

.field-row input {
  flex: 1;
  min-width: 0;
}

.hint {
  margin: 0;
  font-size: 12px;
  color: #9ca3af;
  font-weight: 500;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: #4b5563;
  cursor: pointer;
  user-select: none;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--pink);
  flex-shrink: 0;
  cursor: pointer;
}

.checkbox-row em {
  font-style: normal;
  color: #9ca3af;
  font-size: 13px;
}

.agreements {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.btn-primary {
  width: 100%;
  min-height: 48px;
  height: 48px;
  margin-top: 4px;
  border: none;
  border-radius: var(--radius);
  background: var(--pink);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 132, 205, 0.35);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  touch-action: manipulation;
}

.btn-primary:hover:not(:disabled) {
  background: var(--pink-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled,
.btn-outline:disabled,
.btn-social:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-outline {
  flex-shrink: 0;
  min-height: 48px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
  touch-action: manipulation;
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--pink);
  color: var(--pink);
}

.divider {
  position: relative;
  margin: 24px 0 20px;
  text-align: center;
}

.divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #f3f4f6;
}

.divider span {
  position: relative;
  display: inline-block;
  padding: 0 16px;
  background: #fff;
  color: #d1d5db;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  height: 48px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  touch-action: manipulation;
}

.btn-social:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-google {
  border: 1px solid var(--border);
  background: #fff;
  color: #374151;
}

.btn-google:hover:not(:disabled) {
  background: #f9fafb;
}

.btn-kakao {
  border: none;
  background: var(--kakao);
  color: #3c1e1e;
}

.btn-kakao:hover:not(:disabled) {
  background: var(--kakao-hover);
}

.footer-link {
  margin: 28px 0 0;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}

.link {
  border: none;
  background: none;
  padding: 4px 2px;
  color: var(--pink);
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  touch-action: manipulation;
}

.link:hover {
  color: var(--pink-hover);
}

.message {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  border-left: 4px solid transparent;
}

.message.error {
  background: #fef2f2;
  color: #b91c1c;
  border-left-color: #ef4444;
}

.message.success {
  background: #f0fdf4;
  color: #15803d;
  border-left-color: #22c55e;
}

.message.hidden {
  display: none;
}

/* 태블릿 */
@media (max-width: 768px) {
  .card {
    padding: 36px 28px;
    box-shadow: 0 12px 36px rgba(17, 24, 39, 0.06);
  }

  .brand p {
    font-size: 14px;
    margin-bottom: 24px;
  }
}

/* 모바일 */
@media (max-width: 520px) {
  .page {
    align-items: flex-start;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .card {
    max-width: none;
    padding: 28px 20px;
    border-radius: 20px;
    border: none;
    box-shadow: 0 8px 28px rgba(17, 24, 39, 0.06);
  }

  .brand h1 {
    font-size: 1.625rem;
  }

  .brand p {
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 20px;
  }

  .form {
    gap: 14px;
  }

  /* 이메일 + 인증번호 버튼 세로 배치 */
  .field-row {
    flex-direction: column;
    gap: 10px;
  }

  .btn-outline {
    width: 100%;
  }

  .divider {
    margin: 20px 0 16px;
  }

  .footer-link {
    margin-top: 24px;
    font-size: 14px;
    line-height: 1.6;
  }

  .agreements {
    gap: 10px;
  }

  .checkbox-row {
    font-size: 13px;
    gap: 12px;
    padding: 2px 0;
  }

  .checkbox-row em {
    font-size: 12px;
  }
}

/* 소형 폰 (iPhone SE 등) */
@media (max-width: 380px) {
  .card {
    padding: 24px 16px;
    border-radius: 16px;
  }

  .brand h1 {
    font-size: 1.5rem;
  }

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

  .btn-social {
    height: 52px;
  }
}

/* 가로 모드 — 키보드·짧은 높이 */
@media (max-height: 520px) and (orientation: landscape) {
  .page {
    align-items: flex-start;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .card {
    margin: 0 auto;
  }

  .brand {
    margin-bottom: 4px;
  }

  .brand h1 {
    font-size: 1.375rem;
    margin-bottom: 6px;
  }

  .brand p {
    margin-bottom: 14px;
    font-size: 13px;
  }

  .form {
    gap: 10px;
  }

  .divider {
    margin: 14px 0 12px;
  }

  .footer-link {
    margin-top: 16px;
  }
}
