/* Focus the form first; legacy server form names, fields and handlers stay intact. */
body.v4-scope.v3-scope:is(.v3-route-login, .v3-route-reminder, .v3-route-helpdesk) .v3-content .v4-auth-card {
  width: min(100%, 460px);
  margin-inline: auto;
}

body.v4-scope.v3-scope.v3-route-register #registration {
  width: min(100%, 480px);
  margin-inline: auto;
  padding: clamp(14px, 3vw, 24px);
}

body.v4-scope.v3-scope.v3-route-register #registration .windowbg2 {
  padding: 0 0 14px !important;
  background: transparent !important;
}

body.v4-scope.v3-scope.v3-route-register #registration .register_form {
  margin: 0 0 14px;
}

body.v4-scope.v3-scope.v3-route-register #registration input[name="passwrd1"],
body.v4-scope.v3-scope.v3-route-register #registration input[name="passwrd2"] {
  width: 100%;
}

body.v4-scope.v3-scope.v3-route-register #registration #confirm_buttons {
  text-align: center;
}

body.v4-scope.v3-scope .v4-auth-actions .v4-button,
body.v4-scope.v3-scope.v3-route-reminder .v3-content form .v4-button,
body.v4-scope.v3-scope.v3-route-register #registration button[name="regSubmit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 24px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: #30240c;
  font: 700 18px/1.35 var(--forest-display);
  text-align: center;
  cursor: pointer;
}

body.v4-scope.v3-scope .v4-auth-actions .v4-button:focus-visible,
body.v4-scope.v3-scope.v3-route-reminder .v3-content form .v4-button:focus-visible,
body.v4-scope.v3-scope.v3-route-register #registration button[name="regSubmit"]:focus-visible {
  outline: 2px solid var(--forest-text);
  outline-offset: 4px;
  filter: drop-shadow(0 0 3px var(--forest-gold));
}

body.v4-scope.v3-scope.v3-route-reminder .v3-content form .roundframe {
  width: auto !important;
  max-width: 100%;
}

body.v4-scope.v3-scope.v3-route-reminder .v3-content form .roundframe > div {
  max-width: 100%;
}

body.v4-scope.v3-scope .v4-auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

body.v4-scope.v3-scope .v4-auth-message,
body.v4-scope.v3-scope .v3-content .error {
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  body.v4-scope.v3-scope:is(.v3-route-login, .v3-route-reminder, .v3-route-helpdesk) .v3-content .v4-auth-card,
  body.v4-scope.v3-scope.v3-route-register #registration { padding: 16px; }
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration {
  position: relative;
  display: flow-root;
  width: min(100%, 520px) !important;
  min-height: 0;
  margin: 0 auto !important;
  padding: 24px 30px !important;
  overflow: hidden;
  border: 1px solid rgba(211, 185, 112, .34) !important;
  border-radius: 22px !important;
  background: linear-gradient(145deg, rgba(20, 62, 46, .96), rgba(5, 27, 21, .98)) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .42), inset 0 1px rgba(255, 255, 255, .08);
  color: #f1f0df;
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration > .windowbg2,
body.v4-scope.v3-scope.v3-route-register #registration.v4-registration > .title_bar {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .topslice,
body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .botslice { display: none; }

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration fieldset,
body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .windowbg2 > div {
  min-width: 0;
  max-width: none !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit !important;
  text-shadow: none !important;
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .register_form {
  display: grid;
  gap: 5px;
  margin: 0 0 12px;
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .register_form dt,
body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .register_form dd {
  float: none;
  width: auto;
  margin: 0;
  text-align: left;
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration label,
body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .register_form dt { color: #f5f1df; }
body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .register_form label i {
  display: block;
  margin-top: 2px;
  color: rgba(241, 240, 223, .72);
  font-size: .82em;
  font-style: normal;
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .register_form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(206, 194, 154, .38);
  border-radius: 9px;
  background: rgba(8, 19, 15, .72);
  color: #fff;
  font: inherit;
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration .register_form input:focus-visible {
  outline: 2px solid #d8c17b;
  outline-offset: 2px;
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration #promo {
  padding: 16px;
  border: 1px solid rgba(216, 193, 123, .4);
  border-radius: 12px;
  background: rgba(211, 185, 112, .09);
}

body.v4-scope.v3-scope.v3-route-register #registration.v4-registration #promo a { color: #e5d18e; }
body.v4-scope.v3-scope.v3-route-register #registration.v4-registration #confirm_buttons { margin-top: 14px; }
body.v4-scope.v3-scope.v3-route-register #registration.v4-registration #confirm_buttons p { margin: 12px 0 0 !important; }

.v4-password-control { display: flex; gap: 8px; align-items: stretch; }
.v4-password-control input { flex: 1; min-width: 0; }
.v4-password-toggle {
  min-width: 68px;
  border: 1px solid rgba(206, 194, 154, .38);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  color: #f5f1df;
  cursor: pointer;
}
.v4-password-error { margin: 6px 0 0; color: #ffb7a8; }
.v4-password-error[hidden] { display: none; }

@media (max-width: 700px) {
  body.v4-scope.v3-scope.v3-route-register #registration.v4-registration {
    width: min(100%, 520px) !important;
    min-height: 0;
    padding: 20px 16px !important;
    border-radius: 16px !important;
    background: linear-gradient(145deg, rgba(5, 25, 19, .94), rgba(8, 32, 24, .96)), url("../assets/web/world-forest-480.webp") center / cover !important;
  }
}

body.v4-scope.v3-route-register .v4-field-status { display: block; font-size: 12px; line-height: 1.5; color: #d6e8cf; }
body.v4-scope.v3-route-register #registration img[hidden] { display: none !important; }
body.v4-scope.v3-route-register .register_error { max-width: 1040px; margin: 0 auto 20px; padding: 16px 20px; border: 1px solid #d58e77; border-radius: 12px; background: #402b25 !important; color: #ffded4; }

/* Legacy promo markup contains black inline text and a white code badge. */
body.v4-scope.v3-route-register #registration.v4-registration #promo a { color: #f2d989 !important; }
body.v4-scope.v3-route-register #registration.v4-registration #promo dd > div { background: #153d2e !important; color: #f4edcf !important; height: auto !important; max-width: 100%; padding: 6px 10px; border-radius: 6px; overflow-wrap: anywhere; }

body.v4-scope.v3-route-register .v4-service-intro { padding: 12px 0; text-align: center; }
body.v4-scope.v3-route-register .v4-service-intro h1 { margin-bottom: 8px; }
.v4-registration-scene { position: relative; isolation: isolate; }
.v4-registration-scene::before, .v4-registration-scene::after {
  content: ""; position: absolute; top: 60px; width: calc((100% - 540px) / 2); max-width: 350px;
  height: 480px; pointer-events: none; z-index: -1;
  background: url('../assets/characters/archer.png') center / contain no-repeat;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.35));
  animation: v4-register-float 7s ease-in-out infinite;
}
.v4-registration-scene::before { right: calc(50% + 270px); }
.v4-registration-scene::after { left: calc(50% + 270px); background-image: url('../assets/characters/mage.png'); animation-delay: -3.5s; }
@keyframes v4-register-float { 50% { transform: translateY(-16px) rotate(1deg); } }
body.v4-scope.v3-route-register #registration .g-recaptcha { width: 100%; margin: 4px auto; }
body.v4-scope.v3-route-register #registration .g-recaptcha > div { margin: auto; }
body.v4-scope.v3-route-register #registration .g-recaptcha iframe { border: 0; display: block; color-scheme: normal; }
body.v4-scope.v3-route-register .v4-field-status:empty { display: none; }
@media (max-width: 850px) { .v4-registration-scene::before, .v4-registration-scene::after { display: none; } }
@media (prefers-reduced-motion: reduce) { .v4-registration-scene::before, .v4-registration-scene::after { animation: none; } }

/* Reuse the home landscape and ambient animation behind the registration controls. */
body.v4-scope.v3-route-register .v4-main { position: relative; isolation: isolate; }
body.v4-scope .v4-registration-backdrop {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, #06292333, #06292377 65%, #062923 100%), url('../assets/web/hero-cityhall-1600.webp') center top / auto 100% no-repeat;
}
body.v4-scope .v4-registration-backdrop .v4-ambient { mask-image: none; }
body.v4-scope .v4-registration-backdrop .v4-ambient span:nth-child(even) { left: calc(100% - var(--x)); }
body.v4-scope.v3-route-register .v4-service-intro, body.v4-scope.v3-route-register .navigate_section { text-shadow: 0 2px 5px #001910, 0 0 18px #001910; }
@media (max-width: 700px) {
  body.v4-scope .v4-registration-backdrop { background-image: linear-gradient(180deg, #06292355, #06292399 65%, #062923 100%), url('../assets/web/hero-cityhall-960.webp'); }
}

body.v4-scope .v4-auth-captcha { flex: 0 0 100%; width: 100%; margin: 12px auto 18px; }
body.v4-scope .v4-auth-captcha .g-recaptcha > div { margin: auto; }
body.v4-scope .v4-auth-captcha iframe { border: 0; display: block; color-scheme: normal; }
body.v4-scope .v4-auth-captcha .error { text-align: center; }
