/* Shared motion pieces: drag and drop, 3D dice, floating labels, tutorials. */

/* ---------- drag and drop ---------- */
.draggable { cursor: grab; }
.drag-src { opacity: .28; }
.drag-ghost {
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .45));
  will-change: transform;
}
[data-drop] { transition: box-shadow .12s, background-color .12s, transform .12s; }
.drop-over { box-shadow: 0 0 0 3px var(--accent), 0 0 18px rgba(246, 181, 50, .55) !important; }

/* ---------- 3D dice ---------- */
.d3 {
  --d: 56px;
  position: absolute; left: 0; top: 0; width: var(--d); height: var(--d);
  perspective: 420px; will-change: transform;
}
.d3:not(.d3-in-tray) { position: relative; display: inline-block; }
.d3-cube { position: absolute; inset: 0; transform-style: preserve-3d; }
.d3-face {
  position: absolute; inset: 0; border-radius: 18%;
  background: radial-gradient(circle at 30% 25%, #fff 0%, #f4f1ff 45%, #dcd6f5 100%);
  box-shadow: inset 0 0 0 2px rgba(23, 19, 58, .08), inset 0 -6px 10px rgba(23, 19, 58, .12);
  backface-visibility: hidden;
}
.d3-face svg { width: 100%; height: 100%; display: block; }
.d3-pips circle { fill: #17133a; }
.d3-face:nth-child(1) .d3-pips circle { fill: #e8344a; } /* the one, like a real die */
.d3-shadow {
  position: absolute; left: 8%; right: 8%; bottom: -14%; height: 26%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .45), transparent 70%);
  transform: translateZ(-1px);
}
.d3.held .d3-face { background: radial-gradient(circle at 30% 25%, #fffbe9, #ffe28a); box-shadow: inset 0 0 0 3px var(--accent); }

.d3-tray {
  position: relative; width: 100%; border-radius: 22px; overflow: hidden; flex: none;
  background: radial-gradient(ellipse at 50% 40%, #2f7a4f 0%, #1f5a39 70%, #174a2e 100%);
  box-shadow: inset 0 0 0 5px #6b4426, inset 0 0 0 8px #4e2f18, inset 0 8px 24px rgba(0, 0, 0, .45), 0 6px 18px rgba(0, 0, 0, .3);
  cursor: pointer; user-select: none;
}
.d3-felt {
  position: absolute; inset: 0; opacity: .25; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .25) 1px, transparent 1.2px);
  background-size: 6px 6px;
}
.d3-tray.ready { box-shadow: inset 0 0 0 5px #6b4426, inset 0 0 0 8px var(--c, var(--accent)), inset 0 8px 24px rgba(0, 0, 0, .45), 0 0 22px rgba(246, 181, 50, .35); }
.d3-tray.ready .d3 { animation: d3-wiggle 1.6s ease-in-out infinite; }
.d3-tray.ready .d3:nth-of-type(2n) { animation-delay: .2s; }
@keyframes d3-wiggle { 0%, 80%, 100% { margin-top: 0; } 88% { margin-top: -7px; } }
.d3-tray.shaking { cursor: grabbing; }
.d3-tray.has-keep .d3-hint { top: auto; bottom: 8px; } /* the top is the kept-dice row */
.d3-hint {
  position: absolute; left: 0; right: 0; top: 10px; text-align: center; pointer-events: none;
  color: rgba(255, 255, 255, .75); font-weight: 700; font-size: 13px; letter-spacing: .5px; text-transform: uppercase;
}

/* ---------- floating labels ---------- */
.fx-float {
  position: fixed; z-index: 9997; pointer-events: none; font-weight: 700; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 12px rgba(0, 0, 0, .35);
}

/* Something you can move right now */
.can-move { animation: can-move 1s ease-in-out infinite; }
@keyframes can-move { 50% { filter: drop-shadow(0 0 6px #fff) brightness(1.15); } }
.target-glow { animation: target-glow 0.9s ease-in-out infinite; }
@keyframes target-glow { 50% { opacity: .35; } }

/* ---------- tutorials ---------- */
.tut {
  position: fixed; inset: 0; z-index: 9000; background: rgba(10, 8, 30, .72);
  display: flex; align-items: flex-end; justify-content: center; padding: 12px;
  padding-bottom: calc(12px + var(--safe-bottom));
}
@media (min-height: 640px) { .tut { align-items: center; } }
.tut-box {
  width: min(100%, 460px); background: var(--bg2); border-radius: 26px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.tut-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 14px; }
.tut-x { width: 36px; height: 36px; border-radius: 12px; background: var(--panel); color: var(--muted); font-size: 16px; }
.tut-stage-wrap { width: 100%; aspect-ratio: 300 / 190; border-radius: 18px; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #3a2f8a, #241c58); position: relative; }
.tut-stage { position: absolute; inset: 0; container-type: size; }
.tut-stage.empty::after { content: ''; position: absolute; inset: 0; background: url(../icon.svg) center / 35% no-repeat; opacity: .5; }
.tut-box h2 { margin: 4px 0 0; font-size: 24px; }
.tut-box p { margin: 0; color: var(--muted); line-height: 1.4; min-height: 3.8em; }
.tut-box .row .btn { flex: 1; }
.tut-dots { display: flex; gap: 6px; justify-content: center; }
.tut-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: width .2s, background .2s; }
.tut-dots i.on { width: 22px; border-radius: 4px; background: var(--accent); }
.tut-item { position: absolute; transform: translate(-50%, -50%); }
.tut-item.tut-lifted { filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .45)); z-index: 5; }
.tut-hand { width: 13%; z-index: 10; pointer-events: none; transform: translate(-36%, -8%); transition: scale .12s; }
.tut-hand svg { width: 100%; display: block; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .4)); }
.tut-hand.down { scale: .86; }
.tut-ripple { width: 12%; aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff; pointer-events: none; z-index: 9; }
.tut-label {
  background: #fff; color: #17133a; font-weight: 700; font-size: 4.6cqw; padding: .5em .8em; border-radius: 1em;
  white-space: nowrap; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); z-index: 6;
}
.tut-label.good { background: var(--good); color: #0d2b0d; }
.tut-label.bad { background: var(--bad); color: #fff; }

/* little props for tutorial scenes */
.tut-tray { width: 92%; height: 52%; border-radius: 6cqw; background: radial-gradient(ellipse, #2f7a4f, #1f5a39); box-shadow: inset 0 0 0 1.6cqw #6b4426; }
.tut-piece { width: 9cqw; height: 11cqw; border-radius: 50% 50% 45% 45%; border: .8cqw solid #fff; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.7), transparent 40%), var(--c); box-shadow: 0 1cqw 1.5cqw rgba(0,0,0,.35); z-index: 3; }
.tut-sq { width: 14.6cqw; height: 14.6cqw; display: grid; place-items: start; padding: .6cqw 1cqw; color: rgba(60,40,10,.55); font-weight: 700; font-size: 3cqw; }
.tut-glow { width: 14.6cqw; height: 14.6cqw; border: .8cqw dashed #fff; border-radius: 1.5cqw; animation: target-glow .9s infinite; }
.tut-ladder { width: 14cqw; height: 52cqh; background: repeating-linear-gradient(to bottom, transparent 0 7%, #8a5a2f 7% 10%), linear-gradient(to right, #b07a45 0 14%, transparent 14% 86%, #b07a45 86%); }
.tut-snake { width: 20cqw; }
.tut-snake svg { width: 100%; display: block; }
.tut-item.d3 { position: absolute; }
