/* ── Variables ────────────────────────────────────────────── */
:root {
  --bg: #0d0d14;
  --surface: #13131e;
  --card: #1b1b2a;
  --border: rgb(255 255 255 / 7%);
  --accent: #7c5cfc;
  --accent2: #5cadfc;
  --text: #e4e4f0;
  --muted: #64647a;
  --err: #fc5c7c;
  --radius: 12px;
}

/* ── Reset ────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ─────────────────────────────────────────────────── */
html {
  font-size: 16px;
}

body {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 100dvh;

  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  color: var(--text);

  background: var(--bg);

  -webkit-font-smoothing: antialiased;
}

/* ── Floating background cards ────────────────────────────── */
.bg {
  pointer-events: none;

  position: fixed;
  z-index: 0;
  inset: 0;

  overflow: hidden;
}

.fc {
  position: absolute;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 52px;
  height: 70px;
  border: 1px solid var(--border);
  border-radius: 8px;

  font-size: 22px;
  color: var(--accent);

  opacity: 0%;
  background: var(--card);

  animation: float-card linear infinite;
}

/* Individual positions & timings */
.fc-1 {
  top: 12%;
  left: 4%;
  animation-duration: 19s;
  animation-delay: 0s;
}

.fc-2 {
  top: 65%;
  left: 14%;
  animation-duration: 23s;
  animation-delay: -5s;
}

.fc-3 {
  top: 18%;
  left: 78%;
  animation-duration: 17s;
  animation-delay: -9s;
}

.fc-4 {
  top: 72%;
  left: 68%;
  animation-duration: 25s;
  animation-delay: -2s;
}

.fc-5 {
  top: 4%;
  left: 44%;
  animation-duration: 21s;
  animation-delay: -7s;
}

.fc-6 {
  top: 48%;
  left: 88%;
  animation-duration: 18s;
  animation-delay: -11s;
}

.fc-7 {
  top: 82%;
  left: 30%;
  animation-duration: 22s;
  animation-delay: -4s;
}

.fc-8 {
  top: 35%;
  left: 58%;
  animation-duration: 26s;
  animation-delay: -13s;
}

@keyframes float-card {
  0% {
    transform: translateY(20px) rotate(-4deg);
    opacity: 0%;
  }

  10% {
    opacity: 9%;
  }

  50% {
    transform: translateY(-16px) rotate(5deg);
    opacity: 11%;
  }

  90% {
    opacity: 9%;
  }

  100% {
    transform: translateY(20px) rotate(-4deg);
    opacity: 0%;
  }
}

/* ── Main layout ──────────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;

  width: 100%;
  max-width: 400px;
  padding: 16px;
}

/* ── Panel ────────────────────────────────────────────────── */
.panel {
  padding: 40px 36px 36px;
  border: 1px solid var(--border);
  border-radius: 20px;

  background: var(--surface);
  box-shadow:
    0 32px 80px rgb(0 0 0 / 45%),
    0 0 0 1px rgb(124 92 252 / 6%),
    inset 0 1px 0 rgb(255 255 255 / 4%);

  animation: panel-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes panel-in {
  from {
    transform: translateY(16px);
    opacity: 0%;
  }

  to {
    transform: translateY(0);
    opacity: 100%;
  }
}

/* shake on auth error */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-7px);
  }

  40% {
    transform: translateX(7px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

.panel.shake {
  animation: shake 0.4s ease;
}

/* ── Logo ─────────────────────────────────────────────────── */
.logo {
  display: flex;
  gap: 11px;
  align-items: center;
  margin-bottom: 26px;
}

.logo-stack {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 44px;
}

.ls-back,
.ls-front {
  position: absolute;

  width: 28px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.ls-back {
  top: 6px;
  left: 8px;
  opacity: 45%;
  background: var(--accent);
}

.ls-front {
  top: 0;
  left: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-color: rgb(124 92 252 / 50%);

  font-size: 15px;
  color: var(--accent);

  background: var(--card);
}

.logo-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;

  background: linear-gradient(125deg, #a78bfa, var(--accent2));
  background-clip: text;

  -webkit-text-fill-color: transparent;
}

/* ── Headings ─────────────────────────────────────────────── */
h1 {
  margin-bottom: 5px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.sub {
  margin-bottom: 28px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

/* ── Form fields ──────────────────────────────────────────── */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;

  margin-bottom: 6px;

  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.15px;
}

.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);

  font-size: 15px;
  color: var(--text);

  appearance: none;
  background: var(--card);
  outline: none;

  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(124 92 252 / 18%);
}

.field input::placeholder {
  color: var(--muted);
  opacity: 70%;
}

.field.has-err input {
  border-color: var(--err);
}

.field.has-err input:focus {
  box-shadow: 0 0 0 3px rgb(252 92 124 / 15%);
}

/* Password wrapper */
.pw-wrap {
  position: relative;
}

.pw-wrap input {
  padding-right: 44px;
}

.pw-toggle {
  cursor: pointer;

  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);

  display: flex;
  align-items: center;

  padding: 4px;
  border: none;

  line-height: 0;
  color: var(--muted);

  background: none;

  transition: color 0.18s;
}

.pw-toggle:hover {
  color: var(--text);
}

.pw-toggle svg {
  width: 17px;
  height: 17px;
}

/* Field error text */
.ferr {
  display: block;

  min-height: 15px;
  margin-top: 5px;

  font-size: 12px;
  color: var(--err);
}

/* ── Options row ──────────────────────────────────────────── */
.options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.remember {
  cursor: pointer;
  user-select: none;

  display: flex;
  gap: 7px;
  align-items: center;

  font-size: 14px;
  color: var(--muted);
}

.remember input[type='checkbox'] {
  cursor: pointer;
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

/* Generic text button (links styled as buttons) */
.text-btn {
  cursor: pointer;

  padding: 0;
  border: none;

  font-size: 14px;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;

  background: none;

  transition: color 0.18s;
}

.text-btn:hover {
  color: var(--accent2);
}

/* ── Alert ────────────────────────────────────────────────── */
.alert {
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid rgb(252 92 124 / 28%);
  border-radius: var(--radius);

  font-size: 14px;
  line-height: 1.5;
  color: var(--err);

  background: rgb(252 92 124 / 9%);
}

/* ── Submit button ────────────────────────────────────────── */
.submit-btn {
  cursor: pointer;

  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;

  width: 100%;
  margin-bottom: 22px;
  padding: 13px;
  border: none;
  border-radius: var(--radius);

  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.1px;

  background: linear-gradient(130deg, var(--accent), #5c7cfc);

  transition:
    opacity 0.18s,
    transform 0.1s;
}

.submit-btn:hover:not(:disabled) {
  opacity: 88%;
}

.submit-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.submit-btn:disabled {
  cursor: not-allowed;
  opacity: 55%;
}

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  display: inline-block;

  width: 17px;
  height: 17px;
  border: 2px solid rgb(255 255 255 / 30%);
  border-top-color: #fff;
  border-radius: 50%;

  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Footer note ──────────────────────────────────────────── */
.register-line {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ── Overlay / Modal ──────────────────────────────────────── */
.overlay {
  position: fixed;
  z-index: 100;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 16px;

  background: rgb(0 0 0 / 58%);
  backdrop-filter: blur(4px);

  animation: fade-in 0.2s ease;
}

.overlay[hidden] {
  display: none;
}

@keyframes fade-in {
  from {
    opacity: 0%;
  }

  to {
    opacity: 100%;
  }
}

.notice {
  width: 100%;
  max-width: 320px;
  padding: 32px 28px;
  border: 1px solid var(--border);
  border-radius: 18px;

  text-align: center;

  background: var(--surface);

  animation: panel-in 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.notice p {
  margin-bottom: 22px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

.notice-close {
  cursor: pointer;

  padding: 10px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);

  font-size: 14px;
  font-weight: 500;
  color: var(--text);

  background: var(--card);

  transition:
    border-color 0.18s,
    background 0.18s;
}

.notice-close:hover {
  border-color: var(--accent);
  background: rgb(124 92 252 / 8%);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (width <= 440px) {
  .panel {
    padding: 28px 20px 24px;
    border-radius: 16px;
  }
}
