/* Gundam War Mobile Suit Sci-Fi UI Style */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #030811;
  color: #fff;
}

#app-viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0b1528 0%, #03060c 100%);
  position: relative;
}

#game-stage {
  width: 960px;
  height: 640px;
  min-width: 960px;
  min-height: 640px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
  overflow: hidden;
  background-color: #0d1b2a;
  box-shadow: 0 0 40px rgba(0, 150, 255, 0.25);
  transform-origin: center center;
}

/* Screen Transitions */
.screen {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* Buttons */
.btn {
  background: linear-gradient(180deg, #1f4f89 0%, #0e2a4f 100%);
  border: 1px solid #3d84d6;
  border-radius: 6px;
  color: #e0f2fe;
  font-size: 15px;
  font-weight: bold;
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.1s, filter 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}

.btn:active {
  transform: scale(0.96);
  filter: brightness(1.2);
}

.btn-primary {
  background: linear-gradient(180deg, #ff9f1c 0%, #cc5500 100%);
  border-color: #ffd166;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.btn-gold {
  background: linear-gradient(180deg, #ffd700 0%, #d4af37 50%, #996515 100%);
  border-color: #fff3a8;
  color: #1a1000;
  font-weight: 800;
}

.btn-danger {
  background: linear-gradient(180deg, #e63946 0%, #9b1d20 100%);
  border-color: #f28482;
}

.btn-sm {
  font-size: 13px;
  padding: 4px 10px;
  min-height: 36px;
}

/* Common Header HUD */
.top-hud {
  width: 100%;
  height: 60px;
  background: linear-gradient(180deg, rgba(8, 20, 38, 0.95) 0%, rgba(13, 27, 42, 0.8) 100%);
  border-bottom: 1px solid rgba(0, 200, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.hud-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-avatar-box {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 2px solid #ffd700;
  overflow: hidden;
  background: #111;
  position: relative;
}

.hud-avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hud-player-info {
  display: flex;
  flex-direction: column;
}

.hud-player-name {
  font-size: 14px;
  font-weight: bold;
  color: #f1f5f9;
}

.hud-player-level {
  font-size: 12px;
  color: #38bdf8;
}

.hud-currencies {
  display: flex;
  align-items: center;
  gap: 14px;
}

.currency-badge {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 3px 12px 3px 6px;
  gap: 6px;
  font-size: 13px;
  font-weight: bold;
}

.currency-badge.gold { color: #facc15; border-color: rgba(250, 204, 21, 0.3); }
.currency-badge.diamond { color: #38bdf8; border-color: rgba(56, 189, 248, 0.3); }
.currency-badge.energy { color: #4ade80; border-color: rgba(74, 222, 128, 0.3); }

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ================= TITLE SCREEN ================= */
#screen-title {
  background: #091322 url('res/ui/UI_bg_logo.jpg') center center/cover no-repeat;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.title-box {
  background: rgba(10, 25, 47, 0.85);
  border: 1px solid rgba(0, 200, 255, 0.35);
  border-radius: 12px;
  padding: 24px 32px;
  width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.title-heading {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #f8fafc;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.login-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #38bdf8;
  border-radius: 6px;
  color: #fff;
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
  text-align: center;
}

.login-input:focus {
  border-color: #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* ================= MAIN CITY SCREEN ================= */
#screen-main {
  background: url('res/ui/UI_bg_jidi_01.jpg') center center/cover no-repeat;
}

.city-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Floating Building Nodes */
.city-building {
  position: absolute;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s, filter 0.2s;
}

.city-building:active {
  transform: scale(0.95);
}

.building-glow {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4) 0%, rgba(13, 27, 42, 0.8) 70%);
  border: 2px solid #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
}

.building-glow img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.building-glow.gold {
  border-color: #facc15;
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.6);
  background: radial-gradient(circle, rgba(250, 204, 21, 0.4) 0%, rgba(13, 27, 42, 0.8) 70%);
}

.building-glow.red {
  border-color: #f87171;
  box-shadow: 0 0 15px rgba(248, 113, 113, 0.6);
  background: radial-gradient(circle, rgba(248, 113, 113, 0.4) 0%, rgba(13, 27, 42, 0.8) 70%);
}

.building-glow.purple {
  border-color: #c084fc;
  box-shadow: 0 0 15px rgba(192, 132, 252, 0.6);
  background: radial-gradient(circle, rgba(192, 132, 252, 0.4) 0%, rgba(13, 27, 42, 0.8) 70%);
}

.building-label {
  margin-top: 6px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 1px;
}

/* Bottom Nav Bar */
.bottom-dock {
  height: 72px;
  background: linear-gradient(0deg, rgba(8, 20, 38, 0.95) 0%, rgba(13, 27, 42, 0.85) 100%);
  border-top: 1px solid rgba(0, 200, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 20px;
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  transition: color 0.15s, transform 0.15s;
}

.dock-item:active, .dock-item.active {
  color: #38bdf8;
  transform: scale(1.05);
}

.dock-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.dock-item.main-battle {
  color: #facc15;
}

.dock-item.main-battle .dock-icon {
  background: linear-gradient(135deg, #e63946, #b21e27);
  border-color: #ffd166;
  width: 44px;
  height: 44px;
  font-size: 22px;
  box-shadow: 0 0 10px rgba(230, 57, 70, 0.5);
}

/* ================= CHAPTER / STAGE SELECT ================= */
#screen-chapters {
  background: url('res/ui/UI_putongfuben_beijingditu.jpg') center center/cover no-repeat;
}

.chapter-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(10, 25, 47, 0.85);
  border-bottom: 1px solid rgba(56, 189, 248, 0.3);
}

.chapter-title {
  font-size: 18px;
  font-weight: bold;
  color: #f8fafc;
}

.stage-map-area {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 20px 40px;
}

.mission-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s;
}

.mission-node:active {
  transform: scale(0.95);
}

.mission-avatar {
  width: 76px;
  height: 76px;
  border-radius: 12px;
  border: 2px solid #38bdf8;
  background: #0f172a;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
  overflow: hidden;
  position: relative;
}

.mission-avatar.boss {
  border-color: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
}

.mission-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mission-stars {
  color: #facc15;
  font-size: 14px;
  letter-spacing: 2px;
}

.mission-name {
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: bold;
  color: #e2e8f0;
}

/* ================= BATTLE VIEW ================= */
#screen-battle {
  background: url('res/battle/scene/space_01/space_sky_01.jpg') center center/cover no-repeat;
  position: relative;
}

.battle-hud {
  height: 48px;
  background: rgba(5, 12, 24, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.battle-round {
  font-size: 16px;
  font-weight: bold;
  color: #38bdf8;
}

.battle-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.battlefield {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 50px;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 94px);
  grid-template-rows: repeat(2, 130px);
  gap: 14px 18px;
}

.unit-card {
  width: 94px;
  height: 130px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px;
  position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s, box-shadow 0.2s;
}

.unit-card.ally {
  border-color: #38bdf8;
}

.unit-card.enemy {
  border-color: #f87171;
}

.unit-card.active-attacker {
  box-shadow: 0 0 20px #ffd700;
  border-color: #ffd700;
  transform: scale(1.08);
  z-index: 10;
}

.unit-card.hit-shake {
  animation: shake 0.3s ease-in-out;
}

.unit-avatar {
  width: 74px;
  height: 74px;
  border-radius: 6px;
  background: #000;
  overflow: hidden;
  position: relative;
}

.unit-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.unit-name {
  font-size: 11px;
  font-weight: bold;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 84px;
}

.hp-bar-outer {
  width: 82px;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.hp-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #86efac);
  width: 100%;
  transition: width 0.3s ease-out;
}

.unit-card.enemy .hp-bar-inner {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.fury-dots {
  display: flex;
  gap: 3px;
  margin-top: 3px;
}

.fury-dot {
  width: 16px;
  height: 4px;
  border-radius: 2px;
  background: #475569;
}

.fury-dot.full {
  background: #eab308;
  box-shadow: 0 0 5px #facc15;
}

.floating-damage {
  position: absolute;
  font-size: 20px;
  font-weight: 900;
  color: #ef4444;
  text-shadow: 0 2px 4px #000, 0 0 8px rgba(255, 0, 0, 0.8);
  animation: floatUp 0.9s forwards ease-out;
  pointer-events: none;
  z-index: 99;
}

.floating-damage.crit {
  font-size: 26px;
  color: #fbbf24;
  text-shadow: 0 2px 6px #000, 0 0 12px #f59e0b;
}

.floating-damage.heal {
  font-size: 20px;
  color: #4ade80;
  text-shadow: 0 2px 4px #000, 0 0 8px #22c55e;
}

/* Skill Cut-In */
.skill-cutin-banner {
  position: absolute;
  top: 40%;
  left: 0;
  right: 0;
  height: 90px;
  background: linear-gradient(90deg, transparent 0%, rgba(15, 23, 42, 0.9) 20%, rgba(15, 23, 42, 0.9) 80%, transparent 100%);
  border-top: 2px solid #ffd700;
  border-bottom: 2px solid #ffd700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 150;
  pointer-events: none;
  animation: cutinIn 1.2s forwards;
}

.skill-cutin-name {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffd700;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

/* ================= MODAL DIALOGS ================= */
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-mask.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0d1b2a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 800px;
  width: 90%;
  max-height: 540px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  position: relative;
}

.modal-title {
  font-size: 20px;
  font-weight: bold;
  color: #38bdf8;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}

/* Victory Modal */
.victory-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.victory-title {
  font-size: 34px;
  font-weight: 900;
  color: #facc15;
  text-shadow: 0 0 20px rgba(250, 204, 21, 0.8);
  letter-spacing: 4px;
}

.victory-stars {
  font-size: 28px;
  color: #facc15;
  letter-spacing: 6px;
}

.rewards-grid {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 10px 0;
}

.reward-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 70px;
}

/* Garage & Lineup */
.lineup-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.lineup-slot {
  border: 1px dashed rgba(56, 189, 248, 0.5);
  border-radius: 8px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px;
  transition: border-color 0.15s;
}

.lineup-slot.filled {
  border-style: solid;
  border-color: #38bdf8;
}

/* Gacha Summon */
.gacha-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 30px;
}

.gacha-banners {
  display: flex;
  gap: 30px;
  justify-content: center;
}

.gacha-card {
  width: 280px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #38bdf8;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.gacha-card.gold {
  border-color: #facc15;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.25);
}

/* Animations */
@keyframes floatUp {
  0% { transform: translateY(0) scale(0.8); opacity: 0; }
  20% { transform: translateY(-10px) scale(1.1); opacity: 1; }
  100% { transform: translateY(-36px) scale(0.9); opacity: 0; }
}

@keyframes cutinIn {
  0% { transform: scaleX(0); opacity: 0; }
  20% { transform: scaleX(1); opacity: 1; }
  80% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1.1); opacity: 0; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
