/* 터치스크린 테스트(touch-screen-test) — 검사판 + 점검 레일. 작업면 컨테이너 tchw: 위 줄(다음에 할 일 · 전체 화면) → [판 | 레일 ①~④] → 아래 줄(칸 크기 · 처음부터 · 결과 복사).
   판 색은 사이트 토큰(바탕 wash · 칠한 칸 fill · 선 soft), 강조색은 판 안(손가락 원 · 칠하는 순간 · 끊김 · 남은 칸)과 ① 지금 닿은 손가락 칸에만 쓴다.
   600 이하: 판 위 · 레일은 ①②③ 세 칸 + ④ 한 줄 / 400 이하: 여백 · 숫자 줄임. 전체 화면(.is-fs = Fullscreen API, .is-full = 창 덮기)은 판만 화면 전체 + 가운데 안내판. */
.tch{container:tchw / inline-size}
.tch,.tch-board{--tch-bg:var(--wash);--tch-ln:var(--soft);--tch-on:var(--fill);--tch-acc:var(--accent);--tch-dot:var(--card);--tch-ink:var(--ink)} /* 판은 창 덮기 때 body 끝으로 옮겨지므로 판에도 */
.tch [hidden],.tch-board [hidden]{display:none !important}
.tch p,.tch-board p{margin:0}
.tch:lang(ko),.tch-board:lang(ko){word-break:keep-all;overflow-wrap:anywhere}
.tch-probe{position:absolute;width:0;height:0;overflow:hidden}

/* ---------- 위 줄: 다음에 할 일 · 전체 화면 ---------- */
.tch-top{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--soft)}
.tch-say{flex:1 1 auto;min-width:0;min-height:3em;display:flex;align-items:center;font-family:var(--sans);font-size:14px;font-weight:600;line-height:1.5;color:var(--ink)}
.tch-full{flex:none;background:var(--fill);border-color:var(--fill);color:var(--on-fill)}
.tch-full:hover{background:var(--fill-hover);border-color:var(--fill-hover)}
.tch-full .i{width:15px;height:15px}
.tch-full kbd{padding:1px 5px 0;border:1px solid currentColor;border-radius:var(--radius);font-family:var(--mono);font-size:10.5px;line-height:1.3;opacity:.75}

/* ---------- 본체: 판 | 레일 ---------- */
.tch-main{display:grid;grid-template-columns:minmax(0,1fr) 252px;align-items:stretch}
.tch-stage{display:flex;flex-direction:column;gap:8px;min-width:0;margin:14px 0 14px 16px}
.tch-board{position:relative;flex:1 1 auto;min-width:0;min-height:360px;background:var(--tch-bg);border:1px solid var(--soft);border-radius:var(--radius);overflow:hidden;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;cursor:crosshair}
.tch-board canvas{position:absolute;inset:0;display:block;width:100%;height:100%}
.tch-hint{position:absolute;left:50%;top:50%;display:flex;flex-direction:column;align-items:center;gap:8px;width:max-content;max-width:calc(100% - 32px);transform:translate(-50%,-50%);font-family:var(--sans);font-size:13.5px;font-weight:650;line-height:1.45;text-align:center;color:var(--muted);pointer-events:none}
.tch-hint .i{width:56px;height:28px;color:var(--tch-acc)}
@media (prefers-reduced-motion:no-preference){ .tch-hint .i{animation:tch-swipe 2.4s ease-in-out 3} }
@keyframes tch-swipe{0%,100%{transform:translateX(-10px)}50%{transform:translateX(10px)}}

/* 레일: 점검 네 줄 */
.tch-rail{display:flex;flex-direction:column;margin:0 0 0 16px;padding:4px 0;list-style:none;border-left:1px solid var(--soft)}
.tch-card{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:5px 10px;padding:11px 16px;border-top:1px solid var(--soft)}
.tch-card:first-child{border-top:0}
.tch-ch{grid-column:1 / -1;display:flex;align-items:center;gap:7px;min-width:0;font-family:var(--sans);font-size:12.5px;line-height:1.3;color:var(--ink)}
.tch-ch b{min-width:0;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tch-no{flex:none;width:18px;height:18px;border-radius:50%;background:var(--soft);font-size:10.5px;font-weight:800;line-height:18px;text-align:center;color:var(--ink)}
.tch-st{flex:none;margin-left:auto;padding:2px 7px;border-radius:var(--radius);background:var(--soft);font-size:11px;font-weight:700;line-height:1.35;color:var(--muted);white-space:nowrap}
.tch-card[data-s="part"] .tch-st,.tch-card[data-s="run"] .tch-st{background:transparent;box-shadow:inset 0 0 0 1px var(--line);color:var(--ink)}
.tch-card[data-s="ok"] .tch-st{background:var(--fill);color:var(--on-fill)}
.tch-card[data-s="warn"] .tch-st{background:var(--ink);color:var(--paper)}
.tch-card[data-s="ok"] .tch-st::before{content:"✓ "}
.tch-card[data-s="warn"] .tch-st::before{content:"! "}
.tch-cv{grid-column:1;display:flex;align-items:baseline;gap:5px;min-width:0;font-family:var(--sans);line-height:1}
.tch-cv b{font-size:28px;font-weight:750;letter-spacing:-.02em;color:var(--ink);font-variant-numeric:tabular-nums lining-nums}
.tch-cv em{min-width:0;font-size:12px;font-style:normal;font-weight:600;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tch-cs{grid-column:1 / -1;min-width:0;min-height:2.9em;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-family:var(--sans);font-size:12px;line-height:1.45;color:var(--muted);font-variant-numeric:tabular-nums} /* 두 줄 고정: 글이 바뀌어도 레일 높이(= 판 높이)가 그대로 */

/* ① 손가락 칸: 테두리 = 기기 보고 범위, 채움 = 이번 최대, 강조색 = 지금 닿은 손가락 */
.tch-meter{grid-column:1 / -1;display:flex;flex-wrap:wrap;gap:5px}
.tch-meter i{width:14px;height:14px;border:1.5px solid var(--line);border-radius:50%;transition:background var(--ease),border-color var(--ease)}
.tch-meter i.max{background:var(--soft);border-color:var(--muted)}
.tch-meter i.on{background:var(--tch-acc);border-color:var(--tch-acc)}
/* ② 진행 막대 */
.tch-prog{grid-column:1 / -1;display:block;height:8px;background:var(--soft);border-radius:var(--radius);overflow:hidden}
.tch-prog i{display:block;width:0;height:100%;background:var(--fill);transition:width .2s ease}
/* ③ 끊김 표식 수만큼 X */
.tch-marks{grid-column:2;grid-row:2;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:2px;max-width:96px}
.tch-marks i{width:12px;height:12px;font-style:normal;font-size:11px;font-weight:800;line-height:12px;text-align:center;color:var(--tch-acc)}
.tch-marks i::before{content:"✕"}
/* ④ 감시 고리 · 시간 · 단추 */
.tch-ring{grid-column:2;grid-row:2;width:40px;height:40px;transform:rotate(-90deg)}
.tch-ring circle{fill:none;stroke:var(--soft);stroke-width:4}
.tch-ring .tch-ring-on{stroke:var(--fill);stroke-linecap:butt;transition:stroke-dasharray .2s linear}
.tch[data-gh="run"] .tch-ring .tch-ring-on{stroke:var(--ink)}
.tch-gc{grid-column:1 / -1;display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin-top:2px}
.tch-gc .v2-seg{flex-wrap:nowrap}
.tch-gc .v2-seg button{padding:0 7px;white-space:nowrap}
.tch-gbtn{margin-left:auto;padding-left:11px;padding-right:11px}
.tch-gbtn[aria-pressed="true"],.tch-hud [data-gh-btn][aria-pressed="true"]{background:var(--fill);border-color:var(--fill);color:var(--on-fill)}

/* ---------- 아래 줄 ---------- */
.tch-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;padding:10px 16px;border-top:1px solid var(--soft)}
.tch-sz{display:flex;align-items:center;gap:8px;min-width:0}
.tch-szl{flex:none;font-family:var(--sans);font-size:12.5px;font-weight:650;color:var(--muted);white-space:nowrap}
.tch-sz .v2-seg{flex-wrap:nowrap}
.tch-sz .v2-seg button{padding:0 10px;white-space:nowrap}
.tch-copy{margin-left:auto}
.tch-scr{flex:1 0 100%;min-width:0;font-family:var(--sans);font-size:12px;font-weight:600;color:var(--muted);font-variant-numeric:tabular-nums}
.tch-msg{flex:1 0 100%}
.tch-out{flex:1 0 100%;min-width:0;padding:8px 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--card);font-family:var(--sans);font-size:12.5px;line-height:1.5;color:var(--ink);resize:vertical}
.tch-msg:empty{display:none}
.tch-nojs{padding:12px 16px;font-family:var(--sans);font-size:13px;color:var(--ink)}

/* ---------- 전체 화면 결과 띠(페이지로 돌아온 뒤 읽기 전용) ---------- */
.tch-rib{display:none}
.tch[data-ro="1"] .tch-rib{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;padding:7px 8px 7px 12px;background:var(--wash);border:1px solid var(--soft);border-radius:var(--radius)}
.tch-rib p{flex:1 1 auto;min-width:0;font-family:var(--sans);font-size:12.5px;font-weight:700;line-height:1.4;color:var(--ink)}
.tch-rib .v2-btn{height:34px}

/* ---------- 전체 화면: 판만 화면 전체 + 가운데 안내판(손을 떼면 1.2초 뒤에 나타남, 판을 누르면 숨음) ---------- */
.tch-board:fullscreen{margin:0;border:0;border-radius:0;min-height:0}
.tch-board.is-fs,.tch-board.is-full{width:100%;height:100%;min-height:0;max-height:none;aspect-ratio:auto;margin:0;border:0;border-radius:0;cursor:default}
.tch-board.is-full{position:fixed;inset:0;z-index:2147483647;width:100vw;height:100dvh}
html.tch-lock,html.tch-lock body{overflow:hidden;overscroll-behavior:none}
.tch-hud{display:none}
.tch-board.is-fs .tch-hud,.tch-board.is-full .tch-hud{position:absolute;left:50%;top:50%;display:grid;gap:10px;width:min(360px, calc(100% - 32px));padding:14px 16px;background:color-mix(in srgb, var(--card) 95%, transparent);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 8px 28px rgba(0,0,0,.2);transform:translate(-50%,-50%);pointer-events:none;transition:opacity .18s ease, visibility 0s linear 0s}
.tch-board .tch-hud[data-on="0"]{opacity:0;visibility:hidden;transition:opacity .12s ease, visibility 0s linear .12s}
.tch-hud button{pointer-events:auto}
.tch-hud-t{font-family:var(--sans);font-size:14px;font-weight:600;line-height:1.5;color:var(--ink)}
.tch-hud-st{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin:0}
.tch-hud-st div{min-width:0;padding-left:9px;border-left:1px solid var(--soft)}
.tch-hud-st div:first-child{padding-left:0;border-left:0}
.tch-hud-st dt{font-family:var(--sans);font-size:11px;font-weight:600;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tch-hud-st dd{margin:3px 0 0;font-family:var(--sans);font-size:16px;font-weight:750;color:var(--ink);white-space:nowrap;font-variant-numeric:tabular-nums}
.tch-hud-b{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}

/* ---------- 좁은 폭 ---------- */
@container tchw (max-width:600px){
  .tch-main{grid-template-columns:minmax(0,1fr)}
  .tch-stage{margin:12px 12px 0}
  .tch-rib p{flex:1 0 100%}
  .tch-rib .v2-btn{flex:1 1 0;min-width:0;justify-content:center}
  .tch-board{flex:none;min-height:240px;max-height:min(58vh, 520px);aspect-ratio:1 / 1}
  .tch-rail{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin:12px 0 0;padding:0;border-left:0;border-top:1px solid var(--soft)}
  .tch-card{grid-template-columns:minmax(0,1fr);align-content:start;gap:5px;padding:10px 12px;border-top:0;border-left:1px solid var(--soft)}
  .tch-card:first-child{border-left:0}
  .tch-no{display:none}
  .tch-st{padding:1px 5px;font-size:10.5px}
  .tch-cv b{font-size:24px}
  .tch-cs{min-height:0;display:block;font-size:11.5px}
  .tch-say{min-height:4.5em} /* 좁은 폭은 판이 바로 아래라 세 줄 자리를 잡아 둔다 */
  .tch-marks{grid-column:1;grid-row:auto;justify-content:flex-start;max-width:none}
  .tch-meter{gap:2px}
  .tch-meter i{width:8px;height:8px;border-width:1px}
  #tchC4{grid-column:1 / -1;grid-template-columns:auto minmax(0,1fr);column-gap:12px;border-left:0;border-top:1px solid var(--soft)}
  #tchC4 .tch-ring{grid-column:1;grid-row:2 / span 2}
  #tchC4 .tch-cv,#tchC4 .tch-cs{grid-column:2}
  .tch-sz{flex:1 0 100%}
  .tch-copy{margin-left:auto}
  .tch-bar{padding:10px 12px}
  .tch-top{padding:10px 12px}
}
@container tchw (max-width:400px){
  .tch-ch{flex-wrap:wrap;gap:4px}
  .tch-st{margin-left:0}
  .tch-cv b{font-size:21px}
  .tch-cv em{display:none}
  .tch-card{padding:9px 10px}
  .tch-full kbd{display:none}
  .tch-say{font-size:13.5px}
  .tch-meter i{width:7px;height:7px}
}
@media (prefers-reduced-motion:reduce){
  .tch-meter i,.tch-prog i,.tch-ring .tch-ring-on,.tch-hud{transition:none !important}
}

/* ---------- 본문 그림: 결과 판 세 가지(정상 · 한 줄이 빈 판 · 가장자리만 남은 판) ---------- */
.tch-fig{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;max-width:520px;margin:14px 0 18px}
.tch-fig div{min-width:0}
.tch-fig svg{display:block;width:100%;max-width:140px;height:auto;margin:0 auto}
.tch-fig rect{fill:var(--fill)}
.tch-fig rect.bg{fill:var(--wash);stroke:var(--soft)}
.tch-fig rect.e{fill:var(--wash)}
.tch-fig rect.o{fill:var(--wash);stroke:var(--accent);stroke-width:1.4}
.tch-fig .x{fill:none;stroke:var(--accent);stroke-width:2;stroke-linecap:round}
.tch-fig figcaption{margin-top:6px;font-family:var(--sans);font-size:12.5px;line-height:1.45;color:var(--muted);text-align:center}
