* {
  box-sizing: border-box;
}

:root {
  --bg-deep: #10070a;
  --bg-main: #17090e;
  --card-top: rgba(72, 38, 45, 0.62);
  --card-bottom: rgba(41, 20, 25, 0.78);
  --card-border: rgba(231, 137, 147, 0.42);
  --text: #fffafb;
  --muted: rgba(239, 214, 219, 0.55);
  --input-bg: rgba(255, 255, 255, 0.055);
  --input-border: rgba(255, 255, 255, 0.18);
  --accent-light: #e94b61;
  --accent-dark: #9d0039;
  --danger-bg: rgba(180, 35, 24, 0.16);
  --danger-text: #ffc6cc;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--bg-deep);
}

body {
  min-height: 100vh;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  background:
    radial-gradient(circle at 63% 46%, rgba(123, 42, 54, 0.26), transparent 29%),
    radial-gradient(circle at 10% 78%, rgba(90, 30, 40, 0.16), transparent 34%),
    linear-gradient(180deg, #180a0e 0%, #12080b 55%, #17090d 100%);
}

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.scene-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.30;
}

.glow-center {
  width: 520px;
  height: 390px;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  background: rgba(156, 54, 68, 0.20);
  animation: glowCenter 13s ease-in-out infinite alternate;
}

.glow-right {
  width: 650px;
  height: 470px;
  right: -210px;
  top: 25%;
  background: rgba(154, 47, 63, 0.23);
  animation: glowRight 15s ease-in-out infinite alternate;
}

.survey-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.95;
}

.terrain-reference {
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(39vw, 650px);
  aspect-ratio: 650 / 532;
  background: url("/dgps-terrain-reference.webp") left bottom / 100% 100% no-repeat;
  opacity: 0.96;
  pointer-events: none;
  filter: saturate(0.98) brightness(0.98);
}

.route {
  animation: routePulse 5.5s ease-in-out infinite;
}

.route-b {
  animation-delay: 0.9s;
}

.route-c {
  animation-delay: 1.8s;
}

.login-card {
  position: relative;
  z-index: 3;
  width: min(100%, 470px);
  padding: 38px 38px 28px;
  border: 1px solid var(--card-border);
  border-radius: 29px;
  background:
    linear-gradient(180deg, var(--card-top), var(--card-bottom)),
    rgba(35, 16, 21, 0.70);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.35),
    0 16px 46px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 217, 221, 0.07);
  backdrop-filter: blur(18px) saturate(116%);
  animation: cardEnter 0.65s cubic-bezier(.2,.78,.25,1) both;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 28px;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 191, 198, 0.045),
    inset 0 18px 40px rgba(255, 115, 129, 0.026);
}

.brand-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: white;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0.2px;
  background:
    linear-gradient(145deg, #ef5365 0%, #c82549 52%, #86002f 100%);
  border: 1px solid rgba(255, 154, 164, 0.20);
  box-shadow:
    0 0 25px rgba(229, 73, 94, 0.34),
    0 13px 30px rgba(128, 0, 41, 0.26),
    inset 0 1px 0 rgba(255, 217, 221, 0.28);
}

.portal-badge-wrap {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.portal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 220px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(226, 116, 129, 0.54);
  color: #f0a0aa;
  background: rgba(136, 55, 65, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 196, 203, 0.05),
    0 5px 18px rgba(0,0,0,0.08);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  text-align: center;
}

.portal-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef5d6e;
  box-shadow:
    0 0 0 4px rgba(236, 92, 109, 0.10),
    0 0 15px rgba(236, 92, 109, 0.48);
  flex: 0 0 auto;
}

.login-card h1 {
  margin: 24px 0 0;
  text-align: center;
  color: #fffafb;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: -1.05px;
}

.login-form {
  margin-top: 31px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #f6eff1;
  font-size: 13px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  background: var(--input-bg);
  color: white;
  outline: none;
  font-size: 15px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.02),
    0 7px 20px rgba(0,0,0,0.07);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.form-group input::placeholder {
  color: rgba(236, 218, 222, 0.42);
}

.form-group input:focus {
  border-color: rgba(235, 86, 104, 0.72);
  background: rgba(255,255,255,0.07);
  box-shadow:
    0 0 0 1px rgba(235, 86, 104, 0.34),
    0 0 22px rgba(200, 44, 69, 0.20),
    inset 0 1px 0 rgba(255,255,255,0.03);
  transform: translateY(-1px);
}

.login-button {
  width: 100%;
  height: 56px;
  margin-top: 2px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  background:
    linear-gradient(100deg, #e84b61 0%, #cf2d51 50%, #9c0038 100%);
  box-shadow:
    0 14px 30px rgba(128, 0, 41, 0.22),
    inset 0 1px 0 rgba(255, 207, 214, 0.16);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease;
}

.button-arrow {
  font-size: 19px;
  line-height: 1;
  transition: transform 0.16s ease;
}

.login-button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 18px 38px rgba(128, 0, 41, 0.28),
    0 0 26px rgba(229, 73, 94, 0.11),
    inset 0 1px 0 rgba(255, 207, 214, 0.18);
  filter: brightness(1.025);
}

.login-button:hover .button-arrow {
  transform: translateX(4px);
}

.login-button:active {
  transform: translateY(1px);
}

.message {
  display: none;
  margin-top: 14px;
  padding: 10px 11px;
  border-radius: 11px;
  text-align: center;
  color: var(--danger-text);
  background: var(--danger-bg);
  border: 1px solid rgba(229, 73, 94, 0.18);
  font-size: 12px;
}

.message:not(:empty) {
  display: block;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.footer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d64d5f;
  box-shadow: 0 0 12px rgba(214, 77, 95, 0.42);
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes routePulse {
  0%, 100% { opacity: 0.46; }
  50% { opacity: 0.90; }
}

@keyframes glowCenter {
  from { transform: translate(-50%, -50%) scale(1); }
  to { transform: translate(-46%, -54%) scale(1.06); }
}

@keyframes glowRight {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-55px, 28px, 0); }
}

@media (max-width: 650px) {
  body {
    overflow: auto;
  }

  .login-screen {
    min-height: 100dvh;
    padding: 18px;
  }

  .login-card {
    width: 100%;
    padding: 32px 22px 24px;
    border-radius: 26px;
  }

  .login-card::before {
    border-radius: 25px;
  }

  .brand-mark {
    width: 60px;
    height: 60px;
    border-radius: 17px;
  }

  .login-card h1 {
    font-size: 28px;
  }

  .login-form {
    margin-top: 28px;
  }

  .form-group input,
  .login-button {
    height: 54px;
  }

  .login-footer {
    margin-top: 26px;
  }

  .portal-badge {
    min-width: 200px;
  }

  .terrain-reference {
    width: min(72vw, 520px);
    opacity: 0.82;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-card,
  .route,
  .scene-glow {
    animation: none;
  }
}


/* =========================================================
   MOBILE LOGIN INPUT ALIGNMENT
   iPhone/WebKit needs an explicit 16px text box and balanced vertical
   padding so focused text, placeholder and caret remain truly centered.
   Desktop login styling is intentionally unchanged.
   ========================================================= */
@media (max-width: 650px) {
  .form-group input {
    height: 54px;
    padding: 16px 16px;
    font-size: 16px;
    line-height: 20px;
    -webkit-appearance: none;
    appearance: none;
    vertical-align: middle;
  }

  .form-group input::placeholder {
    line-height: 20px;
  }

  .form-group input:focus {
    transform: none;
  }
}
