/* 建筑拼图页 */

main.puzzle-main {
  min-height: calc(100vh - var(--header-h));
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem) 3rem;
  max-width: 56rem;
  margin: 0 auto;
}

.puzzle-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

.puzzle-page-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4.5vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.puzzle-lead {
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.7;
}

.puzzle-level-card {
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid rgba(26, 26, 26, 0.07);
  padding: 1.25rem 1.35rem 1.5rem;
  box-shadow: 0 2px 14px rgba(26, 26, 26, 0.06);
  margin-bottom: 1.25rem;
}

.puzzle-level-card h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.puzzle-level-card .puzzle-level-desc {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-muted);
  line-height: 1.65;
}

/* 深色拼台 + 左下缩略图（对齐常见在线拼图站布局） */
.puzzle-workspace {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto 1.25rem;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.puzzle-canvas-wrap {
  position: relative;
  width: 100%;
  background: #1e2126;
}

#puzzle-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 720;
  touch-action: none;
  cursor: grab;
  vertical-align: middle;
}

#puzzle-canvas:active {
  cursor: grabbing;
}

.puzzle-ref-thumb {
  position: absolute;
  left: 10px;
  bottom: 10px;
  margin: 0;
  padding: 8px 8px 6px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  backdrop-filter: blur(6px);
  max-width: min(42vw, 168px);
  pointer-events: none;
  z-index: 2;
}

.puzzle-ref-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.puzzle-ref-thumb figcaption {
  margin-top: 6px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
}

.puzzle-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.puzzle-progress {
  font-size: 0.85rem;
  font-weight: 600;
  color: #8b4513;
}

.puzzle-btn-row {
  display: flex;
  gap: 0.5rem;
}

.puzzle-btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(139, 69, 19, 0.12);
  color: #6b3810;
  transition: background 0.2s, transform 0.2s;
}

.puzzle-btn:hover {
  background: rgba(139, 69, 19, 0.2);
}

.puzzle-btn:active {
  transform: scale(0.98);
}

.puzzle-btn-ghost {
  background: rgba(45, 74, 94, 0.15);
  color: #2d4a5e;
}

.puzzle-btn-ghost:hover {
  background: rgba(45, 74, 94, 0.25);
}

.puzzle-complete {
  margin-top: 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(139, 69, 19, 0.1), rgba(45, 74, 94, 0.08));
  border: 1px solid rgba(139, 69, 19, 0.2);
}

.puzzle-complete[hidden] {
  display: none !important;
}

.puzzle-complete p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.6;
}

.puzzle-complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.puzzle-complete-actions .puzzle-btn-primary {
  background: #8b4513;
  color: #fff;
}

.puzzle-complete-actions .puzzle-btn-primary:hover {
  background: #6b3810;
}

.puzzle-complete-actions a.puzzle-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.puzzle-note {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 1rem;
  padding: 0.6rem 0.75rem;
  background: rgba(26, 26, 26, 0.04);
  border-radius: 8px;
  line-height: 1.5;
}

body.puzzle-modal-open {
  overflow: hidden;
}

/* 通关弹窗 */
.puzzle-win-modal[hidden] {
  display: none !important;
}

.puzzle-win-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.puzzle-win-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 14, 0.55);
  backdrop-filter: blur(4px);
}

.puzzle-win-dialog {
  position: relative;
  z-index: 1;
  max-width: 22rem;
  width: 100%;
  padding: 2rem 1.75rem 1.75rem;
  border-radius: 18px;
  background: linear-gradient(165deg, #fdfaf3 0%, #f0ebe0 45%, #e8dfd2 100%);
  border: 1px solid rgba(139, 69, 19, 0.2);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  text-align: center;
  animation: puzzle-win-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes puzzle-win-pop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.puzzle-win-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 50%;
  background: rgba(26, 26, 26, 0.06);
  color: var(--ink-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.puzzle-win-close:hover {
  background: rgba(139, 69, 19, 0.12);
  color: #6b3810;
}

.puzzle-win-badge {
  display: block;
  max-width: min(200px, 55vw);
  height: auto;
  margin: 0 auto 0.5rem;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.12));
}

.puzzle-win-script {
  margin: 0 0 0.75rem;
  font-family: "Ma Shan Zheng", "KaiTi", "STKaiti", cursive;
  font-size: clamp(2.5rem, 8vw, 3.25rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: #7a2f2f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  line-height: 1.2;
}

.puzzle-win-sub {
  margin: 0 0 1.35rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.65;
}

.puzzle-win-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}

.puzzle-win-actions .puzzle-btn-primary {
  background: #8b4513;
  color: #fff;
}

.puzzle-win-actions .puzzle-btn-primary:hover {
  background: #6b3810;
}

.puzzle-win-actions a.puzzle-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
