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

:root {
  --blue-deep: #020510;
  --blue-night: #040d2a;
  --blue-dark: #0a1a4a;
  --blue-mid: #0d2a7a;
  --blue-bright: #1a6fff;
  --blue-glow: #00aaff;
  --blue-light: #7ab8ff;
  --blue-pale: #aad4ff;
  --cyan: #00cfff;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--blue-deep) !important;
  font-family: "Share Tech Mono", monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 350px;
}

/* ── LOGO CANVAS ──
   Absolute overlay covering the entire card.
   The JS renders the logo in the top zone only.
   overflow:visible ensures the canvas is never clipped. */
.sky {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: visible;
  background: transparent;
  pointer-events: none;
  z-index: 0;
}
.sky canvas {
  display: block;
}

/* CRT scanline overlay on logo */
.crt-s {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.055) 2px,
    rgba(0, 0, 0, 0.082) 3px
  );
}
.crt-v {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

/* ── FULLSCREEN ANIMATED BACKGROUND ── */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ── GRID OVERLAY ── */
.sky-grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  background-image: linear-gradient(
      rgba(26, 111, 255, 0.05) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(26, 111, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: grid-pulse 8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes grid-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* ── SCANLINES ── */
.sky-scanlines {
  position: fixed;
  inset: 0;
  z-index: 2;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.12) 3px,
    rgba(0, 0, 0, 0.12) 4px
  );
  pointer-events: none;
}

/* ── CENTER GLOW ── */
.sky-glow {
  position: fixed;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 80, 220, 0.22) 0%,
    transparent 70%
  );
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
  animation: glow-breathe 6s ease-in-out infinite;
}
@keyframes glow-breathe {
  0%,
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1.15);
  }
}

/* ── LOGIN CARD ── */
.sky-card {
  position: relative;
  z-index: 10;
  background: rgba(2, 8, 30, 0.6);
  border: 1px solid rgba(26, 111, 255, 0.3);
  width: 440px;
  padding: 0;
  overflow: hidden;
  animation: card-appear 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes card-appear {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.sky-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--blue-bright),
    var(--cyan),
    var(--blue-bright),
    transparent
  );
  animation: top-line-scan 3s linear infinite;
}
@keyframes top-line-scan {
  0% {
    background-position: -440px 0;
  }
  100% {
    background-position: 440px 0;
  }
}
.sky-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(26, 111, 255, 0.4),
    transparent
  );
}

/* Card corner decorations */
.sky-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 6;
  border-color: var(--blue-bright);
  border-style: solid;
  animation: corner-flash 4s ease-in-out infinite 0s;
}
.sky-tl {
  top: 8px;
  left: 8px;
  border-width: 1px 0 0 1px;
}
.sky-tr {
  top: 8px;
  right: 8px;
  border-width: 1px 1px 0 0;
}
.sky-bl {
  bottom: 8px;
  left: 8px;
  border-width: 0 0 1px 1px;
}
.sky-br {
  bottom: 8px;
  right: 8px;
  border-width: 0 1px 1px 0;
}
@keyframes corner-flash {
  0%,
  90%,
  100% {
    border-color: var(--blue-bright);
    opacity: 1;
  }
  95% {
    border-color: var(--blue-dark)
    opacity: 0.5;
  }
}

/* ── CARD BODY ──
   margin-top pushes content below the logo zone (top 42% of card height).
   The gradient fades the logo into the card background. */
.sky-card-body {
  position: relative;
  z-index: 5;
  padding: 1.5rem 2.25rem 2rem;
  margin-top: 42%;
  margin-bottom: 0px!;
}

/* ── BRAND ── */
.sky-brand-title {
  font-family: "Orbitron", monospace;
  color: var(--blue-glow);
  font-size: 26px;
  letter-spacing: 10px;
  text-transform: uppercase;
  text-align: center;
  animation: fade-in 1s ease both 0.5s;
  text-shadow: 0 0 20px rgba(0, 170, 255, 0.5);
}
.sky-brand-sub {
  color: rgba(26, 111, 255, 0.5);
  font-size: 9px;
  letter-spacing: 3px;
  text-align: center;
  margin-top: 4px;
  margin-bottom: 1.75rem;
  animation: fade-in 1s ease both 0.6s;
}
.sky-divider {
  border: none;
  border-top: 1px solid #0a1a4a;
  margin-bottom: 1.5rem;
}

/* ── HIDDEN ROUNDCUBE FORM ── */
#rc-form-hidden {
  display: none !important;
}

/* ── SKYNET INPUT FIELDS ── */
.sky-field-wrap {
  position: relative;
  margin-bottom: 1.25rem;
  animation: slide-up 0.6s ease both;
}
.sky-field-wrap:nth-child(1) {
  animation-delay: 0.7s;
}
.sky-field-wrap:nth-child(2) {
  animation-delay: 0.85s;
}
@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sky-field-label {
  color: rgba(26, 111, 255, 0.7);
  font-size: 9px;
  letter-spacing: 3px;
  margin-bottom: 6px;
  display: block;
  text-transform: uppercase;
}
.sky-field-icon {
  position: absolute;
  left: 12px;
  bottom: 13px;
  color: var(--blue-bright);
  font-size: 12px;
  transition: color 0.2s;
  pointer-events: none;
}
.sky-input {
  background: #010820;
  border: 1px solid #0d2266;
  color: var(--blue-light);
  font-family: "Share Tech Mono", monospace;
  font-size: 13px;
  padding: 12px 12px 12px 32px;
  width: 100%;
  outline: none;
  letter-spacing: 1px;
  border-radius: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
  caret-color: var(--cyan);
}
.sky-input:focus {
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 1px rgba(26, 111, 255, 0.15),
    inset 0 0 16px rgba(26, 111, 255, 0.04);
}
.sky-input:focus ~ .sky-field-icon {
  color: var(--cyan);
}
.sky-input::placeholder {
  color: #0d2266;
}

/* ── SUBMIT BUTTON ── */
.sky-submit {
  background: rgba(26, 79, 255, 0.06);
  border: 1px solid rgba(26, 79, 255, 0.6);
  color: var(--blue-light);
  font-family: "Orbitron", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  padding: 14px;
  width: 100%;
  cursor: pointer;
  margin-top: 0.25rem;
  position: relative;
  overflow: hidden;
  transition: all 0.25s;
  border-radius: 0;
  animation: slide-up 0.6s ease both 1s;
}
.sky-submit::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(26, 111, 255, 0.12),
    transparent
  );
  transition: left 0.5s;
}
.sky-submit:hover {
  background: rgba(26, 79, 255, 0.16);
  border-color: var(--cyan);
  color: var(--blue-pale);
  text-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
}
.sky-submit:hover::before {
  left: 100%;
}
.sky-submit:active {
  transform: scale(0.99);
}

/* ── BLINK CURSOR ── */
.blink {
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ── ERROR MESSAGE ── */
#messagestack {
  display: none;
}
.sky-error {
  display: none;
}
#messagestack > div,
.sky-error {
  color: #ff4444;
  font-size: 10px;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 1rem;
  padding: 8px;
  border: 1px solid rgba(255, 68, 68, 0.3);
  background: rgba(255, 68, 68, 0.05);
  animation: fade-in 0.3s ease;
}
.sky-error.visible {
  display: block;
}

/* ── STATUS BAR ── */
.sky-status {
  display: flex;
  justify-content: space-between;
  margin-top: 1.25rem;
  animation: fade-in 1s ease both 1.1s;
}
.sky-status-item {
  color: rgba(13, 34, 102, 0.9);
  font-size: 9px;
  letter-spacing: 1px;
}
.sky-status-item span {
  color: rgba(26, 111, 255, 0.55);
}
.sky-status-item.online span {
  color: #00ff88;
  animation: pulse-green 2s ease-in-out infinite;
}
@keyframes pulse-green {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* ── THREAT INDICATOR ── */
.sky-threat {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1rem;
  padding: 8px 10px;
  border: 1px solid rgba(13, 34, 102, 0.6);
  background: rgba(1, 8, 32, 0.5);
  animation: fade-in 1s ease both 1s;
}
.sky-threat-label {
  color: rgba(26, 111, 255, 0.4);
  font-size: 9px;
  letter-spacing: 2px;
  flex-shrink: 0;
}
.sky-threat-bars {
  display: flex;
  gap: 3px;
  flex: 1;
}
.sky-tbar {
  height: 8px;
  flex: 1;
  background: rgba(13, 34, 102, 0.4);
  border: 1px solid rgba(13, 34, 102, 0.6);
}
.sky-tbar.on {
  background: var(--blue-bright);
  animation: bar-pulse 2s ease-in-out infinite;
}
.sky-tbar.on:nth-child(2) {
  animation-delay: 0.2s;
  background: var(--blue-glow);
}
.sky-tbar.on:nth-child(3) {
  animation-delay: 0.4s;
  background: var(--cyan);
}
@keyframes bar-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
.sky-threat-val {
  color: rgba(0, 207, 255, 0.6);
  font-size: 9px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

/* ── SCROLLING TICKER ── */
.sky-ticker {
  color: rgba(13, 34, 102, 0.8);
  font-size: 8px;
  letter-spacing: 1px;
  margin-top: 0.6rem;
  overflow: hidden;
  white-space: nowrap;
  animation: fade-in 1s ease both 1.2s;
}
.sky-ticker-inner {
  display: inline-block;
  animation: ticker-scroll 22s linear infinite;
}
@keyframes ticker-scroll {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* ── NODE ID ── */
.sky-node-id {
  color: rgba(26, 74, 255, 0.25);
  font-size: 8px;
  text-align: center;
  margin-top: 5px;
  letter-spacing: 2px;
  animation: fade-in 1s ease both 1.3s;
}

/* ── HIDE ROUNDCUBE FOOTER ── */
#login-footer {
  display: none !important;
}

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

/* ── RESPONSIVE MOBILE ── */
@media (max-width: 480px) {
  html,
  body {
    align-items: flex-start;
    overflow-y: auto;
  }

  .sky-card {
    width: 100%;
    margin: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .sky-brand-title {
    font-size: 20px;
    letter-spacing: 6px;
  }
  .sky-brand-sub {
    font-size: 8px;
    letter-spacing: 2px;
    margin-bottom: 1.25rem;
  }

  /* font-size 16px prevents iOS auto-zoom on focus */
  .sky-input {
    font-size: 16px !important;
    padding: 14px 12px 14px 32px !important;
  }
  .sky-submit {
    font-size: 12px !important;
    padding: 16px !important;
    letter-spacing: 4px !important;
  }

  .sky-status {
    flex-direction: column;
    gap: 4px;
    align-items: center;
  }

  .sky-ticker {
    font-size: 8px;
  }
  .sky-node-id {
    font-size: 7px;
  }
  .sky-error {
    font-size: 11px;
    letter-spacing: 1px;
  }
}

@media (max-width: 360px) {
  .sky-brand-title {
    font-size: 17px;
    letter-spacing: 4px;
  }
  .sky-card {
    padding: 1.5rem 1rem;
  }
}
