:root {
  --blue: #6db3ff;
  --ice: #dcecff;
  --panel: rgba(14, 22, 34, 0.72);
  --line: rgba(113, 181, 255, 0.72);
  --warning: #ff621f;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ice);
  background:
    radial-gradient(circle at 50% 4%, rgba(255, 255, 255, 0.24), transparent 26%),
    linear-gradient(115deg, #111722, #2c3441 48%, #131922);
}

button,
input,
a {
  font: inherit;
}

.gate {
  min-height: 100%;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.screen {
  width: min(96vw, 1680px);
  aspect-ratio: 1792 / 1024;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(133, 193, 255, 0.78);
  border-radius: clamp(22px, 2.8vw, 48px);
  box-shadow:
    0 0 0 8px rgba(31, 100, 183, 0.12),
    0 0 28px rgba(86, 160, 255, 0.88),
    inset 0 0 36px rgba(99, 171, 255, 0.45);
  background-image: url("/assets/asaria-gate.png");
  background-size: cover;
  background-position: center;
}

.mobile-gate {
  display: none;
}

.screen::before,
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen::before {
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.09), transparent),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 7px);
  mix-blend-mode: screen;
}

.screen::after {
  box-shadow: inset 0 -18vh 9vh rgba(3, 8, 15, 0.52);
}

.brand,
.gate-video,
.source-art {
  position: absolute;
  inset: 0;
}

.brand {
  z-index: 0;
}

.gate-video,
.source-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gate-video {
  display: block;
}

.source-art {
  display: none;
}

.hud {
  display: none !important;
}

.hud-left {
  left: 6.2%;
  top: 9.6%;
  display: grid;
  gap: 14px;
}

.hud-left strong {
  color: rgba(236, 247, 255, 0.9);
  font-weight: 500;
}

.hud-left i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 12px var(--blue);
}

.hud-left small,
.hud-right::after {
  display: block;
  width: 120px;
  height: 1px;
  border-top: 1px solid rgba(92, 171, 255, 0.7);
  padding-top: 15px;
}

.hud-right {
  right: 6.2%;
  top: 11.2%;
  text-align: right;
}

.hud-right::after {
  content: "";
  margin-top: 13px;
  margin-left: auto;
  padding: 0;
}

.enter-prompt {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 7.6%;
  width: min(80%, 840px);
  transform: translateX(-50%);
  border: 0;
  background: transparent;
  color: rgba(255, 159, 94, 0.78);
  font-size: clamp(12px, 1.55vw, 25px);
  font-weight: 400;
  letter-spacing: clamp(0.16em, 0.42vw, 0.28em);
  text-align: center;
  text-shadow:
    0 0 8px rgba(255, 71, 22, 0.45),
    0 0 18px rgba(255, 119, 0, 0.28);
  cursor: pointer;
  animation: ember 3.8s ease-in-out infinite;
}

.enter-prompt::before,
.enter-prompt::after {
  content: "";
  position: absolute;
  top: 50%;
  width: clamp(42px, 10vw, 220px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 106, 46, 0.42));
}

.enter-prompt::before {
  right: calc(100% - 70px);
}

.enter-prompt::after {
  left: calc(100% - 70px);
  transform: scaleX(-1);
}

.security-line {
  display: none !important;
}

.security-line span::before {
  content: "•";
  color: var(--blue);
  margin: 0 18px;
  text-shadow: 0 0 12px var(--blue);
}

.login-panel,
.portal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 50%, rgba(52, 112, 184, 0.2), transparent 34%),
    rgba(4, 9, 17, 0.76);
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms ease, visibility 260ms ease;
  backdrop-filter: blur(8px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-panel.is-open,
.portal.is-open {
  opacity: 1;
  visibility: visible;
}

.access-card,
.portal-shell {
  position: relative;
  width: min(92vw, 520px);
  overflow: hidden;
  border: 1px solid rgba(126, 191, 255, 0.82);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    var(--panel);
  box-shadow:
    0 0 36px rgba(78, 153, 255, 0.42),
    inset 0 0 28px rgba(104, 178, 255, 0.18);
}

.access-card {
  display: grid;
  gap: 14px;
  padding: clamp(26px, 4vw, 42px);
}

.scan-line {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, #75bbff, transparent);
  animation: scan 2.8s linear infinite;
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.access-card h1,
.portal-shell h1 {
  margin: 0;
  color: #f4f8ff;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.access-card label {
  margin-top: 10px;
  color: rgba(220, 236, 255, 0.8);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.access-card input {
  width: 100%;
  height: 54px;
  border: 1px solid rgba(123, 188, 255, 0.66);
  border-radius: 6px;
  outline: 0;
  padding: 0 16px;
  color: #fff;
  background: rgba(5, 13, 23, 0.74);
  box-shadow: inset 0 0 18px rgba(76, 156, 255, 0.15);
}

.access-card input:focus {
  border-color: #a8d5ff;
  box-shadow: 0 0 0 3px rgba(109, 179, 255, 0.2), inset 0 0 18px rgba(76, 156, 255, 0.18);
}

.error {
  min-height: 22px;
  margin: 0;
  color: #ff8a58;
  letter-spacing: 0.06em;
}

.access-card button,
.portal-shell button,
.lock-link {
  height: 52px;
  border: 1px solid rgba(115, 189, 255, 0.82);
  border-radius: 6px;
  color: #eaf5ff;
  background: rgba(26, 74, 128, 0.64);
  box-shadow: 0 0 18px rgba(78, 153, 255, 0.28);
  cursor: pointer;
}

.portal-shell {
  width: min(94vw, 1040px);
  min-height: min(72vh, 620px);
  padding: clamp(22px, 4vw, 42px);
}

.portal-shell header {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-start;
  margin-bottom: 34px;
}

.portal-shell button,
.lock-link {
  width: 92px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  text-decoration: none;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.app-tile {
  min-height: 150px;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 22px;
  color: #e7f4ff;
  text-decoration: none;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid rgba(145, 201, 255, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 22px rgba(104, 178, 255, 0.12);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.app-tile:hover,
.app-tile:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(255, 119, 45, 0.9);
  box-shadow: 0 0 28px rgba(255, 89, 18, 0.22), inset 0 0 22px rgba(104, 178, 255, 0.16);
}

.app-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: var(--blue);
  font-size: 42px;
  line-height: 1;
  text-shadow: 0 0 15px rgba(91, 175, 255, 0.9);
}

@keyframes ember {
  0%,
  100% {
    color: #ff641e;
    filter: saturate(1);
  }
  45% {
    color: #ffd047;
    filter: saturate(1.55);
  }
  70% {
    color: #ff2d00;
  }
}

@keyframes scan {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(380px);
  }
}

@media (max-width: 1100px) {
  .portal-shell {
    width: min(94vw, 860px);
  }

  .apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  html,
  body {
    min-height: 100%;
  }

  body {
    overflow: auto;
  }

  .gate {
    min-height: 100dvh;
  }

  .screen {
    display: none;
  }

  .mobile-gate {
    width: 100%;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 16px;
    padding: max(40px, env(safe-area-inset-top)) 24px max(34px, env(safe-area-inset-bottom));
    text-align: center;
    background:
      radial-gradient(circle at 50% 18%, rgba(126, 191, 255, 0.22), transparent 34%),
      radial-gradient(circle at 50% 84%, rgba(255, 122, 47, 0.12), transparent 34%),
      linear-gradient(145deg, #050a12, #151e2b 52%, #060a11);
    border: 1px solid rgba(133, 193, 255, 0.48);
    box-shadow: inset 0 0 32px rgba(99, 171, 255, 0.22);
    cursor: pointer;
  }

  .mobile-gate::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
      linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.055), transparent),
      repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.032) 0 1px, transparent 1px 7px);
    mix-blend-mode: screen;
  }

  .mobile-mark {
    position: relative;
    display: grid;
    place-items: center;
    width: min(62vw, 240px);
    aspect-ratio: 1.35;
    margin-bottom: 10px;
    border: 1px solid rgba(126, 191, 255, 0.58);
    border-radius: 18px;
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(233, 239, 248, 0.86)),
      rgba(9, 18, 30, 0.72);
    box-shadow:
      0 0 30px rgba(78, 153, 255, 0.32),
      inset 0 0 26px rgba(104, 178, 255, 0.16);
    overflow: hidden;
  }

  .mobile-mark img {
    display: block;
    width: 88%;
    height: 82%;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(7, 14, 25, 0.18));
  }

  .mobile-gate h1 {
    position: relative;
    margin: 0;
    color: #f4f8ff;
    font-size: clamp(34px, 11vw, 48px);
    font-weight: 300;
    letter-spacing: 0.08em;
    line-height: 1.08;
    text-transform: uppercase;
  }

  .mobile-gate p {
    position: relative;
    max-width: 310px;
    margin: 0;
    color: rgba(220, 236, 255, 0.72);
    line-height: 1.5;
  }

  .hud {
    display: none;
  }

  .mobile-enter {
    position: relative;
    width: min(82vw, 340px);
    min-height: 54px;
    margin-top: 18px;
    border: 1px solid rgba(255, 159, 94, 0.48);
    border-radius: 999px;
    color: rgba(255, 176, 116, 0.84);
    background: rgba(5, 10, 18, 0.44);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    box-shadow: 0 0 24px rgba(255, 104, 32, 0.16);
    backdrop-filter: blur(10px);
    cursor: pointer;
  }

  .enter-prompt::before,
  .enter-prompt::after,
  .security-line {
    display: none;
  }

  .enter-prompt::before {
    display: block;
  }

  .portal-shell header {
    align-items: stretch;
    flex-direction: column;
  }

  .apps-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px), (max-height: 560px) {
  .login-panel,
  .portal {
    align-items: start;
    place-items: start center;
    padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  }

  .access-card {
    width: min(100%, 440px);
    margin: auto 0;
    padding: 24px 18px;
  }

  .access-card h1 {
    font-size: clamp(28px, 11vw, 40px);
    line-height: 1.08;
  }

  .portal-shell {
    width: min(100%, 560px);
    min-height: auto;
    padding: 18px;
  }

  .portal-shell header {
    gap: 16px;
    margin-bottom: 18px;
  }

  .portal-shell h1 {
    font-size: clamp(30px, 11vw, 42px);
    line-height: 1.06;
  }

  .eyebrow {
    font-size: 11px;
    letter-spacing: 0.2em;
  }

  .lock-link {
    width: 100%;
    max-width: none;
  }

  .apps-grid {
    gap: 12px;
  }

  .app-tile {
    min-height: 104px;
    grid-template-columns: 54px minmax(0, 1fr);
    place-items: center start;
    gap: 14px;
    padding: 16px;
    text-align: left;
  }

  .app-icon {
    width: 46px;
    height: 46px;
    font-size: 34px;
  }
}

@media (max-width: 380px) {
  .portal-shell {
    padding: 14px;
  }

  .portal-shell h1 {
    font-size: 28px;
  }

  .app-tile {
    min-height: 96px;
    padding: 14px;
    letter-spacing: 0.05em;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .enter-prompt {
    bottom: 14px;
  }

  .access-card {
    margin: 0;
  }

  .portal-shell {
    width: min(94vw, 900px);
  }

  .apps-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-tile {
    min-height: 92px;
    grid-template-columns: 44px minmax(0, 1fr);
  }
}
