/* GameHub 平台基础样式 */
:root {
  --bg: #0a1020;
  --bg-soft: #111a2e;
  --card: #16203a;
  --card-hover: #1b2745;
  --line: #24304d;
  --text: #e7edfb;
  --muted: #8fa0c0;
  --accent: #2dd4bf;
  --accent-2: #f5b544;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(3, 8, 20, .45);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(45, 212, 191, .14), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, rgba(245, 181, 68, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100%;
}

a { color: var(--accent); text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: .15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--card-hover); border-color: #33436b; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #2dd4bf, #14b8a6);
  border-color: transparent;
  color: #04211d;
  font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, #35e0ca, #14b8a6); }
.btn-ghost { background: transparent; }
.btn-danger { color: #ffd7d7; border-color: #4a2431; background: #2a1520; }
.btn-danger:hover { background: #3a1b28; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

.input, select, textarea {
  width: 100%;
  background: #0d1626;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: .15s ease;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45, 212, 191, .12); }
textarea { resize: vertical; min-height: 84px; }
label.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
}
.badge.single { color: #a9d5ff; border-color: #24405e; background: rgba(80, 160, 255, .08); }
.badge.multi { color: #ffd9a0; border-color: #5b4526; background: rgba(245, 181, 68, .08); }
.badge.online { color: #86efac; border-color: #214a33; background: rgba(74, 222, 128, .08); }
.badge.draft { color: #cbd5e1; }
.badge.offline { color: #fca5a5; border-color: #4a2431; background: rgba(248, 113, 113, .08); }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  backdrop-filter: blur(14px);
  background: rgba(10, 16, 32, .78);
  border-bottom: 1px solid rgba(36, 48, 77, .7);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; font-size: 20px;
  background: linear-gradient(135deg, rgba(45, 212, 191, .25), rgba(245, 181, 68, .18));
  border: 1px solid rgba(45, 212, 191, .35);
}
.brand b { font-size: 17px; letter-spacing: .3px; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }

.top-right { display: flex; align-items: center; gap: 10px; }
.coin-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(245, 181, 68, .1);
  border: 1px solid rgba(245, 181, 68, .35);
  color: #ffd9a0; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.coin-pill b { color: #ffe6b8; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line);
  cursor: pointer;
}
.user-chip:hover { border-color: #33436b; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #22304f, #1a2743);
  border: 1px solid var(--line);
  font-size: 17px;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip span { font-size: 13px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 大厅 ---------- */
.shell { max-width: 1180px; margin: 0 auto; padding: 26px 24px 70px; }
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 30px;
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(45, 212, 191, .16), transparent 70%),
    linear-gradient(135deg, rgba(22, 32, 58, .95), rgba(14, 22, 41, .95));
  box-shadow: var(--shadow);
  margin-bottom: 26px;
}
.hero h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: .5px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 760px; }
.hero .coins-note {
  margin-top: 16px; display: inline-flex; gap: 8px; align-items: center;
  font-size: 12.5px; color: #ffe1ad; background: rgba(245, 181, 68, .08);
  border: 1px dashed rgba(245, 181, 68, .35); padding: 7px 12px; border-radius: 10px;
}

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 17px; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; }
.segmented button {
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 16px; border-radius: 9px; cursor: pointer; font-size: 13px;
}
.segmented button.active { background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 18px; }

.game-card {
  position: relative;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.game-card:hover { transform: translateY(-4px); border-color: rgba(45, 212, 191, .45); box-shadow: 0 20px 40px rgba(2, 8, 20, .5); }
.cover {
  height: 148px;
  position: relative;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1c2b4d, #131c33);
  overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .placeholder { font-size: 44px; opacity: .9; }
.cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(10, 16, 32, .85));
}
.cover .badge { position: absolute; top: 10px; left: 10px; z-index: 2; }
.cover .play-cta {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 3;
  opacity: 0; transition: opacity .18s ease;
  background: rgba(6, 12, 24, .45);
}
.cover .play-cta span {
  padding: 9px 20px; border-radius: 999px; font-weight: 700; font-size: 13px;
  background: var(--accent); color: #04211d;
}
.game-card:hover .play-cta { opacity: 1; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; font-size: 15.5px; display: flex; align-items: center; gap: 6px; }
.card-body .desc { color: var(--muted); font-size: 12.5px; line-height: 1.6; min-height: 40px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; border-top: 1px dashed rgba(36, 48, 77, .9); font-size: 12px; color: var(--muted); }
.card-foot .reward { color: #ffd9a0; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: rgba(4, 9, 20, .68);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal {
  width: min(440px, 100%);
  background: linear-gradient(180deg, #141e36, #0f1729);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal .close { position: absolute; top: 14px; right: 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.msg { font-size: 12.5px; min-height: 18px; color: var(--danger); margin: 4px 0 8px; }
.msg.ok { color: var(--ok); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button { flex: 1; }

#toastBox { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px;
  background: rgba(18, 28, 48, .96); border: 1px solid var(--line);
  box-shadow: var(--shadow); animation: toastIn .2s ease;
}
.toast.success { border-color: rgba(74, 222, 128, .45); color: #b9f7cd; }
.toast.error { border-color: rgba(248, 113, 113, .45); color: #ffc9c9; }
.toast.reward { border-color: rgba(245, 181, 68, .6); color: #ffe6b8; background: rgba(48, 34, 12, .96); font-weight: 700; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.rules { margin-top: 34px; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(17, 26, 46, .6); }
.rules h3 { margin: 0 0 10px; font-size: 14px; }
.rules ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.9; }

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .shell { padding: 18px 14px 60px; }
  .hero { padding: 22px; }
  .hero h1 { font-size: 21px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .cover { height: 112px; }
  .brand small { display: none; }
}
