:root {
  color-scheme: light;
  --portal-text: #f6f8fb;
  --portal-line: rgba(255, 255, 255, 0.16);
  --portal-line-strong: rgba(255, 255, 255, 0.22);
  --portal-muted: rgba(246, 248, 251, 0.78);
  --portal-surface: rgba(10, 14, 24, 0.34);
  --portal-shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
  --portal-nav-gap: 20px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--portal-text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  background-color: #09111d;
}

.portal-page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
}

.portal-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  transform: scale(1.06);
  animation: portalBackgroundDrift 22s ease-in-out infinite alternate;
}

.portal-page::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 7, 13, 0.46) 0%, rgba(3, 7, 13, 0.24) 44%, rgba(3, 7, 13, 0.58) 100%),
    linear-gradient(180deg, rgba(4, 8, 14, 0.24) 0%, rgba(4, 8, 14, 0.08) 34%, rgba(4, 8, 14, 0.72) 100%);
}

.portal-page-outer::before {
  background-image: url("/portal/assets/ai-compute-hero.png?v=20260601-ai-hero-1");
}

.portal-page-hub::before {
  background-image: url("/portal/assets/ai-compute-hero.png?v=20260601-ai-hero-1");
}

.portal-topbar,
.portal-stage {
  position: relative;
}

.portal-topbar {
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--portal-nav-gap);
  min-height: 68px;
  padding: 12px 28px;
}

.portal-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--portal-nav-gap);
  flex-wrap: wrap;
  min-width: 0;
}

.portal-nav-link,
.portal-avatar-link,
.portal-avatar-action,
.portal-login-button,
.portal-avatar-button {
  border-radius: 8px;
}

.portal-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 0;
  border: 0;
  color: rgba(246, 248, 251, 0.72);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  background: transparent;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.16);
  transition:
    color 140ms ease,
    text-shadow 140ms ease;
}

.portal-nav-link:hover {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.22);
}

.portal-user-slot {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
}

.portal-auth-pending .portal-login-button,
.portal-auth-pending .portal-avatar-button {
  visibility: hidden;
}

.portal-login-button[hidden],
.portal-avatar-button[hidden],
.portal-avatar-menu[hidden] {
  display: none !important;
}

.portal-login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--portal-line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--portal-text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  backdrop-filter: blur(16px);
  box-shadow: var(--portal-shadow);
}

.portal-login-button:hover {
  border-color: var(--portal-line-strong);
  background: rgba(255, 255, 255, 0.12);
}

.portal-avatar-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  min-height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid #d6def1;
  border-radius: 999px;
  background: rgba(245, 247, 250, 0.78);
  color: #344054;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  box-shadow:
    0 10px 24px rgba(16, 24, 40, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.54) inset;
}

.portal-avatar-button:hover {
  border-color: rgba(255, 255, 255, 0.64);
  background: rgba(255, 255, 255, 0.88);
  color: #1f2937;
}

.portal-avatar-menu {
  position: absolute;
  z-index: 50;
  top: calc(100% + 10px);
  right: 0;
  width: min(220px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 12, 20, 0.88);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
}

.portal-avatar-menu[hidden] {
  display: none;
}

.portal-avatar-header {
  display: grid;
  gap: 3px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-avatar-name {
  max-width: 60%;
  overflow: hidden;
  font-size: clamp(12px, 0.9vw, 14px);
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-avatar-id {
  max-width: 75%;
  overflow: hidden;
  color: var(--portal-muted);
  font-size: clamp(11px, 0.76vw, 12px);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-avatar-link,
.portal-avatar-action {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--portal-text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}

.portal-avatar-link:hover,
.portal-avatar-action:hover {
  background: rgba(255, 255, 255, 0.08);
}

.portal-stage {
  z-index: 1;
  pointer-events: none;
  min-height: calc(100vh - 78px);
  min-height: calc(100svh - clamp(64px, 8vw, 78px));
}

.portal-compliance-footer {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(92vw, 760px);
  min-height: 28px;
  padding: 4px 10px;
  transform: translateX(-50%);
  color: rgba(246, 248, 251, 0.62);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  pointer-events: auto;
}

.portal-compliance-footer a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 140ms ease;
}

.portal-compliance-footer a:hover {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: underline;
}

@keyframes portalBackgroundDrift {
  from {
    transform: scale(1.04) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.11) translate3d(-1.2%, -0.8%, 0);
  }
}

@media (max-width: 860px) {
  .portal-topbar {
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
  }

  .portal-nav {
    justify-content: flex-end;
    gap: 8px;
  }

  .portal-user-slot {
    flex: 0 0 auto;
  }

  .portal-compliance-footer {
    bottom: 12px;
    font-size: 11px;
  }
}

/* Polish pass */
.portal-topbar {
  padding: 12px 28px;
}

.portal-nav {
  gap: var(--portal-nav-gap);
}

.portal-nav-link {
  min-height: 36px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.portal-nav-link:hover {
  color: var(--portal-text);
}

.portal-login-button {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.065);
}

.portal-login-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.portal-avatar-menu {
  box-shadow:
    0 22px 52px rgba(0, 0, 0, 0.32),
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

/* 2026-05-15 right-biased portal navigation. Keep this after polish rules. */
@media (min-width: 861px) {
  .portal-topbar {
    justify-content: flex-end;
  }

  .portal-nav {
    justify-content: flex-end;
  }
}

/* 2026-05-16 real logo asset. Keep after right-biased nav rules so the left brand slot stays visible. */
.portal-topbar {
  justify-content: space-between;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  text-decoration: none;
  pointer-events: auto;
}

.portal-brand-image {
  display: block;
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.2));
}

.portal-nav {
  margin-left: auto;
}

@media (max-width: 860px) {
  .portal-brand {
    width: 40px;
    height: 40px;
  }

  .portal-brand-image {
    width: 34px;
    height: 34px;
  }
}
