:root {
  --bg: #0b0f14;
  --panel: #141b24;
  --accent: #00e5ff;
  --accent2: #ff9100;
  --text: #e6f0f5;
  --danger: #ff3d3d;
  --muted: #8fa3b3;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  height: 100%;
  width: 100%;
}

.screen {
  display: none;
  height: 100%;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen.active {
  display: flex;
}

#game-container.active {
  display: block;
  padding: 0;
  position: relative;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #0d1218;
  cursor: crosshair;
}

/* 登录注册 */
.auth-box {
  background: var(--panel);
  padding: 32px;
  border-radius: 12px;
  min-width: 340px;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.18);
  border: 1px solid #1f2d3a;
}

h1, h2 {
  margin-bottom: 16px;
  text-align: center;
  letter-spacing: 2px;
}

#auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab, .shop-tab, .inv-tab {
  flex: 1;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 8px;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 700;
}

.tab.active, .shop-tab.active, .inv-tab.active {
  background: var(--accent);
  color: #000;
}

.shop-tabs, .inv-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  max-width: 960px;
  width: 100%;
}

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

.form.hidden, .shop-panel.hidden, .inv-panel.hidden {
  display: none;
}

input {
  padding: 10px;
  border: 1px solid #2a3a4a;
  border-radius: 6px;
  background: #0d1218;
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--accent);
}

button {
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
}

button:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.msg {
  color: var(--danger);
  min-height: 20px;
  font-size: 14px;
}

/* 主菜单 */
.menu-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  pointer-events: none;
  z-index: 100;
}

.menu-header > * {
  pointer-events: auto;
}

.menu-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.logo {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

.rank-top-btn {
  background: var(--panel);
  border: 1px solid #2a3a4a;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  padding: 8px 16px;
  pointer-events: auto;
}

.rank-top-btn:hover {
  border-color: var(--accent);
}

#menu-rank-icon {
  font-size: 22px;
}

#menu-rank {
  color: var(--accent2);
  font-weight: 700;
}

.mode-toggle-btn {
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--accent);
  cursor: pointer;
  pointer-events: auto;
  z-index: 200;
}

.mode-toggle-btn:hover {
  background: var(--accent);
  color: #000;
  transform: translateY(-1px);
}

.corner-btn {
  background: var(--accent2);
}

.menu-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding-top: 140px;
}

.big-btn {
  font-size: 30px;
  padding: 22px 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #0088ff);
  box-shadow: 0 0 28px rgba(0, 229, 255, 0.32);
}

.menu-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

/* 排位系统 */
.rank-card {
  background: var(--panel);
  border-radius: 14px;
  padding: 28px 40px;
  text-align: center;
  border: 1px solid #2a3a4a;
  min-width: 320px;
  margin-bottom: 20px;
}

.rank-icon-big {
  font-size: 64px;
  margin-bottom: 8px;
}

.rank-name {
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 14px;
}

.rank-progress-wrap {
  margin-bottom: 10px;
}

.rank-progress-bar {
  width: 100%;
  height: 18px;
  background: #0d1218;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid #2a3a4a;
  margin-bottom: 6px;
}

#rank-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.3s;
}

.rank-progress-text {
  color: var(--muted);
  font-size: 14px;
}

.rank-next {
  color: var(--accent2);
  font-size: 14px;
  margin-top: 4px;
}

.rank-rewards {
  width: 100%;
  max-width: 960px;
}

.rank-rewards h3 {
  text-align: center;
  margin-bottom: 10px;
  color: var(--text);
}

/* 每日任务 */
.task-list {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.task-item {
  background: var(--panel);
  border-radius: 10px;
  padding: 16px 20px;
  border: 1px solid #2a3a4a;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item.completed {
  border-color: var(--accent);
}

.task-item.claimed {
  opacity: 0.6;
}

.task-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-text {
  font-weight: 700;
}

.task-reward {
  color: var(--accent2);
  font-size: 14px;
}

.task-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-progress-bar {
  flex: 1;
  height: 10px;
  background: #0d1218;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #2a3a4a;
}

.task-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

.task-progress-text {
  font-size: 13px;
  color: var(--muted);
  min-width: 60px;
  text-align: right;
}

/* 难度选择 */
.diff-desc {
  color: var(--muted);
  margin-bottom: 16px;
}

.diff-btns {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
  max-width: 600px;
  width: 100%;
}

.diff-btn {
  background: var(--panel);
  border: 1px solid #2a3a4a;
  color: var(--text);
  padding: 18px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diff-btn:hover {
  border-color: var(--accent);
}

.diff-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.diff-bonus {
  font-size: 13px;
  color: var(--muted);
}

/* HUD */
#game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  padding: 16px 22px;
}

.hud-left, .hud-right, .hud-center {
  pointer-events: auto;
}

.hp-bar {
  width: 170px;
  height: 16px;
  background: #222;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 6px;
  border: 1px solid #2a3a4a;
}

#hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00ff88, var(--accent));
  transition: width 0.1s;
}

#ammo-text, #weapon-name, #enemies-text, #loot-text {
  font-size: 14px;
  color: var(--muted);
}

.hud-center {
  align-self: flex-start;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

.hud-right {
  text-align: right;
}

#quit-game-btn {
  margin-top: 8px;
  background: var(--danger);
  color: #fff;
}

#crosshair {
  position: absolute;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
}

.crosshair-line {
  position: absolute;
  background: rgba(0, 229, 255, 0.85);
}

.crosshair-h {
  width: 100%;
  height: 2px;
  top: 50%;
  left: 0;
}

.crosshair-v {
  width: 2px;
  height: 100%;
  left: 50%;
  top: 0;
}

#reload-overlay {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  color: var(--accent2);
  background: rgba(0, 0, 0, 0.7);
  padding: 12px 26px;
  border-radius: 8px;
}

#pickup-toast {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: var(--accent);
  padding: 10px 22px;
  border-radius: 6px;
  font-weight: 700;
}

/* MOBA HUD */
#game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 22px;
}

.hud-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.score-board {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.65);
  padding: 8px 24px;
  border-radius: 10px;
  font-size: 28px;
  font-weight: 900;
}

.team-score.blue {
  color: #2196f3;
}

.team-score.red {
  color: #f44336;
}

.score-sep {
  color: var(--text);
  opacity: 0.6;
}

.match-timer {
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.match-objective {
  background: rgba(0, 0, 0, 0.55);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 13px;
}

.hud-left {
  position: absolute;
  bottom: 110px;
  left: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.hero-avatar {
  width: 54px;
  height: 54px;
  background: var(--panel);
  border: 2px solid var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 170px;
}

.hp-bar, .mp-bar, .xp-bar {
  height: 10px;
  background: #222;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #2a3a4a;
}

.hero-hp #hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #00ff88, var(--accent));
  transition: width 0.1s;
}

#mp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #448aff, #00e5ff);
  transition: width 0.1s;
}

#xp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff9100, #ffeb3b);
  transition: width 0.1s;
}

.hero-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
}

#hero-level {
  color: var(--accent);
}

#hero-gold {
  color: var(--accent2);
}

.hud-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.skill-bar {
  display: flex;
  gap: 12px;
}

.skill {
  position: relative;
  width: 58px;
  height: 58px;
  background: var(--panel);
  border: 2px solid #2a3a4a;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.skill:hover {
  border-color: var(--accent);
}

.skill-key {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.skill-icon {
  font-size: 24px;
  margin-top: 6px;
}

.skill-name {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.skill-cd {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  pointer-events: none;
}

.shop-skill {
  border-color: var(--accent2);
}

.attack-hint {
  background: rgba(0, 0, 0, 0.55);
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.hud-right {
  position: absolute;
  top: 16px;
  right: 22px;
  pointer-events: auto;
}

.hud-right #quit-game-btn {
  background: var(--danger);
  color: #fff;
}

#shop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: auto;
}

.shop-box {
  background: var(--panel);
  border: 1px solid #2a3a4a;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 480px;
  max-height: 70vh;
  overflow: auto;
}

.shop-box h3 {
  text-align: center;
  margin-bottom: 8px;
  color: var(--accent);
}

.shop-gold {
  text-align: center;
  color: var(--accent2);
  font-weight: 700;
  margin-bottom: 16px;
}

.shop-items {
  display: grid;
  gap: 10px;
}

.shop-item {
  background: #0d1218;
  border: 1px solid #223342;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shop-item-name {
  font-weight: 700;
}

.shop-item-cost {
  color: var(--accent2);
  font-size: 13px;
}

.shop-item button {
  padding: 6px 12px;
  font-size: 13px;
}

#game-toast {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: var(--accent);
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 700;
  z-index: 40;
}

#death-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 45;
}

#death-overlay div:first-child {
  font-size: 48px;
  font-weight: 900;
  color: var(--danger);
  text-shadow: 0 0 20px rgba(244, 67, 54, 0.6);
}

#death-timer {
  font-size: 18px;
  color: var(--text);
  margin-top: 8px;
}

/* 通用 */
.hidden {
  display: none !important;
}

.menu-subinfo {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

#menu-stars {
  color: var(--accent);
  font-weight: 700;
}

#menu-trophies {
  color: var(--accent2);
}

.back-btn {
  margin-top: 20px;
  background: #2a3a4a;
  color: var(--text);
}

.danger-btn {
  background: var(--danger);
  color: #fff;
}

.shop-header {
  text-align: center;
  margin-bottom: 8px;
}

.gold-display {
  color: var(--accent2);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 960px;
  max-height: 50vh;
  overflow: auto;
  padding: 8px;
}

.card {
  background: var(--panel);
  border-radius: 10px;
  padding: 16px;
  border: 1px solid #223342;
}

.card h3 {
  margin-bottom: 8px;
  color: var(--accent);
}

.card p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.card button {
  margin-top: 10px;
  width: 100%;
}

.empty-hint {
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.sell-summary {
  color: var(--accent2);
  font-weight: 700;
  margin-bottom: 8px;
}

.sell-all-btn {
  margin-top: 12px;
  width: 100%;
  max-width: 960px;
  background: var(--accent2);
}

.shop-panel, .inv-panel {
  width: 100%;
  max-width: 960px;
  max-height: 55vh;
  overflow: auto;
}

.skin-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(255,255,255,0.3);
}

.profile-card {
  background: var(--panel);
  padding: 24px 32px;
  border-radius: 12px;
  min-width: 320px;
  border: 1px solid #223342;
}

.profile-card p {
  margin-bottom: 10px;
  font-size: 15px;
}

.profile-card span {
  color: var(--accent);
  font-weight: 700;
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* 排行榜 */
.leaderboard-box {
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid #223342;
  max-width: 720px;
  width: 100%;
  max-height: 60vh;
  overflow: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid #223342;
}

.leaderboard-table th {
  color: var(--accent);
  font-weight: 700;
  background: #0d1218;
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table td:first-child {
  color: var(--accent2);
  font-weight: 700;
}

/* 结算 */
.overlay {
  background: rgba(0, 0, 0, 0.85);
}

.result-box {
  background: var(--panel);
  padding: 36px;
  border-radius: 12px;
  text-align: center;
  min-width: 300px;
  border: 1px solid #223342;
}

.result-box h2 {
  color: var(--accent);
  margin-bottom: 12px;
}

.result-box p {
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.6;
}
