/* ─────────────────────────────────────────────
 * 한봇 진영 대전 (2026-11-12) — SPEC §8 디자인 토큰. 소재: 달밤 고갯마루 서낭당 앞마당의 도깨비 씨름판
 * 밤 솔숲 #1e3a33(배경) · 판 위 칸 #2b4f45 · 황토 모래판 #c9a36a(진영 칸·전투 바닥) · 청샅바 #3e78b8(내 편·선택)
 * · 홍샅바 #c9493c(상대 편·목숨·위험) · 금줄 볏짚 #e3c05a(엽전·승·강조)
 * 서체: 제목·승수·전투 결과만 도현(hb-games-display), 숫자 tabular-nums.
 * 시그니처(하나): 서낭당 금줄(.jy-rope) — 이길 때마다 오색 헝겊이 하나씩 매이고, 목숨은 줄 끝 도깨비불 다섯 개.
 * 판 화면이라 어두운 바탕 고정(data-theme-lock="dark") — 공용 변수만 이 범위에서 바꿔 끼운다.
 * 판 크기: --jy-cell(말 칸 한 변) · --jy-bcell(전투 칸) · --jy-bh(남은 높이)는 jinyeong-page.js fitBoard가 넣는다.
 * ───────────────────────────────────────────── */
.jy-root, .chat-fab, .chat-panel {
    --jy-pine: #1e3a33;
    --jy-pine-2: #2b4f45;
    --jy-sand: #c9a36a;
    --jy-blue: #3e78b8;
    --jy-red: #c9493c;
    --jy-straw: #e3c05a;
    --jy-ink: #f1ecdc;
    --jy-ink-dark: #2a241b;
    /* 파생 — 토큰에서만 섞는다 */
    --jy-pine-0: color-mix(in srgb, var(--jy-pine) 76%, #000);
    --jy-pine-3: color-mix(in srgb, var(--jy-pine-2) 80%, var(--jy-sand));
    --jy-sand-2: color-mix(in srgb, var(--jy-sand) 80%, var(--jy-ink-dark));
    --jy-line: color-mix(in srgb, var(--jy-sand) 20%, var(--jy-pine));
    --jy-line-2: color-mix(in srgb, var(--jy-sand) 38%, var(--jy-pine));
    /* 공용 변수 덮어쓰기 — 이 페이지 안에서만 */
    --brand: var(--jy-straw);
    --brand-rgb: 227, 192, 90;
    --brand-ink: var(--jy-ink-dark);
    --brand-tint: rgba(227, 192, 90, 0.12);
    --bg-base: var(--jy-pine);
    --bg-card: var(--jy-pine-2);
    --bg-elev: var(--jy-pine-3);
    --bg-input: var(--jy-pine-0);
    --bg-deep: var(--jy-pine-0);
    --text-main: var(--jy-ink);
    --text-sub: color-mix(in srgb, var(--jy-ink) 84%, var(--jy-pine));
    --text-dim: color-mix(in srgb, var(--jy-ink) 62%, var(--jy-pine));
    --border: var(--jy-line);
    --border-strong: var(--jy-line-2);
    --border-dim: color-mix(in srgb, var(--jy-sand) 12%, var(--jy-pine));
    --fg-rgb: 241, 236, 220;
}
.jy-root {
    --jy-cell: 110px;
    --jy-bcell: 96px;
    --jy-bh: 70vh;
    --jy-gap: 8px;
    background: var(--jy-pine);
    color: var(--text-sub);
    min-height: calc(100vh - var(--topbar-h, 0px));
}
.jy-root [hidden] { display: none !important; }
.jy-root :focus-visible, .chat-panel :focus-visible { outline: 2px solid var(--jy-straw); outline-offset: 2px; }
.jy-num { font-variant-numeric: tabular-nums; }
.jy-root .wrap { max-width: 98%; margin: 0 auto; padding: 10px 16px 90px; }
.jy-root .top-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.jy-root .page-title { font-family: "hb-games-display", var(--font-sans); font-weight: 400; color: var(--text-main); margin: 0; font-size: clamp(1.4rem, 1.1rem + 0.8vw, 2.2rem); }
.jy-root .page-sub { font-size: 0.78rem; color: var(--text-dim); }
.jy-mode { font-size: 0.76rem; color: var(--text-main); border: 1px solid var(--jy-blue); border-radius: 999px; padding: 3px 11px; }
.jy-mode.practice { border-color: var(--jy-straw); border-style: dashed; }
.jy-closed { display: none; font-size: 0.78rem; color: var(--jy-straw); border: 1px solid color-mix(in srgb, var(--jy-straw) 45%, transparent); border-radius: var(--radius); padding: 4px 12px; }
.jy-closed.show { display: inline-block; }
.jy-admin-link { margin-left: auto; }
.jy-root .back-btn { display: inline-flex; align-items: center; font-size: 0.82rem; color: var(--text-dim); text-decoration: none; padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.jy-root .back-btn:hover { color: var(--text-main); border-color: var(--border-strong); }
.jy-root .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 단추 — 주 행동은 볏짚색 */
.jy-root .big-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
    background: var(--jy-straw); border: 1.5px solid var(--jy-straw); border-radius: var(--radius);
    color: var(--jy-ink-dark); font-family: inherit; font-size: 0.95rem; font-weight: 800; padding: 10px 20px; cursor: pointer;
}
.jy-root .big-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--jy-straw) 86%, #fff); }
.jy-root .big-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.jy-root .mini-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--border-strong); border-radius: var(--radius-sm, 6px); color: var(--text-sub); font-family: inherit; font-size: 0.8rem; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.jy-root .mini-btn:hover:not(:disabled) { color: var(--text-main); border-color: var(--jy-straw); }
.jy-root .mini-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.jy-root .mini-btn.poor { opacity: 0.55; }
.jy-root .mini-btn[aria-pressed="true"] { color: var(--text-main); border-color: var(--jy-blue); background: color-mix(in srgb, var(--jy-blue) 30%, transparent); }
.jy-root .chip-btn { font-family: inherit; font-size: 0.78rem; color: var(--text-sub); background: transparent; border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 13px; cursor: pointer; }
.jy-root .chip-btn:hover { color: var(--text-main); }
.jy-root .chip-btn.on { color: var(--text-main); border-color: var(--jy-blue); background: color-mix(in srgb, var(--jy-blue) 32%, var(--bg-card)); font-weight: 700; }
.jy-root .filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.jy-root .title-chip { display: inline-block; white-space: nowrap; font-size: 0.7rem; padding: 1px 7px; margin-left: 6px; border-radius: 999px; background: rgba(var(--fg-rgb), 0.08); color: var(--text-sub); }
.jy-root tr.mine td { background: var(--brand-tint); color: var(--text-main); }
.jy-small { margin: 6px 0; font-size: 0.78rem; color: var(--text-dim); line-height: 1.6; }
.jy-h { margin: 0 0 6px; font-size: 0.82rem; font-weight: 800; color: var(--text-main); }
.jy-h small { margin-left: 6px; font-weight: 400; font-size: 0.74rem; color: var(--text-dim); }
.jy-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 12px; }
.jy-npc { display: inline-block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; color: var(--jy-ink-dark); background: var(--jy-straw); border-radius: 4px; padding: 1px 6px; margin-right: 6px; vertical-align: 1px; }
.jy-root kbd { font-family: inherit; font-size: 0.72rem; border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; color: var(--text-sub); }

/* ── 서낭당 금줄 (시그니처) ── */
.jy-rope { display: flex; align-items: center; gap: clamp(10px, 1.4vw, 28px); margin: 8px 0 6px; }
.jy-rope-line { position: relative; flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-start; height: clamp(40px, 3.2vw, 84px); padding: 0 1.5%; }
.jy-rope-line::before {
    content: ""; position: absolute; left: 0; right: 0; top: 4px; height: clamp(7px, 0.55vw, 14px); border-radius: 999px;
    background: repeating-linear-gradient(118deg, var(--jy-straw) 0 7px, color-mix(in srgb, var(--jy-straw) 62%, var(--jy-ink-dark)) 7px 11px);
}
.jy-root.has-rope .jy-rope-line::before { top: 0; height: clamp(14px, 1.1vw, 28px); border-radius: 0; background: url("/img/jinyeong/bg/rope.png") left center / auto 100% repeat-x; }
.jy-cloths { position: relative; flex: 1 1 auto; display: flex; justify-content: space-around; }
.jy-cloth { width: clamp(7px, 0.7vw, 16px); height: clamp(7px, 0.7vw, 16px); margin-top: 3px; border-radius: 50%; background: color-mix(in srgb, var(--jy-straw) 45%, var(--jy-pine)); transform-origin: 50% 0; }
.jy-cloth.on { width: clamp(9px, 0.95vw, 22px); height: clamp(26px, 2.5vw, 64px); margin-top: 6px; border-radius: 2px 2px 0 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%); }
.jy-cloth.c0 { background: var(--jy-blue); }
.jy-cloth.c1 { background: var(--jy-red); }
.jy-cloth.c2 { background: var(--jy-straw); }
.jy-cloth.c3 { background: var(--jy-ink); }
.jy-cloth.c4 { background: var(--jy-ink-dark); }
.jy-root.has-win_cloth .jy-cloth.on { clip-path: none; border-radius: 0; background-color: transparent; background-image: url("/img/jinyeong/ui/win_cloth.png"); background-position: top center; background-size: contain; background-repeat: no-repeat; width: clamp(14px, 1.5vw, 36px); }
.jy-cloth.new { animation: jy-tie 0.7s ease-out 1; }
.jy-cloths.crown .jy-cloth.on { animation: jy-flutter 1.3s ease-in-out 1; }
.jy-fires { position: relative; flex: 0 0 auto; display: flex; gap: clamp(4px, 0.5vw, 12px); margin-left: 2.5%; }
.jy-fire { width: clamp(13px / max(var(--gx-zoom, 1), 1), 1.25vw / var(--gx-zoom, 1), 30px); aspect-ratio: 3 / 4; margin-top: clamp(10px / max(var(--gx-zoom, 1), 1), 0.9vw / var(--gx-zoom, 1), 22px); border-radius: 50% 50% 50% 50% / 64% 64% 36% 36%; border: 1.5px dashed color-mix(in srgb, var(--jy-red) 55%, var(--jy-pine)); }
.jy-fire.on { border: 0; background: radial-gradient(circle at 50% 68%, var(--jy-ink) 0 14%, var(--jy-straw) 34%, var(--jy-red) 78%); box-shadow: 0 0 10px color-mix(in srgb, var(--jy-red) 70%, transparent); }
.jy-root.has-life_on .jy-fire.on { background: url("/img/jinyeong/ui/life_on.png") center / contain no-repeat; box-shadow: none; border-radius: 0; }
.jy-root.has-life_off .jy-fire:not(.on) { border: 0; background: url("/img/jinyeong/ui/life_off.png") center / contain no-repeat; border-radius: 0; }
.jy-rope-nums { flex: 0 0 auto; display: flex; gap: clamp(10px, 1.2vw, 26px); margin: 0; }
.jy-rope-nums > div { display: flex; flex-direction: column; align-items: flex-end; }
.jy-rope-nums dt { font-size: 0.68rem; color: var(--text-dim); }
.jy-rope-nums dd { margin: 0; font-family: "hb-games-display", var(--font-sans); font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.8rem); color: var(--text-main); line-height: 1.1; white-space: nowrap; }
.jy-coin-box dd { color: var(--jy-straw); }
@keyframes jy-tie { 0% { transform: scaleY(0.1) rotate(0); } 55% { transform: scaleY(1) rotate(9deg); } 80% { transform: rotate(-5deg); } 100% { transform: none; } }
@keyframes jy-flutter { 0%, 100% { transform: none; } 25% { transform: rotate(11deg); } 55% { transform: rotate(-8deg); } 80% { transform: rotate(4deg); } }

.jy-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.jy-left { margin-left: auto; font-size: 0.78rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ── 배치 ── */
.jy-stage { display: grid; grid-template-columns: minmax(0, 1fr) clamp(250px, 23vw / var(--gx-zoom, 1), 460px); gap: 12px; align-items: start; }
/* 시작 화면·전투는 한 단 — 전투는 열 칸이 한 줄에 서도록 판을 넓게 쓰고 전투 기록은 아래에 */
.jy-root:is([data-screen="home"], [data-screen="battle"]) .jy-stage { grid-template-columns: minmax(0, 1fr); }
.jy-root[data-screen="battle"] .jy-side { position: static; }
.jy-main { min-width: 0; }
.jy-side { min-width: 0; position: sticky; top: calc(var(--topbar-h, 0px) / var(--gx-zoom, 1) + 8px); }
.jy-side-prep { display: flex; flex-direction: column; gap: 8px; max-height: var(--jy-bh); }
.jy-info { flex: 1 1 auto; min-height: 4.5em; overflow-y: auto; }
.jy-go { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.jy-go .jy-ready { width: 100%; font-size: 1.02rem; padding: 12px 16px; }
.jy-go-sub { display: flex; gap: 6px; }
.jy-go-sub .mini-btn { flex: 1 1 0; justify-content: center; }

/* ── 시작 화면 ── */
.jy-home { display: flex; justify-content: center; padding: clamp(8px, 2vw, 40px) 0; }
.jy-home-box { width: min(640px, 100%); background: var(--bg-card); border: 1px solid var(--border-strong); border-top: 3px solid var(--jy-straw); border-radius: var(--radius-lg); padding: clamp(16px, 1.8vw, 34px); text-align: center; }
.jy-home-title { font-family: "hb-games-display", var(--font-sans); font-weight: 400; font-size: clamp(1.35rem, 1.1rem + 0.8vw, 2.2rem); color: var(--text-main); margin: 0 0 10px; }
.jy-rules { display: inline-block; text-align: left; margin: 0 0 12px; padding-left: 1.4em; font-size: 0.9rem; line-height: 1.85; color: var(--text-sub); }
.jy-rules b { color: var(--text-main); }
.jy-home-note { margin: 6px 0; font-size: 0.8rem; color: var(--text-dim); line-height: 1.6; }
.jy-home-act { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin: 10px 0 4px; }
.jy-home-act .big-btn { font-size: 1.05rem; padding: 12px 28px; }
.jy-root .login-box { margin-top: 10px; }
.jy-root .login-box p { font-size: 0.8rem; color: var(--text-dim); line-height: 1.7; margin: 0 0 10px; }
.jy-top5 { margin-top: 14px; text-align: left; }
.jy-top5 ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.jy-top5 li { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.82rem; }
.jy-top5 li b { margin-left: auto; color: var(--text-main); }

/* ── 말 칸 (진영·장터·전투 공용) — 칸 안 글자는 칸 너비 기준(cqw) ── */
.jy-card {
    container-type: inline-size; position: relative; flex: 0 0 auto; min-width: 0; min-height: 0; box-sizing: border-box;   /* 내용 최소 크기로 칸이 커지지 않게(배율을 키우면 빈 칸이 판 밖으로 밀렸다) */
    width: var(--jy-cell); aspect-ratio: 1 / 1.24;
    display: flex; flex-direction: column; align-items: stretch;
    border-radius: 10px; border: 2px solid transparent; background: var(--jy-pine-2); color: var(--jy-ink);
    cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation;
    transition: transform 0.15s ease, opacity 0.2s ease;
}
.jy-pic { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 5cqw 8cqw 0; }
.jy-pic img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.jy-pic.noimg::before {
    content: attr(data-ch); display: flex; align-items: center; justify-content: center; width: 56cqw; height: 56cqw; border-radius: 50%;
    background: color-mix(in srgb, var(--jy-pine) 70%, var(--jy-sand)); color: var(--jy-ink); font-weight: 800; font-size: 20cqw; letter-spacing: -0.02em;
}
.jy-name { flex: 0 0 auto; padding: 0 4cqw; text-align: center; font-size: clamp(10px / max(var(--gx-zoom, 1), 1), 11.5cqw, 1.15rem); font-weight: 700; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 공격·체력 = 샅바 띠 (내 편 청, 상대 홍, 장터는 솔색) */
.jy-stats { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 4cqw; margin-top: 2cqw; padding: 2.5cqw 7cqw; border-radius: 0 0 8px 8px; background: var(--jy-sash, var(--jy-pine-0)); color: var(--jy-ink); font-size: clamp(11px / max(var(--gx-zoom, 1), 1), 15cqw, 1.5rem); }
.jy-stats > span { display: inline-flex; align-items: center; gap: 3cqw; }
.jy-stats b { font-weight: 800; font-variant-numeric: tabular-nums; }
.jy-ico { display: inline-flex; align-items: center; justify-content: center; width: 1.15em; height: 1.15em; font-style: normal; font-size: 0.72em; font-weight: 800; border-radius: 3px; background: rgba(0, 0, 0, 0.28); background-position: center; background-size: contain; background-repeat: no-repeat; }
.jy-ico[data-ui="atk"]::before { content: "공"; }
.jy-ico[data-ui="hp"]::before { content: "체"; }
.jy-ico[data-ui="coin"]::before { content: "닢"; }
.jy-root.has-atk .jy-ico[data-ui="atk"], .jy-root.has-hp .jy-ico[data-ui="hp"], .jy-root.has-coin .jy-ico[data-ui="coin"] { background-color: transparent; font-size: 0.95em; }
.jy-root.has-atk .jy-ico[data-ui="atk"] { background-image: url("/img/jinyeong/ui/atk.png"); }
.jy-root.has-hp .jy-ico[data-ui="hp"] { background-image: url("/img/jinyeong/ui/hp.png"); }
.jy-root.has-coin .jy-ico[data-ui="coin"] { background-image: url("/img/jinyeong/ui/coin.png"); }
.jy-root.has-atk .jy-ico[data-ui="atk"]::before, .jy-root.has-hp .jy-ico[data-ui="hp"]::before, .jy-root.has-coin .jy-ico[data-ui="coin"]::before { content: none; }
.jy-pos { position: absolute; top: 3cqw; left: 3cqw; z-index: 1; min-width: 1.5em; text-align: center; font-size: clamp(10px / max(var(--gx-zoom, 1), 1), 10cqw, 1rem); font-weight: 800; border-radius: 999px; background: rgba(0, 0, 0, 0.22); color: inherit; font-variant-numeric: tabular-nums; }
.jy-lv { position: absolute; top: 3cqw; right: 3cqw; z-index: 1; font-size: clamp(10px / max(var(--gx-zoom, 1), 1), 10cqw, 1rem); font-weight: 800; padding: 0 5cqw; border-radius: 999px; background: var(--jy-straw); color: var(--jy-ink-dark); }
.jy-lv[data-lv="1"] { display: none; }
/* 합친 진행 — 단계 표시 아래 작은 점 (1단계는 단계 표시가 없어 그 자리에) */
.jy-exp { position: absolute; top: 3cqw; right: 3cqw; z-index: 1; display: flex; gap: 2.5cqw; padding: 2cqw 3cqw; border-radius: 999px; background: color-mix(in srgb, var(--jy-pine-0) 82%, transparent); }
.jy-exp[data-lv="2"] { top: calc(3cqw + clamp(10px / max(var(--gx-zoom, 1), 1), 10cqw, 1rem) * 1.25 + 2cqw); }
.jy-exp i { width: clamp(6px / max(var(--gx-zoom, 1), 1), 7cqw, 11px); aspect-ratio: 1; border-radius: 50%; box-sizing: border-box; border: 1.5px solid var(--jy-straw); }
.jy-exp i.on { background: var(--jy-straw); }
.jy-exp i.new { animation: jy-exp-new 0.6s ease-out 1; }
.jy-exp[data-lv="2"] ~ .jy-fed { top: calc(3cqw + clamp(10px / max(var(--gx-zoom, 1), 1), 10cqw, 1rem) * 1.25 + 14cqw); }
@keyframes jy-exp-new { 0% { transform: scale(0.2); box-shadow: 0 0 0 0 var(--jy-straw); } 50% { transform: scale(1.7); box-shadow: 0 0 0 4px color-mix(in srgb, var(--jy-straw) 40%, transparent); } 100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; } }
/* 손가락 끌기 — 카드 위를 쓸면 화면이 밀리고, 꾹 누르면(400ms) 들려서 끈다. 길게 누를 때 브라우저 메뉴·글자 선택은 막는다 */
.jy-card[draggable="true"] { -webkit-touch-callout: none; }
.jy-card.lift { z-index: 3; border-color: var(--jy-straw); box-shadow: 0 0 0 2px var(--jy-straw), 0 10px 22px color-mix(in srgb, var(--jy-pine-0) 70%, transparent); transform: translateY(-6%) scale(1.04); }
.jy-card.over { border-color: var(--jy-blue); box-shadow: 0 0 0 2px var(--jy-blue); }
.jy-fed { position: absolute; right: 3cqw; top: 18cqw; z-index: 1; width: 28cqw; height: 28cqw; border-radius: 50%; background: var(--jy-ink); container-type: inline-size; display: flex; }
.jy-fed .jy-pic { padding: 8cqw; }
.jy-fed .jy-pic.noimg::before { width: 84cqw; height: 84cqw; font-size: 34cqw; background: transparent; color: var(--jy-ink-dark); }
.jy-tag { position: absolute; right: 3cqw; z-index: 1; font-size: clamp(9px / max(var(--gx-zoom, 1), 1), 9.5cqw, 0.9rem); font-weight: 800; padding: 0 4cqw; border-radius: 4px; }
.jy-tag-frozen { top: 3cqw; right: auto; left: 3cqw; background: var(--jy-ink); color: var(--jy-ink-dark); }
.jy-tag-bonus { top: 3cqw; background: var(--jy-straw); color: var(--jy-ink-dark); }
.jy-tag-merge { top: 16cqw; background: var(--jy-straw); color: var(--jy-ink-dark); }
.jy-tag-bonus + .jy-tag-merge { top: 17cqw; }
.jy-price { position: absolute; left: 50%; bottom: 100%; transform: translate(-50%, 55%); z-index: 2; display: inline-flex; align-items: center; gap: 2px; font-size: clamp(10px / max(var(--gx-zoom, 1), 1), 11cqw, 1.05rem); padding: 0 6cqw; border-radius: 999px; background: var(--jy-pine-0); color: var(--jy-straw); border: 1px solid var(--jy-line-2); }
.jy-card.sel { border-color: var(--jy-blue); box-shadow: 0 0 0 2px var(--jy-blue); transform: translateY(-4%); }
.jy-card.drop { border-style: dashed; border-color: var(--jy-straw); }
.jy-card.merge { border-color: var(--jy-straw); }
.jy-card.poor { opacity: 0.5; }
.jy-card.frozen { border-style: dotted; border-color: var(--jy-ink); }
.jy-card.sold { visibility: hidden; }
.jy-card.pop { animation: jy-pop 0.35s ease-out 1; }
.jy-card.empty { background: color-mix(in srgb, var(--jy-sand-2) 55%, transparent); border: 2px dashed color-mix(in srgb, var(--jy-ink-dark) 45%, transparent); color: var(--jy-ink-dark); align-items: center; justify-content: center; padding: 0; } /* 공용 .empty(style.css)의 padding 32px가 붙어 빈 칸이 칸 크기보다 넓어졌다 */
.jy-card.empty.drop { border-color: var(--jy-ink-dark); background: color-mix(in srgb, var(--jy-straw) 45%, var(--jy-sand)); }
.jy-empty-text { font-size: clamp(10px / max(var(--gx-zoom, 1), 1), 11cqw, 1rem); opacity: 0.75; }
.jy-root.busy .jy-prep { cursor: progress; }
@keyframes jy-pop { 0% { transform: scale(1); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* ── 준비 — 모래판 위 내 진영 + 좌판 한 줄 ── */
.jy-prep { padding: 2px 0 0; }
.jy-board { --jy-sash: var(--jy-blue); display: flex; flex-direction: row-reverse; justify-content: center; gap: var(--jy-gap); padding: 10px 12px; margin-bottom: 12px; border-radius: var(--radius-lg); background: var(--jy-sand); background-position: center; background-size: cover; }
.jy-root.has-yard .jy-board { background-image: url("/img/jinyeong/bg/yard.webp"); }
.jy-board .jy-card:not(.empty) { background: color-mix(in srgb, var(--jy-sand) 55%, var(--jy-ink)); color: var(--jy-ink-dark); }
.jy-board .jy-card:not(.empty) .jy-stats { color: var(--jy-ink); }
.jy-shop { display: flex; align-items: flex-start; gap: calc(var(--jy-gap) * 2); padding: 14px 12px 10px; border-radius: var(--radius-lg); background: var(--jy-pine-0); }
.jy-shop-units, .jy-shop-foods { display: flex; gap: var(--jy-gap); }
.jy-shop-foods { padding-left: calc(var(--jy-gap) * 2); border-left: 1px dashed var(--jy-line-2); }
.jy-shop .jy-card { background: var(--jy-pine-2); }
.jy-card.food { aspect-ratio: 1 / 1.24; }
.jy-card.food .jy-name { margin-bottom: 6cqw; }
.jy-shop-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.jy-keys { margin-left: auto; font-size: 0.72rem; color: var(--text-dim); line-height: 1.9; }

/* 오른쪽 — 계열 · 고른 말 */
.jy-tribe-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; font-size: 0.8rem; color: var(--text-dim); }
.jy-tribe-list li.on { color: var(--text-main); }
.jy-tribe-list li.on b { color: var(--jy-straw); }
.jy-tribe-list small { display: block; font-size: 0.7rem; line-height: 1.4; }
.jy-info-empty { margin: 0; font-size: 0.8rem; color: var(--text-dim); line-height: 1.65; }
.jy-info-head { display: flex; gap: 10px; align-items: center; }
.jy-info-head > div { min-width: 0; flex: 1 1 auto; }
.jy-pic.big { flex: 0 0 auto; width: clamp(56px, 5vw, 110px); height: clamp(56px, 5vw, 110px); padding: 0; container-type: inline-size; }
.jy-pic.big.noimg::before { width: 100cqw; height: 100cqw; font-size: 34cqw; }
.jy-info-name { margin: 0; font-size: 1rem; font-weight: 800; color: var(--text-main); }
.jy-info-meta { margin: 2px 0 4px; font-size: 0.76rem; color: var(--text-dim); }
.jy-info .jy-stats { display: inline-flex; gap: 12px; margin: 0; padding: 2px 10px; border-radius: 999px; font-size: 0.9rem; --jy-sash: var(--jy-pine-0); }
.jy-info .jy-stats > span { gap: 4px; }
.jy-levels { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 0.8rem; line-height: 1.5; color: var(--text-dim); }
.jy-levels li span { display: inline-block; min-width: 3.2em; font-weight: 700; }
.jy-levels li.now { color: var(--text-main); }
.jy-levels li.now span { color: var(--jy-straw); }
.jy-info-text { margin: 8px 0 0; font-size: 0.84rem; color: var(--text-main); line-height: 1.6; }
.jy-info-note { margin: 6px 0 0; font-size: 0.76rem; color: var(--text-dim); line-height: 1.55; }
.jy-info-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.jy-info-act .jy-info-note { margin: 0; }

/* ── 전투 — 같은 자리의 모래판 ── */
.jy-ring { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: clamp(20px, 3vw, 56px); padding: calc(clamp(1.5rem, 1.1rem + 1.6vw, 3.4rem) * 1.2 + 22px) 12px 16px; border-radius: var(--radius-lg); background: var(--jy-sand); background-position: center; background-size: cover; color: var(--jy-ink-dark); min-height: calc(var(--jy-bcell) * 1.24 + 5.5em); }
.jy-root.has-ring .jy-ring { background-image: url("/img/jinyeong/bg/ring.webp"); }
.jy-team { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.jy-team-a { order: 1; align-items: flex-end; --jy-sash: var(--jy-blue); }
.jy-team-b { order: 2; align-items: flex-start; --jy-sash: var(--jy-red); }
.jy-team-name { margin: 0; font-size: 0.88rem; font-weight: 800; padding: 2px 12px; border-radius: 999px; background: var(--jy-sash); color: var(--jy-ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jy-line { display: flex; gap: var(--jy-gap); min-height: calc(var(--jy-bcell) * 1.24); min-width: var(--jy-bcell); }
#line-a { flex-direction: row-reverse; }
.jy-bu { width: var(--jy-bcell); cursor: default; background: color-mix(in srgb, var(--jy-sand) 55%, var(--jy-ink)); color: var(--jy-ink-dark); transition: transform 0.25s ease, opacity 0.3s ease; }
.jy-bu .jy-stats { color: var(--jy-ink); }
.jy-flip .jy-pic img { transform: scaleX(-1); }
.jy-team-a .jy-bu.clash { transform: translateX(34%); z-index: 2; }
.jy-team-b .jy-bu.clash { transform: translateX(-34%); z-index: 2; }
.jy-team-a .jy-bu.faint { opacity: 0; transform: translateX(-30%); }
.jy-team-b .jy-bu.faint { opacity: 0; transform: translateX(30%); }
.jy-bu.hit .jy-hp b, .jy-bu.down .jy-stats b { animation: jy-num 0.35s ease-out 1; }
.jy-bu.up .jy-stats b { animation: jy-num 0.35s ease-out 1; }
.jy-bubble { position: absolute; left: 50%; bottom: 100%; z-index: 3; transform: translate(-50%, 0); white-space: nowrap; font-size: clamp(10px, 11cqw, 0.9rem); font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--jy-ink); color: var(--jy-ink-dark); opacity: 0; pointer-events: none; }
.jy-bubble.show { animation: jy-bubble 1.1s ease-out 1; }
.jy-float { position: absolute; left: 50%; top: 30%; z-index: 3; transform: translate(-50%, 0); font-family: "hb-games-display", var(--font-sans); font-size: clamp(14px, 24cqw, 2.4rem); color: var(--jy-red); -webkit-text-stroke: 1px var(--jy-ink); opacity: 0; pointer-events: none; }
.jy-float.show { animation: jy-float 0.7s ease-out 1; }
.jy-badges { position: absolute; top: 3cqw; left: 3cqw; z-index: 1; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.jy-badge { font-size: clamp(9px, 9.5cqw, 0.85rem); font-weight: 800; padding: 0 4cqw; border-radius: 4px; background: var(--jy-ink-dark); color: var(--jy-ink); }
.jy-verdict { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); margin: 0; z-index: 4; font-family: "hb-games-display", var(--font-sans); font-size: clamp(1.5rem, 1.1rem + 1.6vw, 3.4rem); line-height: 1.2; padding: 2px 22px; border-radius: 999px; background: var(--jy-pine-0); color: var(--jy-ink); white-space: nowrap; }
.jy-verdict.win { color: var(--jy-straw); }
.jy-verdict.lose { color: color-mix(in srgb, var(--jy-red) 70%, var(--jy-ink)); }
.jy-battle-note { margin: 8px 0 0; font-size: 0.82rem; color: var(--text-main); line-height: 1.6; padding: 8px 12px; border: 1px solid var(--jy-straw); border-radius: var(--radius); }
.jy-battle-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.jy-battle-ctrl .big-btn { margin-left: auto; }
.jy-log-wrap { display: flex; flex-direction: column; }
.jy-log { list-style: none; margin: 0; padding: 0; max-height: 9em; overflow-y: auto; font-size: 0.78rem; line-height: 1.7; color: var(--text-dim); }
.jy-log li:last-child { color: var(--text-main); }
@keyframes jy-num { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes jy-bubble { 0% { opacity: 0; transform: translate(-50%, 30%); } 15%, 75% { opacity: 1; transform: translate(-50%, -10%); } 100% { opacity: 0; transform: translate(-50%, -10%); } }
@keyframes jy-float { 0% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -90%); } }

/* ── 창 (기록·도감·순위·최근 전투 · 판 끝) ── */
.jy-overlay { position: fixed; inset: 0; z-index: 990; display: flex; align-items: center; justify-content: center; padding: 16px; background: color-mix(in srgb, var(--jy-pine-0) 78%, transparent); }
.jy-box { width: min(820px, 100%); max-height: 100%; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border-strong); border-top: 3px solid var(--jy-straw); border-radius: var(--radius-lg); padding: clamp(14px, 1.4vw, 28px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); }
.jy-box-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.jy-box-head h3 { flex: 1 1 auto; margin: 0; font-family: "hb-games-display", var(--font-sans); font-weight: 400; font-size: clamp(1.2rem, 1rem + 0.6vw, 1.9rem); color: var(--text-main); }
.jy-box h4.jy-h { margin-top: 14px; }
.jy-root .me-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; }
.jy-root .me-cell { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 9px; min-width: 0; }
.jy-root .mc-label { font-size: 0.7rem; color: var(--text-dim); }
.jy-root .mc-value { font-size: 1rem; font-weight: 800; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jy-titles { display: flex; flex-wrap: wrap; gap: 6px; }
.jy-achs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 6px; }
.jy-achs li { display: flex; flex-direction: column; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.8rem; color: var(--text-dim); }
.jy-achs li.done { border-color: var(--jy-straw); }
.jy-achs li.done b { color: var(--text-main); }
.jy-achs small { font-size: 0.72rem; line-height: 1.5; }
.jy-codex { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(84px, 8vw, 150px), 1fr)); gap: 6px; }
.jy-codex-item { container-type: inline-size; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); color: var(--text-dim); font-family: inherit; cursor: pointer; opacity: 0.6; }
.jy-codex-item .jy-pic { width: 60cqw; height: 60cqw; padding: 0; flex: 0 0 auto; }
.jy-codex-item b { font-size: 0.76rem; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jy-codex-item small { font-size: 0.68rem; }
.jy-codex-item.seen { opacity: 0.8; }
.jy-codex-item.used { opacity: 1; color: var(--text-main); border-color: var(--border-strong); }
.jy-codex-info { position: sticky; bottom: 0; margin-top: 10px; background: var(--jy-pine-0); }
.jy-battles { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.jy-battles li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.84rem; }
.jy-b-main { flex: 1 1 auto; min-width: 0; color: var(--text-main); }
.jy-b-main small { display: block; font-size: 0.72rem; color: var(--text-dim); }
.jy-res { flex: 0 0 auto; min-width: 4.2em; text-align: center; font-weight: 800; font-size: 0.78rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-sub); }
.jy-res.win { border-color: var(--jy-straw); color: var(--jy-straw); }
.jy-res.lose { border-color: var(--jy-red); color: color-mix(in srgb, var(--jy-red) 60%, var(--jy-ink)); }
.jy-box .empty-state { padding: 24px 12px; }
.jy-box .empty-state p { margin: 12px 0 0; }
.jy-end-box { width: min(520px, 100%); text-align: center; }
.jy-end-title { margin: 0 0 6px; font-family: "hb-games-display", var(--font-sans); font-weight: 400; font-size: clamp(1.5rem, 1.2rem + 1vw, 2.6rem); color: var(--text-main); }
.jy-end-wins { margin: 4px 0; font-size: 1rem; color: var(--text-sub); }
.jy-end-wins b { font-family: "hb-games-display", var(--font-sans); font-weight: 400; font-size: clamp(2rem, 1.5rem + 1.5vw, 3.6rem); color: var(--jy-straw); margin-right: 2px; }
.jy-end-rating { margin: 4px 0; font-size: 0.9rem; color: var(--text-sub); }
.jy-end-rating b { color: var(--text-main); }
.jy-delta { font-weight: 800; margin-left: 4px; font-variant-numeric: tabular-nums; }
.jy-delta.up { color: var(--jy-straw); }
.jy-delta.down { color: color-mix(in srgb, var(--jy-red) 60%, var(--jy-ink)); }
.jy-end-new { margin: 6px 0 0; font-size: 0.84rem; color: var(--text-main); }
.jy-end-act { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }

/* ── 태블릿 — 오른쪽 패널을 아래로 ── */
@media (max-width: 1024px) {
    .jy-stage { grid-template-columns: minmax(0, 1fr); }
    .jy-side { position: static; }
    .jy-side-prep { max-height: none; }
    .jy-info { overflow: visible; }
    .jy-keys { display: none; }
}
/* 화면 배율로 뿌리 너비가 1024px(CSS) 이하가 되면 태블릿과 같은 배치(.jy-narrow는 jinyeong-page.js fitBoard가 붙인다) — 넓은 창에서 300%로 키우면 오른쪽 패널이 판을 덮었다 */
.jy-root.jy-narrow .jy-stage { grid-template-columns: minmax(0, 1fr); }
.jy-root.jy-narrow .jy-side { position: static; }
.jy-root.jy-narrow .jy-side-prep { max-height: none; }
.jy-root.jy-narrow .jy-info { overflow: visible; }
.jy-root.jy-narrow .jy-keys { display: none; }
/* ── 휴대폰 — 칸은 가로가 정한다, '준비 끝'은 아래 고정 ── */
@media (max-width: 640px) {
    .jy-root .wrap { max-width: 100%; padding: 8px 16px 150px; }
    .jy-root .page-sub { display: none; }
    .jy-rope { flex-wrap: wrap; gap: 4px 10px; }
    .jy-rope-line { flex: 1 1 100%; }
    .jy-rope-nums { flex: 1 1 100%; justify-content: space-between; flex-wrap: wrap; gap: 2px 10px; }
    .jy-rope-nums > div { flex-direction: row; align-items: baseline; gap: 5px; }
    .jy-board { padding: 8px 0; gap: var(--jy-gap); }
    .jy-shop { flex-wrap: wrap; padding: 14px 0 8px; gap: 14px var(--jy-gap); background: transparent; }
    .jy-shop-foods { padding-left: 0; border-left: 0; }
    .jy-go { position: fixed; left: 0; right: 0; bottom: 0; z-index: 870; flex-direction: row; align-items: center; padding: 8px 96px 8px 12px; background: var(--jy-pine-0); border-top: 1px solid var(--jy-line-2); }
    .jy-go .jy-ready { flex: 1 1 auto; width: auto; padding: 11px 10px; font-size: 0.95rem; }
    .jy-go-sub { flex: 0 0 auto; flex-direction: column; gap: 4px; }
    .jy-go-sub .mini-btn { padding: 3px 8px; font-size: 0.7rem; }
    /* 전투 — 상대 윗줄·나 아랫줄, 맨 앞이 같은 쪽(오른쪽)에서 마주 본다 */
    .jy-ring { flex-direction: column; align-items: stretch; gap: 10px; padding-left: 0; padding-right: 0; padding-bottom: 10px; }
    .jy-team-a { order: 2; }
    .jy-team-b { order: 1; align-items: flex-end; }
    #line-b { flex-direction: row-reverse; }
    .jy-team-a .jy-bu.clash { transform: translateY(-18%); }
    .jy-team-b .jy-bu.clash { transform: translateY(18%); }
    .jy-team-a .jy-bu.faint, .jy-team-b .jy-bu.faint { transform: scale(0.85); }
    .jy-battle-ctrl .big-btn { margin-left: 0; flex: 1 1 100%; }
    .jy-overlay { padding: 8px; align-items: flex-end; }
    .jy-box { max-height: 92%; }
}
/* ── 4K — 사이트 글자 배율을 따르고 여백만 넓힌다 ── */
@media (min-width: 2400px) {
    .jy-root .wrap { padding: 16px 28px 110px; }
    .jy-root { --jy-gap: 14px; }
    .jy-stage { gap: 22px; }
}
/* ── 모션 줄이기 — 이동·나부낌 없이 숫자와 상태만 ── */
@media (prefers-reduced-motion: reduce) {
    .jy-card, .jy-bu { transition: none; }
    .jy-cloth.new, .jy-cloths.crown .jy-cloth.on, .jy-card.pop, .jy-exp i.new, .jy-bubble.show, .jy-float.show, .jy-bu.hit .jy-hp b, .jy-bu.up .jy-stats b, .jy-bu.down .jy-stats b { animation: none; }
    .jy-card.sel, .jy-card.lift { transform: none; }
    .jy-bu.clash, .jy-bu.faint { transform: none; }
}
