/* 工具箱試作（2026-11-23，Claude）：tools.html 與四個工具頁共用。
   只在工具箱這幾頁載入；build_white.py 只組 index/about/work/blog，不會帶到線上。 */

.trial-bar { background: var(--note, #FBF7EC); border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--dim); }
.trial-bar .wrap { padding-top: 8px; padding-bottom: 8px; }

.tools-page .page-head { padding-bottom: 48px; }
.crumb { font-size: 14px; margin: 0 0 18px; }
.crumb a { text-decoration: none; border-bottom: 1.5px solid var(--dot); padding-bottom: 1px; }

/* ---------- 工具箱入口：四個工具像四張卡擺在桌上 ---------- */
.tool-grid { list-style: none; margin: 0; padding: 0 0 96px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; max-width: 1000px; }
.tool-card {
  position: relative; display: flex; flex-direction: column; height: 100%;
  background: var(--note); padding: 28px 28px 24px; text-decoration: none; color: var(--ink);
  box-shadow: 0 1px 2px rgba(27,26,23,.08), 0 14px 28px -18px rgba(27,26,23,.4);
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.tool-grid li:nth-child(1) .tool-card { transform: rotate(-1.5deg); }
.tool-grid li:nth-child(2) .tool-card { transform: rotate(1deg); }
.tool-grid li:nth-child(3) .tool-card { transform: rotate(-.5deg); }
.tool-grid li:nth-child(4) .tool-card { transform: rotate(1.2deg); }
a.tool-card:hover { transform: rotate(0) translateY(-4px); box-shadow: 0 1px 2px rgba(27,26,23,.08), 0 22px 36px -18px rgba(27,26,23,.45); }
.tool-card svg { width: 44px; height: 44px; margin-bottom: 18px; }
.tool-card .tag { font-size: 12px; letter-spacing: .06em; color: var(--dim); margin: 0 0 6px; }
.tool-card h2 { font-size: 26px; font-weight: 700; margin: 0 0 10px; letter-spacing: .02em; }
.tool-card p { font-size: 16px; line-height: 1.7; margin: 0 0 20px; color: #4A4C44; }
.tool-card .go { margin-top: auto; font-size: 15px; font-weight: 500; }
.tool-card .go b { border-bottom: 1.5px solid var(--dot); font-weight: 500; }
.tool-card.soon { opacity: .62; }

/* ---------- 工具頁共通 ---------- */
.tool { padding: 0 0 72px; }
.tool .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); column-gap: 56px; align-items: start; }
.how { font-size: 14px; color: var(--dim); margin: 16px 0 0; }
.pill {
  appearance: none; font: inherit; font-size: 16px; font-weight: 500; cursor: pointer;
  min-height: 48px; padding: 0 30px; border-radius: 999px; border: 0;
  background: var(--ink); color: #fff;
  transition: background-color 200ms ease-out, transform 160ms var(--ease-out), opacity 200ms;
}
.pill:hover { background: #3a3832; }
.pill:active { transform: scale(.97); }
.pill[disabled] { opacity: .35; cursor: default; }
.pill.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.pill.ghost:hover { background: var(--ink); color: #fff; }
.text-btn { appearance: none; background: none; border: 0; font: inherit; font-size: 14px; color: var(--dim); cursor: pointer; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 28px; }

.flow { min-height: 320px; }
.flow .step-tag { font-size: 13px; letter-spacing: .06em; color: var(--dim); margin: 0 0 12px; }
.flow .q { font-size: 30px; font-weight: 700; line-height: 1.5; letter-spacing: .02em; margin: 0; text-wrap: pretty; }
.flow .q-prev { font-size: 16px; color: var(--dim); margin: 0 0 14px; padding-left: 14px; border-left: 3px solid var(--rule); }
.flow input[type=text], .flow textarea {
  width: 100%; font: inherit; font-size: 18px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--ink); border-radius: 12px; padding: 12px 16px; margin-top: 22px;
}
.flow textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.flow .placeholder { font-size: 18px; color: var(--dim); }
.fade { animation: rise 400ms var(--ease-out) both; }

/* 小卡 */
.card-out { margin-top: 28px; }
.card-out img { width: 100%; max-width: 360px; box-shadow: 0 1px 2px rgba(27,26,23,.08), 0 14px 28px -16px rgba(27,26,23,.42); transform: rotate(-1.5deg); margin-bottom: 24px; }
.cta { font-size: 16px; line-height: 1.8; margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--rule); }
.cta a { text-decoration: none; border-bottom: 1.5px solid var(--dot); font-weight: 500; }
.source { font-size: 13px; color: var(--dim); margin: 40px 0 0; line-height: 1.8; }

/* ---------- 逆向轉盤 ---------- */
.wheel-box { position: relative; max-width: 520px; width: 100%; margin: 0 auto; }
.wheel-box svg { display: block; width: 100%; height: auto; }
.wheel-box .pointer { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 34px; height: 40px; z-index: 2; filter: drop-shadow(0 2px 3px rgba(27,26,23,.25)); }
.wheel-hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 26%; aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; font: inherit; font-size: 18px; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 0 0 6px #fff, 0 6px 14px rgba(27,26,23,.25);
  transition: transform 160ms var(--ease-out), background-color 200ms;
}
.wheel-hub:hover { background: #3a3832; }
.wheel-hub:active { transform: translate(-50%, -50%) scale(.95); }
.wheel-hub[disabled] { cursor: default; background: var(--dim); }
.sound { display: block; margin: 14px auto 0; }

/* ---------- 心情天氣圖 ---------- */
.sky {
  position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 24px;
  background: #F1F1EE; transition: background-color 1200ms ease-out;
}
.sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky .layer { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1200ms ease-out; }
.sky .glow { background: radial-gradient(circle at 72% 24%, rgba(231,121,50,.42), rgba(255,214,140,.25) 30%, transparent 62%); }
.sky .fog { background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.65)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sky .flash { background: #fff; transition: opacity 120ms ease-out; }
.sky .rainbow { display: flex; align-items: flex-end; justify-content: center; }
.sky .rainbow svg { width: 86%; height: auto; margin-bottom: -6%; }
.sky .cloudset svg { position: absolute; width: 34%; height: auto; }
.sky .cloudset svg:nth-child(1) { left: -10%; top: 12%; animation: drift 26s linear infinite; }
.sky .cloudset svg:nth-child(2) { left: 30%; top: 32%; width: 26%; animation: drift 34s linear infinite -12s; }
@keyframes drift { from { transform: translateX(-20%); } to { transform: translateX(260%); } }
.sky .sun-dot { position: absolute; right: 18%; top: 14%; width: 15%; aspect-ratio: 1; border-radius: 50%; background: #F2A65A; opacity: 0; transition: opacity 1200ms ease-out; }
.sky-label { position: absolute; left: 22px; bottom: 18px; font-size: 15px; font-weight: 500; background: rgba(255,255,255,.85); padding: 6px 14px; border-radius: 999px; opacity: 0; transition: opacity 600ms ease-out; }
.sky-label.on { opacity: 1; }
.sky-hint { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; color: var(--dim); text-align: center; padding: 24px; }
.sky-hint[hidden] { display: none; }

.wx-grid { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.wx {
  appearance: none; width: 100%; font: inherit; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #fff; border: 1.5px solid var(--rule); border-radius: 16px; padding: 14px 6px 12px;
  font-size: 14px; line-height: 1.3; transition: border-color 150ms ease-out, background-color 150ms ease-out, transform 160ms var(--ease-out);
}
.wx svg { width: 36px; height: 36px; }
.wx:hover { border-color: var(--ink); }
.wx:active { transform: scale(.96); }
.wx[aria-pressed="true"] { border-color: var(--dot); background: var(--note); }

.team-row { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; margin-top: 18px; padding: 10px 12px; border: 1.5px dashed var(--rule); border-radius: 14px; }
.team-row svg { width: 30px; height: 30px; animation: rise 300ms var(--ease-out) both; }
.team-row .empty-hint { font-size: 14px; color: var(--dim); align-self: center; }
.mode-switch { margin-top: 18px; }

@media (max-width: 1024px) {
  .tool-grid { grid-template-columns: 1fr; max-width: 560px; }
  .tool .wrap { grid-template-columns: 1fr; row-gap: 40px; }
  .flow { min-height: 0; }
}
@media (max-width: 760px) {
  .tool-grid { gap: 24px; padding-bottom: 56px; }
  .tool-card { padding: 22px 22px 20px; }
  .tool-card h2 { font-size: 22px; }
  .flow .q { font-size: 23px; }
  .wx-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .wx { font-size: 12px; padding: 10px 2px; }
  .wx svg { width: 30px; height: 30px; }
  .sky { border-radius: 18px; }
  .wheel-hub { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .fade, .team-row svg { animation: fade-in 200ms ease-out both; }
  .sky .cloudset svg { animation: none; }
  .tool-grid li .tool-card, a.tool-card:hover { transform: none; }
}

/* 選單變成五格：手機上字不換行、間距縮小，否則「關於我」會被擠成直排（上線時要搬進 style.css） */
/* 選單修正已搬進 style.css */

/* ---------- 樹的比喻 ---------- */
.tree-box { background: #F6F7F2; border-radius: 24px; padding: 18px 18px 8px; }
.tree-box svg { display: block; width: 100%; max-width: 460px; height: auto; margin: 0 auto; }
.tree-name { font-size: 17px; font-weight: 700; margin: 4px 4px 0; text-align: center; }
#tree .part { opacity: 0; }
#tree .lab { opacity: 0; transition: opacity 500ms ease-out 400ms; }

/* ---------- 9 Whys：往下挖 ---------- */
.dig { border-radius: 24px; overflow: hidden; background: #F6F7F2; }
.dig-sky { height: 56px; border-bottom: 3px solid #8DB580; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; font-size: 13px; color: var(--dim); }
.dig ol { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; scroll-behavior: smooth; }
.dig li { padding: 14px 20px; font-size: 16px; line-height: 1.6; animation: rise 400ms var(--ease-out) both; }
.dig li small { display: block; font-size: 12px; opacity: .75; margin-bottom: 2px; }
.dig li.dark { color: #fff; }
.dig li.found { box-shadow: inset 0 0 0 3px var(--dot); font-weight: 700; }
.dig .empty-hint { padding: 28px 20px; color: var(--dim); font-size: 15px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .dig li { animation: none; } .dig ol { scroll-behavior: auto; } }

/* 窄螢幕：樹和土層黏在畫面上方，邊回答邊看它長，不用上下捲 */
@media (max-width: 1024px) {
  .tool .sticky-stage { position: sticky; top: 0; z-index: 2; }
  .tool div.sticky-stage { background: var(--paper); padding-top: 8px; }
  .tree-box svg { max-height: 34vh; }
  .dig.sticky-stage ol { max-height: 24vh; }
  .stage-flow { scroll-margin-top: 44vh; }
  .dig.sticky-stage ~ .stage-flow { scroll-margin-top: calc(24vh + 76px); }
  .dig.sticky-stage ~ .stage-flow .q-prev { display: none; }   /* 上一句已經在土層最底下 */
  .tool .wrap:has(.sticky-stage) { row-gap: 24px; }
}

/* 樹：手機上樹旁的標籤太小看不見，改在樹下顯示剛答的那句；還沒種下去時樹先縮小，讓第一題露出來 */
.tree-last { display: none; }
@media (max-width: 600px) {
  .tree-box .lab { display: none; }
  .tree-last { display: block; min-height: 1.5em; margin: 2px 8px 6px; font-size: 14px; text-align: center; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tree-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tree-box svg { transition: max-height 600ms var(--ease-out); }
  .tree-box.unplanted svg { max-height: 8vh; height: 8vh; }   /* Safari 對 max-height 不一定生效，直接給高度 */
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) { .tree-box svg { transition: none; } }

/* 還沒種下去時，樹不必黏在上方，免得往下捲時蓋住第一題（2026-11-23 Corrie 手機截圖） */
.tool .sticky-stage:has(.unplanted) { position: static; }
