:root {
  --navy-deep: #0d1b2a;
  --navy: #1b263b;
  --slate: #415a77;
  --muted: #778da9;
  --deep-teal: #264653;
  --teal: #2a9d8f;
  --teal-bright: #3cb8a9;
  --surface: #f3f6f5;
  --text: #0d1b2a;
  --text-soft: #415a77;
  --border: rgba(13, 27, 42, 0.12);
  --focus-ring: rgba(42, 157, 143, 0.35);
  --error: #b42318;
  --ok: #1f6f5b;
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(42, 157, 143, 0.2), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 80%, rgba(38, 70, 83, 0.14), transparent 50%),
    linear-gradient(165deg, #e8f0ee 0%, var(--surface) 45%, #dfe8e6 100%);
  line-height: 1.55;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--teal);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--deep-teal);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  background: var(--navy-deep);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(42, 157, 143, 0.18);
}

.orbit-a {
  width: min(72vw, 520px);
  height: min(72vw, 520px);
  top: 6%;
  left: 50%;
  translate: -50% 0;
  animation: drift 18s var(--ease) infinite alternate;
}

.orbit-b {
  width: min(90vw, 680px);
  height: min(90vw, 680px);
  top: 0;
  left: 50%;
  translate: -50% 0;
  border-color: rgba(38, 70, 83, 0.12);
  animation: drift 24s var(--ease) infinite alternate-reverse;
}

.grid-fade {
  position: absolute;
  inset: 35% 0 0;
  background-image:
    linear-gradient(rgba(38, 70, 83, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 70, 83, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, transparent, #000 35%, transparent 95%);
  opacity: 0.7;
}

.topbar {
  position: relative;
  z-index: 1;
  padding: 1.25rem 1.5rem 0;
  max-width: 28rem;
  width: 100%;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: var(--deep-teal);
  text-decoration: none;
}

.back-link:hover {
  color: var(--teal);
}

.auth-main,
.account-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
}

.brand-mark img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand-mark span {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--deep-teal);
}

.headline {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4.2vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--navy-deep);
  margin-bottom: 0.65rem;
}

.lede {
  font-size: 1.02rem;
  color: var(--text-soft);
  margin-bottom: 1.5rem;
}

.auth-card,
.account-card {
  display: grid;
  gap: 1.1rem;
  padding: 1.5rem 1.35rem 1.5rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(13, 27, 42, 0.08);
  backdrop-filter: blur(8px);
}

.form-field {
  display: grid;
  gap: 0.4rem;
}

.form-field label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--deep-teal);
}

.form-field input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: 500 1rem var(--font-body);
  color: var(--text);
  background: #fff;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  translate: 0 -50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--slate);
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--deep-teal);
  background: rgba(38, 70, 83, 0.06);
}

.password-toggle:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.form-field input:focus {
  outline: none;
  border-color: rgba(42, 157, 143, 0.55);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-status {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
}

.form-status.is-error {
  color: var(--error);
}

.form-status.is-ok {
  color: var(--ok);
}

.form-status[hidden] {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: 10px;
  font: 600 1rem var(--font-body);
  cursor: pointer;
  text-decoration: none;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), opacity 200ms var(--ease);
}

.btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, var(--teal-bright), var(--teal));
  color: #fff;
  box-shadow: 0 10px 24px rgba(42, 157, 143, 0.28);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--deep-teal);
  border: 1px solid var(--border);
}

.auth-switch {
  text-align: center;
  font-size: 0.95rem;
  color: var(--slate);
  margin-top: 0.25rem;
}

.field-aside {
  margin: -0.35rem 0 0;
  text-align: right;
  font-size: 0.92rem;
}

.field-aside a {
  font-weight: 600;
}

.account-meta {
  display: grid;
  gap: 0.35rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.account-meta dt {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-meta dd {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy-deep);
  word-break: break-all;
}

.account-note {
  font-size: 0.95rem;
  color: var(--text-soft);
}

.license-block {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem 0 0.25rem;
}

.license-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.license-key {
  display: block;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f7faf9;
  font: 600 0.92rem/1.45 ui-monospace, "Cascadia Code", Consolas, monospace;
  color: var(--navy-deep);
  word-break: break-all;
  white-space: pre-wrap;
}

.account-actions {
  display: grid;
  gap: 0.75rem;
}

.footer {
  position: relative;
  z-index: 1;
  padding: 1rem 1.5rem 1.75rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

@keyframes drift {
  from {
    transform: translate(-50%, 0) scale(1);
  }
  to {
    transform: translate(-50%, 12px) scale(1.03);
  }
}

@media (prefers-reduced-motion: reduce) {
  .orbit-a,
  .orbit-b {
    animation: none;
  }
}
