/* ============ 搬运大挑战 全局样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #12141c;
  --bg2: #1a1d2b;
  --card: rgba(255,255,255,.06);
  --border: rgba(255,255,255,.12);
  --text: #e8eaf6;
  --dim: #9aa3b5;
  --orange: #ff9800;
  --purple: #a55eea;
  --green: #2ecc71;
  --red: #ff5252;
  --cyan: #4fc3f7;
}
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(165,94,234,.25), transparent 60%),
    radial-gradient(1000px 500px at 10% 110%, rgba(255,152,0,.18), transparent 60%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
.hidden { display: none !important; }
.glass {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input {
  font-family: inherit;
  background: rgba(0,0,0,.3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  transition: border .2s;
}
input:focus { border-color: var(--orange); }
input::placeholder { color: var(--dim); }

.btn-main {
  background: linear-gradient(135deg, #ff9800, #ff6f68);
  color: #fff;
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(255,111,104,.35);
  transition: transform .15s, box-shadow .2s;
}
.btn-main:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,111,104,.5); }
.btn-main.big { padding: 15px 30px; font-size: 17px; width: 100%; }
.btn-sub {
  background: rgba(79,195,247,.15);
  border: 1px solid rgba(79,195,247,.4);
  color: var(--cyan);
  border-radius: 12px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  transition: background .2s;
}
.btn-sub:hover { background: rgba(79,195,247,.3); }
.btn-sub.sm { padding: 11px 16px; }
.btn-mini {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13px;
}
.btn-mini:hover { background: rgba(255,255,255,.16); }

/* ============ 登录 ============ */
#view-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-bg { width: 100%; display: flex; justify-content: center; padding: 20px; }
.login-box { width: 400px; max-width: 92vw; padding: 34px 30px; text-align: center; }
.logo-lg { font-size: 34px; font-weight: 900; background: linear-gradient(90deg,#ff9800,#ff6f68,#a55eea); -webkit-background-clip: text; background-clip: text; color: transparent; }
.slogan { color: var(--dim); font-size: 13px; margin: 10px 0 22px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab-btn {
  flex: 1; background: transparent; border: 1px solid var(--border);
  color: var(--dim); padding: 10px; border-radius: 10px; font-size: 14px;
}
.tab-btn.active { background: rgba(255,152,0,.15); border-color: var(--orange); color: var(--orange); font-weight: 700; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form-tip { color: var(--dim); font-size: 12px; margin-top: 8px; line-height: 1.6; }

/* ============ 顶栏 ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; margin: 10px 14px; border-radius: 14px;
}
.brand { font-size: 18px; font-weight: 800; background: linear-gradient(90deg,#ff9800,#ff6f68); -webkit-background-clip: text; background-clip: text; color: transparent; }
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background-size: cover; background-position: center; border: 2px solid var(--orange); font-size: 18px; line-height: 30px; text-align: center; overflow: hidden; }
.u-name { font-weight: 700; font-size: 14px; }
.u-stat { display: flex; gap: 10px; font-size: 13px; color: var(--dim); }
.u-stat b { color: var(--text); }

/* ============ 大厅 ============ */
.lobby-body { display: grid; grid-template-columns: 320px 1fr; gap: 14px; padding: 6px 14px 80px; }
@media (max-width: 860px) { .lobby-body { grid-template-columns: 1fr; } }
.panel { padding: 18px; }
.panel h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.or-line { text-align: center; color: var(--dim); font-size: 12px; margin: 12px 0; }
.join-row { display: flex; gap: 8px; margin-top: 12px; }
.join-row input { flex: 1; text-transform: uppercase; }
.join-row input[type=email] { text-transform: none; }
.join-row.wide { width: 100%; max-width: 460px; }
.rank-list { list-style: none; }
.rank-list li { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px dashed rgba(255,255,255,.08); font-size: 13px; }
.rank-list li:last-child { border-bottom: none; }
.rank-no { width: 22px; height: 22px; border-radius: 6px; background: rgba(255,255,255,.08); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.rank-no.top1 { background: linear-gradient(135deg,#ffd54f,#ff9800); color: #333; font-weight: 800; }
.rank-no.top2 { background: #cfd8dc; color: #37474f; font-weight: 700; }
.rank-no.top3 { background: #ffab91; color: #4e342e; font-weight: 700; }
.rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { color: var(--orange); font-weight: 700; }

.banner { text-align: center; padding: 26px 18px; margin-bottom: 14px; position: relative; overflow: hidden; }
.banner .act-badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.15); margin-bottom: 8px; }
.banner h2 { font-size: 24px; margin-bottom: 6px; }
.banner p { color: var(--dim); font-size: 13px; }
.notice p { color: var(--dim); font-size: 13px; line-height: 1.9; padding: 3px 0; }
.notice b { color: var(--text); }

/* ============ 底部导航 ============ */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px;
  display: flex; gap: 6px; padding: 8px; z-index: 50; white-space: nowrap;
}
.nav-btn {
  background: transparent; border: none; color: var(--dim);
  padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: all .2s;
}
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,.08); }
.nav-btn.active { background: linear-gradient(135deg,#ff9800,#ff6f68); color: #fff; box-shadow: 0 4px 14px rgba(255,111,104,.4); }

/* ============ 页面通用 ============ */
.page-body { max-width: 980px; margin: 0 auto; padding: 6px 14px 60px; display: flex; flex-direction: column; gap: 14px; }
.center-col { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tip-line { color: var(--dim); font-size: 13px; }
.tip-line.ok { color: var(--green); }
.tip-line.err { color: var(--red); }

/* ============ 活动页 ============ */
.act-card { padding: 20px; }
.act-card .act-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.act-card .act-title { font-size: 19px; font-weight: 800; }
.act-card .act-sub { color: var(--dim); font-size: 13px; margin-bottom: 12px; }
.act-card .act-body { font-size: 14px; line-height: 1.9; color: var(--text); }
.act-rules { background: rgba(0,0,0,.25); border-radius: 10px; padding: 12px 16px; margin: 12px 0; font-size: 13px; color: var(--dim); white-space: pre-line; line-height: 1.8; }
.act-reward { color: var(--green); font-weight: 700; font-size: 13px; }

/* ============ 兑换码页 ============ */
.codes-ref { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.codes-ref span { background: rgba(255,255,255,.07); border: 1px dashed var(--border); border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--cyan); }

/* ============ 皮肤页 ============ */
.skins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.skin-card { padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; position: relative; }
.skin-card.equipped { border-color: var(--orange); box-shadow: 0 0 18px rgba(255,152,0,.35); }
.skin-img { width: 150px; height: 210px; border-radius: 12px; background-size: cover; background-position: center top; border: 1px solid var(--border); position: relative; }
.skin-race { position: absolute; top: 6px; left: 6px; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.race-common { background: #cfd8dc; color: #263238; }
.race-rare { background: linear-gradient(135deg,#4fc3f7,#3f8efc); color: #fff; }
.race-epic { background: linear-gradient(135deg,#a55eea,#7c4dff); color: #fff; }
.race-legend { background: linear-gradient(135deg,#ffd54f,#ff9800); color: #4e342e; }
.skin-name { font-weight: 800; font-size: 15px; }
.skin-desc { color: var(--dim); font-size: 12px; line-height: 1.6; min-height: 34px; }
.skin-buff { color: var(--green); font-size: 12px; font-weight: 600; }
.skin-buff b { color: var(--text); }

/* ============ 房间等待 ============ */
.room-body { max-width: 560px; margin: 0 auto; padding: 20px 14px 60px; }
.room-card { padding: 28px; }
.room-code { font-size: 42px; font-weight: 900; letter-spacing: 8px; color: var(--orange); background: rgba(0,0,0,.3); padding: 10px 24px; border-radius: 12px; border: 1px dashed var(--border); }
.room-players { display: flex; flex-direction: column; gap: 8px; width: 100%; margin: 14px 0; }
.room-player { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06); padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.room-player .p-avatar { width: 30px; height: 30px; border-radius: 50%; background-size: cover; }
.room-player .is-host { color: var(--orange); font-size: 12px; }
.room-player .waiting { color: var(--dim); font-size: 12px; margin-left: auto; }

/* ============ 游戏 ============ */
.game-wrap { position: fixed; inset: 0; background: #0d1117; overflow: hidden; }
#game-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.hud { position: absolute; z-index: 20; pointer-events: none; }
.hud-top { top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.hud-timer { background: rgba(0,0,0,.55); padding: 8px 16px; border-radius: 10px; font-size: 20px; font-weight: 800; color: #fff; }
.hud-timer.warn { color: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .5; } }
.hud-scores { display: flex; flex-direction: column; gap: 4px; }
.hud-score { background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: 8px; font-size: 12px; color: #fff; display: flex; align-items: center; gap: 6px; }
.hud-score.me { border: 1px solid var(--orange); font-weight: 800; }
.hud-bottom { bottom: 10px; left: 10px; right: 10px; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.hud-car, .hud-hp { background: rgba(0,0,0,.55); padding: 8px 14px; border-radius: 10px; font-size: 15px; color: #fff; }
.hud-car b { color: var(--orange); }
.hud-msg {
  background: rgba(0,0,0,.55); padding: 7px 14px; border-radius: 10px;
  font-size: 12px; color: #ffe0b2; max-width: 420px; min-height: 22px;
}
.game-end { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.end-box { padding: 26px 34px; min-width: 320px; text-align: center; }
.end-box h2 { margin-bottom: 14px; }
.game-tip { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 30; background: rgba(0,0,0,.5); color: #fff; padding: 8px 18px; border-radius: 10px; font-size: 13px; pointer-events: none; }

/* ============ 新手关卡 ============ */
#tut-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
#tut-title { color: var(--orange); font-weight: 800; }
.tut-skip { position: absolute; top: 60px; right: 14px; z-index: 30; pointer-events: auto; }

/* ============ 邮箱绑定弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.66); display: flex; align-items: center; justify-content: center; }
.modal-box { width: min(92vw, 380px); padding: 24px 22px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.modal-box h3 { margin: 0; color: var(--orange); }
.modal-box .dim { color: var(--dim); font-size: 12px; margin: 0; }
.modal-box input { width: 100%; box-sizing: border-box; }
.modal-box .join-row { display: flex; gap: 8px; }
.modal-box .join-row input { flex: 1; }
.modal-box .join-row .btn-sub { flex: 0 0 auto; white-space: nowrap; }

/* ============ 玩家主页 ============ */
.pf-card { padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.pf-avatar {
  width: 92px; height: 92px; border-radius: 50%;
  background-size: cover; background-position: center top;
  border: 3px solid var(--orange); box-shadow: 0 0 24px rgba(255,152,0,.35);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 48px; line-height: 92px; color: #fff;
}
.pf-nick { font-size: 22px; font-weight: 900; }
.pf-uname { color: var(--dim); font-size: 13px; }
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: 6px; }
.pf-stat { background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 12px; padding: 12px 6px; }
.pf-stat b { display: block; font-size: 18px; color: var(--orange); }
.pf-stat span { font-size: 12px; color: var(--dim); }
.pf-row { width: 100%; display: flex; gap: 8px; }
.pf-row input { flex: 1; min-width: 0; }
.pf-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pf-section { width: 100%; text-align: left; }
.pf-section h3 { font-size: 15px; margin: 10px 0 10px; display: flex; align-items: center; gap: 6px; }
.avatar-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.avatar-pick {
  aspect-ratio: 1; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer;
  background-size: cover; background-position: center top;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff; overflow: hidden;
  transition: all .15s;
}
.avatar-pick:hover { border-color: var(--cyan); transform: scale(1.05); }
.avatar-pick.sel { border-color: var(--orange); box-shadow: 0 0 12px rgba(255,152,0,.5); }
.friend-item {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  padding: 10px 12px; border-radius: 12px; margin-bottom: 8px;
}
.friend-item .f-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background-size: cover; background-position: center top;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; overflow: hidden;
}
.friend-item .f-name { font-weight: 700; font-size: 14px; }
.friend-item .f-sub { font-size: 11px; color: var(--dim); margin-top: 2px; }
.friend-item .f-sub.online { color: var(--green); }
.friend-item .f-acts { margin-left: auto; display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.friend-item .btn-mini { padding: 6px 10px; font-size: 12px; }
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px; border-bottom: 1px dashed rgba(255,255,255,.08);
  font-size: 13px;
}
.search-result-item .f-avatar { width: 34px; height: 34px; border-radius: 50%; background-size: cover; background-position: center top; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; overflow: hidden; flex-shrink: 0; }
.search-result-item .sr-name { font-weight: 700; }
.search-result-item .sr-sub { color: var(--dim); font-size: 12px; }
.search-result-item .btn-mini { margin-left: auto; padding: 5px 10px; font-size: 12px; flex-shrink: 0; }
.empty-tip { color: var(--dim); font-size: 13px; text-align: center; padding: 18px 0; }
@media (max-width: 768px) {
  .pf-stats { gap: 6px; }
  .pf-stat b { font-size: 15px; }
  .friend-item { flex-wrap: wrap; }
  .friend-item .f-acts { width: 100%; justify-content: flex-start; margin-left: 0; }
}

/* ============ 内测服水印与徽章 ============ */
#beta-wm {
  position: fixed; inset: 0; z-index: 99999;
  pointer-events: none; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
}
#beta-wm .wm-text {
  align-self: center; justify-self: center;
  font-size: 30px; font-weight: 800; white-space: nowrap;
  color: rgba(255, 90, 90, 0.16);
  transform: rotate(-24deg);
  letter-spacing: 2px;
  text-shadow: 0 1px 0 rgba(255,255,255,.1);
}
.beta-stamp {
  position: fixed; top: 26px; right: 22px; z-index: 9999;
  font-size: 20px; font-weight: 900; letter-spacing: 4px;
  color: #e53935; background: rgba(255,255,255,.92);
  border: 3px double #e53935; border-radius: 8px;
  padding: 4px 10px 4px 14px;
  transform: rotate(6deg);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  pointer-events: none;
}
.beta-tip {
  width: 100%; margin: 2px 0 10px;
  font-size: 12px; color: #ffb74d; text-align: center;
  background: rgba(255,152,0,.08);
  border: 1px dashed rgba(255,152,0,.35); border-radius: 8px;
  padding: 6px 8px; line-height: 1.6;
}
.beta-tip b { color: #ff8f00; }
@media (max-width: 768px) {
  #beta-wm .wm-text { font-size: 18px; }
  .beta-stamp { top: 14px; right: 12px; font-size: 15px; padding: 3px 8px 3px 11px; }
}

/* ============ 通用动画 ============ */
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.floaty { animation: floaty 2.4s ease-in-out infinite; }

/* ============ 响应式适配 ============ */

/* 大屏 PC：内容限宽居中 */
@media (min-width: 1500px) {
  .lobby-body { max-width: 1280px; margin: 0 auto; }
  .page-body { max-width: 1100px; }
}

/* 平板：中等屏幕微调 */
@media (max-width: 1080px) {
  .topbar { margin: 8px 10px; padding: 8px 12px; }
  .panel { padding: 14px; }
}

/* 手机端 */
@media (max-width: 768px) {
  body { font-size: 14px; }
  /* 输入与按钮触控友好（≥44px，防 iOS 聚焦缩放） */
  input, .btn-main, .btn-sub, .btn-mini, .tab-btn { font-size: 16px; }
  input { padding: 13px 14px; }
  .btn-main { padding: 13px 18px; }
  .btn-sub.sm { padding: 13px 16px; }

  /* 登录 */
  #view-login { padding: 12px; }
  .login-bg { padding: 8px; }
  .login-box { width: 100%; max-width: 100%; padding: 26px 20px; }
  .logo-lg { font-size: 30px; }

  /* 顶栏 */
  .topbar { margin: 6px 8px; padding: 8px 10px; border-radius: 12px; }
  .brand { font-size: 16px; }
  .u-stat { gap: 6px; font-size: 12px; }
  .u-name { font-size: 13px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .avatar { width: 30px; height: 30px; }
  .user-info { gap: 7px; }
  .btn-mini { padding: 6px 10px; font-size: 13px; }

  /* 大厅 */
  .lobby-body { grid-template-columns: 1fr; padding: 6px 8px 96px; gap: 10px; }
  .panel { padding: 14px; }
  .panel h3 { font-size: 14px; }
  .btn-main.big { padding: 15px 10px; }
  .notice p { font-size: 13px; }
  .banner { padding: 20px 14px; }
  .banner h2 { font-size: 20px; }

  /* 底部导航：全宽固定，4 等分 */
  .bottom-nav {
    left: 0; right: 0; transform: none; bottom: 0;
    width: 100%; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    border-radius: 0; gap: 4px;
    background: rgba(18,20,28,.92);
    border-top: 1px solid var(--border);
  }
  .nav-btn { flex: 1; padding: 10px 4px; font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 8px; }
  .nav-btn span:first-child { font-size: 16px; }

  /* 页面通用 */
  .page-body { padding: 6px 8px 80px; gap: 10px; }
  .join-row { flex-wrap: wrap; }
  .join-row input { min-width: 0; }
  .join-row.wide { max-width: 100%; }

  /* 活动页 */
  .act-card { padding: 16px; }
  .act-card .act-title { font-size: 17px; }
  .act-card .act-body { font-size: 13px; }

  /* 兑换码 */
  .codes-ref span { font-size: 12px; padding: 6px 8px; }

  /* 皮肤页：2 列紧凑 */
  .skins-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .skin-card { padding: 10px; }
  .skin-img { width: 100%; height: auto; aspect-ratio: 10 / 14; }
  .skin-name { font-size: 13px; }
  .skin-desc { font-size: 11px; min-height: 30px; }
  .skin-buff { font-size: 11px; }

  /* 房间等待 */
  .room-body { padding: 16px 8px 90px; }
  .room-card { padding: 22px 14px; }
  .room-code { font-size: 32px; letter-spacing: 5px; padding: 8px 16px; }

  /* 对战 HUD 紧凑 */
  .hud-top { top: 6px; left: 6px; right: 6px; gap: 6px; }
  .hud-timer { padding: 6px 12px; font-size: 17px; }
  .hud-score { font-size: 11px; padding: 3px 8px; }
  .hud-bottom { bottom: 6px; left: 6px; right: 6px; gap: 6px; }
  .hud-car, .hud-hp { padding: 6px 10px; font-size: 13px; }
  .hud-msg { font-size: 11px; max-width: 70vw; min-height: 18px; padding: 5px 10px; }
  .game-tip { font-size: 12px; padding: 6px 12px; }
  .end-box { min-width: 0; width: 88vw; padding: 20px 16px; }

  /* 新手关卡 HUD */
  .tut-skip { top: 52px; right: 8px; }
  #tut-desc { font-size: 12px; }

  /* 邮箱弹窗 */
  .modal-box { padding: 20px 16px; }
  .modal-box .join-row { flex-wrap: nowrap; }
  .modal-box .join-row .btn-sub { font-size: 14px; padding: 12px 12px; }
}
