/* Wuqingdao script mechanics: operation/interaction points, state toast, journal, settlement.
   Scoped to this project's player; water-jade / ink-green tokens from gameplay.css. */
.mechanic-legend{list-style:none;padding:0;margin:20px 0 0;display:grid;gap:6px;font-size:11px;color:var(--muted)}
.mechanic-legend b{display:inline-block;min-width:74px;color:var(--paper);font-weight:500}

/* ---- overlay ---- */
.mech-overlay{pointer-events:auto;padding:18px 18px 16px;background:#0f201dee;border:1px solid var(--line);border-top:2px solid var(--accent);text-align:center;animation:mech-in 200ms ease-out both}
.mech-overlay.is-ambient{align-self:center;width:min(250px,100%);padding:12px 14px;background:#0f201dcc;margin-bottom:6px}
.mech-overlay h2{font:500 21px/1.4 "SimSun",serif;margin:2px 0 6px}
.mech-overlay.is-ambient h2{font-size:16px;margin:0 0 2px}
.mech-prompt{font-size:12px;line-height:1.7;color:var(--muted);margin:0 0 14px}
.mech-overlay.is-ambient .mech-prompt{margin-bottom:8px}
.mech-attempts{color:var(--muted);letter-spacing:.4px}
.mech-play{display:flex;flex-direction:column;align-items:center;gap:12px;position:relative}
.mech-feedback{min-height:20px;margin:10px 0 0;font-size:12px;color:var(--paper)}
.mech-feedback[data-kind="fail"]{color:#e4a59c}
.mech-feedback[data-kind="success"]{color:var(--accent)}
.mech-actions{display:flex;justify-content:flex-end;margin-top:4px}
.mech-skip{min-height:44px;min-width:56px;background:none;border:0;color:var(--muted);font-size:12px}
.mech-overlay[data-state="fail"]{animation:mech-shake 260ms ease-out}
.mech-overlay button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.mech-button{min-height:48px;min-width:120px;padding:10px 18px;border:1px solid #a8c8c177;border-radius:0;background:#0c1716;color:var(--paper);font-size:13px;font-weight:500;touch-action:none;user-select:none;-webkit-user-select:none;transition:border-color 160ms,background 160ms}
.mech-button:active,.mech-button.is-hit{background:#254036;border-color:var(--accent)}
.mech-round{width:92px;height:92px;min-width:0;border-radius:50%;padding:0;font:500 15px "SimSun",serif}
.mech-hold{background:conic-gradient(var(--accent) calc(var(--fill,0)*360deg),#0c1716 0);box-shadow:inset 0 0 0 5px #0c1716}
.mech-overlay.is-ambient .mech-round{width:64px;height:64px;font-size:13px}

/* rhythm beat ring */
.mech-beat{position:absolute;top:50%;left:50%;width:64px;height:64px;margin:-32px 0 0 -32px;border:1px solid var(--accent);border-radius:50%;opacity:0;pointer-events:none}
.mech-beat.is-pulse{animation:mech-beat 520ms ease-out}

/* swipe track */
.mech-track{position:relative;width:min(240px,100%);height:52px;border:1px solid var(--line);background:linear-gradient(90deg,#a8c8c114,#a8c8c133);touch-action:none;cursor:grab}
.mech-track.is-up{width:64px;height:120px;background:linear-gradient(0deg,#a8c8c114,#a8c8c133)}
.mech-thumb{position:absolute;width:40px;height:40px;top:5px;left:calc(5px + var(--p,0)*(100% - 52px));background:var(--accent);opacity:.85;transition:left 160ms,right 160ms,bottom 160ms}
.mech-track.is-left .mech-thumb{left:auto;right:calc(5px + var(--p,0)*(100% - 52px))}
.mech-track.is-up .mech-thumb{top:auto;left:11px;bottom:calc(5px + var(--p,0)*(100% - 52px))}
.mech-swipe-key{min-height:44px;min-width:96px;font-size:12px}
.mech-dots{display:flex;gap:8px}
.mech-dots i{width:14px;height:14px;border-radius:50%;border:1px solid var(--accent)}
.mech-dots i.is-on{background:var(--accent)}
.mech-overlay[data-mech-id="I05"],.mech-overlay[data-mech-id="I15"]{background:linear-gradient(#0f201dee,#0f201dee),radial-gradient(circle,#a8c8c155 calc(var(--reveal,0)*100%),transparent 0)}

/* pick / react grid */
.mech-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;width:100%}
.mech-grid.is-5{grid-template-columns:repeat(5,1fr);gap:6px}
.mech-grid.is-three{grid-template-columns:repeat(3,1fr);gap:8px}
.mech-option{position:relative;min-height:48px;padding:10px 6px;border:1px solid #a8c8c166;border-radius:0;background:#0c1716ed;color:var(--paper);font-size:13px;font-weight:500;line-height:1.35}
.mech-option small{position:absolute;top:3px;left:5px;font-size:9px;color:var(--muted)}
.mech-option:hover:not(:disabled){border-color:var(--accent);background:#1a302a}
.mech-option.is-right{border-color:var(--accent);background:#254036}
.mech-option.is-wrong{border-color:#9d534b;color:#e4a59c;text-decoration:line-through}
.mech-option:disabled{opacity:1;cursor:default}

/* mash meter / react timer */
.mech-meter{width:min(240px,100%);height:4px;background:#a8c8c133;overflow:hidden}
.mech-meter i{display:block;height:100%;background:var(--accent);transform-origin:left;transform:scaleX(var(--p,0));transition:transform 90ms}
.mech-meter.is-timer i{transform:scaleX(1);background:#c3ae7d}
.mech-meter.is-timer.is-running i{animation:mech-timer var(--ms,2000ms) linear forwards}

/* meridian */
.mech-meridian{position:relative;width:110px;height:190px}
.mech-meridian svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.mech-meridian path{fill:none;stroke:#a8c8c155;stroke-width:2;vector-effect:non-scaling-stroke}
.mech-acu,.mech-qi{position:absolute;border-radius:50%;transform:translate(-50%,-50%)}
.mech-acu{width:20px;height:20px;border:1px solid #c3ae7d}
.mech-acu.is-open{background:#c3ae7d55;box-shadow:0 0 0 6px #c3ae7d33}
.mech-acu.is-locked{background:#c3ae7d;border-color:#c3ae7d}
.mech-qi{width:12px;height:12px;background:var(--accent);box-shadow:0 0 10px var(--accent)}

/* ---- state toast (visible state only: 道基 / 行囊) ---- */
.state-toast{position:absolute;z-index:6;top:calc(var(--hud-top-height) + 10px);left:50%;transform:translateX(-50%);display:flex;gap:8px;pointer-events:none;animation:mech-toast 3200ms ease both}
.state-toast span{padding:6px 12px;font-size:12px;background:#0c1716e6;border:1px solid var(--line);white-space:nowrap}
.state-toast [data-kind="gain"]{color:var(--accent)}
.state-toast [data-kind="loss"]{color:#e4a59c;border-color:#9d534b88}

/* ---- journal ---- */
#journalBody{max-height:62dvh;overflow:auto;scrollbar-width:thin}
.journal-block{padding:12px 0;border-bottom:1px solid #a8c8c11f}
.journal-block h3{font-size:12px;font-weight:600;letter-spacing:.6px;color:var(--accent);margin:0 0 8px}
.journal-block h3 small{color:var(--muted);font-weight:400;margin-left:6px}
.daoji-meter{height:6px;background:#a8c8c126}
.daoji-meter i{display:block;height:100%;background:linear-gradient(90deg,#9d534b,var(--accent) 60%);transform-origin:left;transform:scaleX(var(--p,1))}
.journal-value{font-size:12px;color:var(--paper);margin:6px 0 0}
.item-list{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:1fr 1fr;gap:6px}
.item-list li{padding:8px;border:1px dashed #a8c8c133;color:var(--muted)}
.item-list li.is-owned{border-style:solid;border-color:#c3ae7d88;color:var(--paper)}
.item-list b{display:block;font-size:13px;font-weight:500}
.item-list small{display:block;font-size:10px;margin-top:3px;color:var(--muted)}
.journal-list{list-style:none;margin:0;padding:0;display:grid;gap:6px;font-size:12px}
.journal-list span{display:inline-block;min-width:52px;color:var(--muted)}
.journal-list em{font-style:normal;float:right;color:var(--accent);font-size:11px}
.journal-empty,.journal-note{font-size:11px;color:var(--muted);margin:0}
.journal-note{padding-top:10px}
#resetRun{min-height:44px;background:none;border:1px solid #9d534b88;color:#e4a59c;padding:8px 14px;font-size:12px}

/* ---- settlement on the final available episode ---- */
.settlement{margin:-4px 0 18px;padding:12px;border:1px solid #c3ae7d66;background:#0c1716}
.settlement h3{font:500 18px "SimSun",serif;margin:2px 0 6px;color:#e6d5a8}
.settlement p{font-size:12px;line-height:1.8;margin:0}
.settlement .settlement-egg{color:#e4a59c}
.settlement dl{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin:10px 0 8px}
.settlement dl div{border:1px solid var(--line);padding:4px 0}
.settlement dt{font-size:10px;color:var(--muted)}
.settlement dd{margin:0;font-size:15px}
.settlement small{font-size:10px;color:var(--muted)}

@keyframes mech-in{from{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}
@keyframes mech-shake{25%{transform:translateX(-2px)}75%{transform:translateX(2px)}}
@keyframes mech-beat{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(1.7)}}
@keyframes mech-timer{to{transform:scaleX(0)}}
@keyframes mech-toast{0%{opacity:0}8%,85%{opacity:1}100%{opacity:0}}
@media(max-width:680px){.mech-overlay{padding:14px 12px}.mech-round{width:80px;height:80px}.mech-grid.is-5 .mech-option{font-size:12px;padding-inline:2px}}
@media(prefers-reduced-motion:reduce){.mech-overlay,.mech-overlay[data-state="fail"],.mech-beat.is-pulse{animation:none}.mech-beat.is-pulse{opacity:.6}.mech-thumb{transition:none}.state-toast{animation:none}}
.mech-overlay h2:focus{outline:none}
