/* 길찾기 — 영상의 "매트릭스 터미널" 스킨. 전부 .exp-pf 아래로 범위를 좁힘. */
.exp-pf { --pf-line: #00ff41; --pf-line2: #0b6b2a; --pf-panel: #03110a; --pf-dim: #6fc287; --pf-gold: #ffd23f; --pf-cyan: #46c6ff; --pf-red: #ee5d4b; --pf-ink: #04100a; }
.exp-pf .lab { display: grid; grid-template-columns: 960px 340px; gap: 20px; align-items: start; }
.exp-pf .lab-main { min-width: 0; }
.exp-pf .stage-box { position: relative; width: 960px; height: 540px; box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--pf-line2), 0 0 24px rgba(0,255,65,.18); }
.exp-pf canvas#stage { width: 960px; height: 540px; image-rendering: pixelated; display: block; touch-action: none; cursor: crosshair; }
.exp-pf canvas#stage:focus-visible { outline: 3px solid var(--pf-cyan); outline-offset: 3px; }

/* 글자는 화면에서 11px 아래로 내려가지 않게: 축소 배율(--k)을 거꾸로 곱해 키운다 */
.exp-pf .chips { position: absolute; inset: 0; pointer-events: none; }
.exp-pf .chip { position: absolute; font-weight: 700; font-size: max(15px, calc(11.5px / var(--k, 1))); color: var(--text); background: rgba(3,17,10,.92); border: 3px solid var(--pf-line); box-shadow: 4px 4px 0 var(--pf-line2); padding: 3px 10px; white-space: nowrap; line-height: 1.2; }
.exp-pf .chip.hi { border-color: var(--pf-gold); color: var(--pf-gold); }
.exp-pf .chip.small { font-size: max(12px, calc(11.5px / var(--k, 1))); padding: 2px 8px; }
.exp-pf #c-model { left: 14px; top: 12px; }
.exp-pf #c-swamp { left: 14px; top: 44px; }
.exp-pf #c-alg { right: 14px; top: 12px; }
.exp-pf .caption { position: absolute; left: 60px; right: 60px; bottom: 14px; text-align: center; font-weight: 700; font-size: max(24px, calc(11.5px / var(--k, 1))); line-height: 1.35; padding: 8px 16px; background: rgba(0,10,4,.78); border: 3px solid var(--pf-line); text-shadow: 2px 2px 0 #000; min-height: 74px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.exp-pf .caption b { color: var(--pf-gold); }
.exp-pf .title-card { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; background: rgba(2,7,3,.55); animation: pfTitleOut .4s steps(4) 2.4s forwards; }
.exp-pf .title-card div { font-weight: 700; font-size: 56px; line-height: 1.25; text-shadow: 5px 5px 0 #000, 0 0 24px rgba(0,0,0,.7); animation: pfTitleIn .5s steps(5) both; }
.exp-pf .title-card em { font-style: normal; color: var(--pf-gold); }
@keyframes pfTitleIn { from { transform: scale(1.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pfTitleOut { to { opacity: 0; visibility: hidden; } }

.exp-pf .board { background: var(--pf-panel); border: 4px solid var(--pf-line); box-shadow: inset 0 0 0 4px var(--pf-panel), inset 0 0 0 6px var(--pf-line2), 4px 4px 0 #000; padding: 14px 16px; }
.exp-pf .panel { display: grid; gap: 14px; min-width: 0; }
.exp-pf .panel h2 { margin: 0 0 8px; font-size: 15px; color: var(--pf-gold); }
.exp-pf .help { font-family: var(--read); font-size: 13px; color: var(--pf-dim); margin: 6px 0 0; line-height: 1.5; }
.exp-pf .dim { color: var(--pf-dim); font-weight: 400; }
.exp-pf .seg { display: flex; gap: 6px; flex-wrap: wrap; }
.exp-pf .seg button, .exp-pf .presets button { font: 700 13px "Galmuri11", sans-serif; color: var(--text); background: #06180c; border: 2px solid var(--pf-line2); padding: 6px 9px; min-height: 40px; cursor: pointer; flex: 1 1 auto; }
.exp-pf .seg button[aria-pressed=true], .exp-pf .presets button[aria-pressed=true] { color: var(--pf-ink); background: var(--pf-gold); border-color: #8a7410; }
.exp-pf button:focus-visible, .exp-pf input:focus-visible, .exp-pf select:focus-visible { outline: 3px solid var(--pf-cyan); outline-offset: 2px; }
.exp-pf .sw { display: inline-block; width: 11px; height: 11px; margin-right: 5px; vertical-align: -1px; border: 1px solid #000; }
.exp-pf .sw.wall { background: #0b3d1c; box-shadow: inset 0 2px 0 #00ff41; } .exp-pf .sw.swamp { background: #493a1d; } .exp-pf .sw.erase { background: #0e1f15; }
.exp-pf .param { margin-top: 12px; }
.exp-pf .param .head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.exp-pf .param label { font-size: 14px; font-weight: 700; }
.exp-pf .param .val { display: flex; align-items: center; gap: 3px; }
.exp-pf .param input[type=number] { width: 80px; height: 36px; font: 700 15px "Galmuri11", sans-serif; text-align: right; color: var(--pf-gold); background: #010a04; border: 2px solid var(--pf-line2); padding: 0 6px; }
.exp-pf .param .unit { color: var(--pf-gold); font-weight: 700; font-size: 13px; }
.exp-pf .param input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; cursor: pointer; margin: 2px 0; }
.exp-pf .param input[type=range]::-webkit-slider-runnable-track { height: 10px; background: #010a04; border: 2px solid var(--pf-line2); }
.exp-pf .param input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 26px; margin-top: -10px; background: var(--pf-gold); border: 3px solid #4a3810; box-shadow: 2px 2px 0 #000; }
.exp-pf .param input[type=range]::-moz-range-track { height: 10px; background: #010a04; border: 2px solid var(--pf-line2); }
.exp-pf .param input[type=range]::-moz-range-thumb { width: 16px; height: 22px; background: var(--pf-gold); border: 3px solid #4a3810; border-radius: 0; }
.exp-pf .presets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.exp-pf .presets button { padding: 4px 7px; min-height: 36px; font-size: 13px; }
.exp-pf .presets button small { font-size: 11px; opacity: .85; }
.exp-pf select { font: 700 14px "Galmuri11", sans-serif; color: var(--text); background: #010a04; border: 2px solid var(--pf-line2); padding: 6px; width: 100%; min-height: 40px; }
.exp-pf .chk { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 12px; cursor: pointer; min-height: 32px; }
.exp-pf .chk input { width: 20px; height: 20px; accent-color: #ee5d4b; }
.exp-pf .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.exp-pf .b-play .btns { margin-top: 0; }
.exp-pf button.chipbtn { cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--text); background: var(--pf-panel); border: 3px solid var(--pf-line); box-shadow: 4px 4px 0 var(--pf-line2); padding: 8px; min-height: 44px; }
.exp-pf button.chipbtn.go { color: var(--pf-ink); background: var(--pf-gold); border-color: #8a7410; box-shadow: 4px 4px 0 #4a3810; }
.exp-pf button.chipbtn.wide { grid-column: 1 / -1; }
.exp-pf button.chipbtn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--pf-line2); }

.exp-pf .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.exp-pf .stat { padding: 10px 14px; } .exp-pf .stat.off { opacity: .45; }
.exp-pf .stat h3 { margin: 0 0 6px; font-size: 14px; color: var(--pf-gold); display: flex; justify-content: space-between; }
.exp-pf .stat h3 small { font-size: 11px; color: var(--pf-dim); }
.exp-pf .stat .row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--pf-dim); gap: 8px; padding: 2px 0; }
.exp-pf .stat .row b { font-size: 22px; color: var(--text); font-weight: 700; }
.exp-pf .stat .row small { font-size: 11px; }
.exp-pf .stat.sline h3 { color: var(--pf-red); }
.exp-pf .diff { grid-column: 1 / -1; font-size: 14px; text-align: center; color: var(--pf-dim); min-height: 20px; }
.exp-pf .diff b { color: var(--pf-gold); }

@media (max-width: 1340px) {
  .exp-pf .lab { grid-template-columns: minmax(0, 1fr); }
  .exp-pf .panel { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
  .exp-pf .stage-wrap { width: 100%; max-width: 960px; aspect-ratio: 16 / 9; position: relative; }
  .exp-pf .stage-box { transform-origin: 0 0; transform: scale(var(--k, 1)); position: absolute; }
  .exp-pf .stats { max-width: 960px; }
}

/* 휴대폰: 가로 무대 대신 세로 비율 무대(540×800). 글자·칩은 무대 밖(아래)으로 뺀다. */
@media (max-width: 700px) {
  .exp-pf .lab { gap: 14px; }
  .exp-pf .lab-main, .exp-pf .panel { display: contents; }
  .exp-pf .stage-wrap { order: 1; aspect-ratio: auto; max-width: none; position: static; }
  .exp-pf .b-play { order: 2; } .exp-pf .stats { order: 3; margin-top: 0; max-width: none; grid-template-columns: 1fr 1fr; gap: 10px; }
  .exp-pf .b-tools { order: 4; } .exp-pf .b-alg { order: 5; } .exp-pf .b-size { order: 6; }
  .exp-pf .stage-box { position: relative; width: 100%; height: auto; transform: none; display: flex; flex-direction: column; gap: 8px; box-shadow: none; }
  .exp-pf canvas#stage { width: 100%; height: auto; aspect-ratio: 540 / 800; box-shadow: 0 0 0 3px #000, 0 0 0 5px var(--pf-line2); }
  .exp-pf .chips { position: static; order: -1; display: flex; flex-wrap: wrap; gap: 6px; }
  .exp-pf .chip, .exp-pf .chip.small { position: static; font-size: 12px; box-shadow: 2px 2px 0 var(--pf-line2); border-width: 2px; padding: 3px 8px; }
  .exp-pf .caption { position: static; font-size: 15px; min-height: 0; padding: 8px 10px; border-width: 2px; order: 2; }
  .exp-pf .title-card { display: none; }
  .exp-pf .stat .row b { font-size: 18px; }
  .exp-pf .stat.sline { grid-column: 1 / -1; }
  .exp-pf .board { padding: 12px; }
  .exp-pf .panel h2 { font-size: 16px; }
  .exp-pf .seg button { min-height: 44px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .exp-pf .title-card { animation: none; display: none; } }
