@layer components {
  .auth-page {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    margin: -1.5rem;
    background-color: #f0ede8;
  }

  .auth-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 20px;
    padding: var(--padding-extra-large);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 16px 48px rgba(0, 0, 0, 0.08);
  }

  .auth-wave {
    display: block;
    margin-bottom: 1.75rem;
  }

  .auth-title {
    font-family: 'Syne', system-ui, sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: #0d0d0d;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 0.35rem;
  }

  .auth-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 2rem;
  }

  .auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  .auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .auth-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #374151;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-family: 'Figtree', system-ui, sans-serif;
  }

  .auth-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    color: #0d0d0d;
    background: #f9f9f7;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.15s ease;
    font-family: 'Figtree', system-ui, sans-serif;
    appearance: none;
  }

  .auth-input:focus {
    outline: none;
    background: #ffffff;
    border-color: #ff2800;
    box-shadow: 0 0 0 3px rgba(255, 40, 0, 0.08);
  }

  .auth-input::placeholder {
    color: #9ca3af;
  }

  .auth-submit {
    width: 100%;
    padding: 0.9375rem 1.5rem;
    font-family: 'Figtree', system-ui, sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #ffffff;
    background: #ff2800;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.01em;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }

  .auth-submit:hover {
    background: #e52400;
    box-shadow: 0 4px 20px rgba(255, 40, 0, 0.28);
    transform: translateY(-1px);
  }

  .auth-submit:active {
    transform: translateY(0);
    box-shadow: none;
  }

  .auth-submit[disabled],
  .auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }

  .auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: var(--margin-large) calc(var(--padding-extra-large) * -1);
    color: #9ca3af;
    font-size: 0.8125rem;
  }

  .auth-divider::before,
  .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #f3f4f6;
  }

  .auth-passkey-btn {
    width: 100%;
    padding: 0.9375rem 1.5rem;
    font-family: 'Figtree', system-ui, sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #374151;
    background: #f9f9f7;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }

  .auth-passkey-btn:hover {
    background: #ffffff;
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  .auth-passkey-btn--register {
    background: #0d0d0d;
    color: #ffffff;
    border-color: #0d0d0d;
    margin-bottom: 0.75rem;
  }

  .auth-passkey-btn--register:hover {
    background: #1f2937;
    border-color: #1f2937;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
  }

  .auth-card--wide {
    max-width: 520px;
  }

  @keyframes auth-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
  }

  .auth-card--shake {
    animation: auth-shake 0.4s ease;
  }

  .auth-dev-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    font-size: 0.8125rem;
    color: #92400e;
  }

  .auth-dev-hint code {
    font-family: monospace;
    font-weight: 700;
    letter-spacing: 0.15em;
    font-size: 1.1em;
  }

  .auth-hint {
    font-size: 0.8125rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 0.5rem;
    margin-bottom: 0rem;
  }

  .auth-danger-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-family: 'Figtree', system-ui, sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #dc2626;
    background: transparent;
    border: 1.5px solid #fecaca;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 0.5rem;
  }

  .auth-danger-btn:hover {
    background: #fef2f2;
  }

  .auth-subtle {
    font-size: 0.8125rem;
    color: #9ca3af;
    text-align: center;
  }

  .auth-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    font-family: 'Figtree', system-ui, sans-serif;
  }

  .auth-link {
    color: #ff2800;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
  }

  .auth-link:hover {
    text-decoration: underline;
  }

  .auth-error {
    font-size: 0.8125rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 0.875rem 1rem;
    color: #dc2626;
    line-height: 1.5;
  }

  .auth-error h2 {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 0.35rem;
  }

  .auth-error ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }

  .auth-error li::before {
    content: "· ";
    font-weight: 700;
  }

  .auth-notice {
    font-size: 0.8125rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 0.875rem 1rem;
    color: #15803d;
    line-height: 1.5;
  }

  .auth-code-input {
    width: 100%;
    padding: 1rem;
    font-size: 2rem;
    font-family: 'Syne', system-ui, monospace;
    font-weight: 700;
    color: #0d0d0d;
    background: #f9f9f7;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    text-align: center;
    letter-spacing: 0.5em;
    transition: all 0.15s ease;
  }

  .auth-code-input:focus {
    outline: none;
    background: #ffffff;
    border-color: #ff2800;
    box-shadow: 0 0 0 3px rgba(255, 40, 0, 0.08);
  }

  .passkey-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .passkey-list__item {
    border-radius: 12px;
    border: 1.5px solid #e5e7eb;
    overflow: hidden;
    transition: border-color 0.15s;
  }

  .passkey-list__item:hover {
    border-color: #d1d5db;
  }

  .passkey-list__row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .passkey-list__icon {
    flex-shrink: 0;
  }

  .passkey-list__name-input {
    flex: 1;
    min-width: 0;
    font-family: 'Figtree', system-ui, sans-serif;
    font-weight: 600;
    font-size: 0.9375rem;
    color: #0d0d0d;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.25rem 0.4rem;
    margin: -0.25rem -0.4rem;
    transition: background 0.15s;
  }

  .passkey-list__name-input:focus {
    outline: none;
    background: #f9f9f7;
    box-shadow: 0 0 0 1.5px #e5e7eb;
  }

  .passkey-list__added {
    font-size: 0.8125rem;
    color: #9ca3af;
    white-space: nowrap;
  }

  .passkey-list__save-btn {
    flex-shrink: 0;
    font-family: 'Figtree', system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    background: #f9f9f7;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .passkey-list__save-btn:hover {
    background: #ffffff;
    border-color: #d1d5db;
  }

  .passkey-list__remove-form {
    border-top: 1px solid #f3f4f6;
  }

  .passkey-list__remove-btn {
    display: block;
    width: 100%;
    padding: 0.625rem 1rem;
    font-family: 'Figtree', system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #dc2626;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
  }

  .passkey-list__remove-btn:hover {
    background: #fef2f2;
  }

  @media (max-width: 640px) {
    .auth-page {
      padding: 2rem 1rem;
      margin: -1.5rem;
    }

    .auth-card {
      padding: 2rem 1.5rem;
      border-radius: 16px;
    }

    .auth-title {
      font-size: 1.75rem;
    }
  }
}

@layer native {
  .native-auth {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .native-auth__error {
    font-size: 0.875rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 0.875rem 1rem;
    color: #dc2626;
    line-height: 1.5;
  }

  .native-auth__form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  .native-auth__field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
  }

  .native-auth__label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #374151;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    font-family: 'Figtree', system-ui, sans-serif;
  }

  .native-auth__input {
    width: 100%;
    padding: 0.9375rem 1rem;
    font-size: 1rem;
    color: #0d0d0d;
    background: #f9f9f7;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: 'Figtree', system-ui, sans-serif;
    appearance: none;
    box-sizing: border-box;
  }

  .native-auth__input:focus {
    outline: none;
    background: #ffffff;
    border-color: #ff2800;
    box-shadow: 0 0 0 3px rgba(255, 40, 0, 0.08);
  }

  .native-auth__input::placeholder {
    color: #9ca3af;
  }

  .native-auth__submit {
    width: 100%;
    padding: 1rem 1.5rem;
    font-family: 'Figtree', system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background: #ff2800;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-top: 0.25rem;
  }

  .native-auth__submit:active {
    background: #e52400;
  }

  .native-auth__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
}
