/* Screens of the sign-in flow. The checkout (checkout.css) keeps the earlier look: wordmark, #111 card,
   quiet yellow pill. The login itself follows mockups/version_2/login: the landing's topbar,
   one grey plate and the face (face.css) peeking out from behind its top edge. */
.app:has(:is(.login-card, .checkout-card)) { width: 100%; margin: 0; padding: 0; }
#app-root:has(.checkout-card) { display: flex; min-height: 100svh; padding: 32px 24px; }
.login-screen { display: flex; flex: 1; min-width: 0; flex-direction: column; align-items: center; gap: 32px; }
.login-brand { display: inline-flex; align-items: baseline; gap: 5px; font-size: 30px; font-weight: 750; letter-spacing: -.065em; }
.login-brand-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.checkout-card { width: 520px; max-width: 100%; margin: auto 0; padding: 40px; border-radius: 36px; background: #111; animation: login-content-in .38s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes login-content-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
:is(.login-card, .checkout-card) :is(button, input, h1):focus { outline: none; }
:is(.login-card, .checkout-card) button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.login-title { font-size: 36px; font-weight: 650; line-height: 1.15; letter-spacing: -.035em; }

/* Quiet primary, as «Создать поиск» in the search dialog: the checkout and the consent dialog. */
.login-action { display: flex; width: 100%; min-height: 60px; align-items: center; justify-content: center; gap: 10px; margin-top: 28px; padding: 0 24px; border: 0; border-radius: 999px; background: #353535; color: var(--accent); font-size: 18px; font-weight: 650; transition: background-color .2s ease, color .2s ease; }
.login-action:hover:not(:disabled) { background: #414141; color: #ffdc85; }
.login-action:focus-visible { outline: none; background: #484848; }
.login-action:disabled { color: #8a8a8a; cursor: not-allowed; }
/* Request in flight: same pill, spinner in front of the label, clicks ignored by the controller. */
.login-action.is-loading, .login-action.is-loading:hover:not(:disabled) { background: #353535; color: #b9b9b9; cursor: progress; }
.login-action.is-loading::before { content: ""; width: 20px; height: 20px; flex: none; border: 2.5px solid rgba(255, 255, 255, .18); border-top-color: var(--accent); border-radius: 50%; animation: login-spin .8s linear infinite; }
@keyframes login-spin { to { transform: rotate(360deg); } }

/* Secondary way back: a small pill above the title. */
.login-back { display: inline-flex; height: 36px; align-items: center; gap: 2px; margin: -6px 0 22px -4px; padding: 0 14px 0 8px; border: 0; border-radius: 999px; background: #1b1b1b; color: #999; font-size: 15px; font-weight: 600; transition: background-color .15s ease, color .15s ease; }
.login-back svg { width: 20px; height: 20px; stroke-width: 2.2; }
.login-back:hover { background: #242424; color: #fff; }
.login-back:focus-visible { outline: none; background: #2a2a2a; color: #fff; }

/* ---- the login ---- */
#app-root:has(.login-card) { display: flex; min-height: 100svh; padding: 0; }
.login-page { --login-ease: cubic-bezier(.22, 1, .36, 1); display: flex; flex: 1; min-width: 0; flex-direction: column; background: #000; }

/* the landing's topbar with its logo, whose «o» blinks now and then */
.login-topbar { display: flex; align-items: center; width: min(1232px, calc(100% - 48px)); height: 64px; margin: 0 auto; border-bottom: 1px solid #ffffff12; }
.login-logo { display: inline-flex; align-items: baseline; color: var(--text); font-size: 24px; font-weight: 750; letter-spacing: -.06em; line-height: 1; text-decoration: none; }
.login-logo svg { flex: none; width: .6em; height: .64em; margin: 0 .02em 0 .03em; overflow: visible; translate: 0 .02em; }
.login-logo path { fill: var(--text); stroke: var(--text); stroke-width: 6; stroke-linejoin: round; }
.login-logo g { fill: #000; transform-box: fill-box; transform-origin: center; animation: login-logo-blink 6s infinite; }
@keyframes login-logo-blink { 0%, 93%, 100% { transform: none; } 96% { transform: scaleY(.1); } }
.login-support { display: inline-flex; min-height: 40px; align-items: center; margin-left: auto; padding: 0 18px; border-radius: 999px; background: #1c1c1c; color: #f0f0f0; font-size: 14px; font-weight: 500; text-decoration: none; transition: background .18s ease; }
.login-support:hover { background: #262626; }

.login-main { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; width: min(1232px, calc(100% - 48px)); margin: 0 auto; padding: 56px 0 48px; }

/* the plate covers the lower part of the egg, the eyes stay above its edge */
.login-face-wrap { position: relative; z-index: 0; margin-bottom: -48px; transition: margin-top .4s var(--login-ease); }
.login-face { font-size: 156px; animation: login-rise 1s var(--login-ease) backwards; }

/* the trial the sign-in starts, said by the face over its shoulder, as «Вас пригласили!» on the landing's title
   (pages/login/say.js); the stack is pinned to the egg every frame, so it hops and leans with the face. It grows
   from the bottom, so a new bubble pushes the earlier ones up like a chat; the room above keeps it under the topbar */
.login-face-wrap:has(.login-say-bubble) { margin-top: 24px; }
.login-face-wrap:has(.login-say-bubble + .login-say-bubble) { margin-top: 68px; }
.login-say { position: absolute; left: 0; bottom: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; transition: opacity .3s ease, transform .3s ease; }
.login-say-bubble { display: none; padding: 8px 14px; border-radius: 18px 18px 18px 5px; background: #2a2a2a; color: #f1f1f1; font-size: 15px; font-weight: 500; line-height: 1.3; white-space: nowrap; transform-origin: 0 100%; }
.login-say-bubble:not(:last-child) { border-bottom-left-radius: 10px; }
.login-say-bubble.is-shown { display: block; overflow: hidden; animation: login-say-pop .55s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes login-say-pop { from { opacity: 0; transform: translate(-6px, 8px) scale(.6); } }

/* three dots while wokie is «typing», as HR's in the landing's chat */
.login-say-dots { display: none; gap: 4px; padding: 6px 2px; }
.login-say-dots i { width: 6px; height: 6px; border-radius: 50%; background: #8a8a8a; animation: login-typing 1.1s ease-in-out infinite; }
.login-say-dots i:nth-child(2) { animation-delay: .15s; }
.login-say-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes login-typing { 0%, 60%, 100% { opacity: .35; translate: 0 0; } 30% { opacity: 1; translate: 0 -3px; } }
.login-say-bubble.is-typing .login-say-dots { display: flex; }
.login-say-bubble.is-typing .login-say-text { display: none; }
.login-say-text { display: inline-block; animation: login-say-text .5s var(--login-ease) both; }
@keyframes login-say-text { from { opacity: 0; filter: blur(6px); } }

/* the bubbles are about the first step; on the code step they step aside */
.login-main:has(.login-code-field) .login-say { opacity: 0; transform: translateY(6px); }

.login-card { position: relative; z-index: 1; width: min(500px, 100%); padding: 44px 40px 36px; border-radius: 32px; background: radial-gradient(110% 60% at 50% 0%, #ffffff1a, transparent 72%), #1a1a1a; text-align: center; }

/* each step opens like the landing hero: the parts come out of a blur one after another */
.login-step > * { animation: login-rise .8s var(--login-ease) backwards; }
.login-step > :nth-child(2) { animation-delay: .06s; }
.login-step > :nth-child(3) { animation-delay: .12s; }
.login-step > :nth-child(4) { animation-delay: .18s; }
.login-step > :nth-child(5) { animation-delay: .24s; }
@keyframes login-rise { from { opacity: 0; filter: blur(12px); transform: translateY(10px); } }

.login-step-line { margin-bottom: 14px; color: #8e8e8e; font-size: 14px; font-weight: 550; }
.login-card .login-title { font-size: clamp(36px, 3.2vw, 44px); font-weight: 580; line-height: 1.08; letter-spacing: -.045em; }
.login-copy { margin-top: 16px; color: var(--muted); font-size: 17px; line-height: 1.55; text-wrap: balance; }
.login-copy strong { color: var(--text); font-weight: 550; overflow-wrap: anywhere; }

/* fields are darker than the plate and outlined, so they read as wells cut into it */
.login-methods { position: relative; isolation: isolate; display: inline-grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 28px; padding: 4px; border: 1px solid #ffffff1a; border-radius: 999px; background: #0d0d0d; }
.login-methods::before { content: ""; position: absolute; z-index: -1; inset: 4px auto 4px 4px; width: calc(50% - 4px); border-radius: 999px; background: #2e2e2e; transition: transform .32s cubic-bezier(.22, 1, .36, 1); }
.login-methods[data-method="email"]::before { transform: translateX(100%); }
.login-method { min-height: 38px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: #8e8e8e; font-size: 15px; font-weight: 550; transition: color .18s ease; }
.login-method:hover { color: #e6e6e6; }
.login-method[aria-pressed="true"] { color: #fff; }

.login-form { display: grid; }
.login-field { --field-pad: 28px; position: relative; margin-top: 14px; }
.login-input, .login-phone-template { padding: 0 var(--field-pad); font-size: 22px; font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; text-align: center; }
.login-input { width: 100%; height: 64px; border: 1px solid #ffffff21; border-radius: 999px; background: #0d0d0d; color: var(--text); transition: border-color .2s ease, background .2s ease; }
.login-input::placeholder { color: #6a6a6a; }
.login-input:hover { border-color: #ffffff33; }
.login-input:focus { border-color: #ffffff66; background: #080808; }
.login-input:read-only { color: #8e8e8e; }

/* the phone template has a fixed width, so it is centred as a whole (mask.js):
   its start stays put and the cursor does not slide while typing */
.login-input[name="phone"], .login-phone-template { padding-left: max(var(--field-pad), calc((100% - var(--template-width, 0px)) / 2)); text-align: left; }
.login-phone-template { position: absolute; inset: 0; display: flex; align-items: center; border: 1px solid transparent; color: #4a4a4a; white-space: pre; pointer-events: none; }
.login-phone-template .is-typed { color: transparent; }

.login-error { margin-top: 14px; color: #ff8585; font-size: 14px; line-height: 1.5; }
.login-error:empty { display: none; }

/* the one bright thing on the screen, as «Попробовать бесплатно» on the landing */
.login-card .login-action { min-height: 60px; margin-top: 12px; padding: 0 26px; background: #f5f5f5; color: #0a0a0a; font-size: 17px; font-weight: 560; transition: background .18s ease, transform .18s ease; }
.login-card .login-action:hover:not(:disabled) { background: #fff; color: #0a0a0a; }
.login-card .login-action:active:not(:disabled) { transform: scale(.98); }
.login-card .login-action:focus-visible { outline: 2px solid #fff; outline-offset: 3px; background: #fff; }
.login-card .login-action:disabled { background: #2e2e2e; color: #8a8a8a; }
.login-card .login-action.is-loading, .login-card .login-action.is-loading:hover:not(:disabled) { background: #cfcfcf; color: #0a0a0a; transform: none; }
.login-card .login-action.is-loading::before { border-color: #0000002e; border-top-color: #0a0a0a; }
.login-card .login-form > .consent-clickwrap { max-width: 400px; margin: 22px auto 0; color: #6f6f6f; font-size: 14px; line-height: 1.55; text-wrap: balance; }

.login-card .login-back { margin: 0 0 24px; padding: 0 16px 0 10px; background: #262626; color: #f0f0f0; font-size: 14px; font-weight: 500; }
.login-card .login-back svg { width: 18px; height: 18px; }
.login-card .login-back:hover { background: #303030; }

/* One real input for paste and one-time-code autofill, drawn as cells. */
.login-code-field { position: relative; display: grid; grid-template-columns: repeat(var(--code-length, 4), minmax(0, 1fr)); gap: 12px; width: min(400px, 100%); margin: 32px auto 0; }
.login-code { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; color: transparent; caret-color: transparent; font-size: 16px; opacity: 0; cursor: text; }
.login-cell { display: grid; height: 96px; place-items: center; border: 1px solid #ffffff21; border-radius: 26px; background: #0d0d0d; color: #fff; font-size: 42px; font-weight: 580; letter-spacing: -.03em; font-variant-numeric: tabular-nums; transition: border-color .2s ease, background .2s ease; }
.login-code-field:hover .login-cell { border-color: #ffffff33; }
.login-code-field:has(.login-code:focus) .login-cell.is-active { border-color: #ffffff66; background: #080808; }
.login-code-field:has(.login-code:focus) .login-cell.is-active:empty::after { content: ""; width: 2px; height: 40px; border-radius: 2px; background: #f5f5f5; animation: login-caret 1s steps(1) infinite; }
.login-code-field:has(.login-code:disabled) { opacity: .45; }
.login-code-field:has(.login-code:disabled) .login-code { cursor: not-allowed; }
.login-card .is-wrong { animation: login-shake .42s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes login-caret { 50% { opacity: 0; } }
@keyframes login-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* the resend waits as a quiet pill; an expired code makes it the bright one */
.login-expiry { margin-top: 28px; color: #7a7a7a; font-size: 15px; text-align: center; font-variant-numeric: tabular-nums; }
.login-card .login-expiry .login-action { margin-top: 0; background: #2e2e2e; color: #f0f0f0; }
.login-card .login-expiry .login-action:hover:not(:disabled) { background: #383838; color: #fff; }
.login-card .login-expiry .login-action.is-loading::before { border-color: #ffffff2e; border-top-color: #fff; }
.login-card .login-expiry .login-action.is-warning { background: #f5f5f5; color: #0a0a0a; }
.login-card .login-expiry .login-action.is-warning:hover:not(:disabled) { background: #fff; }
.login-card .login-expiry .login-action:disabled { background: #2e2e2e; color: #8a8a8a; }

.login-page > .legal-docs { padding: 0 20px 28px; }

@media (max-width: 760px) {
  .login-topbar, .login-main { width: calc(100% - 32px); }
  .login-main { justify-content: flex-start; padding: 24px 0 40px; }
  .login-face-wrap { margin-bottom: -40px; }
  .login-face { font-size: 128px; }
  .login-say-bubble { font-size: 14px; }
  .login-card { padding: 36px 20px 28px; border-radius: 28px; }
  .login-card .login-title { font-size: 34px; }
  .login-field { --field-pad: 24px; }
  .login-input, .login-phone-template { font-size: 20px; }
  .login-code-field { gap: 10px; }
  .login-cell { height: 80px; border-radius: 22px; font-size: 36px; }
}
@media (max-width: 540px) {
  #app-root:has(.checkout-card) { padding: 20px 16px 24px; }
  .login-screen { align-items: stretch; gap: 40px; }
  .login-brand { font-size: 26px; }
  .checkout-card { margin: 0; padding: 0; border-radius: 0; background: transparent; }
  .login-title { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .checkout-card, .checkout-card *, .checkout-card *::before, .checkout-card *::after,
  .login-page, .login-page *, .login-page *::before, .login-page *::after { transition: none !important; animation: none !important; }
}

/* the startup sketch of the checkout stays put: the step's own card makes the entrance */
[data-startup] .checkout-card { animation: none; }
