:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #edf4f8;
  background: #0b1521;
}
* {
  box-sizing: border-box;
}
body {
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 90% 10%, #213e4b, transparent 55%);
}
main {
  width: min(100%, 480px);
  padding: 28px;
  border: 1px solid #435c6c;
  border-top: 2px solid #f47bb5;
  border-radius: 20px;
  background: #142334;
  box-shadow: 0 24px 80px #0005;
}
.brand {
  font-size: 1.25rem;
  font-weight: 850;
  letter-spacing: 0.15em;
}
h1 {
  font-size: 2rem;
  margin: 24px 0 12px;
}
.tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0;
}
.tabs button {
  flex: 1;
}
button,
a {
  font: inherit;
}
button {
  color: #edf4f8;
  background: #1c3041;
  border: 1px solid #476074;
  border-radius: 10px;
  padding: 11px 14px;
  min-height: 44px;
  cursor: pointer;
}
button[aria-selected='true'] {
  border-color: #f47bb5;
  background: #3b2941;
}
.primary {
  background: #b7f66a;
  color: #102018;
  border-color: #b7f66a;
  font-weight: 750;
  width: 100%;
  margin-top: 10px;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
label {
  display: block;
  font-size: 0.875rem;
  color: #bdd0dc;
  margin: 16px 0;
}
input,
select {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 7px;
  border: 1px solid #466174;
  border-radius: 9px;
  background: #0d1c2a;
  color: #edf4f8;
  font: inherit;
  min-width: 0;
}
.recent {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 14px;
  text-align: left;
  margin: 24px 0;
  background: #203a46;
}
.recent strong,
.recent small {
  display: block;
}
.recent strong {
  font-size: 1.1rem;
}
.recent small {
  font-size: 0.8rem;
  color: #aec5d4;
  margin-top: 4px;
}
.recent > span:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.recent-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 12px;
  background: #b7f66a22;
  color: #b7f66a;
  font-weight: 800;
}
input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid #f47bb5;
  outline-offset: 2px;
}
a {
  color: #c7d8e2;
}
p {
  font-size: 0.875rem;
  line-height: 1.55;
  color: #b6cbd8;
}
.status {
  border-left: 2px solid #f47bb5;
  padding-left: 12px;
  min-height: 1.5em;
}
.signup-only {
  display: none;
}
.signup .signup-only {
  display: block;
}
.recover .password-field,
.recover .signup-only {
  display: none;
}
.password .email-field,
.password .signup-only {
  display: none;
}
.secondary {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 0.875rem;
}
.hint {
  font-size: 0.75rem;
}
.hidden {
  display: none !important;
}
@media (max-width: 480px) {
  body {
    padding: 12px;
  }
  main {
    padding: 22px;
  }
  h1 {
    font-size: 1.75rem;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brandmark {
  width: 52px;
  height: 52px;
  flex: none;
}
.brandmark svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  line-height: 1;
}
.brand-name {
  font-size: 1.25rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}
.brand-studio {
  color: #b7f66a;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.36em;
}
.brand-pink-i {
  color: #f47bb5;
}
main {
  padding: 34px;
  border-radius: 24px;
  background: linear-gradient(150deg, #1c3040, #111f2d);
  position: relative;
}
h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-top: 32px;
}
.recent {
  padding: 18px;
  border-radius: 16px;
}
.recent-avatar {
  background: #b7f66a22;
  border: 1px solid #b7f66a44;
}
.secondary {
  width: 100%;
  background: transparent;
}
.back-link {
  display: block;
  margin: 22px auto 0;
  border: 0;
  background: transparent;
  color: #a9c0d0;
  font-size: 0.8125rem;
}
.test-label {
  display: inline-block;
  color: #b7f66a;
  border: 1px solid #b7f66a44;
  background: #b7f66a0a;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
}
.status:empty {
  display: none;
}
button {
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}
button:active:not(:disabled) {
  transform: scale(0.985);
}
@media (hover: hover) {
  button:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: #f47bb5;
    background: #2b4051;
    box-shadow: 0 8px 22px #0003;
  }
  .recent:hover:not(:disabled) {
    background: #294852;
    border-color: #b7f66a;
    box-shadow: 0 8px 28px #b7f66a14;
  }
  .primary:hover:not(:disabled) {
    background: #cafa8b;
    color: #102018;
    border-color: #d9ffaf;
  }
  .back-link:hover:not(:disabled) {
    box-shadow: none;
    background: transparent;
    color: #edf4f8;
  }
}
@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
  button:hover,
  button:active {
    transform: none !important;
  }
}
@media (max-width: 480px) {
  main {
    padding: 24px;
  }
  .brandmark {
    width: 46px;
    height: 46px;
  }
}

#logout {
  display: none !important;
}
main:has(.signup) {
  width: min(100%, 680px);
}
.signup {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
}
.signup .signup-only {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
}
.signup .signup-only p,
.signup > .status,
.signup > #submit {
  grid-column: 1/-1;
}
.signup label {
  margin: 9px 0;
}
.signup input,
.signup select {
  padding: 10px;
}
.signup p {
  margin: 8px 0;
}
.signup #submit {
  margin-top: 10px;
}
main:has(.signup) h1 {
  font-size: 2rem;
  margin: 22px 0 10px;
}
main:has(.signup) .tabs {
  margin: 12px 0;
}
main:has(.signup) #intro {
  margin: 8px 0;
}
.signup .hidden {
  display: none !important;
}
@media (max-width: 480px) {
  main:has(.signup) h1 {
    font-size: 1.65rem;
  }
  .signup,
  .signup .signup-only {
    grid-template-columns: 1fr;
  }
  .signup .signup-only > *,
  .signup > * {
    grid-column: 1;
  }
  .signup label {
    margin: 8px 0;
  }
  .signup input,
  .signup select {
    margin-top: 5px;
  }
  .brand {
    margin-bottom: 8px;
  }
}

.login-manifest {
  font-size: clamp(30px, 7vw, 44px);
  line-height: 1.12;
  letter-spacing: -1.3px;
  font-weight: 850;
  margin: 30px 0 20px;
}
.login-manifest span {
  color: #ed88b7;
}
#chooser > .secondary {
  width: 100%;
  background: #ed88b7;
  color: #101a22;
  font-weight: 750;
  border-color: #ed88b7;
  margin-top: 16px;
}
#chooser > #registerAccount {
  background: transparent;
  color: #edf4f8;
  border-color: #ffffff25;
}
main {
  background: linear-gradient(145deg, #1b2939, #101d2b);
  border-color: #ffffff16;
  border-top-color: #ed88b7;
  border-radius: 28px;
}
body {
  background:
    radial-gradient(ellipse at 88% 8%, #ed88b715, transparent 50%),
    radial-gradient(ellipse at 10% 90%, #b7f66a08, transparent 55%), #0b1521;
}

/* Keep return navigation above the form; opening a form never opens the keyboard. */
#credentials > .back-link {
  width: auto;
  margin: 20px 0 8px;
  padding: 8px 0;
  text-align: left;
}
#credentials > h1 {
  margin-top: 12px;
}
#chooserStatus:empty {
  display: none;
}

/* A signal from WebKit's password manager, not a typing heuristic. */
@keyframes cadence-password-filled {
  from {
    opacity: 1;
  }
  to {
    opacity: 1;
  }
}
#authForm.login input:autofill {
  animation: cadence-password-filled 1ms;
}
#authForm.login input:-webkit-autofill {
  animation: cadence-password-filled 1ms;
}

/* One stable authentication frame for login and registration. */
body {
  align-items: start;
  padding-top: max(24px, env(safe-area-inset-top));
}
main,
main:has(.signup) {
  width: min(100%, 560px);
  margin-inline: auto;
}
#credentials {
  width: 100%;
}
#credentials h1,
main:has(.signup) h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin: 32px 0 12px;
  text-align: center;
}
#credentials #intro,
main:has(.signup) #intro {
  margin: 8px 0;
  text-align: center;
}
#credentials .tabs,
main:has(.signup) .tabs {
  margin: 18px 0;
}
.test-label {
  position: absolute;
  top: 7px;
  right: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.625rem;
  color: #bdd0dc;
  opacity: 0.7;
  max-width: calc(100% - 24px);
  text-align: right;
}

#credentials #intro {
  min-height: 3lh;
}

/* Keep the welcome page in place while its own sign-in fields unfold. */
.crew-login-gap {
  width: 100%;
  height: 1.5cm;
  aspect-ratio: auto;
}
body:has(main.inline-login) {
  display: flex;
  flex-direction: column;
  align-items: center;
}
main.inline-login {
  margin-top: var(--auth-entry-top, 0px);
}
main.inline-login #credentials {
  padding-top: 8px;
  animation: cadence-login-unfold 0.24s ease-out;
}
main.inline-login #credentials > #back,
main.inline-login #credentials > #title,
main.inline-login #credentials > #intro,
main.inline-login #credentials > .tabs {
  display: none !important;
}
@keyframes cadence-login-unfold {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  main.inline-login #credentials {
    animation: none;
  }
}

/* Shared account entry, including the native transparent WebView. */
html body main #chooser > .login-manifest {
  text-align: center !important;
  margin: 0 !important;
  width: 100%;
}
html body main #chooser > #otherAccount {
  margin-top: 0 !important;
}
html body main #chooser > .crew-login-gap {
  height: 1.5cm;
  aspect-ratio: auto;
}

/* Shared GiNN 02 vector wordmark: optical spacing is encoded in its geometry. */
.brand,
.remote-brand {
  --ginn-accent: var(--skin-accent, #b083d9);
}
.brand-copy {
  align-items: flex-start;
}
.brand-copy .ginn-wordmark {
  width: 90px;
  height: 35px;
  display: block;
  overflow: visible;
}
.brandmark .ginn-mark {
  width: 100%;
  height: 100%;
  display: block;
}
@media (max-width: 580px) {
  .brand-copy .ginn-wordmark {
    width: 80px;
    height: 31px;
  }
}

/* GiNN sign-in: fixed brand, centered account flow, full-page mobile layout. */
html,
body {
  min-height: 100%;
  background: #0b1017;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: block;
  padding: 0;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 88% 12%, #b083d90f, transparent 42%),
    radial-gradient(ellipse at 14% 92%, #b083d908, transparent 46%), #0b1017;
}
body:has(> main):not(.projectmode) {
  padding: 0 !important;
  align-items: normal;
}
body > main {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: max(112px, calc(env(safe-area-inset-top) + 88px)) 24px
    max(32px, env(safe-area-inset-bottom)) !important;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body > main > .brand {
  position: absolute;
  top: max(24px, calc(env(safe-area-inset-top) + 16px));
  left: max(24px, calc(env(safe-area-inset-left) + 24px));
  margin: 0;
  gap: 10px;
}
body > main > .brand .brandmark {
  width: 42px;
  height: 42px;
}
body > main > .brand-copy {
  align-items: flex-start;
}
body > main > .brand-copy .ginn-wordmark {
  width: 98px;
  height: 36px;
}
#chooser,
#credentials {
  width: min(100%, 420px);
  margin: auto;
}
#chooser {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
#chooser .login-manifest {
  margin: 0 0 12px !important;
  font-size: clamp(2rem, 8vw, 2.65rem);
  line-height: 1.14;
  text-align: center;
  letter-spacing: -0.045em;
}
#chooser .crew-login-gap {
  display: none;
}
#chooser > button {
  min-height: 52px;
  margin: 0 !important;
  border-radius: 14px;
  font-size: 1rem;
}
#chooser > #otherAccount {
  order: 1;
  background: #b083d9;
  border-color: #b083d9;
  color: #101018;
}
#chooser > #registerAccount {
  order: 2;
  background: #ffffff08;
  border-color: #ffffff24;
  color: #f5f3f8;
}
#recentAccount {
  order: 0;
  margin: 4px 0 8px;
  border-radius: 16px;
  background: #ffffff08;
  border-color: #ffffff1a;
}
#chooserStatus {
  order: 0;
  margin: 0;
  text-align: center;
}
#credentials {
  padding: 28px;
  border: 1px solid #ffffff1c;
  border-radius: 24px;
  background: linear-gradient(145deg, #1b2029f2, #141820f2);
  box-shadow: 0 24px 80px #0005;
}
#credentials > .back-link {
  margin: 0 0 10px;
  color: #c9c2d2;
}
#credentials h1 {
  margin: 12px 0 8px;
  font-size: clamp(1.75rem, 6vw, 2.15rem);
  text-align: left;
}
#credentials #intro {
  min-height: 0;
  margin: 0 0 20px;
  text-align: left;
}
#credentials .tabs {
  margin: 0 0 20px;
  padding: 4px;
  border: 1px solid #ffffff16;
  border-radius: 14px;
  background: #080b101c;
}
#credentials .tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
}
#credentials .tabs button[aria-selected='true'] {
  background: #ffffff12;
  color: #fff;
}
#credentials label {
  margin: 14px 0;
  color: #e1dfe6;
}
#credentials input,
#credentials select {
  min-height: 48px;
  border-radius: 12px;
  border-color: #ffffff26;
  background: #0d1118;
}
#credentials #submit {
  min-height: 50px;
  border-radius: 13px;
  background: #b083d9;
  border-color: #b083d9;
  color: #101018;
}
#credentials > #forgot,
#credentials > #logout {
  margin: 12px auto 0;
  background: transparent;
  border-color: transparent;
  color: #d1c6df;
}
.test-label {
  position: fixed;
  z-index: 2;
  top: max(8px, env(safe-area-inset-top));
}
@media (max-width: 480px) {
  body > main {
    padding-inline: 22px !important;
  }
  #credentials {
    padding: 22px;
  }
}
@media (max-height: 680px) {
  body > main {
    place-items: start center;
    padding-top: max(96px, calc(env(safe-area-inset-top) + 80px));
  }
  #chooser,
  #credentials {
    margin-block: auto;
  }
}

/* Fixed GiNN working design. Covers both browser and the already installed native WebView. */
html:has(body.ginn-login) {
  color-scheme: dark;
  --ginn-ui-bg: #191b1c;
  --ginn-ui-text: #f1efea;
  --ginn-ui-accent: #b68b58;
  --auth-text: #f1efea !important;
  --auth-muted: #b7b8b5 !important;
  --auth-accent: #b68b58 !important;
  --auth-on-accent: #17191a !important;
  --auth-surface: #242728 !important;
  --auth-border: #565750 !important;
}
html body.ginn-login > main,
html[data-cadence-native-auth] body.ginn-login > main {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100svh !important;
  width: 100%;
  max-width: none;
  margin: 0 !important;
  padding: max(112px, calc(env(safe-area-inset-top) + 88px)) 22px
    max(24px, env(safe-area-inset-bottom)) !important;
}
html body.ginn-login #credentials {
  flex: none;
  width: min(100%, 420px) !important;
  margin: auto !important;
  padding: 22px;
  color: var(--auth-text);
  border: 1px solid #ffffff20;
  background: linear-gradient(145deg, #282a2b, #202223) !important;
  box-shadow: 0 16px 44px #0003;
}
html body.ginn-login #credentials :is(h1, input, select) {
  color: var(--auth-text) !important;
}
html body.ginn-login #credentials :is(p, label, .hint) {
  color: var(--auth-muted) !important;
}
html body.ginn-login #credentials :is(input, select) {
  background: #191b1c !important;
  border-color: #ffffff26 !important;
}
html body.ginn-login #credentials :is(input, select):focus {
  border-color: var(--auth-accent) !important;
  outline: 2px solid #b68b5840 !important;
  outline-offset: 2px;
}
html body.ginn-login #credentials #back,
html body.ginn-login #credentials #forgot,
html body.ginn-login #credentials #cadencePasswordToggle {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--auth-accent) !important;
  box-shadow: none !important;
}
html body.ginn-login #credentials #back {
  margin: 0 0 12px;
  padding-left: 0;
}
html body.ginn-login #credentials #submit {
  background: var(--auth-accent) !important;
  border-color: var(--auth-accent) !important;
  color: var(--auth-on-accent) !important;
}
html body.ginn-login #credentials :is(button, a):focus-visible {
  outline: 2px solid var(--auth-accent) !important;
  outline-offset: 3px;
}
html body.ginn-login #credentials #status:not(:empty) {
  color: var(--auth-text) !important;
  border-color: var(--auth-accent) !important;
}

/* Browser chooser uses the same fixed working palette as the sign-in form. */
html:has(body.ginn-login),
html body.ginn-login {
  background: var(--ginn-ui-bg);
  color: var(--auth-text);
}
body.ginn-login .brand {
  --ginn-accent: var(--auth-accent);
}
html body.ginn-login #chooser .login-manifest span,
html body.ginn-login #chooser .login-manifest strong {
  color: var(--auth-text);
}
html body.ginn-login #chooser #otherAccount {
  background: var(--auth-accent);
  border-color: var(--auth-accent);
  color: var(--auth-on-accent);
}
html body.ginn-login #chooser #recentAvatar {
  color: var(--auth-accent);
  background: #b68b5820;
  border-color: #b68b5860;
}
html body.ginn-login #chooser #recentMode {
  color: var(--auth-muted);
}
html body.ginn-login #chooser :is(#recentAccount, #registerAccount) {
  background: var(--auth-surface);
  color: var(--auth-text);
  border-color: var(--auth-border);
}
