:root {
  /* theme palette — space-separated RGB so alpha can be added: rgb(var(--a500) / .2) */
  --a50: 236 222 255; --a200: 205 168 255; --a400: 166 112 255; --a500: 139 92 246; --a600: 116 72 245; --a900: 60 28 140;
  --bg0: 7 6 15; --bg1: 13 10 28; --bg2: 22 14 48;
  --tx1: 207 200 230; --tx2: 185 178 214; --tx3: 169 163 196;
  --link: 215 123 255;
  --art-filter: saturate(1);
  --logo-filter: saturate(1);
  --on-accent: 255 255 255;
}
:root {
  --bg: rgb(var(--bg0));
  --panel: rgb(var(--bg2) / 0.78);
  --line: rgb(var(--a400) / 0.55);
  --line-soft: rgba(255, 255, 255, 0.12);
  --text: rgb(var(--a50));
  --muted: rgb(var(--tx2));
  --violet: rgb(var(--a400));
  --violet-2: rgb(var(--a500));
  --pink: rgb(var(--a400));
  --radius: 22px;
}

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

html, body { min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Open Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 12px;
}

button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Frame ---------- */
.frame {
  position: relative;
  min-height: calc(100vh - 24px);
  border: 1px solid transparent;
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(420px, 610px) 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "brand brand"
    "auth  hero"
    "legal legal";
  column-gap: clamp(32px, 4.5vw, 72px);
  padding: 26px clamp(32px, 4.2vw, 68px) 18px;
  isolation: isolate;
}

.bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgb(var(--bg0) / 0.92) 0%, rgb(var(--bg0) / 0.55) 35%, rgb(var(--bg0) / 0) 60%),
    linear-gradient(180deg, rgb(var(--bg1)) 0%, rgb(var(--bg1)) 14%, rgb(var(--bg1) / 0) 32%),
    url("/assets/brand/background.jpg") calc(100% + 60px) 130px / auto 110% no-repeat,
    radial-gradient(ellipse at 70% 10%, rgb(var(--bg2)) 0%, rgb(var(--bg1)) 60%);
}

/* ---------- Brand ---------- */
.brand { grid-area: brand; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* ---------- Language switch ---------- */
.lang {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 999px;
  background: rgb(var(--bg2) / 0.6);
  border: 1px solid rgb(var(--a400) / 0.4);
  box-shadow: 0 0 18px rgb(var(--a400) / 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex: none;
}
.lang-btn {
  position: relative;
  z-index: 1;
  min-width: 52px;
  padding: 8px 14px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgb(var(--tx2));
  border-radius: 999px;
  transition: color .25s;
}
.lang-btn:hover { color: #fff; }
.lang-btn.is-active { color: #fff; }
.lang-btn:focus-visible { outline: 2px solid rgb(var(--a200) / 0.9); outline-offset: 2px; }
.lang-indicator {
  position: absolute;
  top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(var(--a500)), rgb(var(--a400)));
  box-shadow: 0 4px 14px rgb(var(--a500) / 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}
.lang[data-active="en"] .lang-indicator { transform: translateX(100%); }
.lite .lang { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgb(var(--bg2) / 0.9); }
.logo { height: 46px; width: auto; display: block; }

/* ---------- Hero ---------- */
.hero {
  grid-area: hero;
  padding-top: clamp(0px, 1vw, 12px);
  max-width: 860px;
}

.title {
  font-family: "Montserrat", sans-serif;
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}
.title .t1 { display: block; font-size: clamp(50px, 5.9vw, 100px); }
.title .t2 { display: block; font-size: clamp(34px, 4.05vw, 68px); margin-top: 4px; }
.title .accent {
  /* layer 1: light sweep, layer 2: glossy diagonal violet */
  background:
    linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.85) 50%, transparent 58%),
    linear-gradient(160deg, rgb(var(--a50)) 0%, rgb(var(--a200)) 28%, rgb(var(--a400)) 60%, rgb(var(--a500)) 100%);
  background-size: 260% 100%, 100% 100%;
  background-position: 160% 0, 0 0;
  background-repeat: no-repeat;
  animation: title-shine 7s ease-in-out 1.2s infinite;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 4px 22px rgb(var(--a400) / 0.45));
}

.subtitle {
  margin-top: 22px;
  font-size: clamp(17px, 1.6vw, 26px);
  line-height: 1.3;
  color: rgb(var(--a50));
  font-weight: 500;
}

.features {
  list-style: none;
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1.5px solid transparent;
  border-radius: 18px;
  position: relative;
  background: rgb(var(--bg2) / 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 30px rgb(var(--a400) / 0.18), inset 0 0 24px rgb(var(--a400) / 0.08);
  padding: 16px 0 14px;
  max-width: 834px;
}
.features li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: clamp(14px, 1.15vw, 19px);
  line-height: 1.25;
  font-weight: 500;
  position: relative;
}
.features li + li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.22), transparent);
}
.features svg { width: 46px; height: 46px; color: var(--violet-2); filter: drop-shadow(0 0 8px rgb(var(--a500) / 0.5)); }

.cards-art { display: none; }

/* ---------- Auth card ---------- */
.auth {
  grid-area: auth;
  align-self: start;
  margin-top: 36px;
  background: var(--panel);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  position: relative;
  box-shadow: 0 0 40px rgb(var(--a400) / 0.16), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 22px 37px 30px;
}

.tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line-soft);
}
.tab {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 14px 0 20px;
  font-size: 22px;
  color: rgb(var(--tx2));
  transition: color .2s;
}
.tab.is-active { color: #fff; font-weight: 600; }
.tab:hover { color: #fff; }
.tab-indicator {
  position: absolute;
  left: 0; bottom: -1px;
  width: 50%;
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgb(var(--a500)), rgb(var(--a400)));
  box-shadow: 0 0 12px rgb(var(--a400) / 0.7);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.tabs[data-active="register"] .tab-indicator { transform: translateX(100%); }

.form { display: flex; flex-direction: column; }

.field { display: block; margin-top: 30px; }
.field + .field { margin-top: 18px; }
.label { display: block; font-size: 20px; font-weight: 500; margin-bottom: 10px; }

.input {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 68px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgb(var(--bg0) / 0.55);
  transition: border-color .2s, box-shadow .2s;
}
.input:focus-within {
  border-color: rgb(var(--a400) / 0.8);
  box-shadow: 0 0 0 3px rgb(var(--a400) / 0.18);
}
.field.has-error .input { border-color: #ff5c8a; }
.input > svg { width: 30px; height: 30px; flex: none; color: rgb(var(--tx1)); }
.input input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 20px;
  height: 100%;
}
.input input::placeholder { color: rgb(var(--tx3)); }

/* Browser autofill (saved emails/passwords): keep the dark look instead of white/yellow */
.input input:-webkit-autofill,
.input input:-webkit-autofill:hover,
.input input:-webkit-autofill:focus,
.input input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px rgb(var(--bg1)) inset;
  box-shadow: 0 0 0 1000px rgb(var(--bg1)) inset;
  /* stops Chrome from fading its own background back in */
  transition: background-color 9999s ease-out 0s;
}
/* Chrome draws autofilled text with its own font; force the field's font and size */
.input input:-webkit-autofill::first-line {
  font-family: "Open Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: inherit;
  color: var(--text);
}
.input input:autofill {
  box-shadow: 0 0 0 1000px rgb(var(--bg1)) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
}
/* the whole field gets the same dark tone so there is no visible box around the text */
.input:has(input:-webkit-autofill) { background: rgb(var(--bg1)); }
.input:has(input:autofill) { background: rgb(var(--bg1)); }

.eye {
  background: none; border: 0; cursor: pointer;
  display: grid; place-items: center;
  color: #fff;
  padding: 4px;
}
.eye svg { width: 32px; height: 32px; }
.eye .slash { display: none; }
.eye.is-on .slash { display: inline; }

.error { display: block; min-height: 0; color: #ff7fa3; font-size: 14px; margin-top: 6px; }
.error:empty { display: none; }

.forgot {
  margin-top: 16px;
  font-size: 19px;
  font-weight: 500;
  color: var(--pink);
}
.forgot:hover { text-decoration: underline; }

.btn-primary {
  position: relative;
  overflow: hidden;
  margin-top: 26px;
  height: 68px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, rgb(var(--a400)) 0%, rgb(var(--a500)) 55%, rgb(var(--a400)) 100%);
  box-shadow: 0 10px 30px rgb(var(--a500) / 0.45), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform .15s, filter .2s, box-shadow .2s;
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 12px 36px rgb(var(--a500) / 0.6), inset 0 1px 0 rgba(255,255,255,0.25); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .7; cursor: progress; }

.divider {
  display: flex; align-items: center; gap: 22px;
  margin: 26px 0 22px;
  color: rgb(var(--tx1)); font-size: 20px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.socials { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.btn-social {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  height: 70px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  background: rgb(var(--bg0) / 0.5);
  cursor: pointer;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: border-color .2s, background .2s;
  padding: 0 12px;
}
.btn-social:hover { border-color: rgb(var(--a400) / 0.7); background: rgb(var(--bg2) / 0.5); }
.btn-social svg { width: 42px; height: 42px; flex: none; }

.switch { margin-top: 44px; text-align: center; font-size: 22px; color: rgb(var(--tx1)); }
.switch a { color: var(--pink); font-weight: 600; margin-left: 4px; }
.switch a:hover { text-decoration: underline; }

/* login/register visibility */
.only-register { display: none !important; }
.auth[data-mode="register"] .only-register { display: block !important; }
.auth[data-mode="register"] .switch .only-register { display: inline !important; }
.auth[data-mode="register"] .only-login { display: none !important; }

/* ---------- Smooth open/close of the extra register field ---------- */
.collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .5s cubic-bezier(.4, 0, .2, 1), opacity .35s ease;
}
.collapse-inner {
  min-height: 0;
  overflow: hidden;
  /* room for the focus ring so it is not clipped */
  padding: 0 4px 4px;
  margin: 0 -4px -4px;
}
.collapse-inner > * {
  transform: translateY(-10px);
  transition: transform .5s cubic-bezier(.4, 0, .2, 1);
}
.collapse .field { margin-top: 18px; }
.forgot-row { display: flex; justify-content: flex-end; }

.collapse[data-show="login"],
.auth[data-mode="register"] .collapse[data-show="register"] {
  grid-template-rows: 1fr;
  opacity: 1;
}
.collapse[data-show="login"] .collapse-inner > *,
.auth[data-mode="register"] .collapse[data-show="register"] .collapse-inner > * { transform: none; }

.auth[data-mode="register"] .collapse[data-show="login"] {
  grid-template-rows: 0fr;
  opacity: 0;
}
.auth[data-mode="register"] .collapse[data-show="login"] .collapse-inner > * { transform: translateY(-10px); }

/* the switch text and button label fade when the mode changes */
.btn-primary, .switch { transition: opacity .2s ease; }
.auth.is-switching .switch { opacity: 0; }

/* ---------- Footer ---------- */
.legal {
  grid-area: legal;
  justify-self: center;
  margin-top: 18px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgb(var(--bg1) / 0.55);
  border: 1px solid rgb(var(--a400) / 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 15px;
  color: rgb(var(--tx1));
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 14px 22px;
  border-radius: 12px;
  background: rgb(var(--bg2) / 0.95);
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  font-size: 16px;
  transition: opacity .25s, transform .25s;
  z-index: 10;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tablet / mobile: one strip ---------- */
@media (max-width: 1100px) {
  .frame {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "hero"
      "art"
      "auth"
      "legal";
    padding: 36px 24px 22px;
    max-width: 820px;
    margin: 0 auto;
  }
  .bg {
    background:
      radial-gradient(ellipse 60% 18% at 70% 6%, rgba(255, 170, 90, 0.10), transparent 70%),
      radial-gradient(ellipse 90% 35% at 50% 18%, rgb(var(--a600) / 0.35), transparent 75%),
      rgb(var(--bg1));
  }
  .brand { padding-left: 18px; padding-right: 8px; }
  .hero { padding: 26px 18px 0; max-width: none; }
  .title .t1 { font-size: clamp(40px, 11vw, 96px); }
  .title .t2 { font-size: clamp(28px, 7.7vw, 66px); }
  .subtitle { font-size: clamp(16px, 3.4vw, 26px); margin-top: 18px; }
  .features { margin-top: 24px; margin-left: -6px; margin-right: -6px; max-width: none; }

  .cards-art {
    display: block;
    grid-area: art;
    height: clamp(260px, 52vw, 440px);
    margin: 4px -24px -60px;
    background: url("/assets/brand/background.jpg") 84% 62% / auto 175% no-repeat;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 72%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 72%, transparent 100%);
    position: relative;
    z-index: -1;
  }
  .auth { margin: 0; padding: 22px 34px 26px; }
  .switch { margin-top: 26px; }
}

@media (max-width: 560px) {
  body { padding: 8px; }
  .frame { padding: 26px 14px 18px; border-radius: 20px; }
  .brand, .hero { padding-left: 8px; padding-right: 8px; }
  .logo { height: 36px; }
  .lang-btn { min-width: 44px; padding: 7px 10px; font-size: 13px; }
  .features { padding: 12px 0 10px; }
  .features svg { width: 34px; height: 34px; }
  .features li { font-size: 13px; }
  .cards-art { margin: 4px -14px -40px; }
  .auth { padding: 14px 18px 20px; }
  .tab { font-size: 19px; padding: 12px 0 16px; }
  .field { margin-top: 22px; }
  .label { font-size: 17px; }
  .input { height: 56px; padding: 0 14px; gap: 12px; }
  .input > svg { width: 24px; height: 24px; }
  .input input { font-size: 17px; }
  .eye svg { width: 26px; height: 26px; }
  .forgot { font-size: 16px; }
  .btn-primary { height: 56px; font-size: 20px; margin-top: 20px; }
  .divider { font-size: 17px; margin: 20px 0 16px; }
  .socials { gap: 10px; }
  .btn-social { height: 56px; gap: 7px; font-size: 12.5px; padding: 0 6px; letter-spacing: -0.02em; }
  .subtitle br { display: none; }
  .btn-social svg { width: 30px; height: 30px; }
  .switch { font-size: 17px; }
}

@media (max-width: 380px) {
  .socials { grid-template-columns: minmax(0, 1fr); }
  .btn-social { font-size: 14px; }
}

/* ---------- Glass borders: violet light slowly travelling around the edge ---------- */
@property --a {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.glass::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  padding: 1.5px;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  --a: var(--start, 0deg);
  background: conic-gradient(from var(--a),
    rgb(var(--a400) / 0.30) 0deg,
    rgb(var(--a400) / 0.85) 30deg,
    rgb(var(--a50) / 1) 48deg,
    rgb(var(--a400) / 0.85) 66deg,
    rgb(var(--a400) / 0.35) 110deg,
    rgb(var(--a500) / 0.18) 160deg,
    rgb(var(--a400) / 0.35) 200deg,
    rgb(var(--a200) / 0.95) 228deg,
    rgb(var(--a400) / 0.4) 265deg,
    rgb(var(--a500) / 0.18) 320deg,
    rgb(var(--a400) / 0.30) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: glass-spin var(--speed, 20s) linear infinite var(--dir, normal);
}
.frame.glass::before { inset: -1px; padding: 1px; opacity: 0.8; }

/* glass sheen on the top edge */
.auth::after, .features::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 22%);
}

@keyframes glass-spin {
  from { --a: var(--start, 0deg); }
  to   { --a: calc(var(--start, 0deg) + 360deg); }
}

/* ---------- Small modern touches ---------- */

/* soft light that follows the cursor inside the form card */
.auth { --mx: 50%; --my: 0%; }
.auth > .tabs, .auth > .form { position: relative; z-index: 1; }
.auth .spot {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgb(var(--a400) / 0.13), transparent 60%);
  opacity: 0;
  transition: opacity .4s;
}
.auth:hover .spot { opacity: 1; }

/* slow light sweep across the main button */
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: translateX(-140%) skewX(-20deg);
  animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen {
  0%, 70% { transform: translateX(-140%) skewX(-20deg); }
  100% { transform: translateX(440%) skewX(-20deg); }
}

/* feature icons gently lift on hover */
.features svg { transition: transform .35s ease, filter .35s ease; }
.features li:hover svg { transform: translateY(-3px); filter: drop-shadow(0 0 14px rgb(var(--a500) / 0.85)); }

/* background drifts a little with the mouse */
.bg { transform: translate3d(var(--px, 0), var(--py, 0), 0) scale(1.04); transition: transform .6s ease-out; }

/* entrance */
.brand, .hero, .auth, .cards-art, .legal { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero { animation-delay: .08s; }
.auth { animation-delay: .16s; }
.cards-art { animation-delay: .12s; }
.legal { animation-delay: .3s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .glass::before, .btn-primary::after, .brand, .hero, .auth, .cards-art, .legal { animation: none; }
  .bg { transform: scale(1.04); transition: none; }
}

/* ---------- Desktop: whole page at 85%, centered, with ambient background ---------- */
.ambient { display: none; }

@media (min-width: 1101px) {
  :root { --page-scale: 0.85; }
  body {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    /* sits a little lower than exact center */
    padding: 3vh 0 0;
    overflow-x: hidden;
    background: var(--bg);
  }
  .frame {
    zoom: var(--page-scale);
    width: 100vw;
    min-height: 100vh;
    align-content: center;
    z-index: 1;
    box-shadow: 0 30px 120px rgba(0, 0, 0, 0.7), 0 0 90px rgb(var(--a400) / 0.18);
  }

  .logo { height: 51px; }

  /* blurred copy of the scene fills the space around the page */
  body::before {
    content: "";
    position: fixed;
    inset: -60px;
    z-index: 0;
    background: url("/assets/brand/background.jpg") center / cover no-repeat;
    filter: blur(44px) brightness(0.7) saturate(1.35) var(--art-filter);
    animation: ambient-breathe 18s ease-in-out infinite alternate;
  }
  /* vignette + soft violet glow behind the page */
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
      radial-gradient(ellipse 60% 55% at 50% 50%, rgb(var(--a400) / 0.22), transparent 70%),
      radial-gradient(ellipse at center, transparent 55%, rgb(var(--bg0) / 0.55) 100%);
  }

  /* card suits slowly floating up */
  .ambient {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
  }
  .ambient span {
    position: absolute;
    bottom: -120px;
    color: rgb(var(--a400));
    line-height: 1;
    text-shadow: 0 0 24px rgb(var(--a500) / 0.8);
    animation: float-up linear infinite;
    will-change: transform;
  }
}

@keyframes ambient-breathe {
  from { transform: scale(1.05); opacity: 0.9; }
  to   { transform: scale(1.12); opacity: 1; }
}
@keyframes float-up {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to   { transform: translate3d(var(--drift, 40px), -125vh, 0) rotate(var(--spin, 180deg)); }
}
@media (prefers-reduced-motion: reduce) {
  body::before, .ambient span { animation: none; }
  .ambient { display: none; }
}

@keyframes title-shine {
  0%, 62% { background-position: 160% 0, 0 0; }
  100%    { background-position: -60% 0, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .title .accent { animation: none; }
}

/* =========================================================
   Performance & compatibility
   ========================================================= */

/* Phones / tablets: same look, less GPU work */
@media (max-width: 1100px), (hover: none) {
  /* only the form card keeps the moving light; the others stay still */
  .frame.glass::before, .features.glass::before { animation: none; }
  .auth.glass::before { animation-duration: 30s; }
  .auth { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  .features { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgb(var(--bg2) / 0.78); }
  .bg { transform: none; transition: none; }
  .auth .spot { display: none; }
}

/* Lite mode: weak device, data saver or battery saver (set by script.js) */
.lite .glass::before,
.lite .btn-primary::after,
.lite .title .accent,
.lite body::before { animation: none !important; }
.lite .auth, .lite .features, .lite .legal { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.lite .auth { background: rgb(var(--bg2) / 0.94); }
.lite .features { background: rgb(var(--bg2) / 0.85); }
.lite .ambient { display: none !important; }

/* Very old browsers without masks: plain violet border instead of the glass one */
@supports not ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
  .glass::before { display: none; }
  .auth.glass, .features.glass { border-color: rgb(var(--a400) / 0.55); }
  .frame.glass { border-color: rgb(var(--a400) / 0.35); }
}

/* No backdrop blur support: make panels more solid so text stays readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .auth { background: rgb(var(--bg2) / 0.94); }
  .features { background: rgb(var(--bg2) / 0.85); }
  .legal { background: rgb(var(--bg1) / 0.85); }
}

/* No text-clip support: show the accent word as solid violet */
@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
  .title .accent { background: none; color: rgb(var(--a200)); }
}

/* ---------- Language switch transition ---------- */
.legal > [data-i18n-html] { display: inline-block; }
[data-i18n], [data-i18n-html], [data-i18n-ph], .error {
  transition: opacity .22s ease, filter .22s ease, color .2s ease;
}
.i18n-out {
  opacity: 0;
  filter: blur(3px);
}
input.i18n-out { filter: none; }
/* the main button keeps its shape; only its label fades */
.btn-primary { transition: transform .15s, filter .2s, box-shadow .2s, color .22s ease, text-shadow .22s ease; }
.btn-primary.i18n-out { opacity: 1; filter: none; color: transparent; }
@media (prefers-reduced-motion: reduce) {
  [data-i18n], [data-i18n-html], [data-i18n-ph], .error { transition: none; }
}

/* =========================================================
   Transition / loading screen
   ========================================================= */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 44%, rgb(var(--a500) / 0.32), transparent 55%),
    radial-gradient(ellipse at center, rgb(var(--bg0) / 0.78) 0%, rgb(var(--bg0) / 0.96) 100%);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  opacity: 0;
  transition: opacity .5s ease;
}
.loader[hidden] { display: none; }
.loader.is-in { opacity: 1; }
.loader.is-out { opacity: 0; transition-duration: .6s; }

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: translateY(12px) scale(.96);
  opacity: 0;
  transition: transform .7s cubic-bezier(.2, .8, .2, 1) .1s, opacity .6s ease .1s;
}
.loader.is-in .loader-inner { transform: none; opacity: 1; }
.loader.is-out .loader-inner { transform: scale(1.04); opacity: 0; transition-delay: 0s; }

/* page behind gently recedes */
body.is-loading .frame { filter: blur(2px) brightness(.7); transform: scale(.985); transition: filter .6s ease, transform .6s ease; }

/* icon tile + ring */
.loader-mark {
  position: relative;
  width: 168px;
  height: 168px;
  display: grid;
  place-items: center;
  perspective: 700px;
}
.loader-glow {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--a400) / 0.75), transparent 70%);
  filter: blur(22px);
  animation: loader-pulse 2.2s ease-in-out infinite;
}
.loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from 0deg,
    rgb(var(--a400) / 0) 0deg,
    rgb(var(--a400) / 0.15) 90deg,
    rgb(var(--a200) / 0.9) 250deg,
    #fff 300deg,
    rgb(var(--a400) / 0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: loader-spin 1.4s linear infinite;
}
.loader-ring::after {
  /* bright head of the ring */
  content: "";
  position: absolute;
  top: 50%; right: -1px;
  width: 8px; height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px 4px rgb(var(--a200) / 0.9);
}
.loader-card {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgb(var(--a400)) 0%, rgb(var(--a400)) 50%, rgb(var(--a500)) 100%);
  box-shadow: 0 16px 40px rgb(var(--a500) / 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -6px 14px rgb(var(--a900) / 0.35);
  animation: loader-flip 1.2s cubic-bezier(.6, 0, .4, 1) infinite;
  transform-style: preserve-3d;
}
.loader-card::after {
  /* glass sheen on the tile */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.28), transparent 45%);
  pointer-events: none;
}
.loader-suit { width: 46px; height: 46px; fill: rgb(var(--bg1)); }

.loader-word {
  width: 210px;
  height: auto;
  margin-top: 30px;
}

.loader-bar {
  position: relative;
  width: 240px;
  height: 4px;
  margin-top: 26px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.loader-bar > span {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgb(var(--a500)), rgb(var(--a400)), rgb(var(--a50)));
  box-shadow: 0 0 12px rgb(var(--a500) / 0.8);
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  transition: transform .5s cubic-bezier(.4, 0, .2, 1);
}
.loader-bar::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 60px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: loader-sheen 1.3s ease-in-out infinite;
}

.loader-text {
  min-height: 1.4em;
  margin-top: 16px;
  font-size: 16px;
  font-weight: 500;
  color: rgb(var(--tx1));
  letter-spacing: 0.01em;
  transition: opacity .25s ease, filter .25s ease;
}
.loader-text.is-swap { opacity: 0; filter: blur(3px); }
.loader.is-done .loader-text { color: #fff; }
.loader.is-done .loader-card { animation: loader-done .6s cubic-bezier(.2, .8, .2, 1) both; }
.loader.is-done .loader-ring { animation-duration: .7s; }

@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes loader-pulse {
  0%, 100% { transform: scale(.85); opacity: .6; }
  50% { transform: scale(1.1); opacity: 1; }
}
/* the tile flips; script swaps the suit while it is edge-on */
@keyframes loader-flip {
  0%, 30% { transform: rotateY(0deg); }
  50% { transform: rotateY(90deg); }
  50.01% { transform: rotateY(-90deg); }
  70%, 100% { transform: rotateY(0deg); }
}
@keyframes loader-done {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes loader-sheen {
  from { transform: translateX(-60px); }
  to { transform: translateX(260px); }
}

@media (max-width: 560px) {
  .loader-mark { width: 140px; height: 140px; }
  .loader-card { width: 82px; height: 82px; border-radius: 22px; }
  .loader-suit { width: 40px; height: 40px; }
  .loader-word { width: 180px; margin-top: 26px; }
  .loader-bar { width: 200px; }
  .loader-text { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .loader-card, .loader-glow, .loader-bar::after { animation: none; }
  .loader-ring { animation-duration: 3s; }
}
.lite .loader { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgb(var(--bg0) / 0.97); }
.lite body.is-loading .frame, .lite.is-loading .frame { filter: none; }
.lite .loader-card, .lite .loader-glow, .lite .loader-bar::after { animation: none; }

/* =========================================================
   Real accounts: hints, recover mode, recovery code, signed-in
   ========================================================= */
.only-recover, .only-new { display: none !important; }
.auth[data-mode="recover"] .only-recover { display: inline !important; }
.auth[data-mode="recover"] .only-login { display: none !important; }
.auth[data-mode="register"] .only-new, .auth[data-mode="recover"] .only-new { display: block !important; }
.auth[data-mode="register"] .field-hint.only-register { display: block !important; }

.collapse[data-show="recover"], .collapse[data-show="register"] { grid-template-rows: 0fr; opacity: 0; }
.auth[data-mode="recover"] .collapse[data-show="recover"] { grid-template-rows: 1fr; opacity: 1; }
.auth[data-mode="recover"] .collapse[data-show="recover"] .collapse-inner > * { transform: none; }
.auth[data-mode="recover"] .collapse[data-show="login"] { grid-template-rows: 0fr; opacity: 0; }
.auth[data-mode="recover"] .collapse[data-show="login"] .collapse-inner > * { transform: translateY(-10px); }

.field-hint { margin-top: 7px; font-size: 13px; line-height: 1.4; color: rgb(var(--tx3)); }
.recover-head { margin-top: 26px; display: grid; gap: 4px; }
.recover-head b { font-size: 20px; font-weight: 700; }
.recover-head span { color: rgb(var(--tx2)); font-size: 15px; line-height: 1.45; }
.auth[data-mode="recover"] .recover-head ~ * {}
.auth[data-mode="recover"] .tabs { opacity: .45; }

.form-error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 92, 138, 0.1);
  border: 1px solid rgba(255, 92, 138, 0.35);
  color: #ffb3c8;
  font-size: 15px;
  line-height: 1.45;
}
.form-error:empty { display: none; }

.auth-view { position: relative; z-index: 1; }
.auth-view.view-in { animation: view-in .45s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }

.panel-view { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 4px 6px; }
.panel-view h2 { margin-top: 18px; font-family: "Montserrat", sans-serif; font-weight: 800; font-size: 26px; letter-spacing: -0.02em; line-height: 1.2; }
.panel-view p { margin-top: 10px; color: rgb(var(--tx2)); font-size: 16px; line-height: 1.5; max-width: 420px; }
.panel-icon {
  width: 70px; height: 70px;
  border-radius: 22px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgb(var(--a400)), rgb(var(--a500)));
  box-shadow: 0 14px 34px rgb(var(--a500) / 0.5), inset 0 1px 0 rgba(255,255,255,.3);
  color: #fff;
}
.panel-icon svg { width: 34px; height: 34px; }
.recovery-code {
  margin-top: 22px;
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed rgb(var(--a200) / 0.6);
  background: rgb(var(--a400) / 0.1);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 17px;
  line-height: 1.6;
  color: rgb(var(--a50));
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}
.panel-actions { margin-top: 22px; width: 100%; display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.panel-actions .btn-primary { margin-top: 0; }
.btn-ghost {
  height: 68px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: rgb(var(--a50));
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.btn-ghost:hover { border-color: rgb(var(--a400) / 0.7); background: rgb(var(--a400) / 0.12); }
.signed-avatar {
  width: 78px; height: 78px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: "Montserrat", sans-serif;
  font-size: 32px; font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #ffb86b, #ff5ca8);
  box-shadow: 0 12px 30px rgba(255, 92, 168, 0.35);
  text-transform: uppercase;
}
.accent-text {
  background: linear-gradient(160deg, rgb(var(--a50)) 0%, rgb(var(--a200)) 28%, rgb(var(--a400)) 60%, rgb(var(--a500)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* header row now also holds the language switch */
.brand { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

@media (max-width: 560px) {
  .field-hint { font-size: 12px; }
  .recover-head b { font-size: 18px; }
  .panel-view h2 { font-size: 22px; }
  .panel-view p { font-size: 14px; }
  .recovery-code { font-size: 15px; padding: 14px; }
  .btn-ghost { height: 56px; font-size: 16px; }
  .panel-actions { grid-template-columns: 1fr; }
  .form-error { font-size: 14px; }
  /* iOS: no zoom when a field is focused */
  .input input { font-size: 16px; }
}

[hidden] { display: none !important; }

/* ---------- theme hooks: photos and logo follow the palette ---------- */
.bg, .cards-art { filter: var(--art-filter); }
.logo, .loader-word { filter: var(--logo-filter); }
.btn-primary, .lang-btn.is-active, .lang-btn.is-active:hover { color: rgb(var(--on-accent)); }

/* title: "Дурак" in plain white, no gradient or shine */
.title .accent {
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #fff;
  -webkit-text-fill-color: #fff;
  filter: none;
  animation: none;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}
/* hero text: everything pure white */
.title, .title .t1, .title .t2, .subtitle { color: #fff; -webkit-text-fill-color: #fff; }

/* ---------- social sign-in and email code ---------- */
.auth[data-mode="recover"] .social-block { display: none; }
.social-block .divider { margin: 24px 0 18px; }
.btn-social:disabled { opacity: .6; cursor: progress; }
.verify-form { width: 100%; margin-top: 20px; display: grid; gap: 12px; }
.verify-form .btn-primary { margin-top: 4px; }
.code-input {
  width: 100%; height: 68px; box-sizing: border-box;
  border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgb(var(--bg0) / 0.6); color: #fff;
  text-align: center; font: 800 32px/1 "Montserrat", sans-serif; letter-spacing: .5em; padding-left: .5em;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.code-input:focus { border-color: rgb(var(--a400) / 0.8); box-shadow: 0 0 0 3px rgb(var(--a500) / 0.18); }
.link-btn { margin-top: 16px; background: none; border: 0; color: rgb(var(--link)); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.link-btn:disabled { color: rgb(var(--tx3)); cursor: default; }
@media (max-width: 560px) { .code-input { height: 56px; font-size: 26px; } }
