/* ============================================================
 * style.css — 全息人体扫描站
 * 深色全息实验室方向：青蓝主色、扫描线、HUD 边框、克制辉光
 * 断点：<=640 手机 / <=1024 平板 / >1024 桌面
 * ============================================================ */

:root {
  --bg: #05080f;
  --panel: #0a1422;
  --panel-2: #0d1b2e;
  --line: #15324a;
  --cyan: #38e1ff;
  --mint: #46f0c0;
  --text: #d8ecf7;
  --muted: #6f93ab;
  --dim: #3a5a70;
  --danger: #ff8a6b;
  --radius: 10px;
  --font-display: Rajdhani, "Noto Sans SC", "PingFang SC", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Share Tech Mono", "Menlo", monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* 全站扫描线纹理 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(56, 225, 255, 0.025) 0,
    rgba(56, 225, 255, 0.025) 1px,
    transparent 1px,
    transparent 4px
  );
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

img { display: block; }

/* ---------------- 视图切换 ---------------- */

.view {
  position: absolute;
  inset: 0;
  display: none;
}
.view.is-active { display: flex; flex-direction: column; }

#view-gallery.is-active,
#view-search.is-active {
  display: block;
  overflow-y: auto;
}

/* ---------------- 独立检索页 ---------------- */

.search-box--page {
  width: 100%;
  margin-bottom: 8px;
}
.search-empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
  letter-spacing: 1px;
  font-size: 14px;
}

/* 卡片入场（检索结果逐条浮现） */
.masonry-card { animation: cardIn .45s ease both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* 跳转科技感扫描遮罩 */
.scan-flash {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(56, 225, 255, 0.16), transparent 62%),
    linear-gradient(180deg, rgba(56, 225, 255, 0.10), transparent 32%, transparent 68%, rgba(56, 225, 255, 0.10));
}
.scan-flash::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 0;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan), 0 0 40px rgba(56, 225, 255, 0.6);
  opacity: 0;
}
.scan-flash.is-active { animation: scanFlash .9s ease-out forwards; }
.scan-flash.is-active::before { animation: scanLine .9s ease-out forwards; }
@keyframes scanFlash {
  0%   { opacity: 0; transform: scaleX(0.2); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: scaleX(1); }
}
@keyframes scanLine {
  0%   { top: 0;    opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ---------------- 顶部导航 ---------------- */

.topbar {
  flex: 0 0 auto;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 26px;
  background: rgba(6, 12, 22, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
}
.brand-link:hover .brand-logo {
  filter: drop-shadow(0 0 10px rgba(56, 225, 255, 0.45));
}
.brand-logo {
  height: 40px;
  width: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-tabs {
  display: flex;
  gap: 10px;
}

/* 背景音乐 / 音效开关 */
.audio-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  transition: border-color .2s, color .2s, box-shadow .2s, background .2s;
}
.audio-toggle svg { width: 20px; height: 20px; }
.audio-toggle:hover { color: var(--text); border-color: var(--dim); }
.audio-toggle .ico-off { display: none; }
.audio-toggle.is-muted { color: var(--dim); }
.audio-toggle.is-muted .ico-on { display: none; }
.audio-toggle.is-muted .ico-off { display: block; }
.model-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 1px;
  transition: border-color .2s, color .2s, box-shadow .2s, background .2s;
}
.model-tab svg { width: 20px; height: 20px; }
.model-tab:hover { color: var(--text); border-color: var(--dim); }
.model-tab.is-active {
  color: #04101d;
  background: var(--cyan);
  border-color: var(--cyan);
  font-weight: 600;
  box-shadow: 0 0 18px rgba(56, 225, 255, 0.45);
}

/* ---------------- 主页 3D 区 ---------------- */

#canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}
#canvas-wrap canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: grab;
}

/* ---------- 九部位 DOM 标记层 ---------- */

.marker-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
.marker-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.marker-line {
  stroke: var(--cyan);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
  opacity: .8;
}
.marker-dot {
  position: absolute;
  top: 0; left: 0;
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  pointer-events: auto;
}
.dot-core {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #5fe6ff;
  box-shadow: 0 0 0 5px rgba(56, 225, 255, .18), 0 0 16px rgba(56, 225, 255, .9);
  animation: dotPulse 1.8s infinite, dotBlink 1.4s infinite;
}
@keyframes dotPulse { 50% { transform: scale(1.35); } }
@keyframes dotBlink { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.marker-pill {
  position: absolute;
  top: 0; left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px 0 8px;
  border: 1px solid rgba(56, 225, 255, .7);
  border-radius: 999px;
  background: rgba(7, 16, 28, .9);
  pointer-events: auto;
  white-space: nowrap;
  transition: background .2s, box-shadow .2s;
}
.marker-pill:hover {
  background: rgba(14, 40, 58, .95);
  box-shadow: 0 0 16px rgba(56, 225, 255, .4);
}
.pill-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--cyan);
  color: #04101d;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.pill-name { font-size: 13px; letter-spacing: 1px; }

.is-hidden { display: none !important; }

.hud-caption {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 8;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 18, 32, 0.78);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--muted);
  pointer-events: none;
}
.hud-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: blink 1.6s infinite;
}
@keyframes blink { 50% { opacity: .25; } }

.hud-readout {
  position: absolute;
  left: 22px;
  top: 18px;
  z-index: 8;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.9;
  color: var(--dim);
  letter-spacing: 1px;
  pointer-events: none;
}

.rotate-hint {
  position: absolute;
  left: 50%;
  bottom: 118px;
  z-index: 8;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--dim);
  pointer-events: none;
  white-space: nowrap;
}

/* ---------------- 底部搜索 ---------------- */

.search-panel {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(680px, 92vw);
  z-index: 30;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 10px 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 18, 32, 0.92);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.search-box:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 8px 30px rgba(0, 0, 0, 0.45);
}
.search-icon { color: var(--muted); flex: 0 0 auto; }
.search-box input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-body);
}
.search-box input::placeholder { color: var(--dim); }
.search-btn {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 20px;
  border-radius: 8px;
  background: var(--cyan);
  color: #04101d;
  font-weight: 600;
  letter-spacing: 1px;
}
.search-btn:hover { box-shadow: 0 0 14px rgba(56, 225, 255, 0.5); }

/* ---------------- 图库详情页 ---------------- */

.gallery-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 0 26px;
  background: rgba(6, 12, 22, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.back-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.gallery-crumb {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--dim);
}

/* 横向分类栏（标题下方，按文件夹生成） */
.category-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 16px;
  scrollbar-width: thin;
}
.category-bar::-webkit-scrollbar { height: 4px; }
.category-bar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.cat-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, box-shadow .2s;
}
.cat-chip:hover { color: var(--cyan); border-color: var(--cyan); }
.cat-chip.is-active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #04101d;
  font-weight: 600;
  box-shadow: 0 0 14px rgba(56, 225, 255, 0.4);
}

.gallery-body {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 26px;
}

/* 视频：16:9 随宽度伸缩 */
.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #030810;
  box-shadow: 0 0 26px rgba(56, 225, 255, 0.12);
}
.gallery-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(3, 9, 18, 0.55);
  color: var(--cyan);
  cursor: pointer;
}
.video-overlay.is-visible { display: flex; }
.video-play-icon { filter: drop-shadow(0 0 12px rgba(56, 225, 255, 0.8)); }
.video-play-text {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--muted);
}

.gallery-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 30px 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
#gallery-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
}
#gallery-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* 瀑布流：CSS 多列，随宽度变列数 */
.masonry {
  columns: 4 240px;
  column-gap: 16px;
}
.masonry-card {
  break-inside: avoid;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
  transition: transform .22s, border-color .22s, box-shadow .22s;
}
.masonry-card:hover {
  transform: translateY(-4px);
  border-color: var(--cyan);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 16px rgba(56, 225, 255, 0.18);
}
.masonry-img { width: 100%; height: auto; }
.masonry-cap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 12px;
}
.masonry-title { font-size: 13px; color: var(--text); }
.masonry-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 1px;
}

/* ---------------- 灯箱 ---------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 30px;
  background: rgba(2, 6, 12, 0.94);
  cursor: zoom-out;
}
.lightbox.is-open { display: flex; }
.lightbox img {
  max-width: 92vw;
  max-height: 82vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(56, 225, 255, 0.2);
}
#lightbox-title {
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--muted);
}

/* ---------------- 平板（<=1024） ---------------- */

@media (max-width: 1024px) {
  .masonry { columns: 3 220px; }
  .topbar { padding: 0 18px; }
  .gallery-body { padding: 20px; }
}

/* ---------------- 手机（<=640） ---------------- */

@media (max-width: 640px) {
  html, body { font-size: 14px; }

  .topbar {
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
  }
  .brand-logo { height: 30px; }
  .topbar-right { width: 100%; }
  .model-tabs { flex: 1 1 auto; gap: 8px; }
  .model-tab {
    flex: 1 1 0;
    justify-content: center;
    padding: 0 8px;
    min-height: 44px;
    font-size: 13px;
    gap: 6px;
  }
  .model-tab svg { width: 18px; height: 18px; }

  .hud-readout { display: none; }
  .hud-caption { top: 12px; font-size: 11px; padding: 6px 12px; }
  .rotate-hint { bottom: 100px; font-size: 11px; }

  .marker-pill { min-height: 36px; padding: 0 10px 0 6px; gap: 6px; }
  .pill-num { width: 22px; height: 22px; font-size: 13px; }
  .pill-name { font-size: 12px; }
  .marker-line { stroke-width: 1.2; }

  .search-panel { bottom: 14px; width: 94vw; }
  .search-box { height: 50px; padding-left: 14px; }
  .search-btn { padding: 0 14px; }

  .masonry { columns: 2 150px; column-gap: 10px; }
  .masonry-card { margin-bottom: 10px; }

  .gallery-header { padding: 0 14px; min-height: 58px; gap: 10px; flex-wrap: wrap; }
  .gallery-body { padding: 14px; }
  .header-actions { gap: 8px; }
  .back-btn { padding: 0 12px; min-height: 40px; font-size: 13px; }
  .gallery-crumb { font-size: 11px; }
  .cat-chip { min-height: 34px; padding: 0 14px; font-size: 12px; }
  #gallery-title { font-size: 21px; }
  .gallery-meta { margin-top: 20px; }

  .lightbox { padding: 14px; }
  .lightbox img { max-width: 96vw; max-height: 76vh; }
}

/* 超窄屏：瀑布流单列 */
@media (max-width: 360px) {
  .masonry { columns: 1; }
}

/* ---------------- 动效降级 ---------------- */

@media (prefers-reduced-motion: reduce) {
  .hud-dot { animation: none; }
  .masonry-card { transition: none; }
}
