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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #07131c;
  color: #e7f7f7;
}

.stage {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 顶部栏 ===== */
.topbar {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(7, 19, 28, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
}

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

.logo {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #0e7490, #2dd4bf);
  border-radius: 50% 50% 48% 52% / 42% 42% 58% 58%;
}

.brand .title {
  font-size: 16px;
  letter-spacing: 1px;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy small {
  color: #82aab5;
  font-family: "DIN Alternate", "SFMono-Regular", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions .user {
  font-size: 13px;
  color: #9fb0c7;
  margin-right: 2px;
}

.iconbar-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #c8d4e3;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.iconbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
}

.ghost-btn {
  padding: 6px 14px;
  font-size: 13px;
  color: #c8d4e3;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
}

.role-tag {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 12px;
  color: #fff;
}

.role-tag.admin {
  background: rgba(31, 111, 235, 0.75);
}

.role-tag.guest {
  background: rgba(20, 184, 166, 0.6);
}

/* ===== 展示区 ===== */
.viewer {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.product-overview {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(34px, 7vh, 86px) clamp(22px, 6vw, 96px) 54px;
  background: radial-gradient(circle at 78% 18%, rgba(45, 212, 191, .12), transparent 32%), #0a1721;
}
.product-overview[hidden] { display: none; }
.overview-intro { max-width: 850px; margin: 0 auto 30px; }
.overview-kicker { color: #5f9fab; font: 10px "DIN Alternate", "SFMono-Regular", monospace; letter-spacing: .16em; }
.overview-intro h1 { margin: 12px 0 8px; font-size: clamp(30px, 5vw, 62px); font-weight: 600; letter-spacing: .02em; }
.overview-tagline { color: #d4f5ee; font-size: clamp(17px, 2.2vw, 24px); }
.overview-summary { max-width: 680px; margin-top: 12px; color: #82aab5; line-height: 1.8; font-size: 14px; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 1400px; margin: 0 auto; }
.overview-card { min-width: 0; padding: 8px 8px 14px; color: #dbe7f5; text-align: left; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; cursor: pointer; transition: transform .18s, border-color .18s, background .18s; }
.overview-card:hover { transform: translateY(-3px); border-color: rgba(45,212,191,.7); background: rgba(255,255,255,.08); }
.overview-card img, .overview-card video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #0d1526; border-radius: 5px; }
.overview-card-copy { display: grid; gap: 5px; padding: 12px 5px 0; }
.overview-card-copy strong { font-size: 16px; }
.overview-card-copy span { color: #9fb0c7; font-size: 12px; line-height: 1.55; }
.overview-card-copy small { color: #5f9fab; font-size: 11px; }

.stage.menu-visible .viewer,
.stage.menu-visible .bottombar,
.stage.menu-visible .album-view {
  margin-left: 300px;
}

.stage.menu-visible .tree-panel {
  transform: translateX(0);
}

.stage.menu-visible .tree-mask {
  pointer-events: none;
  opacity: 0;
}

.viewer::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 120%, rgba(45, 212, 191, 0.12), transparent 52%),
    linear-gradient(180deg, rgba(56, 189, 248, 0.025), transparent 35%);
  pointer-events: none;
}

.level-ruler {
  position: absolute;
  z-index: 2;
  right: 12px;
  top: 10%;
  bottom: 10%;
  width: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: rgba(130, 170, 181, 0.55);
  font: 9px/1 "DIN Alternate", "SFMono-Regular", monospace;
  text-align: right;
  border-right: 1px solid rgba(45, 212, 191, 0.28);
}

.level-ruler span::after {
  content: "";
  display: inline-block;
  width: 7px;
  margin-left: 4px;
  border-top: 1px solid rgba(45, 212, 191, 0.38);
  vertical-align: middle;
}

.viewer-state {
  position: relative;
  z-index: 3;
  max-width: 420px;
  padding: 32px;
  text-align: center;
}

.viewer-state[hidden] {
  display: none;
}

.viewer-state .state-mark {
  display: block;
  color: #2dd4bf;
  font: 300 64px/0.7 Georgia, serif;
}

.viewer-state h1 {
  margin-top: 20px;
  font-size: 20px;
  font-weight: 600;
}

.viewer-state p {
  margin: 8px 0 20px;
  color: #82aab5;
  font-size: 13px;
}

.media-copy { position: absolute; left: 24px; right: 70px; bottom: 24px; z-index: 3; display: grid; gap: 4px; max-width: 500px; padding: 12px 15px; background: rgba(7, 19, 28, .82); border-left: 2px solid #2dd4bf; border-radius: 4px; backdrop-filter: blur(8px); }
.media-copy strong { color: #fff; font-size: 15px; }
.media-copy span { color: #a7c3ca; font-size: 12px; line-height: 1.5; }

.slide-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.4s ease, transform 0.4s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.slide-img.show {
  opacity: 1;
  transform: scale(1);
}

.slide-video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.4s ease, transform 0.4s ease;
  background: #02080d;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.slide-video.show {
  opacity: 1;
  transform: scale(1);
}

.crumb {
  position: absolute;
  top: 16px;
  left: 24px;
  padding: 6px 14px;
  font-size: 14px;
  color: #dbe7f5;
  background: rgba(31, 111, 235, 0.85);
  border-radius: 20px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.crumb.show {
  opacity: 1;
  transform: translateY(0);
}

.progress-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
}

.progress-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #2dd4bf);
  transition: width 0.35s ease;
}

/* ===== 底部栏 ===== */
.bottombar {
  height: 96px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: rgba(7, 19, 28, 0.94);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 3px;
}

.thumb.active {
  border-color: rgba(45, 212, 191, 0.8);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.25);
}

.tree-group-head,
.tree-item {
  width: 100%;
  border: 0;
  color: inherit;
  text-align: left;
}

.tree-group-body[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.nav-btn {
  width: 44px;
  height: 44px;
  flex: none;
  font-size: 26px;
  line-height: 1;
  color: #dbe7f5;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.thumbs {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  min-width: 0;
  padding: 4px 0;
}

.thumbs::-webkit-scrollbar {
  height: 4px;
}

.thumbs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.thumb-none {
  font-size: 13px;
  color: #7f90a8;
}

.thumb {
  flex: none;
  width: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.thumb:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
}

.thumb.active {
  border-color: #1f6feb;
  background: rgba(31, 111, 235, 0.18);
}

.thumb img {
  width: 100%;
  height: 46px;
  object-fit: cover;
  border-radius: 4px;
  background: #0d1526;
}

.thumb span {
  font-size: 12px;
  color: #c8d4e3;
  white-space: nowrap;
}

.page-info {
  flex: none;
  min-width: 210px;
  text-align: right;
  font-size: 13px;
  color: #9fb0c7;
  font-variant-numeric: tabular-nums;
}

/* ===== 菜单树面板 ===== */
.tree-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.tree-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.tree-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: #121a2c;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.4);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

.tree-panel.open {
  transform: translateX(0);
}

.tree-head {
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 15px;
  color: #dbe7f5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.tree-overview { padding: 4px 7px; color: #9adbd5; background: transparent; border: 1px solid rgba(45,212,191,.35); border-radius: 5px; cursor: pointer; font-size: 11px; }
.tree-overview:hover { color: #fff; background: rgba(45,212,191,.14); }

.tree-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.tree-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: #c8d4e3;
  transition: background 0.15s;
}

.tree-group-head:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tree-group-head.active {
  background: rgba(31, 111, 235, 0.22);
  color: #fff;
}

.tree-arrow {
  flex: none;
  width: 16px;
  font-size: 12px;
  color: #7f90a8;
}

.tree-group-name {
  flex: 1;
  font-size: 14px;
}

.tree-count {
  flex: none;
  font-size: 11px;
  color: #7f90a8;
}

.tree-group-body {
  padding-left: 26px;
}

.tree-item {
  padding: 8px 12px;
  margin: 2px 0;
  font-size: 13px;
  color: #b6c3d8;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.15s;
}

.tree-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tree-item.active {
  color: #fff;
  background: rgba(31, 111, 235, 0.18);
  border-left-color: #1f6feb;
}

.tree-item.empty {
  color: #7f90a8;
  cursor: default;
}

/* ===== 图片库画廊 ===== */
.gallery {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 14, 0.97);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery[hidden] {
  display: none;
}

.gallery.show {
  opacity: 1;
}

.gallery img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.gallery video {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.gallery-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(rgba(0, 0, 0, 0.5), transparent);
  font-size: 14px;
  color: #dbe7f5;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  font-size: 30px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.gallery-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.gallery-prev {
  left: 24px;
}

.gallery-next {
  right: 24px;
}

/* ===== 公共端模块相册 ===== */
.viewer[hidden],
.bottombar[hidden],
.album-view[hidden] {
  display: none;
}

.album-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px clamp(18px, 4vw, 54px) 42px;
  background: #0a1721;
}

.album-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto 18px;
}

.album-back {
  flex: none;
  margin-top: 2px;
}

.album-heading {
  flex: 1;
  order: -1;
}

.album-kicker {
  color: #5f9fab;
  font: 10px "DIN Alternate", "SFMono-Regular", monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.album-heading h1 {
  margin: 7px 0 3px;
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 600;
  letter-spacing: .02em;
}

.album-heading p {
  margin: 0;
  color: #82aab5;
  font-size: 12px;
}

.album-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.album-search { flex: 1; max-width: 320px; }
.album-search input,
.album-size select {
  width: 100%;
  padding: 8px 10px;
  color: #dbe7f5;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 6px;
  font: 12px inherit;
}

.album-size { display: flex; align-items: center; gap: 6px; color: #9fb0c7; font-size: 12px; white-space: nowrap; }
.album-size select { width: auto; }
.album-hint { margin-left: auto; color: #6f8b96; font-size: 11px; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  max-width: 1400px;
  margin: 18px auto 0;
}

.album-card {
  min-width: 0;
  padding: 7px 7px 9px;
  color: #c8d4e3;
  text-align: left;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  cursor: pointer;
  transition: transform .18s, border-color .18s, background .18s;
}

.album-card:hover { transform: translateY(-2px); border-color: rgba(45,212,191,.65); background: rgba(255,255,255,.08); }
.album-card img, .album-card video { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #0d1526; border-radius: 4px; }
.album-card span { display: block; overflow: hidden; margin: 8px 3px 0; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.album-card small { display: block; margin: 5px 3px 0; color: #6f8b96; font-size: 10px; }

.album-pager { display: flex; justify-content: center; align-items: center; gap: 6px; max-width: 1400px; margin: 26px auto 0; }
.album-pager button { min-width: 32px; height: 32px; padding: 0 8px; color: #c8d4e3; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.14); border-radius: 6px; cursor: pointer; }
.album-pager button:hover:not(:disabled), .album-pager button.active { color: #fff; background: #0e7490; border-color: #2dd4bf; }
.album-pager button:disabled { cursor: default; opacity: .35; }
.album-pager .dots { color: #6f8b96; padding: 0 2px; }

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 56px;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .brand {
    padding-top: 4px;
  }

  .top-actions {
    flex: 1 1 220px;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  .top-actions .user {
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ghost-btn {
    padding: 6px 10px;
  }

  .bottombar {
    height: 86px;
    gap: 8px;
    padding: 0 10px;
  }

  .page-info {
    min-width: 92px;
    font-size: 11px;
  }

  .thumb {
    width: 104px;
  }

  .album-view { padding: 20px 12px 32px; }
  .album-head { display: block; }
  .album-back { margin-bottom: 18px; }
  .album-heading { order: initial; }
  .album-toolbar { flex-wrap: wrap; }
  .album-search { max-width: none; flex-basis: 100%; }
  .album-hint { display: none; }
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .overview-grid { grid-template-columns: 1fr; gap: 10px; }
  .product-overview { padding: 26px 14px 34px; }
  .media-copy { left: 12px; right: 12px; bottom: 12px; }
  .tree-panel { width: min(300px, 84vw); transform: translateX(-100%); }
  .tree-mask { z-index: 35; }
  .stage.menu-visible .viewer,
  .stage.menu-visible .bottombar,
  .stage.menu-visible .album-view,
  .stage.menu-visible .product-overview { margin-left: 0; }
}
