:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --accent: #c026d3;
  --success: #047857;
  --danger: #b91c1c;
  --bg: #f9fafb;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1a1a2e;
  --muted: #6b7280;
  --muted-light: #9ca3af;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.topbar-logo,
.auth-brand-mark {
  color: var(--primary-dark);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.topbar-logo {
  font-size: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  background: var(--border);
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 60px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  text-decoration: none;
}

.auth-brand-mark {
  font-size: 22px;
}

.auth-brand-badge {
  padding: 3px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.auth-heading {
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.35;
}

.auth-description {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.auth-notice {
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.auth-notice-error {
  background: #fee2e2;
  color: var(--danger);
}

.auth-notice-success {
  background: #ecfdf5;
  color: var(--success);
}

.auth-notice-static {
  display: block;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: block;
}

.auth-field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  outline: 0;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.auth-input[aria-invalid="true"] {
  border-color: var(--danger);
}

.auth-field-hint {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.auth-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 13px 14px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.15s, opacity 0.15s;
}

.auth-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
  color: #fff;
}

.auth-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.auth-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.auth-text-link {
  display: block;
  margin-top: 18px;
  padding: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  text-decoration: none;
}

.auth-text-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.website-field {
  position: fixed;
  top: -10000px;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.auth-state {
  padding: 8px 0 2px;
  text-align: center;
}

.auth-state-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  background: #fee2e2;
  color: var(--danger);
  font-size: 24px;
  font-weight: 800;
}

.auth-state-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
}

.auth-state-copy {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.auth-spinner {
  display: block;
  width: 36px;
  height: 36px;
  margin: 4px auto 16px;
  border: 3px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

.footer {
  padding: 20px;
  color: var(--muted-light);
  font-size: 11px;
  text-align: center;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .topbar {
    padding: 12px 16px;
  }

  .auth-main {
    align-items: flex-start;
    padding: 28px 16px 44px;
  }

  .auth-card {
    padding: 28px 24px;
  }

  .auth-heading {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
