:root {
  --account-brand-icon-size: 2.55rem;
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f9f2e9;
  background: #141012;
  --muted: #c5b6ae;
  --accent: #ffc394;
  --field: #251e1ddd;
  --border: #776761;
}

* { box-sizing: border-box; }

/* Both columns sit in one warm field. The low left-hand light also remains
   behind the form when the browser is showing the raster bell. */
body {
  --account-background:
    radial-gradient(ellipse at 77% 50%, #4b302c 0%, #322322 24%, transparent 59%),
    radial-gradient(ellipse at 82% 4%, #402a20 0%, transparent 58%),
    radial-gradient(ellipse at 18% 101%, #271a19 0%, transparent 51%),
    #141012;
  min-height: 100svh;
  margin: 0;
  background: var(--account-background);
}

a { color: var(--accent); text-underline-offset: .22em; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.shell {
  width: min(100%, 110rem);
  min-height: 100svh;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(22rem, .88fr) minmax(0, 1.12fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "brand art" "form art";
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.brand-row {
  grid-area: brand;
  padding: clamp(1.65rem, 4.4vh, 3rem) clamp(2rem, 5.4vw, 6.1rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .58rem;
  width: fit-content;
  color: #f7ece1;
  text-decoration: none;
}

.brand img { width: var(--account-brand-icon-size); height: var(--account-brand-icon-size); border-radius: .48rem; }
.wordmark { font-size: 1.16rem; font-weight: 480; letter-spacing: -.065em; }
.wordmark b { color: #f19869; font-weight: 760; }
.brand small {
  margin-inline-start: .16rem;
  padding-inline-start: .83rem;
  border-inline-start: 1px solid #69534a;
  color: #c5b3a6;
  font-size: .72rem;
  font-weight: 470;
  letter-spacing: .018em;
  line-height: 1.4;
}

.entry {
  grid-area: form;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 2rem clamp(2rem, 5.2vw, 6rem) clamp(3.3rem, 12vh, 9rem);
}
.entry-content { width: min(100%, 24rem); }
h1, p { margin: 0; }

/* The original controls occupy the full grid when the bell leaves its studio.
   The flight controller bridges the two layouts while the inputs retain focus. */
[data-bell-flight] .entry { position: relative; z-index: 1; pointer-events: none; }
[data-bell-flight] .entry-content { position: relative; isolation: isolate; pointer-events: auto; }
.account-flight-title > * { display: inline-block; }
[data-account-field] .entry { grid-column: 1 / -1; }
[data-account-field] .entry-content { width: min(100%, 38rem); }
[data-bell-flight] .entry-content::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -16% -12%;
  pointer-events: none;
  background: radial-gradient(ellipse 47% 49% at 52% 50%, #aa643b30, transparent);
  opacity: 0;
  transition: opacity 650ms ease;
}
[data-account-field] .entry-content::before { opacity: 1; }
[data-account-field] .intro { max-width: none; }
[data-account-field] .field { position: relative; padding-top: .95rem; }
/* Give the bell room to land between the email field and the recovery link. */
[data-account-field] .field:has(.forgot) { margin-block-start: 1.75rem; }
[data-account-field] .auth-form { gap: 2.05rem; }
[data-account-field="password"] .hint { color: #f1c5a9; }

/* A small reflected light marks a real landing surface above the active input. */
[data-account-field] .field::after {
  content: "";
  position: absolute;
  top: 1.88rem;
  right: .45rem;
  width: 5rem;
  height: .52rem;
  pointer-events: none;
  background: radial-gradient(ellipse, #ffc07f99, #ed843a40 29%, transparent 72%);
  opacity: 0;
  transition: opacity 260ms ease;
}
[data-account-field="email"]:has([data-flight="perched"]) .field:has(#email)::after,
[data-account-field="password"]:has([data-flight="perched"]) .field:has(#password)::after { opacity: 1; }

/* This light stays on the page when the bell leaves its stage. It spreads
   toward the active form while the smaller bell carries only its refraction. */
[data-bell-flight] {
  position: relative;
  isolation: isolate;
}
.account-light {
  position: absolute;
  z-index: -1;
  inset-block: 0;
  left: calc(50% - 50vw);
  width: 100vw;
  overflow: clip;
  pointer-events: none;
}
.account-light .bell-room {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.account-light[data-room-renderer="webgl"]::before { display: none; }
.account-light::before {
  --room-light-x: calc(50% + min(22vw, 24.2rem));
  --room-light-y: 50%;
  content: "";
  position: absolute;
  /* The smallest light still paints past the screen, and its feather stays
     inside the layer. Scaling never exposes a hard rectangle at its edge. */
  inset: -22% -44%;
  pointer-events: none;
  background:
    linear-gradient(-23deg, transparent 48%, #ffc69b12 48.25%, transparent 48.65%,
      transparent 51.9%, #ffd2ab28 52.05%, transparent 52.3%),
    linear-gradient(-23deg, transparent 40%, #c57a3f21 45%, #ffc18762 49.5%,
      #ffd2aa4a 50.6%, #c4743d1c 54%, transparent 59%),
    radial-gradient(ellipse 24% 32% at var(--room-light-x) var(--room-light-y), #b7734c72, transparent),
    radial-gradient(ellipse 29% 34% at calc(var(--room-light-x) - 10%) calc(var(--room-light-y) + 6%), #9b5b4150, transparent);
  mask-image: radial-gradient(ellipse 37% 45% at var(--room-light-x) var(--room-light-y),
    #000 16%, #000c 54%, transparent);
  opacity: var(--account-ambience, 0);
  transform: scale(.68, .78);
  transform-origin: var(--room-light-x) var(--room-light-y);
  transition: transform 1050ms cubic-bezier(.22,.73,.22,1);
}
[data-account-field] .account-light::before { transform: scale(1.13, 1.10); }


h1 {
  margin-bottom: .85rem;
  font: 400 clamp(3.15rem, 4.75vw, 5rem)/1.02 Georgia, "Times New Roman", serif;
  letter-spacing: -.067em;
  text-wrap: balance;
}
.greeting { font-size: clamp(3.55rem, 5.15vw, 5.65rem); }
.greeting em { color: #f7bd92; font-weight: 400; }

.intro, .alternate, .hint { color: var(--muted); line-height: 1.55; }
.intro { max-width: 33ch; margin-bottom: 2.4rem; overflow-wrap: anywhere; }
.hint { margin-top: .5rem; font-size: .81rem; }
.alternate { margin-top: 1.65rem; padding-top: 1.4rem; border-top: 1px solid #6e514548; font-size: .9rem; }
.alternate a { margin-left: .15rem; font-weight: 590; }

.auth-form, .skeleton-form { display: grid; gap: 1.25rem; }
.field label {
  display: block;
  margin-bottom: .52rem;
  font-size: .88rem;
  font-weight: 600;
}
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.field input {
  width: 100%;
  min-height: 3.2rem;
  padding: .75rem .95rem;
  border: 1px solid var(--border);
  border-radius: .6rem;
  background: var(--field);
  color: #fff7ee;
}
.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.password-field { position: relative; }
.password-field:has(.password-toggle:not([hidden])) input { padding-right: 4.25rem; }

.password-toggle, .link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: .84rem;
  font-weight: 580;
}
.password-toggle {
  position: absolute;
  inset: .22rem .23rem .22rem auto;
  min-width: 3.4rem;
  border-radius: .36rem;
}
.password-toggle:hover { background: #50352a; }
.forgot, .link-button { justify-self: start; font-size: .83rem; }
.link-button { padding: .35rem 0; text-decoration: underline; text-underline-offset: .2em; }

.primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.24rem;
  margin-top: .15rem;
  padding: .78rem 1.02rem;
  border: 1px solid #ffce9e71;
  border-radius: .6rem;
  background: linear-gradient(105deg, #ffc593, #f3a06b 78%, #ed925d);
  color: #2b160d;
  font-weight: 650;
}
.primary:hover { background: linear-gradient(105deg, #ffd0a7, #ffad75); }
.primary span { font-size: 1.3rem; font-weight: 440; line-height: 1; }
.auth-form[aria-busy="true"] .primary { cursor: progress; }

.message {
  margin-bottom: 1.1rem;
  padding: .75rem .9rem;
  border: 1px solid;
  border-radius: .55rem;
  font-size: .89rem;
  line-height: 1.45;
}
.error { background: #3b211a; border-color: #a96b57; color: #ffd6c7; }
.notice { background: #202a1e; border-color: #739269; color: #d4e9ce; }

@media (max-width: 760px) {
  :root { --account-brand-icon-size: 2.25rem; }
  body {
    --account-background:
      radial-gradient(ellipse 90% 16rem at 58% 12rem, #4c3026, transparent),
      linear-gradient(167deg, #211819, #171213 63%, #141012);
  }
  .shell {
    --account-bell-height: clamp(12.75rem, 60vw, 18rem);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "brand" "art" "form";
  }
  [data-bell-flight="register"], [data-registration-skeleton] {
    --account-bell-height: clamp(11rem, 48vw, 15rem);
  }
  .brand-row { padding: 1.05rem clamp(1.25rem, 6.6vw, 2.6rem) .1rem; }
  .entry { padding: .8rem clamp(1.25rem, 6.6vw, 2.6rem) 2.65rem; place-items: start center; }
  h1, .greeting { font-size: clamp(3rem, 12vw, 4.25rem); }
  .intro { margin-bottom: 1.45rem; }
  .auth-form, .skeleton-form { gap: 1.02rem; }
  [data-bell-flight] .entry-content::before { inset-inline: -.72rem; }
  [data-account-field] .auth-form { gap: 1.30rem; }
  [data-account-field] .field { padding-top: .60rem; }
  [data-account-field] .field::after { top: 1.65rem; right: .22rem; width: 3.6rem; }
  .account-light::before {
    --room-light-x: 52%;
    --room-light-y: 38%;
    mask-image: radial-gradient(ellipse 44% 38% at var(--room-light-x) var(--room-light-y),
      #000 16%, #000c 54%, transparent);
    transform: scale(.68, .86);
  }
  .alternate { margin-top: 1.25rem; padding-top: 1.15rem; }
}

@media (max-width: 760px) and (hover: none) and (pointer: coarse) {
  /* The bell can dock without changing the geometry Safari uses to reveal the caret. */
  [data-account-field] .entry-content { width: min(100%, 24rem); }
  [data-account-field] .intro { max-width: 33ch; }
  [data-account-field] .auth-form { gap: 1.02rem; }
  [data-account-field] .field { padding-top: 0; }
  [data-account-field] .field:has(.forgot) { margin-block-start: 0; }
  [data-account-field] .field::after { top: 1.05rem; }

  body[data-account-viewport] {
    position: fixed;
    inset: 0;
    min-height: 0;
    overflow: hidden;
  }
  body[data-account-viewport] > .shell:not(.account-skeleton) {
    position: absolute;
    inset: var(--account-viewport-top, 0px) 0 auto;
    height: var(--account-viewport-height, 100dvh);
    min-height: 0;
    overflow: hidden auto;
    overscroll-behavior-y: contain;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-bell-flight] :is(.entry-content, .field)::after, [data-bell-flight] .entry-content::before { transition: none; }
  .account-light::before,
  [data-account-field] .account-light::before { transform: none; transition: none; }
}

/* A flight may extend beyond the page edge on its way around the form.
   Clip at the page boundary without creating a scrolling or clipping ancestor
   for the live inputs and the floating stage between them. */
body:has([data-bell-flight]) { overflow-x: clip; }
