/* letstack.css — LetStack 河內塔（class 前綴 lt-）
   視覺語彙刻意和 LetSlide 一致：木框、小恐龍教練、🌼 全隱藏、回家的路、綠近／橘遠／灰不變。
   第三款遊戲出現時，這些共用樣式就該抽到 garden.css（見 docs/GARDEN_FRAMEWORK.md）。 */
.lt { max-width: 560px; margin: 0 auto; }
/* 作者樣式的 display 會蓋過 [hidden] 的 UA display:none（圖例是 flex），所以補這一條 */
.lt [hidden] { display: none !important; }

/* toolbar */
.lt-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; }
.lt-toolbar--2 { margin-top: -6px; }
.lt-seg { display: inline-flex; border: 1px solid var(--gd-bd); border-radius: 12px; overflow: hidden; background: #fff; }
.lt-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;
}
.lt-seg button + button { border-left: 1px solid var(--gd-bd); }
.lt-seg button[aria-pressed="true"] { background: var(--gd-green); color: #fff; }
.gd-btn--sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }

/* 🌼/🌱 全隱藏鈕（同 LetSlide、同 devlog 的 🐣/🥚）*/
.lt-divider { display: flex; align-items: center; gap: 14px; margin: 2px 0 12px; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.lt-divider::before, .lt-divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, transparent, #f3dcb5); }
.lt-divider::after { background: linear-gradient(to left, transparent, #f3dcb5); }
.lt-divider span { width: 40px; height: 40px; border-radius: 50%; background: #fff8ec; border: 1px solid #f3dcb5; display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; transition: transform .15s, box-shadow .15s; }
.lt-divider:hover span, .lt-divider:focus-visible span { transform: scale(1.1); box-shadow: 0 2px 10px rgba(243,220,181,.9); }
.lt-divider:focus-visible { outline: none; }
.lt--zen .lt-top, .lt--zen .lt-bottom { display: none; }
.lt--zen .lt-divider { margin-top: 0; }

/* 木框 */
.lt-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;
}
.lt-ref { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.lt-ref-goal {
  width: 64px; height: 64px; border-radius: 10px; flex-shrink: 0; background: #fff8ea;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; padding: 0 0 9px;
  position: relative;
}
.lt-ref-goal::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 34px; height: 3px; margin-left: -17px; border-radius: 2px; background: #c9a36a; }
.lt-ref-goal i { height: 8px; border-radius: 999px; background: #8b5cf6; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.lt-ref-goal i:nth-child(1) { background: #60a5fa; }
.lt-ref-goal i:nth-child(2) { background: #6366f1; }
.lt-ref-meta { flex: 1; min-width: 0; }
.lt-ref-name { font-weight: 800; font-size: 16px; color: #5b3a12; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-ref-hint { font-size: 12.5px; color: #8a6a3a; margin-top: 2px; }
.lt-ref-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.lt-undo, .lt-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; }
.lt-teach[aria-pressed="true"] { background: #fde047; border-color: #eab308; color: #422006; }
.lt-undo[disabled] { opacity: .45; cursor: default; }

/* 教練（小恐龍）*/
.lt-coach { margin: -4px 0 12px; animation: lt-pop .22s cubic-bezier(.2,.9,.3,1.2); }
.lt-coach-avatar {
  appearance: none; padding: 0; margin: 0 2px 0 -2px; cursor: pointer; flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.14); overflow: hidden;
  background: url("/assets/img/rexcode-logo.webp") center / cover no-repeat #fff;
  transition: transform .12s, box-shadow .12s; -webkit-tap-highlight-color: transparent;
}
.lt-coach-avatar:hover, .lt-coach-avatar.is-open { transform: scale(1.08); box-shadow: 0 0 0 3px #fde047, 0 2px 8px rgba(0,0,0,.18); }
.lt-coach-bubble { position: relative; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: 0 2px 8px rgba(90,55,10,.12); }
.lt-coach-bubble::before { content: ''; position: absolute; left: 82px; top: -8px; border: 8px solid transparent; border-bottom-color: #fff; border-top: 0; }
.lt-coach-text { font-size: 15px; font-weight: 700; color: #3f2a10; line-height: 1.45; }
.lt-coach-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lt-coach-btns:empty { display: none; }

/* 板面：三根柱子 */
.lt-board {
  position: relative; width: 100%; aspect-ratio: 16 / 10;
  background: linear-gradient(180deg, #d8f0ff 0%, #eaf7e6 62%, #cfe9bd 100%);
  border-radius: 14px; overflow: hidden;
  box-shadow: inset 0 3px 10px rgba(90, 55, 10, .28);
  touch-action: none; outline: none; user-select: none; -webkit-user-select: none;
  --base: 24px;                                   /* 底座高度 */
  --dh: min(40px, (100% - 34px) / 7);             /* 盤子高度：固定除以 7，6 個盤子也塞得下 */
}
.lt-board:focus-visible { box-shadow: inset 0 3px 10px rgba(90,55,10,.28), 0 0 0 3px #86efac; }

.lt-peg { position: absolute; top: 0; bottom: 0; width: calc(100% / 3); left: calc(var(--p) * 100% / 3); cursor: pointer; }
.lt-peg-post {
  position: absolute; left: 50%; bottom: var(--base); width: 14px; margin-left: -7px;
  height: calc(var(--dh) * 6.4); max-height: calc(100% - var(--base) - 10px);
  border-radius: 8px 8px 0 0; background: linear-gradient(90deg, #c2915a, #e0b782 40%, #b57f45);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35);
}
.lt-peg-base {
  position: absolute; left: 8%; right: 8%; bottom: 0; height: var(--base);
  border-radius: 10px; background: linear-gradient(180deg, #d9a96e, #b9813f);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.lt-peg-lbl { font-size: 13px; font-weight: 900; color: #fff8ea; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
/* 小房子靠右上角：正中間會和「可以放」的綠色圓標撞在一起 */
.lt-peg-flag { position: absolute; right: 8%; top: 3px; font-size: 20px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.2)); }
.lt-peg.is-goal .lt-peg-base { background: linear-gradient(180deg, #86d9a2, #3f9c62); }
/* 落點區：拿著盤子時，三根柱子的可放／不可放提示畫在這裡 */
.lt-peg-zone {
  position: absolute; left: 6%; right: 6%; bottom: calc(var(--base) - 2px); top: 26px;
  border-radius: 14px; border: 3px solid transparent; pointer-events: none;
}
.lt-peg-badge { position: absolute; left: 50%; top: -14px; margin-left: -13px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.28); }
.lt-peg-badge svg { width: 15px; height: 15px; display: block; }
.lt-board--sel .lt-peg:not(.is-sel):hover .lt-peg-zone { border-color: rgba(255,255,255,.7); }
.lt-peg.is-sel .lt-peg-zone { border-color: rgba(255,255,255,.85); border-style: dashed; }
.lt-board--hints .lt-peg.is-good .lt-peg-zone { border-color: var(--lt-good); background: var(--lt-good-soft); }
.lt-board--hints .lt-peg.is-bad  .lt-peg-zone { border-color: var(--lt-bad); }
.lt-board--hints .lt-peg.is-same .lt-peg-zone { border-color: var(--lt-same); }
.lt-board--hints .lt-peg.is-no   .lt-peg-zone { border-color: var(--lt-no); border-style: dashed; }
.lt-board--hints .lt-peg.is-good .lt-peg-badge { display: grid; background: var(--lt-good); }
.lt-board--hints .lt-peg.is-bad  .lt-peg-badge { display: grid; background: var(--lt-bad); }
.lt-board--hints .lt-peg.is-same .lt-peg-badge { display: grid; background: var(--lt-same); }
.lt-board--hints .lt-peg.is-no   .lt-peg-badge { display: grid; background: var(--lt-no); }

/* 盤子 */
.lt-disk {
  position: absolute; left: calc(var(--p) * 100% / 3); width: calc(100% / 3);
  bottom: calc(var(--base) + var(--i) * var(--dh)); height: var(--dh);
  display: flex; align-items: center; justify-content: center;
  transition: left .19s cubic-bezier(.3,.8,.35,1), bottom .19s cubic-bezier(.3,.8,.35,1);
  cursor: pointer; z-index: 2; will-change: left, bottom;
}
.lt-disk.is-lift { bottom: calc(100% - var(--dh) - 4px); z-index: 4; }
.lt-disk-body {
  position: relative; width: var(--w); height: calc(100% - 4px); border-radius: 999px;
  background: var(--dc); display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.45), 0 2px 5px rgba(30,20,60,.25);
  border: 2px solid rgba(255,255,255,.75);
}
.lt-disk.is-lift .lt-disk-body { transform: scale(1.04); box-shadow: inset 0 -3px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.45), 0 8px 16px rgba(30,20,60,.3); }
.lt-disk-face { font-size: clamp(11px, 2.6vw, 17px); line-height: 1; }
.lt-disk-num {
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: rgba(255,255,255,.92); color: #1e1b4b; font-size: 12px; font-weight: 900;
  display: none; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.lt-board--nums .lt-disk-num { display: inline-flex; }
.lt-disk-badge {
  position: absolute; right: 2px; top: 50%; margin-top: -11px; width: 22px; height: 22px; border-radius: 50%;
  display: none; place-items: center; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.lt-disk-badge svg { width: 13px; height: 13px; display: block; }
.lt-board--hints .lt-disk.is-good .lt-disk-badge { display: grid; background: var(--lt-good); }
.lt-board--hints .lt-disk.is-bad  .lt-disk-badge { display: grid; background: var(--lt-bad); }
.lt-board--hints .lt-disk.is-same .lt-disk-badge { display: grid; background: var(--lt-same); }
.lt-board--hints .lt-disk.is-good .lt-disk-body { border-color: var(--lt-good); box-shadow: inset 0 -3px 0 rgba(0,0,0,.16), 0 0 0 3px var(--lt-good-soft), 0 2px 5px rgba(30,20,60,.25); }
.lt-board--hints .lt-disk.is-bad  .lt-disk-body { border-color: var(--lt-bad); }
.lt-board--hints .lt-disk.is-same .lt-disk-body { border-color: var(--lt-same); }
.lt-board--won .lt-disk { cursor: default; }
.lt-shake { animation: lt-shake .24s; }
@keyframes lt-shake { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }

/* 小手提示 */
.lt-glow { z-index: 5; }
.lt-disk.lt-glow .lt-disk-body { animation: lt-glow 1s ease-in-out infinite; }
.lt-peg.lt-glow .lt-peg-zone { animation: lt-glow-zone 1s ease-in-out infinite; }
@keyframes lt-glow {
  0%, 100% { box-shadow: 0 0 0 3px #fde047, 0 0 0 0 rgba(250,204,21,0); }
  50%      { box-shadow: 0 0 0 3px #facc15, 0 0 0 10px rgba(250,204,21,.45); }
}
@keyframes lt-glow-zone {
  0%, 100% { border-color: #fde047; }
  50%      { border-color: #facc15; box-shadow: 0 0 0 8px rgba(250,204,21,.3); }
}
.lt-hand { position: absolute; left: 50%; top: -6px; margin-left: -14px; font-size: 30px; line-height: 1; pointer-events: none; z-index: 6; animation: lt-hand .8s ease-in-out infinite; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.lt-disk .lt-hand { top: auto; bottom: -2px; }
@keyframes lt-hand { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-8px) scale(1.12); } }

/* 贏了 */
.lt-win {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 7;
  background: rgba(255,255,255,.95); border-radius: 14px; padding: 12px 14px;
  text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  display: none; animation: lt-pop .28s cubic-bezier(.2,.9,.3,1.3);
}
.lt-board--won .lt-win { display: block; }
@keyframes lt-pop { from { transform: translateY(14px) scale(.94); opacity: 0; } }
.lt-win-title { font-size: 20px; font-weight: 900; margin: 0 0 4px; }
.lt-win-sub { font-size: 13.5px; color: #475569; margin: 0 0 10px; }
.lt-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; }
.lt-win-best--perfect { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.lt-win-btns { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

/* 統計 / 小知識 / 動作 */
.lt-stats { display: flex; justify-content: center; gap: 18px; margin: 14px 0 6px; font-size: 14px; color: #475569; flex-wrap: wrap; }
.lt-stat b { color: var(--gd-ink); font-variant-numeric: tabular-nums; font-size: 16px; }
.lt-fact { text-align: center; font-size: 13px; color: var(--gd-muted); margin: 0 0 12px; }
.lt-fact b { color: var(--gd-ink); font-variant-numeric: tabular-nums; }
.lt-fact sup { font-size: .72em; }
.lt-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* ── 回家的路：綠／橘對比只有 ΔE≈8（色盲），所以一定配圖示 ── */
.lt { --lt-good: #2f8a50; --lt-good-soft: rgba(47, 138, 80, .22); --lt-bad: #c4560e; --lt-same: #7f897e; --lt-no: #94a3b8; }

.lt-road { margin-top: 12px; background: #fffaf0; border: 1px solid #e5c58c; border-radius: 16px; padding: 10px 12px 8px; }
.lt-road-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; color: #5b3a12; }
.lt-road-label, .lt-road-unit { font-size: 14px; font-weight: 800; }
.lt-road-n { font-size: 30px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: #3f2a10; }
.lt-road-say { margin-left: auto; font-size: 14px; font-weight: 800; color: #7a4f14; }
.lt-road-say.is-good { color: var(--lt-good); }
.lt-road-say.is-bad { color: var(--lt-bad); }
.lt-road-track { position: relative; width: 100%; }
.lt-road-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.lt-road-svg polyline { fill: none; stroke: #f0dfbd; stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; }
.lt-road-stone {
  position: absolute; border-radius: 50%; background: #fff; border: 2px solid #dcc59a;
  display: grid; place-items: center; font-weight: 800; color: #9a7a4a;
  font-variant-numeric: tabular-nums; transition: opacity .2s; box-sizing: border-box;
}
.lt-road-stone.is-past { opacity: .35; }
.lt-road-home {
  position: absolute; border-radius: 10px; background: #fff8ea; border: 3px solid var(--lt-good);
  box-shadow: 0 2px 6px rgba(0,0,0,.18); box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 3px;
}
.lt-road-home i { height: 4px; border-radius: 999px; background: #8b5cf6; }
.lt-road-home i:nth-child(1) { background: #60a5fa; }
.lt-road-home i:nth-child(2) { background: #6366f1; }
.lt-road-home-badge { position: absolute; right: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--lt-good); color: #fff; display: grid; place-items: center; }
.lt-road-home-badge svg { width: 11px; height: 11px; display: block; }
.lt-road-home.is-home { animation: lt-home-bounce .8s 2; }
@keyframes lt-home-bounce { 40% { transform: translateY(-6px); } }
.lt-road-dino { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 2; pointer-events: none; transition: transform .4s cubic-bezier(.3,.7,.3,1.15); }
.lt-road-dino.is-instant { transition: none; }
.lt-road-dino-img {
  position: absolute; left: -17px; top: -38px; width: 34px; height: 34px; border-radius: 50%;
  background: url("/assets/img/rexcode-logo.webp") center / cover no-repeat #fff;
  border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.22);
}
.lt-road-dino.is-hop .lt-road-dino-img { animation: lt-dino-hop .4s; }
@keyframes lt-dino-hop { 45% { transform: translateY(-14px); } }
.lt-road-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: #7a5a2a; }
.lt-lg { display: inline-flex; align-items: center; gap: 5px; }
.lt-lg-dot { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.lt-lg-dot svg { width: 10px; height: 10px; display: block; }
.lt-lg-good { background: var(--lt-good); }
.lt-lg-bad { background: var(--lt-bad); }
.lt-lg-same { background: var(--lt-same); }
.lt-lg-no { background: var(--lt-no); }

/* 走過的路 */
.lt-journey { margin: 0 0 16px; }
.lt-journey-cap { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 8px; font-size: 13px; color: var(--gd-muted); margin-bottom: 2px; }
.lt-journey-cap b { color: var(--gd-ink); }
.lt-journey-plot { position: relative; max-width: 460px; margin: 0 auto; }
.lt-journey-svg { display: block; width: 100%; height: auto; }
.lt-j-grid { stroke: #e5e7eb; stroke-width: 1; }
.lt-j-base { stroke: var(--lt-good); stroke-width: 1.5; stroke-dasharray: 4 4; }
.lt-j-axis { fill: #64748b; font-size: 12px; font-variant-numeric: tabular-nums; }
.lt-j-home { fill: var(--lt-good); font-size: 13px; font-weight: 800; }
.lt-j-seg { stroke-width: 3; stroke-linecap: round; }
.lt-j-good { stroke: var(--lt-good); }
.lt-j-bad { stroke: var(--lt-bad); }
.lt-j-same { stroke: var(--lt-same); }
.lt-j-pt { fill: #fff; stroke: #475569; stroke-width: 1.5; }
.lt-j-ring { fill: none; stroke: #fff; stroke-width: 2; }
.lt-j-lbl { fill: #0f172a; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lt-j-lbl--muted { fill: #64748b; font-weight: 700; }
.lt-j-guide { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 3; }
.lt-j-hit { fill: transparent; }
.lt-journey-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 12px)); pointer-events: none; z-index: 3;
  background: #fff; border: 1px solid var(--gd-bd); border-radius: 8px; padding: 4px 8px;
  font-size: 12.5px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.1); font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .lt-tray { padding: 10px; border-radius: 18px; }
  .lt-ref-goal { width: 54px; height: 54px; }
  .lt-coach-avatar { width: 42px; height: 42px; }
  .lt-coach-bubble::before { left: 66px; }
  .lt-coach-text { font-size: 14px; }
  .lt-seg button { padding: 0 11px; }
  .lt-toolbar .gd-btn { padding: 8px 11px; font-size: 13.5px; min-height: 38px; }
  .lt-board { --base: 20px; --dh: min(32px, (100% - 28px) / 7); }
  .lt-road { padding: 8px 10px 6px; }
  .lt-road-n { font-size: 26px; }
  .lt-road-say { margin-left: 0; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .lt-disk, .lt-road-dino, .lt-road-stone { transition: none; }
  .lt-road-dino.is-hop .lt-road-dino-img, .lt-road-home.is-home,
  .lt-disk.lt-glow .lt-disk-body, .lt-peg.lt-glow .lt-peg-zone, .lt-hand { animation: none; }
}
