/* 칩 디자인 모음 — GPT 시안·디글 실제 썸네일에서 뽑은 틀. 칩 = 글자를 감싸는 HTML+CSS:
   <div class="chip chip-<id>"><i class="d1"></i><i class="d2"></i><i class="d3"></i><div class="tx">글자</div></div>
   사용자가 바꾸는 값: --chip-bg(바탕, 색이나 그라데이션), --chip-line(선), --pt·--pr·--pb·--pl(위·오른쪽·아래·왼쪽 여백, em. 없으면 칩마다 정한 기본값).
   크기는 전부 em(글자 크기 기준)이라 글자를 키우면 칩도 같이 커진다. 새 칩은 .chip-<id> 를 더하고 app.js 의 CHIPS 에 한 줄. */
.chip { position: relative; display: inline-flex; isolation: isolate; --chip-bg: #fff; --chip-line: #e01010; }
/* 칩 안 글자는 줄 높이를 글자 높이(대문자 높이~기준선)로 잘라 위아래 빈칸을 없앤다 — 여백 0 이 글자에 딱 붙게.
   한글은 대문자 높이보다 살짝 높아서 위로 .06em 을 돌려준다 */
.chip > .tx .cp { text-box: trim-both cap alphabetic; }  /* 블록에 주면 첫 줄 위·마지막 줄 아래만 잘린다(줄 사이는 그대로) */
.chip > .tx { padding-top: .1em !important; padding-bottom: .09em !important; }
.chip > .tx { position: relative; z-index: 6 }
.chip > i { position: absolute; pointer-events: none; display: none }
.chip::before, .chip::after { pointer-events: none }

/* ── 사각 박스류 ── */
/* 대사 박스: 흰 바탕 + 굵은 색 테두리 + 얇은 어두운 바깥선 (디글 '이상한 변호사 우영우', GPT 대사 인용) */
.chip-quote-frame { background: var(--chip-bg); border: .1em solid var(--chip-line); padding: var(--pt, 0.16em) var(--pr, .3em) var(--pb, 0.16em) var(--pl, .3em);
  box-shadow: 0 0 0 .025em rgba(40,0,0,.8); }

/* 메모 박스: 흰 바탕 + 노란 테두리 + 그림자, 살짝 기울여 쓴다 (손글씨 대사) */
.chip-note-box { background: var(--chip-bg); border: .075em solid var(--chip-line); padding: var(--pt, 0.22em) var(--pr, .32em) var(--pb, 0.22em) var(--pl, .32em);
  box-shadow: .05em .08em .12em rgba(0,0,0,.55); }

/* 컬러 박스: 민트·그라데이션 바탕 + 검정 테두리, 기울여 쓴다 */
.chip-color-box { background: var(--chip-bg); border: .065em solid var(--chip-line); padding: var(--pt, 0.24em) var(--pr, .42em) var(--pb, 0.24em) var(--pl, .42em);
  box-shadow: .03em .05em 0 rgba(0,0,0,.5); }

/* 유퀴즈 정보 박스: 초록 바탕 + 얇은 진초록 선, 두 줄(첫 줄은 {강조}색) */
.chip-info-box { background: var(--chip-bg); border: .03em solid var(--chip-line); padding: var(--pt, 0.13em) var(--pr, .25em) var(--pb, 0.13em) var(--pl, .25em); }

/* 컬러 띠: 메인 자막 뒤에 붙는 형광 띠 (디글 '유재석 찐 웃음', '김연경 남다른 발사이즈') */
.chip-band { background: var(--chip-bg); padding: var(--pt, 0.1em) var(--pr, .12em) var(--pb, 0.1em) var(--pl, .12em); }

/* ── 말풍선 ── 꼬리는 선 삼각형(::before) 위에 바탕 삼각형(::after)을 겹쳐 테두리를 연다 */
.chip-speech-box { background: var(--chip-bg); border: .1em solid var(--chip-line); border-radius: .16em; padding: var(--pt, 0.2em) var(--pr, .36em) var(--pb, 0.2em) var(--pl, .36em); margin-bottom: .4em;
  box-shadow: .03em .05em 0 rgba(0,0,0,.35); }
.chip-speech-box::before, .chip-speech-box::after { content: ''; position: absolute; z-index: 1; }
.chip-speech-box::before { left: 30%; top: calc(100% - .02em); width: .62em; height: .52em; background: var(--chip-line); clip-path: polygon(0 0, 100% 0, 12% 100%); }
.chip-speech-box::after { left: calc(30% + .13em); top: calc(100% - .11em); width: .36em; height: .36em; background: var(--chip-bg); clip-path: polygon(0 0, 100% 0, 6% 100%); }

.chip-speech-yellow { background: var(--chip-bg); border: .09em solid var(--chip-line); border-radius: .06em; padding: var(--pt, 0.22em) var(--pr, .35em) var(--pb, 0.22em) var(--pl, .35em); margin-bottom: .45em;
  box-shadow: .04em .06em 0 rgba(0,0,0,.35); }
.chip-speech-yellow::before, .chip-speech-yellow::after { content: ''; position: absolute; z-index: 1; }
.chip-speech-yellow::before { right: 6%; top: calc(100% - .02em); width: .75em; height: .6em; background: var(--chip-line); clip-path: polygon(0 0, 62% 0, 100% 100%); }
.chip-speech-yellow::after { right: calc(6% + .16em); top: calc(100% - .12em); width: .44em; height: .4em; background: var(--chip-bg); clip-path: polygon(0 0, 62% 0, 100% 100%); }

/* ── 붓·종이 ── 모양은 SVG 마스크, 색은 바탕 변수 */
.chip-brush-dark, .chip-brush-light { padding: var(--pt, 0.32em) var(--pr, .8em) var(--pb, 0.32em) var(--pl, .8em); background: var(--chip-bg);
  -webkit-mask: url(chips/brush.svg?v=20261127081316) center / 100% 100% no-repeat; mask: url(chips/brush.svg?v=20261127081316) center / 100% 100% no-repeat; }
.chip-torn-paper { padding: var(--pt, 0.22em) var(--pr, .55em) var(--pb, 0.22em) var(--pl, .55em); background: url(chips/paper.svg?v=20261127081316) 0 0 / 6em, var(--chip-bg); background-blend-mode: multiply;
  box-shadow: inset 0 0 .4em rgba(120,80,30,.35);
  -webkit-mask: url(chips/torn.svg?v=20261127081316) center / 100% 100% no-repeat; mask: url(chips/torn.svg?v=20261127081316) center / 100% 100% no-repeat; }

/* ── 라벨 ── 여러 겹을 같은 모양으로 안쪽으로 줄여 겹쳐 두 줄 테두리를 만든다(바깥선 → 바탕 → 안쪽선 → 바탕) */
.chip-label-frame { padding: var(--pt, 0.24em) var(--pr, .7em) var(--pb, 0.24em) var(--pl, .7em); }
.chip-ribbon { padding: var(--pt, 0.4em) var(--pr, .8em) var(--pb, 0.24em) var(--pl, .8em); }
.chip-label-frame, .chip-label-frame::before, .chip-label-frame::after, .chip-label-frame > .d1 {
  --r: .32em;
  -webkit-mask: radial-gradient(circle at 0 0, #0000 var(--r), #000 calc(var(--r) + .5px)) 0 0 / 51% 51% no-repeat,
                radial-gradient(circle at 100% 0, #0000 var(--r), #000 calc(var(--r) + .5px)) 100% 0 / 51% 51% no-repeat,
                radial-gradient(circle at 0 100%, #0000 var(--r), #000 calc(var(--r) + .5px)) 0 100% / 51% 51% no-repeat,
                radial-gradient(circle at 100% 100%, #0000 var(--r), #000 calc(var(--r) + .5px)) 100% 100% / 51% 51% no-repeat;
          mask: radial-gradient(circle at 0 0, #0000 var(--r), #000 calc(var(--r) + .5px)) 0 0 / 51% 51% no-repeat,
                radial-gradient(circle at 100% 0, #0000 var(--r), #000 calc(var(--r) + .5px)) 100% 0 / 51% 51% no-repeat,
                radial-gradient(circle at 0 100%, #0000 var(--r), #000 calc(var(--r) + .5px)) 0 100% / 51% 51% no-repeat,
                radial-gradient(circle at 100% 100%, #0000 var(--r), #000 calc(var(--r) + .5px)) 100% 100% / 51% 51% no-repeat; }
.chip-label-frame { background: var(--chip-line); }
.chip-label-frame::before, .chip-label-frame::after, .chip-label-frame > .d1 { content: ''; position: absolute; display: block; }
.chip-label-frame::before { inset: .045em; --r: .275em; background: var(--chip-bg); z-index: 0; }
.chip-label-frame::after { inset: .11em; --r: .21em; background: var(--chip-line); z-index: 1; }
.chip-label-frame > .d1 { inset: .135em; --r: .185em; background: url(chips/paper.svg?v=20261127081316) 0 0 / 6em, var(--chip-bg); background-blend-mode: multiply; z-index: 2;
  box-shadow: inset 0 0 .35em rgba(110,70,30,.35); }

/* 리본 라벨: 끝이 뾰족한 육각 + 두 줄 테두리 + 위 장식 (GPT '1화 하이라이트' 남색, '11화' 빨강)
   바깥선(::before) → 바탕(::after) → 안쪽선(.d1) → 바탕(.d2) 을 같은 육각으로 줄여 겹치고, 장식(.d3)은 위로 */
.chip-ribbon::before, .chip-ribbon::after, .chip-ribbon > .d1, .chip-ribbon > .d2 { content: ''; position: absolute; display: block;
  clip-path: polygon(.3em 0, calc(100% - .3em) 0, 100% .3em, 100% calc(100% - .3em), calc(100% - .3em) 100%, .3em 100%, 0 calc(100% - .3em), 0 .3em); }
.chip-ribbon::before { inset: 0; background: var(--chip-line); z-index: 0; }
.chip-ribbon::after { inset: .055em .08em; background: var(--chip-bg); z-index: 1; }
.chip-ribbon > .d1 { inset: .1em .16em; background: var(--chip-line); z-index: 2; }
.chip-ribbon > .d2 { inset: .125em .2em; background: var(--chip-bg); z-index: 3; }
.chip-ribbon > .d3 { display: block; left: 50%; top: .14em; width: 62%; height: .26em; transform: translateX(-50%); z-index: 4; background: var(--chip-line);
  -webkit-mask: url(chips/ornament.svg?v=20261127081316) center / contain no-repeat; mask: url(chips/ornament.svg?v=20261127081316) center / contain no-repeat; }

/* ── 둥근 태그류 ── */
/* 반투명 알약: '• 11화 하이라이트 •' (tvN 드라마) */
.chip-soft-pill { background: var(--chip-bg); border-radius: 999px; padding: var(--pt, 0.16em) var(--pr, .75em) var(--pb, 0.16em) var(--pl, .75em); }
.chip-soft-pill > .d1, .chip-soft-pill > .d2 { display: block; top: 50%; width: .16em; height: .16em; border-radius: 50%; background: var(--chip-line); transform: translateY(-50%); }
.chip-soft-pill > .d1 { left: .32em } .chip-soft-pill > .d2 { right: .32em }

/* 테두리 알약: 흰 바탕 + 분홍 굵은 테두리 ('1화 하이라이트') */
.chip-line-pill { background: var(--chip-bg); border: .085em solid var(--chip-line); border-radius: 999px; padding: var(--pt, 0.12em) var(--pr, .55em) var(--pb, 0.12em) var(--pl, .55em); }

/* 프로그램 태그: 분홍·보라 둥근 사각 ('최애의 사원', '포핸즈') */
.chip-program-tag { background: var(--chip-bg); border-radius: .1em; padding: var(--pt, 0.14em) var(--pr, .22em) var(--pb, 0.14em) var(--pl, .22em); }

/* 탭 라벨: 위가 열린 흰 탭 + 남색 테두리 ('나의 유죄인간 2화') */
.chip-tab-label { background: var(--chip-bg); border: .06em solid var(--chip-line); border-radius: .06em;
  padding: var(--pt, 0.36em) var(--pr, .5em) var(--pb, 0.18em) var(--pl, .5em); box-shadow: inset 0 0 0 .05em var(--chip-bg), inset 0 0 0 .075em var(--chip-line); }
.chip-tab-label > .d3 { display: block; left: 50%; top: .07em; width: 62%; height: .24em; transform: translateX(-50%); z-index: 4;
  background: var(--chip-line); -webkit-mask: url(chips/ornament.svg?v=20261127081316) center / contain no-repeat; mask: url(chips/ornament.svg?v=20261127081316) center / contain no-repeat; }

/* ── 새로 디자인한 칩(원본에 없던 것, 썸네일 문법에 맞춰) ── */
/* 스티커: 다이컷 스티커처럼 두꺼운 흰 테두리 + 그림자 */
.chip-sticker { background: var(--chip-bg); border-radius: .28em; padding: var(--pt, 0.2em) var(--pr, .42em) var(--pb, 0.2em) var(--pl, .42em);
  box-shadow: 0 0 0 .1em var(--chip-line), .06em .1em .14em .1em rgba(0,0,0,.45); }

/* 네온: 어두운 바탕 + 빛나는 테두리 */
.chip-neon { background: var(--chip-bg); border: .05em solid var(--chip-line); border-radius: .22em; padding: var(--pt, 0.2em) var(--pr, .45em) var(--pb, 0.2em) var(--pl, .45em);
  box-shadow: 0 0 .12em var(--chip-line), 0 0 .4em var(--chip-line), inset 0 0 .25em color-mix(in srgb, var(--chip-line) 60%, transparent); }
.chip-neon .cp:last-child { filter: drop-shadow(0 0 .08em currentColor); }

/* 마스킹 테이프: 반투명 테이프 + 톱니 끝 */
.chip-tape { padding: var(--pt, 0.2em) var(--pr, .6em) var(--pb, 0.2em) var(--pl, .6em); background: var(--chip-bg);
  -webkit-mask: url(chips/tape.svg?v=20261127081316) center / 100% 100% no-repeat; mask: url(chips/tape.svg?v=20261127081316) center / 100% 100% no-repeat; }

/* 뉴스 바: 흰 바 + 왼쪽 색 블록 */
.chip-news-bar { background: var(--chip-bg); border-left: .32em solid var(--chip-line); padding: var(--pt, 0.16em) var(--pr, .4em) var(--pb, 0.16em) var(--pl, .3em);
  box-shadow: .04em .06em .1em rgba(0,0,0,.4); }

/* 폭발 말풍선: 별 모양(선 별 위에 바탕 별) */
.chip-burst { padding: var(--pt, 0.65em) var(--pr, .9em) var(--pb, 0.65em) var(--pl, .9em); }
.chip-burst::before, .chip-burst::after { content: ''; position: absolute; z-index: 0;
  clip-path: polygon(50% 0, 58% 22%, 78% 6%, 74% 30%, 100% 28%, 82% 48%, 100% 68%, 75% 70%, 80% 96%, 58% 80%, 50% 100%, 42% 80%, 20% 96%, 25% 70%, 0 68%, 18% 48%, 0 28%, 26% 30%, 22% 6%, 42% 22%); }
.chip-burst::before { inset: 0; background: var(--chip-line); }
.chip-burst::after { inset: .09em .12em; background: var(--chip-bg); z-index: 1; }

/* 생각 풍선: 둥근 구름 + 작은 동그라미 꼬리 */
.chip-thought { background: var(--chip-bg); border: .06em solid var(--chip-line); border-radius: 1em; padding: var(--pt, 0.3em) var(--pr, .6em) var(--pb, 0.3em) var(--pl, .6em); margin-bottom: .5em; }
.chip-thought > .d1, .chip-thought > .d2 { display: block; background: var(--chip-bg); border: .06em solid var(--chip-line); border-radius: 50%; }
.chip-thought > .d1 { width: .3em; height: .3em; left: 20%; top: calc(100% + .06em); }
.chip-thought > .d2 { width: .17em; height: .17em; left: calc(20% - .2em); top: calc(100% + .38em); }

/* 레트로 블록: 굵은 선 + 두꺼운 딱딱한 그림자 */
.chip-retro-block { background: var(--chip-bg); border: .07em solid var(--chip-line); border-radius: .08em; padding: var(--pt, 0.18em) var(--pr, .4em) var(--pb, 0.18em) var(--pl, .4em);
  box-shadow: .13em .13em 0 var(--chip-line); }

/* 붓 밑줄: 글자 아래쪽 절반에 붓 자국 */
.chip-brush-under { padding: var(--pt, 0.1em) var(--pr, .15em) var(--pb, 0.1em) var(--pl, .15em); }
.chip-brush-under > .d1 { display: block; left: -.15em; right: -.15em; top: 48%; bottom: -.04em; background: var(--chip-bg); z-index: 0;
  -webkit-mask: url(chips/brush.svg?v=20261127081316) center / 100% 100% no-repeat; mask: url(chips/brush.svg?v=20261127081316) center / 100% 100% no-repeat; }
