@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --bg-base: #05070f;
  --bg-elevated: rgba(11, 17, 29, 0.9);
  --bg-input: rgba(18, 27, 44, 0.9);
  --bg-panel-glow: rgba(96, 120, 176, 0.35);
  --color-primary: #4d63b0;
  --color-primary-hover: #40529a;
  --color-accent: #8fa2d4;
  --color-text: #dfe4f7;
  --color-muted: #96a2c4;
  --color-border: rgba(110, 134, 188, 0.32);
  --color-success: #6dd6b4;
  --panel-radius: 24px;
  --panel-shadow: 0 34px 90px rgba(3, 6, 14, 0.68);
  --radius-md: 18px;
  --transition-fast: 180ms ease;
  --transition-slow: 320ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: radial-gradient(circle at 18% -20%, rgba(104, 132, 188, 0.32), transparent 55%),
    radial-gradient(circle at 84% 16%, rgba(78, 100, 153, 0.28), transparent 52%),
    linear-gradient(180deg, #05070f 0%, #091021 46%, #04060b 100%);
  overflow-x: hidden;
  position: relative;
}

body.modal-open {
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 22% 34%, rgba(96, 120, 176, 0.26), transparent 58%),
    radial-gradient(circle at 78% 74%, rgba(58, 74, 115, 0.24), transparent 62%);
  filter: blur(120px);
  opacity: 0.78;
  transform: translateZ(0);
}

::selection {
  background: rgba(112, 140, 206, 0.35);
  color: #f6f8ff;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

a:hover {
  opacity: 0.85;
}

.text-link {
  color: var(--color-accent);
  font-weight: 500;
}

.text-link:hover {
  opacity: 0.85;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.help-text {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.75);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 3rem 1.5rem 3.5rem;
  position: relative;
  z-index: 1;
}

.landing::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.4), transparent 60%);
  z-index: -1;
}

.landing h1 {
  font-weight: 600;
  font-size: clamp(2rem, 3vw, 2.75rem);
  letter-spacing: -0.02em;
  text-align: center;
}

.landing p {
  max-width: 520px;
  color: var(--color-muted);
  text-align: center;
  line-height: 1.6;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 1.65rem;
  background: linear-gradient(120deg, var(--color-primary), var(--color-accent));
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 20px 46px rgba(34, 44, 76, 0.55);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
}

.cta::after {
  content: '›';
  font-size: 1.2rem;
  line-height: 1;
}

.cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 54px rgba(32, 42, 72, 0.6);
}

.cta:active {
  transform: translateY(-1px);
}

.cta.secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  box-shadow: none;
}

.panel {
  background: linear-gradient(160deg, rgba(13, 20, 34, 0.95), rgba(9, 13, 24, 0.92));
  border-radius: var(--panel-radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--panel-shadow);
  padding: 2.25rem 2rem;
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: '';
  position: absolute;
  inset: -60% 10% auto -15%;
  height: 260px;
  background: radial-gradient(circle, var(--bg-panel-glow), transparent 65%);
  opacity: 0.5;
  z-index: 0;
  transform: rotate(5deg);
}

.panel h1,
.panel h2,
.panel h3 {
  position: relative;
  z-index: 1;
}

.panel form,
.panel > * {
  position: relative;
  z-index: 1;
}

.panel h1,
.panel h2,
.panel h3 {
  margin-bottom: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel p {
  color: var(--color-muted);
  line-height: 1.6;
}

.auth-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.auth-hero {
  text-align: center;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-hero .badge {
  align-self: center;
  background: rgba(120, 140, 196, 0.26);
  color: #d2dcff;
}

.auth-card {
  width: min(640px, calc(100vw - 3rem));
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-grid {
  display: grid;
  gap: 1.25rem 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.95rem;
  color: var(--color-muted);
  letter-spacing: 0.01em;
}

input,
select,
textarea {
  background: var(--bg-input);
  border: 1px solid rgba(120, 146, 204, 0.28);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  color: var(--color-text);
  font-size: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 14px 34px rgba(4, 7, 15, 0.55);
  transition: border var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast),
    background-color var(--transition-fast);
}

.field-hint {
  font-size: 0.75rem;
  color: rgba(159, 174, 202, 0.72);
}

input.invite-email-locked {
  background: rgba(30, 39, 61, 0.9);
  border-color: rgba(122, 150, 210, 0.42);
  cursor: not-allowed;
}

input.invite-email-locked:focus {
  transform: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 24px rgba(4, 6, 12, 0.4);
}

input::placeholder,
textarea::placeholder {
  color: rgba(160, 176, 204, 0.58);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(126, 156, 220, 0.7);
  box-shadow: 0 0 0 3px rgba(110, 140, 204, 0.26), 0 18px 40px rgba(3, 6, 14, 0.6);
  transform: translateY(-1px);
  background: rgba(21, 30, 47, 0.98);
}

button.cta,
button.primary {
  font: inherit;
  border: none;
  background: linear-gradient(120deg, var(--color-primary), var(--color-accent));
  color: #fff;
  padding: 0.9rem 1.85rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 20px 46px rgba(34, 44, 76, 0.55);
}

button.cta:hover,
button.primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 54px rgba(32, 42, 72, 0.6);
}

button.cta:active,
button.primary:active {
  transform: translateY(-1px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  background: rgba(120, 140, 196, 0.24);
  color: #d2dcff;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge.success {
  background: rgba(93, 210, 170, 0.16);
  color: var(--color-success);
}

.badge.error {
  background: rgba(215, 112, 112, 0.18);
  color: #f58f8f;
}

.subtext {
  color: var(--color-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.feedback {
  border-radius: var(--radius-md);
  background: rgba(102, 122, 170, 0.18);
  border: 1px solid rgba(116, 140, 196, 0.32);
  padding: 0.85rem 1rem;
  color: var(--color-text);
  font-size: 0.95rem;
  line-height: 1.5;
}

.support-text {
  text-align: center;
  color: var(--color-muted);
  margin-top: 1.25rem;
}

#two-factor-field,
#two-factor-setup {
  display: none;
}

#two-factor-field {
  margin-top: 0.25rem;
}

#two-factor-setup {
  background: rgba(8, 12, 22, 0.78);
  border-radius: var(--radius-md);
  border: 1px solid rgba(116, 140, 196, 0.32);
  padding: 1.75rem 1.5rem;
}

#two-factor-setup > * + * {
  margin-top: 1rem;
}

#two-factor-setup h2 {
  margin-bottom: 0.4rem;
}

#two-factor-setup img {
  justify-self: center;
  border-radius: 10px;
  border: 1px solid rgba(116, 140, 196, 0.32);
  padding: 0.75rem;
  background: rgba(16, 23, 36, 0.85);
}

#two-factor-backups ul {
  list-style: none;
  padding-left: 0;
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.35rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
}

#two-factor-backups li {
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: rgba(110, 132, 188, 0.18);
  color: #d7e1ff;
}

#two-factor-backups h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

#two-factor-secret {
  margin: 0;
  padding: 0.75rem 1rem;
  background: rgba(16, 23, 36, 0.85);
  border: 1px solid rgba(116, 140, 196, 0.32);
  border-radius: 10px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: #d7e1ff;
  letter-spacing: 0.08em;
}

.alert-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 7, 15, 0.55);
  backdrop-filter: blur(2px);
  z-index: 5000;
}

.alert-modal[hidden] {
  display: none;
}

.alert-modal__overlay {
  position: absolute;
  inset: 0;
}

.alert-modal__dialog {
  width: min(320px, 100%);
  padding: 1.5rem;
  border-radius: 18px;
  border: 1px solid rgba(110, 134, 188, 0.35);
  background: rgba(9, 14, 26, 0.95);
  box-shadow: 0 24px 68px rgba(3, 6, 14, 0.72);
  display: grid;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.alert-modal__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(77, 99, 176, 0.18);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--color-accent);
}

.alert-modal__content {
  display: grid;
  gap: 0.55rem;
}

.alert-modal__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}

.alert-modal__message {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-muted);
  word-break: break-word;
}

.alert-modal__actions {
  display: flex;
  justify-content: space-between;
  /*gap: 0.75rem;*/
  flex-wrap: wrap;
}

.alert-modal__actions button {
  min-width: 120px;
}

@media (max-width: 640px) {
  .panel {
    padding: 1.85rem 1.6rem;
  }

  .landing {
    gap: 2rem;
  }

  .cta {
    width: 100%;
    justify-content: center;
  }
}
