/* 動手玩元件樣式：web-layers／flow／api-playground／git-sim。
 * class 一律前綴 .w-<id>；顏色／圓角用 base.css 的 CSS 變數；尺寸用 em／rem（講師模式整體放大字級）。 */

/* ========== web-layers：前端三層 ========== */
.w-web-layers-wrap { display: grid; gap: .9em; }
.w-web-layers-label { margin: 0 0 .45em; font-size: .78em; font-weight: 800; letter-spacing: .06em; color: var(--c-muted); }

/* 開關（窄版一層一列；寬版三個並排） */
.w-web-layers-toggles { display: grid; grid-template-columns: minmax(0, 1fr); gap: .55em; }
.w-web-layers-toggle {
  --t: var(--c-orange); --t-dark: var(--c-orange-dark); --t-soft: var(--c-orange-soft);
  appearance: none; -webkit-appearance: none;
  display: flex; align-items: center; gap: .6em; width: 100%; min-height: 3.4em; padding: .5em .8em;
  border: 2px solid var(--c-line-strong); border-radius: 14px; background: var(--c-surface); color: var(--c-text);
  text-align: left; cursor: pointer; box-shadow: 0 4px 0 var(--c-line-strong);
  transition: transform .08s, box-shadow .08s, background .15s, border-color .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.w-web-layers-toggle--css { --t: var(--c-blue); --t-dark: var(--c-blue-dark); --t-soft: var(--c-blue-soft); }
.w-web-layers-toggle--js { --t: var(--c-gold); --t-dark: var(--c-gold-dark); --t-soft: var(--c-gold-soft); }
.w-web-layers-toggle:hover { border-color: var(--t); }
.w-web-layers-toggle:active { transform: translateY(4px); box-shadow: 0 0 0 var(--c-line-strong); }
.w-web-layers-toggle.is-on { background: var(--t-soft); border-color: var(--t); box-shadow: 0 4px 0 var(--t-dark); }
.w-web-layers-toggle.is-on:active { box-shadow: 0 0 0 var(--t-dark); }
.w-web-layers-toggle.is-locked { background: var(--c-surface-2); border-style: dashed; box-shadow: 0 4px 0 var(--c-line); }
.w-web-layers-toggle.is-locked .w-web-layers-toggle-icon,
.w-web-layers-toggle.is-locked .w-web-layers-toggle-text { opacity: .5; }
.w-web-layers-toggle-icon { flex: none; font-size: 1.4em; line-height: 1; }
.w-web-layers-toggle-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.w-web-layers-toggle-name { font-weight: 800; font-size: .98em; }
.w-web-layers-toggle-role { font-size: .76em; font-weight: 700; color: var(--c-muted); }
.w-web-layers-toggle.is-on .w-web-layers-toggle-role { color: var(--t-dark); }
.w-web-layers-switch {
  position: relative; flex: none; margin-left: auto; width: 2.3em; height: 1.35em;
  border-radius: 999px; background: var(--c-locked-dark); transition: background .18s;
}
.w-web-layers-knob {
  position: absolute; top: .18em; left: .18em; width: 1em; height: 1em; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s var(--ease);
}
.w-web-layers-toggle.is-on .w-web-layers-switch { background: var(--t); }
.w-web-layers-toggle--js.is-on .w-web-layers-switch { background: var(--c-gold-dark); }
.w-web-layers-toggle.is-on .w-web-layers-knob { transform: translateX(.95em); }
.w-web-layers-toggle.is-shake { animation: w-web-layers-shake .45s; }
.w-web-layers-toggle.is-nudge { outline: .2em solid transparent; outline-offset: .15em; animation: w-web-layers-nudge .6s; }
@keyframes w-web-layers-shake {
  0%, 100% { transform: translateX(0); } 20% { transform: translateX(-.3em); } 40% { transform: translateX(.3em); }
  60% { transform: translateX(-.2em); } 80% { transform: translateX(.2em); }
}
@keyframes w-web-layers-nudge { 0%, 100% { outline-color: transparent; } 25%, 75% { outline-color: var(--t); } }

/* 任務小清單 */
.w-web-layers-steps { display: flex; flex-wrap: wrap; gap: .4em; margin: 0; padding: 0; list-style: none; }
.w-web-layers-step {
  display: inline-flex; align-items: center; gap: .4em; padding: .2em .75em .2em .25em;
  border: 2px solid transparent; border-radius: 999px; background: var(--c-surface-2);
  color: var(--c-muted); font-size: .82em; font-weight: 700; line-height: 1.4;
}
.w-web-layers-step-dot {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 1.55em; height: 1.55em;
  border: 2px solid var(--c-line-strong); border-radius: 50%; background: var(--c-surface); font-size: .85em; font-weight: 800;
}
.w-web-layers-step.is-current { border-color: var(--c-blue); background: var(--c-blue-soft); color: var(--c-blue-dark); }
.w-web-layers-step.is-current .w-web-layers-step-dot { border-color: var(--c-blue); color: var(--c-blue-dark); }
.w-web-layers-step.is-done { background: var(--c-primary-soft); color: var(--c-primary-dark); }
.w-web-layers-step.is-done .w-web-layers-step-dot { border-color: var(--c-primary); background: var(--c-primary); color: #fff; }

/* 預覽＋程式碼（寬版左右並排） */
.w-web-layers-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1em; }
.w-web-layers-preview, .w-web-layers-panel { min-width: 0; }
.w-web-layers-frame {
  overflow: hidden; border: 2px solid var(--c-line-strong); border-radius: var(--radius); background: #fff;
  box-shadow: 0 3px 0 var(--c-line);
}
.w-web-layers-bar { display: flex; align-items: center; gap: .6em; padding: .45em .7em; background: var(--c-surface-2); border-bottom: 2px solid var(--c-line); }
.w-web-layers-dots { display: inline-flex; gap: .3em; flex: none; }
.w-web-layers-dots i { width: .62em; height: .62em; border-radius: 50%; background: #ff6b6b; }
.w-web-layers-dots i:nth-child(2) { background: var(--c-gold); }
.w-web-layers-dots i:nth-child(3) { background: var(--c-primary); }
.w-web-layers-addr {
  flex: 1; min-width: 0; padding: .1em .8em; border-radius: 999px; background: var(--c-surface); border: 1px solid var(--c-line);
  color: var(--c-muted); font-size: .76em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.w-web-layers-host { display: block; }
.w-web-layers-frame.is-flash-html { animation: w-web-layers-glow-html .7s ease-out; }
.w-web-layers-frame.is-flash-css { animation: w-web-layers-glow-css .7s ease-out; }
.w-web-layers-frame.is-flash-js { animation: w-web-layers-glow-js .7s ease-out; }
@keyframes w-web-layers-glow-html { from { box-shadow: 0 0 0 0 rgba(255, 138, 0, .55); } to { box-shadow: 0 0 0 .9em rgba(255, 138, 0, 0); } }
@keyframes w-web-layers-glow-css { from { box-shadow: 0 0 0 0 rgba(31, 157, 224, .55); } to { box-shadow: 0 0 0 .9em rgba(31, 157, 224, 0); } }
@keyframes w-web-layers-glow-js { from { box-shadow: 0 0 0 0 rgba(255, 197, 61, .7); } to { box-shadow: 0 0 0 .9em rgba(255, 197, 61, 0); } }

.w-web-layers-hint {
  margin: .6em 0 0; min-height: 2.7em; padding: .55em .85em; border-radius: var(--radius-sm);
  background: var(--c-surface-2); color: var(--c-text); font-size: .9em; font-weight: 700; line-height: 1.5;
}
.w-web-layers-hint.is-warn { background: var(--c-orange-soft); color: var(--c-orange-dark); }
.w-web-layers-hint.is-ok { background: var(--c-primary-soft); color: var(--c-primary-dark); }

.w-web-layers-tabs { display: flex; flex-wrap: wrap; gap: .4em; margin: 0 0 .55em; }
.w-web-layers-tab {
  appearance: none; -webkit-appearance: none; min-height: 2.2em; padding: .15em .8em; border: 2px solid var(--c-line-strong);
  border-radius: 999px; background: var(--c-surface); color: var(--c-text); font-family: var(--mono); font-size: .8em; font-weight: 700; cursor: pointer;
}
.w-web-layers-tab.is-locked { border-style: dashed; color: var(--c-locked-text); background: var(--c-surface-2); }
.w-web-layers-tab--html.is-active { border-color: var(--c-orange); background: var(--c-orange-soft); color: var(--c-orange-dark); }
.w-web-layers-tab--css.is-active { border-color: var(--c-blue); background: var(--c-blue-soft); color: var(--c-blue-dark); }
.w-web-layers-tab--js.is-active { border-color: var(--c-gold-dark); background: var(--c-gold-soft); color: #8a6200; }

.w-web-layers-file { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4em; margin: 0 0 .4em; }
.w-web-layers-file-name { font-family: var(--mono); font-size: .8em; font-weight: 800; color: var(--c-muted); }
.w-web-layers-file-role { padding: .05em .6em; border-radius: 8px; font-size: .8em; font-weight: 800; background: var(--c-orange-soft); color: var(--c-orange-dark); }
.w-web-layers-file--css .w-web-layers-file-role { background: var(--c-blue-soft); color: var(--c-blue-dark); }
.w-web-layers-file--js .w-web-layers-file-role { background: var(--c-gold-soft); color: #8a6200; }
.w-web-layers-code {
  margin: 0; padding: .8em .95em; border-radius: var(--radius-sm); background: var(--c-code-bg); color: var(--c-code-text);
  font-family: var(--mono); font-size: .8em; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2;
  animation: w-web-layers-in .3s var(--ease);
}
.w-web-layers-code code { padding: 0; border: 0; background: none; color: inherit; font-size: 1em; }
.w-web-layers-k-tag, .w-web-layers-k-fn, .w-web-layers-k-prop { color: #7cc4ff; }
.w-web-layers-k-attr { color: #ffd479; }
.w-web-layers-k-str, .w-web-layers-k-val { color: #a5e88f; }
.w-web-layers-k-sel, .w-web-layers-k-num { color: #ffb86b; }
.w-web-layers-k-key { color: #c9a7ff; font-weight: 700; }
.w-web-layers-k-com { color: #8b93a7; font-style: italic; }
.w-web-layers-note {
  margin: .6em 0 0; padding: .6em .85em; border-left: .3em solid var(--c-orange); border-radius: var(--radius-sm);
  background: var(--c-orange-soft); font-size: .92em; line-height: 1.6;
}
.w-web-layers-note--css { border-left-color: var(--c-blue); background: var(--c-blue-soft); }
.w-web-layers-note--js { border-left-color: var(--c-gold-dark); background: var(--c-gold-soft); }
.w-web-layers-empty {
  display: flex; align-items: center; gap: .7em; padding: 1em; border: 2px dashed var(--c-line-strong); border-radius: var(--radius-sm);
  color: var(--c-muted); font-size: .92em; font-weight: 700; line-height: 1.5;
}
.w-web-layers-empty-icon { flex: none; font-size: 1.6em; }
@keyframes w-web-layers-in { from { opacity: 0; transform: translateY(.35em); } to { opacity: 1; transform: none; } }

/* 完成橫幅 */
.w-web-layers-done {
  display: flex; align-items: center; gap: .8em; padding: .8em 1em; border: 2px solid var(--c-gold); border-radius: var(--radius);
  background: var(--c-gold-soft); color: #8a6200;
}
.w-web-layers-done[hidden] { display: none; }
.w-web-layers-done-icon { flex: none; width: 2.5em; height: 2.5em; }
.w-web-layers-done > div { display: flex; flex-direction: column; line-height: 1.5; }
.w-web-layers-done strong { font-size: 1.05em; }
.w-web-layers-done > div > span { font-size: .92em; font-weight: 700; }
.w-web-layers-done.is-pop { animation: w-web-layers-pop .55s var(--ease); }
@keyframes w-web-layers-pop { 0% { transform: scale(.85); opacity: 0; } 60% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); } }

/* 版型：元件寬 ≥ 30em 開關三個並排；≥ 36em 預覽與程式碼左右並排（class 由 JS 依寬度切換） */
.w-web-layers-wide .w-web-layers-toggles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.w-web-layers-xwide .w-web-layers-main { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-items: start; }

/* ========== flow：請求旅程 ========== */
.w-flow-wrap { display: grid; gap: .9em; }
.w-flow-top { display: flex; align-items: center; flex-wrap: wrap; gap: .5em; }
.w-flow-label { font-size: .78em; font-weight: 800; letter-spacing: .06em; color: var(--c-muted); }
.w-flow-chips { display: flex; flex-wrap: wrap; gap: .4em; }
.w-flow-chip { min-height: 2.5em; padding: .2em .85em; font-size: .9em; color: var(--c-text); }
.w-flow-chip-check { display: none; color: var(--c-primary-dark); font-weight: 900; }
.w-flow-chip.is-finished .w-flow-chip-check { display: inline; }

/* 舞台：角色＋連線＋封包 */
.w-flow-stage {
  position: relative; overflow: hidden; padding: 1em .8em; border-radius: var(--radius);
  background-color: var(--c-surface-2);
  background-image: radial-gradient(var(--c-line) 1.2px, transparent 1.3px);
  background-size: 1.1em 1.1em;
}
.w-flow-wires { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.w-flow-wire { fill: none; stroke: var(--c-line-strong); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 9; }
.w-flow-route { stroke: var(--c-blue); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 10 8; animation: w-flow-dash .7s linear infinite; }
.w-flow-arrow { fill: var(--c-blue); }
@keyframes w-flow-dash { to { stroke-dashoffset: -18; } }

.w-flow-actors { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.9em; margin: 0; padding: 0; list-style: none; }
.w-flow-actor { display: flex; align-items: flex-start; gap: .8em; min-width: 0; }
.w-flow-avatar {
  flex: none; display: flex; align-items: center; justify-content: center; width: 2.05em; height: 2.05em;
  border: 3px solid var(--c-line-strong); border-radius: 50%; background: var(--c-surface);
  font-size: 1.6em; line-height: 1; box-shadow: 0 3px 0 var(--c-line);
  transition: border-color .2s, box-shadow .2s;
}
.w-flow-body { display: flex; flex-direction: column; align-items: flex-start; gap: .3em; min-width: 0; padding-top: .2em; }
.w-flow-name { font-weight: 800; font-size: .95em; line-height: 1.3; }
.w-flow-bubble {
  max-width: 100%; padding: .3em .75em; border: 2px solid var(--c-line); border-radius: .85em; background: var(--c-surface);
  font-size: .85em; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere;
  visibility: hidden; opacity: 0; transform: translateY(.3em) scale(.96);
  transition: opacity .2s, transform .25s var(--ease);
}
.w-flow-bubble:empty { padding: 0; border: 0; }
.w-flow-bubble.is-shown { visibility: visible; opacity: 1; transform: none; border-color: var(--c-blue); background: var(--c-blue-soft); color: var(--c-blue-dark); }
.w-flow-bubble.is-shown.is-think { border-color: var(--c-gold); background: var(--c-gold-soft); color: #8a6200; }
.w-flow-actor.is-sending .w-flow-avatar { border-color: var(--c-blue); }
.w-flow-actor.is-receiving .w-flow-avatar { border-color: var(--c-blue); box-shadow: 0 0 0 .22em var(--c-blue-soft), 0 3px 0 var(--c-line); animation: w-flow-ping .6s var(--ease); }
.w-flow-actor.is-busy .w-flow-avatar { border-color: var(--c-gold); box-shadow: 0 0 0 .22em var(--c-gold-soft), 0 3px 0 var(--c-line); animation: w-flow-wobble 1.1s ease-in-out infinite; }
.w-flow-actor.is-busy .w-flow-name, .w-flow-actor.is-receiving .w-flow-name { color: var(--c-text); }
@keyframes w-flow-ping { 0% { transform: scale(1); } 40% { transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes w-flow-wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }

.w-flow-packet {
  position: absolute; left: 0; top: 0; z-index: 3; display: inline-flex; align-items: center; gap: .4em;
  max-width: min(15em, 100%); padding: .22em .8em .22em .22em; border-radius: 999px;
  background: var(--c-blue); color: #fff; font-size: .88em; font-weight: 800; white-space: nowrap;
  box-shadow: 0 3px 0 var(--c-blue-dark), 0 .5em 1.2em rgba(21, 123, 179, .28);
  pointer-events: none; transition: opacity .3s; will-change: transform;
}
.w-flow-packet[hidden] { display: none; }
.w-flow-packet.is-landed { opacity: 0; }
.w-flow-packet-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.85em; height: 1.85em; border-radius: 50%; background: #fff; font-size: 1em; }
.w-flow-packet-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* 控制列 */
.w-flow-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6em; }
.w-flow-controls .btn { flex: 1 1 auto; }
.w-flow-controls .w-flow-next { flex: 1 1 100%; }
.w-flow-progress {
  margin-left: auto; padding: .15em .7em; border-radius: 999px; background: var(--c-surface-2);
  color: var(--c-muted); font-size: .82em; font-weight: 800; white-space: nowrap;
}

/* 逐步紀錄 */
.w-flow-log { display: grid; gap: .45em; margin: 0; padding: 0; list-style: none; }
.w-flow-log-empty {
  padding: .8em 1em; border: 2px dashed var(--c-line-strong); border-radius: var(--radius-sm);
  color: var(--c-muted); font-size: .92em; font-weight: 700; line-height: 1.55;
}
.w-flow-log-item {
  display: flex; align-items: flex-start; gap: .7em; padding: .55em .8em; border: 2px solid var(--c-line); border-radius: var(--radius-sm);
  background: var(--c-surface); animation: w-flow-in .3s var(--ease);
}
.w-flow-log-item.is-current { border-color: var(--c-blue); background: var(--c-blue-soft); }
.w-flow-log-n {
  flex: none; margin-top: .15em; padding: .15em .6em; border-radius: 999px; background: var(--c-surface-2);
  color: var(--c-muted); font-size: .75em; font-weight: 800; white-space: nowrap;
}
.w-flow-log-item.is-current .w-flow-log-n { background: var(--c-blue); color: #fff; }
.w-flow-log-main { display: flex; flex-direction: column; gap: .1em; min-width: 0; line-height: 1.5; }
.w-flow-log-route { color: var(--c-muted); font-size: .78em; font-weight: 800; }
.w-flow-log-arrow { color: var(--c-blue-dark); }
.w-flow-log-text { font-weight: 800; overflow-wrap: anywhere; }
.w-flow-log-detail { color: var(--c-muted); font-size: .86em; overflow-wrap: anywhere; }
@keyframes w-flow-in { from { opacity: 0; transform: translateY(.4em); } to { opacity: 1; transform: none; } }

/* 完成橫幅 */
.w-flow-done {
  display: flex; align-items: center; gap: .8em; padding: .8em 1em; border: 2px solid var(--c-gold); border-radius: var(--radius);
  background: var(--c-gold-soft); color: #8a6200;
}
.w-flow-done[hidden] { display: none; }
.w-flow-done-icon { flex: none; width: 2.5em; height: 2.5em; }
.w-flow-done > div { display: flex; flex-direction: column; line-height: 1.5; }
.w-flow-done strong { font-size: 1.05em; }
.w-flow-done > div > span { font-size: .92em; font-weight: 700; }
.w-flow-done.is-pop { animation: w-flow-pop .55s var(--ease); }
@keyframes w-flow-pop { 0% { transform: scale(.85); opacity: 0; } 60% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); } }

/* 寬版（元件寬 ≥ 30em，class 由 JS 切換）：角色橫排 */
.w-flow-wide .w-flow-stage { padding: 1.3em .8em 1em; }
.w-flow-wide .w-flow-actors { grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 1em; }
.w-flow-wide .w-flow-actor { flex-direction: column; align-items: center; gap: .45em; text-align: center; }
.w-flow-wide .w-flow-body { align-items: center; min-height: 4.9em; padding-top: 0; }
.w-flow-wide .w-flow-controls .btn { flex: 0 0 auto; }
.w-flow-wide .w-flow-next { min-width: 8.5em; }

/* ========== api-playground：API 遊樂場 ========== */
.w-api-playground-wrap { display: grid; gap: .9em; }
.w-api-playground-label { margin: 0 0 .45em; font-size: .78em; font-weight: 800; letter-spacing: .06em; color: var(--c-muted); }
.w-api-playground-head { display: flex; align-items: center; gap: .7em; }
.w-api-playground-logo {
  flex: none; display: flex; align-items: center; justify-content: center; width: 2.1em; height: 2.1em;
  border-radius: .7em; background: var(--c-orange-soft); font-size: 1.25em; line-height: 1;
}
.w-api-playground-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.w-api-playground-title strong { font-size: 1.05em; }
.w-api-playground-title span { color: var(--c-muted); font-size: .8em; font-weight: 700; }

/* 挑戰 */
.w-api-playground-challenge {
  position: relative; display: flex; align-items: center; gap: .7em; padding: .65em .95em;
  border: 2px dashed var(--c-purple); border-radius: var(--radius); background: var(--c-purple-soft); color: var(--c-purple-dark);
}
.w-api-playground-challenge.is-done { border-style: solid; border-color: var(--c-gold); background: var(--c-gold-soft); color: #8a6200; animation: w-api-playground-pop .5s var(--ease); }
.w-api-playground-ch-icon { flex: none; font-size: 1.55em; line-height: 1; }
.w-api-playground-ch-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.45; }
.w-api-playground-ch-text strong { font-size: .95em; }
.w-api-playground-ch-text span { font-size: .92em; font-weight: 700; }

/* 主區：端點清單＋請求／回應 */
.w-api-playground-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: .9em; }
.w-api-playground-list, .w-api-playground-console { min-width: 0; }
.w-api-playground-eps { display: grid; gap: .45em; }
.w-api-playground-ep {
  appearance: none; -webkit-appearance: none; display: flex; align-items: center; gap: .6em; width: 100%; min-height: 3em;
  padding: .45em .6em; border: 2px solid var(--c-line); border-radius: 12px; background: var(--c-surface); color: var(--c-text);
  text-align: left; cursor: pointer; box-shadow: 0 3px 0 var(--c-line);
  transition: transform .08s, box-shadow .08s, border-color .15s, background .15s; -webkit-tap-highlight-color: transparent;
}
.w-api-playground-ep:hover { border-color: var(--c-line-strong); }
.w-api-playground-ep:active { transform: translateY(3px); box-shadow: 0 0 0 var(--c-line); }
.w-api-playground-ep.is-active { border-color: var(--c-blue); background: var(--c-blue-soft); box-shadow: 0 3px 0 var(--c-blue); }
.w-api-playground-ep-main { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.35; }
/* 路徑：JS 在每個「/」後插 <wbr>，只在那裡斷行；單段長到一行放不下才退而求其次切開（break-word），不會撐出橫向捲軸 */
.w-api-playground-ep-path { font-family: var(--mono); font-size: .82em; font-weight: 700; word-break: normal; overflow-wrap: break-word; }
.w-api-playground-ep-desc { color: var(--c-muted); font-size: .78em; font-weight: 700; }
.w-api-playground-ep-tried {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.45em; height: 1.45em;
  border-radius: 50%; background: var(--c-primary); color: #fff; font-size: .8em; visibility: hidden;
}
.w-api-playground-ep-tried .ico { width: .95em; height: .95em; }
.w-api-playground-ep.is-tried .w-api-playground-ep-tried { visibility: visible; }

.w-api-playground-method {
  flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 5.1em; padding: .22em .45em;
  border-radius: 8px; background: var(--c-muted); color: #fff; font-family: var(--mono); font-size: .72em; font-weight: 800; letter-spacing: .04em; line-height: 1.3;
}
.w-api-playground-method--get { background: var(--c-blue-dark); }
.w-api-playground-method--post { background: var(--c-primary-dark); }
.w-api-playground-method--put { background: var(--c-orange-dark); }
.w-api-playground-method--patch { background: var(--c-purple-dark); }
.w-api-playground-method--delete { background: var(--c-red-dark); }

.w-api-playground-console { display: grid; gap: .5em; }
.w-api-playground-card { min-width: 0; padding: .8em .95em; border: 2px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface); }
.w-api-playground-req { background: var(--c-surface-2); }
.w-api-playground-reqline { display: flex; align-items: center; flex-wrap: wrap; gap: .5em; }
.w-api-playground-reqline .w-api-playground-method { font-size: .82em; }
.w-api-playground-path { min-width: 0; max-width: 100%; padding: 0; border: 0; background: none; font-family: var(--mono); font-size: 1em; font-weight: 800; word-break: normal; overflow-wrap: break-word; }
.w-api-playground-reqbody { margin: .65em 0 .85em; }
.w-api-playground-sub { margin: 0 0 .3em; color: var(--c-muted); font-size: .78em; font-weight: 800; }
.w-api-playground-json {
  max-height: 16em; margin: 0; padding: .7em .9em; overflow-y: auto; border-radius: var(--radius-sm);
  background: var(--c-code-bg); color: var(--c-code-text); font-family: var(--mono); font-size: .8em; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.w-api-playground-json code { padding: 0; border: 0; background: none; color: inherit; font-size: 1em; }
.w-api-playground-j-key { color: #7cc4ff; }
.w-api-playground-j-str { color: #a5e88f; }
.w-api-playground-j-num { color: #ffb86b; }
.w-api-playground-j-bool { color: #c9a7ff; }
.w-api-playground-j-null { color: #ff9a9a; }
.w-api-playground-muted { margin: 0; color: var(--c-muted); font-size: .9em; font-weight: 700; line-height: 1.55; }
.w-api-playground-send { width: 100%; }

/* 傳送動畫 */
.w-api-playground-wire { display: flex; align-items: center; gap: .55em; padding: 0 .5em; }
.w-api-playground-wire-end { flex: none; font-size: 1.1em; line-height: 1; }
.w-api-playground-wire-track {
  position: relative; flex: 1; height: .28em; border-radius: 999px;
  background: repeating-linear-gradient(90deg, var(--c-line-strong) 0 .5em, transparent .5em 1em);
}
.w-api-playground-wire-dot { position: absolute; top: 50%; left: 0; font-size: 1.05em; line-height: 1; opacity: 0; transform: translate(-50%, -50%); }
.w-api-playground-wire.is-sending .w-api-playground-wire-dot { animation: w-api-playground-fly .5s ease-in-out forwards; }
@keyframes w-api-playground-fly { 0% { left: 0; opacity: 0; } 15%, 85% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

/* 回應 */
.w-api-playground-res { min-height: 7.5em; }
.w-api-playground-res.is-2 { border-color: var(--c-primary); }
.w-api-playground-res.is-3 { border-color: var(--c-blue); }
.w-api-playground-res.is-4 { border-color: var(--c-orange); }
.w-api-playground-res.is-5 { border-color: var(--c-red); }
.w-api-playground-res.is-pop { animation: w-api-playground-pop .4s var(--ease); }
.w-api-playground-idle { padding: 1.2em .5em; text-align: center; }
.w-api-playground-sending { padding: 1.2em .5em; text-align: center; }
.w-api-playground-spinner {
  display: inline-block; width: 1em; height: 1em; margin-right: .5em; vertical-align: -.15em;
  border: .18em solid var(--c-line-strong); border-top-color: var(--c-blue); border-radius: 50%;
  animation: w-api-playground-spin .6s linear infinite;
}
@keyframes w-api-playground-spin { to { transform: rotate(360deg); } }
.w-api-playground-status { display: flex; align-items: center; flex-wrap: wrap; gap: .5em .7em; margin: 0 0 .7em; }
.w-api-playground-code {
  display: inline-flex; align-items: baseline; gap: .15em; padding: .15em .65em; border-radius: 10px;
  background: var(--c-muted); color: #fff; font-family: var(--mono); font-size: 1.2em; font-weight: 800; line-height: 1.4;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}
.w-api-playground-code small { font-family: var(--font); font-size: .6em; font-weight: 800; }
.w-api-playground-code--2 { background: var(--c-primary-dark); }
.w-api-playground-code--3 { background: var(--c-blue-dark); }
.w-api-playground-code--4 { background: var(--c-orange-dark); }
.w-api-playground-code--5 { background: var(--c-red-dark); }
.w-api-playground-note { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.w-api-playground-note strong { font-size: 1.02em; }
.w-api-playground-note span { color: var(--c-muted); font-size: .8em; font-weight: 700; }
.w-api-playground-empty { padding: .7em .8em; border: 2px dashed var(--c-line-strong); border-radius: var(--radius-sm); text-align: center; }

/* 進度 */
.w-api-playground-progress { display: flex; flex-wrap: wrap; gap: .45em; }
.w-api-playground-pill {
  display: inline-flex; align-items: center; gap: .35em; padding: .25em .8em; border: 2px solid var(--c-line); border-radius: 999px;
  background: var(--c-surface-2); color: var(--c-muted); font-size: .82em; font-weight: 800;
}
.w-api-playground-pill.is-done { border-color: var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary-dark); }

/* 完成橫幅＋彩帶 */
.w-api-playground-done {
  position: relative; display: flex; align-items: center; gap: .8em; padding: .8em 1em; border: 2px solid var(--c-gold); border-radius: var(--radius);
  background: var(--c-gold-soft); color: #8a6200;
}
.w-api-playground-done[hidden] { display: none; }
.w-api-playground-done-icon { flex: none; width: 2.5em; height: 2.5em; }
.w-api-playground-done > div { display: flex; flex-direction: column; line-height: 1.5; }
.w-api-playground-done strong { font-size: 1.05em; }
.w-api-playground-done > div > span { font-size: .92em; font-weight: 700; }
.w-api-playground-done.is-pop { animation: w-api-playground-pop .55s var(--ease); }
@keyframes w-api-playground-pop { 0% { transform: scale(.9); opacity: .2; } 60% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); } }
.w-api-playground-confetti { position: absolute; left: 50%; top: 50%; z-index: 2; width: 0; height: 0; pointer-events: none; }
.w-api-playground-confetti i {
  position: absolute; left: 0; top: 0; width: .5em; height: .75em; border-radius: 2px; opacity: 0;
  animation: w-api-playground-confetti 1.1s cubic-bezier(.15, .7, .3, 1) forwards;
}
@keyframes w-api-playground-confetti {
  0% { transform: translate(-50%, -50%) rotate(0) scale(.6); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0)), calc(-50% + var(--dy, 0) + 1.6em)) rotate(var(--rot, 180deg)) scale(1); opacity: 0; }
}

/* 寬版（元件寬 ≥ 38em，class 由 JS 切換）：端點清單在左、請求／回應在右 */
.w-api-playground-wide .w-api-playground-main { grid-template-columns: minmax(0, 17em) minmax(0, 1fr); align-items: start; }

/* ========== git-sim：Git 模擬器（工作區 → 暫存區 → 儲存庫） ========== */
/* 版面寬窄由 JS 依「元件寬度 ÷ 字級」切換 .w-git-sim-wide／-xwide／-narrow（不用 container query：
 * 外層若是 shrink-to-fit，container-type 會讓元件寬度塌成 0） */
.w-git-sim { display: grid; gap: .85em; min-width: 0; }
.w-git-sim > * { min-width: 0; }
.w-git-sim [hidden] { display: none !important; }
.w-git-sim-mono { font-family: var(--mono); font-weight: 800; letter-spacing: 0; }

/* 任務清單 */
.w-git-sim-missionbox {
  background: var(--c-surface-2); border: 2px solid var(--c-line); border-radius: var(--radius);
  padding: .65em .8em .75em;
}
.w-git-sim-top { display: flex; align-items: center; justify-content: space-between; gap: .6em; margin-bottom: .4em; }
.w-git-sim-label { font-size: .78em; font-weight: 800; color: var(--c-muted); letter-spacing: .06em; }
.w-git-sim-count { color: var(--c-primary-dark); margin-left: .15em; font-size: 1.1em; }
.w-git-sim-reset .ico { width: 1em; height: 1em; }
.w-git-sim-missions { list-style: none; margin: 0; padding: 0; display: grid; gap: .3em; }
.w-git-sim-mission {
  display: flex; align-items: center; gap: .55em;
  padding: .3em .55em; border-radius: var(--radius-sm); border: 2px solid transparent;
  font-weight: 700; line-height: 1.4; min-width: 0;
}
.w-git-sim-mtext { min-width: 0; overflow-wrap: anywhere; }
.w-git-sim-mtext code { font-size: .85em; }
.w-git-sim-mcheck {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 1.7em; height: 1.7em; border-radius: 50%;
  border: 2px solid var(--c-line-strong); background: var(--c-surface);
  font-size: .82em; font-weight: 800; color: var(--c-muted); line-height: 1;
}
.w-git-sim-mcheck .ico { width: 1.05em; height: 1.05em; vertical-align: 0; }
.w-git-sim-mission.is-current { background: var(--c-blue-soft); border-color: var(--c-blue); color: var(--c-blue-dark); }
.w-git-sim-mission.is-current .w-git-sim-mcheck { border-color: var(--c-blue); color: var(--c-blue-dark); animation: w-git-sim-pulse 1.8s ease-in-out infinite; }
.w-git-sim-mission.is-done { color: var(--c-muted); }
.w-git-sim-mission.is-done .w-git-sim-mcheck { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.w-git-sim-mission.is-pop .w-git-sim-mcheck { animation: w-git-sim-pop .5s var(--ease); }
.w-git-sim-mission.is-manual .w-git-sim-mcheck { border-style: dashed; }
.w-git-sim-xwide .w-git-sim-missions { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(var(--w-git-sim-rows, 3), auto); grid-auto-flow: column; column-gap: .5em; }

/* 提示列 */
.w-git-sim-hint {
  display: grid; gap: .25em;
  padding: .6em .85em; border-radius: var(--radius);
  border: 2px solid var(--c-line); background: var(--c-surface);
  transition: background .2s, border-color .2s;
}
.w-git-sim-hint.is-ok { border-color: var(--c-primary); background: var(--c-primary-soft); }
.w-git-sim-hint.is-warn { border-color: var(--c-orange); background: var(--c-orange-soft); }
.w-git-sim-feedback { margin: 0; font-weight: 800; line-height: 1.5; overflow-wrap: anywhere; }
.w-git-sim-feedback:empty { display: none; }
.w-git-sim-feedback.is-ok { color: var(--c-primary-dark); }
.w-git-sim-feedback.is-warn { color: var(--c-orange-dark); }
.w-git-sim-feedback code, .w-git-sim-next code { font-size: .85em; background: var(--c-surface); }
.w-git-sim-star { display: block; margin-top: .15em; color: #8a6200; }
.w-git-sim-next { margin: 0; color: var(--c-muted); font-weight: 700; font-size: .92em; line-height: 1.5; overflow-wrap: anywhere; }
.w-git-sim-next:empty { display: none; }

/* 三個區塊 */
.w-git-sim-flow { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5em; }
.w-git-sim-zone {
  min-width: 0; padding: .7em .8em .8em;
  border: 2px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface);
}
.w-git-sim-zone.is-work { border-top: .3em solid var(--c-orange); }
.w-git-sim-zone.is-stage { border-top: .3em solid var(--c-blue); }
.w-git-sim-zone.is-repo { border-top: .3em solid var(--c-primary); }
.w-git-sim-zone-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1em .55em; }
.w-git-sim-zone-title { font-weight: 800; font-size: 1.02em; }
.w-git-sim-zone-sub { font-size: .8em; font-weight: 700; color: var(--c-muted); }
.w-git-sim-repohead { align-items: center; }
.w-git-sim-headbadge {
  margin-left: auto; font-family: var(--mono); font-size: .76em; font-weight: 800;
  padding: .15em .65em; border-radius: 999px; color: #fff; background: var(--c-primary); white-space: nowrap;
}
.w-git-sim-headbadge.is-feature { background: var(--c-purple); }

.w-git-sim-files {
  list-style: none; margin: .55em 0 .65em; padding: 0;
  display: flex; flex-wrap: wrap; gap: .4em; min-height: 2.2em; align-content: flex-start;
}
.w-git-sim-file {
  display: inline-flex; align-items: center; gap: .35em; max-width: 100%;
  padding: .25em .55em; border-radius: 12px; border: 2px solid var(--c-line);
  background: var(--c-surface); font-weight: 800; font-size: .9em;
}
.w-git-sim-fname { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.w-git-sim-ftag { flex: none; font-size: .74em; font-weight: 800; padding: .05em .45em; border-radius: 6px; color: #fff; }
.w-git-sim-file.is-work { background: var(--c-orange-soft); border-color: var(--c-orange); }
.w-git-sim-file.is-work .w-git-sim-ftag { background: var(--c-orange-dark); }
.w-git-sim-file.is-stage { background: var(--c-blue-soft); border-color: var(--c-blue); }
.w-git-sim-file.is-stage .w-git-sim-ftag { background: var(--c-blue-dark); }
.w-git-sim-file.is-flash { animation: w-git-sim-pop .45s var(--ease); }
.w-git-sim-empty { align-self: center; color: var(--c-muted); font-size: .88em; font-weight: 700; }

.w-git-sim-edit { width: 100%; }
.w-git-sim-picker, .w-git-sim-commitpanel { animation: w-git-sim-slide .25s var(--ease); }
.w-git-sim-picker {
  margin-top: .65em; padding: .6em .65em .7em; border-radius: var(--radius-sm);
  background: var(--c-gold-soft); border: 2px dashed var(--c-gold-dark);
}
.w-git-sim-ask { margin: 0 0 .45em; font-size: .85em; font-weight: 800; color: var(--c-muted); }
.w-git-sim-picks, .w-git-sim-presets { display: flex; flex-wrap: wrap; gap: .45em; }
.w-git-sim-pick { white-space: normal; }

/* 連接兩區的指令按鈕（窄：↓；寬：→） */
.w-git-sim-link { display: flex; align-items: center; justify-content: center; }
.w-git-sim-link .btn { gap: .5em; }
.w-git-sim-arrow::after { content: '↓'; font-weight: 900; font-size: 1.1em; line-height: 1; }
.w-git-sim-wide .w-git-sim-flow { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; }
.w-git-sim-wide .w-git-sim-link.is-add .w-git-sim-arrow::after { content: '→'; }
.w-git-sim-wide .w-git-sim-link.is-add .btn { padding-left: .8em; padding-right: .8em; }

/* commit 訊息面板 */
.w-git-sim-commitpanel {
  display: grid; gap: .55em; padding: .7em .85em .85em;
  border: 2px solid var(--c-primary); border-radius: var(--radius); background: var(--c-primary-soft);
}
.w-git-sim-commitpanel .w-git-sim-ask { margin: 0; color: var(--c-primary-dark); }
.w-git-sim-preset { white-space: normal; text-align: left; }
.w-git-sim-form { display: flex; flex-wrap: wrap; gap: .45em; }
.w-git-sim-input {
  flex: 1 1 12em; min-width: 0; min-height: 2.4em; padding: .35em .75em;
  border: 2px solid var(--c-line-strong); border-radius: 12px; background: var(--c-surface);
  font-weight: 700;
}
.w-git-sim-input:focus { border-color: var(--c-blue); }
.w-git-sim-input.is-shake { border-color: var(--c-orange); }
.w-git-sim-cancel { justify-self: start; color: var(--c-muted); }

/* 分支指令列 */
.w-git-sim-branchbar { display: flex; flex-wrap: wrap; gap: .5em; margin: .65em 0 .6em; }
.w-git-sim-cmd { white-space: normal; text-align: left; overflow-wrap: anywhere; max-width: 100%; }
.w-git-sim-cmd .w-git-sim-mono { font-size: .95em; }

/* 建議的下一步按鈕：金色光圈 */
.w-git-sim-act { --w-git-sim-edge: 4px; }
.w-git-sim-act.btn-sm { --w-git-sim-edge: 3px; }
.w-git-sim-act.is-suggest {
  box-shadow: 0 var(--w-git-sim-edge) 0 var(--b-edge), 0 0 0 .22em var(--c-gold);
  animation: w-git-sim-glow 1.6s ease-in-out infinite;
}
.w-git-sim-act.is-suggest:active { box-shadow: 0 0 0 var(--b-edge), 0 0 0 .22em var(--c-gold); animation: none; }
.w-git-sim .is-shake { animation: w-git-sim-shake .4s ease; }

/* 歷史圖 */
.w-git-sim-graph {
  position: relative; max-height: 26em; overflow-y: auto; overflow-x: hidden;
  padding: .35em 0; border-radius: var(--radius-sm);
  background: var(--c-surface-2); border: 2px solid var(--c-line);
}
.w-git-sim-rows { position: relative; }
.w-git-sim-svg { position: absolute; left: 0; top: 0; overflow: visible; max-width: none; }
.w-git-sim-row { padding: .625em .65em 0 .2em; overflow: hidden; }
.w-git-sim-row.is-new { animation: w-git-sim-rowin .4s var(--ease); }
.w-git-sim-msgline { display: flex; align-items: center; gap: .45em; height: 1.35em; line-height: 1.35em; white-space: nowrap; overflow: hidden; }
.w-git-sim-msg { font-weight: 800; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.w-git-sim-row.is-merge .w-git-sim-msg { color: var(--c-purple-dark); }
.w-git-sim-mergetag { flex: none; line-height: 1.4; }
.w-git-sim-hash { flex: none; font-family: var(--mono); font-size: .74em; color: var(--c-muted); }
.w-git-sim-refs { display: flex; gap: .3em; margin-top: .32em; overflow: hidden; white-space: nowrap; }
.w-git-sim-ref {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--mono); font-size: .72em; font-weight: 800; line-height: 1.5;
  padding: 0 .55em; border-radius: 999px; border: 2px solid;
}
.w-git-sim-ref.is-main { color: var(--c-primary-dark); border-color: var(--c-primary); background: var(--c-primary-soft); }
.w-git-sim-ref.is-feature { color: var(--c-purple-dark); border-color: var(--c-purple); background: var(--c-purple-soft); }
.w-git-sim-ref.is-head.is-main { color: #fff; background: var(--c-primary); }
.w-git-sim-ref.is-head.is-feature { color: #fff; background: var(--c-purple); }
.w-git-sim-narrow .w-git-sim-hash, .w-git-sim-narrow .w-git-sim-mergetag { display: none; }
.w-git-sim-narrow .w-git-sim-branchbar .btn { flex: 1 1 100%; }

.w-git-sim-edge { fill: none; stroke-width: .24; stroke-linecap: round; }
.w-git-sim-edge.is-main { stroke: var(--c-primary); }
.w-git-sim-edge.is-feature { stroke: var(--c-purple); }
.w-git-sim-edge.is-new { stroke-dasharray: 1; animation: w-git-sim-draw .55s var(--ease) both; }
.w-git-sim-dot { stroke: var(--c-surface); stroke-width: .16; }
.w-git-sim-node.is-main .w-git-sim-dot, .w-git-sim-node.is-main .w-git-sim-core { fill: var(--c-primary); }
.w-git-sim-node.is-feature .w-git-sim-dot, .w-git-sim-node.is-feature .w-git-sim-core { fill: var(--c-purple); }
.w-git-sim-ring { fill: var(--c-surface); stroke-width: .2; stroke: var(--c-primary); }
.w-git-sim-node.is-feature .w-git-sim-ring { stroke: var(--c-purple); }
.w-git-sim-halo { stroke-width: .12; }
.w-git-sim-halo.is-main { fill: var(--c-primary-soft); stroke: var(--c-primary); }
.w-git-sim-halo.is-feature { fill: var(--c-purple-soft); stroke: var(--c-purple); }
.w-git-sim-node.is-new circle { transform-box: fill-box; transform-origin: center; animation: w-git-sim-pop .45s var(--ease) both; }

/* 完成橫幅 */
.w-git-sim-donewrap:empty { display: none; }
.w-git-sim-done {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: .8em;
  padding: .8em 1em; border-radius: var(--radius);
  background: var(--c-gold-soft); border: 2px solid var(--c-gold); color: #8a6200;
  animation: w-git-sim-bannerin .5s var(--ease) both;
}
.w-git-sim-trophy { flex: none; width: 2.6em; height: 2.6em; }
.w-git-sim-done-text { display: grid; gap: .1em; min-width: 0; }
.w-git-sim-done-text strong { font-size: 1.12em; }
.w-git-sim-done-text span { font-weight: 700; font-size: .9em; line-height: 1.5; }
.w-git-sim-confetti { position: absolute; inset: 0; pointer-events: none; }
.w-git-sim-confetti i {
  position: absolute; left: 50%; top: 50%; width: .55em; height: .9em; border-radius: 3px;
  background: var(--w-git-sim-c, var(--c-gold)); opacity: 0;
  animation: w-git-sim-confetti 1.5s cubic-bezier(.15, .7, .3, 1) both;
}

/* 終端機 */
.w-git-sim-termbox { border-radius: var(--radius); overflow: hidden; background: var(--c-code-bg); border: 2px solid #151a24; }
.w-git-sim-termhead {
  display: flex; align-items: center; gap: .4em; padding: .45em .8em;
  background: #2a3141; color: #aab3c5; font-size: .78em; font-weight: 800; letter-spacing: .06em;
}
.w-git-sim-termhead i { display: inline-block; width: .8em; height: .8em; border-radius: 50%; background: #ff5f57; }
.w-git-sim-termhead i:nth-child(2) { background: #febc2e; }
.w-git-sim-termhead i:nth-child(3) { background: #28c840; margin-right: .4em; }
.w-git-sim-term {
  /* 捲動區本身不留內距（用 margin），高度剛好 6 行 → 捲到最底時最上面不會切到半行 */
  max-height: 9.6em; overflow-y: auto; margin: .6em .85em .7em; padding: 0;
  font-family: var(--mono); font-size: .82em; line-height: 1.6; color: var(--c-code-text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.w-git-sim-tl.is-cmd { color: #fff; font-weight: 700; }
.w-git-sim-prompt { color: var(--c-primary); }
.w-git-sim-tl.is-out { color: #c3cad8; }
.w-git-sim-tl.is-note { color: #8792a8; }
.w-git-sim-tl.is-err { color: #ff8f8f; font-weight: 700; }

/* 情境切換（第四輪）：自由練習／分岔／衝突 */
.w-git-sim-scenes { display: flex; flex-wrap: wrap; align-items: center; gap: .45em; }
.w-git-sim-scenes .w-git-sim-label { margin-right: .1em; }
.w-git-sim-scene { white-space: nowrap; }
.w-git-sim-scene.is-on { --b-bg: var(--c-primary-soft); --b-fg: var(--c-primary-dark); --b-border: var(--c-primary); --b-edge: var(--c-primary-dark); }
.w-git-sim-narrow .w-git-sim-scene { flex: 1 1 auto; padding-left: .55em; padding-right: .55em; }

/* 衝突：工作區的 both modified 檔案、HEAD 標籤的 MERGING */
.w-git-sim-file.is-conflict { background: var(--c-red-soft); border-color: var(--c-red); flex-wrap: wrap; }
.w-git-sim-file.is-conflict .w-git-sim-ftag { background: var(--c-red-dark); white-space: normal; }
.w-git-sim-file.is-conflict.is-picked { background: var(--c-primary-soft); border-color: var(--c-primary); }
.w-git-sim-file.is-conflict.is-picked .w-git-sim-ftag { background: var(--c-primary-dark); }
.w-git-sim-headbadge.is-merging { background: var(--c-red-dark); }

/* 解衝突面板（類 VS Code：目前＝綠、傳入＝藍） */
.w-git-sim-conflict {
  display: grid; gap: .55em; min-width: 0; padding: .7em .85em .8em;
  border: 2px solid var(--c-red); border-radius: var(--radius); background: var(--c-surface);
  animation: w-git-sim-slide .25s var(--ease);
}
.w-git-sim-conflict .w-git-sim-ask { margin: 0; }
.w-git-sim-cf-head { display: flex; align-items: center; flex-wrap: wrap; gap: .3em .6em; }
.w-git-sim-cf-title { font-weight: 800; color: var(--c-red-dark); overflow-wrap: anywhere; }
.w-git-sim-cf-tag { background: var(--c-surface-2); color: var(--c-muted); font-size: .75em; }
.w-git-sim-cf-picks { display: flex; flex-wrap: wrap; gap: .45em; }
.w-git-sim-cf-pick { flex: 1 1 9em; flex-direction: column; gap: 0; line-height: 1.25; white-space: normal; }
.w-git-sim-cf-en { font-family: var(--mono); font-size: .78em; font-weight: 700; opacity: .8; }
.w-git-sim-cf-pick.is-current { --b-fg: var(--c-primary-dark); }
.w-git-sim-cf-pick.is-incoming { --b-fg: var(--c-blue-dark); }
.w-git-sim-cf-pick.is-both { --b-fg: var(--c-purple-dark); }
.w-git-sim-cf-pick.is-on { --b-bg: var(--c-gold-soft); --b-border: var(--c-gold-dark); --b-edge: var(--c-gold-dark); }
.w-git-sim-code {
  min-width: 0; overflow-x: auto; padding: .45em 0; border-radius: var(--radius-sm);
  background: var(--c-code-bg); font-family: var(--mono); font-size: .82em; line-height: 1.6; color: var(--c-code-text);
}
.w-git-sim-cl { display: flex; align-items: baseline; gap: .7em; padding: 0 .8em 0 0; white-space: pre; min-width: max-content; }
.w-git-sim-ln { flex: none; width: 2.2em; text-align: right; color: #6b7488; user-select: none; }
.w-git-sim-cnote { font-family: var(--font, inherit); font-size: .85em; font-weight: 800; opacity: .85; }
.w-git-sim-cl.is-mark { color: #ffd479; font-weight: 800; }
.w-git-sim-cl.is-mark.is-cur { background: rgba(38, 194, 129, .32); }
.w-git-sim-cl.is-mark.is-inc { background: rgba(31, 157, 224, .34); }
.w-git-sim-cl.is-cur { background: rgba(38, 194, 129, .16); }
.w-git-sim-cl.is-inc { background: rgba(31, 157, 224, .18); }
.w-git-sim-cl.is-kept { box-shadow: inset .25em 0 0 var(--c-gold); }
.w-git-sim-cf-state { margin: 0; font-size: .88em; font-weight: 800; line-height: 1.5; overflow-wrap: anywhere; }
.w-git-sim-cf-state.is-warn { color: var(--c-red-dark); }
.w-git-sim-cf-state.is-ok { color: var(--c-primary-dark); }
.w-git-sim-abort { justify-self: start; color: var(--c-muted); white-space: normal; text-align: left; }
.w-git-sim-abort { flex-wrap: wrap; row-gap: 0; }
.w-git-sim-abort .w-git-sim-mono { white-space: nowrap; }

/* 歷史圖：合併點按鈕、parent 標示、合併中的虛線點 */
.w-git-sim-inspect {
  font: inherit; font-size: .9em; font-weight: 800; line-height: 1.4; cursor: pointer;
  border: 2px solid var(--c-purple); flex: none; white-space: nowrap;
}
.w-git-sim-inspect:hover { filter: brightness(1.04); }
.w-git-sim-inspect.is-on { background: var(--c-purple); color: #fff; }
.w-git-sim-inspect.is-suggest { box-shadow: 0 0 0 .2em var(--c-gold); animation: w-git-sim-pulse 1.8s ease-in-out infinite; }
.w-git-sim-narrow .w-git-sim-mergetag.w-git-sim-inspect { display: inline-flex; }
.w-git-sim-msgline:has(.w-git-sim-inspect) { overflow: visible; }
.w-git-sim-pendtag { flex: none; line-height: 1.4; background: var(--c-red-soft); color: var(--c-red-dark); }
.w-git-sim-parenttag { flex: none; line-height: 1.4; background: var(--c-gold-soft); color: #8a6200; font-size: .85em; }
.w-git-sim-row.is-parent { background: linear-gradient(90deg, transparent, var(--c-gold-soft) 30%); }
.w-git-sim-row.is-pending .w-git-sim-msg { color: var(--c-red-dark); font-style: italic; }
.w-git-sim-edge.is-pending { stroke: var(--c-red); stroke-dasharray: .3 .25; opacity: .8; }
.w-git-sim-pend { fill: var(--c-surface); stroke: var(--c-red); stroke-width: .16; stroke-dasharray: .28 .2; }
.w-git-sim-pring { fill: none; stroke: var(--c-gold-dark); stroke-width: .14; }

/* 動畫（base 狀態＝最終狀態；關掉動畫也不會看不到東西） */
@keyframes w-git-sim-pop { 0% { transform: scale(.55); opacity: .3; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes w-git-sim-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(31, 157, 224, .45); } 50% { box-shadow: 0 0 0 .4em rgba(31, 157, 224, 0); } }
@keyframes w-git-sim-glow {
  0%, 100% { box-shadow: 0 var(--w-git-sim-edge) 0 var(--b-edge), 0 0 0 .2em rgba(255, 197, 61, .95); }
  50% { box-shadow: 0 var(--w-git-sim-edge) 0 var(--b-edge), 0 0 0 .4em rgba(255, 197, 61, .3); }
}
@keyframes w-git-sim-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes w-git-sim-rowin { from { opacity: 0; transform: translateY(-.35em); } to { opacity: 1; transform: none; } }
@keyframes w-git-sim-slide { from { opacity: 0; transform: translateY(-.3em); } to { opacity: 1; transform: none; } }
@keyframes w-git-sim-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-.28em); } 40% { transform: translateX(.28em); } 60% { transform: translateX(-.18em); } 80% { transform: translateX(.12em); } }
@keyframes w-git-sim-bannerin { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes w-git-sim-confetti {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(.6); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--w-git-sim-x, 0em)), calc(-50% + var(--w-git-sim-y, 0em))) rotate(var(--w-git-sim-r, 180deg)) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .w-git-sim *, .w-git-sim *::before, .w-git-sim *::after { animation: none !important; transition: none !important; }
  .w-git-sim-confetti { display: none; }
}
