/* 九层 — purple night tower navigation */
:root {
  --bg-0: #0b0614;
  --bg-1: #150a24;
  --bg-2: #1f1035;
  --violet-50: #f5e8ff;
  --violet-100: #e9d5ff;
  --violet-200: #d8b4fe;
  --violet-300: #c4b5fd;
  --violet-400: #a78bfa;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;
  --violet-900: #4c1d95;
  --gold: #f5d78e;
  --gold-soft: rgba(245, 215, 142, 0.55);
  --pink: #f0abfc;
  --ink: #f3e8ff;
  --muted: rgba(233, 213, 255, 0.62);
  --card: rgba(36, 18, 58, 0.55);
  --card-border: rgba(196, 181, 253, 0.18);
  --card-hover: rgba(88, 28, 135, 0.35);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC",
    "PingFang SC", serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
    "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", ui-monospace, monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg-0);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* —— atmosphere —— */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(124, 58, 237, 0.35), transparent 60%),
    radial-gradient(700px 420px at 90% 10%, rgba(192, 132, 252, 0.18), transparent 55%),
    radial-gradient(800px 600px at 50% 110%, rgba(76, 29, 149, 0.45), transparent 55%),
    linear-gradient(180deg, #12081f 0%, #0b0614 48%, #160a28 100%);
}

.mist {
  position: absolute;
  left: -10%;
  width: 120%;
  height: 180px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
  pointer-events: none;
}

.mist-1 {
  bottom: 8%;
  background: radial-gradient(ellipse, rgba(124, 58, 237, 0.45), transparent 70%);
  animation: drift 18s ease-in-out infinite;
}

.mist-2 {
  bottom: 22%;
  height: 120px;
  background: radial-gradient(ellipse, rgba(240, 171, 252, 0.18), transparent 70%);
  animation: drift 24s ease-in-out infinite reverse;
}

.mist-3 {
  top: 18%;
  height: 100px;
  opacity: 0.2;
  background: radial-gradient(ellipse, rgba(167, 139, 250, 0.25), transparent 70%);
  animation: drift 28s ease-in-out infinite;
}

.orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(196, 181, 253, 0.12);
  pointer-events: none;
}

.orbit-a {
  width: min(70vw, 520px);
  height: min(70vw, 520px);
  top: -12%;
  right: -8%;
  box-shadow: inset 0 0 60px rgba(139, 92, 246, 0.08);
}

.orbit-b {
  width: min(40vw, 280px);
  height: min(40vw, 280px);
  bottom: 8%;
  left: -6%;
  border-style: dashed;
  border-color: rgba(245, 215, 142, 0.12);
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 28% 48%, rgba(233, 213, 255, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 62% 18%, rgba(255, 255, 255, 0.65), transparent),
    radial-gradient(1px 1px at 78% 36%, rgba(245, 215, 142, 0.55), transparent),
    radial-gradient(1px 1px at 88% 68%, rgba(233, 213, 255, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 42% 72%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 8% 80%, rgba(240, 171, 252, 0.45), transparent);
  opacity: 0.8;
  pointer-events: none;
}

@keyframes drift {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(4%);
  }
}

/* —— layout —— */
.frame {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.75rem 0 3.5rem;
}

/* —— hero —— */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  animation: rise 0.8s ease both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 24px rgba(124, 58, 237, 0.45));
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--gold-soft);
}

.brand-text h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0.28em;
  line-height: 1;
  background: linear-gradient(120deg, #fff7ed 0%, #e9d5ff 40%, #c4b5fd 75%, #f5d78e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-indent: 0.28em;
}

.tagline {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  letter-spacing: 0.12em;
}

/* nine thin layers as visual meter */
.layer-meter {
  display: flex;
  flex-direction: column-reverse;
  gap: 5px;
  padding: 0.4rem 0;
  opacity: 0.85;
}

.layer-meter span {
  display: block;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--violet-400), transparent);
  animation: pulse-layer 2.8s ease-in-out infinite;
}

.layer-meter span:nth-child(1) { width: 18px; animation-delay: 0s; }
.layer-meter span:nth-child(2) { width: 26px; animation-delay: 0.1s; }
.layer-meter span:nth-child(3) { width: 34px; animation-delay: 0.2s; }
.layer-meter span:nth-child(4) { width: 42px; animation-delay: 0.3s; }
.layer-meter span:nth-child(5) { width: 50px; animation-delay: 0.4s; }
.layer-meter span:nth-child(6) { width: 58px; animation-delay: 0.5s; }
.layer-meter span:nth-child(7) { width: 66px; animation-delay: 0.6s; }
.layer-meter span:nth-child(8) { width: 74px; animation-delay: 0.7s; }
.layer-meter span:nth-child(9) { width: 82px; animation-delay: 0.8s; }

@keyframes pulse-layer {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* —— cards —— */
.services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.35rem 1.3rem 1.2rem;
  min-height: 220px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(88, 28, 135, 0.28), rgba(24, 12, 40, 0.65) 55%),
    var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    background 0.28s ease;
  animation: rise 0.7s ease both;
  animation-delay: calc(0.08s * var(--i) + 0.15s);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    transparent 30%,
    rgba(245, 215, 142, 0.06) 48%,
    transparent 62%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.card-glow {
  position: absolute;
  width: 160px;
  height: 160px;
  top: -60px;
  right: -40px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.35), transparent 68%);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0.55;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(216, 180, 254, 0.42);
  box-shadow:
    0 28px 50px rgba(76, 29, 149, 0.35),
    0 0 0 1px rgba(245, 215, 142, 0.08);
  background:
    linear-gradient(160deg, rgba(124, 58, 237, 0.38), rgba(30, 14, 52, 0.75) 55%),
    var(--card-hover);
}

.card:hover::before {
  opacity: 1;
}

.card:hover .card-glow {
  opacity: 1;
  transform: scale(1.12);
}

.card:hover .go i {
  transform: translateX(4px);
}

.card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.svc-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.floor {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: rgba(245, 215, 142, 0.7);
}

.card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--violet-50);
}

.card p {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
  color: var(--muted);
}

/* credentials on card */
.creds {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
  padding: 0.55rem 0.6rem;
  border-radius: 12px;
  background: rgba(11, 6, 20, 0.4);
  border: 1px solid rgba(196, 181, 253, 0.12);
}

.cred-row {
  display: grid;
  grid-template-columns: 4.2rem 1fr auto;
  gap: 0.35rem;
  align-items: center;
}

.cred-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: rgba(245, 215, 142, 0.65);
  white-space: nowrap;
}

.cred-val {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--violet-100);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.copy-btn {
  appearance: none;
  border: 1px solid rgba(196, 181, 253, 0.28);
  background: rgba(124, 58, 237, 0.28);
  color: var(--violet-100);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
  background: rgba(139, 92, 246, 0.5);
  border-color: rgba(245, 215, 142, 0.4);
}

.copy-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.btn-open,
.btn-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid rgba(196, 181, 253, 0.28);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-open {
  appearance: none;
  background: rgba(124, 58, 237, 0.45);
  border-color: rgba(245, 215, 142, 0.28);
  color: #fff7ed;
}

.btn-ext {
  background: rgba(255, 255, 255, 0.04);
  color: var(--violet-200);
}

.btn-open:hover,
.btn-ext:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 215, 142, 0.45);
}

.btn-open:focus-visible,
.btn-ext:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(12px);
  z-index: 100;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: rgba(36, 18, 58, 0.92);
  border: 1px solid rgba(245, 215, 142, 0.35);
  color: var(--violet-50);
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* viewer overlay */
body.viewer-open {
  overflow: hidden;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: #0b0614;
}

.viewer[hidden] {
  display: none !important;
}

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: rgba(21, 10, 36, 0.95);
  border-bottom: 1px solid rgba(196, 181, 253, 0.18);
}

.viewer-bar-left,
.viewer-bar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.viewer-bar-left strong {
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--violet-50);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-back,
.viewer-close {
  appearance: none;
  border: 1px solid rgba(196, 181, 253, 0.25);
  background: rgba(124, 58, 237, 0.25);
  color: var(--violet-100);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.82rem;
}

.viewer-back {
  padding: 0.4rem 0.7rem;
  letter-spacing: 0.04em;
}

.viewer-close {
  width: 2rem;
  height: 2rem;
  font-size: 1.2rem;
  line-height: 1;
}

.viewer-newtab {
  color: var(--gold);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.viewer-newtab:hover {
  text-decoration: underline;
}

.viewer-note {
  margin: 0;
  padding: 0.35rem 0.9rem;
  font-size: 0.75rem;
  color: rgba(233, 213, 255, 0.5);
  background: rgba(76, 29, 149, 0.2);
  border-bottom: 1px solid rgba(196, 181, 253, 0.1);
}

.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.viewer-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #12081f;
}

.viewer-creds {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: min(320px, calc(100% - 1.5rem));
  padding: 0.75rem 0.8rem;
  border-radius: 16px;
  background: rgba(21, 10, 36, 0.92);
  border: 1px solid rgba(196, 181, 253, 0.28);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.viewer-creds-head {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: rgba(245, 215, 142, 0.75);
  margin-bottom: 0.55rem;
}

.viewer-creds .cred-row {
  grid-template-columns: 4.5rem 1fr auto;
  margin-bottom: 0.35rem;
}

.viewer-creds .cred-val {
  font-size: 0.74rem;
}

/* —— footer —— */
footer {
  margin-top: 2.75rem;
  text-align: center;
  animation: rise 0.9s ease both;
  animation-delay: 0.55s;
}

.footer-line {
  width: min(280px, 50%);
  height: 1px;
  margin: 0 auto 1rem;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(196, 181, 253, 0.45),
    rgba(245, 215, 142, 0.5),
    rgba(196, 181, 253, 0.45),
    transparent
  );
}

footer p {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(233, 213, 255, 0.42);
  letter-spacing: 0.1em;
}

.dot {
  margin: 0 0.35rem;
  color: rgba(245, 215, 142, 0.45);
}

.logout-wrap {
  margin: 0.75rem 0 0 !important;
}

.logout {
  color: rgba(196, 181, 253, 0.45);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.logout:hover {
  color: rgba(245, 215, 142, 0.75);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— responsive —— */
@media (max-width: 900px) {
  .services {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .frame {
    width: min(100% - 1.5rem, 1080px);
    padding-top: 1.75rem;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .layer-meter {
    flex-direction: row;
    align-items: flex-end;
    gap: 4px;
  }

  .layer-meter span {
    width: 3px !important;
    height: auto;
  }

  .layer-meter span:nth-child(1) { height: 10px; }
  .layer-meter span:nth-child(2) { height: 14px; }
  .layer-meter span:nth-child(3) { height: 18px; }
  .layer-meter span:nth-child(4) { height: 22px; }
  .layer-meter span:nth-child(5) { height: 26px; }
  .layer-meter span:nth-child(6) { height: 30px; }
  .layer-meter span:nth-child(7) { height: 34px; }
  .layer-meter span:nth-child(8) { height: 38px; }
  .layer-meter span:nth-child(9) { height: 42px; }

  .brand {
    gap: 0.9rem;
  }

  .logo {
    width: 72px;
    height: 72px;
  }

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

  .card {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
