/* P&ID 识图闯关 */
.pg-shell { padding: 26px clamp(20px, 4vw, 60px) 40px; }

/* 关卡选择 */
.pg-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 18px; }
.pg-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; }
.pg-tab:hover { border-color: var(--orange); transform: translateY(-1px); }
.pg-tab.active { border-color: var(--orange); box-shadow: 0 6px 18px rgba(255, 106, 42, .12); }
.pg-tab.locked { opacity: .45; cursor: not-allowed; }
.pg-tab.locked:hover { border-color: var(--line); transform: none; }
.pg-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; }
.pg-tab span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pg-tab b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-tab small { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-stars { position: absolute; top: 6px; right: 10px; font-style: normal; font-size: 9px; color: var(--orange); letter-spacing: 1px; }

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

/* 图区 */
.pg-canvas { position: relative; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; aspect-ratio: 1000 / 620; background:
  radial-gradient(120% 90% at 50% 0%, rgba(124, 167, 216, .06), transparent 60%),
  repeating-linear-gradient(0deg, transparent 0 27px, rgba(102, 115, 111, .10) 27px 28px),
  repeating-linear-gradient(90deg, transparent 0 27px, rgba(102, 115, 111, .10) 27px 28px),
  var(--paper); }
.pg-svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* SVG 图元 */
.pg-svg text { fill: var(--ink); font-family: inherit; }
.pg-inst circle { fill: var(--surface); stroke: var(--ink); stroke-width: 2.4; }
.pg-inst rect { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.pg-mid { stroke: var(--ink); stroke-width: 1.5; }
.pg-l { font-size: 14px; font-weight: 700; text-anchor: middle; }
.pg-n { font-size: 12px; font-weight: 600; text-anchor: middle; font-family: ui-monospace, monospace; }
.pg-line { fill: none; }
.pg-line.process { stroke: var(--blue); stroke-width: 4; }
.pg-line.impulse { stroke: var(--blue); stroke-width: 1.6; }
.pg-line.signal { stroke: var(--orange); stroke-width: 2; stroke-dasharray: 7 6; }
.pg-equip path { fill: rgba(124, 167, 216, .10); stroke: var(--blue); stroke-width: 2.5; }
.pg-eq { font-size: 15px; font-weight: 700; text-anchor: middle; fill: var(--blue); font-family: ui-monospace, monospace; }
.pg-valve path { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.pg-valve line { stroke: var(--ink); stroke-width: 2; }
.pg-valve circle { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.pg-valve polyline { fill: none; stroke: var(--ink); stroke-width: 2; }
.pg-pump circle { fill: var(--surface); stroke: var(--ink); stroke-width: 2.5; }
.pg-pump path { fill: var(--ink); }
.pg-tag { font-size: 11px; font-weight: 600; text-anchor: middle; fill: var(--muted); font-family: ui-monospace, monospace; }
.pg-txt { font-size: 12px; fill: var(--muted); }

/* 可点热点 */
.pg-spot { position: absolute; width: 48px; height: 48px; transform: translate(-50%, -50%); border-radius: 50%; border: 2px dashed transparent; background: transparent; cursor: pointer; z-index: 5; padding: 0; display: grid; place-items: center; transition: border-color .15s, background .15s; }
.pg-spot:hover, .pg-spot:focus-visible { border-color: rgba(255, 106, 42, .55); background: rgba(255, 106, 42, .08); }
.pg-spot-line { width: 64px; height: 40px; border-radius: 12px; }
.pg-spot.found { border: 2px solid var(--mint); background: rgba(139, 212, 177, .14); cursor: default; }
.pg-spot.found i { font-style: normal; font-size: 16px; font-weight: 700; color: var(--mint); }
.pg-spot.wrong { animation: pg-shake .5s ease; border: 2px solid #ff5f56; background: rgba(255, 95, 86, .14); }
.pg-spot.pg-flash { animation: pg-flash .9s ease-in-out 2; }
@keyframes pg-shake { 25% { transform: translate(-54%, -50%); } 75% { transform: translate(-46%, -50%); } }
@keyframes pg-flash { 50% { border-color: var(--orange); background: rgba(255, 106, 42, .18); box-shadow: 0 0 0 8px rgba(255, 106, 42, .15); } }

/* 工具栏 */
.pg-toolbar { display: flex; gap: 10px; padding-top: 12px; }
.pg-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; }
.pg-btn:hover { border-color: var(--orange); transform: translateY(-1px); }
.pg-btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.pg-btn.primary:hover { background: var(--orange-deep); }
.pg-btn.ghost { background: transparent; }

/* 侧栏 */
.pg-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pg-brief { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: var(--surface); }
.pg-mode-chip { display: inline-flex; align-items: center; margin-left: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(113, 211, 44, .14); color: #4c9c22; font-size: 10px; font-weight: 800; letter-spacing: .2px; vertical-align: 2px; }
.pg-brief h3 { margin: 6px 0 8px; font-size: 19px; }
.pg-brief p { margin: 0; font-size: 12px; line-height: 1.7; }
.pg-points { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--line); list-style: none; display: flex; flex-direction: column; gap: 9px; }
.pg-points li { font-size: 11px; line-height: 1.65; color: var(--muted); padding-left: 16px; position: relative; }
.pg-points li::before { content: '▸'; position: absolute; left: 0; color: var(--orange); }

/* 当前任务 */
.pg-task { border: 1px solid var(--orange); border-radius: 16px; padding: 16px 18px; background: rgba(255, 106, 42, .07); }
.pg-task-meta { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-bottom: 8px; font-family: ui-monospace, monospace; }
.pg-task b { font-size: 15px; line-height: 1.55; }

/* 反馈 */
.pg-feedback { border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; background: var(--paper); min-height: 120px; font-size: 12px; }
.pg-fb-empty { margin: 6px 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.pg-fb-head { margin-bottom: 8px; }
.pg-fb-head.ok b { color: var(--mint); font-size: 14px; }
.pg-fb-head.err b { color: #ff8f84; font-size: 14px; }
.pg-fb-why { margin: 0 0 10px; line-height: 1.7; font-size: 12px; }
.pg-fb-more { margin: 0; font-size: 11px; color: var(--muted); }

/* 过关弹层 */
.pg-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; }
.pg-pass[hidden] { display: none; }
.pg-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); }
.pg-pass-card h3 { margin: 8px 0 4px; font-size: 24px; }
.pg-pass-stars { font-size: 30px; color: var(--orange); letter-spacing: 6px; margin: 10px 0; }
.pg-pass-meta { display: flex; justify-content: center; gap: 16px; font-size: 11px; color: var(--muted); margin-bottom: 14px; }
.pg-pass-card p { font-size: 12px; line-height: 1.75; color: var(--muted); margin: 0 0 20px; }
.pg-pass-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* 轻提示 */
.pg-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; }
.pg-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 980px) {
  .pg-main { grid-template-columns: 1fr; }
  .pg-tabs { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .pg-spot { width: 40px; height: 40px; }
  .pg-spot-line { width: 52px; height: 34px; }
}
