/**
 * 赳赳大秦演艺中心 · 桥接层（portal-ops 主样式 + 深色金版差异 + 动态子系统）
 */

/* 用户稿色板（略暖于 portal-ops 默认纯黑） */
html {
  --bg: #08080c;
  --bg-deep: #040407;
  --surface: #0e0e14;
  --surface-light: #14141c;
}

body {
  font-family: 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.7;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.018;
  pointer-events: none;
  z-index: 9999;
}

/* 主题切换过渡：避免浅深色硬切 */
html.dq-theme-anim-ready body,
html.dq-theme-anim-ready #navbar,
html.dq-theme-anim-ready .hero--weather .wx-badge,
html.dq-theme-anim-ready .hero--weather .wx-clock,
html.dq-theme-anim-ready #services .sy-card,
html.dq-theme-anim-ready .service-cell {
  transition:
    background-color 420ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 420ms cubic-bezier(0.22, 1, 0.36, 1),
    color 420ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

html.dq-theme-switching body::after {
  animation: dqThemeSwitchFade 460ms ease-out;
}

@keyframes dqThemeSwitchFade {
  0% { opacity: 0.03; }
  50% { opacity: 0.075; }
  100% { opacity: 0.03; }
}

/* nav#navbar 复用 site-nav */
#navbar,
nav.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.45rem 4rem;
  min-height: 64px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 8, 12, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--white-04);
  transition: all 0.5s ease;
}

#navbar.scrolled,
nav.site-nav.scrolled {
  background: rgba(8, 8, 12, 0.92);
  border-bottom-color: rgba(200, 168, 78, 0.08);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-indicator {
  position: absolute;
  bottom: -1px;
  height: 1px;
  background: var(--gold);
  transition: left 0.4s cubic-bezier(0.23, 1, 0.32, 1), width 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
}

#navbar .nav-left {
  font-size: clamp(0.82rem, 2.2vw, 1rem);
  letter-spacing: 0.04em;
  max-width: min(42vw, 280px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-center { position: relative; }

/* Hero 竖线 */
.hero .v-line--l { left: 6%; height: 55%; top: 22%; }
.hero .v-line--r { right: 8%; height: 40%; top: 28%; }
.hero .v-line--c { left: 50%; height: 25%; top: 8%; opacity: 0.4; }

.hero .v-line--l::after { animation-delay: 0.5s; }
.hero .v-line--r::after { animation-delay: 0.8s; }
.hero .v-line--c::after { animation-delay: 1.1s; }

/* 粒子流沙：悬浮岩块（仅秦版 Hero） */
.hero-sand-rocks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.hero-sand-rock {
  position: absolute;
  display: block;
  background: linear-gradient(145deg, rgba(72, 58, 46, 0.22) 0%, rgba(48, 38, 30, 0.08) 100%);
  border: 1px solid rgba(120, 96, 72, 0.12);
  box-shadow: 0 18px 40px rgba(44, 36, 24, 0.06);
  transform: rotate(var(--rock-rot, 0deg));
}

.portal-app.n-layout--light .hero-sand-rock {
  background: linear-gradient(145deg, rgba(110, 82, 58, 0.16) 0%, rgba(90, 68, 48, 0.05) 100%);
  border-color: rgba(154, 102, 64, 0.14);
}

.hero-sand-rock--1 {
  --rock-rot: -8deg;
  top: 4%;
  right: 16%;
  width: min(140px, 18vw);
  height: min(72px, 9vw);
  clip-path: polygon(8% 18%, 42% 0%, 88% 12%, 100% 58%, 72% 100%, 22% 92%, 0% 52%);
}

.hero-sand-rock--2 {
  --rock-rot: 12deg;
  top: 10%;
  right: 8%;
  width: min(96px, 12vw);
  height: min(56px, 7vw);
  clip-path: polygon(12% 8%, 78% 0%, 100% 38%, 86% 100%, 28% 88%, 0% 42%);
  opacity: 0.85;
}

.hero-sand-rock--3 {
  --rock-rot: -4deg;
  top: 2%;
  right: 28%;
  width: min(110px, 14vw);
  height: min(48px, 6vw);
  clip-path: polygon(0% 28%, 36% 0%, 100% 16%, 92% 100%, 18% 82%);
  opacity: 0.7;
}

.hero-content,
.hero-deco-char,
.hero-bottom-left,
.scroll-hint,
.hero-corners {
  z-index: 3;
}

.hero-deco-char {
  z-index: 3;
}

.hero-title .char {
  animation: charReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    titleGlow 4s ease-in-out 2.5s infinite;
}

.hero-title .char:nth-child(1) { animation-delay: 1.0s, 2.5s; }
.hero-title .char:nth-child(2) { animation-delay: 1.12s, 2.62s; }
.hero-title .char:nth-child(3) { animation-delay: 1.24s, 2.74s; }
.hero-title .char:nth-child(4) { animation-delay: 1.36s, 2.86s; }

@keyframes titleGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.05); }
}

.hero-deco-char {
  opacity: 0;
  animation: textFadeUp 1s ease 2.2s forwards, decoFloat 6s ease-in-out 3.2s infinite;
}

@keyframes decoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.preloader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.portal-landing {
  opacity: 0;
  animation: pageFadeIn 1s ease 0.3s forwards;
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-landing {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* 滚动进度 / 光标 / 回顶 */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-light));
  z-index: 10001;
  width: 0%;
  transition: width 0.15s linear;
  box-shadow: 0 0 10px rgba(200, 168, 78, 0.4);
}

.cursor-glow {
  position: fixed;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 168, 78, 0.035) 0%, transparent 70%);
  pointer-events: none;
  z-index: 9997;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.cursor-glow.active { opacity: 1; }

@media (hover: none) {
  .cursor-glow { display: none; }
}

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 42px;
  height: 42px;
  background: rgba(14, 14, 20, 0.85);
  border: 1px solid rgba(200, 168, 78, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 1rem;
  cursor: pointer;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.4s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: inherit;
  line-height: 1;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
  box-shadow: 0 8px 24px rgba(200, 168, 78, 0.25);
}

/* 动态子系统分组 */
.portal-sy-root {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 5vw, 4rem);
}

.portal-group-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.portal-group-head .head-line {
  width: 32px;
  height: 1px;
  background: var(--gold-dim);
}

.portal-group-head h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.portal-group-meta {
  font-size: 0.68rem;
  color: var(--text-subtle);
  margin-left: auto;
}

button.service-cell {
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.service-cell--active {
  background: var(--surface) !important;
  box-shadow: inset 0 0 0 1px rgba(200, 168, 78, 0.2);
}

.service-cell--active h3 {
  color: var(--gold-light);
}

.portal-loading,
.portal-error {
  padding: 3rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.portal-error {
  color: #d4a574;
}

.app-menu-item.portal-link {
  border: none;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}

.app-menu-item.portal-link.active {
  background: rgba(200, 168, 78, 0.06);
  border-color: rgba(200, 168, 78, 0.12);
  color: var(--gold);
}

  .hero-sand-rock--1,
  .hero-sand-rock--2,
  .hero-sand-rock--3 {
    opacity: 0.55;
  }
}

@media (max-width: 968px) {
  #navbar { padding: 0.45rem 1.5rem; }
  .nav-center { display: none; }
  .nav-skin-switch-notes { display: none; }
  .portal-group-meta { display: none; }
  .nav-right-tools .dq-theme-toggle__label { display: none; }
  .hero-sand-rock { opacity: 0.45; transform: scale(0.85) rotate(var(--rock-rot, 0deg)); }
}

/* ===== 顶栏工具区 + 主题切换 ===== */
.nav-right-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.portal-app.n-layout--light #navbar {
  background: rgba(246, 241, 232, 0.88);
  border-bottom-color: rgba(154, 102, 64, 0.12);
}

.portal-app.n-layout--light #navbar.scrolled {
  background: rgba(246, 241, 232, 0.96);
  box-shadow: 0 4px 24px rgba(44, 36, 24, 0.08);
}

/* 门户皮肤切换（秦版 ↔ 朋友稿 / 高性能版） */
.nav-skin-switch {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 1;
  min-width: 0;
}

.nav-skin-switch-notes {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.28rem;
  max-width: min(38vw, 22rem);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(200, 168, 78, 0.28);
  background: rgba(200, 168, 78, 0.1);
  pointer-events: none;
  user-select: none;
}

.nav-skin-switch-hint {
  margin: 0;
  font-family: var(--font-body, 'Noto Sans SC', sans-serif);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.03em;
  color: #f0dfa0;
  white-space: nowrap;
}

.nav-skin-switch-detail {
  margin: 0;
  font-family: var(--font-body, 'Noto Sans SC', sans-serif);
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: rgba(240, 223, 160, 0.92);
  text-align: right;
}

.portal-app.n-layout--light .nav-skin-switch-notes {
  border-color: rgba(154, 102, 64, 0.28);
  background: rgba(154, 102, 64, 0.08);
}

.portal-app.n-layout--light .nav-skin-switch-hint {
  color: #8b4f2e;
}

.portal-app.n-layout--light .nav-skin-switch-detail {
  color: rgba(74, 52, 36, 0.88);
}

.nav-design-toggle {
  position: relative;
  z-index: 6;
  flex-shrink: 0;
  pointer-events: auto;
  cursor: pointer;
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
  border: 1px solid rgba(200, 168, 78, 0.45);
  border-radius: 4px;
  background: rgba(200, 168, 78, 0.08);
  color: var(--gold-light, #e8d48a);
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav-design-toggle:hover,
.nav-design-toggle[aria-pressed='true'] {
  background: rgba(200, 168, 78, 0.18);
  border-color: rgba(200, 168, 78, 0.75);
  color: #fff4cc;
}

.portal-app.n-layout--light .nav-design-toggle {
  border-color: rgba(154, 102, 64, 0.35);
  background: rgba(154, 102, 64, 0.06);
  color: var(--n-accent, #a65d45);
}

html.n-layout--light body::after {
  opacity: 0.012;
}

/* ===== 嵌入全屏：盖住门户顶栏，显示返回条 ===== */
body.portal-page--fullscreen {
  overflow: hidden;
}

body.portal-page--fullscreen #app-layout {
  visibility: hidden;
  pointer-events: none;
}

body.portal-page--fullscreen .scroll-progress,
body.portal-page--fullscreen .cursor-glow,
body.portal-page--fullscreen .back-to-top {
  display: none !important;
}

.portal-workspace {
  position: fixed;
  inset: 0;
  z-index: 100010;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.portal-workspace[hidden] {
  display: none !important;
}

.portal-workspace-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  min-height: 52px;
  border-bottom: 1px solid var(--white-04);
  background: var(--surface);
  flex-shrink: 0;
}

.portal-workspace-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.portal-workspace-label {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.portal-workspace-title strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-workspace-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.portal-bar-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 4px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.portal-bar-btn--ghost {
  background: transparent;
  color: var(--gold);
}

.portal-bar-btn--ghost:hover {
  background: rgba(200, 168, 78, 0.08);
}

.portal-frame-wrap {
  flex: 1;
  min-height: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.portal-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

.portal-frame-tip {
  margin: 0;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--white-04);
  border-top: 1px solid var(--white-06);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .portal-workspace-title strong {
    max-width: 140px;
  }
  .portal-bar-btn {
    padding: 0 10px;
    font-size: 12px;
  }
}

/* ── 维护遮罩（常驻公告 + 开发者 bypass） ── */
body.portal-maint-locked {
  overflow: hidden;
}

.portal-maint-overlay {
  position: fixed;
  inset: 0;
  z-index: 100020;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 16, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.portal-maint-overlay[hidden] {
  display: none !important;
}

.portal-maint-card {
  width: min(520px, 100%);
  padding: 32px 28px 28px;
  border-radius: 14px;
  border: 1px solid rgba(166, 93, 69, 0.35);
  background: linear-gradient(165deg, #faf7f1 0%, #f0e8da 100%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.portal-maint-badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #a65d45;
  background: rgba(166, 93, 69, 0.12);
}

.portal-maint-title {
  margin: 0 0 16px;
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
  font-weight: 700;
  color: #2c2a28;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.portal-maint-msg {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: #4a4540;
  text-align: left;
}

.portal-maint-dev {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}

.portal-maint-dev[hidden] {
  display: none !important;
}

/* 开发者终端（盲打 xhmh 唤起） */
.portal-maint-term {
  position: fixed;
  inset: 0;
  z-index: 100030;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.portal-maint-term[hidden] {
  display: none !important;
}

.portal-maint-term-window {
  width: min(640px, 100%);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(126, 231, 135, 0.22);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  background: #0d1117;
  font-family: 'IBM Plex Mono', 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}

.portal-maint-term-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.portal-maint-term-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.portal-maint-term-dot--r {
  background: #ff5f57;
}

.portal-maint-term-dot--y {
  background: #febc2e;
}

.portal-maint-term-dot--g {
  background: #28c840;
}

.portal-maint-term-bar-title {
  margin-left: 6px;
  font-size: 12px;
  color: #8b949e;
  letter-spacing: 0.02em;
}

.portal-maint-term-body {
  max-height: min(42vh, 280px);
  overflow-y: auto;
  padding: 16px 16px 8px;
  font-size: 13px;
  line-height: 1.55;
  color: #7ee787;
}

.portal-maint-term-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.portal-maint-term-line--dim {
  color: #6e7681;
}

.portal-maint-term-line--ok {
  color: #3fb950;
}

.portal-maint-term-line--err {
  color: #f85149;
}

.portal-maint-term-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 14px;
}

.portal-maint-term-prompt {
  color: #58a6ff;
  font-size: 14px;
  user-select: none;
}

.portal-maint-term-input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: #7ee787;
  font: inherit;
  font-size: 14px;
  outline: none;
  caret-color: #7ee787;
}

.portal-maint-term-foot {
  margin: 0;
  padding: 0 16px 12px;
  font-size: 11px;
  color: #484f58;
}

.portal-maint-dev-card {
  width: min(400px, 100%);
  padding: 24px;
  border-radius: 12px;
  background: #faf7f1;
  border: 1px solid rgba(61, 90, 108, 0.25);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.portal-maint-dev-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-family: 'Noto Serif SC', serif;
  color: #2c2a28;
}

.portal-maint-dev-hint {
  margin: 0 0 16px;
  font-size: 13px;
  color: #6b6560;
  line-height: 1.5;
}

.portal-maint-dev-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid rgba(61, 90, 108, 0.3);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: #2c2a28;
}

.portal-maint-dev-input:focus {
  outline: 2px solid rgba(61, 90, 108, 0.45);
  outline-offset: 1px;
}

.portal-maint-dev-error {
  min-height: 20px;
  margin: 8px 0 0;
  font-size: 13px;
  color: #a65d45;
}

.portal-maint-dev-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.portal-maint-dev-btn {
  min-height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  background: linear-gradient(135deg, #3d5a6c, #2f4858);
  color: #faf7f1;
}

.portal-maint-dev-btn--ghost {
  background: transparent;
  border: 1px solid rgba(61, 90, 108, 0.35);
  color: #3d5a6c;
}

.portal-maint-dev-revoke {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 0;
  border: none;
  background: none;
  font-size: 12px;
  color: #8a8480;
  cursor: pointer;
  text-decoration: underline;
}

.n-layout--dark .portal-maint-card {
  background: linear-gradient(165deg, #2a2622 0%, #1e1b18 100%);
  border-color: rgba(126, 184, 201, 0.25);
}

.n-layout--dark .portal-maint-title {
  color: #ebe4d8;
}

.n-layout--dark .portal-maint-msg {
  color: #c8c0b4;
}

.n-layout--dark .portal-maint-dev-card {
  background: #2a2622;
  border-color: rgba(126, 184, 201, 0.2);
}

.n-layout--dark .portal-maint-dev-title {
  color: #ebe4d8;
}

.n-layout--dark .portal-maint-dev-input {
  background: #1e1b18;
  border-color: rgba(126, 184, 201, 0.25);
  color: #ebe4d8;
}
