/* 全站公共层：变量、头部、导航、页脚、登录弹层基础、通用表单控件 */

:root {
  --bg: #0f1221;
  --card: #191d34;
  --line: #2b335a;
  --text: #eef1ff;
  --muted: #a9b1d6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0f1221, #151a33);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.wrap {
  flex: 1 0 auto;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px;
  width: 100%;
}

/* —— 头部 —— */
.site-header {
  border-bottom: 1px solid rgba(43, 51, 90, 0.35);
  margin-bottom: 10px;
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 12px;
}

/* 整行标语：在 PC 上独占首行；在导航链接行之上 */
.site-tagline {
  flex: 1 1 100%;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 4px;
  padding: 11px 18px;
  text-align: center;
  font-size: clamp(15px, 2.6vw, 20px);
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1.5;
  color: #f5fbff;
  background: linear-gradient(135deg, rgba(102, 192, 244, 0.28), rgba(90, 200, 170, 0.18) 40%, rgba(166, 140, 255, 0.22));
  border: 1px solid rgba(122, 210, 255, 0.45);
  border-radius: 12px;
  box-shadow:
    0 0 26px rgba(102, 192, 244, 0.35),
    0 0 48px rgba(122, 245, 200, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  text-shadow:
    0 0 14px rgba(102, 192, 244, 0.65),
    0 0 32px rgba(122, 245, 200, 0.35),
    0 1px 0 rgba(0, 0, 0, 0.35);
}

.site-header .brand {
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}

.site-header-mid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

.nav-links {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.nav-links a:hover {
  border-color: rgba(43, 51, 90, 0.8);
  background: rgba(17, 19, 36, 0.6);
}

.nav-links a.active {
  border-color: rgba(43, 51, 90, 1);
  background: rgba(25, 29, 52, 1);
}

.site-header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  flex: 0 1 auto;
  min-width: 0;
}

.site-search-inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.site-search-inline input {
  width: min(200px, 42vw);
  min-width: 120px;
}

.site-auth {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.site-auth .auth-user {
  font-size: 12px;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-auth .auth-name-brief {
  font-size: 13px;
  color: #bcd0ff;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-auth a.auth-name-brief {
  text-decoration: none;
  color: #bcd0ff;
}

.site-auth .auth-my-link {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(43, 51, 90, 0.85);
  background: rgba(31, 39, 80, 0.55);
}

.site-auth .auth-my-link:hover {
  filter: brightness(1.08);
}

input,
select,
button {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #131833;
  color: var(--text);
  padding: 0 10px;
  font-size: 14px;
}

button {
  cursor: pointer;
  background: #1f2750;
}

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 1.25rem 14px 1.75rem;
  text-align: center;
  border-top: 1px solid rgba(43, 51, 90, 0.55);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.2));
}

.site-footer a {
  display: inline-block;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-decoration: none;
  line-height: 1.5;
}

.site-footer a:hover {
  text-decoration: underline;
  color: #fff;
}

/* 登录弹层 */
.modal-mask {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 20;
  padding: 16px;
}

.modal {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #161d3d;
  padding: 14px;
}

.modal-title {
  margin: 0 0 10px;
  font-size: 16px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.tabs button.active {
  background: #32418c;
}

.form-row {
  margin-bottom: 8px;
}

.form-row input {
  width: 100%;
}

.form-tip {
  margin: 4px 0 10px;
  font-size: 12px;
  color: #9db4ff;
}

.form-err {
  min-height: 18px;
  font-size: 12px;
  color: #ff9a9a;
  margin-bottom: 6px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 登录 / 注册弹层（site-auth.js）：布局骨架；配色见 store-platform.css body.steam-store */
.auth-modal-mask {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.auth-modal-card {
  max-width: 440px;
  width: 100%;
  box-sizing: border-box;
  padding: 18px 16px 16px;
  border-radius: 12px;
  border: 1px solid var(--line, #2a334d);
  background: #161d3d;
  color: #dbe4ef;
}

body:not(.steam-store) .auth-tabs button {
  border-radius: 8px;
  border: 1px solid #32418c;
  background: #1a2244;
  color: #dbe4ef;
}

body:not(.steam-store) .auth-tabs button.active {
  background: #32418c;
  color: #fff;
}

body:not(.steam-store) .auth-field input {
  border-radius: 8px;
  border: 1px solid #32418c;
  background: rgba(0, 0, 0, 0.25);
  color: #f2f5ff;
}

body:not(.steam-store) .auth-form-err {
  color: #ff9a9a;
}

.auth-modal-head {
  margin-bottom: 12px;
}

.auth-modal-title {
  margin: 0 0 6px;
}

.auth-modal-subtitle {
  margin: 0;
  line-height: 1.45;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-tabs button {
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

.auth-form-tip {
  line-height: 1.5;
  margin-bottom: 12px;
}

.auth-field {
  margin-bottom: 12px;
}

.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 14px;
}

.auth-form-err {
  min-height: 20px;
  margin-bottom: 8px;
  font-size: 12px;
}

.auth-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.auth-btn {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 760px) {
  .site-header-inner {
    padding-top: 6px;
  }

  .nav-links {
    gap: 6px;
  }

  .site-header-mid {
    justify-content: flex-start;
    width: 100%;
    order: 3;
  }

  .site-header-right {
    width: 100%;
    justify-content: flex-start;
  }

  /* layout-mobile 页面：不要用窄屏规则把搜索区拉成整行，与首页同款顶栏 */
  body.layout-mobile .site-header-inner .site-header-right {
    width: auto !important;
    max-width: none;
    justify-content: flex-end !important;
  }

  body.layout-mobile .site-header-inner .site-header-mid {
    order: 4;
  }
}

/* 手机站 body.layout-mobile：首行 = 站点名 + 搜索 + 账号，导航单独一行；仅键盘确认搜索 */
body.layout-mobile .site-header-inner {
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0 10px;
}

body.layout-mobile .site-header-inner .brand {
  order: 1;
  flex: 0 1 auto;
  max-width: 38%;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.layout-mobile .site-header-inner .site-header-right {
  order: 2;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

body.layout-mobile .site-tagline {
  order: 3;
  margin: 8px 0 6px;
  padding: 9px 12px;
  letter-spacing: 0.12em;
  font-size: clamp(14px, 3.6vw, 17px);
}

body.layout-mobile .site-header-inner .site-header-mid {
  order: 4;
  width: 100%;
  flex: 1 1 100%;
  margin: 0;
}

body.layout-mobile .site-search-inline {
  flex: 1 1 auto;
  min-width: 0;
  gap: 0;
  margin-right: 6px;
}

/* 首页 / 游戏库 / 排行榜 / 个人中心 / 详情：顶栏短搜索，与昵称同排 */
body.layout-mobile[data-fj2me-page="home"] .site-header-inner .site-search-inline,
body.layout-mobile[data-fj2me-page="games"] .site-header-inner .site-search-inline,
body.layout-mobile[data-fj2me-page="ranking"] .site-header-inner .site-search-inline,
body.layout-mobile[data-fj2me-page="posts"] .site-header-inner .site-search-inline,
body.layout-mobile[data-fj2me-page="my"] .site-header-inner .site-search-inline,
body.layout-mobile[data-fj2me-page="game"] .site-header-inner .site-search-inline,
body.layout-mobile[data-fj2me-page="post"] .site-header-inner .site-search-inline {
  flex: 0 1 auto;
  max-width: min(118px, 36vw);
}

body.layout-mobile .site-search-inline input {
  width: 100%;
  min-width: 0;
  height: 36px;
  font-size: 14px;
}

body.layout-mobile .site-search-inline #searchBtn,
body.layout-mobile .site-search-inline button#searchBtn {
  display: none !important;
}

body.layout-mobile .site-auth {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 6px;
}

body.layout-mobile .site-auth .auth-user {
  display: none !important;
}

body.layout-mobile .site-auth .auth-my-link {
  display: none !important;
}

body.layout-mobile .site-auth #logoutBtn {
  display: none !important;
}

body.layout-mobile .site-auth a.auth-name-brief {
  max-width: 8.2rem;
  min-width: 2.75rem;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(102, 192, 244, 0.42);
  background: linear-gradient(180deg, rgba(42, 62, 98, 0.95), rgba(31, 39, 80, 0.88));
  color: #fff !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(102, 192, 244, 0.2);
}

body.layout-mobile .site-auth #authOpenBtn {
  height: 36px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

/* 从 play 返回后的留存弹层（post-play-retention.js）：与 .modal / 站点深色卡片一致，全视口 fixed */
.fj2me-retention-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 16px;
  box-sizing: border-box;
  isolation: isolate;
}

.fj2me-retention-box {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 18px 18px 16px;
  border-radius: 12px;
  border: 1px solid var(--line, #2b335a);
  background: #161d3d;
  color: var(--text, #eef1ff);
  text-align: left;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(102, 192, 244, 0.08);
}

.fj2me-retention-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(102, 192, 244, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.75);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fj2me-retention-close:hover {
  background: rgba(102, 192, 244, 0.12);
  color: #fff;
}

.fj2me-retention-title {
  margin: 0 36px 10px 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  line-height: 1.35;
}

.fj2me-retention-body {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted, #a9b1d6);
}

.fj2me-retention-login-desc {
  text-align: left;
}

.fj2me-retention-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 2px;
}

.fj2me-retention-box .fj2me-retention-primary,
.fj2me-retention-box .fj2me-retention-secondary {
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.fj2me-retention-primary {
  border: 1px solid rgba(102, 192, 244, 0.45);
  background: linear-gradient(180deg, rgba(102, 192, 244, 0.35) 0%, rgba(74, 143, 199, 0.55) 100%);
  color: #fff !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.fj2me-retention-primary:hover {
  filter: brightness(1.06);
}

.fj2me-retention-primary--wide {
  width: 100%;
  margin-top: 2px;
  text-align: center;
}

.fj2me-retention-secondary {
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid rgba(102, 192, 244, 0.22);
}

.fj2me-retention-secondary:hover {
  background: rgba(102, 192, 244, 0.1);
}

.fj2me-retention-snooze {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted, #a9b1d6);
  cursor: pointer;
  user-select: none;
  text-align: left;
}

.fj2me-retention-snooze-input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #66c0f4;
}

.fj2me-retention-joined {
  margin-top: 4px;
}

@media (max-width: 520px) {
  .fj2me-retention-box {
    max-width: none;
    padding: 16px 14px 14px;
  }

  .fj2me-retention-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .fj2me-retention-actions .fj2me-retention-primary,
  .fj2me-retention-actions .fj2me-retention-secondary {
    width: 100%;
    justify-content: center;
  }
}
