/* 赛博木鱼 · 运势灵签 — 禅意金黑主题 */

:root {
  --bg: #09090b;
  --bg-elev: #121217;
  --card: rgba(22, 22, 28, 0.75);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --gold: #c9a227;
  --gold-2: #f3df95;
  --gold-dim: rgba(201, 162, 39, 0.16);
  --gold-glow: rgba(243, 223, 149, 0.4);
  --line: rgba(201, 162, 39, 0.22);
  --line-soft: rgba(255, 255, 255, 0.08);
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* 优雅暗黑环境光斑 */
body::before, body::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  z-index: 0;
  opacity: 0.12;
  pointer-events: none;
}
body::before {
  width: 320px; height: 320px;
  background: var(--gold);
  top: -80px; left: 50%;
  transform: translateX(-50%);
  animation: pulse-glow 8s ease-in-out infinite alternate;
}
body::after {
  width: 260px; height: 260px;
  background: #a855f7;
  bottom: -40px; right: -40px;
}

@keyframes pulse-glow {
  0% { transform: translateX(-50%) scale(0.9); opacity: 0.08; }
  100% { transform: translateX(-50%) scale(1.15); opacity: 0.16; }
}

.game-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 500px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(16px + env(safe-area-inset-bottom));
}

/* ---- HUD 顶栏 ---- */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.hud-back {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s;
}
.hud-back:hover { color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.hud-back svg { width: 20px; height: 20px; }

.hud-mid { text-align: center; }
.hud-kicker { display: block; font-size: 10px; letter-spacing: 0.2em; color: var(--gold); font-weight: 700; }
.hud-title { display: block; font-size: 15px; font-weight: 700; color: #fff; margin-top: 2px; }

.hud-stats { text-align: right; min-width: 60px; }
.hud-count-label { display: block; font-size: 10px; color: var(--muted); }
.hud-score { font-size: 20px; font-weight: 800; color: var(--gold-2); font-variant-numeric: tabular-nums; }

/* ---- 模式切换 TAB ---- */
.mode-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 4px 6px;
  justify-content: center;
  flex-shrink: 0;
}
.mode-tab {
  flex: 1;
  max-width: 90px;
  padding: 7px 0;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}
.mode-tab.is-active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold-2);
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.2);
}

/* ---- 木鱼主舞台 ---- */
.stage-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.halo-wrap {
  position: relative;
  width: 250px;
  height: 250px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.progress-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}
.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 5;
}
.ring-bar {
  fill: none;
  stroke: url(#goldRim);
  stroke: var(--gold);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 691.15; /* 2 * PI * 110 */
  stroke-dashoffset: 691.15;
  transition: stroke-dashoffset 0.25s ease;
  filter: drop-shadow(0 0 6px rgba(201, 162, 39, 0.6));
}

.halo-glow {
  position: absolute;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.25) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.5;
  transition: all 0.3s;
}

/* 木鱼按钮 */
.muyu-btn {
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  width: 190px;
  height: 150px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 2;
  transition: transform 0.08s cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}
.muyu-btn:active {
  transform: scale(0.92);
}
.muyu-btn.is-hit {
  transform: scale(0.91);
}
.muyu-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* 木槌 */
.mallet {
  position: absolute;
  top: 15px;
  right: -5px;
  width: 80px;
  height: 80px;
  pointer-events: none;
  z-index: 3;
  transform-origin: 75px 25px;
  transform: rotate(0deg);
  transition: transform 0.12s cubic-bezier(0.1, 0.9, 0.2, 1);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}
.mallet.is-hitting {
  transform: rotate(-35deg) scale(0.95);
}

/* ---- 浮动飘字动画 ---- */
.floating-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}
.float-text {
  position: absolute;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold-2);
  text-shadow: 0 0 10px rgba(243, 223, 149, 0.8), 0 2px 4px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  animation: float-up-fade 1.1s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes float-up-fade {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.7);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -20px) scale(1.15);
  }
  60% {
    opacity: 0.9;
    transform: translate(-50%, -60px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -100px) scale(0.85);
  }
}

/* ---- 底部控制栏 ---- */
.bottom-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.progress-hint {
  text-align: center;
}
.hint-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: block;
}
.hint-text b {
  color: var(--gold-2);
  font-size: 16px;
}
.hint-desc {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.action-row {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}
.btn-auto {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-auto:hover { border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.auto-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: all 0.3s;
}
.btn-auto.is-active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold-2);
}
.btn-auto.is-active .auto-indicator {
  background: var(--gold-2);
  box-shadow: 0 0 8px var(--gold);
  animation: pulse-dot 1s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ---- 刮刮乐 / 灵签模态框 ---- */
.fortune-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 4, 6, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.fortune-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.fortune-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  background: linear-gradient(160deg, #1c1815 0%, #110e0c 100%);
  border: 1.5px solid var(--gold);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(201, 162, 39, 0.25);
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  overflow: hidden;
}
.fortune-overlay.is-open .fortune-card {
  transform: translateY(0) scale(1);
}

.card-ornament {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.card-ornament span { font-size: 8px; opacity: 0.7; }

/* 刮开后的签文内容容器 */
.fortune-reveal {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 240px;
  justify-content: center;
  padding: 10px 0;
}
.fortune-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--r-pill);
  background: var(--gold);
  color: #1a1200;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.15em;
  box-shadow: 0 2px 10px rgba(201, 162, 39, 0.5);
  margin-bottom: 12px;
}
.fortune-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.fortune-poem {
  font-size: 13px;
  line-height: 1.8;
  color: var(--gold-2);
  margin-bottom: 18px;
  letter-spacing: 0.08em;
  font-family: "PingFang SC", "STKaiti", "KaiTi", serif;
}
.fortune-advice {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  text-align: left;
}
.advice-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e4e4e7;
}
.tag-yi {
  background: #166534;
  color: #86efac;
  font-size: 11px;
  font-weight: 800;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  flex-shrink: 0;
}
.tag-ji {
  background: #991b1b;
  color: #fca5a5;
  font-size: 11px;
  font-weight: 800;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  flex-shrink: 0;
}

/* 覆盖层 Canvas 刮刮乐 */
.scratch-canvas {
  position: absolute;
  top: 50px;
  left: 20px;
  right: 20px;
  bottom: 70px;
  width: calc(100% - 40px);
  height: 250px;
  border-radius: var(--r-md);
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: opacity 0.4s ease;
  z-index: 10;
}
.scratch-canvas.is-cleared {
  opacity: 0;
  pointer-events: none;
}

.scratch-tip {
  position: absolute;
  bottom: 24px;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gold-2);
  opacity: 0.85;
  animation: pulse-tip 1.8s infinite;
  pointer-events: none;
  z-index: 11;
  transition: opacity 0.3s;
}
.scratch-tip svg { width: 14px; height: 14px; }
@keyframes pulse-tip {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.97); }
}

/* 操作按钮 */
.fortune-actions {
  width: 100%;
  margin-top: 14px;
  display: flex;
  gap: 10px;
  z-index: 12;
  transition: all 0.3s;
}
.fortune-actions.is-hidden {
  display: none;
}

.btn-primary {
  flex: 1;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #120e06;
  border: none;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(201, 162, 39, 0.35);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  flex: 1;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover { color: #fff; border-color: rgba(255, 255, 255, 0.2); }
