/* 玩法相关：材料卡、换一批、自己写、反应徽章、稀有 / 传说 / 炸炉特效、主人页火候条。 */

/* ---------- 首屏层级（特效要插在插画和炉子之间） ---------- */
.diorama__world { z-index: 0; }
.diorama__glow { z-index: 1; }
.stove { z-index: 2; }
.diorama__snow { z-index: 3; }
.stove-talk { z-index: 5; }

/* ---------- 材料卡 ---------- */
.deck {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 4px 0 12px;
}
.mat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 112px;
  padding: 12px 6px 10px;
  border: var(--line);
  border-radius: 16px;
  font: inherit;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.9), transparent 60%),
    var(--paper-hi);
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  rotate: calc((var(--i, 1) - 1) * 2.5deg);
  transition: transform 0.18s var(--ease-pop), box-shadow 0.15s, background 0.15s;
  /* backwards：动画结束后不再锁住 transform，选中时的上浮才能生效 */
  animation: deal-in 0.45s var(--ease-pop) backwards;
  animation-delay: calc(var(--i, 0) * 0.07s);
  -webkit-tap-highlight-color: transparent;
}
.mat-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.mat-card:focus-visible { outline: 3px solid var(--ember-500); outline-offset: 3px; }
.mat-card__emoji { font-size: 34px; line-height: 1.1; }
.mat-card__name { font-weight: 900; font-size: var(--text-base); line-height: 1.2; text-align: center; word-break: break-all; }
.mat-card__cat {
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-faint);
  background: rgba(43, 28, 24, 0.07);
}
/* 没有 emoji 的材料：纯文字签 */
.mat-card--text { justify-content: center; gap: 8px; }
.mat-card--text .mat-card__name {
  padding: 0 2px 4px;
  font-family: var(--font-letter);
  font-size: 1.12rem;
  line-height: 1.25;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'><path d='M2 6 Q 14 2 26 6 T 50 6 T 74 6 T 98 5' fill='none' stroke='%23ff9a45' stroke-width='2.4' stroke-linecap='round'/></svg>") center bottom / 70% 6px no-repeat;
}
/* 名字长的卡：缩小字号，5~6 个字尽量一行；7 个字以上两行、字数均匀 */
.mat-card .mat-card__name { text-wrap: balance; }
.mat-card.is-long .mat-card__name { font-size: 0.92rem; }
.mat-card.is-xlong .mat-card__name { font-size: 0.84rem; }
.mat-card--text.is-long .mat-card__name { font-size: 0.98rem; }
.mat-card--text.is-xlong .mat-card__name { font-size: 0.9rem; }
.mat-card.is-picked {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.7), transparent 60%),
    var(--ember-300);
  transform: translateY(-6px);
  rotate: 0deg;
  box-shadow: 0 8px 0 var(--ink), 0 12px 24px -8px rgba(255, 122, 47, 0.8);
}
.mat-card.is-picked::after {
  content: "✓";
  position: absolute;
  top: -10px; right: -8px;
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
  color: var(--paper-hi);
  background: var(--clay);
  animation: pop-in 0.3s var(--ease-pop);
}
@keyframes deal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.85) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}

.refresh, .link-btn {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.refresh {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 3px 11px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 900;
  color: var(--ink);
  background: var(--paper-hi);
  box-shadow: 0 2px 0 var(--ink);
}
.refresh small { font-weight: 800; color: var(--ember-700); }
.refresh:active { transform: translateY(2px); box-shadow: none; }
.refresh[disabled] { opacity: 0.55; cursor: default; }
.link-btn {
  display: block;
  min-height: 40px;
  margin: 0 auto;
  padding: 6px 10px;
  border: 0;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--clay);
  background: none;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: 4px;
}
.custom { margin-top: 6px; animation: pop-in 0.3s var(--ease-pop); }

/* ---------- 反应徽章（结果卡） ---------- */
.reaction-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 900;
  box-shadow: 0 3px 0 var(--ink);
  rotate: -2deg;
  animation: badge-in 0.6s var(--ease-pop) 0.2s both;
}
.result[data-reaction="rare"] .reaction-badge { color: #fff; background: linear-gradient(135deg, #9b6bff, #6a3cf0); }
.result[data-reaction="legend"] .reaction-badge {
  color: var(--ink);
  background: linear-gradient(110deg, #ffe48a 20%, #fff6cf 40%, #ffd24a 60%);
  background-size: 200% 100%;
  animation: badge-in 0.6s var(--ease-pop) 0.2s both, gold-shine 2.4s linear 0.8s infinite;
}
@keyframes badge-in { from { opacity: 0; transform: scale(2) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes gold-shine { to { background-position: -200% 0; } }

/* 传说结果卡：一道金光扫过 */
.result[data-reaction="legend"] { overflow: hidden; }
.result[data-reaction="legend"]::after {
  content: "";
  position: absolute;
  inset: -20% auto -20% -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 236, 150, 0.65), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
  animation: card-sweep 2.6s ease-in-out 0.6s 2;
}
@keyframes card-sweep { from { left: -60%; } to { left: 130%; } }

/* ---------- 炉子：稀有变紫、传说变金 ---------- */
.stove.is-rare .stove__fire { background: radial-gradient(circle, rgba(214, 182, 255, 0.9) 0, rgba(150, 100, 255, 0.45) 38%, transparent 66%); }
.stove.is-rare .stove__burst i { background: #ecdfff; box-shadow: 0 0 9px 3px rgba(160, 110, 255, 0.95); }
.stove.is-legend .stove__fire { background: radial-gradient(circle, rgba(255, 246, 190, 0.95) 0, rgba(255, 205, 70, 0.55) 38%, transparent 66%); }
.stove.is-legend .stove__burst i { background: #fff3b0; box-shadow: 0 0 11px 4px rgba(255, 210, 74, 0.95); }
.stove.is-legend .stove__burst i:nth-child(odd) { width: 8px; height: 8px; }

/* 首屏的紫光一闪 / 金光四射 / 炸炉黑烟 */
.diorama::before, .diorama::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0;
}
.diorama::after { inset: 0; z-index: 3; }
.diorama.fx-rare::after {
  background: radial-gradient(ellipse 60% 50% at 49% 62%, rgba(167, 123, 255, 0.6), rgba(120, 80, 255, 0.15) 50%, transparent 72%);
  animation: fx-flash 1.8s ease-out forwards;
}
.diorama.fx-legend::after {
  background: radial-gradient(ellipse 65% 55% at 49% 62%, rgba(255, 226, 120, 0.75), rgba(255, 200, 60, 0.2) 50%, transparent 74%);
  animation: fx-flash 2.6s ease-out forwards;
}
.diorama.fx-legend::before {
  z-index: 1;
  left: 49%; top: 60%;
  width: 150%;
  padding-top: 150%;
  margin: -75% 0 0 -75%;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 222, 110, 0.38) 0 9deg, transparent 9deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 12%, transparent 62%);
  mask-image: radial-gradient(circle, #000 12%, transparent 62%);
  animation: rays 3.2s ease-out forwards;
}
.diorama.fx-explode { animation: shake 0.5s ease-in-out; }
.diorama.fx-explode::after {
  background: radial-gradient(ellipse 55% 45% at 49% 58%, rgba(20, 14, 22, 0.7), transparent 70%);
  animation: fx-flash 1.4s ease-out forwards;
}
@keyframes fx-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
@keyframes rays {
  0% { opacity: 0; transform: rotate(0) scale(0.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: rotate(70deg) scale(1.1); }
}

/* 传说：满屏金色粒子 */
.gold-rain { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.gold-rain i {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: var(--s); height: calc(var(--s) * 1.6);
  border-radius: 2px;
  background: linear-gradient(180deg, #fff3b0, #ffc93a);
  box-shadow: 0 0 8px rgba(255, 210, 74, 0.9);
  opacity: 0;
  animation: gold-fall var(--t) cubic-bezier(0.3, 0.6, 0.5, 1) var(--d) forwards;
}
.gold-rain i:nth-child(3n) { border-radius: 50%; height: var(--s); }
@keyframes gold-fall {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(20px, 105vh, 0) rotate(var(--r)); }
}

/* ---------- 主人页：火候条 ---------- */
.heat { margin-top: 18px; }
.heat__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.heat__label { font-weight: 900; }
.heat__label b { font-family: var(--font-letter); font-size: 1.5rem; color: var(--ember-600); margin-left: 4px; }
.tier-badge {
  padding: 2px 11px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 900;
  box-shadow: 0 2px 0 var(--ink);
}
.tier-badge--common { background: var(--paper-lo); }
.tier-badge--rare { color: #fff; background: #8a5cff; }
.tier-badge--epic { color: #fff; background: #e0478f; }
.tier-badge--legend { background: linear-gradient(110deg, #ffe48a, #ffd24a); }
.heat__bar {
  position: relative;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #2a1712;
  overflow: visible;
}
.heat__fill {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ember-300) 0%, var(--ember-500) 22%, #8a5cff 45%, #e0478f 70%, #ffd24a 100%);
  clip-path: inset(0 calc(100% - var(--pct)) 0 0 round 999px);
  animation: heat-grow 1.2s var(--ease-out) 0.3s both;
}
@keyframes heat-grow { from { clip-path: inset(0 100% 0 0 round 999px); } }
.heat__mark {
  position: absolute;
  top: -4px; bottom: -4px;
  left: var(--at);
  width: 2px;
  background: var(--ink);
}
.heat__mark i {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 4px;
  transform: translateX(-50%);
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-soft);
  white-space: nowrap;
}
.heat__hint { margin: 26px 0 0; font-size: var(--text-sm); font-weight: 800; }
.heat__hint b { color: var(--ember-700); }
.heat__rule { margin: 4px 0 0; font-size: var(--text-2xs); color: var(--ink-faint); }

@media (prefers-reduced-motion: reduce) {
  .gold-rain, .diorama::before { display: none; }
}

/* ---------- 等待期：倒计时、闷烧、闻一闻、猜一猜 ---------- */
.countdown-card { padding: 18px 14px 16px; text-align: center; }
.countdown { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.message-countdown, .paper .countdown { margin-top: 6px; }
.countdown__label { font-size: var(--text-sm); font-weight: 900; color: var(--ink-soft); letter-spacing: 0.08em; }
.countdown__digits { display: flex; align-items: center; gap: 4px; }
.countdown__digits b {
  min-width: 44px;
  padding: 6px 6px 4px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-family: var(--font-letter);
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--ember-300);
  background: linear-gradient(180deg, #3a1d14 0 50%, #2a140e 50% 100%);
  box-shadow: 0 3px 0 var(--ink);
}
.countdown__digits i { font-style: normal; font-size: var(--text-2xs); font-weight: 800; color: var(--ink-soft); }
.countdown__note { font-size: var(--text-xs); font-weight: 700; color: var(--ink-faint); }
.countdown.is-done .countdown__label { color: var(--ember-700); animation: pop-in 0.4s var(--ease-pop); }

.smolder-tag {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 13px;
  border: 2px dashed rgba(255, 190, 102, 0.6);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--ember-100);
  background: rgba(40, 18, 10, 0.55);
}

.sniff-bubble { margin-bottom: 14px; }
.sniff-bubble.is-new { animation: pop-in 0.5s var(--ease-pop); }
.sniff-bubble p { min-height: 1.6em; }
.clue-list { margin-top: 16px; padding-top: 12px; border-top: 2px dashed rgba(43, 28, 24, 0.2); }
.clue-list__title { margin: 0 0 8px; font-size: var(--text-xs); font-weight: 900; color: var(--ink-faint); letter-spacing: 0.1em; }
.clue-list ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.clue-list li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; font-size: var(--text-sm); line-height: 1.5; }
.clue-list time {
  align-self: start;
  padding: 1px 0;
  border-radius: 6px;
  font-size: var(--text-2xs);
  font-weight: 900;
  text-align: center;
  color: var(--paper-hi);
  background: var(--clay);
}

/* 闻一闻时炉子冒一大团烟 */
.stove.is-sniffed .stove__smoke i { animation-duration: 2.2s; width: 34px; height: 34px; }
.stove.is-sniffed .stove__fire { animation: fire-flare 1s var(--ease-pop); }
