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

button {
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

button:focus {
  outline: none;
  box-shadow: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--bg-dot) 1px, transparent 1px);
  background-size: 26px 26px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  transition: background-color 0.3s ease;
}

/* ── Scene ─────────────────────────────────────────────────── */
.scene {
  perspective: 1400px;
  width: 380px;
  height: 700px;
  flex-shrink: 0;
}

@media (max-width: 639px) {
  .scene {
    width: 100vw;
    height: 100dvh;
  }
}

@media (min-width: 1024px) {
  .scene {
    width: 420px;
    height: 700px;
  }
}

/* ── Flip ──────────────────────────────────────────────────── */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.70s cubic-bezier(0.45, 0.05, 0.25, 1);
}

.card-inner.flipped {
  transform: rotateY(180deg);
}

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--face-bg);
  border: 1px solid var(--face-border);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-radius: 28px;
  transition: background 0.3s ease, border-color 0.3s ease, opacity 0s linear 0.35s;
}

.face-back {
  transform: rotateY(180deg);
  opacity: 0;
}

.card-inner.flipped .face-back {
  opacity: 1;
  transition: background 0.3s ease, border-color 0.3s ease, opacity 0s linear 0.35s;
}

.card-inner.flipped .face-front {
  opacity: 0;
}

@media (max-width: 639px) {
  .face {
    border-radius: 0;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
  }
}

/* ── Page controls (lang + theme, fixed top-right) ──────────── */
#pageControls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Front face ────────────────────────────────────────────── */
.face-front {
  padding: 1.75rem 1.75rem 1.5rem;
  align-items: center;
  user-select: none;
  -webkit-user-select: none;
}

.face-back .tab-nav,
.face-back .form-scroll,
.face-back .tab-form-footer {
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 639px) {
  #pageControls {
    top: 0.75rem;
    right: 0.75rem;
  }

  body.panel-open #pageControls {
    display: none;
  }

  .face-front {
    padding: 2.5rem 1.5rem 1.75rem;
  }

  .front-logo {
    width: 9.5rem !important;
  }

  .front-headline {
    margin-top: 0.75rem !important;
  }

  .front-divider {
    margin: 0.65rem 0 !important;
  }

  .front-links {
    gap: 9px !important;
  }

  .front-sep {
    margin: 0.6rem 0 !important;
  }

  .front-sec {
    gap: 6px !important;
  }
}

/* ── Firefox: crossfade instead of 3D flip ──────────────────── */
@supports (-moz-appearance: none) {
  .card-inner {
    transform-style: flat;
    transition: none;
  }

  .card-inner.flipped {
    transform: none;
  }

  .face {
    transition: background 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
  }

  .face-back {
    transform: none;
    opacity: 0;
    pointer-events: none;
  }

  .card-inner.flipped .face-back {
    opacity: 1;
    pointer-events: auto;
    transition: background 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
  }

  .card-inner.flipped .face-front {
    opacity: 0;
    pointer-events: none;
  }
}
