/* ============================================================
   BASE.CSS — CSS变量、全局重置、布局框架、导航
   ============================================================ */

:root {
  --bg-deep: #1a1040;
  --bg-card: #2d1f6e;
  --bg-card2: #3a2880;
  --accent-purple: #7c3aed;
  --accent-pink: #db2777;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-orange: #f97316;
  --accent-blue: #3b82f6;
  --text-white: #ffffff;
  --text-gray: #a78bfa;
  --gold: #ffd700;
  --sidebar-w: 190px;
  --header-h: 60px;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--bg-deep); color: var(--text-white); font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.15); }
::-webkit-scrollbar-thumb { background: rgba(124,58,237,.45); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,.7); }

/* ===== 通用按钮 ===== */
.btn-primary { width: 100%; padding: 13px; background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink)); border: none; border-radius: 12px; color: white; font-size: 1rem; font-weight: 700; cursor: pointer; transition: all .3s; margin-bottom: 9px; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(124,58,237,.5); }
.btn-guest { width: 100%; padding: 11px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); border-radius: 12px; color: var(--text-gray); font-size: .9rem; cursor: pointer; transition: all .3s; }
.btn-guest:hover { background: rgba(255,255,255,.15); }

/* ===== 登录 ===== */
#login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1a1040, #2d1f6e 50%, #1a1040);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; overflow-y: auto; padding: 20px;
}
.login-box { background: rgba(45,31,110,.97); border: 2px solid var(--accent-purple); border-radius: 20px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 0 60px rgba(124,58,237,.4); }
.login-title { text-align: center; font-size: 1.9rem; font-weight: 900; background: linear-gradient(to right, #ffd700, #ff9800); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 6px; }
.login-subtitle { text-align: center; color: var(--text-gray); margin-bottom: 24px; font-size: .85rem; }
.login-tabs { display: flex; margin-bottom: 20px; background: rgba(0,0,0,.3); border-radius: 10px; padding: 4px; }
.tab-btn { flex: 1; padding: 8px; border: none; border-radius: 8px; background: transparent; color: var(--text-gray); cursor: pointer; font-size: .9rem; transition: all .3s; }
.tab-btn.active { background: var(--accent-purple); color: white; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; color: var(--text-gray); font-size: .82rem; margin-bottom: 5px; }
.form-group input { width: 100%; padding: 11px 14px; background: rgba(0,0,0,.3); border: 1px solid rgba(124,58,237,.4); border-radius: 10px; color: white; font-size: .92rem; transition: border-color .3s; outline: none; }
.form-group input:focus { border-color: var(--accent-purple); }
.login-msg { text-align: center; font-size: .82rem; margin-top: 8px; min-height: 18px; }
.login-msg.error { color: #f87171; }
.login-msg.success { color: var(--accent-green); }

/* ===== 游戏整体布局 ===== */
#game-screen { display: none; height: 100vh; flex-direction: column; }
#game-screen.visible { display: flex; }
.game-header {
  height: var(--header-h); min-height: var(--header-h);
  background: rgba(20,10,55,.97); border-bottom: 1px solid rgba(124,58,237,.3);
  padding: 0 14px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; z-index: 100; flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.world-title { font-size: 1.1rem; font-weight: 900; white-space: nowrap; background: linear-gradient(to right, #ffd700, #ff9800); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.money-display { background: linear-gradient(135deg, #064e3b, #065f46); border: 1.5px solid var(--accent-green); border-radius: 24px; padding: 5px 14px; display: flex; align-items: center; gap: 6px; font-size: 1rem; font-weight: 800; color: #86efac; white-space: nowrap; }
.income-badge { background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.3); border-radius: 16px; padding: 4px 10px; color: #86efac; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.hbtn { background: rgba(124,58,237,.25); border: 1px solid rgba(124,58,237,.4); border-radius: 8px; color: white; padding: 6px 10px; cursor: pointer; font-size: .8rem; transition: all .2s; white-space: nowrap; }
.hbtn:hover { background: rgba(124,58,237,.5); }
.hbtn-save { background: linear-gradient(135deg, #10b981, #059669); border-color: #10b981; }
.hbtn-prestige { background: linear-gradient(135deg, #7c3aed, #db2777); border: none; font-weight: 700; }
.game-body { flex: 1; display: flex; overflow: hidden; }

/* ===== 侧边栏 ===== */
.sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: rgba(20,10,55,.85); border-right: 1px solid rgba(124,58,237,.2); display: flex; flex-direction: column; gap: 10px; padding: 12px 10px; overflow-y: auto; flex-shrink: 0; }
.player-card { background: var(--bg-card); border-radius: 12px; padding: 12px; text-align: center; border: 1px solid rgba(124,58,237,.3); }
.player-avatar { width: 52px; height: 52px; background: linear-gradient(135deg, #7c3aed, #db2777); border-radius: 50%; margin: 0 auto 7px; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; }
.player-name { font-weight: 700; color: var(--gold); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-sub { color: var(--text-gray); font-size: .72rem; margin-top: 2px; }
.player-xp-bar { height: 5px; background: rgba(0,0,0,.3); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.player-xp-fill { height: 100%; background: linear-gradient(to right, #f59e0b, #ef4444); border-radius: 3px; transition: width .4s; }
.income-stat { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.25); border-radius: 9px; padding: 8px; text-align: center; }
.income-stat-label { color: var(--text-gray); font-size: .7rem; }
.income-stat-val { color: #86efac; font-size: .95rem; font-weight: 700; }
.sidebar-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 7px; background: rgba(124,58,237,.12); border: 1px solid rgba(124,58,237,.18); border-radius: 9px; padding: 9px 10px; cursor: pointer; transition: all .2s; font-size: .82rem; }
.nav-item:hover { background: rgba(124,58,237,.3); transform: translateX(3px); }
.nav-item.active { background: rgba(124,58,237,.38); border-color: var(--accent-purple); }
.nav-icon { font-size: 1.1rem; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--accent-pink); border-radius: 10px; padding: 1px 6px; font-size: .7rem; font-weight: 700; }
.prestige-stat { background: linear-gradient(135deg, rgba(124,58,237,.18), rgba(219,39,119,.18)); border: 1px solid rgba(124,58,237,.35); border-radius: 10px; padding: 10px; }
.prestige-stat-title { font-size: .72rem; color: var(--text-gray); margin-bottom: 3px; }
.prestige-stat-val { font-size: 1.1rem; font-weight: 700; color: #c084fc; }
.prestige-stat-sub { font-size: .7rem; color: var(--text-gray); }

/* ===== 手机底部导航 ===== */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: rgba(20,10,55,.97); border-top: 1px solid rgba(124,58,237,.3); padding: 6px 0 env(safe-area-inset-bottom, 6px); z-index: 200; }
.mobile-nav-inner { display: flex; justify-content: space-around; align-items: center; }
.mnav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; cursor: pointer; color: var(--text-gray); font-size: .6rem; transition: color .2s; min-width: 44px; }
.mnav-item .mnav-icon { font-size: 1.3rem; }
.mnav-item.active, .mnav-item:hover { color: white; }
.mnav-item.active .mnav-icon { filter: drop-shadow(0 0 4px #a78bfa); }

/* ===== 主内容区 ===== */
.main-content { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.qty-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.qty-opt { padding: 5px 12px; background: rgba(124,58,237,.18); border: 1px solid rgba(124,58,237,.35); border-radius: 8px; color: white; cursor: pointer; font-size: .8rem; font-weight: 600; transition: all .2s; }
.qty-opt.active { background: var(--accent-purple); border-color: var(--accent-purple); }
.qty-label { color: var(--text-gray); font-size: .8rem; margin-right: 2px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.section-title { font-size: 1rem; font-weight: 700; color: white; }
.section-sub { color: var(--text-gray); font-size: .78rem; }
.info-chip { background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.3); border-radius: 10px; padding: 6px 12px; font-size: .78rem; }

/* ===== 通知 & 浮动数字 ===== */
#notif-container { position: fixed; top: 70px; right: 14px; z-index: 400; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.notif { background: linear-gradient(135deg, #2d1f6e, #3a2880); border: 1px solid rgba(124,58,237,.5); border-radius: 11px; padding: 11px 16px; max-width: 280px; box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: notifIn .3s ease; }
@keyframes notifIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.notif-title { font-weight: 700; font-size: .85rem; color: var(--gold); margin-bottom: 2px; }
.notif-body { color: #ddd; font-size: .78rem; }
.float-num { position: fixed; font-size: 1rem; font-weight: 700; color: var(--gold); pointer-events: none; z-index: 450; animation: floatUp 1.1s ease forwards; }
@keyframes floatUp { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-70px); opacity: 0; } }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; --header-h: 54px; }
  .sidebar { display: none !important; }
  .mobile-nav { display: block; }
  .main-content { padding: 10px 10px 72px; }
  .game-header { padding: 0 10px; gap: 5px; }
  .world-title { font-size: .9rem; }
  .money-display { padding: 4px 9px; font-size: .85rem; }
  .income-badge { display: none; }
  .hbtn-save { display: none; }
  .qty-opt { padding: 4px 8px; font-size: .72rem; }
}
@media (min-width: 641px) and (max-width: 900px) {
  :root { --sidebar-w: 160px; }
}
