/* Login + liitumine — KAKLUS 01: hämar kaklus, kuldne JAHIL, tume läbipaistev ruut */
:root {
  --g: #c9a36a;
  --bg: #070807;
  --t: #fff;
  --line: rgba(255, 255, 255, .14);
}
* { box-sizing: border-box; }
html {
  height: 100%;
  height: 100svh;
  min-height: 100%;
  min-height: 100svh;
  background: #070807;
}
body.auth-gate {
  margin: 0;
  min-height: 100%;
  min-height: 100svh;
  height: 100%;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 32px calc(40px + var(--safe-bottom, 0px));
  overflow: auto;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  color: var(--t);
  background: #070807;
  position: relative;
}
html.is-browser body.auth-gate,
html.is-ios-browser body.auth-gate {
  padding: 24px 32px calc(24px + var(--safe-bottom, 0px));
  min-height: 100svh;
  height: 100svh;
}
html.is-native body.auth-gate,
html.is-android:not(.is-browser) body.auth-gate {
  padding: 24px 32px 32px;
  height: 100%;
  min-height: 100%;
}
html.is-kb-open body.auth-gate .wrap {
  max-height: none;
}
/* Android: klaviatuur avatud → tõsta kast IME peale (flex-end + padding = --kb). */
html.is-android.is-kb-open body.auth-gate,
html.is-native.is-android.is-kb-open body.auth-gate,
html.is-android.pwa-standalone.is-kb-open body.auth-gate {
  padding-bottom: max(16px, var(--kb, 280px)) !important;
  justify-content: flex-end !important;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  height: auto !important;
  min-height: 100% !important;
  min-height: 100dvh !important;
  max-height: none !important;
}
html.is-android.is-kb-open body.auth-gate .wrap,
html.is-native.is-android.is-kb-open body.auth-gate .wrap,
html.is-android.pwa-standalone.is-kb-open body.auth-gate .wrap {
  margin-bottom: 0 !important;
  max-height: none !important;
  position: relative;
  z-index: 2;
}

/* Kohesed tapid — ilma 300ms viivituseta; lingid/nupud pealpool */
.auth-gate a,
.auth-gate button,
.auth-gate label.legal-ack,
.auth-gate input,
.auth-gate [data-legal-doc] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.12);
}
.auth-gate .join-link a,
.auth-gate .foot a,
.auth-gate label.legal-ack a,
.auth-gate [data-legal-doc] {
  position: relative;
  z-index: 3;
  display: inline-block;
  padding: 10px 8px;
  margin: -10px -8px;
  min-height: 44px;
  line-height: 24px;
  box-sizing: border-box;
}
.auth-gate button[type="submit"],
.auth-gate .passkey-btn,
.auth-gate .legal-doc-btn {
  position: relative;
  z-index: 3;
  touch-action: manipulation;
}
.auth-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  width: var(--auth-bg-w, 100%);
  max-width: none;
  /* --auth-bg-h/--auth-bg-w = JS px-lukk (Android IME ei moonuta). */
  height: var(--auth-bg-h, 100lvh);
  min-height: var(--auth-bg-h, 100lvh);
  z-index: 0;
  pointer-events: none;
  background-color: #070807;
  background-position: center 32%;
  background-size: cover;
  background-repeat: no-repeat;
}
.auth-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .28);
}
/* Android/PWA IME: lukustatud px laius+kõrgus, mitte kahanev %. */
html.is-kb-open .auth-bg,
html.is-android.is-kb-open .auth-bg,
html.is-android.pwa-standalone.is-kb-open .auth-bg {
  left: 0 !important;
  right: auto !important;
  bottom: auto !important;
  width: var(--auth-bg-w, 100%) !important;
  max-width: none !important;
  height: var(--auth-bg-h, 100lvh) !important;
  min-height: var(--auth-bg-h, 100lvh) !important;
}
.auth-gate .wrap {
  width: min(304px, 100%);
  position: relative;
  z-index: 1;
  margin: auto auto 8px;
}
.auth-gate .card {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 58px 22px 18px;
  background: rgba(0, 0, 0, .32);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 32px;
  backdrop-filter: blur(28px) saturate(1.05);
  -webkit-backdrop-filter: blur(28px) saturate(1.05);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
  overflow: visible;
}
.auth-gate .card.is-long,
.auth-gate .card.is-login {
  aspect-ratio: auto;
}
/* Lühem login-kaart all — ülemine pool taust (loomad) vaba */
body.auth-gate.is-login-page {
  justify-content: flex-end;
  padding-top: calc(8px + var(--safe-top, 0px));
  padding-bottom: calc(8px + var(--safe-bottom, 0px));
}
body.auth-gate.is-login-page .wrap {
  margin: 0 auto 0;
}
/* Kogu pilt täidab ekraani alumise servani. Androidi klaviatuur lukustab kõrguse eraldi. */
body.auth-gate.is-login-page .auth-bg {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
  min-height: 100lvh;
  min-height: 100dvh;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}
html.is-android body.auth-gate.is-login-page .auth-bg,
html.is-android.pwa-standalone body.auth-gate.is-login-page .auth-bg,
html.is-kb-open body.auth-gate.is-login-page .auth-bg {
  background-size: cover !important;
  background-position: center top !important;
}
html.is-native.is-android:not(.is-kb-open) body.auth-gate.is-login-page {
  padding-bottom: calc(12px + max(48px, var(--safe-bottom, 0px), var(--android-sab, 0px), var(--sab, 0px))) !important;
}
.auth-gate .card.is-login {
  padding: 42px 18px 10px;
  justify-content: flex-start;
}
.auth-gate .card.is-login > .brand-mark.is-jahil {
  width: 86px;
  height: 86px;
}
.auth-gate .card.is-login .auth-title {
  margin: 0 0 10px;
  font-size: 20px;
}
.auth-gate .card.is-login .auth-fields {
  gap: 8px;
}
.auth-gate .card.is-login input {
  height: 42px;
  padding: 10px 12px;
  border-radius: 11px;
}
.auth-gate .card.is-login button[type="submit"] {
  margin-top: 10px;
  height: 42px;
  font-size: 14px;
}
.auth-gate .card.is-login .login-paths {
  margin: 8px 0 0;
}
.auth-gate .card.is-login .login-paths a {
  min-height: 36px;
  gap: 10px;
  font-size: 14px;
}
.auth-gate .card.is-login .login-paths img {
  width: 20px;
  height: 20px;
}
.auth-gate .card.is-long {
  justify-content: flex-start;
  padding-top: 72px;
}
.brand-mark {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}
.auth-gate .card > .brand-mark {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 2;
  margin: 0;
  transform: translate(-50%, -46%);
}
.brand-mark.is-jahil {
  width: 108px;
  height: 108px;
  background: transparent;
  overflow: hidden;
  border-radius: 50%;
}
.auth-gate .auth-title {
  margin: 0 0 14px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #fff;
}
.auth-gate .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;
}
.auth-gate label {
  display: block;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  margin: 12px 0 6px;
  font-weight: 700;
}
.auth-gate .card.is-login label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.auth-gate input {
  width: 100%;
  height: 44px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 0;
  background: #111;
  color: var(--t);
  font-size: 16px;
  font-family: inherit;
}
.auth-gate .auth-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
}
.auth-gate input::placeholder {
  color: #8a8a86;
  opacity: 1;
}
.auth-gate input:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .22);
}
.auth-gate button[type="submit"],
.auth-gate .passkey-btn {
  width: 100%;
  margin-top: 14px;
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: #111;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.auth-gate .passkey-btn {
  margin-top: 10px;
  background: transparent;
  color: #f4f4f2;
  border: 1.5px solid rgba(178, 189, 159, .55);
}
.auth-gate .passkey-help {
  margin: 10px 0 0;
  color: #8a8f86;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
.auth-gate .err {
  background: #2a1210;
  color: #ffb0a6;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 10px;
  border: 1px solid rgba(158, 27, 27, .4);
  white-space: pre-wrap;
  line-height: 1.45;
}
.auth-gate .err.is-block {
  background: rgba(28, 18, 10, .92);
  color: #f3d2b8;
  border-color: rgba(196, 140, 80, .45);
}
.auth-gate .err.is-block strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: #fff;
}
.auth-gate .hint {
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  margin: 0 0 12px;
  line-height: 1.4;
  text-align: center;
}
.auth-gate .login-paths {
  display: flex;
  flex-direction: column;
  margin: 14px 0 0;
  padding: 0;
}
.auth-gate .login-paths a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 4px;
  margin: 0;
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.2;
  border-top: 1px solid rgba(255, 255, 255, .14);
  position: relative;
  z-index: 3;
  box-sizing: border-box;
}
.auth-gate .login-paths a:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .78);
}
.auth-gate .login-paths img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: none;
}
.auth-gate .login-paths span {
  flex: 1;
  text-align: left;
}
.auth-gate .login-paths a::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  margin-right: 2px;
  border-right: 1.6px solid #c9a36a;
  border-top: 1.6px solid #c9a36a;
  transform: rotate(45deg);
}
.auth-gate .join-link {
  text-align: center;
  margin: 14px 0 0;
}
.auth-gate .join-link a,
.auth-gate .foot a {
  color: #fff;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-gate .foot {
  text-align: center;
  margin: 16px 0 0;
}
.auth-gate .card.is-long .foot {
  margin-top: 16px;
}
@media (min-height: 780px) {
  body.auth-gate {
    padding-bottom: calc(56px + var(--safe-bottom, 0px));
  }
  body.auth-gate.is-login-page {
    padding-bottom: calc(8px + var(--safe-bottom, 0px));
  }
  html.is-native body.auth-gate,
  html.is-android:not(.is-browser) body.auth-gate {
    padding-bottom: 32px;
  }
  html.is-native body.auth-gate.is-login-page,
  html.is-android:not(.is-browser) body.auth-gate.is-login-page {
    padding-bottom: calc(8px + var(--safe-bottom, 0px));
  }
  html.is-native.is-android:not(.is-kb-open) body.auth-gate.is-login-page {
    padding-bottom: calc(12px + max(48px, var(--safe-bottom, 0px), var(--android-sab, 0px), var(--sab, 0px))) !important;
  }
  html.is-browser body.auth-gate,
  html.is-ios-browser body.auth-gate {
    padding-bottom: calc(24px + var(--safe-bottom, 0px));
  }
  html.is-browser body.auth-gate.is-login-page,
  html.is-ios-browser body.auth-gate.is-login-page {
    padding-bottom: calc(8px + var(--safe-bottom, 0px));
  }
}
.auth-gate .wrap.is-join-form,
.auth-gate .wrap.is-legal-doc {
  width: min(392px, 100%);
  margin-top: 0;
}
body.auth-gate.is-legal-doc {
  justify-content: flex-start;
  padding-top: calc(56px + var(--safe-top));
}
.auth-gate .legal-card {
  padding-bottom: 22px;
}
.auth-gate .legal-body {
  margin: 0;
  max-height: min(62vh, 640px);
  overflow: auto;
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, .88);
  white-space: pre-wrap;
}
.auth-gate .legal-delete {
  margin: 0;
  max-height: min(70vh, 720px);
  overflow: auto;
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(255, 255, 255, .88);
}
.auth-gate .legal-delete h2 {
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.auth-gate .legal-delete p,
.auth-gate .legal-delete li {
  margin: 0 0 8px;
}
.auth-gate .legal-delete ol,
.auth-gate .legal-delete ul {
  margin: 0 0 12px;
  padding-left: 1.2em;
}
.auth-gate .legal-delete a { color: #c5d1b8; }
.auth-gate .legal-empty {
  margin: 0;
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, .72);
}
.auth-gate .legal-ack-box {
  margin: 16px 0 0;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.auth-gate .legal-ack-box legend {
  padding: 0;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.45;
  color: rgba(255, 255, 255, .9);
}
.auth-gate .legal-ack-ver,
.auth-gate .legal-ack-warn {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  letter-spacing: 0;
  text-transform: none;
}
.auth-gate .legal-ack-ver { color: rgba(201, 163, 106, .95); }
.auth-gate .legal-ack-warn { color: #ffb0a6; }
.auth-gate label.legal-ack {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.45;
  color: rgba(255, 255, 255, .9);
  cursor: pointer;
}
.auth-gate label.legal-ack input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 2px 0 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: #c9a36a;
  background: #111;
}
.auth-gate label.legal-ack a {
  color: #c9a36a;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-gate button[type="submit"]:disabled {
  opacity: .42;
  cursor: not-allowed;
}
.auth-gate .legal-doc-btn {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #c9a36a;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  height: auto;
  width: auto;
}
/* Pikk liitumisvorm (selts + üksik): ära joonda põhja. Muidu jääb algus
   ekraanist üles ja WebKit ei lase sinna tagasi kerida. */
html:has(body.auth-gate.is-join-scroll) {
  height: auto;
  min-height: 100%;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
html.is-browser body.auth-gate.is-join-scroll,
html.is-ios-browser body.auth-gate.is-join-scroll,
html.is-ios body.auth-gate.is-join-scroll,
html.is-native body.auth-gate.is-join-scroll,
html.is-android body.auth-gate.is-join-scroll,
html.pwa-standalone body.auth-gate.is-join-scroll,
body.auth-gate.is-join-scroll {
  justify-content: flex-start;
  height: auto;
  min-height: 100%;
  min-height: 100svh;
  max-height: none;
  overflow: visible;
  padding-top: calc(72px + var(--safe-top, 0px));
  padding-bottom: calc(28px + var(--safe-bottom, 0px));
}
body.auth-gate.is-join-scroll .wrap.is-join-form {
  margin-top: 0;
  margin-bottom: 12px;
}

body.auth-gate.legal-sheet-open {
  overflow: hidden;
}
.legal-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(20px + var(--safe-bottom, 0px));
  background: rgba(0, 0, 0, .62);
}
.legal-sheet[hidden] {
  display: none !important;
}
.legal-sheet-card {
  width: min(392px, 100%);
  max-height: min(86dvh, 720px);
  display: flex;
  flex-direction: column;
  padding: 22px 20px 18px;
  background: rgba(0, 0, 0, .78);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 28px;
  backdrop-filter: blur(28px) saturate(1.05);
  -webkit-backdrop-filter: blur(28px) saturate(1.05);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
}
.legal-sheet-card h2 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}
.legal-sheet-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(255, 255, 255, .88);
  white-space: pre-wrap;
}
.legal-sheet-close {
  width: 100%;
  margin-top: 14px;
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: #111;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}
