:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #090909;
  --text: #fff;
  --muted: rgba(255, 255, 255, .62);
  --line: rgba(255, 255, 255, .22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", "Cascadia Mono", "Lucida Console", "Courier New", monospace;
  letter-spacing: .015em;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: .22;
  background-image:
    radial-gradient(circle at 16% 13%, rgba(255,255,255,.18) 0 .7px, transparent .9px),
    radial-gradient(circle at 87% 76%, rgba(255,255,255,.12) 0 .7px, transparent .9px),
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(255,255,255,.1) 3px);
  background-size: 10px 10px, 13px 13px, auto;
}

a { color: inherit; text-decoration: none; }

.auth-page,
.cabinet-page {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  justify-items: center;
  align-content: center;
  padding: 54px 24px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: fit-content;
  margin-bottom: 28px;
}

.auth-brand img { width: 58px; height: 58px; object-fit: contain; }
.auth-brand span { display: flex; align-items: baseline; letter-spacing: -.08em; }
.auth-brand strong { font-size: 29px; line-height: 1; }
.auth-brand small { margin-left: 5px; font-size: 13px; letter-spacing: -.05em; }

.auth-card,
.cabinet-card {
  width: min(100%, 476px);
  padding: 30px;
  border: 1px solid #fff;
  background:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px),
    var(--panel);
  background-size: 22px 22px, 22px 22px, auto;
  box-shadow: 12px 12px 0 rgba(255,255,255,.12);
}

.auth-card-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: -10px 0 25px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-card-topline a { color: #fff; border-bottom: 1px solid #fff; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border: 1px solid var(--line);
  background: #000;
}

.auth-tab {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 700 11px inherit;
  text-transform: uppercase;
  cursor: pointer;
}

.auth-tab.is-active { background: #fff; color: #000; }

.auth-copy { padding: 25px 0 20px; }
.auth-copy .eyebrow, .cabinet-card .eyebrow { margin: 0 0 10px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.auth-copy h1, .cabinet-card h1 { margin: 0 0 10px; font-size: 29px; line-height: 1; letter-spacing: -.08em; text-transform: uppercase; }
.auth-copy p:last-child { max-width: 355px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

.provider-stack { display: grid; gap: 9px; }

.provider {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  gap: 11px;
  border: 1px solid #fff;
  background: #000;
  color: #fff;
  font: 700 11px inherit;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.provider:hover { background: #fff; color: #000; transform: translate(-2px, -2px); }
.provider-main { justify-content: flex-start; padding: 0 15px; }
.provider-main b { margin-left: auto; font-size: 20px; font-weight: 400; }

.provider-icon {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
}
.telegram-icon { transform: rotate(-25deg); }
.google-icon { border: 0; }
.google-icon svg { width: 20px; height: 20px; }

.divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 11px; margin: 19px 0; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.divider::before, .divider::after { height: 1px; content: ""; background: var(--line); }

.email-form,
.code-form,
.complete-registration { display: grid; gap: 11px; }

.email-form label,
.code-form label,
.complete-registration label { display: grid; gap: 7px; }
.email-form label > span, .code-form label > span, .complete-registration label > span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: #000;
  color: #fff;
  font: 14px inherit;
  padding: 0 13px;
}

input:focus { border-color: #fff; box-shadow: 3px 3px 0 rgba(255,255,255,.12); }

.email-control { display: flex; min-width: 0; }
.email-control input { min-width: 0; border-right: 0; }
.email-control button {
  flex: 0 0 auto;
  min-width: 132px;
  border: 1px solid var(--line);
  background: #fff;
  color: #000;
  font: 700 10px inherit;
  text-transform: uppercase;
  cursor: pointer;
}
.email-control button:hover:not(:disabled) { background: #000; color: #fff; }
.email-control button:disabled { cursor: wait; background: #171717; color: var(--muted); }

.email-submit,
.logout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 49px;
  gap: 12px;
  margin-top: 3px;
  border: 1px solid #fff;
  background: #fff;
  color: #000;
  font: 700 11px inherit;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.email-submit b { margin-left: auto; padding-right: 16px; font-size: 20px; font-weight: 400; }
.email-submit:hover { transform: translate(-2px, -2px); background: #000; color: #fff; }

.registration-provider { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.passkey-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 43px;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.64);
  color: var(--muted);
  font: 700 10px inherit;
  text-transform: uppercase;
}
.passkey-button span { font-size: 18px; }
.passkey-button small { font: 9px inherit; }

.auth-message { min-height: 18px; margin: 13px 0 0; color: #fff; font-size: 11px; line-height: 1.45; }
.auth-message.is-error { color: #ff9999; }
.auth-message.is-success { color: #a7ffcb; }
.auth-note { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.cabinet-card { display: grid; gap: 0; }
.cabinet-email { margin: 0 0 24px; color: var(--muted); font-size: 12px; }
.cabinet-stats { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 22px; border: 1px solid var(--line); }
.cabinet-stats div { display: grid; gap: 7px; padding: 16px; }
.cabinet-stats div + div { border-left: 1px solid var(--line); }
.cabinet-stats span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.cabinet-stats strong { font-size: 20px; letter-spacing: -.06em; }
.cabinet-caption { margin: 0 0 20px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.logout-button { margin-top: 10px; border-color: var(--line); background: #000; color: #fff; }

@media (max-width: 520px) {
  .auth-page, .cabinet-page { align-content: start; padding: 32px 16px; }
  .auth-brand { margin-bottom: 22px; }
  .auth-brand img { width: 48px; height: 48px; }
  .auth-brand strong { font-size: 24px; }
  .auth-card, .cabinet-card { padding: 21px 17px; box-shadow: 7px 7px 0 rgba(255,255,255,.12); }
  .auth-card-topline { margin: -2px 0 19px; font-size: 8px; }
  .auth-copy { padding: 21px 0 17px; }
  .auth-copy h1, .cabinet-card h1 { font-size: 25px; }
  .email-control button { min-width: 112px; font-size: 9px; }
}
