:root {
  --bg-color: #1a1a1a;
  --bg-dark: #111111;
  --bg-card: #252525;
  --primary-cyan: #00ffff;
  --primary-magenta: #ff00ff;
  --accent-green: #00ff88;
  --danger-red: #ff3366;
  --text-main: #ffffff;
  --text-dim: #a0a0a0;
  
  --card-width: 100px;
  --card-height: 140px;
  
  /* 使用系统字体栈作为回退，移除对外部字体的硬依赖 */
  --font-main: 'Noto Sans SC', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-tech: 'Rajdhani', 'Courier New', Courier, monospace;
}

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

body {
  margin: 0;
  padding: 0;
  background-color: #000;
  color: var(--text-main);
  font-family: var(--font-main);
  display: flex;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
}

#app {
  width: 100%;
  max-width: 480px; /* 移动端优先布局 */
  background-color: var(--bg-color);
  height: 100%;
  position: relative;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 通用工具类 */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.text-cyan { color: var(--primary-cyan); }
.text-magenta { color: var(--primary-magenta); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--danger-red); }
.neon-text { text-shadow: 0 0 5px currentColor; }
.full-screen { width: 100%; height: 100%; }

/* 按钮样式 */
.btn {
  background: transparent;
  border: 1px solid var(--primary-cyan);
  color: var(--primary-cyan);
  padding: 10px 20px;
  font-family: var(--font-tech);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 5px;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 10px var(--primary-cyan);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  border-color: var(--primary-magenta);
  color: var(--primary-magenta);
}

.btn-primary:hover {
  background: rgba(255, 0, 255, 0.1);
  box-shadow: 0 0 10px var(--primary-magenta);
}

/* Loading Screen */
#loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--bg-dark);
}

#loading-screen h1 {
  font-family: var(--font-tech);
  font-size: 3rem;
  color: var(--primary-cyan);
  text-shadow: 0 0 10px var(--primary-cyan);
  margin-bottom: 2rem;
}

.loader {
  width: 48px;
  height: 48px;
  border: 3px solid var(--primary-magenta);
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Main Menu */
.main-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: radial-gradient(circle at center, #2a2a2a 0%, var(--bg-dark) 100%);
}

.logo {
  font-family: var(--font-tech);
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 3rem;
  text-align: center;
  background: linear-gradient(45deg, var(--primary-cyan), var(--primary-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.3));
}

/* Map View */
.game-header {
  height: 60px;
  background: rgba(0,0,0,0.5);
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  z-index: 10;
}

.status-bar {
  display: flex;
  gap: 15px;
  font-family: var(--font-tech);
  font-weight: 600;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.map-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image: 
    linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
}

.map-node {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid #444;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 0;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  font-size: 1.5rem;
}

.map-node::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  height: 34px; /* distance between nodes - margin + borders */
  background: #333;
  transform: translateX(-50%);
  z-index: -1;
}

.map-node:last-child::after {
  display: none;
}

.map-node.active {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 15px var(--primary-cyan);
  transform: scale(1.1);
  background: rgba(0, 255, 255, 0.1);
}

.map-node.completed {
  border-color: var(--text-dim);
  background: #222;
  color: var(--text-dim);
}

.map-node.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.map-node:not(.locked):hover {
  border-color: var(--accent-green);
}

/* Battle View */
.battle-scene {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(circle at top, #222 0%, #111 100%);
}

.monster-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.monster-avatar {
  width: 150px;
  height: 150px;
  background: #000;
  border: 2px solid var(--danger-red);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  box-shadow: 0 0 20px rgba(255, 51, 102, 0.2);
}

.monster-avatar.attack-anim {
  animation: lunge 0.3s ease-in-out;
}

.monster-avatar.hit-anim {
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
  border-color: #fff;
}

@keyframes lunge {
  0% { transform: translateY(0); }
  50% { transform: translateY(20px) scale(1.1); }
  100% { transform: translateY(0); }
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

.monster-intent {
  position: absolute;
  top: -30px;
  background: rgba(0,0,0,0.8);
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid #555;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9rem;
}

.monster-stats {
  text-align: center;
}

.health-bar {
  width: 150px;
  height: 10px;
  background: #333;
  border-radius: 5px;
  overflow: hidden;
  margin-top: 5px;
  position: relative;
}

.health-fill {
  height: 100%;
  background: var(--danger-red);
  transition: width 0.3s ease;
}

.block-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 255, 0.3);
  border: 1px solid #44f;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-left: 5px;
}

.player-stats-area {
  padding: 10px 20px;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #333;
}

.energy-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--primary-cyan), #008888);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #000;
  font-size: 1.2rem;
  box-shadow: 0 0 10px var(--primary-cyan);
}

.hand-area {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow-x: auto;
  gap: 10px;
  background: rgba(0,0,0,0.3);
}

.card {
  width: var(--card-width);
  height: var(--card-height);
  background: var(--bg-card);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.card:hover {
  transform: translateY(-20px) scale(1.05);
  z-index: 10;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.card-cost {
  position: absolute;
  top: -5px;
  left: -5px;
  width: 24px;
  height: 24px;
  background: var(--primary-cyan);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-family: var(--font-tech);
}

.card-title {
  font-weight: bold;
  text-align: center;
  margin-top: 10px;
  margin-bottom: 5px;
  font-size: 0.85rem;
}

.card-image {
  flex: 1;
  background: #111;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.card-desc {
  font-size: 0.7rem;
  text-align: center;
  color: var(--text-dim);
  line-height: 1.2;
}

.card.type-attack { border-color: var(--danger-red); }
.card.type-attack .card-title { color: var(--danger-red); }

.card.type-skill { border-color: var(--primary-cyan); }
.card.type-skill .card-title { color: var(--primary-cyan); }

.card.type-power { border-color: var(--accent-green); }
.card.type-power .card-title { color: var(--accent-green); }

.turn-btn {
  position: absolute;
  right: 10px;
  bottom: 190px;
  padding: 8px 16px;
  background: var(--primary-magenta);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: var(--font-tech);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.turn-btn:disabled {
  background: #555;
  color: #888;
  cursor: not-allowed;
  box-shadow: none;
}

/* Floating Text */
.floating-text {
  position: absolute;
  color: #fff;
  font-weight: bold;
  font-size: 1.5rem;
  pointer-events: none;
  animation: floatUp 0.8s forwards;
  text-shadow: 1px 1px 0 #000;
  z-index: 100;
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-50px) scale(1.2); opacity: 0; }
}

/* Event / Reward Screen */
.event-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  text-align: center;
}

.event-title {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--primary-cyan);
}

.card-grid {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px 0;
}

.reward-card {
  transform: scale(1.1);
}
