:root {
  color-scheme: light;
  --hb-bg: #fbfcfa;
  --hb-surface: #ffffff;
  --hb-surface-soft: #f2f7f4;
  --hb-text: #111b2b;
  --hb-forest: #075b47;
  --hb-muted: #697281;
  --hb-line: #e2e7e4;
  --hb-accent: #06754b;
  --hb-accent-strong: #055f3d;
  --hb-accent-soft: #e8f7ef;
  --hb-danger: #bd3948;
  --hb-danger-soft: #fff1f2;
  --hb-shadow: 0 22px 64px rgba(7, 91, 71, .12);
  font-family: "Manrope Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  min-width: 280px;
  min-height: 100%;
  background: var(--hb-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 280px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: #f3f8f5;
  color: var(--hb-text);
}

button,
input { font: inherit; }

.hidden { display: none !important; }

.auth-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: max(28px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.auth-wave {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 0;
  width: min(100%, 760px);
  height: auto;
  opacity: .58;
  pointer-events: none;
  user-select: none;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 492px);
  padding: 31px;
  overflow: hidden;
  border: 1px solid rgba(219, 229, 223, .92);
  border-radius: 30px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--hb-shadow);
}

.brand-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand-name {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--hb-forest);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.beta-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d8eadf;
  border-radius: 10px;
  background: #edf7f1;
  color: var(--hb-accent-strong);
  font-size: 11px;
  font-weight: 800;
}

.auth-copy {
  position: relative;
  z-index: 1;
  min-height: 150px;
  margin: 42px 0 21px;
  padding-top: 2px;
}

.auth-copy > :not(.signal-hero) {
  position: relative;
  z-index: 1;
}

.signal-hero {
  position: absolute;
  top: -45px;
  right: -28px;
  z-index: 0;
  width: 152px;
  height: 152px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--hb-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}

.security-badge i { font-size: 16px; }

h1 {
  max-width: 275px;
  margin: 14px 0 10px;
  color: var(--hb-forest);
  font-size: clamp(37px, 10vw, 45px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.06em;
}

.auth-copy p {
  max-width: 300px;
  margin: 0;
  color: #5d6674;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
}

.telegram-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  margin: 0 0 12px;
  padding: 14px 15px;
  border: 1px solid #d7e9df;
  border-radius: 16px;
  background: rgba(240, 249, 244, .9);
  color: #52645e;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.telegram-check > i {
  color: var(--hb-accent);
  font-size: 22px;
}

.telegram-check.failed {
  border-color: #eadfd4;
  background: #fff8f1;
  color: #685e54;
}

.telegram-check.failed > i { color: #b97835; }
.telegram-check.hidden { display: none; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(7, 138, 85, .16);
  border-top-color: var(--hb-accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.bot-start {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0;
  border-radius: 16px;
  background: var(--hb-accent);
  box-shadow: 0 10px 24px rgba(7, 138, 85, .16);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.02em;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.bot-start i { font-size: 20px; }
.bot-start:hover { background: var(--hb-accent-strong); }
.bot-start:active { transform: scale(.98); }
.bot-start.hidden { display: none !important; }

.auth-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 9px;
}

.auth-form label {
  margin-top: 7px;
  color: var(--hb-text);
  font-size: 12px;
  font-weight: 800;
}

.field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 16px;
  z-index: 1;
  color: #7d8e87;
  font-size: 20px;
  pointer-events: none;
}

.field-wrap input {
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 0 98px 0 47px;
  border: 1px solid #dce2de;
  border-radius: 15px;
  outline: 0;
  background: rgba(242, 247, 244, .9);
  color: var(--hb-text);
  caret-color: var(--hb-accent);
  font-size: 14px;
  font-weight: 600;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.field-wrap input[type="email"] { padding-right: 16px; }
.field-wrap input::placeholder { color: #929b9f; font-weight: 500; }

.field-wrap input:focus {
  border-color: var(--hb-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(7, 138, 85, .13);
}

.field-wrap:focus-within .field-icon { color: var(--hb-accent); }

.field-action {
  position: absolute;
  right: 8px;
  min-height: 40px;
  padding: 0 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--hb-forest);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.form-error {
  margin: 5px 0 0;
  padding: 11px 13px;
  border: 1px solid #f0cfd3;
  border-radius: 13px;
  background: var(--hb-danger-soft);
  color: var(--hb-danger);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.submit-button {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 13px;
  border: 0;
  border-radius: 16px;
  background: var(--hb-accent);
  box-shadow: 0 10px 24px rgba(7, 138, 85, .16);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.02em;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.submit-button i { font-size: 19px; }
.submit-button:hover { background: var(--hb-accent-strong); }
.submit-button:active { transform: scale(.98); }

.privacy-note {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 21px auto 0;
  color: #5e6770;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.privacy-note i {
  flex: 0 0 auto;
  color: var(--hb-accent);
  font-size: 15px;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(7, 138, 85, .24);
  outline-offset: 3px;
}

@media (max-width: 520px) {
  body { background: var(--hb-bg); }

  .auth-shell {
    place-items: stretch;
    overflow: visible;
    padding: 0;
  }

  .auth-wave {
    width: 100%;
    opacity: .78;
  }

  .auth-card {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(21px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
}

@media (max-width: 350px) {
  .auth-card { padding-inline: 18px; }
  .brand-mark { width: 44px; height: 44px; }
  .brand-name { font-size: 17px; }
  .beta-chip { min-height: 28px; padding-inline: 8px; }
  .auth-copy { margin-top: 35px; }
  .signal-hero { right: -36px; width: 135px; height: 135px; }
  h1 { max-width: 235px; font-size: 36px; }
  .auth-copy p { max-width: 250px; }
}

@media (min-width: 700px) {
  .auth-card { padding: 37px; }
  .auth-copy { margin-top: 48px; }
  .signal-hero { right: -22px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
