/* garden-kit.css — Garden 遊戲共用介面（class 前綴 gk-），搭配 garden-kit.js
   木框／工具列／🌼 全隱藏／小恐龍教練／小手提示／贏了卡片／統計／回家的路／走過的路／三色提示 token。
   遊戲自己的 CSS 只管「板面」：用 --gk-good／--gk-bad／--gk-same／--gk-no 上色，
   用 .gk-glow／.gk-hand／.gk-shake 掛提示，其餘不要重寫。 */
.gk { max-width: 560px; margin: 0 auto; }
/* 作者樣式的 display 會蓋過 [hidden] 的 UA display:none（圖例是 flex），所以補這一條 */
.gk [hidden] { display: none !important; }

/* toolbar */
.gk-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; }
.gk-toolbar--2 { margin-top: -6px; }
.gk-seg { display: inline-flex; border: 1px solid var(--gd-bd); border-radius: 12px; overflow: hidden; background: #fff; }
.gk-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;
}
.gk-seg button + button { border-left: 1px solid var(--gd-bd); }
.gk-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 的 🐣/🥚）*/
.gk-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; }
.gk-divider::before, .gk-divider::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, transparent, #f3dcb5); }
.gk-divider::after { background: linear-gradient(to left, transparent, #f3dcb5); }
.gk-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; }
.gk-divider:hover span, .gk-divider:focus-visible span { transform: scale(1.1); box-shadow: 0 2px 10px rgba(243,220,181,.9); }
.gk-divider:focus-visible { outline: none; }
.gk--zen .gk-top, .gk--zen .gk-bottom { display: none; }
.gk--zen .gk-divider { margin-top: 0; }

/* 木框 */
.gk-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;
}
.gk-ref { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.gk-ref-thumb {
  width: 64px; height: 64px; border-radius: 10px; flex-shrink: 0; background: #fff8ea; position: relative; overflow: hidden;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); box-sizing: border-box;
}
.gk-ref-meta { flex: 1; min-width: 0; }
.gk-ref-name { font-weight: 800; font-size: 16px; color: #5b3a12; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gk-ref-hint { font-size: 12.5px; color: #8a6a3a; margin-top: 2px; }
.gk-ref-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.gk-ref-btns .gd-btn { 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; }
.gk-ref-btns .gd-btn[aria-pressed="true"] { background: #fde047; border-color: #eab308; color: #422006; }
.gk-ref-btns .gd-btn[disabled] { opacity: .45; cursor: default; }

/* 教練（小恐龍）*/
.gk-coach { margin: -4px 0 12px; animation: gk-pop .22s cubic-bezier(.2,.9,.3,1.2); }
.gk-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;
}
.gk-coach-avatar:hover, .gk-coach-avatar.is-open { transform: scale(1.08); box-shadow: 0 0 0 3px #fde047, 0 2px 8px rgba(0,0,0,.18); }
.gk-coach-bubble { position: relative; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: 0 2px 8px rgba(90,55,10,.12); }
.gk-coach-bubble::before { content: ''; position: absolute; left: 82px; top: -8px; border: 8px solid transparent; border-bottom-color: #fff; border-top: 0; }
.gk-coach-text { font-size: 15px; font-weight: 700; color: #3f2a10; line-height: 1.45; }
.gk-coach-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gk-coach-btns:empty { display: none; }

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

/* 贏了 */
.gk-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: gk-pop .28s cubic-bezier(.2,.9,.3,1.3);
}
.gk-win.is-on { display: block; }
@keyframes gk-pop { from { transform: translateY(14px) scale(.94); opacity: 0; } }
.gk-win-title { font-size: 20px; font-weight: 900; margin: 0 0 4px; }
.gk-win-sub { font-size: 13.5px; color: #475569; margin: 0 0 10px; }
.gk-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; }
.gk-win-best--perfect { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.gk-win-btns { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

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

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

.gk-road { margin-top: 12px; background: #fffaf0; border: 1px solid #e5c58c; border-radius: 16px; padding: 10px 12px 8px; }
.gk-road-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; color: #5b3a12; }
.gk-road-label, .gk-road-unit { font-size: 14px; font-weight: 800; }
.gk-road-n { font-size: 30px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: #3f2a10; }
.gk-road-say { margin-left: auto; font-size: 14px; font-weight: 800; color: #7a4f14; }
.gk-road-say.is-good { color: var(--gk-good); }
.gk-road-say.is-bad { color: var(--gk-bad); }
.gk-road-track { position: relative; width: 100%; }
.gk-road-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.gk-road-svg polyline { fill: none; stroke: #f0dfbd; stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; }
.gk-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;
}
.gk-road-stone.is-past { opacity: .35; }
.gk-road-home {
  position: absolute; border-radius: 10px; background: #fff8ea; border: 3px solid var(--gk-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;
}
.gk-road-home-badge { position: absolute; right: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--gk-good); color: #fff; display: grid; place-items: center; }
.gk-road-home-badge svg { width: 11px; height: 11px; display: block; }
.gk-road-home.is-home { animation: gk-home-bounce .8s 2; }
@keyframes gk-home-bounce { 40% { transform: translateY(-6px); } }
.gk-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); }
.gk-road-dino.is-instant { transition: none; }
.gk-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);
}
.gk-road-dino.is-hop .gk-road-dino-img { animation: gk-dino-hop .4s; }
@keyframes gk-dino-hop { 45% { transform: translateY(-14px); } }
.gk-road-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: #7a5a2a; }
.gk-lg { display: inline-flex; align-items: center; gap: 5px; }
.gk-lg-dot { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.gk-lg-dot svg { width: 10px; height: 10px; display: block; }
.gk-lg-good { background: var(--gk-good); }
.gk-lg-bad { background: var(--gk-bad); }
.gk-lg-same { background: var(--gk-same); }
.gk-lg-no { background: var(--gk-no); }

/* 走過的路 */
.gk-journey { margin: 0 0 16px; }
.gk-journey-cap { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 8px; font-size: 13px; color: var(--gd-muted); margin-bottom: 2px; }
.gk-journey-cap b { color: var(--gd-ink); }
.gk-journey-plot { position: relative; max-width: 460px; margin: 0 auto; }
.gk-journey-svg { display: block; width: 100%; height: auto; }
.gk-j-grid { stroke: #e5e7eb; stroke-width: 1; }
.gk-j-base { stroke: var(--gk-good); stroke-width: 1.5; stroke-dasharray: 4 4; }
.gk-j-axis { fill: #64748b; font-size: 12px; font-variant-numeric: tabular-nums; }
.gk-j-home { fill: var(--gk-good); font-size: 13px; font-weight: 800; }
.gk-j-seg { stroke-width: 3; stroke-linecap: round; }
.gk-j-good { stroke: var(--gk-good); }
.gk-j-bad { stroke: var(--gk-bad); }
.gk-j-same { stroke: var(--gk-same); }
.gk-j-pt { fill: #fff; stroke: #475569; stroke-width: 1.5; }
.gk-j-ring { fill: none; stroke: #fff; stroke-width: 2; }
.gk-j-lbl { fill: #0f172a; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gk-j-lbl--muted { fill: #64748b; font-weight: 700; }
.gk-j-guide { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 3; }
.gk-j-hit { fill: transparent; }
.gk-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) {
  .gk-tray { padding: 10px; border-radius: 18px; }
  .gk-ref-thumb { width: 54px; height: 54px; }
  .gk-coach-avatar { width: 42px; height: 42px; }
  .gk-coach-bubble::before { left: 66px; }
  .gk-coach-text { font-size: 14px; }
  .gk-seg button { padding: 0 11px; }
  .gk-toolbar .gd-btn { padding: 8px 11px; font-size: 13.5px; min-height: 38px; }
  .gk-road { padding: 8px 10px 6px; }
  .gk-road-n { font-size: 26px; }
  .gk-road-say { margin-left: 0; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .gk-road-dino, .gk-road-stone { transition: none; }
  .gk-road-dino.is-hop .gk-road-dino-img, .gk-road-home.is-home,
  .gk-hand, .gk-glow, .gk-glow * { animation: none !important; }
}

.gk-shake { animation: gk-shake .24s; }
@keyframes gk-shake { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
.gk-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;
}
