/* ============================================================
   电子蹦迪 · 暖阳陶土
   配色严格遵循视觉规范，装饰以「陶土色块 + 柔和手作阴影 + 自然肌理」
   ============================================================ */
:root {
  /* —— 规范配色 —— */
  --c-primary: #3fb12f;    /* 主色 */
  --c-accent: #6249c1;     /* 辅助色 */
  --c-cta: #29d66a;        /* 强调色 / CTA */
  --c-bg: #f9fbf8;         /* 页面背景 */
  --c-surface: #ffffff;    /* 卡片 / 表面 */
  --c-text: #1d2c1b;       /* 正文文字 */
  --c-text-2: #607a5c;     /* 次要文字 */
  --c-line: #dce6db;       /* 描边 */
  /* —— 陶土暖阳装饰用（仅用于肌理 / 点缀，功能色一律使用上方规范色值）—— */
  --c-clay: #d98a5f;
  --c-clay-soft: #f4e0cc;

  --radius: 16px;
  --font-head: 'Quicksand', 'PingFang SC', system-ui, sans-serif;
  --font-body: 'Noto Serif SC', 'Songti SC', Georgia, 'Times New Roman', serif;
  --shadow-soft: 0 12px 26px -14px rgba(29, 44, 27, .22), 0 3px 8px rgba(29, 44, 27, .06);
  --shadow-lift: 0 26px 52px -26px rgba(29, 44, 27, .3), 0 8px 18px -10px rgba(29, 44, 27, .14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* ============ 背景：自然肌理 + 霓虹光斑 + 暖阳 ============ */
.bg-scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }

.blob { position: absolute; border-radius: 50%; filter: blur(72px); opacity: .55; animation: drift 20s ease-in-out infinite alternate; }
.blob-a { width: 430px; height: 430px; left: -130px; top: -90px; background: rgba(63, 177, 47, .34); }
.blob-b { width: 470px; height: 470px; right: -150px; top: 26%; background: rgba(98, 73, 193, .26); animation-delay: -7s; }
.blob-c { width: 380px; height: 380px; left: 28%; bottom: -170px; background: rgba(217, 138, 95, .3); animation-delay: -13s; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(44px, -34px) scale(1.09); } }

/* 陶土暖阳：旋转光斑，代表「暖阳」气质 */
.sun {
  position: absolute; top: -170px; right: -150px; width: 540px; height: 540px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(217, 138, 95, .2) 0deg 9deg, rgba(217, 138, 95, 0) 9deg 36deg);
  -webkit-mask: radial-gradient(circle, #000 16%, transparent 70%);
  mask: radial-gradient(circle, #000 16%, transparent 70%);
  opacity: .75;
  animation: sunspin 46s linear infinite;
}
@keyframes sunspin { to { transform: rotate(360deg); } }

/* 陶土色块：手工陶片式的散点 */
.clay-patch { position: absolute; border-radius: 46% 54% 55% 45% / 48% 44% 56% 52%; background: var(--c-clay-soft); opacity: .8; }
.patch-1 { width: 120px; height: 96px; left: -40px; top: 38%; transform: rotate(18deg); }
.patch-2 { width: 90px; height: 74px; right: 6%; bottom: 8%; transform: rotate(-14deg); background: rgba(217, 138, 95, .16); }

/* 纸张颗粒肌理 */
.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: .55; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncA type='linear' slope='0.06'/></feComponentTransfer></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============ 页头 ============ */
.app-header {
  position: relative; z-index: 5; max-width: 1080px; margin: 0 auto;
  padding: 30px 20px 14px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand .title {
  font-family: var(--font-head); font-weight: 700; letter-spacing: .5px;
  font-size: clamp(32px, 6vw, 46px); line-height: 1.1; margin: 0; color: var(--c-text);
  position: relative; display: inline-block;
}
.title::after { /* 手绘波浪下划线 */
  content: ''; position: absolute; left: 0; right: -4px; bottom: -8px; height: 13px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 16' preserveAspectRatio='none'><path d='M4 10 Q 50 3 96 8 T 176 7 T 216 8' fill='none' stroke='%236249c1' stroke-width='5' stroke-linecap='round' opacity='0.4'/></svg>");
  background-size: 100% 100%; background-repeat: no-repeat;
}
.doodle-star { color: var(--c-cta); font-size: .5em; margin-left: 8px; display: inline-block; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0deg); opacity: .7; } 50% { transform: scale(1.3) rotate(20deg); opacity: 1; } }

.brand .subtitle { margin: 12px 0 0; color: var(--c-text-2); font-size: 14px; }

.header-actions { display: flex; gap: 10px; }

/* 按钮（手作感：圆角 + 柔和阴影 + 微按压） */
.btn {
  border: 0; cursor: pointer; font-family: var(--font-head); font-weight: 600; font-size: 15px;
  padding: 12px 18px; border-radius: var(--radius);
  display: inline-flex; gap: 8px; align-items: center;
  box-shadow: var(--shadow-soft);
  transition: transform .16s ease, box-shadow .22s ease, background .22s ease, opacity .22s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(2px) scale(.97); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 30px -14px rgba(63, 177, 47, .55); }
.btn-primary.playing { background: var(--c-accent); box-shadow: 0 18px 30px -14px rgba(98, 73, 193, .55); }
.btn-ghost { background: var(--c-surface); color: var(--c-text-2); box-shadow: none; border: 1.5px solid var(--c-line); }
.btn-ghost:hover { border-color: var(--c-accent); color: var(--c-accent); }
.btn-ghost.off { opacity: .5; }
.btn-ghost.off .btn-ico { text-decoration: line-through; }
.btn-ico { line-height: 1; }

/* ============ 舞台 ============ */
.stage-wrap { position: relative; z-index: 4; max-width: 1080px; margin: 0 auto; padding: 10px 20px 6px; }

.stage {
  position: relative; overflow: hidden; cursor: pointer;
  height: clamp(360px, 58vh, 560px); min-height: 360px;
  border-radius: 24px;
  background:
    radial-gradient(120% 95% at 10% 0%, rgba(63, 177, 47, .1), transparent 55%),
    radial-gradient(120% 95% at 92% 8%, rgba(98, 73, 193, .11), transparent 55%),
    linear-gradient(180deg, #ffffff, #fbfdf9);
  box-shadow: var(--shadow-lift), 0 0 0 1px var(--c-line), 0 26px 60px -26px rgba(63, 177, 47, .3);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  outline: none;
}
.stage:focus-visible { box-shadow: var(--shadow-lift), 0 0 0 3px var(--c-accent); }
.stage:active { transform: scale(.994); }

/* 舞台霓虹顶灯 */
.spotlights { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cone {
  position: absolute; top: -12%; width: 46%; height: 132%;
  background: linear-gradient(180deg, rgba(98, 73, 193, .15), rgba(98, 73, 193, 0) 72%);
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
  transform-origin: top center; animation: swing 9s ease-in-out infinite alternate;
}
.cone-l { left: 3%; }
.cone-r { right: 3%; background: linear-gradient(180deg, rgba(63, 177, 47, .13), rgba(63, 177, 47, 0) 72%); animation-delay: -4.5s; }
@keyframes swing { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }

/* 舞池同心圈：随节拍脉冲（transform 由 JS 每帧写入） */
.floor { position: absolute; inset: 0; transform-origin: 50% 92%; pointer-events: none; }
.ring { position: absolute; left: 50%; transform: translateX(-50%); border-radius: 50%; }
.ring-1 { width: 70%; height: 30%; bottom: 4%; border: 2.5px dashed rgba(63, 177, 47, .42); }
.ring-2 { width: 88%; height: 40%; bottom: -1%; border: 2px dotted rgba(98, 73, 193, .36); }
.ring-3 { width: 105%; height: 52%; bottom: -7%; border: 2px solid rgba(41, 214, 106, .22); }
.ring-4 { width: 122%; height: 66%; bottom: -16%; border: 2px solid rgba(217, 138, 95, .26); }

/* 顶部彩灯串 */
.dots {
  position: absolute; top: 14px; left: 16px; right: 16px; z-index: 2;
  display: flex; justify-content: space-between; pointer-events: none;
}
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--dc, var(--c-cta)); box-shadow: 0 0 9px var(--dc, var(--c-cta)); animation: dotpulse 1.3s ease-in-out infinite; }
.dots i:nth-child(3n+1) { --dc: var(--c-primary); }
.dots i:nth-child(3n+2) { --dc: var(--c-accent); animation-delay: .42s; }
.dots i:nth-child(3n) { --dc: var(--c-cta); animation-delay: .84s; }
@keyframes dotpulse { 0%, 100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.55); opacity: 1; } }

#danceCanvas { position: relative; z-index: 2; display: block; width: 100%; height: 100%; }

/* 初始提示 */
.tap-hint {
  position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%);
  text-align: center; font-family: var(--font-head); font-weight: 600; color: var(--c-text-2);
  pointer-events: none; transition: opacity .6s ease, transform .6s ease; animation: hintbob 2.4s ease-in-out infinite;
}
.tap-hint small { display: block; font-family: var(--font-body); font-weight: 400; margin-top: 4px; font-size: 13px; }
.tap-hint.hide { opacity: 0; transform: translate(-50%, -70%); }
@keyframes hintbob { 0%, 100% { margin-top: 0; } 50% { margin-top: -8px; } }

/* 连击大数字 */
.combo-pop {
  position: absolute; left: 50%; top: 20%; z-index: 4; transform: translate(-50%, -50%);
  font-family: var(--font-head); font-weight: 700; font-size: clamp(60px, 13vw, 100px); line-height: 1;
  color: transparent; -webkit-text-stroke: 2.5px var(--c-accent);
  text-shadow: 0 0 26px rgba(98, 73, 193, .4);
  opacity: 0; pointer-events: none;
}
.combo-pop.pop { animation: popIn .55s cubic-bezier(.2, 1.5, .4, 1) forwards; }
@keyframes popIn {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(.4); }
  32% { opacity: 1; transform: translate(-50%, -60%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(.92); }
}

/* 解锁 / 纪录 Toast */
.unlock-toast {
  position: absolute; left: 50%; top: 9%; z-index: 4; transform: translate(-50%, -6px);
  font-family: var(--font-head); font-weight: 600; font-size: 14px;
  padding: 9px 18px; border-radius: 999px; color: #fff; white-space: nowrap;
  box-shadow: 0 14px 26px -10px rgba(98, 73, 193, .55);
  opacity: 0; pointer-events: none; transition: opacity .32s ease, transform .32s cubic-bezier(.2, 1.4, .4, 1);
}
.unlock-toast.show { opacity: 1; transform: translate(-50%, 6px); }
.unlock-toast.t-unlock { background: var(--c-accent); }
.unlock-toast.t-record { background: var(--c-primary); box-shadow: 0 14px 26px -10px rgba(63, 177, 47, .6); }

/* 火花 */
.sparks { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 3; }
.spark {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--sc); box-shadow: 0 0 10px var(--sc);
  animation: sparkFly .78s cubic-bezier(.16, .8, .4, 1) forwards;
}
@keyframes sparkFly {
  from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.12) rotate(140deg); opacity: 0; }
}
.ripple {
  position: absolute; left: var(--rx); top: var(--ry); width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--c-cta); transform: translate(-50%, -50%); pointer-events: none; z-index: 3;
  animation: ripple .62s ease-out forwards;
}
@keyframes ripple { to { width: 140px; height: 140px; border-width: 1px; opacity: 0; } }

.stage-caption { text-align: center; margin: 12px 0 0; font-size: 13px; color: var(--c-text-2); }
.cap-move { font-family: var(--font-head); font-weight: 700; color: var(--c-accent); }

/* ============ 信息面板 ============ */
.dash {
  position: relative; z-index: 4; max-width: 1080px; margin: 0 auto; padding: 18px 20px 8px;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px;
}
.card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius); box-shadow: var(--shadow-soft);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.card::before { /* 陶土角标色块：手工质感 */
  content: ''; position: absolute; right: -26px; top: -26px; width: 74px; height: 74px;
  border-radius: 40% 60% 55% 45%; background: rgba(217, 138, 95, .14); transform: rotate(14deg);
}

.status-card { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.status-left { text-align: center; }
.label {
  font-family: var(--font-head); font-weight: 600; font-size: 12px; letter-spacing: 2.5px;
  color: var(--c-text-2); text-transform: uppercase; margin-bottom: 2px;
}
.combo-big { font-family: var(--font-head); font-weight: 700; font-size: 54px; line-height: 1.05; color: var(--c-primary); }
.combo-big small { font-size: 18px; color: var(--c-text-2); font-weight: 600; margin-left: 2px; }
.status-mid { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--c-text-2); min-width: 112px; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; }
.mini-row b { color: var(--c-text); font-family: var(--font-head); }
.status-right { flex: 1; min-width: 210px; }
.move-name { font-family: var(--font-head); font-weight: 700; font-size: 19px; color: var(--c-accent); margin-bottom: 8px; }
.progress { height: 10px; background: #e9f1e6; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--c-primary), var(--c-cta)); transition: width .32s ease; }
.progress-label { font-size: 12px; color: var(--c-text-2); margin-top: 7px; }

.moves-card .card-title { margin: 0 0 14px; font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--c-text); display: flex; align-items: center; gap: 10px; }
.clay-tag {
  font-family: var(--font-head); font-size: 11px; font-weight: 600; color: #fff;
  background: var(--c-clay); padding: 2px 10px; border-radius: 999px; letter-spacing: 1px;
}
.moves { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.move {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 6px 10px; border-radius: 14px; border: 1.5px solid var(--c-line);
  background: #fff; text-align: center; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
}
.move-ico { font-size: 23px; line-height: 1; filter: grayscale(1); opacity: .45; transition: .22s; }
.move-txt b { font-family: var(--font-head); font-size: 13px; font-weight: 600; color: var(--c-text-2); }
.move-txt small { display: none; }
.move-min { font-size: 11px; color: var(--c-text-2); font-family: var(--font-head); }
.move.on { border-color: rgba(63, 177, 47, .5); background: #f2fbef; }
.move.on .move-ico { filter: none; opacity: 1; }
.move.on .move-txt b { color: var(--c-primary); }
.move.now { border-color: var(--c-accent); background: #f6f4ff; box-shadow: 0 8px 18px -10px rgba(98, 73, 193, .5); transform: translateY(-2px); }
.move.now .move-txt b { color: var(--c-accent); }
.move.locked .move-min { color: #a9bfa5; }

/* ============ 页脚 ============ */
.app-footer { position: relative; z-index: 4; max-width: 1080px; margin: 0 auto; padding: 10px 20px 30px; text-align: center; color: var(--c-text-2); font-size: 12.5px; }

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .dash { grid-template-columns: 1fr; }
  .status-card { gap: 14px; }
}
@media (max-width: 520px) {
  .app-header { padding-top: 22px; align-items: flex-start; }
  .header-actions { width: 100%; }
  .btn { flex: 1; justify-content: center; }
  .status-card { flex-direction: column; align-items: stretch; text-align: center; }
  .status-mid { flex-direction: row; justify-content: center; gap: 24px; }
  .mini-row { flex-direction: column; align-items: center; min-width: 0; }
  .status-right { min-width: 0; }
  .moves { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .sun, .cone, .dots i, .doodle-star, .tap-hint { animation: none !important; }
  .spark, .ripple { animation-duration: .01s; }
}
