/* =====================================================================
   GEBL Minimalist Square Authentication Card & Kinetic PIN Physics
   - Static pure black background (#000000)
   - Minimalist matte obsidian square card with subtle glass highlights
   - Two sides of the same card (Login with Username/Email & Users Up)
   - 4 Code Boxes that move into a circle, spin, join into one tile,
     and morph into an animated check mark
   ===================================================================== */

/* 1. Fullscreen Backdrop Stage (Static Pure Black) */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000000;
  font-family: var(--f-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-gate.unlocked {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.04);
}

/* Static clean dark background (no animated rainbow blobs) */
.auth-stage-bg {
  position: absolute;
  inset: 0;
  background: #000000;
  pointer-events: none;
}

/* 2. The 3D Square Card Stage */
.auth-disc-stage {
  perspective: 1200px;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Minimalist Square Card Container */
.glass-disc-container {
  width: 430px;
  min-height: 570px;
  position: relative;
  border-radius: 22px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

/* 3D Two-Sided Card Flipper */
.glass-disc-flipper {
  width: 100%;
  min-height: 570px;
  border-radius: 22px;
  position: relative;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.34, 1.25, 0.64, 1);
}

.glass-disc-container.flipped .glass-disc-flipper {
  transform: rotateY(180deg);
}

/* Card Faces (Login & Users Up on Opposite Sides) */
.glass-disc-face {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  padding: 34px 36px 28px;
  box-sizing: border-box;
  background: #0B0E14;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 24px 64px -12px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  z-index: 10;
}

/* Users Up Face (Flipped) */
.glass-disc-face.face-signup {
  transform: rotateY(180deg);
  background: #0B0E14;
  padding: 32px 36px 24px;
}

/* Brand Header */
.disc-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  text-align: center;
}

.disc-logo-img {
  height: 36px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.disc-title {
  font-family: var(--f-disp, "Space Grotesk", sans-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #FFFFFF;
  margin: 0;
}

.disc-subtitle {
  font-size: 12.5px;
  color: #8B949E;
  margin: 0;
}

/* 3. Form Input Field (Username or Email) */
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  text-align: left;
}

.auth-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8B949E;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 12px;
  color: #6E7681;
  font-size: 14px;
  pointer-events: none;
}

.auth-text-input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 36px;
  border-radius: 10px;
  background: #141820;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-sizing: border-box;
}

.auth-text-input:focus {
  border-color: #F2A900;
  background: #171C26;
  box-shadow: 0 0 0 2px rgba(242, 169, 0, 0.25);
}

.auth-text-input::placeholder {
  color: #484F58;
}

/* 4. Four Code Boxes: Orbital Circle, Spin & Join into One Check Mark */
.pin-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.pin-section-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8B949E;
  margin-bottom: 8px;
  align-self: flex-start;
}

.pin-stage {
  position: relative;
  width: 250px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
}

/* Orbital Container for the 4 boxes */
.pin-orbit {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
}

/* The Individual 4 Code Boxes */
.pin-box {
  position: absolute;
  width: 48px;
  height: 54px;
  border-radius: 10px;
  background: #141820;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: text;
  transition:
    transform 0.4s cubic-bezier(0.25, 1, 0.5, 1),
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.3s ease;
  will-change: transform, opacity;
}

/* Initial Horizontal Row Placement (Centered) */
.pin-box[data-idx="0"] { transform: translate(-81px, 0); }
.pin-box[data-idx="1"] { transform: translate(-27px, 0); }
.pin-box[data-idx="2"] { transform: translate(27px, 0); }
.pin-box[data-idx="3"] { transform: translate(81px, 0); }

/* Focus & Active State */
.pin-box.active {
  border-color: #F2A900;
  background: rgba(242, 169, 0, 0.08);
  box-shadow: 0 0 0 2px rgba(242, 169, 0, 0.25);
}

.pin-box.filled {
  border-color: rgba(255, 255, 255, 0.35);
  background: #1A202C;
}

.pin-input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: #FFFFFF;
  font-family: var(--f-disp, "Space Grotesk", sans-serif);
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  caret-color: #F2A900;
}

/* Glowing Indicator Dot for Masked PIN */
.pin-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #F2A900;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.pin-box.has-val .pin-dot {
  opacity: 1;
  transform: scale(1);
}

.pin-box.has-val .pin-input {
  color: transparent;
  text-shadow: none;
}

/* --- ANIMATION STEP 1: MOVE INTO A CIRCLE --- */
.pin-stage.anim-circle .pin-box[data-idx="0"] { transform: translate(0, -38px); }
.pin-stage.anim-circle .pin-box[data-idx="1"] { transform: translate(38px, 0); }
.pin-stage.anim-circle .pin-box[data-idx="2"] { transform: translate(0, 38px); }
.pin-stage.anim-circle .pin-box[data-idx="3"] { transform: translate(-38px, 0); }

.pin-stage.anim-circle .pin-box {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  background: rgba(242, 169, 0, 0.2);
  border-color: #F2A900;
}

/* --- ANIMATION STEP 2: SPIN AROUND THE CIRCLE --- */
.pin-stage.anim-spin .pin-orbit {
  animation: orbitSpin 0.75s cubic-bezier(0.34, 0, 0.3, 1) forwards;
}

@keyframes orbitSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(720deg); }
}

/* --- ANIMATION STEP 3: JOIN INTO ONE TILE --- */
.pin-stage.anim-join .pin-box {
  transform: translate(0, 0) scale(0.15) !important;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

/* The Unified Tile in the Center */
.unified-tile {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: #10B981;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 28px rgba(16, 185, 129, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  z-index: 25;
  pointer-events: none;
}

.pin-stage.anim-join .unified-tile {
  transform: scale(1);
  opacity: 1;
}

/* --- ANIMATION STEP 4: TURNS INTO A CHECK MARK --- */
.check-svg {
  width: 38px;
  height: 38px;
  overflow: visible;
}

.check-circle {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  transition: stroke-dashoffset 0.35s ease 0.08s;
}

.check-path {
  stroke: #FFFFFF;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset 0.32s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.pin-stage.anim-check .check-circle {
  stroke-dashoffset: 0;
}

.pin-stage.anim-check .check-path {
  stroke-dashoffset: 0;
}

/* Status Text & Feedback */
.auth-status-wrap {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.auth-status-text {
  font-size: 12.5px;
  font-weight: 500;
  color: #8B949E;
  transition: color 0.25s ease;
}

.auth-status-text.verified {
  color: #10B981;
  font-weight: 600;
}

/* Quick Access Demo Badge */
.demo-pin-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  background: #141820;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #8B949E;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  margin-top: 8px;
  width: fit-content;
  align-self: center;
}

.demo-pin-pill:hover {
  background: #1A202C;
  border-color: #F2A900;
  color: #FFFFFF;
}

.demo-pin-pill kbd {
  background: #0B0E14;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0 5px;
  font-family: inherit;
  font-weight: 700;
  color: #F2A900;
}

/* 5. Flip Buttons between Login and Users Up */
.disc-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  margin-top: 12px;
}

.disc-flip-btn {
  background: none;
  border: 0;
  color: #8B949E;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.disc-flip-btn:hover {
  color: #FFFFFF;
}

.disc-flip-btn b {
  color: #F2A900;
  font-weight: 600;
}

/* 6. Users Up (Sign Up) Form Fields */
.signup-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0;
}

.su-field {
  text-align: left;
}

.su-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #8B949E;
  margin-bottom: 5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.su-input,
.su-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  background: #141820;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.su-input:focus,
.su-select:focus {
  border-color: #F2A900;
  box-shadow: 0 0 0 2px rgba(242, 169, 0, 0.25);
}

.su-select option {
  background: #141820;
  color: #FFFFFF;
}

.su-submit-btn {
  height: 42px;
  border-radius: 10px;
  background: #F2A900;
  border: 0;
  color: #0E1217;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s ease, transform 0.15s ease;
  margin-top: 8px;
}

.su-submit-btn:hover {
  background: #FFC02E;
  transform: translateY(-1px);
}

.su-submit-btn:active {
  transform: scale(0.98);
}

/* Sidebar Lock Button */
.sb-lock-btn {
  background: none;
  border: 0;
  color: #8B949E;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.sb-lock-btn:hover {
  color: #F2A900;
  background: rgba(242, 169, 0, 0.12);
}

/* =====================================================================
   7. Mobile Screen Optimization
   ===================================================================== */
@media (max-width: 480px) {
  .glass-disc-container {
    width: min(92vw, 380px);
    min-height: 520px;
  }

  .glass-disc-flipper {
    min-height: 520px;
  }

  .glass-disc-face {
    padding: 26px 22px 20px;
  }

  .glass-disc-face.face-signup {
    padding: 22px 20px 18px;
  }

  .disc-logo-img {
    height: 28px;
  }

  .disc-title {
    font-size: 18px;
  }

  .auth-text-input {
    height: 38px;
    font-size: 13px;
  }

  .pin-box {
    width: 42px;
    height: 48px;
  }

  .pin-box[data-idx="0"] { transform: translate(-69px, 0); }
  .pin-box[data-idx="1"] { transform: translate(-23px, 0); }
  .pin-box[data-idx="2"] { transform: translate(23px, 0); }
  .pin-box[data-idx="3"] { transform: translate(69px, 0); }

  .pin-stage.anim-circle .pin-box[data-idx="0"] { transform: translate(0, -34px); }
  .pin-stage.anim-circle .pin-box[data-idx="1"] { transform: translate(34px, 0); }
  .pin-stage.anim-circle .pin-box[data-idx="2"] { transform: translate(0, 34px); }
  .pin-stage.anim-circle .pin-box[data-idx="3"] { transform: translate(-34px, 0); }

  .unified-tile {
    width: 52px;
    height: 52px;
  }

  .check-svg {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 360px) {
  .glass-disc-container {
    width: 95vw;
  }

  .glass-disc-face {
    padding: 20px 16px 16px;
  }

  .disc-title {
    font-size: 17px;
  }

  .pin-stage {
    width: 200px;
  }

  .pin-box {
    width: 38px;
    height: 44px;
  }

  .pin-input {
    font-size: 20px;
  }

  .pin-box[data-idx="0"] { transform: translate(-60px, 0); }
  .pin-box[data-idx="1"] { transform: translate(-20px, 0); }
  .pin-box[data-idx="2"] { transform: translate(20px, 0); }
  .pin-box[data-idx="3"] { transform: translate(60px, 0); }

  .pin-stage.anim-circle .pin-box[data-idx="0"] { transform: translate(0, -30px); }
  .pin-stage.anim-circle .pin-box[data-idx="1"] { transform: translate(30px, 0); }
  .pin-stage.anim-circle .pin-box[data-idx="2"] { transform: translate(0, 30px); }
  .pin-stage.anim-circle .pin-box[data-idx="3"] { transform: translate(-30px, 0); }

  .unified-tile {
    width: 48px;
    height: 48px;
  }
}
