/* 接线实训室 Wiring Lab */
.wl-shell { padding: 26px clamp(20px, 4vw, 60px) 40px; }

/* 关卡选择 */
.wl-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.wl-tab { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; text-align: left; transition: border-color .18s, transform .18s; position: relative; }
.wl-tab:hover { border-color: var(--orange); transform: translateY(-1px); }
.wl-tab.active { border-color: var(--orange); box-shadow: 0 6px 18px rgba(255, 106, 42, .12); }
.wl-tab.locked { opacity: .45; cursor: not-allowed; }
.wl-tab.locked:hover { border-color: var(--line); transform: none; }
.wl-tab i { font-style: normal; font-family: ui-monospace, monospace; font-size: 15px; font-weight: 700; color: var(--orange); border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; flex: none; }
.wl-tab span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wl-tab b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-tab small { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-stars { position: absolute; top: 6px; right: 10px; font-style: normal; font-size: 9px; color: var(--orange); letter-spacing: 1px; }

/* 主布局 */
.wl-main { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }

/* 画布 */
.wl-stage-wrap { min-width: 0; }
.wl-canvas { position: relative; min-height: 470px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(124, 167, 216, .07), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(102, 115, 111, .12) 27px 28px),
    repeating-linear-gradient(90deg, transparent 0 27px, rgba(102, 115, 111, .12) 27px 28px),
    var(--paper); }
.wl-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.wl-wire { fill: none; stroke-width: 3.5; stroke-linecap: round; pointer-events: stroke; cursor: pointer; transition: stroke-width .12s; touch-action: none; }
.wl-wire:hover { stroke-width: 5.5; }
.wl-wire.wl-selected { stroke-width: 6; filter: drop-shadow(0 0 6px rgba(255, 255, 255, .55)); }
.wl-wire.wl-tmp { stroke: var(--orange); stroke-dasharray: 7 6; opacity: .8; pointer-events: none; }
.wl-wire.wl-found { stroke-dasharray: 8 6; stroke-width: 4.5; }
.wl-wire.wl-live { stroke-dasharray: 12 9; animation: wl-dash 1.1s linear infinite; }
.wl-flash-wire { animation: wl-wire-flash .9s ease-in-out 2; stroke-width: 7 !important; }
@keyframes wl-dash { to { stroke-dashoffset: -21; } }
@keyframes wl-wire-flash { 50% { filter: drop-shadow(0 0 10px currentColor); } }

/* 危险区/安全区 */
.wl-zone { position: absolute; top: 0; bottom: 0; z-index: 0; pointer-events: none; }
.wl-zone span { position: absolute; top: 10px; left: 14px; font-size: 9px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.wl-zone.danger { background: rgba(124, 167, 216, .06); }
.wl-zone.danger span { color: var(--blue); }
.wl-zone.safe { background: rgba(139, 212, 177, .05); }
.wl-zone.safe span { color: var(--mint); }
.wl-zone-line { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--blue); opacity: .5; z-index: 1; pointer-events: none; }

/* 设备卡 */
.wl-comp { position: absolute; transform: translate(-50%, -50%); z-index: 3; width: clamp(118px, 13.5vw, 152px); background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 9px 12px 14px; box-shadow: 0 10px 26px rgba(13, 25, 29, .16); }
.wl-comp.wl-wide { width: clamp(150px, 17vw, 196px); }
.wl-comp header { display: flex; flex-direction: column; gap: 1px; text-align: center; }
.wl-comp header b { font-size: 12px; letter-spacing: .3px; }
.wl-comp header small { font-size: 9px; color: var(--muted); }
.wl-kind-psu { border-top: 3px solid #ff5f56; }
.wl-kind-tx { border-top: 3px solid var(--orange); }
.wl-kind-rtd { border-top: 3px solid #ff5f56; }
.wl-kind-ai { border-top: 3px solid var(--blue); }
.wl-kind-barrier { border-top: 3px solid #7cc7ff; }
.wl-kind-jb { border-top: 3px solid #b8d94a; width: clamp(104px, 11vw, 130px); }
.wl-kind-gndbar { border-top: 3px solid #b8d94a; width: clamp(104px, 11vw, 130px); }

/* 端子轨道与端子 */
.wl-rail { position: absolute; display: flex; gap: 16px; z-index: 4; }
.wl-rail-left { left: 0; top: 0; bottom: 0; flex-direction: column; justify-content: space-evenly; transform: translateX(-50%); }
.wl-rail-right { right: 0; top: 0; bottom: 0; flex-direction: column; justify-content: space-evenly; transform: translateX(50%); }
.wl-rail-bottom { bottom: 0; left: 0; right: 0; flex-direction: row; justify-content: space-evenly; transform: translateY(50%); }
.wl-term { position: relative; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--tc, var(--orange)); background: var(--paper); cursor: crosshair; padding: 0; flex: none; display: grid; place-items: center; transition: box-shadow .15s, transform .15s; touch-action: none; }
.wl-term i { width: 9px; height: 9px; border-radius: 50%; background: var(--tc, var(--orange)); pointer-events: none; }
.wl-term:hover { transform: scale(1.15); }
.wl-term.wl-pending { box-shadow: 0 0 0 5px rgba(255, 106, 42, .22), 0 0 14px var(--tc, var(--orange)); transform: scale(1.18); }
.wl-term.wl-flash { animation: wl-term-flash .9s ease-in-out 2; }
@keyframes wl-term-flash { 50% { box-shadow: 0 0 0 7px rgba(255, 106, 42, .3), 0 0 18px var(--orange); transform: scale(1.22); } }
.wl-term span { position: absolute; font-size: 10px; color: var(--muted); white-space: nowrap; pointer-events: none; font-family: ui-monospace, monospace; }
.wl-rail-left .wl-term span { left: 31px; }
.wl-rail-right .wl-term span { right: 31px; }
.wl-rail-bottom .wl-term span { bottom: 31px; left: 50%; transform: translateX(-50%); }

/* HUD 与工具栏 */
.wl-hud { display: flex; gap: 18px; align-items: center; padding: 0 4px 10px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.wl-hud b { color: var(--ink); font-family: ui-monospace, monospace; }
.wl-hud-goal { margin-left: auto; font-size: 10px; }
.wl-toolbar { display: flex; gap: 10px; padding-top: 12px; flex-wrap: wrap; }
.wl-btn { padding: 9px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 12px; cursor: pointer; transition: border-color .15s, transform .15s; }
.wl-btn:hover { border-color: var(--orange); transform: translateY(-1px); }
.wl-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.wl-btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.wl-btn.primary:hover { background: var(--orange-deep); }
.wl-btn.ghost { background: transparent; }

/* 侧栏 */
.wl-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.wl-brief { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: var(--surface); }
.wl-brief h3 { margin: 6px 0 8px; font-size: 19px; }
.wl-brief p { margin: 0; font-size: 12px; line-height: 1.7; color: var(--ink); }
.wl-note { display: block; margin-top: 8px; font-size: 10px; color: var(--blue); }
.wl-points { margin: 14px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--line); list-style: none; display: flex; flex-direction: column; gap: 9px; }
.wl-points li { font-size: 11px; line-height: 1.65; color: var(--muted); padding-left: 16px; position: relative; }
.wl-points li::before { content: '▸'; position: absolute; left: 0; color: var(--orange); }
.wl-hunt-count { margin-top: 14px; padding: 9px 12px; border: 1px dashed var(--orange); border-radius: 10px; font-size: 12px; }
.wl-hunt-count b { color: var(--orange); font-family: ui-monospace, monospace; }

/* 反馈面板 */
.wl-feedback { border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; background: var(--paper); min-height: 130px; font-size: 12px; }
.wl-fb-empty { margin: 6px 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.wl-fb-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.wl-fb-head b { color: #ff5f56; font-size: 14px; }
.wl-fb-head.found b { color: var(--mint); }
.wl-fb-head span { font-size: 10px; color: var(--muted); }
.wl-feedback ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.wl-feedback li { line-height: 1.6; font-size: 11.5px; }
.wl-feedback li.ok { color: var(--mint); }
.wl-feedback li.err { color: #ff8f84; }
.wl-feedback li.miss { color: var(--muted); }
.wl-fb-why { margin: 8px 0; line-height: 1.7; font-size: 12px; }
.wl-fb-more { margin: 0; font-size: 11px; color: var(--muted); }

/* 电流读数徽章 */
.wl-ma { position: absolute; transform: translate(-50%, 0); z-index: 5; padding: 6px 12px; border-radius: 999px; background: rgba(255, 106, 42, .14); border: 1px solid var(--orange); color: var(--orange); font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; animation: wl-ma-pop .5s ease-out; pointer-events: none; }
@keyframes wl-ma-pop { 0% { transform: translate(-50%, 8px); opacity: 0; } }

/* 过关弹层 */
.wl-pass { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(8, 16, 20, .62); backdrop-filter: blur(6px); padding: 20px; }
.wl-pass[hidden] { display: none; }
.wl-pass-card { max-width: 460px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px 28px; text-align: center; box-shadow: 0 30px 80px rgba(7, 23, 27, .4); }
.wl-pass-card h3 { margin: 8px 0 4px; font-size: 24px; }
.wl-pass-stars { font-size: 30px; color: var(--orange); letter-spacing: 6px; margin: 10px 0; }
.wl-pass-meta { display: flex; justify-content: center; gap: 16px; font-size: 11px; color: var(--muted); margin-bottom: 14px; }
.wl-pass-card p { font-size: 12px; line-height: 1.75; color: var(--muted); margin: 0 0 20px; }
.wl-pass-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* 轻提示 */
.wl-toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(12px); z-index: 95; background: var(--surface); border: 1px solid var(--orange); color: var(--ink); font-size: 12px; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 14px 34px rgba(7, 23, 27, .3); max-width: 82vw; text-align: center; }
.wl-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 980px) {
  .wl-main { grid-template-columns: 1fr; }
  .wl-canvas { min-height: 430px; }
  .wl-comp { width: clamp(96px, 24vw, 130px); padding: 7px 9px 12px; }
  .wl-comp.wl-wide { width: clamp(126px, 30vw, 160px); }
  .wl-comp header b { font-size: 10.5px; }
  .wl-comp header small { font-size: 8px; }
  .wl-term span { font-size: 8.5px; }
  .wl-hud-goal { display: none; }
  .wl-tabs { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
