/* ==========================================================================
   css/play.css —— 三处互动：抽非遗签 / 打铁花 / 剪纸生成器
   说明：这三块是“可上手玩”的部分，单独成文件，方便和展示型板块分开维护。
        （声音墙的样式在 gallery.css 里，与卡片墙贴在一起。）
   ========================================================================== */

/* ======================================================================
   一、抽一张非遗签：签筒晃动 + 竹签弹出
   ====================================================================== */
.draw-shell {
  display: grid;
  gap: 26px;
  padding: 30px 22px 28px;
}

.draw-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* 签筒 */
.tube-wrap {
  position: relative;
  width: 168px;
  height: 210px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  perspective: 700px;
}

.tube {
  position: relative;
  width: 132px;
  height: 170px;
  transform-origin: 50% 92%;
}

.tube.shaking { animation: tube-shake .62s ease-in-out; }

@keyframes tube-shake {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(-9deg) translateY(-3px); }
  32%  { transform: rotate(8deg) translateY(-5px); }
  50%  { transform: rotate(-7deg) translateY(-3px); }
  68%  { transform: rotate(6deg) translateY(-2px); }
  84%  { transform: rotate(-3deg); }
  100% { transform: rotate(0deg); }
}

/* 筒身：竹木质感（写在签之后，正好盖住签脚） */
.tube-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 140px;
  border-radius: 8px 8px 18px 18px;
  background:
    repeating-linear-gradient(90deg,
      rgba(31, 28, 26, .05) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #e0cb9b 0%, #cbb078 42%, #ab8f5a 100%);
  border: 1px solid rgba(90, 68, 30, .55);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, .45),
    inset 0 -18px 30px rgba(90, 68, 30, .32),
    0 14px 26px rgba(31, 28, 26, .22);
}

/* 筒口 */
.tube-mouth {
  position: absolute;
  left: -4px;
  right: -4px;
  top: 26px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #7d6231, #4b3a18);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, .5);
}

/* 筒底投影 */
.tube-foot {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -9px;
  height: 13px;
  border-radius: 50%;
  background: rgba(75, 58, 24, .32);
  filter: blur(4px);
}

/* 露出的竹签（DOM 里排在筒身之前） */
.tube-stick {
  position: absolute;
  bottom: 120px;
  width: 9px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #f7ecd0, #d8c393);
  border: 1px solid rgba(120, 92, 40, .45);
  transform-origin: 50% 100%;
}

.tube-stick:nth-child(1) { left: 30px; height: 56px; --r: -7deg; transform: rotate(-7deg); }
.tube-stick:nth-child(2) { left: 46px; height: 70px; --r: -3deg; transform: rotate(-3deg); }
.tube-stick:nth-child(3) { left: 61px; height: 60px; --r: 1deg;  transform: rotate(1deg); }
.tube-stick:nth-child(4) { left: 76px; height: 74px; --r: 5deg;  transform: rotate(5deg); }
.tube-stick:nth-child(5) { left: 92px; height: 52px; --r: 9deg;  transform: rotate(9deg); }

.tube-stick.rattle { animation: stick-rattle .5s ease-in-out 1; }

@keyframes stick-rattle {
  0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
  40%      { transform: translateY(-9px) rotate(calc(var(--r, 0deg) + 6deg)); }
  70%      { transform: translateY(-3px) rotate(calc(var(--r, 0deg) - 5deg)); }
}

.draw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.draw-count {
  font-family: var(--font-kai);
  font-size: .8rem;
  letter-spacing: .1em;
  text-align: center;
  color: var(--ink-soft);
}

/* 签筒提示的竖排小字 */
.tube-label {
  font-family: var(--font-kai);
  font-size: .8rem;
  letter-spacing: .34em;
  text-indent: .34em;
  color: var(--ink-soft);
  opacity: .8;
}

/* ---------------------------------------------------------------- 竹签 */
.sign-stage { display: flex; justify-content: center; min-height: 40px; }

.sign {
  position: relative;
  width: min(268px, 78vw);
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 12px;
  border: 1px solid rgba(120, 92, 40, .5);
  background:
    repeating-linear-gradient(90deg,
      rgba(120, 92, 40, .07) 0 2px, transparent 2px 8px),
    linear-gradient(180deg, #f0e2bd 0%, #e3d0a3 38%, #d3bb85 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .55),
    inset 0 -20px 34px rgba(120, 92, 40, .22),
    0 18px 34px rgba(31, 28, 26, .2);
}

.sign-stage.out .sign { animation: sign-out .62s var(--spring) both; }

@keyframes sign-out {
  0%   { opacity: 0; transform: translateY(46px) rotate(-5deg) scale(.9); }
  65%  { opacity: 1; transform: translateY(-6px) rotate(1.5deg) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
}

/* 签头：穿绳孔 */
.sign-head {
  position: relative;
  width: 58%;
  height: 20px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #b89a5f, #8b6f3a);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .3);
}

.sign-head::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #4b3a18;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .35);
}

/* 签面：竖排 */
.sign-face {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  width: 100%;
  padding: 8px 0 18px;
  min-height: 330px;
}

.sign-face > * { writing-mode: vertical-rl; }

.sign-no {
  font-family: var(--font-kai);
  font-size: .78rem;
  letter-spacing: .3em;
  color: var(--ink-soft);
  align-self: flex-start;
}

.sign-name {
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .6);
}

.sign-region {
  font-family: var(--font-kai);
  font-size: .82rem;
  letter-spacing: .18em;
  color: var(--red-deep);
}

.sign-words {
  font-family: var(--font-kai);
  font-size: .96rem;
  letter-spacing: .16em;
  line-height: 1.4;
  color: var(--ink-2);
}

/* 签尾 */
.sign-foot {
  width: 100%;
  padding-top: 12px;
  border-top: 1px dashed rgba(120, 92, 40, .5);
  text-align: center;
}

.sign-more {
  padding: .42em 1.3em;
  border: 1px solid rgba(178, 58, 43, .55);
  border-radius: 999px;
  font-family: var(--font-kai);
  font-size: .82rem;
  letter-spacing: .14em;
  color: var(--red);
  background: rgba(255, 253, 246, .78);
  transition: background .22s var(--ease), color .22s var(--ease), transform .22s var(--ease);
}

.sign-more:hover { background: var(--red); color: #fdf8ee; transform: translateY(-2px); }

/* ======================================================================
   二、打铁花小游戏
   ====================================================================== */
.th-shell { padding: 26px 22px 24px; }

.th-stage {
  position: relative;
  height: clamp(320px, 54vw, 460px);
  overflow: hidden;
  border: 1px solid rgba(31, 28, 26, .5);
  border-radius: var(--radius-sm);
  background: radial-gradient(ellipse at 50% 110%, #1d1613, var(--night) 62%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .6);
  touch-action: none;
  cursor: pointer;
}

.th-canvas { display: block; width: 100%; height: 100%; }

.th-hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 16px 16px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(14, 11, 10, .8));
}

.th-tip {
  margin-top: 10px;
  font-family: var(--font-kai);
  font-size: .8rem;
  letter-spacing: .16em;
  text-align: center;
  color: rgba(246, 240, 228, .78);
}

.th-power {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(246, 240, 228, .14);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
}

.th-power i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd672, #ff8a2b 55%, #c9401f);
  box-shadow: 0 0 12px rgba(255, 140, 43, .7);
  transition: width .06s linear;
}

/* 结果卡 */
.th-result {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 45%, rgba(178, 58, 43, .35), rgba(14, 11, 10, .92) 70%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
}

.th-result[hidden] { display: none; }

.th-result.show { animation: th-show .7s var(--ease-out) forwards; }

@keyframes th-show {
  0%   { opacity: 0; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}

.th-badge {
  padding: .5em 1.6em;
  border: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  font-family: var(--font-kai);
  font-size: clamp(.96rem, 3vw, 1.3rem);
  font-weight: 700;
  letter-spacing: .2em;
  color: #ffeec2;
  background: rgba(178, 58, 43, .55);
  box-shadow: 0 0 26px rgba(255, 190, 90, .3);
  animation: th-badge .8s var(--spring) .1s both;
}

@keyframes th-badge {
  from { opacity: 0; transform: translateY(18px) scale(.86); }
  to   { opacity: 1; transform: none; }
}

.th-sub {
  font-family: var(--font-kai);
  font-size: .9rem;
  letter-spacing: .16em;
  color: rgba(246, 240, 228, .82);
}

.th-result .btn { margin-top: 6px; }

/* ======================================================================
   三、剪纸生成器
   ====================================================================== */
.pc-shell {
  display: grid;
  gap: 26px;
  padding: 28px 22px 26px;
}

.pc-controls { display: grid; gap: 18px; align-content: start; }

.pc-group-title {
  font-family: var(--font-kai);
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .24em;
  color: var(--ink);
}

.pc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.pc-chips .chip { flex-direction: column; align-items: flex-start; padding: .5em 1em; }

.chip-dot i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(31, 28, 26, .35);
  box-shadow: inset 0 0 0 2px rgba(255, 253, 246, .6);
}

.pc-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: var(--line);
  border-radius: var(--radius-sm);
  background:
    url('../assets/svg/paper-noise.svg') 0 0 / 240px 240px,
    rgba(255, 253, 246, .6);
  box-shadow: var(--shadow-sm);
}

.pc-stage .pc-svg {
  width: min(400px, 100%);
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(31, 28, 26, .22));
  animation: pc-in .5s var(--ease-out);
}

@keyframes pc-in {
  from { opacity: 0; transform: scale(.94) rotate(-2deg); }
  to   { opacity: 1; transform: none; }
}

.pc-note {
  margin-top: 12px;
  font-family: var(--font-kai);
  font-size: .84rem;
  letter-spacing: .12em;
  text-align: center;
  color: var(--ink-soft);
}

.pc-actions { display: flex; gap: 12px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  .tube.shaking, .sign-stage.out .sign, .th-result.show,
  .th-badge, .pc-stage .pc-svg { animation: none; }
  .sign-stage.out .sign { opacity: 1; }
  .th-result.show { opacity: 1; }
}