/* 全站顶栏唯一来源：首页、开通会员、CDKEY 兑换、个人中心、游戏详情页、信息页都引这份文件。
   顶栏只在这一处定义样式，不要再往任何页面里另写一套头部 CSS。 */
.header {
  position: sticky; top: 0; z-index: 100; background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
  padding: 0 clamp(16px, 2.5vw, 32px);
  /* 行高与字体必须锁死：详情页/信息页的 body 样式不同，继承后会让同一份顶栏量出不同高度。 */
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.header input, .header button { font-family: inherit; }
.header-row {
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr) auto;
  grid-template-areas: "brand nav search actions";
  align-items: center;
  gap: clamp(12px, 1.5vw, 22px);
  height: 72px;
}
.header-brand { grid-area: brand; display: flex; align-items: center; flex-shrink: 0; }
.header-brand a { display: flex; align-items: center; }
.header-brand img { height: 44px; width: auto; object-fit: contain; display: block; }
.header-nav { grid-area: nav; display: flex; align-items: center; gap: 4px; }
.hn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; line-height: 1.4; color: var(--text-secondary); text-decoration: none;
  border: 1px solid transparent; white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.hn:hover { color: var(--text); background: var(--surface-hover); }
.hn.gold { color: var(--gold); }
.hn.gold:hover { color: #fff; background: linear-gradient(135deg, #f7b733, #fc4a1a); }
.hn.pink { color: var(--pink); }
.hn.pink:hover { color: #fff; background: linear-gradient(135deg, #ff6b9d, #c44569); }
/* 当前页统一为紫底白字，避免金色/粉色项目在高亮时各说各话。 */
.hn.on { color: #fff; background: var(--accent); border-color: transparent; }
.header-search { grid-area: search; display: flex; justify-content: center; min-width: 0; }
.search-box { position: relative; width: 100%; max-width: 420px; }
.search-box input {
  width: 100%; height: 40px; padding: 0 34px 0 38px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: 13px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.14); }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--text-secondary); pointer-events: none; }
.search-clear {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border: none; border-radius: 50%; background: var(--surface-hover);
  color: var(--text-secondary); font-size: 15px; line-height: 1; cursor: pointer; display: none;
  align-items: center; justify-content: center; padding: 0;
}
.search-clear:hover { color: var(--text); background: var(--border); }
.header-actions { grid-area: actions; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.guest-login-btn {
  height: 40px; padding: 0 16px; background: var(--accent); color: #fff; border: none;
  border-radius: 12px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s;
}
.guest-login-btn:hover { background: var(--accent-hover); }
.user-menu { position: relative; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.user-menu-trigger:hover { border-color: var(--accent); background: var(--surface-hover); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 9px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.user-status-dot.inactive { background: var(--red); }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; min-width: 180px; padding: 6px;
  display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.user-dropdown.show { display: block; }
.user-dropdown-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 8px;
  font-size: 13px; color: var(--text); cursor: pointer; transition: background 0.15s;
  border: none; background: none; width: 100%; text-align: left; text-decoration: none;
}
.user-dropdown-item:hover { background: var(--surface-hover); }
.user-dropdown-item.danger { color: var(--red); }
.user-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

@media (max-width: 1050px) {
  .header-row { grid-template-columns: auto auto minmax(140px, 1fr) auto; gap: 10px; }
  .hn { padding: 7px 9px; font-size: 13px; }
  .user-name { max-width: 72px; }
}
@media (max-width: 900px) {
  .header-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand search actions" "nav nav nav";
    grid-template-rows: 60px 42px;
    height: auto;
    gap: 0 12px;
  }
  .header-brand img { height: 38px; }
  .header-nav { justify-content: center; gap: 6px; padding-bottom: 6px; }
  .search-box { max-width: 520px; }
}
@media (max-width: 640px) {
  .header { padding: 0 12px; }
  .header-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "search actions" "nav nav";
    grid-template-rows: 56px 42px;
    gap: 0 8px;
  }
  .header-brand { display: none; }
  .header-nav { justify-content: stretch; gap: 4px; }
  .hn { flex: 1 1 0; padding: 7px 4px; font-size: 12.5px; border-radius: 9px; }
  .search-box input { height: 38px; font-size: 12px; border-radius: 11px; }
  .guest-login-btn { height: 38px; padding: 0 12px; font-size: 12px; border-radius: 11px; }
  .header-actions { gap: 8px; }
  .user-menu-trigger { height: 38px; padding-right: 9px; }
  .user-name { display: none; }
}
@media (max-width: 380px) {
  .header { padding: 0 10px; }
  .header-nav { gap: 3px; }
  .hn { font-size: 12px; padding: 7px 2px; }
}
