/* 纹样抽线 - 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --ink: #2f5d62;
  --ink-dark: #1f4044;
  --coral: #e8734a;
  --paper: #f7f4ee;
  --paper-dark: #ede8dd;
  --gold: #c9a86a;
}

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--paper);
  background-image: radial-gradient(circle at 20% 20%, rgba(201, 168, 106, 0.06) 0, transparent 40%),
                    radial-gradient(circle at 80% 80%, rgba(47, 93, 98, 0.05) 0, transparent 40%);
  color: var(--ink-dark);
  overflow: hidden;
  user-select: none;
}

#app { display: flex; flex-direction: column; height: 100%; }

/* ---------- 顶栏 ---------- */
#hud {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(47, 93, 98, 0.18);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
}

#title-block h1 {
  font-size: 22px; letter-spacing: 6px; color: var(--ink);
  font-weight: 700; display: inline-block;
}
#title-block .subtitle { font-size: 12px; color: var(--gold); margin-left: 8px; letter-spacing: 2px; }

#progress-block { flex: 1; min-width: 140px; max-width: 420px; }
#counter { font-size: 13px; color: var(--ink); margin-bottom: 4px; font-variant-numeric: tabular-nums; transform-origin: left center; }
#counter #done { color: var(--coral); font-weight: 700; font-size: 15px; }
#counter.pop { animation: cntpop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1); }
#counter #done.pop { display: inline-block; animation: cntpop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes cntpop { 0% { transform: scale(1); } 40% { transform: scale(1.45); color: var(--coral); } 100% { transform: scale(1); } }
#progress-bar {
  height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--paper-dark);
  border: 1px solid rgba(47, 93, 98, 0.15);
}
#progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--coral), var(--gold));
  border-radius: 4px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

#btn-block { display: flex; gap: 8px; margin-left: auto; }
#btn-block button {
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  padding: 7px 14px; border-radius: 20px; font-size: 13px; cursor: pointer;
  transition: all 0.2s; letter-spacing: 1px;
}
#btn-block button:hover { background: var(--ink); color: #fff; }
#btn-block button:active { transform: scale(0.95); }

/* ---------- 画布 ---------- */
#stage-wrap { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }

#stage {
  background: #fffdf9;
  border-radius: 14px;
  box-shadow: 0 6px 40px rgba(47, 93, 98, 0.14), 0 0 0 1px rgba(47, 93, 98, 0.1);
  cursor: default;
  touch-action: manipulation;
}
#stage.grabbable { cursor: pointer; }

/* ---------- 提示条 ---------- */
#toast {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: rgba(31, 64, 68, 0.92); color: #fff;
  padding: 8px 18px; border-radius: 20px; font-size: 13px; letter-spacing: 1px;
  opacity: 0; pointer-events: none; transition: all 0.3s;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.good { background: rgba(200, 120, 60, 0.95); }

/* ---------- 通关 ---------- */
#win-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
  background: linear-gradient(to top, rgba(247, 244, 238, 0.92) 0%, rgba(247, 244, 238, 0) 45%);
  opacity: 0; pointer-events: none; transition: opacity 0.8s;
}
#win-overlay.show { opacity: 1; pointer-events: auto; }

#win-card {
  text-align: center; padding: 26px 46px 34px; margin-bottom: 4vh;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.win-seal {
  width: 54px; height: 54px; margin: 0 auto 12px;
  background: #b03a2e; color: #fff; border-radius: 10px;
  font-size: 30px; line-height: 54px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(176, 58, 46, 0.35);
  transform: rotate(-6deg);
}
#win-card h2 { font-size: 26px; letter-spacing: 10px; color: var(--ink); margin-bottom: 10px; }
#win-card p { font-size: 14px; color: #6b7f81; line-height: 1.9; margin-bottom: 18px; }
#btn-again {
  border: none; background: linear-gradient(135deg, var(--coral), #d4593a); color: #fff;
  padding: 11px 34px; border-radius: 24px; font-size: 15px; letter-spacing: 3px;
  cursor: pointer; box-shadow: 0 6px 18px rgba(232, 115, 74, 0.4); transition: transform 0.2s;
}
#btn-again:hover { transform: translateY(-2px); }
.hidden { display: none !important; }

/* ---------- 底部规则 ---------- */
#rules {
  text-align: center; font-size: 12px; color: #7d8f91;
  padding: 8px 14px 12px; line-height: 1.8; letter-spacing: 0.5px;
}
#rules b { color: var(--ink); }
.dot-free, .dot-blocked {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  vertical-align: -1px; margin: 0 2px;
}
.dot-free { background: var(--coral); box-shadow: 0 0 0 2px rgba(232, 115, 74, 0.25); }
.dot-blocked { background: #b9c4c5; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  #hud { padding: 8px 10px; gap: 8px; }
  #title-block h1 { font-size: 17px; letter-spacing: 3px; }
  #title-block .subtitle { display: none; }
  #btn-block button { padding: 5px 10px; font-size: 12px; }
  #rules { font-size: 11px; }
}
