:root {
  --bg-deep: #060916;
  --bg-card: rgba(15, 23, 42, 0.86);
  --bg-glass: rgba(30, 41, 59, 0.72);
  --border-subtle: rgba(148, 163, 184, 0.18);
  --border-glow: rgba(56, 189, 248, 0.45);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-red: #ef4444;
  --accent-blue: #38bdf8;
  --accent-purple: #a855f7;
  --accent-gold: #fde047;
  --accent-green: #4ade80;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

 input, select, textarea {
  user-select: text;
  -webkit-user-select: text;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 0%, #172554 0%, #090d20 55%, #050711 100%);
  color: var(--text-main);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  overscroll-behavior: none;
}

.hidden {
  display: none !important;
}

/* ==================== 顶部通用安全区容器 ==================== */
.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(14px, env(safe-area-inset-top))
    14px
    max(24px, env(safe-area-inset-bottom))
    14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ==================== 登录门户视图 ==================== */
.auth-hero {
  text-align: center;
  padding: 18px 10px 6px;
}

.auth-logo {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 12px 32px rgba(56, 189, 248, 0.42), 0 0 0 2px rgba(253, 224, 71, 0.55);
  margin-bottom: 10px;
  object-fit: cover;
}

.eyebrow-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--accent-gold);
  background: rgba(253, 224, 71, 0.12);
  border: 1px solid rgba(253, 224, 71, 0.35);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.auth-title {
  margin: 4px 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 0%, #93c5fd 55%, #f43f5e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.tabs-bar {
  display: flex;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 800;
  padding: 9px 0;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: linear-gradient(135deg, #2563eb, #ef4444);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 700;
  color: #cbd5e1;
}

.input-box {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  font-size: 15px;
  outline: none;
}

.input-box:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.btn-primary {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #2563eb 100%);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.38);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary:active {
  transform: scale(0.96);
}

/* ==================== 顶部用户信息栏 ==================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 10px 14px;
  border-radius: 18px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
}

.station-logo {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.38), 0 0 0 1.5px rgba(253, 224, 71, 0.55);
  flex-shrink: 0;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ef4444, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
}

.role-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent-blue);
}

.role-tag.admin {
  background: rgba(253, 224, 71, 0.2);
  color: var(--accent-gold);
}

.medal-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(253, 224, 71, 0.14);
  border: 1px solid rgba(253, 224, 71, 0.35);
  color: var(--accent-gold);
  padding: 5px 11px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13.5px;
}

/* ==================== 游戏集合大厅与雷电机库 ==================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 6px;
}

.games-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.game-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.game-card.featured {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.92), rgba(69, 10, 10, 0.88));
  border-color: rgba(239, 68, 68, 0.55);
}

.game-badge {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.hangar-hero-banner {
  position: relative;
  margin: -16px -16px 14px -16px;
  height: 118px;
  overflow: hidden;
  border-bottom: 1px solid rgba(56, 189, 248, 0.35);
}

.hangar-hero-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 65%;
  filter: saturate(1.2) contrast(1.08);
}

.hangar-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(6, 9, 22, 0.88) 0%, rgba(6, 9, 22, 0.45) 65%, rgba(6, 9, 22, 0.75) 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hangar-boss-preview {
  width: 76px;
  height: 76px;
  object-fit: contain;
  transform: rotate(180deg);
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.65));
  animation: floatFighter 2.8s ease-in-out infinite;
}

@keyframes floatFighter {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.fighter-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.fighter-card {
  background: radial-gradient(circle at 50% 35%, rgba(30, 58, 138, 0.45) 0%, rgba(15, 23, 42, 0.92) 75%);
  border: 2px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
}

.fighter-card.active {
  border-color: var(--accent-gold);
  background: radial-gradient(circle at 50% 35%, rgba(239, 68, 68, 0.35) 0%, rgba(30, 41, 59, 0.96) 75%);
  box-shadow: 0 0 18px rgba(253, 224, 71, 0.32);
}

.f-sprite-wrap {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.f-sprite-img {
  width: 52px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(56, 189, 248, 0.45));
  animation: floatFighter 2.4s ease-in-out infinite;
}

.fighter-card.active .f-sprite-img {
  filter: drop-shadow(0 0 14px rgba(253, 224, 71, 0.75));
  transform: scale(1.06);
}

.w-btn-ico {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 3px;
}

.fighter-card .f-name {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

.fighter-card .f-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.option-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.opt-pill {
  flex: 1;
  min-width: 68px;
  text-align: center;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-muted);
  cursor: pointer;
}

.opt-pill.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-blue);
  color: #fff;
}

.opt-pill.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==================== 机库强化列表 ==================== */
.upgrade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.upgrade-item {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.upgrade-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
}

.upgrade-lv {
  color: var(--accent-gold);
  font-size: 11px;
}

/* ==================== 全屏雷电战斗舞台 ==================== */
#gameScreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background: #030611;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  touch-action: none;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#raidenCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* 顶部战斗 HUD */
.hud-top {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.hud-box {
  background: rgba(6, 10, 25, 0.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-btn {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* Boss 顶部血条 */
.boss-hud {
  background: rgba(69, 10, 10, 0.85);
  border: 1px solid #ef4444;
  border-radius: 10px;
  padding: 5px 10px;
}

.boss-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.boss-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #fde047, #ef4444);
  transition: width 0.08s linear;
}

/* 底部拇指操控区：左武器切换 + 右侧必杀核弹大按钮 */
.hud-bottom {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.weapon-Matrix {
  pointer-events: auto;
  display: flex;
  gap: 6px;
}

.w-switch-btn {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  border-radius: 11px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.w-switch-btn.active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(253, 224, 71, 0.45);
}

.bomb-fab {
  pointer-events: auto;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2.5px solid #fde047;
  background: radial-gradient(circle at 35% 30%, #fb923c, #dc2626 70%, #7f1d1d 100%);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.6), inset 0 2px 6px rgba(255, 255, 255, 0.4);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  cursor: pointer;
}

.bomb-fab:active {
  transform: scale(0.92);
}

/* ==================== 弹窗遮罩 ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 17, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-box {
  width: 100%;
  max-width: 410px;
  max-height: 86dvh;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

/* ==================== 排行榜与管理员用户列表 ==================== */
.rank-list, .admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-row, .admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
}

.rank-num {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 12px;
}

.rank-num.top1 { background: #eab308; color: #000; }
.rank-num.top2 { background: #94a3b8; color: #000; }
.rank-num.top3 { background: #d97706; color: #000; }

.toast-banner {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--accent-blue);
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  z-index: 400;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}
