:root {
  --bg-0: #0a0d14;
  --bg-1: #0f1320;
  --neon-1: #00e0ff;
  --neon-2: #ff00aa;
  --neon-3: #87ff65;
  --text: #e8f0ff;
  --muted: #8aa0c6;
  --nav-h: 66px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(1200px 800px at 10% 10%, #101629 0%, var(--bg-0) 40%, var(--bg-1) 100%);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background-color: var(--bg-1); border-radius: 8px; width: 90%; max-width: 500px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); overflow: hidden; border: 1px solid rgba(0,224,255,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.modal-header h3 { margin: 0; color: var(--text); font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: background-color 0.2s; }
.modal-close:hover { background-color: rgba(255,255,255,0.1); color: var(--neon-1); }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text); font-weight: 500; }
.form-group input { width: 100%; padding: 8px 12px; border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; font-size: 14px; transition: border-color 0.2s; background-color: rgba(255,255,255,0.05); color: var(--text); }
.form-group input:focus { outline: none; border-color: var(--neon-1); box-shadow: 0 0 0 2px rgba(0,224,255,0.2); }
.form-group input:disabled { background-color: rgba(255,255,255,0.03); color: var(--muted); }
.error-message { color: #ff4d4f; font-size: 12px; margin-top: 4px; min-height: 16px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.btn-primary { background-color: var(--neon-1); color: var(--bg-0); border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.2s; }
.btn-primary:hover { background-color: #40a9ff; box-shadow: 0 0 8px rgba(0,224,255,0.4); }
.btn-cancel { background-color: transparent; color: var(--muted); border: 1px solid rgba(255,255,255,0.2); padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; transition: all 0.2s; }
.btn-cancel:hover { border-color: var(--neon-1); color: var(--neon-1); }

.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; background-image: radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.25) 0, transparent 50%), radial-gradient(1.5px 1.5px at 70% 80%, rgba(255,255,255,.12) 0, transparent 50%), radial-gradient(1.8px 1.8px at 40% 60%, rgba(255,255,255,.18) 0, transparent 50%), radial-gradient(2px 2px at 85% 25%, rgba(255,255,255,.2) 0, transparent 50); animation: twinkle 8s linear infinite; }
@keyframes twinkle { 0% { transform: translateY(0); opacity: .9; } 50% { transform: translateY(-10px); opacity: .7; } 100% { transform: translateY(0); opacity: .9; } }
header { position: relative; z-index: 2; padding: 32px 20px 12px; text-align: center; }
.title { margin: 0; font-size: clamp(24px, 5vw, 48px); letter-spacing: .03em; text-shadow: 0 0 10px rgba(0,224,255,.25), 0 0 25px rgba(255,0,170,.2); }
.subtitle { margin: 8px 0 0; color: var(--muted); font-size: clamp(12px, 2.2vw, 16px); }
.grid { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; padding: 20px; max-width: 1200px; margin: 0 auto 32px; }
.card { --glow: rgba(0,224,255,.55); --glow-2: rgba(255,0,170,.45); position: relative; display: flex; flex-direction: column; border-radius: 16px; color: var(--text); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0) 60%), radial-gradient(120% 100% at 0% 0%, rgba(0,224,255,.08), transparent 60%), radial-gradient(120% 100% at 100% 100%, rgba(255,0,170,.08), transparent 60%), linear-gradient(180deg, #0f1526, #0a0f1d); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 8px 24px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.04); overflow: hidden; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.card::before { content: ""; position: absolute; inset: -1px; border-radius: 16px; padding: 1px; background: linear-gradient(135deg, var(--neon-1), transparent 30%), linear-gradient(315deg, var(--neon-2), transparent 30%), linear-gradient(90deg, transparent, rgba(255,255,255,.06)); -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000); mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: .35; transition: opacity .25s ease; }
.card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,.15); box-shadow: 0 16px 36px rgba(0,0,0,.5), 0 0 24px var(--glow-2); }
.card:hover::before { opacity: .65; }
.card-preview { position: relative; height: 50%; min-height: 140px; background-image: linear-gradient(135deg, rgba(0,224,255,.12), rgba(255,0,170,.12)); background-size: cover; background-position: center; background-repeat: no-repeat; }
.hot-tag { position: absolute; top: 8px; left: 8px; background: linear-gradient(135deg, #ff4d4f, #ff7a45); color: white; font-size: 12px; font-weight: bold; padding: 4px 8px; border-radius: 4px; z-index: 10; transform: rotate(-5deg); box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.new-tag { position: absolute; top: 8px; left: 8px; background: linear-gradient(135deg, #2ed573, #1e90ff); color: white; font-size: 12px; font-weight: bold; padding: 4px 8px; border-radius: 4px; z-index: 10; transform: rotate(-5deg); box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.card-preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.3) 60%, rgba(0,0,0,0) 100%); pointer-events: none; }
.badge { width: 44px; height: 44px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; letter-spacing: .02em; color: #051018; font-size: clamp(12px, 2.2vw, 16px); background: linear-gradient(135deg, #6bdcff, #f8a6ff); filter: saturate(120%) brightness(110%); box-shadow: inset 0 0 24px rgba(255,255,255,.25), 0 4px 12px rgba(0,0,0,.35); }
.badge-01 { background: linear-gradient(135deg, #00e0ff, #7a00ff); }
.badge-02 { background: linear-gradient(135deg, #ff8a00, #ff0040); }
.badge-03 { background: linear-gradient(135deg, #8dff1a, #00c897); }
.badge-04 { background: linear-gradient(135deg, #ffd400, #ff2aa1); }
.badge-05 { background: linear-gradient(135deg, #2a7cff, #ff4fb3); }
.name { font-size: 16px; font-weight: 700; letter-spacing: .02em; text-shadow: 0 0 8px rgba(0,224,255,.2); }
.hint { color: var(--muted); font-size: 12px; }
.card-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; }
.play-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; color: #ffffff; font-weight: 700; letter-spacing: .02em; font-size: 13px; background: linear-gradient(135deg, var(--neon-1), var(--neon-2)); box-shadow: 0 8px 20px rgba(0,224,255,.3), 0 6px 18px rgba(255,0,170,.25); transition: transform .15s ease, box-shadow .2s ease; text-decoration: none; }
.play-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,224,255,.35), 0 10px 24px rgba(255,0,170,.3); text-decoration: none; }
footer { position: relative; z-index: 2; text-align: center; color: var(--muted); padding: 10px 20px 24px; }
@media (max-width: 480px) { .badge { width: 38px; height: 38px; } .name { font-size: 16px; } .card-info { padding: 12px 14px; } }
.auth-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; visibility: hidden; opacity: 0; transition: visibility 0s, opacity 0.3s ease; }
.auth-modal-overlay.active { visibility: visible; opacity: 1; }
.auth-modal { background: linear-gradient(180deg, #0f1526, #0a0f1d); border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04); width: 100%; max-width: 400px; max-height: 90vh; overflow-y: auto; transform: scale(0.9); transition: transform 0.3s ease; }
.auth-modal-overlay.active .auth-modal { transform: scale(1); }
.auth-modal-header { padding: 20px 24px 16px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.08); }
.auth-modal-title { font-size: 24px; font-weight: 700; background: linear-gradient(135deg, var(--neon-1), var(--neon-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 8px; }
.auth-modal-subtitle { color: var(--muted); font-size: 14px; }
.auth-tabs { display: flex; padding: 16px 24px 0; }
.auth-tab { flex: 1; padding: 10px 0; text-align: center; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; transition: color 0.2s ease; }
.auth-tab.active { color: var(--text); }
.auth-tab.active::after { content: ''; position: absolute; bottom: 0; left: 10%; right: 10%; height: 3px; background: linear-gradient(135deg, var(--neon-1), var(--neon-2)); border-radius: 3px; }
.auth-form-container { padding: 20px 24px 24px; }
.auth-form { display: none; }
.auth-form.active { display: block; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; color: var(--text); font-weight: 600; font-size: 14px; }
.form-input { width: 100%; height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); color: var(--text); font-size: 16px; transition: border-color 0.2s ease, background-color 0.2s ease; }
.form-input:focus { outline: none; border-color: var(--neon-1); background: rgba(255,255,255,0.06); box-shadow: 0 0 0 3px rgba(0,224,255,0.1); }
.form-input::placeholder { color: var(--muted); }
.form-error { color: #ff4444; font-size: 12px; margin-top: 4px; min-height: 16px; }
.auth-btn { width: 100%; height: 48px; border-radius: 12px; border: none; font-size: 16px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--neon-1), var(--neon-2)); box-shadow: 0 8px 20px rgba(0,224,255,0.3), 0 6px 18px rgba(255,0,170,0.25); cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease; margin-top: 8px; }
.auth-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,224,255,0.35), 0 10px 24px rgba(255,0,170,0.3); }
.auth-btn:active:not(:disabled) { transform: translateY(0); }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.close-btn { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: none; background: rgba(255,255,255,0.1); color: var(--text); font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease; }
.close-btn:hover { background: rgba(255,255,255,0.15); }
.user-info { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: rgba(255,255,255,0.06); cursor: pointer; }

/* 个人信息页面的用户显示区域样式 */
.profile-user-info {
  margin-bottom: 16px;
  justify-content: center;
}
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--neon-1), var(--neon-2)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; }
.user-name { color: var(--text); font-weight: 600; font-size: 14px; }
.logout-btn { background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 4px 8px; border-radius: 4px; transition: color 0.2s ease, background-color 0.2s ease; }
.logout-btn:hover { color: #ff4444; background: rgba(255,68,68,0.1); }
.view { display: none; }

/* 搜索框样式 */
.search-container {
  position: relative;
  max-width: 500px;
  margin: 0 auto 20px;
  padding: 0 20px;
  z-index: 2;
}

#game-search {
  width: 100%;
  padding: 12px 40px 12px 16px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 16px;
  transition: all 0.2s ease;
  /* 确保有足够的触摸区域 */
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  /* 提升移动端输入体验 */
  -webkit-appearance: none;
  appearance: none;
}

/* 移动设备响应式调整 */
@media (max-width: 768px) {
  .search-container {
    padding: 0 16px;
    margin-bottom: 16px;
  }
  
  #game-search {
    font-size: 16px; /* 防止iOS缩放 */
    padding: 14px 40px 14px 16px; /* 增加内边距，提高触摸体验 */
    border-radius: 28px;
  }
}

#game-search:focus {
  outline: none;
  border-color: var(--neon-1);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(0,224,255,0.1);
}

#game-search::placeholder {
  color: var(--muted);
}

.search-icon {
  position: absolute;
  right: 36px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 16px;
}
.view.active { display: block; }
body.game-active header { display: none; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-around; gap: 10px; flex-wrap: nowrap; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0) 35%), #0a0f1d; border-top: 1px solid rgba(255,255,255,.12); box-shadow: 0 -8px 24px rgba(0,0,0,.4); z-index: 10; backdrop-filter: blur(10px); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 8px 12px; padding-bottom: env(safe-area-inset-bottom); }
.nav-item { flex: 1; max-width: 240px; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 14px; cursor: pointer; user-select: none; color: var(--text); font-weight: 700; background: linear-gradient(135deg, rgba(0,224,255,.08), rgba(255,0,170,.08)); border: 1px solid rgba(255,255,255,.12); transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease; }
.nav-item:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.35); }
.nav-item:active { transform: translateY(0); box-shadow: 0 6px 16px rgba(0,0,0,.3); }
.nav-item.active { background: linear-gradient(135deg, var(--neon-1), var(--neon-2)); color: #fff; box-shadow: 0 12px 26px rgba(0,224,255,.3), 0 10px 24px rgba(255,0,170,.25); border-color: transparent; }
.chat-wrap { position: relative; z-index: 2; padding: 16px 16px 60px; max-width: 1000px; margin: 0 auto; min-height: calc(var(--vvh, 100dvh) - var(--nav-h) - 24px); display: flex; }
.chat-card { border-radius: 16px; background: linear-gradient(180deg, #0f1526, #0a0f1d); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 8px 24px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.04); overflow: hidden; display: flex; flex-direction: column; flex: 1 1 auto; height: calc(100vh - var(--nav-h) - 152px); }
.chat-header { padding: 14px 16px; font-weight: 700; letter-spacing: .02em; background: linear-gradient(135deg, rgba(0,224,255,.12), rgba(255,0,170,.12)); border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.messages { flex: 1 1 auto; height: calc(100vh - var(--nav-h) - 360px); overflow-y: auto; overflow-x: hidden; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-track { background: rgba(255,255,255,0.1); border-radius: 3px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }
.messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }
.msg { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); animation: slideInUp 0.3s ease-out; }
@keyframes slideInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.msg .content { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.chat-input { display: grid; grid-template-columns: 160px 1fr auto; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.chat-input input { height: 44px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); color: var(--text); padding: 8px 10px; font-size: 16px; transition: all 0.2s ease; }
.chat-input input:focus { border-color: var(--neon-1); box-shadow: 0 0 0 2px rgba(0,224,255,0.2); background: rgba(255,255,255,0.06); }
.chat-input button { height: 44px; border-radius: 10px; border: 0; padding: 0 16px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--neon-1), var(--neon-2)); box-shadow: 0 8px 20px rgba(0,224,255,.3), 0 6px 18px rgba(255,0,170,.25); cursor: pointer; touch-action: manipulation; transition: all 0.2s ease; }
.chat-input button:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(0,224,255,.4), 0 8px 20px rgba(255,0,170,.3); }
.chat-input button:active { transform: translateY(0); }
.chat-hint { padding: 8px 16px; color: var(--muted); font-size: 12px; border-top: 1px solid rgba(255,255,255,.08); }

@media (max-width: 600px) { .chat-input { grid-template-columns: 120px 1fr auto; } }
@media (max-width: 440px) { .chat-input { grid-template-columns: 1fr auto; grid-template-rows: auto auto; } #chat-username { grid-column: 1 / span 2; } }
#profile-view { padding: 20px; overflow-y: auto; height: calc(100vh - var(--nav-h) - 20px); }
.edit-profile-btn { margin-top: 10px; padding: 6px 16px; border: 1px solid rgba(255,255,255,.2); border-radius: 20px; background: rgba(255,255,255,.06); color: var(--text); font-size: 14px; cursor: pointer; transition: all 0.3s ease; }
.edit-profile-btn:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); }
.profile-header { display: flex; align-items: center; padding: 20px; background: rgba(255,255,255,0.05); border-radius: 16px; margin-bottom: 24px; }
.profile-info { flex: 1; }

/* 游戏历史记录样式 */
.history-section {
  background: rgba(255,255,255,0.05);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.history-title {
  margin: 0;
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
}

.clear-history-btn {
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 16px;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-history-btn:hover {
  color: #ff4d4f;
  border-color: rgba(255,77,79,0.3);
  background: rgba(255,77,79,0.1);
}

.history-container {
  min-height: 100px;
}

.empty-history {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  transition: all 0.2s ease;
  gap: 12px;
}

.history-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
  transform: translateX(4px);
}

.history-game-info {
  flex: 1;
  min-width: 0;
}

/* 游戏预览图样式 */
.history-game-preview {
  width: 60px;
  height: 60px;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  background-color: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.history-game-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-game-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.history-game-category {
  background: rgba(0,224,255,0.1);
  color: var(--neon-1);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.history-play-btn {
  padding: 8px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  border: none;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.history-play-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,224,255,0.3);
}

/* 响应式调整 */
@media (max-width: 480px) {
  .history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .clear-history-btn {
    align-self: flex-end;
    padding: 8px 16px;
    font-size: 14px;
  }
  
  .history-item {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 16px;
  }
  
  .history-game-preview {
    width: 70px;
    height: 70px;
  }
  
  .history-game-info {
    flex: 1;
  }
  
  .history-game-name {
    font-size: 16px;
    line-height: 1.4;
    margin-bottom: 6px;
  }
  
  .history-game-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .history-play-btn {
    padding: 10px 16px;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* 个人信息右侧登录注册按钮样式 */
.profile-auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 16px;
}

.profile-auth-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 80px;
}

.profile-auth-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.profile-auth-btn:active {
  transform: translateY(0);
}

.user-avatar-large {
  width: 80px; height: 80px; border-radius: 50%; 
  background: linear-gradient(135deg, #4b80ff, #6c8cff); 
  display: flex; align-items: center; justify-content: center; 
  font-size: 28px; font-weight: 700; margin-right: 20px; color: white; 
}
.profile-name { font-size: 24px; font-weight: 600; margin: 0 0 8px 0; color: white; }
.profile-stats { font-size: 16px; color: rgba(255,255,255,0.7); margin: 0; }
.profile-menu { display: flex; background: rgba(255,255,255,0.05); border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.menu-item { flex: 1; display: flex; align-items: center; justify-content: center; padding: 12px; border-radius: 8px; cursor: pointer; transition: background-color 0.2s; }
.menu-item:hover { background-color: rgba(255,255,255,0.05); }
.menu-item.active { background-color: rgba(75,128,255,0.2); }
.menu-icon { font-size: 18px; margin-right: 8px; }
.menu-text { color: white; font-size: 16px; }
.profile-content { min-height: 200px; }
.clear-cache-btn {
  margin-top: 20px;
  padding: 10px 20px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  text-align: center;
}
.clear-cache-btn:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.3);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

.history-actions .text-btn:hover { background-color: rgba(75,128,255,0.1); }
.history-list { display: flex; flex-direction: column; gap: 12px; }
  
  .empty-state { text-align: center; padding: 40px 20px; color: #999; font-size: 14px; }
.history-item { background: rgba(255,255,255,0.05); border-radius: 12px; padding: 16px; transition: transform 0.2s, box-shadow 0.2s; display: flex; align-items: center; }
.history-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); background: rgba(255,255,255,0.08); }
.history-item .game-preview { width: 60px; height: 60px; background-size: cover; background-position: center; border-radius: 8px; margin-right: 16px; background-color: rgba(255,255,255,0.1); flex-shrink: 0; }
.history-item .game-info { flex: 1; }
.history-item .game-title { font-size: 16px; font-weight: 500; margin-bottom: 4px; color: white; }

/* 动态星空背景 */
.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.25) 0, transparent 50%),
    radial-gradient(1.5px 1.5px at 70% 80%, rgba(255,255,255,.12) 0, transparent 50%),
    radial-gradient(1.8px 1.8px at 40% 60%, rgba(255,255,255,.18) 0, transparent 50%),
    radial-gradient(2px 2px at 85% 25%, rgba(255,255,255,.2) 0, transparent 50%);
  animation: twinkle 8s linear infinite;
}
@keyframes twinkle {
  0% { transform: translateY(0); opacity: .9; }
  50% { transform: translateY(-10px); opacity: .7; }
  100% { transform: translateY(0); opacity: .9; }
}

/* 游戏网格布局样式 */
.grid {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px; padding: 20px; max-width: 1200px; margin: 0 auto 32px;
}

/* 增强的游戏卡片样式 */
.card {
  --glow: rgba(0,224,255,.55);
  --glow-2: rgba(255,0,170,.45);
  position: relative;
  display: flex; flex-direction: column;
  border-radius: 16px; color: var(--text);
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0) 60%),
    radial-gradient(120% 100% at 0% 0%, rgba(0,224,255,.08), transparent 60%),
    radial-gradient(120% 100% at 100% 100%, rgba(255,0,170,.08), transparent 60%),
    linear-gradient(180deg, #0f1526, #0a0f1d);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 24px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.04);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card::before {
  content: "";
  position: absolute; inset: -1px; border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, var(--neon-1), transparent 30%),
              linear-gradient(315deg, var(--neon-2), transparent 30%),
              linear-gradient(90deg, transparent, rgba(255,255,255,.06));
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
  opacity: .35; transition: opacity .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,.15);
  box-shadow: 0 16px 36px rgba(0,0,0,.5), 0 0 24px var(--glow-2);
}
.card:hover::before { opacity: .65; }

/* 卡片预览区域 */
.card-preview {
  position: relative;
  height: 50%; min-height: 140px;
  background-image: linear-gradient(135deg, rgba(0,224,255,.12), rgba(255,0,170,.12));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* 热门和新游戏标签样式 */
.hot-tag, .new-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 10;
  transform: rotate(-5deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hot-tag {
  background: linear-gradient(135deg, #ff4d4f, #ff7a45);
  color: white;
}

.new-tag {
  background: linear-gradient(135deg, #2ed573, #1e90ff);
  color: white;
}

/* 下拉刷新样式 */
.pull-refresh {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  z-index: 100;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}
.pull-refresh.show { transform: translateY(0); }
.pr-icon {
  width: 20px;
  height: 20px;
  border: 2px solid var(--neon-1);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.pr-icon.spin { animation: spin 1s linear infinite; }

/* 分类栏样式 */
.category-bar {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-bar::-webkit-scrollbar {
  display: none;
}
.cat-btn {
  white-space: nowrap;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.cat-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}
.cat-btn.active {
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0,224,255,0.3);
}

/* Header样式 */
header {
  position: relative; z-index: 2;
  padding: 32px 20px 12px;
  text-align: center;
}
.title {
  margin: 0;
  font-size: clamp(24px, 5vw, 48px);
  letter-spacing: .03em;
  text-shadow: 0 0 10px rgba(0,224,255,.25), 0 0 25px rgba(255,0,170,.2);
}
.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 2.2vw, 16px);
}

/* Footer样式 */
footer {
  position: relative; z-index: 2; text-align: center; color: var(--muted); padding: 10px 20px 24px;
}

/* 用户信息样式 */
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 管理功能按钮样式 */
.management-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.management-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.management-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.management-btn:hover::before {
  left: 100%;
}

.management-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 16px rgba(0, 224, 255, 0.2);
}

.management-btn .btn-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.management-btn .btn-text {
  font-weight: 500;
  letter-spacing: 0.02em;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
}
.user-name {
  font-size: 14px;
  color: var(--text);
}
.auth-btn {
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,224,255,0.3);
}

/* 增强的游戏卡片内容样式 */
.card-content {
  padding: 16px;
  flex: 1;
}
.card-title {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
  text-shadow: 0 0 8px rgba(0,224,255,.2);
  color: var(--text);
}
.card-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 12px 0;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 徽章样式 */
.badge {
  width: 44px; height: 44px; flex: none;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: .02em; color: #051018;
  font-size: clamp(14px, 2.6vw, 18px);
  background: linear-gradient(135deg, #6bdcff, #f8a6ff);
  filter: saturate(120%) brightness(110%);
  box-shadow: inset 0 0 24px rgba(255,255,255,.25), 0 4px 12px rgba(0,0,0,.35);
}
.badge-01 { background: linear-gradient(135deg, #00e0ff, #7a00ff); }
.badge-02 { background: linear-gradient(135deg, #ff8a00, #ff0040); }
.badge-03 { background: linear-gradient(135deg, #8dff1a, #00c897); }
.badge-04 { background: linear-gradient(135deg, #ffd400, #ff2aa1); }
.badge-05 { background: linear-gradient(135deg, #2a7cff, #ff4fb3); }

/* 增强的播放按钮样式 */
.play-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 12px;
  color: #ffffff; font-weight: 700; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  box-shadow: 0 8px 20px rgba(0,224,255,.3), 0 6px 18px rgba(255,0,170,.25);
  transition: transform .15s ease, box-shadow .2s ease;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,224,255,.35), 0 10px 24px rgba(255,0,170,.3);
  text-decoration: none;
  opacity: 0.9;
}
.play-btn:active {
  opacity: 0.8;
}

/* 增强的认证模态框样式 */
.auth-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.auth-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.auth-modal {
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  background: var(--bg-2);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 32px 64px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08) inset;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}
.auth-modal-overlay.active .auth-modal {
  transform: scale(1);
}
.auth-modal-header {
  padding: 20px 24px 16px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.auth-modal-title {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.auth-modal-subtitle {
  color: var(--muted);
  font-size: 14px;
}
.auth-tabs {
  display: flex;
  padding: 16px 24px 0;
}
.auth-tab {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}
.auth-tab.active {
  color: var(--text);
}
.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 3px;
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  border-radius: 3px;
}
.auth-form-container {
  padding: 20px 24px 24px;
}
.auth-form {
  display: none;
}
.auth-form.active {
  display: block;
}
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.form-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 16px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.form-input:focus {
  outline: none;
  border-color: var(--neon-1);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 224, 255, 0.1);
}
.form-input::placeholder {
  color: var(--muted);
}
.form-error {
  color: #ff4444;
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
}

/* 增强的底部导航栏样式 */
.bottom-nav {
  position: fixed; 
  left: 0; 
  right: 0; 
  bottom: 0;
  display: flex; 
  align-items: center; 
  justify-content: space-around; 
  gap: 10px; 
  flex-wrap: nowrap;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0) 35%), #0a0f1d;
  border-top: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -8px 24px rgba(0,0,0,.4);
  z-index: 10;
  backdrop-filter: blur(10px);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 8px 12px;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; 
  max-width: 240px; 
  height: 44px;
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 8px;
  border-radius: 14px; 
  cursor: pointer; 
  user-select: none;
  color: var(--text); 
  font-weight: 700;
  background: linear-gradient(135deg, rgba(0,224,255,.08), rgba(255,0,170,.08));
  border: 1px solid rgba(255,255,255,.12);
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
}
.nav-item:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 10px 22px rgba(0,0,0,.35); 
}
.nav-item:active { 
  transform: translateY(0); 
  box-shadow: 0 6px 16px rgba(0,0,0,.3); 
}
.nav-item.active { 
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2)); 
  color: #fff; 
  box-shadow: 0 12px 26px rgba(0,224,255,.3), 0 10px 24px rgba(255,0,170,.25); 
  border-color: transparent; 
}

/* 增强的聊天室样式 */
.chat-wrap { 
  position: relative; 
  z-index: 2; 
  padding: 16px; 
  max-width: 1000px; 
  margin: 0 auto; 
  min-height: calc(var(--vvh, 100dvh) - var(--nav-h) - 24px); 
  display: flex; 
}
.chat-card {
  border-radius: 16px; 
  background: linear-gradient(180deg, #0f1526, #0a0f1d);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 24px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.04);
  overflow: hidden;
  display: flex; 
  flex-direction: column; 
  flex: 1 1 auto; 
  min-height: inherit;
}
.chat-header { 
  padding: 14px 16px; 
  font-weight: 700; 
  letter-spacing: .02em; 
  background: linear-gradient(135deg, rgba(0,224,255,.12), rgba(255,0,170,.12)); 
  border-bottom: 1px solid rgba(255,255,255,.08); 
}
.messages { 
  flex: 1 1 auto; 
  min-height: 120px; 
  overflow: auto; 
  padding: 12px 16px; 
  display: flex; 
  flex-direction: column; 
  gap: 10px; 
}
.msg { 
  padding: 10px 12px; 
  border-radius: 12px; 
  background: rgba(255,255,255,.04); 
  border: 1px solid rgba(255,255,255,.08); 
}
.msg .meta { 
  font-size: 12px; 
  color: var(--muted); 
  margin-bottom: 4px; 
}
.msg .content { 
  font-size: 14px; 
  white-space: pre-wrap; 
  word-break: break-word; 
}
.chat-input { 
  display: grid; 
  grid-template-columns: 160px 1fr auto; 
  gap: 10px; 
  padding: 12px 16px; 
  border-top: 1px solid rgba(255,255,255,.08); 
  flex: none; 
  padding-bottom: calc(12px + env(safe-area-inset-bottom)); 
}
.chat-input input { 
  height: 44px; 
  border-radius: 10px; 
  border: 1px solid rgba(255,255,255,.12); 
  background: rgba(255,255,255,.04); 
  color: var(--text); 
  padding: 8px 10px; 
  font-size: 16px; 
}
.chat-input button { 
  height: 44px; 
  border-radius: 10px; 
  border: 0; 
  padding: 0 16px; 
  font-weight: 700; 
  color: #fff; 
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2)); 
  box-shadow: 0 8px 20px rgba(0,224,255,.3), 0 6px 18px rgba(255,0,170,.25); 
  cursor: pointer; 
  touch-action: manipulation; 
}
.chat-hint { 
  padding: 8px 16px 16px; 
  color: var(--muted); 
  font-size: 12px; 
}

/* 个人中心页面增强样式 */
#profile-view {
  padding: 20px;
  overflow-y: auto;
  height: calc(100vh - var(--nav-h) - 20px);
}
.edit-profile-btn {
  margin-top: 10px;
  padding: 6px 16px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.edit-profile-btn:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.3);
}
.profile-header {
  display: flex;
  align-items: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  margin-bottom: 24px;
}
.user-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4b80ff, #6c8cff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin-right: 20px;
  color: white;
}
.profile-info {
  flex: 1;
}
.profile-name {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: white;
}
.profile-stats {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}
.profile-menu {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}
.menu-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.menu-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}
.menu-item.active {
  background-color: rgba(75, 128, 255, 0.2);
}
.menu-icon {
  font-size: 18px;
  margin-right: 8px;
}
.menu-text {
  color: white;
  font-size: 16px;
}
.profile-content {
  min-height: 200px;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* 增强的历史记录列表样式 */
.history-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.history-actions .text-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 4px;
  transition: background-color 0.2s;
}
.history-actions .text-btn:hover {
  background-color: rgba(75, 128, 255, 0.1);
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
}
.history-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.08);
}
.history-item .game-preview {
  width: 60px;
  height: 60px;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  margin-right: 16px;
  background-color: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.history-item .game-info {
  flex: 1;
}
.history-item .game-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
  color: white;
}
.history-item .game-time {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}
.history-item .continue-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #4b80ff, #6c8cff);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.history-item .continue-btn:hover {
  background: linear-gradient(135deg, #3a6cdd, #5b7ae0);
}

/* 响应式设计优化 */
@media (max-width: 600px) {
  .chat-input { grid-template-columns: 120px 1fr auto; }
}
@media (max-width: 440px) {
  .chat-input { 
    grid-template-columns: 1fr auto; 
    grid-template-rows: auto auto; 
  }
  #chat-username { grid-column: 1 / span 2; }
}

/* 视图切换样式 */
.view { 
  display: none; 
}
.view.active { 
  display: block; 
}

/* 进入游戏时隐藏header */
body.game-active header { 
  display: none; 
}

/* 游戏历史头部样式 */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.history-header h2, .history-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
}
.text-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.text-btn:hover {
  color: var(--neon-1);
  background-color: rgba(0,224,255,0.1);
}
.history-item .game-time { font-size: 14px; color: rgba(255,255,255,0.7); }
.history-item .continue-btn { padding: 8px 16px; background: linear-gradient(135deg, #4b80ff, #6c8cff); border: none; border-radius: 6px; color: white; font-size: 14px; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.history-item .continue-btn:hover { background: linear-gradient(135deg, #3a6cdd, #5b7ae0); }
#profile-history-grid, #history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 16px; min-height: 200px; }
#profile-history-grid .card, #history-grid .card { --glow: rgba(0,224,255,.55); --glow-2: rgba(255,0,170,.45); position: relative; display: flex; flex-direction: column; border-radius: 16px; color: var(--text); background: var(--bg-1); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 8px 24px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.04); overflow: hidden; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
#profile-history-grid .card::before, #history-grid .card::before { content: ""; position: absolute; inset: -1px; border-radius: 16px; padding: 1px; background: linear-gradient(135deg, var(--neon-1), transparent 30%), linear-gradient(315deg, var(--neon-2), transparent 30%), linear-gradient(90deg, transparent, rgba(255,255,255,.06)); -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000); mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: .35; transition: opacity .25s ease; }
#profile-history-grid .card:hover, #history-grid .card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,.15); box-shadow: 0 16px 36px rgba(0,0,0,.5), 0 0 24px var(--glow-2); }
#profile-history-grid .card:hover::before, #history-grid .card:hover::before { opacity: .65; }
#profile-history-grid .card-preview, #history-grid .card-preview { height: 160px; background-size: cover; background-position: center; }
#profile-history-grid .card-content, #history-grid .card-content { padding: 16px; }
#profile-history-grid .card-title, #history-grid .card-title { margin: 0 0 8px 0; font-size: 18px; font-weight: 600; color: var(--text); }
#profile-history-grid .card-hint, #history-grid .card-hint { margin: 0 0 12px 0; font-size: 14px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2; overflow: hidden; }
#profile-history-grid .card-footer, #history-grid .card-footer { display: flex; justify-content: space-between; align-items: center; }
#profile-history-grid .card-time, #history-grid .card-time { font-size: 12px; color: rgba(138,160,198,0.7); }
#profile-history-grid .play-btn, #history-grid .play-btn { padding: 6px 16px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 20px; font-size: 14px; cursor: pointer; transition: opacity 0.2s ease; }

/* 第二块样式 */
#home-view { overscroll-behavior-y: contain; }
.pull-refresh { position: fixed; top: 0; left: 0; right: 0; height: 0; display: flex; align-items: center; justify-content: center; gap: 8px; z-index: 20; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0)); color: var(--text); overflow: hidden; backdrop-filter: blur(6px); }
.pull-refresh .pr-icon { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: transparent; }
.pull-refresh .pr-icon.spin { animation: prspin .8s linear infinite; }
@keyframes prspin { to { transform: rotate(360deg); } }
#home-view .history-actions { display:flex; justify-content:flex-end; padding: 0 16px; }
#home-view .history-actions .text-btn { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; font-size: 14px; padding: 10px 0; }
.text-btn:hover { color: var(--text); }
.nav-item::before { content: ""; display:inline-block; margin-right:6px; font-size: 16px; }
.nav-item[data-view="home"]::before { content: "🏠"; }
.nav-item[data-view="chat"]::before { content: "💬"; }
.nav-item[data-view="profile"]::before { content: "👤"; }
#nav-refresh::before { content: "↻"; }
.tag { display:inline-block; padding:2px 8px; border-radius:12px; background: rgba(255,255,255,0.08); color:#ddd; font-size:12px; border:1px solid rgba(255,255,255,0.12); }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton .card { pointer-events:none; }
.skeleton .card-preview { background: linear-gradient(90deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton .name, .skeleton .hint { background: linear-gradient(90deg, rgba(255,255,255,0.06) 0, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 100%); color: transparent; border-radius: 6px; min-height: 14px; }

/* 第三块样式 */
.category-bar { display:flex; gap:8px; flex-wrap:wrap; margin: 12px 16px; overflow-x:auto; -webkit-overflow-scrolling: touch; }
.category-bar .cat-btn { padding:6px 10px; border-radius: 16px; background: rgba(255,255,255,0.08); color:#ddd; font-size: 14px; cursor:pointer; border: 1px solid rgba(255,255,255,0.12); }
.category-bar .cat-btn.active { background: #4cd2b5; color: #000; border-color: #4cd2b5; }
#home-view .grid .card.hidden { display: none !important; }
@media (max-width: 600px) { .category-bar { margin: 8px 12px; } .category-bar .cat-btn { font-size: 13px; } }

/* 游戏界面样式 - 参照旧版本完全照搬 */

/* 游戏容器样式 - 完全照搬旧版本样式 */
#game-view #game-container {
  display: flex;
  justify-content: center;
}

/* 游戏框架样式 - 完全照搬旧版本最大宽度420px */
#game-view #game-frame {
  max-width: 420px;
  height: calc(var(--vvh, 100dvh) - var(--nav-h) - env(safe-area-inset-bottom));
}

#game-view.active {
  min-height: calc(var(--vvh, 100dvh) - var(--nav-h) - env(safe-area-inset-bottom));
}

/* 底部导航栏始终显示，不再根据屏幕宽度隐藏 */
/* 注释掉之前的隐藏规则 */
/* @media screen and (orientation: landscape) and (min-width: 769px) {
  body.game-active .bottom-nav {
    transform: translateY(calc(100% + env(safe-area-inset-bottom)));
    transition: transform 0.3s ease;
  }
} */

/* 游戏加载状态样式 */
.game-loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text);
}

.game-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top: 3px solid var(--neon-1);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

.game-loading-text {
  font-size: 16px;
  color: var(--muted);
}

/* 游戏控制栏样式 - 统一手机端样式 */
.game-controls {
  position: fixed;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  z-index: 1000;
}

.game-control-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.game-control-btn:hover {
  background: rgba(0,0,0,0.8);
  border-color: var(--neon-1);
  box-shadow: 0 0 16px rgba(0,224,255,0.3);
}

/* 横屏时控制栏位置调整 */
@media screen and (orientation: landscape) {
  .game-controls {
    top: 10px;
    right: 10px;
  }
}

/* 竖屏时控制栏紧凑排列 */
@media screen and (orientation: portrait) {
  .game-controls {
    flex-direction: column;
    right: 5px;
  }
}

/* 游戏全屏状态样式 */
body.game-fullscreen {
  overflow: hidden;
}

body.game-fullscreen #game-view.active #game-frame {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0;
  z-index: 9999;
}

/* 游戏界面安全区域适配 */
@supports (padding: max(0px)) {
  #game-view.active {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  
  #game-view.active #game-container {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* 竖屏游戏手机端优化样式 */
.mobile-optimized {
  /* 隐藏浏览器界面元素 */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;

  /* 优化视窗高度 */
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);

  /* 隐藏滚动条 */
  overflow: hidden;
}

.mobile-optimized #game-view.active {
  padding: 0 !important;
  margin: 0 !important;
  height: calc(var(--vh, 1vh) * 100 - var(--nav-h) - env(safe-area-inset-bottom));
  overflow: hidden;
}

.mobile-optimized #game-view.active #game-container {
  padding: 0 !important;
  margin: 0 !important;
  height: calc(var(--vh, 1vh) * 100 - var(--nav-h) - env(safe-area-inset-bottom));
  overflow: hidden;
}

.mobile-optimized #game-view.active #game-frame {
  width: 100vw !important;
  height: calc(var(--vh, 1vh) * 100 - var(--nav-h) - env(safe-area-inset-bottom)) !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: none !important;
}

/* 底部导航栏始终显示，不再在移动设备上隐藏 */
/* 注释掉之前的隐藏规则 */
/* .mobile-optimized .bottom-nav {
  transform: translateY(calc(100% + env(safe-area-inset-bottom)));
  transition: transform 0.3s ease;
} */

/* 确保游戏控制按钮仍然可见 */
.mobile-optimized .game-controls {
  z-index: 10001;
  opacity: 0.8;
}

.mobile-optimized .game-controls:hover {
  opacity: 1;
}

/* 防止页面被意外缩放 */
.mobile-optimized * {
  touch-action: manipulation;
}

/* 安全区域适配 */
@supports (padding: max(0px)) {
  .mobile-optimized #game-view.active {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-top: max(0px, env(safe-area-inset-top));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

/* 注册冷却状态样式 */
.auth-btn.cooldown {
  background: linear-gradient(135deg, #666, #888);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
  overflow: hidden;
}

.auth-btn.cooldown:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.auth-btn.cooldown::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: cooldown-shimmer 2s infinite;
}

@keyframes cooldown-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.auth-btn.cooldown-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.cooldown-icon {
  font-size: 14px;
  animation: cooldown-pulse 1s infinite;
}

@keyframes cooldown-pulse {
  0% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.7; transform: scale(1); }
}

/* 移动端响应式调整 */
@media (max-width: 480px) {
  .auth-btn.cooldown-text {
    font-size: 14px;
  }
  
  .cooldown-icon {
    font-size: 12px;
  }
}
