/* letslide.css — LetSlide 滑塊拼圖（class 前綴 ls-） */
.ls { max-width: 520px; margin: 0 auto; }

/* toolbar */
.ls-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; }
.ls-seg { display: inline-flex; border: 1px solid var(--gd-bd); border-radius: 12px; overflow: hidden; background: #fff; }
.ls-seg button {
  appearance: none; border: 0; background: transparent; font: inherit; font-weight: 700;
  padding: 0 14px; min-height: 42px; cursor: pointer; color: #475569; font-size: 14.5px;
  -webkit-tap-highlight-color: transparent;
}
.ls-seg button + button { border-left: 1px solid var(--gd-bd); }
.ls-seg button[aria-pressed="true"] { background: var(--gd-green); color: #fff; }

/* wooden tray（照片裡的木框） */
.ls-tray {
  position: relative;
  background: linear-gradient(180deg, #f6e3bf, #ecd2a2);
  border: 1px solid #d9b77f; border-radius: 22px;
  box-shadow: 0 8px 26px rgba(120, 80, 20, .16), inset 0 1px 0 rgba(255,255,255,.6);
  padding: 14px;
}
.ls-ref { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ls-ref-img {
  width: 64px; height: 64px; border-radius: 10px; flex-shrink: 0;
  background: var(--ls-img) center / cover no-repeat #fff;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.ls-ref-meta { flex: 1; min-width: 0; }
.ls-ref-name { font-weight: 800; font-size: 16px; color: #5b3a12; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-ref-hint { font-size: 12.5px; color: #8a6a3a; margin-top: 2px; }
.ls-ref-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.ls-peek, .ls-teach { background: #fff8ea; border-color: #e5c58c; color: #7a4f14; user-select: none; -webkit-user-select: none; touch-action: manipulation; min-height: 38px; padding: 8px 12px; font-size: 13.5px; justify-content: center; }
.ls-teach[aria-pressed="true"] { background: #fde047; border-color: #eab308; color: #422006; }

/* board */
.ls-board {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  background: #e2c48f; border-radius: 14px; overflow: hidden;
  box-shadow: inset 0 3px 10px rgba(90, 55, 10, .35);
  touch-action: none; outline: none; user-select: none; -webkit-user-select: none;
}
.ls-board:focus-visible { box-shadow: inset 0 3px 10px rgba(90,55,10,.35), 0 0 0 3px #86efac; }
.ls-tile {
  position: absolute; left: 0; top: 0;
  width: calc(100% / var(--n)); height: calc(100% / var(--n));
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%));
  transition: transform .17s cubic-bezier(.2,.8,.3,1);
  background-image: var(--ls-img);
  background-size: calc(var(--n) * 100%) calc(var(--n) * 100%);
  background-position: calc(var(--c0) / (var(--n) - 1) * 100%) calc(var(--r0) / (var(--n) - 1) * 100%);
  background-repeat: no-repeat;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.78), inset 0 -3px 0 rgba(0,0,0,.08);
  cursor: pointer; will-change: transform;
}
.ls-tile.ls-shake { animation: ls-shake .22s; }
@keyframes ls-shake { 25% { translate: -3px 0; } 75% { translate: 3px 0; } }
.ls-tile--blank { visibility: hidden; }
.ls-tile-num {
  position: absolute; left: 5px; top: 5px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: rgba(255,255,255,.92); color: #0f172a;
  font-size: 12.5px; font-weight: 800; display: none; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.18); pointer-events: none;
}
.ls-board--nums .ls-tile-num { display: inline-flex; }
.ls-board--won .ls-tile { box-shadow: none; border-radius: 0; cursor: default; }
.ls-board--won .ls-tile--blank { visibility: visible; }
.ls-board--won .ls-tile-num { display: none; }

/* peek overlay */
.ls-peekov {
  position: absolute; inset: 0; background: var(--ls-img) center / 100% 100% no-repeat;
  opacity: 0; transition: opacity .12s; pointer-events: none; z-index: 3;
}
.ls-board--peek .ls-peekov { opacity: .96; }

/* win card */
.ls-win {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 4;
  background: rgba(255,255,255,.94); border-radius: 14px; padding: 12px 14px;
  text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  display: none; animation: ls-pop .28s cubic-bezier(.2,.9,.3,1.3);
}
.ls-board--won .ls-win { display: block; }
@keyframes ls-pop { from { transform: translateY(14px) scale(.94); opacity: 0; } }
.ls-win-title { font-size: 20px; font-weight: 900; margin: 0 0 4px; }
.ls-win-sub { font-size: 13.5px; color: #475569; margin: 0 0 10px; }
.ls-win-best { display: inline-block; background: var(--gd-amber-bg); border: 1px solid var(--gd-amber-bd); color: #92400e; font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }

/* stats */
.ls-stats { display: flex; justify-content: center; gap: 18px; margin: 14px 0 12px; font-size: 14px; color: #475569; flex-wrap: wrap; }
.ls-stat b { color: var(--gd-ink); font-variant-numeric: tabular-nums; font-size: 16px; }

/* actions */
.ls-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* picker */
.ls-picker-label { font-size: 12.5px; color: var(--gd-muted); margin: 0 0 6px; text-align: center; }
.ls-picker { display: flex; gap: 8px; overflow-x: auto; padding: 6px 4px 10px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.ls-pick {
  flex: 0 0 auto; width: 58px; height: 58px; border-radius: 14px; border: 3px solid transparent;
  background: center / cover no-repeat #fff; cursor: pointer; scroll-snap-align: start; padding: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.10); transition: transform .12s, border-color .12s;
  -webkit-tap-highlight-color: transparent;
}
.ls-pick:hover { transform: scale(1.06); }
.ls-pick[aria-pressed="true"] { border-color: var(--gd-green); }
.ls-pick--custom { background: var(--gd-amber-bg); border: 3px dashed var(--gd-amber-bd); display: grid; place-items: center; font-size: 22px; color: #92400e; }
.ls-pick--custom.has-img { border-style: solid; font-size: 0; }
.ls-note { font-size: 12px; color: var(--gd-muted); text-align: center; margin: 4px 0 0; line-height: 1.5; }

/* toast */
.ls-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 14px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 90vw;
}

@media (max-width: 480px) {
  .ls-tray { padding: 10px; border-radius: 18px; }
  .ls-ref-img { width: 54px; height: 54px; }
  .ls-seg button { padding: 0 11px; }
}

/* ── 教練（小恐龍）、提示發光、第二列工具列 ── */
.ls-toolbar--2 { margin-top: -6px; }
.gd-btn--sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.ls-coach { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.ls-coach-avatar { width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.14); flex-shrink: 0; }
.ls-coach-bubble {
  position: relative; flex: 1; min-width: 0;
  background: #fff; border-radius: 14px; padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(90,55,10,.12);
}
.ls-coach-bubble::before {
  content: ''; position: absolute; left: -8px; top: 14px;
  border: 8px solid transparent; border-right-color: #fff; border-left: 0;
}
.ls-coach-text { font-size: 15px; font-weight: 700; color: #3f2a10; line-height: 1.45; }
.ls-coach-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ls-coach-btns:empty { display: none; }
.ls-tile--glow { z-index: 2; animation: ls-glow 1s ease-in-out infinite; }
@keyframes ls-glow {
  0%, 100% { box-shadow: inset 0 0 0 3px #fde047, 0 0 0 0 rgba(250,204,21,.0); }
  50%      { box-shadow: inset 0 0 0 3px #facc15, 0 0 0 10px rgba(250,204,21,.45); }
}
.ls-hand {
  position: absolute; right: 6px; bottom: 4px; font-size: 30px; line-height: 1; pointer-events: none;
  animation: ls-hand .8s ease-in-out infinite; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}
@keyframes ls-hand { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-8px) scale(1.12); } }
.ls-win-btns { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 480px) {
  .ls-coach-text { font-size: 14px; }
  .ls-toolbar .gd-btn { padding: 8px 11px; font-size: 13.5px; min-height: 38px; }
}
