/* ========================================================================
   iangame 设计系统 — 深色霓虹电竞风
   改样式请只改 :root 变量与组件类,勿在模板堆内联样式。
   ======================================================================== */

/* ---------- 设计 Token ---------- */
:root {
  /* 背景层级 */
  --bg:        #060912;
  --bg-card:   #0d1320;
  --bg-hover:  #141b2e;
  --bg-elev:   rgba(20, 27, 46, .6);

  /* 霓虹主色 */
  --neon-purple: #b537f2;
  --neon-cyan:   #00e0ff;
  --neon-blue:   #7c3aed;
  --grad-main:   linear-gradient(135deg, #b537f2 0%, #00e0ff 100%);
  --grad-soft:   linear-gradient(135deg, rgba(181,55,242,.18), rgba(0,224,255,.18));

  /* 文字 */
  --text:    #eaf0fb;
  --text-2:  #8b97b3;
  --text-3:  #5a6580;

  /* 状态 */
  --ok:    #2ee6a6;
  --warn:  #ffb627;
  --danger:#ff2e63;

  /* 描边 / 辉光 */
  --border:      rgba(124, 58, 237, .25);
  --border-2:    rgba(0, 224, 255, .25);
  --glow-purple: 0 0 20px rgba(181, 55, 242, .45);
  --glow-cyan:   0 0 20px rgba(0, 224, 255, .35);

  /* 尺寸 */
  --radius:   16px;
  --radius-sm:10px;
  --maxw:     1200px;
  --nav-h:    64px;

  /* 字体 */
  --ff-title: 'Orbitron', sans-serif;
  --ff-body:  'Rajdhani', system-ui, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* 全站背景:径向霓虹光晕 + 网格 */
  background-image:
    radial-gradient(900px 500px at 80% -10%, rgba(181,55,242,.18), transparent 60%),
    radial-gradient(800px 500px at 0% 110%, rgba(0,224,255,.14), transparent 60%),
    linear-gradient(var(--bg), var(--bg));
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
canvas { display: block; }

/* ---------- 布局 ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 48px 0; }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }
.center { display: flex; align-items: center; justify-content: center; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: rgba(6, 9, 18, .7);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--ff-title); font-weight: 700; font-size: 20px; letter-spacing: 1px; }
.brand .hex {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--grad-main); border-radius: 8px;
  box-shadow: var(--glow-purple); color: #060912; font-weight: 900;
}
.brand b { background: var(--grad-main); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.nav-links { display: flex; gap: 6px; }
.nav-links a {
  padding: 8px 14px; border-radius: 10px; color: var(--text-2); font-weight: 600;
  transition: all .18s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-hover); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: var(--bg-hover); border: 1px solid var(--border); font-weight: 600; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--grad-main); display: grid; place-items: center; color: #060912; font-weight: 800; font-size: 14px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 15px;
  transition: all .18s ease; white-space: nowrap;
}
.btn-primary { background: var(--grad-main); color: #060912; box-shadow: var(--glow-purple); }
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-ghost { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--neon-cyan); box-shadow: var(--glow-cyan); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: rgba(255,46,99,.15); color: var(--danger); border: 1px solid rgba(255,46,99,.4); }
.btn-block { width: 100%; }

/* ---------- HERO ---------- */
.hero {
  position: relative; overflow: hidden;
  margin-top: 24px; padding: 56px 40px; border-radius: 24px;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  box-shadow: var(--glow-purple);
}
.hero::before { /* 网格底纹 */
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(124,58,237,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,224,255,.08) 1px, transparent 1px);
  background-size: 40px 40px; mask-image: radial-gradient(circle at 50% 30%, #000, transparent 75%);
}
.hero-tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(0,224,255,.12); border: 1px solid var(--border-2); color: var(--neon-cyan); font-weight: 700; font-size: 13px; letter-spacing: .5px; position: relative; }
.hero h1 { font-family: var(--ff-title); font-weight: 800; font-size: clamp(38px, 7vw, 72px); line-height: 1; margin: 18px 0 14px; letter-spacing: 2px; position: relative; }
.hero h1 span { background: var(--grad-main); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { color: var(--text-2); font-size: 18px; max-width: 540px; position: relative; }
.hero-actions { display: flex; gap: 14px; margin-top: 26px; position: relative; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 28px; margin-top: 30px; position: relative; }
.hero-stat b { font-family: var(--ff-title); font-size: 28px; display: block; }
.hero-stat span { color: var(--text-2); font-size: 13px; }

/* ---------- 区块标题 ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.section-title { font-family: var(--ff-title); font-weight: 700; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.section-title .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grad-main); box-shadow: var(--glow-purple); }
.section-link { color: var(--neon-cyan); font-weight: 700; font-size: 14px; }
.section-link:hover { text-decoration: underline; }

/* ---------- 游戏卡片 ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.game-grid.compact { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.game-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: all .22s ease;
}
.game-card:hover { transform: translateY(-6px); border-color: var(--neon-cyan); box-shadow: var(--glow-cyan); }
.game-cover {
  position: relative; height: 120px; display: grid; place-items: center;
  font-size: 52px; background: var(--cover, var(--grad-soft));
}
.game-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(6,9,18,.55)); }
.game-cover .tag {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(6,9,18,.6); border: 1px solid var(--border); color: var(--text-2);
}
.game-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.game-body h3 { font-size: 17px; font-weight: 700; }
.game-body .desc { color: var(--text-2); font-size: 13px; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.game-body .play { margin-top: 8px; }

/* ---------- 筛选 ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.chip {
  padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-2);
  transition: all .16s ease;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--grad-main); color: #060912; border-color: transparent; box-shadow: var(--glow-purple); }

/* ---------- 卡片容器(玻璃) ---------- */
.panel { background: var(--bg-elev); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.panel h4 { font-family: var(--ff-title); font-size: 15px; letter-spacing: .5px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ---------- 游戏页布局 ---------- */
.play-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 20px; margin-top: 20px; }
.play-main { display: flex; flex-direction: column; gap: 16px; }
.play-canvas-box {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: #000; border: 1px solid var(--border);
  display: grid; place-items: center; min-height: 360px;
}
.play-canvas-box canvas { width: 100%; height: auto; background: #000; }
.play-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.play-meta { display: flex; align-items: center; gap: 18px; }
.stat-pill { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; }
.stat-pill .k { color: var(--text-2); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.stat-pill .v { font-family: var(--ff-title); font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; color: var(--neon-cyan); }
.play-side { display: flex; flex-direction: column; gap: 16px; }

/* 游戏结束/准备遮罩 */
.overlay { position: absolute; inset: 0; background: rgba(6,9,18,.82); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 5; text-align: center; padding: 20px; }
.overlay .ttl { font-family: var(--ff-title); font-size: 30px; font-weight: 800; margin-bottom: 6px; }
.overlay .sub { color: var(--text-2); margin-bottom: 18px; }
.overlay .final-score { font-family: var(--ff-title); font-size: 44px; font-weight: 800; background: var(--grad-main); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; margin: 8px 0 18px; }
.overlay.hidden { display: none; }

/* ---------- 排行榜 ---------- */
.lb { display: flex; flex-direction: column; gap: 4px; }
.lb-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.lb-row.me { background: rgba(0,224,255,.1); border: 1px solid var(--border-2); }
.lb-rank { font-family: var(--ff-title); font-weight: 800; color: var(--text-3); text-align: center; }
.lb-row:nth-child(1) .lb-rank { color: #ffd54a; }
.lb-row:nth-child(2) .lb-rank { color: #cfd8e6; }
.lb-row:nth-child(3) .lb-rank { color: #e0a06b; }
.lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-family: var(--ff-title); font-weight: 700; color: var(--neon-cyan); font-variant-numeric: tabular-nums; }
.lb-empty { color: var(--text-3); text-align: center; padding: 20px 0; font-size: 14px; }

/* ---------- 表单 / 认证 ---------- */
.auth-wrap { min-height: calc(100vh - var(--nav-h)); display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--bg-elev); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 20px; padding: 36px 30px; box-shadow: var(--glow-purple); }
.auth-card .brand { justify-content: center; margin-bottom: 6px; }
.auth-card h2 { text-align: center; font-family: var(--ff-title); font-size: 22px; margin: 12px 0 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text); font-size: 15px;
  transition: border-color .16s;
}
.field input:focus { outline: none; border-color: var(--neon-cyan); box-shadow: var(--glow-cyan); }
.form-msg { min-height: 18px; font-size: 13px; margin-top: 8px; }
.form-msg.err { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-2); font-size: 14px; }
.auth-switch a { color: var(--neon-cyan); font-weight: 700; }

/* ---------- 个人中心 ---------- */
.profile-head { display: flex; align-items: center; gap: 18px; padding: 24px; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 28px; }
.profile-head h2 { font-family: var(--ff-title); }
.profile-tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.profile-table { width: 100%; border-collapse: collapse; }
.profile-table th, .profile-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.profile-table th { color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.profile-table td .v { font-family: var(--ff-title); font-weight: 700; color: var(--neon-cyan); }

/* ---------- Toast ---------- */
.toast-host { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border); font-weight: 600; box-shadow: var(--glow-purple); animation: toastIn .2s ease; }
.toast.err { border-color: var(--danger); box-shadow: 0 0 16px rgba(255,46,99,.4); }
.toast.ok { border-color: var(--ok); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 28px 0; color: var(--text-3); font-size: 14px; text-align: center; }

/* ---------- 工具类 ---------- */
.muted { color: var(--text-2); }
.tiny { font-size: 13px; }
.hide { display: none !important; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.text-grad { background: var(--grad-main); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  .play-wrap { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .hero { padding: 36px 22px; }
}
@media (max-width: 520px) {
  .game-grid, .game-grid.compact { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero-stats { gap: 18px; }
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--neon-blue); }
