/* =========================================================================
   theme.css —— 鬼灭之刃美学 · 配色系统 + 装饰类
   =========================================================================
   设计灵感：大正浪漫 · 市松格纹 · 樱吹雪 · 水波 · 流光呼吸
   色调：深紫夜空 → 暖橘暖粉（鬼灭标志性夜景配色）
   ========================================================================= */

:root {
  /* ===== 主色调 ===== */
  --color-bg: #1a0f2e;              /* 深紫夜空底色 */
  --color-bg-deep: #0f0820;          /* 更深的背景 */
  --color-bg-soft: #2d1b4e;          /* 柔和紫，卡片背景 */

  /* ===== 品牌色（鬼灭特征） ===== */
  --color-sakura: #ffb7c5;           /* 樱花粉 */
  --color-sakura-deep: #ff8fab;      /* 深樱花 */
  --color-amber: #ff9966;            /* 大正暖橘（火之呼吸） */
  --color-amber-light: #ffbb88;      /* 浅暖橘 */
  --color-cyan: #7fdbe6;             /* 水之呼吸青 */
  --color-cyan-deep: #4fb8c7;        /* 深青 */
  --color-gold: #ffd700;             /* 金光（解锁特效） */
  --color-gold-soft: #ffe88c;        /* 柔金 */

  /* ===== 市松格纹双色（鬼灭羽织标志性） ===== */
  --color-ichi-a: #2d5f4e;           /* 市松深绿 */
  --color-ichi-b: #1a3d32;           /* 市松更深绿 */
  /* 备用：黑白经典市松 */
  --color-ichi-classic-a: #1a1a1a;
  --color-ichi-classic-b: #f5f5f5;

  /* ===== 文字 ===== */
  --color-text: #fff5e6;             /* 暖白主文字 */
  --color-text-soft: #d4c4e0;        /* 柔紫副文字 */
  --color-text-muted: #8a7ba8;       /* 弱化文字 */
  --color-text-gold: #ffe88c;        /* 金色强调 */

  /* ===== 渐变 ===== */
  --gradient-night: linear-gradient(160deg, #0f0820 0%, #2d1b4e 45%, #4a2c5e 100%);
  --gradient-hero: linear-gradient(180deg, #1a0f2e 0%, #3d2456 40%, #8b4d5e 80%, #d97b5f 100%);
  --gradient-sakura: linear-gradient(135deg, #ffb7c5 0%, #ff8fab 100%);
  --gradient-amber: linear-gradient(135deg, #ff9966 0%, #ff6b6b 100%);
  --gradient-water: linear-gradient(135deg, #7fdbe6 0%, #4fb8c7 100%);
  --gradient-gold: linear-gradient(135deg, #ffd700 0%, #ffae00 100%);

  /* ===== 玻璃拟态 ===== */
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);

  /* ===== 圆角与间距 ===== */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 999px;

  /* ===== 字体 ===== */
  --font-title: "LXGW WenKai", "STKaiti", "KaiTi", "楷体",
    "Hiragino Mincho ProN", "Yu Mincho", "游明朝", serif;
  --font-body: "LXGW WenKai", -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  /* ===== 阴影 ===== */
  --shadow-glow-sakura: 0 0 30px rgba(255, 183, 197, 0.5);
  --shadow-glow-amber: 0 0 30px rgba(255, 153, 102, 0.5);
  --shadow-glow-gold: 0 0 40px rgba(255, 215, 0, 0.6);
}

/* =========================================================================
   装饰类 —— 市松格纹背景（鬼灭羽织标志性图案）
   ========================================================================= */

/* 经典市松格纹（菱形交错）—— 用 CSS 渐变绘制 */
.bg-ichimatsu {
  background-color: var(--color-ichi-a);
  background-image:
    linear-gradient(45deg, var(--color-ichi-b) 25%, transparent 25%, transparent 75%, var(--color-ichi-b) 75%),
    linear-gradient(45deg, var(--color-ichi-b) 25%, transparent 25%, transparent 75%, var(--color-ichi-b) 75%);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
}

/* 樱花粉版市松格纹（更柔和，适合背景） */
.bg-ichimatsu-sakura {
  background-color: rgba(255, 183, 197, 0.08);
  background-image:
    linear-gradient(45deg, rgba(255, 183, 197, 0.12) 25%, transparent 25%, transparent 75%, rgba(255, 183, 197, 0.12) 75%),
    linear-gradient(45deg, rgba(255, 183, 197, 0.12) 25%, transparent 25%, transparent 75%, rgba(255, 183, 197, 0.12) 75%);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
}

/* =========================================================================
   玻璃拟态卡片
   ========================================================================= */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
}

/* =========================================================================
   文字辅助类
   ========================================================================= */
.text-title {
  font-family: var(--font-title);
}
.text-glow-sakura {
  text-shadow: 0 0 20px rgba(255, 183, 197, 0.8), 0 0 40px rgba(255, 183, 197, 0.4);
}
.text-glow-gold {
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4);
}
.text-gradient-sakura {
  background: var(--gradient-sakura);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.text-gradient-gold {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* =========================================================================
   装饰线 —— 和风分隔线（菱形点缀）
   ========================================================================= */
.divider-wafu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px auto;
  color: var(--color-sakura);
}
.divider-wafu::before,
.divider-wafu::after {
  content: "";
  height: 1px;
  width: 60px;
  background: linear-gradient(90deg, transparent, var(--color-sakura), transparent);
}
.divider-wafu .diamond {
  width: 8px;
  height: 8px;
  background: var(--color-sakura);
  transform: rotate(45deg);
}

/* =========================================================================
   樱花花瓣（CSS 绘制，用于飘落动画）
   ========================================================================= */
.sakura-petal {
  position: fixed;
  top: -20px;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 30% 30%, #ffd6e0, #ff8fab);
  border-radius: 50% 0 50% 50%;
  opacity: 0.85;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 0 4px rgba(255, 143, 171, 0.5));
}

/* =========================================================================
   进度条（水之呼吸流光）
   ========================================================================= */
.progress-water {
  position: relative;
  height: 14px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid rgba(127, 219, 230, 0.3);
}
.progress-water__fill {
  height: 100%;
  background: linear-gradient(90deg, #4fb8c7, #7fdbe6, #b0f0f5, #7fdbe6, #4fb8c7);
  background-size: 200% 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation: water-flow 2s linear infinite;
  box-shadow: 0 0 12px rgba(127, 219, 230, 0.8);
}

/* =========================================================================
   状态标签
   ========================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  font-size: 13px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--color-text-soft);
}
.badge--locked {
  background: rgba(138, 123, 168, 0.15);
  color: var(--color-text-muted);
}
.badge--unlocked {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.5);
  color: var(--color-gold);
}

/* =========================================================================
   角色画像区 —— CSS 绘制的鬼灭风格化 Q 版角色
   =========================================================================
   说明：这些是原创风格化绘制（市松羽织/藤花头饰/羽织配色等），
        表达鬼灭美学，不复制任何官方原画。
        如果你有正版图片，可在 index.html 用 <img src="assets/xxx.png"> 替换。
   ========================================================================= */

.char-card {
  position: relative;
  padding: 20px 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--glass-border);
  text-align: center;
  overflow: hidden;
}
.char-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(255, 183, 197, 0.15), transparent 60%);
  pointer-events: none;
}

.char-avatar {
  width: 90px;
  height: 90px;
  margin: 0 auto 10px;
  position: relative;
}

/* —— 角色1：市松羽织少年（主角，绿黑格纹） —— */
.avatar-hero {
  background:
    linear-gradient(45deg, #2d5f4e 25%, transparent 25%) 0 0/14px 14px,
    linear-gradient(-45deg, #2d5f4e 25%, transparent 25%) 0 0/14px 14px,
    linear-gradient(45deg, transparent 75%, #2d5f4e 75%) 0 0/14px 14px,
    linear-gradient(-45deg, transparent 75%, #2d5f4e 75%) 0 0/14px 14px,
    #0f0820;
  border-radius: 50%;
  border: 3px solid var(--color-sakura);
  box-shadow: 0 0 16px rgba(255, 183, 197, 0.5);
}
.avatar-hero::after {
  /* 头发剪影 */
  content: "🗡️";
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 30px;
}

/* —— 角色2：藤花头饰少女（粉和服） —— */
.avatar-sister {
  background: linear-gradient(135deg, #ff8fab, #ffb7c5);
  border-radius: 50%;
  border: 3px solid #ffe88c;
  box-shadow: 0 0 16px rgba(255, 143, 171, 0.6);
}
.avatar-sister::after {
  content: "🌸";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
}
.avatar-sister::before {
  content: "👧";
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 30px;
}

/* —— 角色3：紫羽织师匠（金色羽织纹） —— */
.avatar-master {
  background: linear-gradient(135deg, #5a3568, #3d1f4e);
  border-radius: 50%;
  border: 3px solid var(--color-gold);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}
.avatar-master::after {
  content: "🧙";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 38px;
}

/* —— 角色4：蓝水纹剑士（青色水之呼吸） —— */
.avatar-water {
  background: linear-gradient(135deg, #4fb8c7, #7fdbe6);
  border-radius: 50%;
  border: 3px solid #b0f0f5;
  box-shadow: 0 0 16px rgba(127, 219, 230, 0.6);
}
.avatar-water::after {
  content: "💧";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
}

/* —— 角色5：火纹剑士（橙红火之呼吸） —— */
.avatar-fire {
  background: linear-gradient(135deg, #ff6b6b, #ff9966);
  border-radius: 50%;
  border: 3px solid #ffbb88;
  box-shadow: 0 0 16px rgba(255, 107, 107, 0.6);
}
.avatar-fire::after {
  content: "🔥";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
}

/* —— 角色6：金光剑士（雷之呼吸） —— */
.avatar-thunder {
  background: linear-gradient(135deg, #ffd700, #ffae00);
  border-radius: 50%;
  border: 3px solid #fff5e6;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.7);
}
.avatar-thunder::after {
  content: "⚡";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
}

.char-name {
  font-family: var(--font-title);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
  color: var(--color-text-gold);
}
.char-role {
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

/* =========================================================================
   宝箱解锁卡片（三张依次揭晓）
   ========================================================================= */
.treasure-rewards {
  display: none;            /* 默认隐藏，宝箱打开后由 JS 控制 */
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}
.treasure-rewards.is-visible {
  display: flex;
}

.treasure-card {
  position: relative;
  padding: 22px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(139, 90, 43, 0.3), rgba(255, 215, 0, 0.08));
  border: 1px solid rgba(255, 215, 0, 0.4);
  text-align: center;
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.treasure-card.is-revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.treasure-card::before {
  content: "💎";
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  background: var(--gradient-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.6);
}

.treasure-card__label {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--color-gold);
  margin-bottom: 6px;
}
.treasure-card__content {
  font-family: var(--font-title);
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  color: var(--color-text-gold);
  margin-bottom: 4px;
}
.treasure-card__sub {
  font-size: 12px;
  color: var(--color-text-soft);
}

/* =========================================================================
   游戏画布区
   ========================================================================= */
.game-canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0f0820;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
#game-canvas {
  display: block;
  width: 100%;
  height: 320px;
  touch-action: none;
}

/* 游戏遮罩层（开始/失败） */
.game-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(15, 8, 32, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 20px;
  z-index: 5;
}

.game-overlay__title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  color: var(--color-gold);
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}
.game-overlay__desc {
  font-size: 13px;
  color: var(--color-text-soft);
  margin-bottom: 18px;
  line-height: 1.8;
  max-width: 280px;
}

/* 游戏内 HUD */
.game-hud {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--color-text-gold);
  z-index: 4;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.game-hud__hp {
  letter-spacing: 0.1em;
}

.game-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  padding: 10px 20px;
  background: rgba(15, 8, 32, 0.9);
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: var(--radius-sm);
  color: var(--color-gold);
  font-size: 14px;
  letter-spacing: 0.1em;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.game-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* 游戏控制按钮（移动端） */
.game-controls {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  justify-content: center;
}
.game-btn {
  flex: 1;
  max-width: 140px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  border-radius: var(--radius-md);
  border: none;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.game-btn--jump {
  background: var(--gradient-water);
  box-shadow: 0 4px 12px rgba(79, 184, 199, 0.4);
}
.game-btn--attack {
  background: var(--gradient-amber);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}
.game-btn:active {
  transform: scale(0.95);
}
