:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2e2e2e;
  --text: #f5f5f5;
  --muted: #8a8a8a;
  --accent: #00e600;
  --accent-text: #0a0a0a;
  --tile-bg: #252525;
  --tile-num: #0a0a0a;
  --puzzle-shell: #121212;
  --puzzle-tile: #1c1c1c;
  --puzzle-ref: 860;
  --puzzle-max: 817;
  --radius: 10px;
  --radius-sm: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  overflow-x: hidden;
}

@media (min-width: 901px) {
  body {
    height: 100%;
    overflow-y: hidden;
  }
}

.page {
  --page-y-pad: clamp(1.25rem, 4vw, 3rem);
  --page-x-pad: clamp(1.25rem, 5vw, 4rem);
  scrollbar-gutter: stable;
  --puzzle-outer: min(
    calc(var(--puzzle-max) * 1px),
    calc(100svh - 2 * var(--page-y-pad) - 2rem),
    calc(100vw - 2 * var(--page-x-pad))
  );
  --puzzle-pad: calc(var(--puzzle-outer) * 3 / var(--puzzle-ref));
  --puzzle-gap: calc(var(--puzzle-outer) * 3 / var(--puzzle-ref));
  --puzzle-cell: calc(var(--puzzle-outer) * 282 / var(--puzzle-ref));
  --puzzle-font: calc(var(--puzzle-outer) * 152 / var(--puzzle-ref));
  --puzzle-shell-radius: calc(var(--puzzle-outer) * 28 / var(--puzzle-ref));
  --puzzle-tile-radius: calc(var(--puzzle-outer) * 14 / var(--puzzle-ref));
  min-height: 100svh;
  max-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: var(--page-y-pad) var(--page-x-pad);
  max-width: 1480px;
  margin: 0 auto;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
}

@media (min-width: 901px) {
  .page {
    --puzzle-outer: min(
      calc(var(--puzzle-max) * 1px),
      calc(100svh - 2 * var(--page-y-pad) - 2rem),
      calc(100vw - 2 * var(--page-x-pad) - 28rem)
    );
  }
}

@media (max-width: 900px) {
  .page {
    grid-template-columns: 1fr;
    align-items: start;
    max-height: none;
    min-height: 100svh;
    overflow-y: auto;
    overflow-x: hidden;
    --page-x-pad: 20px;
    padding: var(--page-y-pad) var(--page-x-pad) max(var(--page-y-pad), 1.5rem);
    --puzzle-outer: min(
      calc(var(--puzzle-max) * 1px),
      calc(100vw - 2 * var(--page-x-pad)),
      calc(100svh - 2 * var(--page-y-pad) - 14rem)
    );
  }

  .panel--puzzle {
    justify-content: center;
    overflow: visible;
    width: 100%;
  }

  .puzzle-frame {
    width: var(--puzzle-outer);
    max-width: calc(100vw - 2 * var(--page-x-pad));
  }
}

.panel--form {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 901px) {
  .panel--form {
    margin: 0;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.brand__icon {
  color: var(--text);
  display: flex;
}

.brand__name {
  font-weight: 600;
  font-size: 0.95rem;
}

.title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 0 1.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.field {
  width: 100%;
  min-width: 0;
}

.field__label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field__wrap {
  position: relative;
  width: 100%;
}

.field__input {
  --field-pad-y: 0.6875rem;
  --field-pad-x: 0.85rem;
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: var(--field-pad-y) var(--field-pad-x);
  min-height: 2.75rem;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.field__input::placeholder {
  color: #5c5c5c;
}

.field__input:focus {
  border-color: #0aca00;
}

.field__input--with-icon {
  padding-right: 2.75rem;
}

.field__eye {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.35rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.field__eye:hover {
  color: var(--text);
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  margin-top: 0.25rem;
  user-select: none;
}

.consent__checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.consent__switch {
  --consent-ball-inset: 3px;
  --consent-svg: 32px;
  --consent-thumb: calc(var(--consent-svg) + 2 * var(--consent-ball-inset));
  --consent-pad: 3px;
  --consent-travel: 32px;
  --consent-track-w: calc(2 * var(--consent-pad) + var(--consent-thumb) + var(--consent-travel));
  --consent-track-h: calc(2 * var(--consent-pad) + var(--consent-thumb));
  flex-shrink: 0;
  width: var(--consent-track-w);
  height: var(--consent-track-h);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  margin-top: 1px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.consent__thumb {
  position: absolute;
  top: var(--consent-pad);
  left: var(--consent-pad);
  width: var(--consent-thumb);
  height: var(--consent-thumb);
  border-radius: 50%;
  display: block;
  transition: transform 0.22s ease;
}

.consent__ball-img {
  position: absolute;
  top: var(--consent-ball-inset);
  right: var(--consent-ball-inset);
  bottom: var(--consent-ball-inset);
  left: var(--consent-ball-inset);
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.consent__ball-img--active {
  opacity: 0;
}

.consent__checkbox:checked + .consent__switch {
  background: var(--surface);
  border-color: #ff6a00;
}

.consent__checkbox:checked + .consent__switch .consent__thumb {
  transform: translateX(var(--consent-travel));
}

.consent__checkbox:checked + .consent__switch .consent__ball-img--passive {
  opacity: 0;
}

.consent__checkbox:checked + .consent__switch .consent__ball-img--active {
  opacity: 1;
}

.consent__checkbox:focus-visible + .consent__switch {
  outline: 2px solid #ff6a00;
  outline-offset: 2px;
}

.consent__text {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.btn-submit {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.95rem 1rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-submit:hover {
  filter: brightness(1.08);
}

.btn-submit:active {
  transform: scale(0.99);
}

.login-hint {
  margin: 1.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
}

.login-hint a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.login-hint a:hover {
  text-decoration: underline;
}

.legal {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.legal__intro {
  margin: 0 0 0.65rem;
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  justify-content: center;
  flex-wrap: wrap;
}

.legal__line {
  flex: 1;
  min-width: 1.5rem;
  height: 1px;
  background: var(--border);
  max-width: 4rem;
}

.legal__links {
  margin: 0;
  font-size: 0.7rem;
  text-align: center;
  line-height: 1.6;
}

.legal__links a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal__links a:hover {
  color: var(--text);
}

.legal__sep {
  color: var(--muted);
  margin: 0 0.25rem;
}

.legal__break--mobile-only {
  display: none;
}

@media (max-width: 900px) {
  .legal__break--mobile-only {
    display: block;
  }

  .legal__links .legal__sep {
    margin-left: 0;
  }
}

.panel--puzzle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}

.puzzle-frame {
  box-sizing: border-box;
  width: var(--puzzle-outer);
  height: var(--puzzle-outer);
  max-width: 100%;
  flex-shrink: 0;
  padding: var(--puzzle-pad);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--puzzle-shell-radius);
  background: var(--puzzle-shell);
}

.puzzle {
  display: grid;
  grid-template-columns: repeat(3, var(--puzzle-cell));
  grid-template-rows: repeat(3, var(--puzzle-cell));
  gap: var(--puzzle-gap);
  width: calc(3 * var(--puzzle-cell) + 2 * var(--puzzle-gap));
  height: calc(3 * var(--puzzle-cell) + 2 * var(--puzzle-gap));
  box-sizing: border-box;
}

.puzzle__tile {
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  width: var(--puzzle-cell);
  height: var(--puzzle-cell);
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--puzzle-tile-radius);
  background: var(--puzzle-tile);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000000;
  font-family: "Staatliches", "Inter", sans-serif;
  font-size: var(--puzzle-font);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
  transition: background 0.15s ease, transform 0.08s ease;
}

.puzzle__tile:hover {
  background: #222222;
}

.puzzle__tile:active {
  transform: scale(0.985);
}

.puzzle__tile--empty {
  cursor: default;
  pointer-events: none;
  background: var(--puzzle-shell);
  border-radius: var(--puzzle-tile-radius);
}

.puzzle__tile:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.field__error {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: #e53935;
  line-height: 1.3;
}

.field--invalid .field__input {
  border-color: #e53935;
}

.field--invalid .field__input:focus {
  border-color: #e53935;
}

.field--invalid .consent__switch {
  border-color: #e53935;
}

.field--consent {
  margin-top: 0.25rem;
}

.field--consent .consent {
  width: 100%;
}

.verify-body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
}

.verify {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 5vw, 2rem) 20px;
  box-sizing: border-box;
}

.verify__card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.verify__icon-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
}

.verify__icon {
  display: block;
  width: 80px;
  height: 80px;
}

.verify__icon--base {
  position: relative;
  z-index: 0;
}

.verify__icon--fill {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  pointer-events: none;
  clip-path: inset(calc((6 - var(--otp-digits, 0)) * 100% / 6) 0 0 0);
  transition: clip-path 0.45s ease;
}

.verify__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.verify__stack {
  --verify-gap: 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: var(--verify-gap);
}

.verify__text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

.verify__text-br--desktop {
  display: none;
}

@media (min-width: 901px) {
  .verify__text-br--desktop {
    display: block;
  }

  .verify__title {
    font-size: 1.95rem;
  }
}

.verify__form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--verify-gap);
  width: 100%;
}

.otp {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: clamp(6px, 2vw, 10px);
  width: 100%;
}

.otp__cell {
  flex: 1 1 0;
  min-width: 0;
  max-width: 52px;
  height: 56px;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 600;
  text-align: center;
  color: #0a0a0a;
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.otp__cell:focus {
  border-color: #0aca00;
  box-shadow: 0 0 0 1px #0aca00;
}

.otp__cell--invalid {
  border-color: #e53935;
}

.verify__form--invalid .otp__cell--invalid:focus {
  border-color: #e53935;
  box-shadow: 0 0 0 1px #e53935;
}

.verify__error {
  margin: 0;
  text-align: center;
  width: 100%;
}

.verify__btn {
  width: 100%;
  margin-top: 0;
}
