/* 총선 대결 전용 화면(js/asm-arena.js): #sheet에 arena가 붙으면 아래 창이 화면 가득 어두운 무대가 된다.
   안쪽 부품(버튼·대결판 칸·개표 줄)은 색 이름만 바꿔 어두운 무대에 맞춘다. 등장 연출 시각은 js/asm-arena.js 소리 시각과 같다. */
.sheet.arena { align-items: stretch; padding: 0; background: #07070B; animation: none; }
.sheet.arena .sheet-card {
  --card: #17171F; --ink: #F4F1EA; --muted: rgba(244,241,234,.62); --line: rgba(255,255,255,.14); --soft: rgba(255,255,255,.07);
  --good: #3CC67A; --bad: #FF5A47; --ar-red: #FF3B2F; --ar-gold: #F5C542;
  --pb-bg: #23232D; --pb-ink: #F4F1EA; --pb-line: #000; --pb-hi: #353542; --pb-lo: #121218; --acc: #E5352A; --pb-acc-hi: #FF7A66; --pb-acc-lo: #8E1710;   /* 픽셀 버튼(index.html)도 어두운 무대 색으로 */
  max-width: none; max-height: none; height: 100%; border-radius: 0; box-shadow: none; color: var(--ink);
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background:   /* 보스전 무대(10/30 시안 C, Codex 도트): 초록 조명의 내 단상과 빨간 조명의 상대 단상. 볼거리는 위쪽, 대결판 칸이 올라가는 아래는 어둡게 누른다 */
    linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.05) 30%, rgba(0,0,0,.35) 48%, rgba(0,0,0,.55) 100%),
    url(../assets/elect/duel-stage.webp) top center / 100% auto no-repeat,
    #0B0B0D;
  animation: arIn .35s ease-out;
}
@media (min-width: 760px) { .sheet.arena .sheet-card { background-size: auto, 760px auto, auto; } }   /* 넓은 화면: 그림은 가운데 760px, 양옆은 같은 어두운 색 */
.sheet.arena .sheet-card > *, .sheet.arena .choices > .choice { animation: none; }
.ar { max-width: 720px; margin: 0 auto; position: relative; }
@keyframes arIn { from { opacity: 0; transform: scale(1.03); } }

/* 위 띠: 대수·남은 날, 나가기 */
.ar-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; text-shadow: 0 1px 2px #000; }
.ar-x { font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.ar-head { text-align: center; margin: 4px 0 6px; }
.ar-head .kicker { background: var(--ar-red); }
.ar-head h2 { font: var(--hw) clamp(28px, 7vw, 40px) var(--head); letter-spacing: -.02em; margin: 6px 0 0; text-shadow: 0 3px 0 rgba(0,0,0,.5); }
.ar-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin: 0 auto 10px; width: fit-content; max-width: 100%; padding: 5px 14px; border-radius: 999px; background: rgba(0,0,0,.55); font-size: 12.5px; color: rgba(244,241,234,.78); text-shadow: 0 1px 2px #000; }   /* 무대 조명 위에서도 읽히게 반투명 띠 */
.ar-stats b { color: var(--ink); }

/* 내 국회 VS 상대 */
.ar-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 6px; margin: 4px 0 12px; padding: 10px 8px 12px; border-radius: 16px;
  background: linear-gradient(90deg, rgba(60,198,122,.16), transparent 42%, transparent 58%, rgba(255,59,47,.2)); border: 1px solid var(--line); }
.ar-side { display: grid; justify-items: center; gap: 2px; min-width: 0; text-align: center; }
.ar-side b { font: var(--hw) 15px var(--head); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-side small { font-size: 11.5px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-side em { font-style: normal; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; color: var(--ar-red); }
.ar-side.them { position: relative; }
.ar-side.them em { position: absolute; z-index: 1; top: 80px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,.6); }   /* '다음 상대'는 실루엣 몸에 겹친다(줄을 따로 차지하면 상대 칸만 높아져 실루엣이 상자 위로 넘쳤다) */
.ar-fig { line-height: 0; height: 106px; display: flex; align-items: flex-end; }   /* 72px 캐릭터 그림(높이 105px)이 칸 밖으로 넘치지 않게 */
.ar-fig.boss svg { transform: scaleX(-1); filter: brightness(.12) drop-shadow(0 0 1px var(--ar-red)) drop-shadow(0 0 8px rgba(255,59,47,.7)); }   /* 아직 정체를 모르는 상대: 실루엣 */
.ar-vs-mark { font: italic 900 34px var(--head); color: var(--ar-gold); text-shadow: 3px 3px 0 var(--ar-red), 0 0 18px rgba(245,197,66,.5); align-self: center; transform: skewX(-8deg); }

/* 대결판 */
.ar-board .asm-board { gap: 8px; }
.ar-board .asm-slot { padding: 10px; border-radius: 12px; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); transition: transform .12s, border-color .12s; }
.ar-board .asm-slot:active { transform: scale(.97); }
.ar-board .asm-slot b { font-size: 14px; }
.ar-board .asm-slot.hot { border-color: var(--ar-red); box-shadow: inset 0 0 0 1px var(--ar-red), 0 0 12px rgba(255,59,47,.25); }
.ar-board .asm-fill, .ar-board .note { color: var(--muted); }
.ar-go [data-v="go"] { font-size: 19px; min-height: 60px; animation: arPulse 1.6s ease-in-out infinite; }
.ar-go [data-v="go"]:disabled { animation: none; filter: saturate(.4); }
@keyframes arPulse { 50% { filter: brightness(1.18) drop-shadow(0 0 14px rgba(255,59,47,.7)); } }

/* 공천 고르기: 대결판 위 작은 창 */
.ar-behind { filter: blur(1.5px) brightness(.55); pointer-events: none; user-select: none; }
.ar-dim { position: fixed; inset: 0; z-index: 1; background: rgba(0,0,0,.45); cursor: pointer; }
.ar-drawer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; width: min(640px, 100%); margin: 0 auto; max-height: 72vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px rgba(0,0,0,.6); }
.sheet.arena .sheet-card > .ar-drawer { animation: up .22s ease-out; }

/* ── 개표 ── */
.ar-count { --me: #2FB868; --them: #F0473A; }
.ar-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 6px 0 8px; }
.ar-score .ar-side b { font-size: 14px; }
.ar-score .ar-side.me b { color: color-mix(in srgb, var(--me) 55%, #fff); } .ar-score .ar-side.them b { color: color-mix(in srgb, var(--them) 55%, #fff); }
.ar .asm-tally { font: 900 clamp(48px, 14vw, 72px) var(--head); margin: 0; gap: 12px; letter-spacing: -.03em; }
.ar .asm-tally .me { color: #fff; text-shadow: 0 0 0 transparent, 0 4px 0 color-mix(in srgb, var(--me) 70%, #000); }
.ar .asm-tally .them { color: #fff; text-shadow: 0 4px 0 color-mix(in srgb, var(--them) 70%, #000); }
.ar .asm-tally span { font-size: .5em; color: var(--muted); }
/* 줄다리기: 가운데 선을 넘으면 과반 */
.ar-tug { position: relative; height: 12px; border-radius: 999px; background: var(--soft); overflow: hidden; margin: 0 0 6px; }
.ar-tug i { position: absolute; top: 0; bottom: 0; width: 0; transition: width .5s cubic-bezier(.2,.9,.3,1.2); }
.ar-tug .me { left: 0; background: var(--me); } .ar-tug .them { right: 0; background: var(--them); }
.ar-tug::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: #fff; opacity: .8; }
.ar-tug span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 0; }
.ar .asm-live { background: rgba(0,0,0,.4); border: 1px solid var(--line); font-size: 14px; font-weight: 700; min-height: 2.4em; }

/* 개표 칸: 줄 목록을 3×3 판으로 */
.ar .asm-count { grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.ar .asm-count li { display: grid; grid-template-columns: 1fr; gap: 3px; padding: 9px 8px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 12px; text-align: center; min-width: 0; position: relative; transition: opacity .3s, filter .3s, transform .3s; }
.ar .asm-count li > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar .asm-count .asm-reg { font: var(--hw) 13px var(--head); display: grid; } .ar .asm-count .asm-reg small { font: 500 10px var(--body); color: var(--muted); }
.ar .asm-count .asm-c.me { order: 2; } .ar .asm-count .asm-bar { order: 3; } .ar .asm-count .asm-c.them { order: 4; color: var(--muted); }
.ar .asm-count .asm-bar { height: 16px; position: relative; border-radius: 6px; background: color-mix(in srgb, var(--them) 55%, #222); overflow: hidden; }
.ar .asm-count .asm-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--me) !important; }
.ar .asm-count .asm-bar b { position: absolute; inset: 0; font-size: 11px; line-height: 16px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.ar .asm-count li.wait { opacity: .35; filter: grayscale(1); }
.ar .asm-count li.open.win { border-color: var(--me); box-shadow: inset 0 0 0 1px var(--me), 0 0 16px color-mix(in srgb, var(--me) 40%, transparent); animation: arFlip .45s ease-out both; }
.ar .asm-count li.open.lose { border-color: var(--them); box-shadow: inset 0 0 0 1px var(--them); animation: arFlip .45s ease-out both; }
.ar .asm-count li.open.win .asm-reg { color: color-mix(in srgb, var(--me) 50%, #fff); } .ar .asm-count li.open.lose .asm-reg { color: color-mix(in srgb, var(--them) 50%, #fff); }
@keyframes arFlip { 0% { transform: rotateY(90deg) scale(.96); } 100% { transform: none; } }
/* 마지막 두 곳: 다른 칸은 어둡게, 이 칸에 조명 */
.ar-tense .asm-count li:not(.spot) { opacity: .4; }
.ar .asm-count li.spot { opacity: 1; filter: none; transform: scale(1.08); z-index: 1; border-color: var(--ar-gold); box-shadow: 0 0 0 2px var(--ar-gold), 0 0 30px rgba(245,197,66,.5); }
.ar-tense .ar-tug { box-shadow: 0 0 0 1px var(--ar-gold); }

/* 결과 */
.ar .asm-stamp { left: 50%; right: auto; top: 128%; z-index: 3; white-space: nowrap; font-size: 30px; border-width: 5px; padding: 2px 18px; background: rgba(11,11,16,.85); transform: translate(-50%, -50%) rotate(-10deg); animation: arStamp .5s cubic-bezier(.2,.9,.3,1.2) both; }
.ar .asm-stamp.big { font-size: 36px; }
.ar .asm-stamp:not(.bad) { color: var(--ar-gold); text-shadow: 0 0 18px rgba(245,197,66,.6); }
.ar .asm-stamp.bad { color: #9A9AA6; }
@keyframes arStamp { 0% { transform: translate(-50%, -50%) rotate(-10deg) scale(3); opacity: 0; } 100% { transform: translate(-50%, -50%) rotate(-10deg) scale(1); opacity: 1; } }
.ar-won .ar-head h2 { color: var(--ar-gold); text-shadow: 0 3px 0 #8E5A00, 0 0 24px rgba(245,197,66,.45); }
.ar-lost .ar-head h2 { color: #B9B9C4; }
.ar-won::before { content: ''; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(60% 40% at 50% 20%, rgba(245,197,66,.35), transparent 70%); animation: arGlow 1.6s ease-out both; }
@keyframes arGlow { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: .5; } }
.ar .asm-after { text-align: center; }
.ar-count:has(.asm-stamp) .asm-live { visibility: hidden; }   /* 도장이 마지막 중계 줄 자리에 찍힌다 */
.ar .choices small { font-size: 12px; opacity: .8; margin-left: 4px; }

/* ── 등장: 제N대 총선 → 쟁점 → 내 국회 VS 상대(2.7초) ── */
.ar-intro { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: #050508; overflow: hidden; pointer-events: none; animation: arOut .4s ease-in 3s both; }
.ar-intro .ar-i1, .ar-intro .ar-i2 { position: absolute; left: 0; right: 0; text-align: center; margin: 0; font: 900 clamp(34px, 10vw, 60px) var(--head); color: #fff; letter-spacing: -.02em; }
.ar-intro .ar-i1 { top: 38%; animation: arSlideL 1.05s cubic-bezier(.2,.9,.3,1) .05s both; }
.ar-intro .ar-i2 { top: 52%; font-size: clamp(20px, 6vw, 32px); color: var(--ar-gold); animation: arSlideR 1s cubic-bezier(.2,.9,.3,1) .5s both; }
.ar-i-vs { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; }
.ar-i-vs .l, .ar-i-vs .r { display: grid; gap: 6px; padding: 0 18px; min-width: 0; }
.ar-i-vs .l { align-content: start; padding-top: 9vh; } .ar-i-vs .r { align-content: end; padding-bottom: 9vh; }   /* 대각선으로: 내 이름은 위, 상대 이름은 아래(가운데 VS와 안 겹치게) */
.ar-i-vs .l { background: linear-gradient(110deg, var(--pme) 0%, color-mix(in srgb, var(--pme) 45%, #000) 100%); text-align: left; clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%); animation: arPanelL .35s cubic-bezier(.2,.9,.3,1) 1.15s both; }
.ar-i-vs .r { background: linear-gradient(250deg, var(--pthem) 0%, color-mix(in srgb, var(--pthem) 45%, #000) 100%); text-align: right; clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%); margin-left: -12%; animation: arPanelR .35s cubic-bezier(.2,.9,.3,1) 1.15s both; }
.ar-i-vs b { font: 900 clamp(20px, 5.6vw, 40px) var(--head); line-height: 1.15; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.45); overflow-wrap: anywhere; }
.ar-i-vs small { font-size: 13px; color: rgba(255,255,255,.8); }
.ar-i-vs .v { position: absolute; z-index: 2; left: 50%; top: 50%; font: italic 900 clamp(64px, 20vw, 120px) var(--head); color: var(--ar-gold); text-shadow: 5px 5px 0 #000, 0 0 40px rgba(245,197,66,.8); animation: arSlam .4s cubic-bezier(.2,.9,.3,1.3) 1.45s both; }
@keyframes arSlideL { 0% { transform: translateX(-110%); } 25%, 70% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(8%); opacity: 0; } }
@keyframes arSlideR { 0% { transform: translateX(110%); } 25%, 70% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(-8%); opacity: 0; } }
@keyframes arPanelL { from { transform: translateX(-100%); } }
@keyframes arPanelR { from { transform: translateX(100%); } }
@keyframes arSlam { 0% { transform: translate(-50%, -50%) scale(4) skewX(-8deg); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1) skewX(-8deg); opacity: 1; } }
@keyframes arOut { to { opacity: 0; visibility: hidden; } }

@media (min-width: 760px) {
  .sheet.arena { padding: 0; align-items: stretch; }
  .sheet.arena .sheet-card { padding: 18px 28px 32px; }
  .ar .asm-count li { font-size: 13px; padding: 12px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet.arena .sheet-card, .ar-go [data-v="go"], .ar .asm-count li.open, .ar .asm-stamp, .ar-won::before { animation: none; }
  .ar .asm-count li.spot { transform: none; }
}
.ar-drawer .asm-tags em { white-space: nowrap; }

/* ── 개표 방송(js/asm-arena-count.js): 9곳이 한꺼번에, 앞서는 쪽 색으로 테두리가 흔들리다 끝나면 굳는다 ── */
.ar .asm-count li.live { opacity: 1; filter: none; }
.ar .asm-count li.live.me { border-color: color-mix(in srgb, var(--me) 60%, transparent); }
.ar .asm-count li.live.them { border-color: color-mix(in srgb, var(--them) 60%, transparent); }
.ar .asm-count li.live.me .asm-reg { color: color-mix(in srgb, var(--me) 45%, #fff); } .ar .asm-count li.live.them .asm-reg { color: color-mix(in srgb, var(--them) 45%, #fff); }
.ar .asm-count li.live .asm-c.them { visibility: visible; }
.ar .asm-count .asm-bar i { transition: none; }
.ar .asm-count .ar-pr { order: 5; font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.ar .asm-count li.flip { animation: arJolt .35s ease-out; }
@keyframes arJolt { 30% { transform: scale(1.06); filter: brightness(1.4); } }
.ar-skip { display: block; margin: 0 auto 10px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.ar-count .asm-tally b { display: inline-block; min-width: .62em; text-align: center; }

/* 도장 그림(js/asm-show.js asmStamp): 점수판 아래에 쾅. 꾸미기 잉크는 css/cos.css의 .cos-stampw가 그대로 칠한다 */
.ar-score { position: relative; } .ar-count .asm-tally { position: static; }   /* 도장은 점수판 전체 기준으로 */
.ar .asm-stamp-img { position: absolute; left: 83%; top: 62%; z-index: 3; width: clamp(108px, 30vw, 150px); height: auto; aspect-ratio: 1; right: auto; transform: translate(-50%, -50%) rotate(-12deg); pointer-events: none;
  animation: arStampImg .5s cubic-bezier(.2,.9,.3,1.2) .15s both; }
.ar img.asm-stamp-img { filter: drop-shadow(0 4px 10px rgba(0,0,0,.55)); }   /* 꾸미기 잉크(.st-gold 등)는 제 그림자를 쓴다 */
.ar .asm-stamp-img.bad { opacity: .92; left: 17%; }   /* 석패는 내 쪽에 */
@keyframes arStampImg { 0% { transform: translate(-50%, -50%) rotate(-12deg) scale(2.6); opacity: 0; } 100% { transform: translate(-50%, -50%) rotate(-12deg) scale(1); opacity: 1; } }
/* 다른 언어판 글자 도장에도 꾸미기 잉크 */
.ar .asm-stamp.st-gold { color: #FFE58A; border-color: #E2A81F; text-shadow: 0 0 12px rgba(255,214,90,.8); }
.ar .asm-stamp.st-neon { color: #FFD6F6; border-color: #FF3FD8; text-shadow: 0 0 6px #FF3FD8, 0 0 16px #FF3FD8; box-shadow: 0 0 12px #FF3FD8; }
.ar .asm-stamp.st-holo { color: #fff; border-color: #B58CFF; text-shadow: 0 0 8px #5FE3FF, 0 0 16px #FF5FA2; }
@media (prefers-reduced-motion: reduce) { .ar .asm-stamp-img { animation: none; } }
.ar .asm-stamp.st-seal { color: #FF6A4A; border-color: #F2C744; text-shadow: 0 0 10px rgba(242,199,68,.7); }
