:root {
  --bg-base: #07090d;
  --bg-radial: #111723;
  --surface-panel: rgba(13, 17, 25, 0.94);
  --surface-control: rgba(255, 255, 255, 0.05);
  --surface-control-hover: rgba(255, 255, 255, 0.1);
  --border-hairline: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.22);
  --fg-primary: #f6f8fc;
  --fg-secondary: #a4b0c4;
  --fg-muted: #768298;
  --danger-fg: #fca5a5;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.34);
  --success-fg: #cbd5e1;
  --font-display: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html,
body {
  width: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  background-color: var(--bg-base);
  color: var(--fg-primary);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.ambient-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at 50% 42%,
    var(--bg-radial) 0%,
    #0a0d14 45%,
    var(--bg-base) 100%
  );
}

.snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  display: block;
}

/* Top Bar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding:
    max(14px, env(safe-area-inset-top))
    max(22px, env(safe-area-inset-right))
    14px
    max(22px, env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgba(7, 9, 13, 0.84), rgba(7, 9, 13, 0));
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg-primary);
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 40px;
}

.corner-logo {
  width: 28px;
  height: auto;
  aspect-ratio: 517 / 494;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.14));
  will-change: transform;
}

.brand-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.auth-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.auth-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 140ms ease;
}

.nav-btn:focus-visible,
.download-btn:focus-visible,
.social-btn:focus-visible,
.submit-btn:focus-visible,
.modal-close-btn:focus-visible,
.auth-tab:focus-visible,
.copy-invite-btn:focus-visible,
.antibot-box:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.nav-btn-ghost {
  background: transparent;
  color: var(--fg-primary);
  border-color: var(--border-hairline);
}

.nav-btn-ghost:hover {
  background: var(--surface-control);
  border-color: var(--border-strong);
}

.nav-btn-solid {
  background: #ffffff;
  color: #07090d;
  font-weight: 600;
}

.nav-btn-solid:hover {
  background: #e5e9f2;
}

.nav-btn-subtle {
  background: var(--surface-control);
  color: var(--fg-secondary);
  border-color: var(--border-hairline);
}

.nav-btn-subtle:hover {
  background: var(--surface-control-hover);
  color: var(--fg-primary);
}

.btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.user-email-label {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main Stage */
.stage {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    max(84px, calc(env(safe-area-inset-top) + 64px))
    max(20px, env(safe-area-inset-right))
    max(36px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}

.hero-card {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  will-change: transform, opacity;
}

.hero-title {
  font-size: clamp(1.85rem, 4.4vw, 3.1rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: #ffffff;
  text-wrap: balance;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.55);
}

.hero-subtitle {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: clamp(0.84rem, 1.8vw, 0.96rem);
  font-weight: 400;
  line-height: 1.65;
  color: var(--fg-secondary);
  max-width: 52ch;
}

.action-stack {
  margin-top: 28px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: #ffffff;
  color: #07090d;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: transform 140ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.download-btn:hover {
  background: #edf1f8;
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.52);
}

.download-btn:active {
  transform: translateY(0);
}

.download-btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.download-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.version-tag {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: #3a4559;
  border-left: 1px solid rgba(7, 9, 13, 0.16);
  padding-left: 10px;
  font-variant-numeric: tabular-nums;
}

.feedback-line {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 10px 14px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--border-hairline);
  background: rgba(15, 20, 30, 0.85);
  color: var(--fg-secondary);
}

.feedback-line.is-error {
  color: var(--danger-fg);
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.feedback-line.is-info {
  color: var(--fg-primary);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
}

.social-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 11px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border-hairline);
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.social-btn-telegram {
  background: rgba(255, 255, 255, 0.06);
  color: #f6f8fc;
}

.social-btn-telegram:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-strong);
}

.social-btn-discord {
  background: rgba(128, 136, 152, 0.1);
  color: #96a0b3;
  border-color: rgba(148, 163, 184, 0.14);
}

.social-btn-discord:hover {
  background: rgba(128, 136, 152, 0.16);
  color: #b4bdd0;
}

.social-btn-discord.is-soon {
  color: #d6dde9;
  border-color: rgba(255, 255, 255, 0.22);
}

.social-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Antibot Widget */
.antibot-slot {
  width: 100%;
  margin-top: 2px;
}

.antibot-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 11px;
  border: 1px solid var(--border-hairline);
  background: rgba(14, 18, 27, 0.9);
  cursor: pointer;
  user-select: none;
  overflow: visible;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.antibot-box:hover {
  border-color: var(--border-strong);
  background: rgba(20, 25, 37, 0.94);
}

.antibot-left {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.antibot-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  color: #07090d;
  flex-shrink: 0;
}

.antibot-check-svg {
  width: 14px;
  height: 14px;
  opacity: 0;
  transform: scale(0.6);
}

.antibot-box.is-checked .antibot-checkbox {
  background: #ffffff;
  border-color: #ffffff;
}

.antibot-box.is-checked .antibot-check-svg {
  opacity: 1;
  transform: scale(1);
}

.antibot-title {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-primary);
  letter-spacing: 0.02em;
}

.antibot-right {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.antibot-shield-icon {
  width: 20px;
  height: 20px;
  color: var(--fg-muted);
}

.antibot-box.is-checked .antibot-shield-icon {
  opacity: 0.15;
}

.antibot-stamp {
  position: absolute;
  inset: 0;
  width: 34px;
  height: 34px;
  object-fit: contain;
  opacity: 0;
  transform: scale(1.6) rotate(-10deg);
  pointer-events: none;
  filter: drop-shadow(0 2px 10px rgba(255, 255, 255, 0.32));
  will-change: transform, opacity;
}

.antibot-falling-clone {
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.6);
  will-change: transform;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 6, 10, 0.76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
}

.modal-panel {
  width: 100%;
  max-width: 400px;
  background: var(--surface-panel);
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.modal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-brand-logo {
  width: 22px;
  height: auto;
  aspect-ratio: 517 / 494;
}

.modal-heading {
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.modal-close-btn:hover {
  background: var(--surface-control);
  color: #ffffff;
}

.modal-close-btn svg {
  width: 18px;
  height: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hairline);
  margin-bottom: 18px;
}

.auth-tab {
  min-height: 36px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-secondary);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.auth-tab.is-active {
  background: #ffffff;
  color: #07090d;
  font-weight: 600;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-secondary);
}

.field-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-hairline);
  background: rgba(7, 9, 13, 0.72);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.9375rem;
}

.field-input-mono {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.field-input::placeholder {
  color: var(--fg-muted);
}

.field-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.45);
}

.form-error {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--danger-fg);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 9px;
  padding: 9px 12px;
}

.submit-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  background: #ffffff;
  color: #07090d;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.submit-btn:hover {
  background: #e6ebf4;
}

.submit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.submit-btn-compact {
  width: auto;
  min-width: 96px;
}

.antibot-slot-modal {
  margin-top: 0;
}

/* Profile View */
.profile-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-hairline);
}

.profile-label {
  font-size: 0.78rem;
  color: var(--fg-muted);
  font-weight: 500;
}

.profile-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #ffffff;
  word-break: break-all;
}

.profile-invite-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-invite-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.profile-invite-uses {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--fg-secondary);
}

.invite-copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-hairline);
  background: rgba(7, 9, 13, 0.72);
}

.invite-code-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: #ffffff;
  user-select: all;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-invite-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  background: var(--surface-control);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}

.copy-invite-btn:hover {
  background: var(--surface-control-hover);
}

.copy-icon {
  width: 14px;
  height: 14px;
}

.profile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
}

/* Mobile Responsive */
@media (max-width: 560px) {
  .topbar {
    padding:
      max(12px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      12px
      max(14px, env(safe-area-inset-left));
    gap: 10px;
  }

  .corner-logo {
    width: 24px;
  }

  .brand-name {
    font-size: 0.9rem;
  }

  .nav-btn {
    min-height: 38px;
    padding: 7px 11px;
    font-size: 0.8125rem;
  }

  .user-email-label {
    max-width: 92px;
  }

  .action-stack {
    max-width: 100%;
  }
}

@media (max-width: 350px) {
  .social-row {
    grid-template-columns: 1fr;
  }
}
