/* 대결 모드(duel.js·duel-fx.js): 대결 창 · 받은 초대 · 승패 · 판 위 점수 띠 · VS 연출 · 우사기 소동 흔들기 */
.social-head h3 { white-space: nowrap; }
.duel-open { flex: none; white-space: nowrap; margin-left: auto; background: #efe2ff; border-color: #7a3fb0; color: #5a2a8a; }
.duel-dlg { width: min(360px, calc(100vw - 32px)); }
.duel-list { list-style: none; margin: 0 0 8px; padding: 0; max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.duel-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 1.5px solid #e2d5c7; border-radius: 12px; padding: 6px 10px; }
.duel-list li.empty { display: block; color: var(--muted); font-size: 0.85rem; text-align: center; border-style: dashed; }
.duel-list .nm { font-family: var(--display); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-list .nm small { font: 0.7rem var(--body); color: var(--muted); margin-left: 6px; }
.duel-msg { min-height: 1.3em; font-family: var(--display); color: #7a3fb0 !important; }
.duel-dlg .row { display: flex; gap: 8px; justify-content: center; }
.duel-dlg .row .btn { flex: 1; }
.duel-dlg .row .btn[hidden] { display: none; }

/* 받은 초대: 판을 가리지 않게 화면 위쪽에 뜨는 모달 아닌 창 */
.duel-invite[open] { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); margin: 0; z-index: 60; animation: duelDrop .45s cubic-bezier(.3,1.6,.5,1); border-color: #7a3fb0; box-shadow: 0 5px 0 #7a3fb0; }
@keyframes duelDrop { from { transform: translate(-50%, -40px) scale(.9); opacity: 0 } to { transform: translateX(-50%); opacity: 1 } }
.duel-from { display: flex; align-items: center; gap: 10px; text-align: left; }
.duel-from canvas { width: 80px; height: 80px; flex: none; animation: duelHop 0.9s ease-in-out infinite; }
.duel-from h2 { font-size: 1.1rem; }
.duel-from p { margin: 0; }
.duel-ttl { height: 6px; border-radius: 99px; background: #eadcf7; margin: 10px 0 12px; overflow: hidden; }
.duel-ttl i { display: block; height: 100%; background: #7a3fb0; transform-origin: left; }

/* 승패 */
.duel-res { display: flex; justify-content: center; gap: 14px; margin: 6px 0 10px; }
.duel-res .col { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: 14px; border: 2px solid transparent; }
.duel-res .col.win { border-color: #e9a614; background: linear-gradient(180deg, rgba(255,217,90,.35), transparent); }
.duel-res canvas { width: 90px; height: 90px; }
.duel-res .col.win canvas { animation: duelHop 0.8s ease-in-out infinite; }
.duel-res b { font: 0.95rem var(--display); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-res span { font: 1.15rem var(--display); font-variant-numeric: tabular-nums; }
.duel-result h2 { color: #7a3fb0; }

/* 판 위 점수 띠: 나(초록) · 상대(보라). 들판 맨 위 하늘(목표 알약 아래·첫 줄 구멍 위)에 — 아래에 두면 폰에서 맨 아래 줄 구멍을 가림(10/2 사파리) */
.duel-hud { position: absolute; left: 50%; top: 8.4%; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 8px; background: rgba(255,249,239,.94);
  border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; font-family: var(--display); font-size: 0.9rem; white-space: nowrap; pointer-events: none; max-width: calc(100% - 16px); }
.duel-hud[hidden] { display: none; }
.duel-hud em { font-style: normal; font-variant-numeric: tabular-nums; }
.duel-hud .me { color: #3d7a3a; }
.duel-hud .hp { color: #e0453f; font-size: 0.8rem; letter-spacing: -1px; }  /* 내 하트(ghost.js가 #hearts를 따라 씀): 대결 땐 들판이 화면 맨 위로 올라가 위쪽 하트 칸이 안 보임 */
.duel-hud .hp .lost { opacity: .25; }
.duel-hud .opp { color: #7a3fb0; }
.duel-hud .opp b { max-width: 6.5em; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }
.duel-hud .bar { width: 64px; height: 8px; border-radius: 99px; background: #b48ad8; overflow: hidden; border: 1.5px solid var(--ink); }
.duel-hud .bar i { display: block; height: 100%; background: var(--leaf); transform-origin: left; transition: transform .35s ease-out; }

/* 우사기 소동: 들판 3초 흔들기 */
.stage.duel-shake { animation: duelShake .12s linear infinite; }
@keyframes duelShake { 0% { transform: translate(0, 0) rotate(0) } 25% { transform: translate(-5px, 2px) rotate(-.6deg) } 50% { transform: translate(4px, -3px) rotate(.5deg) } 75% { transform: translate(-3px, -1px) rotate(-.3deg) } 100% { transform: translate(0, 0) } }

/* VS 연출 */
.vs-ov { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; gap: clamp(6px, 3vw, 40px); overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #9b5fd0 0, #5a2a8a 45%, #2a1440 100%); animation: vsFade .3s ease-out; }
.vs-ov::before { content: ""; position: absolute; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.08) 0 8deg, transparent 8deg 20deg); animation: vsSpin 14s linear infinite; }
@keyframes vsFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes vsSpin { to { transform: rotate(360deg) } }
.vs-side { position: relative; display: flex; flex-direction: column; align-items: center; width: min(33vw, 260px); min-width: 0; }
.vs-side.left { animation: vsInL .55s .45s both cubic-bezier(.2,1.4,.4,1); }
.vs-side.right { animation: vsInR .55s .45s both cubic-bezier(.2,1.4,.4,1); }
@keyframes vsInL { from { transform: translateX(-70vw) } to { transform: none } }
@keyframes vsInR { from { transform: translateX(70vw) } to { transform: none } }
.vs-fig { width: min(31vw, 220px); height: auto; aspect-ratio: 1; transform-origin: 50% 100%; animation: vsBounce .62s 1s ease-in-out infinite; }
.vs-side.right .vs-fig { animation-delay: 1.31s; }
@keyframes vsBounce { 0%, 100% { transform: scale(1.12, .86) } 35% { transform: scale(.9, 1.12) translateY(-14%) } 60% { transform: scale(1.02, .98) translateY(-4%) } }
.vs-name { font: clamp(1rem, 4vw, 1.6rem) var(--display); color: #fff; background: rgba(0,0,0,.35); border: 2px solid #fff; border-radius: 999px; padding: 2px 14px; margin-top: 4px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-sweat { position: absolute; top: 18%; right: 14%; width: 14px; height: 20px; background: #8fd3ff; border: 2px solid var(--ink); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; animation: vsDrip 1.1s 1.1s ease-in infinite both; }
.vs-side.right .vs-sweat { right: auto; left: 14%; }
@keyframes vsDrip { 0% { transform: translateY(0) scale(.4); opacity: 0 } 20% { opacity: 1; transform: translateY(0) scale(1) } 100% { transform: translateY(40px) scale(.8); opacity: 0 } }
.vs-spark { position: absolute; top: 6%; left: 18%; width: 22px; height: 22px; background: #ffe066; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: vsTwinkle .9s 1s ease-in-out infinite both; }
.vs-side.right .vs-spark { left: auto; right: 18%; animation-delay: 1.35s; }
@keyframes vsTwinkle { 0%, 100% { transform: scale(.3) rotate(0); opacity: .2 } 50% { transform: scale(1.2) rotate(45deg); opacity: 1 } }
.vs-mid { position: relative; z-index: 1; font: clamp(3rem, 14vw, 7rem) var(--display); color: #ffe066; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink); animation: vsSlam .45s cubic-bezier(.2,1.8,.4,1) both, vsWobble .5s .45s ease-out; min-width: 1.3em; text-align: center; flex: none; }
@keyframes vsSlam { from { transform: scale(4) rotate(-12deg); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes vsWobble { 0%, 100% { transform: none } 30% { transform: rotate(-6deg) scale(1.08) } 60% { transform: rotate(4deg) } }
.vs-mid.count { color: #fff; }
.vs-mid.pop { animation: vsSlam .35s cubic-bezier(.2,1.8,.4,1) both; }
.vs-mid.go { color: #7fd078; animation: vsSlam .3s both; }
/* VS 화면 위쪽 공격 아이템 안내(아래쪽은 전적 이야기 .vs-story) */
.vs-tip { position: absolute; left: 50%; top: max(7%, 48px); transform: translateX(-50%); z-index: 2; width: min(92vw, 520px); display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center; color: #fff; animation: vsFade .4s .9s both; }
.vs-tip b { font: clamp(1rem, 4.4vw, 1.35rem) var(--display); font-weight: 400; color: #fff; background: #7a3fb0; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 14px; }
.vs-tip span { font: clamp(.78rem, 3.2vw, .95rem) var(--display); background: rgba(0,0,0,.35); border-radius: 999px; padding: 2px 12px; }
@keyframes duelHop { 0%, 100% { transform: translateY(0) scale(1.04, .96) } 50% { transform: translateY(-8%) scale(.97, 1.04) } }
@media (prefers-reduced-motion: reduce) {
  .vs-ov::before, .vs-fig, .vs-sweat, .vs-spark, .duel-from canvas, .duel-res .col.win canvas { animation: none; }
  .vs-side.left, .vs-side.right { animation-duration: .01s; }
}

/* 랭킹에서 바로 대결(rank-duel.js): 접속한 사람 옆 「대결」 버튼 · 겨루는 중 표시 · 지금 겨루는 짝 띠 */
#rankList li { grid-template-columns: 26px minmax(0, 1fr) auto auto; }
#rankList li .pt { grid-column: 4; }
#rankList li .duel-go, #rankList li .duel-busy { grid-column: 3; }
.duel-go { padding: 1px 8px; font-size: 0.72rem; background: #efe2ff; border-color: #7a3fb0; color: #5a2a8a; white-space: nowrap; }
.duel-busy { font: 0.68rem var(--display); color: #fff; background: #7a3fb0; border-radius: 999px; padding: 1px 7px; white-space: nowrap; animation: duelPulse 1.2s ease-in-out infinite; }
.podium .duel-go, .podium .duel-busy { margin: 1px 0 4px; }
@keyframes duelPulse { 50% { opacity: .65; } }
.duel-now { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 2px; padding: 5px 10px; border-radius: 10px; background: #f4ecff; border: 1.5px dashed #b48ae0; font-size: 0.78rem; color: #5a2a8a; }
.duel-now .vs b { font-family: var(--display); font-weight: 400; }
.duel-now .vs::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7a3fb0; margin-right: 6px; vertical-align: 1px; animation: duelPulse 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .duel-busy, .duel-now .vs::before { animation: none; } }

/* 단상 칭호는 점수 아래 줄(net.js renderPodium) */
.podium .ps { line-height: 1.25; text-align: center; }
.podium .ps small { font-size: 0.66rem; white-space: nowrap; }

/* 점수판 「최고 기록 자랑」(share.js) */
#bestShareBtn { display: block; background: #ffd6e2; margin: 6px auto 0; font-size: 0.78rem; padding: 3px 11px; box-shadow: 0 2px 0 var(--ink); }

/* 대결 승률 랭킹 탭(duel-rank.js): 켜면 점수 랭킹(단상·목록·명예의 전당)을 숨김 */
#duelRankList, p.duel-rank-empty { display: none; }  /* index.html .rank(display:flex)보다 우선하게 id로 */
.duel-scope #duelRankList { display: flex; }
.duel-scope p.duel-rank-empty:not([hidden]) { display: block; }
.duel-scope #rankPodium, .duel-scope #rankList, .duel-scope #rankEmpty, .duel-scope #hall { display: none !important; }
#duelRankList li { grid-template-columns: 26px minmax(0, 1fr) auto auto; }
#duelRankList li .pt { grid-column: 4; color: #5a2a8a; }
#duelRankList li .duel-go, #duelRankList li .duel-busy { grid-column: 3; }
#duelRankList li.unranked { opacity: .7; }
#scopeDuel[aria-pressed="true"] { background: #7a3fb0; color: #fff; }

/* 1~3등 입장 효과(enter.js): 채팅에 금·은·동 입장 줄, 1등은 반짝이는 배너 */
#chatLog li.enter { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; border: 2px solid var(--ink); position: relative; overflow: hidden; animation: enterIn .6s cubic-bezier(.3,1.6,.5,1); }
#chatLog li.enter .enter-fig { width: 42px; height: 42px; flex: none; animation: duelHop 0.9s ease-in-out infinite; }
#chatLog li.enter .enter-txt { display: flex; flex-direction: column; min-width: 0; }
#chatLog li.enter b { margin: 0; font-size: 0.86rem; }
#chatLog li.enter small { font-size: 0.7rem; opacity: .8; }
#chatLog li.enter-r1 { background: linear-gradient(135deg, #fff2b8, #ffd95a 55%, #f4bf3a); color: #5a3a00; box-shadow: 0 0 0 3px rgba(255,217,90,.45); }
#chatLog li.enter-r2 { background: linear-gradient(135deg, #ffffff, #e3e8ee 55%, #b9c2cc); color: #39424d; }
#chatLog li.enter-r3 { background: linear-gradient(135deg, #fde3cc, #f3c39a 55%, #d39a66); color: #4d2a10; }
#chatLog li.enter::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.75) 50%, transparent 65%); transform: translateX(-100%); animation: enterShine 2.2s ease-in-out 0.3s 3; pointer-events: none; }
@keyframes enterIn { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes enterShine { to { transform: translateX(100%); } }
.shout.shout-gold { background: linear-gradient(135deg, #fff2b8, #ffd95a, #f4bf3a); box-shadow: 0 4px 0 var(--ink), 0 0 18px rgba(255,200,60,.8); }
@media (prefers-reduced-motion: reduce) { #chatLog li.enter, #chatLog li.enter .enter-fig, #chatLog li.enter::after { animation: none; } }

/* 왼쪽 아래 떠 있는 「제보하기」 버튼(report.js). PC는 왼쪽 칸 아래가 비어 있고, 폰은 채팅 입력칸이 보이면 숨김 */
.report-fab { position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 40; border: 2px solid var(--ink); border-radius: 999px; background: #ffe0c7; color: #7a3410; font: 0.9rem var(--display); padding: 8px 16px; box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
.report-fab:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.report-fab[hidden] { display: none; }

/* 상대 들판 미리보기(duel-view.js): 판 왼쪽 위(구멍 위 빈 하늘 자리) */
.duel-view { position: absolute; left: 10px; top: 10px; z-index: 4; display: flex; flex-direction: column; gap: 2px; padding: 4px; background: rgba(255,249,239,.94); border: 2px solid #7a3fb0; border-radius: 12px; box-shadow: 0 3px 0 #7a3fb0; pointer-events: none; }
.duel-view[hidden] { display: none; }
.duel-view .lbl { font: 0.72rem var(--display); color: #5a2a8a; max-width: 176px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-view canvas { width: 176px; height: 128px; border-radius: 8px; }
/* 폰 세로(.below, duel-view.js): 들판 바깥 아래 가운데. 폰 가로: 들판 왼쪽 위에 작게. 둘 다 누르면 이름표만 남게 접힘 */
.stagewrap.has-dview { position: relative; }
.duel-view.below { left: 50%; top: calc(100% + 6px); transform: translateX(-50%); z-index: 30; opacity: 1; }
@media (max-width: 899px) { .duel-view.below canvas { width: 150px; height: 109px; } .duel-view.below .lbl { font-size: 0.72rem; max-width: 150px; } }
@media (max-width: 899px) {
  .duel-view { left: 5px; top: 5px; padding: 2px; gap: 1px; border-width: 1.5px; border-radius: 9px; box-shadow: 0 2px 0 #7a3fb0; pointer-events: auto; cursor: pointer; opacity: .92; }
  .duel-view canvas { width: 84px; height: 61px; border-radius: 6px; }
  .duel-view .lbl { font-size: 0.58rem; max-width: 84px; }
  .duel-view .lbl::after { content: " ▴"; }
  .duel-view.mini canvas { display: none; }
  .duel-view.mini .lbl::after { content: " ▾"; }
}

/* 판돈(duel-bet.js) */
.bet-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.bet-pick > span { font: 0.9rem var(--display); }
.bet-pick .seg { flex: 1; min-width: 0; }
.bet-pick .seg button { flex: 1; min-width: 0; padding: 4px 0; }
.bet-tip { flex-basis: 100%; font-size: 0.74rem; color: var(--muted); }
.bet-line { font: 0.9rem var(--display); color: #8a5a00 !important; background: #fff4c9; border: 1.5px solid #e9a614; border-radius: 10px; padding: 4px 10px; margin: 8px 0 0 !important; }
.bet-line[hidden] { display: none; }

/* 구경하기(duel-watch.js) */
.watch-go { padding: 1px 8px; font-size: 0.7rem; margin-left: 6px; background: #fff; border-color: #7a3fb0; color: #5a2a8a; }
button.duel-busy { border: 0; cursor: pointer; font: 0.68rem var(--display); }
.update-dlg.watch-dlg { width: min(560px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto; }
.w-head { display: flex; align-items: center; justify-content: center; gap: 10px; }
.w-head h2 { margin: 0; }
.w-time { font: 1rem var(--display); color: #7a3fb0; font-variant-numeric: tabular-nums; }
.w-bet { font: 0.85rem var(--display); color: #8a5a00 !important; margin: 4px 0 !important; }
.w-row { display: flex; align-items: flex-start; justify-content: center; gap: 6px; margin: 8px 0; }
.w-side { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; border-radius: 14px; border: 2px solid transparent; transition: border-color .3s, background .3s; }
.w-side.lead { border-color: #b48ad8; background: #f6efff; }
.w-side.win { border-color: #e9a614; background: linear-gradient(180deg, rgba(255,217,90,.35), transparent); }
.w-top { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.w-top canvas { width: 40px; height: 40px; flex: none; }
.w-top b { font: 0.9rem var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-score { font: 1.3rem var(--display); font-variant-numeric: tabular-nums; }
.w-field { width: 100%; max-width: 220px; aspect-ratio: 220 / 160; height: auto; border-radius: 10px; border: 2px solid #7a3fb0; background: #a9d58e; }
.w-vs { font: 1.3rem var(--display); color: #7a3fb0; align-self: center; }
.w-bar { height: 10px; border-radius: 99px; background: #b48ad8; overflow: hidden; border: 1.5px solid var(--ink); margin: 0 6px 6px; }
.w-bar i { display: block; height: 100%; background: var(--leaf); transform-origin: left; transform: scaleX(.5); transition: transform .35s ease-out; }
.w-res { font: 1.05rem var(--display); color: #7a3fb0 !important; min-height: 1.3em; text-align: center; }
.watch-dlg > .btn { width: 100%; }
/* 선수 화면 구경꾼 줄: 들판 오른쪽 위 하늘 칸(구멍을 가리지 않게 작게) */
.watchers { position: absolute; right: 6px; top: 6px; z-index: 4; display: flex; align-items: center; gap: 2px; background: rgba(255,249,239,.92); border: 1.5px solid #7a3fb0; border-radius: 999px; padding: 1px 8px 1px 6px; pointer-events: none; max-width: 46%; }
.watchers[hidden] { display: none; }
.watchers .w-lbl { font: 0.66rem var(--display); color: #5a2a8a; white-space: nowrap; margin-right: 2px; }
.watchers .w-who { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.watchers .w-who canvas { width: 24px; height: 24px; }
.watchers .w-who small { font: 0.5rem var(--display); max-width: 3.6em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -2px; }
.watchers .w-more { font: 0.62rem var(--display); color: #5a2a8a; }
