/* ===== 暗夜魔法绘本 · 精致版 ===== */
:root {
  --bg-deep: #1a3a1a;
  --bg-card: rgba(26,58,26,.92);
  --bg-panel: rgba(20,45,20,.85);
  --orange: #ff6b1a;
  --blue: #5ce1e6;
  --red: #FF2A2A;
  --gold: #ffd700;
  --purple: #b44dff;
  --moss: #1a3a1a;
  --mud: #2d4a1e;
  --dark-violet: #4a1a5e;
  --text-light: #e8d5ff;
  --text-dim: #a0b890;
  --glow-orange: 0 0 25px rgba(255,107,26,.5);
  --glow-blue: 0 0 25px rgba(92,225,230,.5);
  --glow-gold: 0 0 25px rgba(255,215,0,.5);
  --radius: 14px;
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== 首页 ===== */
.home-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, #2d4a1e 0%, #1a3a1a 70%);
}
.home-container {
  text-align: center;
  padding: 40px 20px;
  max-width: 600px;
  width: 100%;
}
.title-section { margin-bottom: 48px; }
.game-title {
  font-size: 2.6rem;
  background: linear-gradient(135deg, #ff6b1a, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(255,107,26,.3));
}
.title-icon { display:inline-block; animation: float 3s ease-in-out infinite; }
.subtitle {
  margin-top: 8px;
  color: #5ce1e6;
  font-size: 1.1rem;
  letter-spacing: 6px;
  text-shadow: 0 0 12px rgba(92,225,230,.3);
}

.home-cards { display:flex; flex-direction:column; gap:16px; }
.home-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(26,58,26,.95);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-decoration: none;
  color: var(--text-light);
  transition: transform .2s, box-shadow .3s;
  border: 1px solid rgba(92,225,230,.08);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.home-card::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(255,107,53,.1), transparent 60%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.home-card:hover::before { opacity: 1; }
.home-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.glow-card { box-shadow: 0 0 25px rgba(255,107,26,.5); }
.glow-card:hover { box-shadow: 0 8px 30px rgba(255,107,26,.4); }
.glow-card-blue { box-shadow: 0 0 25px rgba(92,225,230,.5); }
.glow-card-blue:hover { box-shadow: 0 8px 30px rgba(92,225,230,.4); }
.card-icon { font-size: 2rem; }
.card-text { flex:1; text-align:left; }
.card-text h2 { font-size:1.2rem; margin-bottom:4px; }
.card-text p { font-size:.85rem; color:var(--text-dim); }
.card-arrow { font-size:1.4rem; color:#ff6b1a; transition:transform .2s; }
.home-card:hover .card-arrow { transform:translateX(4px); }
.home-footer { margin-top:48px; color:var(--text-dim); font-size:.8rem; }
.feature-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(255,107,26,.12);
  border: 1px solid rgba(255,107,26,.25);
  border-radius: 20px;
  font-size: .8rem;
  color: #ff6b1a;
  transition: transform .2s, box-shadow .2s;
  cursor: default;
}
.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,107,26,.25);
}
.footer-tagline {
  color: var(--text-dim);
  font-size: .8rem;
  letter-spacing: 2px;
}

/* ===== 游戏页面 ===== */
.game-page {
  background: #1a3a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
}
#gameCanvas {
  display: block;
  background: #1a3a1a;
  border-radius: 12px;
  box-shadow: 0 0 80px rgba(92,225,230,.1), 0 0 40px rgba(26,58,26,.5);
}

/* ===== UI 层叠 ===== */
.game-ui {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}
.game-ui > * { pointer-events: auto; }

/* 顶部栏 */
.top-bar {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(26,58,26,.92);
  backdrop-filter: blur(10px);
  padding: 6px 20px;
  border-radius: 24px;
  border: 1px solid rgba(92,225,230,.08);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.level-display {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255,215,0,.4);
  min-width: 50px;
  text-align: center;
}
.exp-bar-wrap {
  width: 160px;
  height: 12px;
  background: rgba(26,58,26,.6);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,215,0,.15);
}
.exp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7fff00, var(--gold));
  border-radius: 10px;
  transition: width .3s ease;
  box-shadow: 0 0 12px rgba(127,255,0,.5);
}
.exp-bar-text {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  font-weight: 600;
}
.hp-bar-wrap {
  width: 120px;
  height: 10px;
  background: rgba(26,58,26,.6);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,42,42,.15);
}
.hp-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--red), #FF6B6B);
  border-radius: 8px;
  transition: width .2s;
  box-shadow: 0 0 8px rgba(255,42,42,.3);
}
.hp-bar-text {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .55rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
  font-weight: 600;
}
.timer-display {
  font-size: .8rem;
  color: var(--text-dim);
  min-width: 50px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.dmg-display {
  font-size: .8rem;
  color: var(--gold);
  min-width: 50px;
  text-align: center;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255,215,0,.3);
}
.kill-display {
  font-size: .8rem;
  color: var(--orange);
  min-width: 40px;
  text-align: center;
  font-weight: 600;
}
.stage-display {
  font-size: .75rem;
  color: var(--blue);
  min-width: 80px;
  text-align: center;
  padding: 2px 8px;
  background: rgba(92,225,230,.1);
  border-radius: 10px;
  border: 1px solid rgba(92,225,230,.15);
}

/* 装备槽 (左侧) */
.equip-panel {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.equip-slot {
  width: 52px;
  height: 52px;
  background: rgba(26,58,26,.92);
  border: 2px solid rgba(255,255,255,.08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all .3s;
  position: relative;
  backdrop-filter: blur(4px);
}
.equip-slot.active {
  border-color: var(--orange);
  box-shadow: 0 0 16px rgba(255,107,26,.3);
  background: rgba(255,107,26,.1);
}
.equip-slot.empty { opacity: .5; }
.equip-slot .slot-label {
  position: absolute;
  bottom: -16px;
  font-size: .55rem;
  color: var(--text-dim);
  white-space: nowrap;
  letter-spacing: 1px;
}
.equip-slot.flip {
  animation: flipCard .4s ease;
}

/* 升级弹窗 */
.levelup-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26,58,26,.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(4px);
}
.levelup-overlay.show { display: flex; }
.levelup-panel {
  background: linear-gradient(135deg, rgba(26,58,26,.95), rgba(13,26,13,.95));
  border: 2px solid rgba(255,215,0,.2);
  border-radius: 20px;
  padding: 30px 24px;
  box-shadow: 0 0 60px rgba(255,215,0,.1), 0 20px 60px rgba(0,0,0,.5);
  max-width: 650px;
  width: 90%;
}
.levelup-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255,215,0,.3);
  margin-bottom: 20px;
  letter-spacing: 4px;
}
.cards-container {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.skill-card {
  width: 140px;
  min-height: 190px;
  background: linear-gradient(180deg, rgba(26,58,26,.95), rgba(13,26,13,.95));
  border-radius: var(--radius);
  padding: 18px 14px;
  cursor: pointer;
  transition: transform .3s, box-shadow .3s;
  border: 2px solid rgba(255,255,255,.08);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  animation: cardAppear .4s ease backwards;
  position: relative;
  overflow: hidden;
}
.skill-card::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at center, rgba(255,255,255,.05), transparent 60%);
  opacity: 0;
  transition: opacity .3s;
}
.skill-card:hover::before { opacity: 1; }
.skill-card:nth-child(1) { animation-delay:0s; }
.skill-card:nth-child(2) { animation-delay:.08s; }
.skill-card:nth-child(3) { animation-delay:.16s; }
.skill-card:nth-child(4) { animation-delay:.24s; }
.skill-card:nth-child(5) { animation-delay:.32s; }
.skill-card:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  border-color: rgba(255,215,0,.3);
}
.skill-card .skill-icon { font-size: 2.2rem; }
.skill-card .skill-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-light);
}
.skill-card .skill-desc {
  font-size: .7rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.skill-card .skill-level {
  font-size: .65rem;
  color: var(--gold);
  background: rgba(255,215,0,.12);
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 600;
}
.skill-card.fusion {
  border-color: var(--gold);
  box-shadow: 0 0 30px rgba(255,215,0,.2);
  background: linear-gradient(180deg, rgba(42,58,26,.95), rgba(13,26,13,.95));
}
.skill-card.fusion .skill-level {
  background: rgba(255,215,0,.25);
  color: #fff;
}
.skill-ult-hint {
  font-size: .6rem;
  color: var(--gold);
  background: rgba(255,215,0,.1);
  padding: 2px 8px;
  border-radius: 8px;
  margin-top: 4px;
  border: 1px solid rgba(255,215,0,.2);
  animation: ultHintPulse 1.5s ease infinite alternate;
}
@keyframes ultHintPulse {
  from { box-shadow: 0 0 4px rgba(255,215,0,.2); }
  to { box-shadow: 0 0 12px rgba(255,215,0,.5); }
}

/* 危险警告 */
.danger-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}
.danger-overlay.show { display: flex; }
.danger-text {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--red);
  text-shadow: 0 0 40px rgba(255,42,42,.6), 0 0 80px rgba(255,42,42,.3);
  opacity: .7;
  animation: dangerPulse .5s ease infinite alternate;
  letter-spacing: 8px;
}
.danger-glow {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(255,42,42,.12) 100%);
  animation: dangerGlow 1s ease infinite alternate;
}

/* 结算弹窗 */
.gameover-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26,58,26,.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(6px);
}
.gameover-overlay.show { display: flex; }
.gameover-box {
  background: linear-gradient(135deg, rgba(26,58,26,.95), rgba(13,26,13,.95));
  border-radius: 20px;
  padding: 36px 44px;
  text-align: center;
  border: 2px solid rgba(255,255,255,.06);
  max-width: 360px;
  width: 90%;
  box-shadow: 0 0 60px rgba(0,0,0,.5);
}
.gameover-box h2 {
  font-size: 2rem;
  color: var(--red);
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(255,42,42,.3);
}
.gameover-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255,255,255,.03);
  border-radius: 8px;
}
.stat-label {
  font-size: .85rem;
  color: var(--text-dim);
}
.stat-value {
  font-size: .9rem;
  color: var(--gold);
  font-weight: 700;
}
.btn-restart {
  padding: 12px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b1a, #ffd700);
  border: none;
  border-radius: 30px;
  color: #fff;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 4px 15px rgba(255,107,53,.3);
}
.btn-restart:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(255,107,53,.4);
}

/* 开始界面 */
.start-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26,58,26,.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 30;
  backdrop-filter: blur(8px);
}
.start-overlay.hidden { display: none; }
.start-title {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b1a, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(255,107,53,.3));
  letter-spacing: 4px;
}
.start-subtitle {
  font-size: 1rem;
  color: #5ce1e6;
  letter-spacing: 8px;
  text-shadow: 0 0 12px rgba(92,225,230,.3);
  margin-bottom: 12px;
}
.start-tips {
  text-align: left;
  margin: 16px 0 24px;
  padding: 14px 20px;
  background: rgba(26,58,26,.6);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.06);
  max-width: 380px;
}
.start-tips p {
  font-size: .78rem;
  color: var(--text-dim);
  line-height: 1.8;
  margin: 0;
}
.start-tips p:last-child {
  color: var(--gold);
  font-weight: 600;
}
.btn-start {
  padding: 14px 48px;
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b1a, #ffd700);
  border: none;
  border-radius: 30px;
  color: #fff;
  cursor: pointer;
  transition: transform .2s, box-shadow .3s;
  box-shadow: 0 0 40px rgba(255,107,53,.3);
  letter-spacing: 2px;
}
.btn-start:hover {
  transform: scale(1.1);
  box-shadow: 0 0 60px rgba(255,107,53,.5);
}
.btn-start:active {
  transform: scale(.95);
}

/* ===== 蓝图页面 ===== */
.doc-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
  background: radial-gradient(ellipse at 30% 20%, #2d4a1e 0%, #1a3a1a 70%);
  min-height: 100vh;
}
.doc-page h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--orange), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}
.doc-page h2 {
  color: var(--blue);
  margin: 32px 0 12px;
  font-size: 1.3rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-bottom: 6px;
}
.doc-page p, .doc-page li {
  color: var(--text-dim);
  line-height: 1.8;
  font-size: .95rem;
}
.doc-page ul { padding-left: 20px; }
.doc-page li { margin-bottom: 6px; }
.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--blue);
  text-decoration: none;
  font-size: .9rem;
  transition: color .2s;
}
.back-link:hover { color: var(--orange); }

/* ===== 技能栏 ===== */
.skill-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
.skill-slot {
  width: 48px;
  height: 48px;
  background: rgba(26,58,26,.92);
  border: 2px solid rgba(255,255,255,.1);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  position: relative;
  backdrop-filter: blur(4px);
  transition: border-color .3s, box-shadow .3s;
}
.skill-slot .skill-key {
  position: absolute;
  top: -7px;
  left: -7px;
  font-size: .55rem;
  background: var(--orange);
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 0 6px rgba(255,107,26,.4);
}
.skill-slot .skill-cd-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: var(--red);
  font-weight: 700;
}
.skill-slot .skill-level-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-size: .5rem;
  background: var(--gold);
  color: #000;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.skill-slot.on-cd { border-color: rgba(255,42,42,.3); }
.skill-slot.ready { border-color: rgba(92,225,230,.3); box-shadow: 0 0 10px rgba(92,225,230,.15); }
.skill-slot.maxed { border-color: var(--gold); box-shadow: 0 0 12px rgba(255,215,0,.2); }
.skill-slot.fusion-skill { border-color: var(--purple); box-shadow: 0 0 15px rgba(180,77,255,.25); }

/* ===== 动画 ===== */
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes cardAppear {
  from { opacity:0; transform: translateY(30px) scale(.9); }
  to { opacity:1; transform: translateY(0) scale(1); }
}
@keyframes flipCard {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(90deg); }
  100% { transform: rotateY(0); }
}
@keyframes dangerPulse {
  from { opacity:.4; transform: scale(1); }
  to { opacity:.8; transform: scale(1.05); }
}
@keyframes dangerGlow {
  from { opacity:.3; }
  to { opacity:.7; }
}
@keyframes starPulse {
  0%,100% { box-shadow: 0 0 30px rgba(255,107,53,.3); }
  50% { box-shadow: 0 0 60px rgba(255,107,53,.6); }
}
@keyframes hpFlash {
  0%,100% { opacity:1; }
  50% { opacity:.5; }
}
@keyframes levelUpFlash {
  0% { box-shadow: 0 0 0 rgba(255,215,0,0); }
  50% { box-shadow: 0 0 40px rgba(255,215,0,.6); }
  100% { box-shadow: 0 0 0 rgba(255,215,0,0); }
}
