@font-face {
  font-family: Manrope;
  src: url("/assets/manrope.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  font-family: Manrope, "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  min-width: 280px;
  margin: 0;
  background: var(--night);
  color: var(--ink);
}

button, input { font: inherit; }

.access-layout {
  --access-halo: #202020;
  --access-glass: #252525a8;
  --access-field: #141414a8;
  --access-field-focus: #1b1b1b;
  --access-brand-ink: #dedede;
  --access-placeholder: #a8a8a8;
  --access-icon-filter: invert(1);
  --access-error-ink: #e3e3e3;
  --access-error-line: #b2b2b2;
  --access-shadow: #00000032;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  min-height: 100svh;
  overflow: clip;
  padding: clamp(24px, 4.2vw, 64px);
  background: radial-gradient(ellipse at 50% 24%, var(--access-halo), var(--night) 72%);
}

:root[data-theme="light"] .access-layout {
  --access-halo: #fbfcff;
  --access-glass: #fffdfbea;
  --access-field: #f7f8fbed;
  --access-field-focus: #fff;
  --access-brand-ink: #303747;
  --access-placeholder: #616a7c;
  --access-icon-filter: none;
  --access-error-ink: #8a3345;
  --access-error-line: #a24d5f;
  --access-shadow: #4f60802b;
}

.access-nickname { overflow-wrap: anywhere; }
.access-step-link, .access-start-link { color: var(--ink); text-underline-offset: 3px; }
.access-step-reset { margin-top: 16px; }
.access-step-reset button { padding: 7px 0; border: 0; background: none; font-size: 13px; text-decoration: underline; cursor: pointer; }
.access-start-link { display: inline-block; margin-top: 12px; font-size: 13px; }
#telegram-code { letter-spacing: .08em; font-variant-numeric: tabular-nums; }

.social-lane {
  position: relative;
  min-width: 0;
  min-height: 0;
  container-type: size;
  pointer-events: none;
}

.social-lane-top { grid-area: 1 / 1 / 2 / 4; margin-block-end: 14px; }
.social-lane-left { grid-area: 2 / 1 / 3 / 2; margin-inline-end: 16px; }
.social-lane-right { grid-area: 2 / 3 / 3 / 4; margin-inline-start: 16px; }
.social-lane-bottom { grid-area: 3 / 1 / 4 / 4; margin-block-start: 14px; }

.social-tile {
  --tile-size: min(var(--size), 68cqw, 68cqh);
  --path-inset: calc(var(--tile-size) * .69);
  position: absolute;
  inset: 0 auto auto 0;
  display: grid;
  place-items: center;
  width: var(--tile-size);
  aspect-ratio: 1;
  offset-path: ellipse(
    max(1px, calc(var(--radius-x, 50%) - var(--path-inset)))
    max(1px, calc(50% - var(--path-inset)))
    at var(--center-x, 50%) 50%
  );
  offset-anchor: center;
  offset-distance: var(--offset);
  offset-rotate: var(--tilt);
  border: 1px solid rgb(var(--ui-overlay) / 0.11);
  border-radius: 26%;
  background: linear-gradient(150deg, rgb(var(--ui-overlay) / 0.071), rgb(var(--ui-overlay) / 0.02));
  box-shadow: 0 12px 30px #00000025, inset 0 1px 0 rgb(var(--ui-overlay) / 0.027);
  opacity: var(--tile-opacity, .8);
}

.social-tile img {
  display: block;
  width: 45%;
  height: 45%;
  object-fit: contain;
  opacity: .62;
  filter: var(--access-icon-filter);
}

.social-telegram {
  --size: 72px; --tilt: -13deg; --offset: 28%;
  --center-x: 17%; --radius-x: 16%; --duration: 27s; --phase: -8s;
}

.social-discord {
  --size: 55px; --tilt: 9deg; --offset: 10%;
  --duration: 28s; --phase: -3s; --tile-opacity: .65;
}

.social-youtube {
  --size: 64px; --tilt: -10deg; --offset: 60%;
  --duration: 28s; --phase: -17s;
}

.social-instagram {
  --size: 69px; --tilt: 13deg; --offset: 62%;
  --center-x: 83%; --radius-x: 16%; --duration: 31s; --phase: -12s; --direction: reverse;
}

.social-tiktok {
  --size: 62px; --tilt: -7deg; --offset: 84%;
  --center-x: 83%; --radius-x: 16%; --duration: 37s; --phase: -6s; --direction: reverse;
}

.social-x {
  --size: 46px; --tilt: 10deg; --offset: 87%;
  --duration: 32s; --phase: -4s; --direction: reverse; --tile-opacity: .6;
}

.social-twitch {
  --size: 60px; --tilt: -12deg; --offset: 37%;
  --duration: 32s; --phase: -20s; --direction: reverse;
}

.sms-message {
  --sms-radius: 16%;
  --sms-tilt: -3deg;
  --sms-start: 50%;
  --sms-middle: 75%;
  --sms-end: 100%;
  --sms-duration: 16s;
  --sms-phase: -3.2s;
  --sms-delay: var(--sms-phase);
  offset-path: ellipse(
    max(1px, calc(var(--sms-radius) - var(--path-inset)))
    max(1px, calc(50% - var(--tile-size) * .55 - 2px))
    at 50% 50%
  );
  offset-distance: var(--sms-middle);
  offset-rotate: var(--sms-tilt);
}

.social-lane-bottom .sms-message {
  --sms-tilt: 3deg;
  --sms-start: 0%;
  --sms-middle: 25%;
  --sms-end: 50%;
  --sms-duration: 19s;
  --sms-phase: -5.1s;
}

.sms-message + .sms-message {
  --sms-delay: calc(var(--sms-phase) - var(--sms-duration) / 2);
  opacity: 0;
}

.access-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--access-brand-ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid rgb(var(--ui-overlay) / 0.145);
  border-radius: 11px;
  background: rgb(var(--ui-overlay) / 0.043);
}

.access-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(100%, 440px) minmax(0, 1fr);
  grid-template-rows: minmax(48px, .85fr) auto minmax(58px, 1.15fr);
  min-width: 0;
}

.access-content {
  grid-area: 2 / 2 / 3 / 3;
  z-index: 1;
  min-width: 0;
  padding: clamp(28px, 4vw, 38px);
  border: 1px solid rgb(var(--ui-overlay) / 0.137);
  border-radius: 26px;
  background: linear-gradient(155deg, #ffffff0c, #ffffff03 75%), var(--access-glass);
  box-shadow:
    0 24px 66px var(--access-shadow),
    inset 0 1px 0 #ffffff0c;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.access-symbol {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 23px;
  border: 1px solid rgb(var(--ui-overlay) / 0.125);
  border-radius: 14px;
  background: rgb(var(--ui-overlay) / 0.031);
  color: var(--access-brand-ink);
}

.access-content h1 {
  margin: 0;
  font-size: clamp(2.125rem, 5vw, 2.6rem);
  font-weight: 740;
  line-height: 1.12;
  letter-spacing: -0.053em;
  text-wrap: balance;
}

.access-description {
  max-width: 35ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 550;
  line-height: 1.6;
  text-wrap: pretty;
}

.balance-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.balance-summary > div {
  display: grid;
  align-content: space-between;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid rgb(var(--ui-overlay) / 0.133);
  border-radius: 12px;
  background: rgb(var(--ui-overlay) / 0.031);
}

.balance-summary dt { color: var(--muted); font-size: 13px; line-height: 1.4; }
.balance-summary dd {
  margin: 0;
  font-size: clamp(1.05rem, 3vw, 1.45rem);
  font-weight: 750;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.access-content .balance-summary { margin-top: 20px; }

.sms-statistics {
  display: grid;
  margin: 10px 0 0;
  padding: 0 12px;
  border: 1px solid rgb(var(--ui-overlay) / 0.133);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.sms-statistics > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 12px;
  padding: 10px 0;
}

.sms-statistics > div + div { border-top: 1px solid rgb(var(--ui-overlay) / 0.102); }
.sms-statistics dt { color: var(--muted); }
.sms-statistics dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.access-form { margin-top: 29px; }

.access-form label {
  display: block;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 660;
}

.key-field {
  display: flex;
  align-items: center;
  min-height: 56px;
  border: 1px solid rgb(var(--ui-overlay) / 0.18);
  border-radius: 12px;
  background: var(--access-field);
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.key-field:focus-within {
  background-color: var(--access-field-focus);
  border-color: var(--ui-focus);
  box-shadow: 0 0 0 3px rgb(var(--ui-overlay) / 0.09);
}

.key-field:has([aria-invalid="true"]) { border-color: var(--access-error-line); }

.key-field input {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 15px 10px 15px 15px;
  outline: none;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.key-field input::placeholder { color: var(--access-placeholder); opacity: 1; }

.key-toggle {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  height: 44px;
  margin-right: 5px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms ease;
}

.key-toggle[hidden] { display: none; }
.key-toggle:hover { background: rgb(var(--ui-overlay) / 0.063); color: var(--ink); }

.key-toggle-slash {
  opacity: 0;
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  transition: opacity 120ms ease, stroke-dashoffset 180ms ease;
}

.key-field input[type="text"] + .key-toggle .key-toggle-slash {
  opacity: 1;
  stroke-dashoffset: 0;
}

.access-submit {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  min-height: 54px;
  margin-top: 14px;
  padding: 11px 16px;
  border: 1px solid rgb(var(--ui-overlay) / 0.141);
  border-radius: 12px;
  background: var(--action);
  color: var(--action-ink);
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 150ms ease, translate 150ms ease;
}

.access-submit-label { grid-column: 2; }

.access-submit-arrow,
.access-submit-progress {
  grid-area: 1 / 3;
  justify-self: end;
}

.access-submit-arrow { transition: translate 170ms ease; }

.access-submit-progress {
  display: none;
  width: 16px;
  height: 16px;
  margin-inline-end: 3px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

.access-submit:disabled {
  background-color: var(--ui-action-pressed);
  cursor: progress;
}

.access-submit:disabled .access-submit-arrow { display: none; }
.access-submit:disabled .access-submit-progress { display: block; }

@media (hover: hover) {
  .access-submit:enabled:hover { background-color: var(--ui-action-hover); }
}

.access-submit:enabled:active { background-color: var(--ui-action-pressed); }

.key-toggle:focus-visible,
.access-submit:focus-visible,
.access-help-link:focus-visible,
.access-step-link:focus-visible,
.access-start-link:focus-visible,
.access-help summary:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 3px;
}

.access-error {
  margin: 8px 1px 0;
  padding-inline-start: 9px;
  border-inline-start: 2px solid var(--access-error-line);
  color: var(--access-error-ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}

.access-help {
  margin-top: 17px;
  padding-top: 5px;
  border-top: 1px solid rgb(var(--ui-overlay) / 0.078);
  color: var(--muted);
  font-size: 13px;
}

.access-help summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  border-radius: 5px;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
  transition: color 150ms ease;
}

.access-help summary::-webkit-details-marker { display: none; }
.access-help summary:hover { color: var(--ink); }
.access-help summary svg { flex-shrink: 0; transition: rotate 180ms ease; }
.access-help[open] summary svg { rotate: 180deg; }

.access-help-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin-block: 1px 3px;
  padding-inline: 8px;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  text-underline-offset: 3px;
  transition: background-color 150ms ease;
}

.access-help-link img { filter: var(--access-icon-filter); opacity: .85; }
.access-help-link:hover { background: rgb(var(--ui-overlay) / 0.047); text-decoration: underline; }

@media (prefers-reduced-motion: no-preference) {
  .social-tile {
    animation: social-flight var(--duration) linear var(--phase) infinite var(--direction, normal);
  }

  .sms-message {
    animation: sms-flight var(--sms-duration) linear var(--sms-delay) infinite;
  }

  .access-content:not(:has(.access-error)) {
    animation: access-appear 380ms cubic-bezier(.2, .65, .3, 1);
  }

  .access-help[open] .access-help-link { animation: help-appear 200ms ease-out; }
  .access-submit:enabled:active { translate: 0 1px; }
  .access-submit:disabled .access-submit-progress { animation: access-spin 750ms linear infinite; }

  @media (hover: hover) {
    .access-submit:enabled:hover .access-submit-arrow { translate: 3px 0; }
  }
}

@keyframes social-flight {
  from { offset-distance: 0%; }
  to { offset-distance: 100%; }
}

@keyframes sms-flight {
  0% { offset-distance: var(--sms-start); opacity: 0; }
  6%, 44% { opacity: .9; }
  50%, 100% { offset-distance: var(--sms-end); opacity: 0; }
}

@keyframes access-appear {
  from { opacity: 0; translate: 0 9px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes help-appear {
  from { opacity: 0; translate: 0 -3px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes access-spin {
  to { rotate: 1turn; }
}

@media (max-width: 740px) {
  .social-lane-right, .social-lane-left .social-discord { display: none; }
  .social-lane-left {
    grid-area: 3 / 1 / 4 / 4;
    margin-block-start: 14px;
    margin-inline-end: 0;
  }
  .social-tile { --size: 44px; --tile-opacity: .68; }
  .social-telegram, .social-youtube { --center-x: 11%; --radius-x: 10%; }
  .social-instagram, .social-tiktok { --center-x: 89%; --radius-x: 10%; }
  .sms-message { --sms-radius: 28%; }
}

@container (max-height: 50px) {
  .sms-message { offset-rotate: 0deg; }
}

@media (max-width: 600px) {
  .access-layout {
    padding: max(22px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .access-header { padding-inline: 6px; }
  .brand-wordmark { width: 132px; height: auto; }
  .brand-mark { width: 32px; height: 32px; }
  .access-content { padding: 28px 24px; border-radius: 23px; }
  .access-symbol { width: 48px; height: 48px; margin-bottom: 21px; border-radius: 14px; }
  .access-form { margin-top: 24px; }
  .access-help summary, .access-help-link { min-height: 44px; }
}

@media (max-width: 340px) {
  .access-content { padding-inline: 18px; }
  .access-content h1 { font-size: 1.96rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media (forced-colors: active) {
  .social-lane { display: none; }
  .brand-mark, .access-symbol, .access-content, .key-field, .access-submit {
    border: 1px solid CanvasText;
  }
}
