/* 編舞模式（/）：三拍時間軸＋舞步庫。沿用 game.css 的卡牌、舞台、按鈕與畫面樣式，這裡只放編舞模式多的部分。 */
body.choreo { --dock-h: 30px; --hand-h: 190px; }
body.choreo.plate-on { --dock-h: 92px; }
body.choreo .app { grid-template-rows: minmax(190px, 1fr) auto auto auto; grid-template-columns: minmax(0, 1fr); }
body.choreo .plate { display: none; }
body.choreo.plate-on .plate { display: flex; }
body.choreo .score-dock { bottom: 8px; gap: 6px; }
body.choreo .stage-tools { bottom: calc(var(--dock-h) + 10px); }
body.choreo .judge { top: calc(env(safe-area-inset-top) + 56px); }
body.choreo .judge-avatar { width: 58px; height: 58px; }
body.choreo .boss-rule { top: calc(env(safe-area-inset-top) + 140px); }
body.choreo .busy-fx { top: 38%; }
body.choreo .center-pop { top: 26%; }

/* 演出中的小標籤 */
.show-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); box-shadow: 0 3px 10px rgba(167, 139, 250, 0.3); font-size: 13px; font-weight: 900;
}
.show-chip .busy-dot { width: 10px; height: 10px; animation-play-state: paused; opacity: 0.5; }
.show-chip.waiting .busy-dot { animation-play-state: running; opacity: 1; }
.show-chip.waiting { color: var(--lav-deep); }

/* ── 題目詩句 ─────────────────────────── */
.poem {
  position: relative; z-index: 4; justify-self: center; margin: -15px 16px 0; max-width: calc(100% - 32px);
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px 5px 8px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #fff, #fff4f8); box-shadow: 0 0 0 2px #fff, 0 4px 0 #f1d9e6, 0 8px 18px rgba(167, 139, 250, 0.3);
  color: var(--ink);
}
.poem-mark { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: linear-gradient(135deg, var(--lavender), var(--pink)); }
.poem-title { min-width: 0; font-size: 15px; font-weight: 900; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poem-arc { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--sunny-soft); color: #7a4a00; font-family: var(--num-font); font-size: 11px; font-weight: 900; }

/* ── 三拍時間軸 ───────────────────────── */
.timeline {
  position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  padding: 10px 10px 2px;
}
.timeline.off { visibility: hidden; }
.beat-col {
  position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 4px 5px; border-radius: 20px; background: rgba(255, 255, 255, 0.72); border: 2.5px solid transparent;
  box-shadow: 0 4px 0 #eee2f2, 0 8px 18px rgba(167, 139, 250, 0.16);
  transition: transform 0.25s cubic-bezier(.34, 1.56, .64, 1), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.beat-col.editable { cursor: pointer; }
.beat-col.selected {
  background: linear-gradient(180deg, #fffaf0, #fff1f6); border-color: #ffd36b; transform: translateY(-3px);
  box-shadow: 0 4px 0 #f5d98a, 0 0 0 4px rgba(255, 211, 107, 0.28), 0 10px 22px rgba(255, 158, 188, 0.35);
}
.beat-col.selected::before {
  content: "▼"; position: absolute; top: -13px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #f0b93f;
  animation: sel-bob 1s ease-in-out infinite;
}
@keyframes sel-bob { 50% { transform: translate(-50%, -3px); } }
.beat-col.pickable { cursor: pointer; border: 2.5px dashed var(--pink); animation: pick-pulse 1.2s ease-in-out infinite; }
@keyframes pick-pulse { 50% { box-shadow: 0 4px 0 #eee2f2, 0 0 0 5px rgba(255, 111, 156, 0.25); } }
.beat-col.drop-hot { border-color: #ffd36b; transform: scale(1.05); box-shadow: 0 0 0 4px rgba(255, 211, 107, 0.5), 0 0 22px 6px rgba(255, 211, 107, 0.6); }
.beat-col.focus { border-color: var(--lavender); background: linear-gradient(180deg, #fff, #f5f0ff); transform: translateY(-4px) scale(1.04); box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.3), 0 12px 26px rgba(124, 95, 214, 0.35); }
.beat-col.mode-result, .beat-col.mode-show { cursor: default; }

.bc-head { display: flex; align-items: center; gap: 4px; max-width: 100%; height: 18px; }
.bc-num { flex: none; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--lavender), var(--pink)); color: #fff; font-family: var(--num-font); font-size: 10.5px; font-weight: 900; }
.bc-name { min-width: 0; font-size: 12.5px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bc-slot {
  position: relative; padding: 0; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, 0.55);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.bc-action { width: 62px; height: 86px; border-radius: 12px; box-shadow: inset 0 0 0 2.5px rgba(91, 157, 255, 0.55), inset 0 0 16px rgba(91, 157, 255, 0.2); }
.bc-action .gcard { width: 100%; height: 100%; --card-w: 62px; --card-radius: 11px; }
.bc-slots { display: flex; align-items: center; gap: 5px; }
.bc-mods { display: flex; flex-direction: column; gap: 6px; }
.bc-mod { width: 30px; height: 30px; border-radius: 10px; box-shadow: inset 0 0 0 2px rgba(255, 111, 156, 0.5), inset 0 0 10px rgba(255, 111, 156, 0.18); }
.bc-slot.filled { background: none; box-shadow: none; }
.bc-mod.filled { background: radial-gradient(circle at 50% 38%, #fff 0%, #fff4d1 60%, #d9f5ec 100%); box-shadow: 0 0 0 2px #fff, 0 3px 0 #f1d9e6, 0 4px 8px rgba(255, 111, 156, 0.3); }
.bc-mod-art { position: relative; width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; border-radius: inherit; }
.bc-mod-art .art-emoji { font-size: 17px; }
.bc-mod-art .art-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.bc-ph { font-size: 24px; opacity: 0.4; filter: grayscale(0.3); }
.bc-mod .bc-ph { font-size: 12px; }
.beat-col.selected .bc-slot:not(.filled) { animation: socket-breathe 2.4s ease-in-out infinite; }
.beat-col.selected .bc-action.filled .gcard::after, .beat-col.selected .bc-mod.filled::after {
  content: "✕"; position: absolute; right: -5px; top: -5px; z-index: 5; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--text-secondary); font-size: 9px; font-weight: 900; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* 亮燈（同卡牌版的卡槽） */
.bc-slot.lit-hit { box-shadow: 0 0 0 3px #ffd36b, 0 0 18px 5px rgba(255, 211, 107, 0.8); transform: translateY(-2px) scale(1.04); }
.bc-slot.lit-partial { box-shadow: 0 0 0 3px var(--lavender), 0 0 12px 2px rgba(167, 139, 250, 0.65); }
.bc-slot.lit-miss .gcard-body, .bc-slot.lit-miss .bc-mod-art { filter: grayscale(1) brightness(0.92); opacity: 0.6; }
.bc-slot.lit-hit::before, .bc-slot.lit-partial::before, .bc-slot.lit-miss::before {
  position: absolute; left: -5px; top: -6px; z-index: 6; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 900; color: #fff; box-shadow: 0 0 0 2px #fff;
}
.bc-slot.lit-hit::before { content: "✓"; background: var(--good); }
.bc-slot.lit-partial::before { content: "◐"; background: var(--warning); color: #3b2a00; }
.bc-slot.lit-miss::before { content: "✕"; background: #b8b0c8; }
.bc-mod.lit-hit::before, .bc-mod.lit-partial::before, .bc-mod.lit-miss::before { width: 13px; height: 13px; font-size: 8px; left: -4px; top: -4px; }
.bc-slot.flash .gcard, .bc-slot.flash .bc-mod-art { animation: card-flip 0.5s cubic-bezier(.34, 1.4, .64, 1); }
.bc-slot.pending .gcard-body, .bc-action.queued .gcard-body, .bc-action.working .gcard-body { filter: saturate(0.6) brightness(1.05); }
.bc-action.working .gcard-body::after, .bc-slot.pending .gcard-body::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.8) 50%, transparent 70%);
  background-size: 250% 100%; animation: shimmer 1.2s linear infinite;
}
.bc-action.queued .gcard-body { opacity: 0.7; }

/* 感覺圖示：外圈是 ✓ 的機率 */
.bc-feel { display: flex; gap: 4px; min-height: 24px; align-items: center; margin-top: 3px; }
.bc-feel .bt-icon.small { width: 24px; height: 24px; font-size: 13px; }
.bc-feel .bt-icon.has-p:not(.hit):not(.partial):not(.miss) {
  border-color: transparent;
  background: radial-gradient(circle, #fff 0 56%, transparent 58%), conic-gradient(var(--mint) calc(var(--p, 0) * 1turn), #ece4f3 0);
}

.bc-meta { height: 18px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.bc-stars { font-size: 13px; letter-spacing: -1px; color: #f5b83d; text-shadow: 0 1px 0 #fff; white-space: nowrap; }
.bc-stars.s0, .bc-stars.wait { color: #d9d0e4; }
.bc-stars.s3 { color: #ffb800; text-shadow: 0 0 6px rgba(255, 184, 0, 0.6); }
.bc-fig { width: 18px; height: 18px; display: grid; place-items: center; color: var(--lav-deep); }
.bc-fig.floor { color: var(--blue-deep); }
.bc-fig.crouch { color: #c2568b; }
.fig { width: 18px; height: 18px; }
.bc-status { font-size: 13px; font-weight: 900; color: var(--text-muted); }
.bc-status.ok { color: var(--mint); }
.bc-score { padding: 0 8px; border-radius: 999px; background: linear-gradient(135deg, #fff2c2, #ffd36b); color: #7a4a00; font-family: var(--num-font); font-size: 12px; font-weight: 900; line-height: 18px; box-shadow: 0 2px 0 #f0b93f; }
.bc-warn {
  position: absolute; left: 50%; bottom: -7px; z-index: 6; transform: translateX(-50%) rotate(-3deg); max-width: 112%;
  height: 17px; padding: 0 6px; border-radius: 999px; background: #fff4d1; color: #8a5a00; pointer-events: none;
  font-size: 10px; font-weight: 900; line-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 0 0 1.5px #ffd36b, 0 3px 8px rgba(240, 185, 63, 0.35);
}

/* 拍與拍之間的連招 */
.bc-link {
  position: absolute; z-index: 5; transform: translate(-50%, -50%); display: inline-flex; flex-direction: column; align-items: center; gap: 0;
  padding: 3px 5px; border: 0; border-radius: 12px; background: #fff; box-shadow: 0 0 0 2px var(--mint-soft), 0 3px 8px rgba(63, 191, 152, 0.3);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.bc-link.has { opacity: 1; pointer-events: auto; }
.bl-icon { font-size: 12px; line-height: 1; }
.bl-name { font-size: 9px; font-weight: 900; color: #1f7a5d; line-height: 1.2; writing-mode: vertical-rl; letter-spacing: 0.04em; }
.bc-link.on { background: linear-gradient(180deg, var(--mint), #6fd6b5); box-shadow: 0 0 0 2px #fff, 0 0 14px 3px rgba(63, 191, 152, 0.75); animation: ribbon-glow 1.4s ease-in-out infinite; }
.bc-link.on .bl-name { color: #fff; }

/* ── 下方：舞步庫 ─────────────────────── */
.dock { position: relative; z-index: 3; padding: 4px 10px calc(env(safe-area-inset-bottom) + 8px); }
.library { display: flex; flex-direction: column; gap: 4px; transition: opacity 0.25s ease, filter 0.25s ease; }
.library.locked .lib-actions, .library.locked .lib-mods, .library.locked .energy { opacity: 0.55; filter: saturate(0.6); }
.lib-actions {
  display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 10px 6px 8px; margin: 0 -10px; padding-left: 14px; padding-right: 14px;
  scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 18px), transparent 100%);
}
.lib-actions::-webkit-scrollbar, .lib-mods::-webkit-scrollbar { display: none; }
.lib-card.gcard.size-mini { --card-w: 58px; flex: none; width: 58px; height: 81px; scroll-snap-align: start; touch-action: pan-x; }
.lib-card .gcard-name { font-size: 9.5px; }
.lib-card.in-use .gcard-body { border-color: #ffd36b; }
.lib-card.maxed .gcard-body { filter: grayscale(0.7); opacity: 0.5; }
.lib-card.lifted, .lib-mod.lifted { opacity: 0.35; }
.lib-count {
  position: absolute; right: -4px; top: -6px; z-index: 4; min-width: 22px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--sunny); color: #6b4a10; font-family: var(--num-font); font-size: 9.5px; font-weight: 900; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px #fff;
}
.lib-row { display: flex; align-items: center; gap: 8px; }
.energy { flex: none; display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 14px; background: #fff; box-shadow: 0 3px 0 #eadff0, 0 4px 10px rgba(167, 139, 250, 0.2); }
.en-dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 10px; background: #f1eaf6; filter: grayscale(1); opacity: 0.55; transition: all 0.25s ease; }
.en-dot.on { background: radial-gradient(circle at 40% 35%, #fff6cc, #ffd36b); filter: none; opacity: 1; box-shadow: 0 0 6px rgba(255, 211, 107, 0.8); }
.lib-mods { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px 4px; scrollbar-width: none; }
.lib-mod {
  position: relative; flex: none; width: 46px; height: 62px; padding: 0; border: 0; border-radius: 14px; touch-action: pan-x;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; padding-top: 4px;
  background: #fff; box-shadow: 0 3px 0 #f1d9e6, 0 5px 10px rgba(255, 111, 156, 0.2); color: var(--ink);
}
.lm-art { position: relative; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 50% 38%, #fff 0%, #fff4d1 60%, #d9f5ec 100%); }
.lm-art .art-emoji { font-size: 20px; }
.lm-art .art-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.lm-name { font-size: 10.5px; font-weight: 900; line-height: 1.1; white-space: nowrap; }
.lm-cost { position: absolute; right: -3px; top: -5px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; background: var(--sunny); box-shadow: 0 0 0 2px #fff; }
.lib-mod.on { box-shadow: 0 0 0 3px var(--pink), 0 3px 0 #f1d9e6, 0 0 14px rgba(255, 111, 156, 0.45); transform: translateY(-2px); }
.lib-mod.maxed { opacity: 0.45; filter: grayscale(0.6); }
.lib-mod.blocked { filter: grayscale(1); opacity: 0.45; }
.lib-mod.blocked::after { content: "🚫"; position: absolute; left: 50%; top: 22px; transform: translate(-50%, -50%); font-size: 20px; }
.drag-ghost { position: fixed !important; z-index: 70; margin: 0; pointer-events: none; transform: rotate(-6deg) scale(1.12); filter: drop-shadow(0 12px 16px rgba(124, 95, 214, 0.4)); }
.perform-btn { width: 70px; height: 70px; }
.perform-btn .go-label { font-size: 17px; }
.perform-btn.dim:not(.working) { filter: saturate(0.35) brightness(1.05); box-shadow: 0 6px 0 #d0a8bd, 0 8px 16px rgba(255, 111, 156, 0.2); }
.perform-btn.working { filter: none; }
.rework-bar { display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; padding: 4px 36px 0; }
.rework-text { padding: 4px 14px; border-radius: 999px; background: #fff4d1; color: #7a4a00; font-size: 13px; font-weight: 900; box-shadow: 0 2px 0 #f0d58a; }
.rework-bar .mini-x { right: 2px; top: 2px; }
body.rework-picking .lib-actions, body.rework-picking .lib-row { opacity: 0.4; pointer-events: none; }

/* ── 本台結果 ─────────────────────────── */
.results { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 4px 2px; }
.res-score { display: flex; align-items: baseline; gap: 6px; font-family: var(--num-font); }
.res-label { font-family: inherit; font-size: 13px; font-weight: 900; color: var(--text-secondary); }
.res-score strong { font-size: 42px; line-height: 1; color: var(--ink); text-shadow: 0 3px 0 #ffe3ec; }
.results.reached .res-score strong { color: #e09a00; text-shadow: 0 3px 0 #fff1c7, 0 0 16px rgba(255, 211, 107, 0.8); }
.res-target { font-size: 15px; font-weight: 900; color: var(--text-muted); }
.res-badges { display: flex; gap: 8px; }
.res-actions { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: center; }
.rework-btn { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.rework-btn b { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--lavender); color: #fff; font-family: var(--num-font); font-size: 12px; line-height: 20px; }
.rework-btn:disabled b { background: #c9c0d6; }
.settle-btn { min-width: 0; flex: 1; max-width: 200px; height: 54px; font-size: 18px; }

body.choreo.versus-open .timeline, body.choreo.versus-open .dock, body.choreo.versus-open .poem { visibility: hidden; }
body.choreo.replaying .timeline, body.choreo.replaying .dock { opacity: 0.35; pointer-events: none; filter: saturate(0.6); }
body.choreo .toast { bottom: calc(var(--hand-h) + 20px + env(safe-area-inset-bottom)); }

@media (max-height: 720px) {
  body.choreo { --hand-h: 170px; }
  .bc-action { width: 54px; height: 75px; }
  .bc-action .gcard { --card-w: 54px; }
  .bc-mod { width: 26px; height: 26px; }
  .lib-card.gcard.size-mini { --card-w: 52px; width: 52px; height: 73px; }
  .lib-mod { width: 42px; height: 56px; }
  .lm-art { width: 32px; height: 32px; }
  .perform-btn { width: 62px; height: 62px; }
  .timeline { padding-top: 8px; gap: 10px; }
  .beat-col { gap: 3px; padding: 5px 3px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .beat-col.selected::before, .beat-col.pickable, .bc-link.on { animation: none; }
}

/* 依起始姿勢調整過的基礎分：變高是金色徽章、變低是灰色徽章 */
.beat-col .gcard-value.base-up { background: linear-gradient(180deg, #ffd45e, #f0a400); box-shadow: 0 0 0 1.5px #fff, 0 0 8px rgba(255, 190, 0, .7); }
.beat-col .gcard-value.base-down { background: linear-gradient(180deg, #c3ccd8, #8c98aa); }
