/* ==========================================================
   clues.css —— 线索板（墙上软木板放大到画面正中）
   ========================================================== */

.cb-scene {
  position: absolute;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  font-family: var(--f-sans);
  animation: cb-scene-in 0.3s var(--ease);
}

@keyframes cb-scene-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* —— 吧台 01 背景：镜头缓慢推进 —— */
.cb-scene-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/bar-bg-01.png') center / 100% 100% no-repeat;
  transform-origin: 36.2% 45%;
  animation: cb-bg-in 1.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes cb-bg-in {
  from { transform: scale(1); filter: brightness(0.62) saturate(0.9) blur(0px); }
  to   { transform: scale(1.16); filter: brightness(0.52) saturate(0.86) blur(2.5px); }
}

.cb-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 72% 72% at 50% 50%,
      rgba(0, 0, 0, 0) 32%,
      rgba(0, 0, 0, 0.42) 70%,
      rgba(0, 0, 0, 0.78) 100%),
    rgba(10, 5, 8, 0.3);
  cursor: default;
}

/* ==========================================================
   线索板本体：从墙上原位放大到正中
   ========================================================== */

.cb-board {
  position: absolute;
  left: 8%;
  top: 3.05%;
  width: 84%;
  aspect-ratio: 1497 / 941;
  opacity: 0;
  transform: translate(-16%, -9.1%) scale(0.27);
  transform-origin: 50% 50%;
  transition:
    transform 1.05s cubic-bezier(0.2, 0.82, 0.2, 1) 0.12s,
    opacity 0.45s ease 0.1s;
}

.cb-scene.is-open .cb-board {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* 线索板底图（真实素材） */
.cb-board-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 38px 80px rgba(0, 0, 0, 0.85));
}

/* 软木内板：与底图的木框内沿对齐，只用来定位线索 */
.cb-cork {
  position: absolute;
  left: 6.2%;
  right: 3.2%;
  top: 16.2%;
  bottom: 10.2%;
}

/* ==========================================================
   钉在板上的线索
   ========================================================== */

.cb-item {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform: rotate(var(--r));
  transform-origin: 50% 12%;
  filter: drop-shadow(0 9px 16px rgba(0, 0, 0, 0.55));
  transition: transform 0.28s var(--ease), filter 0.28s var(--ease);
  animation: cb-item-in 0.5s var(--ease) both;
  animation-delay: calc(0.5s + var(--i) * 0.06s);
  z-index: 2;
}

@keyframes cb-item-in {
  from { opacity: 0; scale: 0.88; }
  to   { opacity: 1; scale: 1; }
}

.cb-item:hover {
  transform: rotate(calc(var(--r) * 0.25)) scale(1.055);
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.7)) brightness(1.07);
  z-index: 4;
}

.cb-item-media {
  display: block;
  width: 100%;
  position: relative;
}

/* —— 终局红线 —— */
.cb-strings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.cb-string {
  fill: none;
  stroke: #b2352c;
  stroke-width: 2.4;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
  animation: cb-string-draw 0.5s ease forwards;
}

@keyframes cb-string-draw {
  to { stroke-dashoffset: 0; }
}

.cb-finale {
  position: absolute;
  left: 50%;
  bottom: 3.2%;
  z-index: 25;
  transform: translate(-50%, 22px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cb-finale.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.cb-finale-card {
  text-align: center;
  padding: 16px 40px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(40, 26, 40, 0.94), rgba(22, 13, 22, 0.96));
  border: 1px solid rgba(226, 190, 128, 0.34);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 236, 194, 0.12);
}

.cb-finale-ico {
  font-size: clamp(18px, 1.6vw, 28px);
  line-height: 1;
}

.cb-finale-card h3 {
  margin: 6px 0 4px;
  font-family: var(--f-serif);
  font-size: clamp(16px, 1.5vw, 27px);
  letter-spacing: 0.18em;
  color: #f4e2b6;
  text-shadow: 0 0 16px rgba(226, 168, 92, 0.45);
}

.cb-finale-card p {
  margin: 0 0 12px;
  font-size: clamp(11px, 0.92vw, 16px);
  line-height: 1.85;
  color: rgba(238, 226, 205, 0.8);
}

.cb-finale-btn {
  padding: 8px 30px;
  border: 1px solid rgba(226, 190, 128, 0.55);
  border-radius: 999px;
  background: rgba(226, 190, 128, 0.12);
  color: #f4e2b6;
  font-family: var(--f-serif);
  font-size: clamp(12px, 1vw, 17px);
  letter-spacing: 0.22em;
  cursor: pointer;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.cb-finale-btn:hover {
  background: rgba(226, 190, 128, 0.24);
  box-shadow: 0 0 18px rgba(226, 168, 92, 0.35);
}

.cb-item-media img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

/* 新的来信：封蜡偏暗紫，与旧信区分 */
.cb-item--letter2 .cb-item-media img {
  filter: hue-rotate(-24deg) saturate(0.92) brightness(0.94);
}

/* 图钉（真实素材） */
.cb-pin {
  position: absolute;
  top: 0;
  left: 50%;
  width: clamp(13px, 1.45vw, 26px);
  aspect-ratio: 115 / 169;
  transform: translate(-50%, -58%);
  background: url('../assets/clue-pin-small.png') center / contain no-repeat;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
  z-index: 3;
  pointer-events: none;
}

.cb-item.is-locked .cb-pin {
  display: none;
}

/* 标题小标签 */
.cb-item-tag {
  position: absolute;
  left: 50%;
  top: 101%;
  transform: translateX(-50%);
  margin-top: 0.6%;
  padding: 0.4% 6%;
  white-space: nowrap;
  font-family: var(--f-serif);
  font-size: clamp(10px, 0.94vw, 17px);
  letter-spacing: 0.12em;
  color: #f4e2b6;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 8px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

/* 未解锁：暗色空位 */
.cb-item.is-locked {
  cursor: default;
  filter: none;
}

.cb-item.is-locked:hover {
  transform: rotate(var(--r));
  filter: none;
}

.cb-item.is-locked .cb-item-media {
  background: none;
  border: 0;
  box-shadow: none;
}

.cb-item.is-locked .cb-item-media img {
  visibility: hidden;
}

.cb-item-lock {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  pointer-events: none;
}

.cb-item.is-locked .cb-item-lock {
  display: flex;
}

.cb-item-lock i {
  font-style: normal;
  font-family: var(--f-serif);
  font-size: clamp(20px, 2.2vw, 42px);
  color: rgba(226, 196, 128, 0.45);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.cb-item-lock em {
  font-style: normal;
  font-size: clamp(8px, 0.72vw, 13px);
  letter-spacing: 0.2em;
  color: rgba(226, 196, 128, 0.38);
}

/* 新线索：光晕贴着线索自身的轮廓 */
.cb-item.is-unread .cb-item-media {
  animation: cb-unread 2.4s ease-in-out infinite;
}

@keyframes cb-unread {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(244, 214, 146, 0.32)); }
  50%      { filter: drop-shadow(0 0 13px rgba(244, 214, 146, 0.88)); }
}

/* ==========================================================
   关闭 / 底部栏
   ========================================================== */

.cb-close {
  position: absolute;
  right: 0.4%;
  top: -3%;
  width: 4.8%;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  background: url('../assets/ui-circle-close.png') center / contain no-repeat;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
  transition: transform 0.2s var(--ease), filter 0.2s var(--ease);
  z-index: 6;
}

.cb-close:hover {
  transform: scale(1.08) rotate(6deg);
  filter: brightness(1.12) drop-shadow(0 0 12px rgba(240, 214, 143, 0.55));
}

.cb-foot {
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: -2%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 5;
  pointer-events: none;
}

.cb-progress {
  font-family: var(--f-serif);
  font-size: clamp(10px, 0.92vw, 17px);
  letter-spacing: 0.16em;
  color: rgba(244, 226, 182, 0.82);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

.cb-progress b {
  color: #f0d68f;
  font-size: 1.15em;
}

.cb-back,
.cb-next {
  pointer-events: auto;
  width: 13%;
  aspect-ratio: 409 / 116;
  padding: 0;
  border: 0;
  background: transparent center / contain no-repeat;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
  transition: transform 0.2s var(--ease), filter 0.2s var(--ease);
}

.cb-back { background-image: url('../assets/ui-btn-back.png'); }
.cb-next { background-image: url('../assets/ui-btn-next.png'); }

.cb-back:hover,
.cb-next:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.12) drop-shadow(0 0 14px rgba(240, 214, 143, 0.5));
}

.cb-back:active,
.cb-next:active {
  transform: translateY(0) scale(0.98);
}

/* ==========================================================
   线索详情
   ========================================================== */

.cb-detail {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 5%;
  background:
    radial-gradient(ellipse 70% 70% at 50% 48%,
      rgba(14, 8, 10, 0.55), rgba(6, 3, 6, 0.9));
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.26s var(--ease);
}

.cb-detail.is-shown {
  opacity: 1;
}

.cb-detail-close {
  position: absolute;
  top: 3.4%;
  right: 3.4%;
  width: 4.4%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: url('../assets/ui-circle-close.png') center / contain no-repeat;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.65));
  transition: transform 0.2s var(--ease), filter 0.2s var(--ease);
  z-index: 4;
}

.cb-detail-close:hover {
  transform: scale(1.08) rotate(6deg);
  filter: brightness(1.14) drop-shadow(0 0 12px rgba(240, 214, 143, 0.6));
}

/* —— 照片 —— */
.cb-photo-big {
  height: 68%;
  max-width: 72%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cb-photo-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.cb-photo-big img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 26px 54px rgba(0, 0, 0, 0.82));
}

@keyframes cb-photo-in {
  from { opacity: 0; transform: scale(0.4) rotate(var(--r, -4deg)); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

.cb-detail-cap {
  position: absolute;
  left: 50%;
  bottom: 5%;
  transform: translateX(-50%);
  width: min(62%, 980px);
  padding: 12px 30px 14px;
  text-align: center;
  color: #3a2820;
  background:
    linear-gradient(180deg, rgba(255, 250, 236, 0.55), rgba(224, 202, 168, 0.55)),
    linear-gradient(180deg, #efe0c4, #d9c3a0);
  border: 2px solid var(--c-gold);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
}

.cb-cap-title {
  display: block;
  font-family: var(--f-serif);
  font-size: clamp(14px, 1.25vw, 24px);
  font-weight: 700;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--c-deep-purple);
  margin-bottom: 4px;
}

.cb-detail-cap p {
  font-size: clamp(11px, 0.96vw, 18px);
  line-height: 1.8;
  margin: 0;
}

.cb-cap-hint {
  display: inline-block;
  margin-top: 4px;
  font-size: clamp(9px, 0.76vw, 13px);
  color: #8a6d2f;
  opacity: 0.85;
}

/* —— 塔罗牌 —— */
.cb-detail--tarot {
  justify-content: flex-start;
  padding-top: 4%;
}

.cb-tarot-scene {
  height: 68%;
  aspect-ratio: 2 / 3;
  perspective: 1600px;
  animation: cb-card-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes cb-card-in {
  from { opacity: 0; transform: translateY(6%) scale(0.35); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cb-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 1.05s cubic-bezier(0.24, 0.82, 0.24, 1);
  cursor: pointer;
}

.cb-detail.is-flipped .cb-card {
  transform: rotateY(180deg);
}

.cb-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.cb-card-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.78));
}

.cb-card-front {
  transform: rotateY(180deg);
}

.cb-card-glow {
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
    rgba(206, 168, 255, 0.42) 0%,
    rgba(150, 110, 210, 0.18) 45%,
    transparent 70%);
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

.cb-detail.is-flipped .cb-card-glow {
  opacity: 1;
}

/* —— 信件 —— */
.cb-detail--letter {
  justify-content: center;
  padding-top: 0;
}

.cb-letter-scene {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-letter-env {
  position: absolute;
  z-index: 3;
  height: 47%;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 22px 44px rgba(0, 0, 0, 0.8));
  animation: cb-env-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.cb-letter-env img {
  height: 100%;
  width: auto;
  max-width: 70vw;
  object-fit: contain;
}

@keyframes cb-env-in {
  from { opacity: 0; transform: scale(0.35) translateY(8%); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.cb-letter-scene.is-opened .cb-letter-env {
  animation: cb-env-open 0.85s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

@keyframes cb-env-open {
  0%   { opacity: 1; transform: scale(1) translateY(0); }
  45%  { opacity: 1; transform: scale(1.12) translateY(-1%); }
  100% { opacity: 0; transform: scale(1.24) translateY(6%); }
}

.cb-letter-sheet {
  position: relative;
  height: 84%;
  aspect-ratio: 1086 / 1448;
  opacity: 0;
  transform: translateY(7%) scale(0.9);
  transition:
    opacity 0.6s ease 0.2s,
    transform 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s;
}

.cb-letter-sheet.cb-parchment-sheet {
  height: 72%;
  aspect-ratio: 4 / 3;
}

.cb-letter-scene.is-opened .cb-letter-sheet {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.cb-sheet-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 26px 52px rgba(0, 0, 0, 0.82));
}

/* 新来信：空白羊皮纸卡片 */
.cb-parchment-sheet {
  background: url('../assets/ui-parchment.png') center / 100% 100% no-repeat;
  filter: drop-shadow(0 26px 52px rgba(0, 0, 0, 0.82));
}

/* 信纸上的文字 */
.cb-letter-text {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 24%;
  bottom: 20%;
  opacity: 0;
  transition: opacity 0.4s ease;
  overflow: hidden;
}

.cb-parchment-sheet .cb-letter-text {
  inset: 26% 12% 6%;
}

.cb-letter-scene.show-text .cb-letter-text {
  opacity: 1;
}

.cb-letter-veil {
  position: absolute;
  inset: -7% -5%;
  background: rgba(245, 229, 199, 0.93);
  -webkit-mask-image: radial-gradient(ellipse 78% 84% at 50% 50%, #000 58%, transparent 100%);
  mask-image: radial-gradient(ellipse 78% 84% at 50% 50%, #000 58%, transparent 100%);
}

.cb-letter-body {
  position: relative;
  z-index: 1;
  display: block;
  padding: 3.2% 4%;
  font-family: var(--f-serif);
  font-size: clamp(11px, 1.02vw, 19px);
  line-height: 2.05;
  color: #4a2f22;
  white-space: pre-wrap;
  text-shadow: 0 1px 0 rgba(255, 250, 235, 0.6);
}

.cb-letter-hint {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  font-size: clamp(9px, 0.78vw, 14px);
  letter-spacing: 0.14em;
  color: rgba(244, 226, 182, 0.7);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.cb-letter-hint.is-done {
  opacity: 0;
}
