/* ============================================
   layout.css — 顶栏 / 侧边栏 / 主区 / 状态栏
   ============================================ */

.page {
  display: flex;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 20px) 16px 60px;
  align-items: flex-start;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--dark-2);
  border-bottom: 2px solid var(--pink);
  box-shadow: 0 3px 0 rgba(61, 90, 255, .6);
}

.topbar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
}
.topbar__logo:hover { text-decoration: none; color: var(--pink-light); }
.topbar__logo img { width: 28px; height: auto; }
.topbar__title {
  font-family: var(--font-en);
  font-size: 14px;
  background: linear-gradient(90deg, var(--cyan), var(--pink), var(--cyan));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbow-slide 4s linear infinite;
}

.topbar__marquee { flex: 1; min-width: 0; }

/* ---------- 顶栏搜索框 ---------- */
.topbar__search {
  position: relative;
  display: flex;
  align-items: center;
}
.topbar__search img {
  position: absolute;
  left: 7px;
  width: 12px;
  height: 12px;
  pointer-events: none;
}
.topbar__search input {
  width: 220px;
  height: 34px;
  line-height: 1;
  font-family: inherit;
  font-size: 12px;
  color: var(--cyan);
  background: var(--bg);
  border: 2px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  padding: 0 26px 0 24px;
}
/* 隐藏原生清除按钮（又小又无法着色），用自绘的 ✕ */
.topbar__search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.topbar__search input::placeholder { color: rgba(253, 246, 255, .4); }
.topbar__search input:focus {
  outline: 2px solid var(--pink);
  outline-offset: -2px;
}
.topbar__search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 0;
  line-height: 1;
  font-family: var(--font-en);
  font-size: 12px;
  color: var(--pink);
  background: transparent;
  border: 2px solid transparent;
  cursor: pointer;
  display: none;
}
.topbar__search input:not(:placeholder-shown) + .topbar__search-clear { display: block; }
.topbar__search-clear:hover {
  border-color: var(--pink);
  background: rgba(255, 110, 199, .18);
}

.topbar__clock {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  background: var(--bg);
  border: 2px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  font-family: var(--font-en);
  font-size: 10px;
  color: var(--cyan-text);
  white-space: nowrap;
}

/* ---------- 左侧导航栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav { display: flex; flex-direction: column; gap: 8px; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  transition: transform .1s steps(2);
}
.nav-btn img { width: 18px; height: 18px; }
.nav-btn:hover {
  background: var(--blue);
  text-decoration: none;
  color: var(--white);
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 var(--pink);
}
.nav-btn.is-active {
  background: var(--pink);
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  color: var(--white);
}
.nav-btn.is-active img { filter: brightness(0) invert(1); }

/* ---------- 右侧音乐栏 ---------- */
.rightbar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- 主内容区 ---------- */
.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- 底部状态栏 ---------- */
.statusbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  padding: 6px 16px;
  background: var(--dark);
  border-top: 2px solid var(--blue);
  font-size: 12px;
  color: var(--pink-light);
  text-align: center;
}

/* 备案号（ICP + 公安）：号码见 DEPLOYMENT.md §10，底栏改动不得删除 */
.statusbar__beian {
  color: inherit;
  text-decoration: none;
}
.statusbar__beian:hover { text-decoration: underline; }

/* 公安备案徽章：官方 20x20 PNG 原样贴入（assets/img/ghs.png） */
.statusbar__gaicon {
  width: 15px;
  height: 15px;
  vertical-align: -3px;
  margin-right: 3px;
}

/* ---------- 装饰星星 ---------- */
.deco-star {
  position: fixed;
  z-index: -1;
  width: 22px;
  height: auto;
  pointer-events: none;
  animation: twinkle 1.6s steps(2) infinite;
}
.deco-star--pink { filter: hue-rotate(120deg) saturate(3); }

/* ---------- 移动端布局 ----------
   由 main.js 判定竖屏（宽 ≤ 高）后给 body 加 .is-mobile 生效。
   不用 @media (orientation: portrait)：手机键盘弹起会压扁视口高度，
   瞬间宽 > 高会闪回桌面布局；JS 只在宽度变化时重判（键盘只改高度）。
   侧栏默认收起，由左上角菜单按钮展开为抽屉（瞬间显示无动画）；
   顶栏保留 菜单/logo/跑马灯，搜索框收进按钮点击展开，时钟隐藏；
   访客窗口与音乐盒不显示。player.js 读 body.is-mobile 保持一致 */
.topbar__menu, .topbar__search-btn, .drawer-mask { display: none; }

/* 顶栏压缩 */
body.is-mobile .topbar { gap: 10px; padding: 0 10px; }
body.is-mobile .topbar__logo img { width: 24px; }
body.is-mobile .topbar__clock { display: none; }
body.is-mobile .topbar__search { display: none; }

/* 顶栏按钮（菜单 / 搜索）：主题蓝凸起像素按钮 */
body.is-mobile .topbar__menu, body.is-mobile .topbar__search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  background: var(--blue);
  border: 2px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
  box-shadow: 1px 1px 0 var(--pink);
  cursor: pointer;
}
body.is-mobile .topbar__menu img, body.is-mobile .topbar__search-btn img { width: 18px; height: 18px; }
/* 按下：向右下平移压住投影位置，边框不动（反色会在蓝底上闪白边） */
body.is-mobile .topbar__menu:active, body.is-mobile .topbar__search-btn:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

/* 搜索框：点击按钮后固定在顶栏下方整行展开 */
body.is-mobile .topbar__search.is-open {
  display: flex;
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  left: 10px;
  right: 10px;
  z-index: 101;
}
body.is-mobile .topbar__search.is-open input { width: auto; flex: 1; }

/* 侧栏 → 抽屉覆盖，默认收起 */
body.is-mobile .page {
  flex-direction: column;
  align-items: stretch; /* 桌面是 flex-start（防竖拉伸），纵向布局需改回拉伸铺满宽度 */
  padding-top: calc(var(--topbar-h) + 12px);
}
body.is-mobile .sidebar {
  display: none;
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  width: min(78vw, 300px);
  z-index: 120;
  flex-direction: column;
  gap: 16px;
  padding: 16px 12px;
  overflow-y: auto;
  background: var(--dark-2);
  border-right: 2px solid var(--pink);
  box-shadow: 3px 0 0 rgba(61, 90, 255, .6);
}
body.is-mobile.nav-open .sidebar { display: flex; }
body.is-mobile .sidebar .win { width: 100%; }
/* 音乐盒：移动端不显示（访客窗口保留，排在抽屉菜单下方） */
body.is-mobile .rightbar { display: none; }

/* 抽屉遮罩 */
body.is-mobile .drawer-mask {
  display: none;
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0; bottom: 0;
  z-index: 110;
  background: rgba(13, 11, 46, .72);
}
body.is-mobile.nav-open .drawer-mask { display: block; }

/* 移动端底栏只留 © 2026 Love4C + 备案号，防止撑爆窄栏 */
body.is-mobile .statusbar__credit { display: none; }
/* 两个备案号在窄屏放不下：改为弹性换行居中，不撑爆底栏 */
body.is-mobile .statusbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 2px;
  column-gap: 8px;
}
