/* ============================================
   刀盾大作战 - 主样式
   ============================================ */

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

body {
  overflow: hidden;
  background: #1a1a2e;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  display: block;
  background: #2a2a4a;
  image-rendering: pixelated;
}

/* ============ HUD ============ */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 10;
}

#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
}

.player-info {
  flex: 1;
  max-width: 280px;
}

.player-info.p1 { text-align: left; }
.player-info.p2 { text-align: right; }

.player-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  margin-bottom: 4px;
}

.p1 .player-name { color: #ff9966; }
.p2 .player-name { color: #66bbff; }

.health-bar {
  position: relative;
  height: 18px;
  background: rgba(0,0,0,0.4);
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.2);
}

.p2 .health-bar {
  direction: rtl;
}

.health-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #ff6644, #ffaa44);
  border-radius: 7px;
  transition: width 0.3s ease;
  width: 100%;
}

.p2 .health-fill {
  background: linear-gradient(90deg, #44aaff, #4488ff, #6666ff);
}

.health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

#timer {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 10px rgba(255,200,0,0.5);
  min-width: 60px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#timer.warning {
  color: #ff4444;
  animation: timerPulse 0.5s ease infinite alternate;
}

@keyframes timerPulse {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

#hud-bottom {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
}

.controls-hint {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.controls-hint span {
  background: rgba(0,0,0,0.3);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ============ Screens ============ */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(10, 10, 30, 0.92);
  backdrop-filter: blur(8px);
}

.hidden {
  display: none !important;
}

/* Main Menu */
.game-title {
  font-size: 56px;
  font-weight: 900;
  background: linear-gradient(135deg, #ff6b35, #ff4444, #ff8844);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 4px 8px rgba(255, 68, 68, 0.3));
  margin-bottom: 8px;
  letter-spacing: 4px;
}

.game-subtitle {
  font-size: 16px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 40px;
  letter-spacing: 6px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 40px;
}

.btn {
  padding: 14px 48px;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 2px;
  pointer-events: auto;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b35, #ff4444);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, #4488ff, #4466dd);
  color: #fff;
  box-shadow: 0 4px 15px rgba(68, 136, 255, 0.3);
}

.btn-back {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 10px 30px;
  font-size: 14px;
}

.menu-footer {
  color: rgba(255,255,255,0.25);
  font-size: 13px;
}

/* Character Select */
.screen-title {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 24px;
  letter-spacing: 4px;
}

.select-layout {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 30px;
}

.select-side {
  text-align: center;
}

.select-label {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.p1-select .select-label { color: #ff9966; }
.p2-select .select-label { color: #66bbff; }

.char-list {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.char-item {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 3px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.char-item:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.1);
}

.char-item.selected {
  border-color: #ff8844;
  background: rgba(255, 136, 68, 0.15);
  box-shadow: 0 0 15px rgba(255, 136, 68, 0.3);
}

.char-item.locked {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.char-item canvas {
  width: 48px;
  height: 48px;
}

.char-preview {
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-preview canvas {
  width: 100px;
  height: 100px;
}

.select-vs {
  font-size: 36px;
  font-weight: 900;
  color: rgba(255,255,255,0.15);
  letter-spacing: 4px;
}

.screen-actions {
  display: flex;
  gap: 16px;
}

/* Result Screen */
.result-content {
  text-align: center;
}

.result-text {
  font-size: 52px;
  font-weight: 900;
  background: linear-gradient(135deg, #ffaa44, #ff6b35, #ff4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  letter-spacing: 4px;
}

.stage-text {
  font-size: 42px;
}

.result-winner {
  font-size: 18px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 30px;
}

.result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* Round Announcement */
#announcement {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 30px rgba(255,200,0,0.5);
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  letter-spacing: 8px;
}

#announcement.show {
  animation: announceIn 1.5s ease forwards;
}

@keyframes announceIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}
