/* 사진에 글씨 넣기 — 편집대: 위 띠 → 무대(툴 폭 전체) → 판정·저장 줄 → 스타일 6 줄 → 두 칸: 왼쪽(문구 · 글꼴 · 크기 · 색) | 오른쪽(읽힘 점검 · 읽히게 · 배치 · 저장).
   2026-10-20 사용자 "sticky는 없애고, 펼쳐줘": 무대는 화면에 붙지 않고 툴 폭 전체로 펼친다. 툴 폭 760px 미만은 한 열. */
.tw-work{container:twk/inline-size;position:relative}
.tw-work [hidden]{display:none!important}
.tw-fileinput{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}

/* 위 띠 */
.tw-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:12px 16px;border-bottom:1px solid var(--soft)}
.tw-pick{cursor:pointer}
.tw-src{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 10px;flex:1 1 200px;min-width:0;margin:0;font-family:var(--sans);font-size:13px;line-height:1.4}
.tw-src b{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:650;color:var(--ink)}
.tw-src span{font-family:var(--mono);font-size:11.5px;color:var(--muted)}
.tw-privacy{flex:0 1 auto;font-family:var(--sans);font-size:11.5px;line-height:1.45;color:var(--muted)}

/* 무대: 툴 폭 전체. 세로로 긴 사진은 화면 높이 80% 안으로 */
.tw-stagewrap{padding:12px 14px 10px;border-bottom:1px solid var(--soft)}
.tw-stage{position:relative;display:grid;place-items:center;max-height:min(80vh,780px);min-height:120px;overflow:hidden;background:conic-gradient(var(--wash) 25%,var(--paper) 0 50%,var(--wash) 0 75%,var(--paper) 0) 0 0/16px 16px;border:1px solid var(--soft)}
.tw-stage:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.tw-stage canvas{display:block;max-width:100%;touch-action:pan-x pan-y;-webkit-user-select:none;user-select:none}
.tw-stage.is-drag canvas{cursor:grabbing!important}
.tw-sbar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:8px}
.tw-mchk{display:inline-flex;align-items:center;gap:7px;min-width:0;font-family:var(--mono);font-size:12px;font-weight:600;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tw-mchk::before{content:"";flex:none;width:9px;height:9px;border-radius:50%;background:#2f9e44}
.tw-mchk[data-level="large"]::before{background:#c99a2e}
.tw-mchk[data-level="poor"]::before{background:var(--accent)}
.tw-mchk[data-level="none"]::before{background:var(--line)}
.tw-sbar .v2-btn{flex:none}
.tw-over{position:absolute;inset:0;display:none;place-content:center;gap:8px;margin:0;background:color-mix(in srgb,var(--card) 82%,transparent);border:2px dashed var(--accent);font-family:var(--sans);font-size:14px;font-weight:650;color:var(--ink);text-align:center}
.tw-over .i{width:28px;height:28px;margin:0 auto}
.tw-work.is-over .tw-over{display:grid}

/* 두 칸 */
.tw-desk{display:grid;grid-template-columns:minmax(0,1fr)}
.tw-main{display:flex;flex-direction:column;min-width:0}
.tw-panel.tw-textp{gap:12px}
.tw-sub{font-family:var(--sans);font-size:11.5px;font-weight:600;letter-spacing:.02em;color:var(--muted)}
.tw-layers{display:flex;flex-wrap:wrap;align-items:flex-start;gap:6px 8px}
.tw-layers > .tw-sub{padding-top:7px}
.tw-chips{display:flex;flex-wrap:wrap;gap:6px;flex:1 1 0;min-width:0}
.tw-chip{max-width:150px;height:30px;padding:0 10px;overflow:hidden;border:1px solid var(--soft);border-radius:var(--radius);background:var(--paper);font-family:var(--sans);font-size:12.5px;font-weight:600;color:var(--muted);text-overflow:ellipsis;white-space:nowrap;transition:background var(--ease),color var(--ease),border-color var(--ease)}
.tw-chip:hover{background:var(--btn);color:var(--ink)}
.tw-chip[aria-pressed="true"]{background:var(--fill);border-color:var(--fill);color:var(--on-fill)}
.tw-mini{height:30px;padding:0 10px;font-size:12px}
.tw-mini .i{width:15px;height:15px}
.tw-ic{flex:none;width:30px;padding:0;justify-content:center}
.tw-ic .i{width:17px;height:17px}
.tw-mini:disabled{opacity:.45;cursor:not-allowed}
.tw-hint{margin-top:-6px;font-family:var(--sans);font-size:12px;line-height:1.5;color:var(--muted)}
.tw-textf .v2-label{display:block;margin-bottom:6px}
.tw-text{display:block;width:100%;min-height:76px;resize:vertical;padding:9px 11px;border:1px solid var(--line);border-radius:var(--radius);background:var(--paper);color:var(--ink);font-family:var(--sans);font-size:15px;font-weight:600;line-height:1.45}
.tw-text:focus{outline:2px solid var(--accent);outline-offset:1px;border-color:var(--ink)}
.tw-count{display:block;margin-top:4px;font-family:var(--mono);font-size:11px;color:var(--muted);text-align:right}

/* 읽힘 점검: 배경 밝기 범위(띠) · 가운데 · 글자 색(점) · 외곽선 색(고리) */
.tw-check{display:grid;gap:8px;padding:12px 12px 11px;border:1px solid var(--soft);border-left:3px solid var(--ink);border-radius:var(--radius);background:var(--paper)}
.tw-check[data-level="large"]{border-left-color:#c99a2e}
.tw-check[data-level="poor"]{border-left-color:var(--accent)}
.tw-chead{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:2px 10px}
.tw-verdict{margin:0;font-family:var(--sans);font-size:13px;font-weight:600;line-height:1.45;color:var(--ink)}
.tw-verdict b{margin-right:2px;font-family:var(--mono);font-size:14px}
.tw-check[data-level="poor"] .tw-verdict b{color:var(--accent)}
.tw-meter{position:relative;height:14px;margin:6px 9px 2px;border:1px solid var(--line);border-radius:7px;background:linear-gradient(90deg,#000,#fff)}
.tw-band{position:absolute;top:-5px;bottom:-5px;min-width:3px;border:2px solid var(--accent);border-radius:4px;background:rgba(196,74,0,.16);transition:left .3s ease,width .3s ease}
.tw-midt{position:absolute;top:-6px;bottom:-6px;width:2px;margin-left:-1px;background:var(--accent);transition:left .3s ease}
.tw-ring{position:absolute;top:50%;width:26px;height:26px;margin:-13px 0 0 -13px;border:4px solid #000;border-radius:50%;box-shadow:0 0 0 1px var(--card),inset 0 0 0 1px var(--card);transition:left .3s ease}
.tw-dot{position:absolute;top:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid var(--card);border-radius:50%;background:#fff;box-shadow:0 0 0 1.5px var(--ink);transition:left .3s ease}
.tw-scale{display:flex;flex-wrap:wrap;justify-content:space-between;gap:2px 10px;font-family:var(--mono);font-size:10.5px;color:var(--muted)}
.tw-key{display:inline-flex;align-items:center;gap:5px}
.tw-key i{display:inline-block}
.tw-key .k-band{width:14px;height:8px;border:2px solid var(--accent);border-radius:2px;background:rgba(196,74,0,.16)}
.tw-key .k-dot{width:9px;height:9px;margin-left:6px;border-radius:50%;background:var(--card);box-shadow:0 0 0 1.5px var(--ink)}
.tw-why{margin:0;font-family:var(--sans);font-size:12px;line-height:1.5;color:var(--muted)}
.tw-fixes{display:flex;flex-wrap:wrap;gap:6px}
.tw-edge{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin:0;font-family:var(--sans);font-size:12.5px;font-weight:600;line-height:1.45;color:var(--accent)}
.tw-work.is-rm .tw-band,.tw-work.is-rm .tw-midt,.tw-work.is-rm .tw-ring,.tw-work.is-rm .tw-dot{transition:none}

/* 스타일 6: 내 사진 그 자리에 대 본 그림 */
.tw-stylesec{display:flex;flex-direction:column;gap:7px;padding:12px 14px 14px;border-bottom:1px solid var(--soft)}
.tw-styles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.tw-styles button{display:flex;flex-direction:column;gap:5px;min-width:0;padding:4px 4px 6px;border:1px solid var(--soft);border-radius:var(--radius);background:var(--paper);font-family:var(--sans);font-size:11.5px;font-weight:600;line-height:1.3;color:var(--ink);text-align:left;cursor:pointer;transition:border-color var(--ease),background var(--ease)}
.tw-styles button:hover{border-color:var(--ink);background:var(--card)}
.tw-styles canvas{display:block;width:100%;height:auto;aspect-ratio:8/5;background:var(--wash)}
.tw-styles span{padding:0 2px}

/* 저장 줄 */
.tw-panel.tw-save{gap:10px;background:var(--paper)}
.tw-o{display:flex;align-items:center;gap:8px}
.tw-save .tw-o:not(.tw-q){flex-direction:column;align-items:flex-start;gap:6px}
.tw-q input[type=range]{width:110px;margin:0;accent-color:var(--accent)}
.tw-q output{min-width:40px;font-family:var(--mono);font-size:12px;color:var(--ink)}
.tw-acts{display:flex;gap:6px}
.tw-acts .v2-btn{height:40px;justify-content:center}
.tw-acts .v2-btn--primary{flex:1 1 auto}
.tw-status{margin:0;line-height:1.5}
.tw-status[data-kind="ok"]{color:var(--ink)}
.tw-status[data-kind="err"]{color:var(--accent);font-weight:600}

/* 오른쪽: 설정 칸 */
.tw-side{display:flex;flex-direction:column;min-width:0;border-top:1px solid var(--soft)}
.tw-panel{display:flex;flex-direction:column;gap:9px;padding:13px 16px 14px}
.tw-panel + .tw-panel{border-top:1px solid var(--soft)}
.tw-main > .tw-panel:last-child,.tw-side > .tw-panel:last-child{flex:1 1 auto} /* 두 칸 높이 차를 마지막 패널이 채운다(빈 띠 없음) */
.tw-ph{margin:0;font-family:var(--mono);font-size:11px;font-weight:700;letter-spacing:.06em;line-height:1.3;color:var(--muted)}
.tw-fonts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.tw-font{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:4px;min-width:0;min-height:58px;padding:7px 10px;overflow:hidden;border:1px solid var(--soft);border-radius:var(--radius);background:var(--paper);color:var(--ink);text-align:left;cursor:pointer;transition:border-color var(--ease),background var(--ease)}
.tw-font:hover{border-color:var(--line);background:var(--card)}
.tw-font[aria-pressed="true"]{border-color:var(--ink);background:var(--card);box-shadow:inset 0 0 0 1px var(--ink)}
.tw-font[aria-busy="true"]{animation:tw-pulse 1s ease-in-out infinite alternate}
.tw-font small{max-width:100%;font-family:var(--sans);font-size:11px;line-height:1.3;color:var(--muted);overflow-wrap:anywhere}
.tw-fimg{display:block;flex:none;height:22px;max-width:100%;background:currentColor;-webkit-mask-image:var(--tw-sprite);mask-image:var(--tw-sprite);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}
.tw-fsys{display:block;font-size:18px;font-weight:700;line-height:22px;white-space:nowrap}
@keyframes tw-pulse{to{opacity:.55}}
.tw-work.is-rm .tw-font[aria-busy="true"]{animation:none;opacity:.7}
.tw-miss{margin:0;font-family:var(--sans);font-size:12px;line-height:1.5;color:var(--accent)}
.tw-rng{display:grid;grid-template-columns:minmax(4.2em,auto) minmax(0,1fr) auto;align-items:center;gap:6px 10px}
.tw-rng--c{grid-template-columns:minmax(4.2em,auto) minmax(0,1fr) auto auto}
.tw-rng > label:first-child{font-family:var(--sans);font-size:12.5px;font-weight:600;color:var(--ink)}
.tw-rng input[type=range]{width:100%;height:28px;margin:0;accent-color:var(--accent)}
.tw-rng output{min-width:46px;font-family:var(--mono);font-size:12px;font-weight:600;color:var(--ink);text-align:right}
.tw-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
.tw-sw{align-self:flex-start}
.tw-sws{display:flex;flex-wrap:wrap;align-items:center;gap:6px 7px}
.tw-sws button{width:26px;height:26px;padding:0;border:1px solid var(--line);border-radius:50%;background:var(--c);box-shadow:inset 0 0 0 2px var(--card);cursor:pointer}
.tw-sws button[aria-pressed="true"],.tw-well.is-on{outline:2px solid var(--ink);outline-offset:2px}
.tw-well{position:relative;display:inline-block;flex:none;width:26px;height:26px;overflow:hidden;border:1px solid var(--line);border-radius:50%;background:conic-gradient(#f03e3e,#ffd43b,#69db7c,#4dabf7,#9775fa,#f783ac,#f03e3e);cursor:pointer}
.tw-well input{position:absolute;inset:-4px;width:calc(100% + 8px);height:calc(100% + 8px);padding:0;border:0;opacity:0;cursor:pointer}
.tw-well:focus-within{outline:2px solid var(--accent);outline-offset:2px}
.tw-well--s{width:26px;height:26px;background:none}
.tw-well--s input{inset:0;width:100%;height:100%;opacity:1;-webkit-appearance:none;appearance:none;background:none}
.tw-well--s input::-webkit-color-swatch-wrapper{padding:0}
.tw-well--s input::-webkit-color-swatch{border:0;border-radius:50%}
.tw-well--s input::-moz-color-swatch{border:0;border-radius:50%}
.tw-lay{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:12px}
.tw-pos{justify-self:start;display:grid;grid-template-columns:repeat(3,26px);grid-template-rows:repeat(3,22px);gap:3px;padding:4px;border:1px solid var(--line);border-radius:var(--radius);background:var(--wash)}
.tw-pos button{display:grid;place-items:center;padding:0;border:0;border-radius:1px;background:transparent;cursor:pointer}
.tw-pos button i{width:8px;height:8px;border-radius:50%;background:var(--line);transition:background var(--ease),transform var(--ease)}
.tw-pos button:hover i,.tw-pos button:focus-visible i{background:var(--accent);transform:scale(1.3)}
.tw-laycol{display:flex;flex-direction:column;gap:8px;min-width:0}
.tw-sws2{display:flex;flex-wrap:wrap;gap:8px 18px}

/* 넓은 툴: 두 칸 */
@container twk (min-width:760px){
  .tw-desk{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .tw-main{border-right:1px solid var(--soft)}
  .tw-side{border-top:0}
}
@container twk (min-width:520px){
  .tw-styles{grid-template-columns:repeat(6,minmax(0,1fr))}
}
@container twk (min-width:520px) and (max-width:759px){
  .tw-fonts{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (prefers-reduced-motion:reduce){.tw-band,.tw-midt,.tw-ring,.tw-dot{transition:none}.tw-font[aria-busy="true"]{animation:none;opacity:.7}}
