/* 家具組裝工坊 */
.fp { padding: clamp(12px, 2.4vw, 22px); }
.fp-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.fp-levels { display: flex; gap: 6px; flex-wrap: wrap; }
.fp-level {
  font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; color: var(--ink);
  padding: 5px 12px; border: var(--line); border-radius: 999px; background: var(--white);
}
.fp-level.current { background: var(--games); color: #fff; }
.fp-level:disabled { cursor: not-allowed; opacity: .45; }
.fp-level .st { color: #e0a100; margin-left: 4px; letter-spacing: -1px; }
.fp-level.current .st { color: var(--sun); }
.fp-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fp-progress { height: 10px; border: 2px solid var(--ink); border-radius: 99px; background: var(--paper-2); margin: 12px 0 14px; overflow: hidden; }
.fp-progress i { display: block; height: 100%; width: 0; background: var(--kids); transition: width .3s; }

.fp-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.fp-side { display: flex; flex-direction: column; gap: 12px; }
.fp-manual, .fp-tray { background: var(--paper); border: var(--line); border-radius: 16px; padding: 12px 14px; }
.fp-step { font-weight: 700; font-size: .8rem; color: var(--games); letter-spacing: .05em; }
.fp-manual h2 { font-size: 1.3rem; margin: 2px 0 4px; }
.fp-manual p { font-size: .9rem; color: var(--ink-soft); margin: 0; min-height: 4.2em; line-height: 1.6; }
.fp-drawing { height: 120px; background: var(--white); border: 2px solid var(--ink); border-radius: 12px; margin: 8px 0; display: grid; place-items: center; }
.fp-drawing svg { width: 92%; height: 92%; }
.fp-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.fp-dot { width: 20px; height: 7px; border-radius: 6px; background: #e6dccb; }
.fp-dot.done { background: var(--kids); }
.fp-dot.now { background: var(--games); }
.fp-tray h3 { font-size: 1.05rem; margin: 0 0 8px; }
.fp-tray h3 small { font-family: var(--font-body); font-size: .78rem; color: var(--ink-soft); margin-left: 6px; }
.fp-parts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fp-part {
  position: relative; touch-action: none; user-select: none; cursor: grab;
  height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--white); border: 2px solid var(--ink); border-radius: 12px;
}
.fp-part.active { background: var(--sun-pale); box-shadow: 3px 3px 0 var(--ink); animation: fp-wiggle 1.6s ease-in-out infinite; }
.fp-part.done { opacity: .4; }
.fp-part.screw { background: var(--sky-pale); }
.fp-part svg { height: 46px; width: 86%; }
.fp-part span { font-size: .78rem; font-weight: 700; }
.fp-part .count { position: absolute; top: 3px; right: 7px; font-size: .7rem; color: var(--ink-soft); }
@keyframes fp-wiggle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-1.5deg); } }

.fp-tools { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 10px; }
.fp-tool {
  font: inherit; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 4px;
  background: var(--white); border: 2px solid var(--ink); border-radius: 12px;
}
.fp-tool .ico { font-size: 1.6rem; line-height: 1.2; }
.fp-tool b { font-size: .85rem; }
.fp-tool kbd { font: inherit; font-size: .7rem; color: var(--ink-soft); }
.fp-tool.selected { background: var(--sun); box-shadow: 3px 3px 0 var(--ink); }
.fp-tool.recommended:not(.selected) { outline: 3px dashed var(--kids); outline-offset: 2px; }

.fp-stage {
  position: relative; aspect-ratio: 4 / 3; touch-action: none; overflow: hidden; user-select: none;
  background: #fbeeda; border: var(--line); border-radius: 16px;
}
.fp-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
.fp-poster { position: absolute; inset: 0; width: 100%; height: 100%; }
.fp-stage.ready .fp-poster { display: none; }
.fp-start { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 7; background: rgba(34, 48, 74, .35); }
.fp-start[hidden] { display: none; }
.fp-load { font-weight: 700; margin: 10px 0 0 !important; color: var(--ink) !important; }
.fp-load::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 3px solid var(--ink); border-right-color: transparent; border-radius: 50%; animation: fp-spin .8s linear infinite; }
@keyframes fp-spin { to { transform: rotate(360deg); } }
.fp-toast {
  position: absolute; top: 12px; left: 50%; transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; border-radius: 99px; padding: 8px 16px; font-weight: 700; font-size: .9rem;
  white-space: nowrap; transition: .2s; z-index: 5;
}
.fp-toast.show { opacity: 1; transform: translate(-50%, 0); }
.fp-overlay { position: absolute; inset: 0; display: none; place-items: center; padding: 16px; background: rgba(34, 48, 74, .55); z-index: 8; }
.fp-overlay.show { display: grid; }
.fp-win { background: var(--white); border: var(--line); border-radius: 22px; box-shadow: var(--pop-lg); padding: 22px 26px; text-align: center; max-width: 400px; }
.fp-stars { font-size: 2.6rem; color: #e0a100; letter-spacing: 4px; }
.fp-stars .off { color: #e3dacb; }
.fp-win h2 { margin: 4px 0; font-size: 1.6rem; }
.fp-win p { color: var(--ink-soft); margin: 0 0 14px; }
.fp-win .btn { margin: 4px; }
.fp-status { display: flex; gap: 8px; align-items: center; min-height: 3em; margin: 10px 2px 0; color: var(--ink-soft); font-size: .95rem; }
.fp-status #statusEmoji { font-size: 1.5rem; }
.fp-note { font-size: .85rem; margin-top: 12px; }

.fp-proxy { pointer-events: none; position: fixed; z-index: 9999; width: 110px; height: 80px; opacity: .9; transform: translate(-50%, -50%); filter: drop-shadow(3px 4px 0 rgba(34, 48, 74, .5)); }
.fp-proxy svg { width: 100%; height: 100%; }

@media (max-width: 760px) {
  .fp-body { grid-template-columns: 1fr; }
  .fp-main { order: -1; }
  .fp-parts { grid-template-columns: repeat(3, 1fr); }
  .fp-manual p { min-height: 0; }
  .fp-drawing { display: none; }
  .fp-tool b { font-size: .72rem; }
  .fp-tool kbd { display: none; }
}

/* 3D 拍的零件圖、說明書圖 */
.fp-part img { height: 52px; width: 90%; object-fit: contain; pointer-events: none; }
.fp-drawing img { width: 100%; height: 100%; object-fit: contain; }
.fp-proxy img { width: 100%; height: 100%; object-fit: contain; }

/* 完成：上方小橫幅，不擋住作品，下面的家具可以照樣拖曳旋轉 */
.fp-overlay { inset: 10px 10px auto 10px; padding: 0; background: none; place-items: start center; pointer-events: none; }
.fp-overlay.show { display: grid; animation: fp-drop .35s ease-out; }
.fp-overlay .fp-win {
  pointer-events: auto; max-width: none; display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; justify-content: center;
  padding: 8px 14px; border-radius: 16px; box-shadow: var(--pop);
}
.fp-overlay .fp-stars { font-size: 1.5rem; letter-spacing: 1px; }
.fp-overlay h2 { font-size: 1.15rem; margin: 0; }
.fp-overlay p { margin: 0; font-size: .85rem; }
.fp-overlay .btn { margin: 0; font-size: .95rem; padding: 5px 14px; box-shadow: 3px 3px 0 var(--ink); }
@keyframes fp-drop { from { transform: translateY(-20px); opacity: 0; } }
