:root {
  color-scheme: light;
  --paper: #faf8f2;
  --paper-low: #f4f0e8;
  --ink: #403d37;
  --muted-ink: #817d75;
  --line: rgba(81, 78, 71, 0.24);
  --button: #5f5b53;
  --error: #9a5148;
  --toast-error: #8b554d;
  --toast-error-bg: #f1e7e1;
  --toast-success: #5d735f;
  --toast-success-bg: #e8eee6;
  --display-font: 'Times New Roman', Times, serif;
  --sans-font: Inter, Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans-font);
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.auth-page {
  background: linear-gradient(
    180deg,
    var(--paper) 0%,
    var(--paper) 46%,
    var(--paper-low) 100%
  );
}

.hero-section,
.signin-section {
  min-height: 100svh;
  padding: clamp(1.5rem, 4vw, 4.75rem);
}

.hero-section {
  position: relative;
  display: flex;
  flex-direction: column;
}

.brand {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand {
  width: fit-content;
  text-decoration: none;
  animation: hero-enter 700ms ease-out both;
}

.auth-nav {
  position: absolute;
  top: clamp(1.5rem, 4vw, 4.75rem);
  right: clamp(1.5rem, 4vw, 4.75rem);
  display: flex;
  gap: clamp(1.1rem, 2.5vw, 2rem);
  animation: hero-enter 700ms ease-out both;
}

.auth-nav a {
  color: var(--muted-ink);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 180ms ease;
}

.auth-nav a:hover,
.auth-nav a.is-current {
  color: var(--ink);
}

.auth-nav a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 0.35rem;
}

.brand:focus-visible,
.scroll-cue:focus-visible,
.text-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 0.35rem;
}

.intro-title {
  max-width: 11.5ch;
  margin: auto 0 clamp(4.5rem, 10vh, 8rem);
  font-family: var(--display-font);
  font-size: clamp(4.8rem, 9vw, 10.5rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.04;
  animation: hero-enter 900ms 100ms ease-out both;
}

.intro-title em {
  font-weight: 400;
}

.intro-title-short {
  text-transform: none;
}

.scroll-cue {
  position: absolute;
  right: clamp(1.5rem, 4vw, 4.75rem);
  bottom: clamp(1.5rem, 4vw, 4.75rem);
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  color: var(--muted-ink);
  font-size: 1.25rem;
  text-decoration: none;
  animation: hero-enter 700ms 300ms ease-out both;
}

.signin-section {
  display: grid;
  place-items: center;
  scroll-margin-top: 0;
}

.login-wrap {
  width: min(100%, 34rem);
}

.reveal-enabled [data-reveal] {
  opacity: 0;
  transform: translateY(4rem);
  transition: opacity 800ms ease, transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-enabled [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

.login-title {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(4.25rem, 8vw, 8rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.04;
}

.login-form {
  margin-top: clamp(3rem, 7vh, 5rem);
}

.stage-note {
  max-width: 31rem;
  margin: 0 0 clamp(2.5rem, 6vh, 4rem);
  color: var(--muted-ink);
  font-family: var(--display-font);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.55;
}

.verification-email {
  margin: 1.5rem 0 0;
  color: var(--muted-ink);
  font-family: var(--display-font);
  font-size: 1.15rem;
  line-height: 1.5;
}

.code-row[hidden],
.verified-note[hidden] {
  display: none;
}

.form-row + .form-row {
  margin-top: 2.35rem;
}

.form-label {
  display: block;
  margin-bottom: 0.7rem;
  color: var(--muted-ink);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  padding: 0.4rem 0 0.85rem;
  background: transparent;
  color: var(--ink);
  font-family: var(--display-font);
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  line-height: 1.35;
}

.form-control::placeholder {
  color: #aaa59b;
}

.form-control:focus {
  border-bottom-color: rgba(81, 78, 71, 0.62);
  box-shadow: 0 1px 0 rgba(81, 78, 71, 0.28);
}

.field-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
}

.inline-action {
  min-width: 7.5rem;
  border: 1px solid var(--line);
  padding: 0.8rem 0.9rem;
  background: transparent;
  color: var(--button);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.inline-action:hover {
  border-color: var(--button);
  background: rgba(95, 91, 83, 0.06);
}

.inline-action:disabled {
  border-color: var(--line);
  background: transparent;
  color: var(--muted-ink);
  cursor: not-allowed;
  opacity: 0.55;
}

.inline-action:disabled:hover {
  border-color: var(--line);
  background: transparent;
}

.inline-action:focus-visible {
  outline: 2px solid var(--button);
  outline-offset: 0.25rem;
}

.inline-action[aria-busy="true"] {
  cursor: wait;
  opacity: 0.55;
}

.username-action-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.dice-action {
  display: grid;
  min-width: 3.25rem;
  min-height: 3.25rem;
  place-items: center;
  padding: 0.55rem;
  font-size: 1.25rem;
  line-height: 1;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.verified-note {
  margin: 0.75rem 0 0;
  color: var(--muted-ink);
  font-size: 0.82rem;
}

.submit-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin-top: 2.75rem;
  border: 1px solid var(--button);
  padding: 1rem 1.15rem;
  background: var(--button);
  color: var(--paper);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: background-color 180ms ease, color 180ms ease;
}

.submit-button:hover {
  background: transparent;
  color: var(--button);
}

.submit-button:focus-visible {
  outline: 2px solid var(--button);
  outline-offset: 0.3rem;
}

.submit-button:disabled {
  border-color: var(--line);
  background: transparent;
  color: var(--muted-ink);
  cursor: not-allowed;
  opacity: 0.62;
}

.submit-button:disabled:hover {
  background: transparent;
  color: var(--muted-ink);
}

.account-switch,
.secondary-form {
  margin: 1.35rem 0 0;
  text-align: center;
}

.verification-secondary-actions {
  display: grid;
  justify-items: center;
}

.account-switch a {
  color: var(--muted-ink);
  font-family: var(--display-font);
  font-size: 1.05rem;
  text-underline-offset: 0.25rem;
}

.secondary-form .text-button {
  font-family: var(--sans-font);
}

.stage-reset {
  display: block;
  margin: 1.35rem auto 0;
}

.code-control {
  letter-spacing: 0.24em;
}

.toast-stack {
  position: fixed;
  right: clamp(1rem, 2.5vw, 2rem);
  bottom: clamp(1rem, 2.5vw, 2rem);
  z-index: 30;
  display: grid;
  width: min(24rem, calc(100vw - 2rem));
  gap: 0.7rem;
  pointer-events: none;
}

.toast {
  box-sizing: border-box;
  width: 100%;
  border: 0;
  border-left: 3px solid var(--toast-success);
  border-radius: 0;
  padding: 1rem 1.2rem;
  box-shadow: none;
  font-family: var(--sans-font);
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast--error {
  border-left-color: var(--toast-error);
  background: var(--toast-error-bg);
  color: var(--toast-error);
}

.toast--success {
  border-left-color: var(--toast-success);
  background: var(--toast-success-bg);
  color: var(--toast-success);
}

.app-message {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  border: 0;
  border-left: 3px solid var(--toast-success);
  border-radius: 0;
  padding: 1rem 1.2rem;
  background: var(--toast-success-bg);
  color: var(--toast-success);
  box-shadow: none;
  font-family: var(--sans-font);
  font-size: 0.9rem;
  line-height: 1.5;
}

.app-message--error {
  border-left-color: var(--toast-error);
  background: var(--toast-error-bg);
  color: var(--toast-error);
}

.app-message--success {
  border-left-color: var(--toast-success);
  background: var(--toast-success-bg);
  color: var(--toast-success);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(0.6rem);
}

.home-shell {
  min-height: 100svh;
  padding: clamp(1.5rem, 4vw, 4.75rem);
  background: linear-gradient(180deg, var(--paper), var(--paper-low));
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.home-header form {
  margin: 0;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted-ink);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-decoration: underline;
  text-underline-offset: 0.25rem;
  text-transform: uppercase;
}

.home-header .text-button,
.home-message a {
  color: var(--muted-ink);
  text-decoration: none;
  transition: color 180ms ease;
}

.home-header .text-button:hover,
.home-message a:hover {
  color: var(--ink);
  text-decoration: none;
}

.home-message {
  margin-top: clamp(8rem, 24vh, 16rem);
}

.home-message h1 {
  max-width: 10ch;
  margin: 1rem 0;
  font-family: var(--display-font);
  font-size: clamp(4rem, 10vw, 9rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.04;
}

.home-message > p:last-child {
  color: var(--muted-ink);
  font-size: 1rem;
}

@keyframes hero-enter {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .hero-section,
  .signin-section,
  .home-shell {
    padding: 1.25rem;
  }

  .intro-title {
    max-width: 9ch;
    margin-bottom: 5rem;
    font-size: clamp(4rem, 19vw, 6.5rem);
  }

  .scroll-cue {
    right: 1.25rem;
    bottom: 1.25rem;
  }

  .auth-nav {
    top: 1.25rem;
    right: 1.25rem;
    gap: 0.9rem;
  }

  .signin-section {
    align-items: center;
  }

  .login-title {
    font-size: clamp(4rem, 20vw, 6rem);
  }

  .field-action-row {
    grid-template-columns: minmax(0, 1fr) 7rem;
    gap: 0.65rem;
  }

  .username-action-row {
    grid-template-columns: minmax(0, 1fr) 3.25rem;
  }

  .inline-action {
    min-width: 0;
    padding-inline: 0.55rem;
  }

  .toast-stack {
    right: 1rem;
    bottom: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .brand,
  .auth-nav,
  .intro-title,
  .scroll-cue {
    animation: none;
  }

  .reveal-enabled [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .submit-button {
    transition: none;
  }

  .inline-action {
    transition: none;
  }

  .toast {
    transition: none;
  }
}


