/* 테세우스 쥐 — 영상(미로를 외운 쥐)의 도트 인포그래픽 스킨. 전부 .exp-th 아래로 범위를 좁힘. */
.exp-th { --th-bg: #0b1020; --th-chip: #141b30; --th-line: #24345c; --th-cyan: #46c6ff; --th-gold: #ffd23f; --th-sub: #8fa0c8; --th-red: #ff6b5b; --th-green: #5be3a0; --th-ink: #0b1020; }
.exp-th .lab { display: grid; grid-template-columns: 960px 340px; gap: 20px; align-items: start; }
.exp-th .lab-main { min-width: 0; }
.exp-th .stage-box { position: relative; width: 960px; height: 540px; box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--th-line), 6px 6px 0 6px #000; background: var(--th-bg); }
.exp-th canvas#stage { width: 960px; height: 540px; image-rendering: pixelated; display: block; touch-action: none; cursor: pointer; }
.exp-th canvas#stage:focus-visible { outline: 3px solid var(--th-cyan); outline-offset: 3px; }

/* 영상의 칩(모서리를 깎은 어두운 판). 화면에서 11px 아래로 내려가지 않게 축소 배율(--k)을 거꾸로 곱한다 */
.exp-th .chips { position: absolute; inset: 0; pointer-events: none; }
.exp-th .chip { position: absolute; font-weight: 700; font-size: max(17px, calc(11.5px / var(--k, 1))); color: var(--text); background: var(--th-chip); padding: 5px 13px; white-space: nowrap; line-height: 1.3;
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px); }
.exp-th .chip b { color: var(--th-gold); font-weight: 700; }
.exp-th .chip.small { font-size: max(13px, calc(11.5px / var(--k, 1))); color: var(--th-sub); padding: 3px 10px; }
.exp-th .chip.small b { font-size: inherit; }
.exp-th .chip.ok { color: var(--th-green); } .exp-th .chip.bad { color: var(--th-red); } .exp-th .chip.gold { background: var(--th-gold); color: var(--th-ink); }
.exp-th .chip.gold b { color: var(--th-ink); }
.exp-th #c-model { left: 14px; top: 12px; }
.exp-th #c-trial { left: 14px; top: 50px; }
.exp-th #c-count { left: 14px; top: 98px; }
.exp-th #c-mem { right: 14px; top: 12px; }
.exp-th #c-rule { right: 14px; top: 50px; max-width: 235px; white-space: normal; text-align: left; }
.exp-th .caption { position: absolute; left: 30px; right: 30px; bottom: 10px; text-align: center; font-weight: 700; font-size: max(22px, calc(11.5px / var(--k, 1))); line-height: 1.35; padding: 8px 16px; background: rgba(7,10,20,.82); border: 3px solid var(--th-line); text-shadow: 2px 2px 0 #000; min-height: 76px; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.exp-th .caption #cap { width: 100%; } .exp-th .caption b { color: var(--th-gold); }
.exp-th .caption .bad { color: var(--th-red); }

.exp-th .title-card { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; background: rgba(7,10,20,.6); animation: thTitleOut .4s steps(4) 2.6s forwards; }
.exp-th .title-card > div { display: grid; gap: 14px; justify-items: center; animation: thTitleIn .5s steps(5) both; }
.exp-th .title-card .row { display: flex; gap: 10px; }
.exp-th .title-card i { font-style: normal; font-weight: 700; font-size: 68px; width: 92px; height: 100px; display: grid; place-items: center; color: var(--text); background: var(--th-chip); text-shadow: 4px 4px 0 #000; border: 5px solid var(--th-cyan); }
.exp-th .title-card .r2 i { border-color: var(--th-gold); }
.exp-th .title-card .r2 i:nth-child(3) { visibility: hidden; width: 24px; }
@keyframes thTitleIn { from { transform: scale(1.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes thTitleOut { to { opacity: 0; visibility: hidden; } }

.exp-th .board { background: var(--th-chip); border: 4px solid var(--th-line); box-shadow: 4px 4px 0 #000; padding: 14px 16px; }
.exp-th .panel { display: grid; gap: 14px; min-width: 0; }
.exp-th .board h2 { margin: 0 0 8px; font-size: 16px; color: var(--th-gold); }
.exp-th .help { font-family: var(--read); font-size: 13px; color: var(--th-sub); margin: 6px 0 0; line-height: 1.5; }
.exp-th .seg { display: flex; gap: 6px; flex-wrap: wrap; }
.exp-th .seg button, .exp-th .presets button { font: 700 14px "Galmuri11", sans-serif; color: var(--text); background: #0f1628; border: 2px solid var(--th-line); padding: 6px 9px; min-height: 40px; cursor: pointer; flex: 1 1 auto; }
.exp-th .seg button[aria-pressed=true], .exp-th .presets button[aria-pressed=true] { color: var(--th-ink); background: var(--th-gold); border-color: #8a7410; }
.exp-th button:focus-visible, .exp-th input:focus-visible { outline: 3px solid var(--th-cyan); outline-offset: 2px; }
.exp-th .param { margin-top: 14px; }
.exp-th .param .head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.exp-th .param label { font-size: 15px; font-weight: 700; }
.exp-th .param .val { display: flex; align-items: center; gap: 3px; }
.exp-th .param input[type=number] { width: 78px; height: 36px; font: 700 15px "Galmuri11", sans-serif; text-align: right; color: var(--th-gold); background: #060a16; border: 2px solid var(--th-line); padding: 0 6px; }
.exp-th .param .unit { color: var(--th-gold); font-weight: 700; font-size: 13px; }
.exp-th .param input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; cursor: pointer; margin: 2px 0; }
.exp-th .param input[type=range]::-webkit-slider-runnable-track { height: 10px; background: #060a16; border: 2px solid var(--th-line); }
.exp-th .param input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 26px; margin-top: -10px; background: var(--th-gold); border: 3px solid #4a3810; box-shadow: 2px 2px 0 #000; }
.exp-th .param input[type=range]::-moz-range-track { height: 10px; background: #060a16; border: 2px solid var(--th-line); }
.exp-th .param input[type=range]::-moz-range-thumb { width: 16px; height: 22px; background: var(--th-gold); border: 3px solid #4a3810; border-radius: 0; }
.exp-th .presets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.exp-th .presets button { padding: 4px 7px; min-height: 40px; font-size: 13px; }
.exp-th .presets button small { font-size: 11px; opacity: .85; }
.exp-th .chk { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin-top: 12px; cursor: pointer; min-height: 36px; }
.exp-th .chk input { width: 22px; height: 22px; accent-color: #46c6ff; flex: none; }
.exp-th .chk span { font-weight: 400; font-size: 12px; color: var(--th-sub); font-family: var(--read); }
.exp-th .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.exp-th .b-play .btns { margin-top: 0; }
.exp-th button.chipbtn { cursor: pointer; font-family: inherit; font-size: 15px; font-weight: 700; color: var(--text); background: var(--th-chip); border: 3px solid var(--th-cyan); box-shadow: 4px 4px 0 #000; padding: 8px; min-height: 46px; }
.exp-th button.chipbtn.go { color: var(--th-ink); background: var(--th-gold); border-color: #8a7410; }
.exp-th button.chipbtn.wide { grid-column: 1 / -1; }
.exp-th button.chipbtn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #000; }

.exp-th .cmp { margin-top: 18px; max-width: 960px; }
.exp-th .cmp .row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; color: var(--th-sub); padding: 3px 0; }
.exp-th .cmp .row b { font-size: 20px; color: var(--text); font-weight: 700; text-align: right; }
.exp-th .cmp .row small { font-size: 12px; }
.exp-th .hist { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 2px solid var(--th-line); max-height: 150px; overflow: auto; font-size: 13px; color: var(--th-sub); display: grid; gap: 3px; }
.exp-th .hist li b { color: var(--th-gold); }
.exp-th .hist li.sep { color: var(--th-red); font-size: 12px; }
.exp-th .hist li.zero b.z { color: var(--th-green); }

@media (max-width: 1340px) {
  .exp-th .lab { grid-template-columns: minmax(0, 1fr); }
  .exp-th .panel { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 960px; }
  .exp-th .stage-wrap { width: 100%; max-width: 960px; aspect-ratio: 16 / 9; position: relative; }
  .exp-th .stage-box { transform-origin: 0 0; transform: scale(var(--k, 1)); position: absolute; }
}

/* 휴대폰: 가로 무대 대신 정사각 미로(180×180). 칩·자막은 무대 밖(위·아래)으로 뺀다. */
@media (max-width: 700px) {
  .exp-th .lab { gap: 14px; }
  .exp-th .lab-main, .exp-th .panel { display: contents; }
  .exp-th .stage-wrap { order: 1; aspect-ratio: auto; max-width: none; position: static; }
  .exp-th .b-play { order: 2; } .exp-th .cmp { order: 3; margin-top: 0; max-width: none; }
  .exp-th .b-tools { order: 4; } .exp-th .b-speed { order: 5; } .exp-th .b-save { order: 6; }
  .exp-th .stage-box { position: relative; width: 100%; height: auto; transform: none; display: flex; flex-direction: column; gap: 8px; box-shadow: none; background: none; }
  .exp-th canvas#stage { width: 100%; height: auto; aspect-ratio: 1 / 1; box-shadow: 0 0 0 3px #000, 0 0 0 5px var(--th-line); }
  .exp-th .chips { position: static; order: -1; display: flex; flex-wrap: wrap; gap: 6px; }
  .exp-th .chip, .exp-th .chip.small, .exp-th #c-rule { position: static; font-size: 13px; padding: 3px 9px; max-width: none; white-space: nowrap; }
  .exp-th #c-count br { display: none; } .exp-th #c-count b { margin-right: 8px; }
  .exp-th #c-count b { margin-right: 8px; }
  .exp-th #c-model { display: none; }
  .exp-th .caption { position: static; font-size: 15px; min-height: 0; padding: 8px 10px; border-width: 2px; order: 2; }
  .exp-th .title-card { display: none; }
  .exp-th .board { padding: 12px; }
  .exp-th .btns { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .exp-th .title-card { animation: none; display: none; } }
