:root {
  --navy-950: #081a2b;
  --navy-900: #0c2238;
  --navy-800: #12314d;
  --cyan-500: #1cbda9;
  --cyan-100: #ddf7f2;
  --slate-700: #4f5e6c;
  --slate-500: #748290;
  --slate-300: #cbd3da;
  --slate-200: #dce3e8;
  --slate-100: #edf1f4;
  --white: #fff;
  --danger: #b42318;
  --sans: Arial, "Noto Sans Thai", "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--white);
  color: var(--navy-950);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.auth-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.auth-topbar {
  min-height: 62px; padding: 10px 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.auth-brand { display: inline-flex; align-items: center; gap: 9px; }
.auth-brand img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.auth-brand strong { color: var(--navy-900); font-size: 14px; }
.auth-top-actions { display: flex; align-items: center; gap: 10px; }
.auth-top-actions select {
  min-height: 36px; max-width: 110px; padding: 6px 8px; border: 0; border-radius: 7px;
  background: transparent; color: var(--slate-700); font-size: 11px; cursor: pointer;
}
.auth-top-link {
  padding: 8px 14px; border: 1px solid var(--slate-300); border-radius: 7px;
  color: var(--navy-900); font-size: 11px; font-weight: 700;
}
.auth-top-link:hover { background: var(--navy-900); border-color: var(--navy-900); color: var(--white); }
.auth-main {
  width: min(480px, calc(100% - 32px)); margin: auto; padding: 44px 0 72px;
}
.auth-main.signup-mode { width: min(520px, calc(100% - 32px)); }
.auth-heading { margin-bottom: 28px; text-align: center; }
.auth-heading img {
  width: 72px; height: 72px; margin-bottom: 19px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 6px 24px rgba(8, 26, 43, .08);
}
.auth-heading h1 { margin: 0; font-size: clamp(26px, 5vw, 34px); font-weight: 500; letter-spacing: -.035em; }
.auth-heading p { margin: 10px auto 0; color: var(--slate-500); font-size: 13px; line-height: 1.6; }
.auth-card {
  padding: 28px; border: 1px solid var(--slate-200); border-radius: 22px;
  box-shadow: 0 8px 34px rgba(8, 26, 43, .08);
}
.auth-form { display: grid; gap: 18px; }
.form-field { display: grid; gap: 7px; }
.form-field label, .field-label { color: var(--navy-900); font-size: 12px; font-weight: 700; }
.form-field input, .form-field select {
  width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--slate-300);
  border-radius: 10px; outline: 0; background: var(--white); color: var(--navy-950); font-size: 14px;
}
.form-field input:focus, .form-field select:focus {
  border-color: var(--cyan-500); box-shadow: 0 0 0 3px rgba(28, 189, 169, .11);
}
.form-field small { color: var(--slate-500); font-size: 10px; line-height: 1.5; }
.username-check-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.ghost-inline-button {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--slate-300);
  border-radius: 10px;
  background: var(--white);
  color: var(--navy-900);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.ghost-inline-button:hover {
  border-color: var(--navy-900);
  background: var(--navy-900);
  color: var(--white);
}
.username-field small[data-state="success"] { color: #0b6f62; font-weight: 800; }
.username-field small[data-state="error"] { color: var(--danger); font-weight: 800; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.signup-password-fields { display: grid; grid-template-columns: 1fr; gap: 18px; }
.account-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.account-option { position: relative; }
.account-option input { position: absolute; opacity: 0; pointer-events: none; }
.account-option span {
  min-height: 58px; padding: 11px 12px; display: grid; gap: 3px; align-content: center;
  border: 1px solid var(--slate-300); border-radius: 10px; cursor: pointer;
}
.account-option strong { font-size: 12px; }
.account-option small { color: var(--slate-500); font-size: 9px; }
.account-option input:checked + span {
  border-color: var(--cyan-500); background: var(--cyan-100);
  box-shadow: 0 0 0 2px rgba(28, 189, 169, .08);
}
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; color: var(--slate-700); font-size: 11px; }
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--cyan-500); }
.text-link { color: var(--navy-800); font-size: 11px; font-weight: 700; }
.text-link:hover { color: var(--cyan-500); }
.primary-submit {
  min-height: 50px; padding: 12px 18px; border: 0; border-radius: 10px;
  background: var(--navy-900); color: var(--white); font-size: 13px; font-weight: 700; cursor: pointer;
}
.primary-submit:hover { background: var(--navy-800); }
.auth-switch { margin: 20px 0 0; color: var(--slate-500); font-size: 12px; text-align: center; }
.auth-switch a { color: var(--navy-900); font-weight: 700; }
.form-message {
  margin-bottom: 18px; padding: 12px 14px; border-radius: 10px;
  background: #fff0ef; color: var(--danger); font-size: 11px; line-height: 1.55;
}
.form-message.success { background: var(--cyan-100); color: #0b6f62; }
.form-message ul { margin: 0; padding-inline-start: 18px; }
.captcha-placeholder {
  min-height: 58px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  border: 1px dashed var(--slate-300);
  border-radius: 12px;
  background: #f8fafb;
  color: var(--navy-900);
}
.captcha-placeholder > span:not(.captcha-check) {
  font-size: 12px;
  font-weight: 800;
}
.captcha-placeholder small {
  color: var(--slate-500);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.captcha-check {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--slate-300);
  border-radius: 7px;
  background: var(--white);
  box-shadow: inset 0 0 0 3px #f3f6f7;
}
.local-reset-link { margin-top: 12px; overflow-wrap: anywhere; }
.local-reset-link a { color: var(--navy-900); font-weight: 700; text-decoration: underline; }
[hidden] { display: none !important; }

@media (max-width: 560px) {
  .auth-topbar { padding-inline: 12px; border-bottom: 1px solid #eceeee; }
  .auth-top-actions select { width: 84px; }
  .auth-main { padding-top: 34px; }
  .auth-heading img { width: 64px; height: 64px; margin-bottom: 16px; }
  .auth-card { padding: 22px 18px; border-radius: 18px; box-shadow: 0 5px 24px rgba(8, 26, 43, .07); }
  .form-row { grid-template-columns: 1fr; }
}
