/* 탭잼 공용 컴포넌트: 보드판, 말, 찬스 카드, 칩 탑, 초대장, 카드 덱, 결과 카드, 색 고르기 */

/* ---------- 보드판 ---------- */
.board { position: relative; width: 100%; height: 100%; }
.board .tile { position: absolute; box-sizing: border-box; padding: 3px; }
.board .tile::before { content: ""; position: absolute; inset: 3px; background: var(--paper); border: 2px solid var(--wood); border-radius: 10%; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.board .tile-n { position: absolute; left: 10%; top: 6%; font: 700 clamp(8px, .8vw, 16px)/1 var(--font); color: var(--ink-muted); }
.board .tile.start::before { background: #d8ead2; }
.board .tile.finish::before { background: repeating-conic-gradient(var(--ink) 0 25%, var(--paper) 0 50%) 0 0 / 22% 22%; border-color: var(--ink); }
.board .tile.finish .tile-n { color: var(--paper); background: var(--ink); padding: 2px 4px; border-radius: 4px; }
.board .tile.chance::before { background: #f7d3c2; border-color: var(--accent); }
.board .tile.chance .tile-n { left: 50%; top: 50%; transform: translate(-50%, -50%); font: 400 clamp(12px, 1.6vw, 34px)/1 var(--font-display); color: var(--accent); }
.board .tile.flash::before { animation: tileFlash .8s; }
.board .tile-count { position: absolute; right: 6%; bottom: 8%; min-width: 1.7em; padding: .12em .35em; box-sizing: border-box; border-radius: 99px; background: var(--ink); color: var(--paper); font: 800 clamp(8px, .75vw, 15px)/1.15 var(--font); text-align: center; font-variant-numeric: tabular-nums; }
@keyframes tileFlash { 50% { background: var(--accent2); transform: scale(1.12); } }
.board-center { position: absolute; display: grid; place-items: center; padding: 2%; box-sizing: border-box; }
.pawns { position: absolute; inset: 0; pointer-events: none; }
.pawn { position: absolute; width: calc(100% / var(--cols) * .52 * var(--crowd, 1)); transform: translate(-50%, -64%); transition: left .18s ease-out, top .18s ease-out; filter: drop-shadow(0 2px 0 rgba(0,0,0,.25)); }
.pawn svg { display: block; width: 100%; height: auto; }
.pawn .pawn-tag { position: absolute; left: 50%; top: 0; transform: translate(-50%, -85%); min-width: 1.4em; padding: .1em .3em; box-sizing: border-box; border-radius: 99px; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); font: 800 clamp(9px, .95vw, 20px)/1.1 var(--font); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pawn.hop { animation: hop .2s ease-out; }
.pawn.focus { width: calc(100% / var(--cols) * .8); z-index: 50 !important; animation: bob 1s ease-in-out infinite; }
@keyframes hop { 50% { transform: translate(-50%, -90%); } }
@keyframes bob { 50% { transform: translate(-50%, -76%); } }

/* ---------- 초대장 (참가 접수) ---------- */
.invite { background: var(--paper); color: var(--ink); border-radius: 1.4rem; padding: 1.2rem 1.2rem 1rem; box-shadow: 0 .6rem 0 var(--wood), 0 1.6rem 3rem rgba(0,0,0,.35); transform: rotate(-1.5deg); text-align: center; }
.inv-top { display: flex; align-items: center; gap: .7rem; text-align: left; margin-bottom: .6rem; }
.inv-logo { width: 2.4rem; flex: none; }
.inv-top small { display: block; color: var(--ink-muted); font-size: .8rem; }
.inv-top b { font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; }
.invite .qr { width: min(26rem, 52vh); height: min(26rem, 52vh); margin: 0 auto; }
.invite .qr-code b { color: var(--accent); }
.invite .url { color: var(--ink-muted); }
.lobby-copy .lead { font-size: 1.3rem; color: var(--muted); margin: 0 0 1.4rem; }
.rounds { display: inline-flex; align-items: center; gap: .7rem; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: .4rem .6rem .4rem 1.1rem; margin-bottom: 1.4rem; font-weight: 700; }
.rounds b { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; min-width: 3.2rem; text-align: center; }
.rounds small { color: var(--muted); font-weight: 500; }
.rbtn { width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 0; background: var(--paper); color: var(--ink); font-size: 1.3rem; font-weight: 800; }
.chip-pawn { width: 1.3rem; display: inline-block; }
.chip-pawn svg { display: block; width: 100%; height: auto; }

/* ---------- 게임 고르기: 위 판 + 아래 세로 스크롤 목록 ---------- */
/* 판은 화면 높이에 맞추고, 그 아래로 게임 카드가 이어짐. 화면 전체를 내려서 고름 */
body[data-view="menu"] #main { overflow-y: auto; container-type: size; scrollbar-width: thin; scrollbar-color: var(--wood) transparent; }
/* 작은 화면(host.css와 같은 기준)은 페이지 자체가 스크롤됨 */
@media (max-width: 820px), (max-height: 520px) { body[data-view="menu"] #main { overflow: visible; container-type: normal; } }
.menu2 { display: flex; flex-direction: column; gap: 1rem; }
.menu-board { height: 74cqh; flex: none; }
.mc { text-align: center; }
.mc-round { font-family: var(--font-display); font-size: 3rem; }
.mc-round small { font-size: 1.4rem; color: var(--muted); }
.mc-sub { color: var(--muted); font-size: 1.05rem; margin-top: .3rem; }
.mc-lead { margin-top: .8rem; display: inline-flex; align-items: center; gap: .5rem; background: var(--panel); border-radius: 99px; padding: .35rem .9rem; font-weight: 700; }
.mc-lead i { width: .8rem; height: .8rem; border-radius: 50%; }
.fan-wrap { background: var(--felt2); border-radius: 1rem; padding: .2rem .9rem 1rem; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.fan-head { display: flex; align-items: baseline; gap: .6rem; padding: .7rem .2rem .3rem; font-weight: 800; }
.fan-head small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.fan { display: grid; grid-template-columns: repeat(auto-fill, 8.6rem); justify-content: center; gap: .9rem .6rem; padding: .5rem 0 .3rem; }
.gcard { width: 8.6rem; height: 10.6rem; background: var(--paper); color: var(--ink); border: 2px solid var(--wood); border-radius: .9rem; padding: .7rem; text-align: left; display: flex; flex-direction: column; gap: .2rem; box-shadow: 0 .3rem 0 rgba(0,0,0,.3); transition: transform .15s; scroll-margin: 1rem; }
.gcard:nth-child(odd) { transform: rotate(-1.5deg); }
.gcard:nth-child(even) { transform: rotate(1.5deg); }
.gcard.sel { transform: translateY(-.4rem) rotate(0); border-color: var(--accent); box-shadow: 0 .8rem 1.6rem rgba(0,0,0,.4), 0 0 0 .2rem var(--accent); }
.gcard.played { background: var(--paper2); }
.gcard .gc-icon { width: 3rem; height: 3rem; }
.gcard .gc-name { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.2; }
.gcard .gc-desc { color: var(--ink-muted); font-size: .78rem; }
.gcard .gc-meta { margin-top: auto; display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-muted); }
.gcard .gc-meta .done { color: var(--felt); font-weight: 800; }

/* ---------- 실시간 중계: 칩 탑 ---------- */
.towers { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: clamp(.3rem, 1vw, 1.2rem); min-height: 0; padding-top: 1rem; }
.tower { flex: 0 1 7rem; height: 100%; display: grid; grid-template-rows: auto 1fr auto auto auto; justify-items: center; gap: .3rem; min-width: 0; }
.tw-val { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.tw-stack { position: relative; width: 70%; height: 100%; display: flex; align-items: flex-end; }
.tw-fill { width: 100%; height: 0; border-radius: .5rem .5rem .2rem .2rem; transition: height .3s ease-out;
  background: repeating-linear-gradient(0deg, var(--c) 0 .9rem, rgba(255,255,255,.85) .9rem 1.05rem, var(--c) 1.05rem 1.6rem); box-shadow: inset -.4rem 0 0 rgba(0,0,0,.18); }
.tower.hidden-chips .tw-fill { background: repeating-linear-gradient(0deg, var(--paper2) 0 .9rem, var(--wood) .9rem 1.05rem); }
.tw-pawn { width: 2.2rem; }
.tw-pawn svg { display: block; width: 100%; height: auto; }
.tw-name { font-weight: 700; font-size: .95rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-rank { font-family: var(--font-display); font-size: 1.2rem; color: var(--accent2); min-height: 1.3em; }
.tower.lead .tw-val { color: var(--accent2); }

/* ---------- 판 결과 · 찬스 카드 ---------- */
.result2 { height: 100%; display: grid; grid-template-rows: auto 1fr; gap: .6rem; }
.res-board { min-height: 0; }
.ranklist { background: var(--paper); color: var(--ink); border-radius: 1rem; padding: .8rem 1.1rem; min-width: 60%; max-height: 100%; overflow: hidden; display: grid; grid-template-columns: repeat(var(--cols2, 1), 1fr); gap: .1rem 1.4rem; box-shadow: 0 .4rem 0 var(--wood); }
.rl-row { display: grid; grid-template-columns: 1.6rem 1.6rem 1fr auto auto; align-items: center; gap: .5rem; font-weight: 700; padding: .2rem 0; }
.rl-row .rk { font-family: var(--font-display); font-size: 1.3rem; color: var(--ink-muted); text-align: center; }
.rl-row .rl-pawn svg { display: block; width: 100%; height: auto; }
.rl-row .v { color: var(--ink-muted); font-weight: 500; font-size: .9rem; }
.rl-row b { color: var(--accent); font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; }
.rl-row.absent { opacity: .55; }
.chance-card { width: min(22rem, 70%); background: var(--paper); color: var(--ink); border: .3rem solid var(--c); border-radius: 1.2rem; padding: 1.2rem; text-align: center; box-shadow: 0 .6rem 0 rgba(0,0,0,.3); animation: flipIn .6s ease-out; }
@keyframes flipIn { from { transform: perspective(60rem) rotateY(90deg); } to { transform: perspective(60rem) rotateY(0); } }
.cc-team { display: inline-flex; align-items: center; gap: .4rem; font-weight: 800; }
.cc-team i { width: .8rem; height: .8rem; border-radius: 50%; background: var(--c); }
.cc-icon { width: 4.5rem; height: 4.5rem; margin: .6rem auto; color: var(--accent); }
.cc-icon svg { width: 100%; height: 100%; }
.cc-title { font-family: var(--font-display); font-size: 2rem; }
.cc-body { font-size: 1.15rem; margin-top: .3rem; word-break: keep-all; }
.round-sum { text-align: center; }
.round-sum h2 { font-size: 2.6rem; margin: 0 0 .4rem; }
.round-sum p { color: var(--muted); font-size: 1.15rem; margin: 0; }

/* ---------- 골인 · 결과 카드 ---------- */
.finale { height: 100%; display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.6rem; align-items: center; }
.final-board { height: 100%; min-height: 0; }
.ribbon span { display: inline-block; font-family: var(--font-display); font-size: 3.4rem; color: var(--paper); background: var(--accent); padding: .2rem 1.6rem; border-radius: .6rem; transform: rotate(-4deg); animation: pop .6s; box-shadow: 0 .4rem 0 rgba(0,0,0,.3); }
.result-card { background: var(--paper); color: var(--ink); border-radius: 1.4rem; padding: 1.4rem; box-shadow: 0 .6rem 0 var(--wood), 0 1.6rem 3rem rgba(0,0,0,.35); max-height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.rc-head { display: flex; align-items: center; gap: .7rem; }
.rc-logo { width: 2.2rem; flex: none; }
.rc-head b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; }
.rc-head small { color: var(--ink-muted); }
.rc-champ { margin: 1rem 0; padding: .8rem 1rem; background: #f7d3c2; border-radius: 1rem; }
.rc-champ small { display: block; color: var(--accent); font-weight: 800; }
.rc-champ b { font-family: var(--font-display); font-weight: 400; font-size: 2.4rem; }
.rc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; overflow: hidden; }
.rc-list.many { grid-template-columns: 1fr 1fr; column-gap: 1rem; font-size: .85rem; }
.rc-list li { display: grid; grid-template-columns: 1.8rem 1.4rem 1fr auto; gap: .5rem; align-items: center; font-weight: 700; }
.rc-list .rk { font-family: var(--font-display); font-size: 1.2rem; text-align: center; color: var(--ink-muted); }
.rc-list .rc-pawn svg { display: block; width: 100%; height: auto; }
.rc-list small { color: var(--ink-muted); font-weight: 500; }
/* 대규모 개인전 */
.center-pair { display: flex; align-items: center; justify-content: center; gap: 1.6rem; width: 100%; max-height: 100%; min-height: 0; }
.top-legend { background: var(--paper); color: var(--ink); border-radius: 1rem; padding: .5rem .9rem; box-shadow: 0 .3rem 0 var(--wood); font-size: .85rem; max-height: 100%; overflow: hidden; }
.top-legend.empty { font-weight: 700; display: grid; gap: .2rem; text-align: center; }
.top-legend ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(5, auto); grid-auto-flow: column; column-gap: 1.2rem; row-gap: .1rem; }
.top-legend li { display: grid; grid-template-columns: 1.4rem .7rem minmax(0, 7.5rem) auto; gap: .4rem; align-items: center; font-weight: 700; }
.top-legend .rk { font-family: var(--font-display); font-size: 1.1rem; text-align: center; color: var(--ink-muted); }
.top-legend i { width: .7rem; height: .7rem; border-radius: 50%; }
.top-legend .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-legend li small { color: var(--ink-muted); font-weight: 500; }
.tl-note { display: block; margin-top: .3rem; color: var(--ink-muted); font-size: .72rem; }
.rl-more { grid-column: 1 / -1; color: var(--ink-muted); font-weight: 700; font-size: .9rem; padding-top: .3rem; border-top: 1px dashed var(--wood); }
.rc-more { margin: .4rem 0 0; color: var(--ink-muted); font-weight: 700; text-align: center; }
.big-done { align-self: center; width: min(40rem, 80%); text-align: center; display: grid; gap: 1rem; }
.big-done b { font-family: var(--font-display); font-size: 6rem; color: var(--accent2); font-weight: 400; }
.big-done span { font-size: 1.6rem; font-weight: 700; }
.bd-bar { height: 1.4rem; background: var(--panel); border-radius: 99px; overflow: hidden; }
.bd-fill { height: 100%; width: 0; background: var(--accent2); transition: width .3s ease-out; }

/* ---------- 폰: 말 색 고르기 · 미니 판 ---------- */
.color-pick { display: grid; grid-template-columns: 3.4rem 1fr; gap: .8rem; align-items: center; margin-top: .8rem; }
.sw-preview svg { display: block; width: 100%; height: auto; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: .35rem; }
.sw { aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--ink); background: var(--c); padding: 0; }
.sw.light { border-width: 3px; }
.sw.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--accent); }
.sw[disabled] { opacity: .2; }
.mini-board { width: 100%; aspect-ratio: 1.3; margin: .8rem 0; }
.wb-pawn { width: 1.6rem; display: inline-block; vertical-align: middle; margin-right: .3rem; }
.wb-pawn svg { display: block; width: 100%; height: auto; }

@media (max-width: 760px), (max-height: 520px) and (orientation: landscape) {
  .finale { grid-template-columns: 1fr; height: auto; }
  .final-board { height: 55vw; }
  .menu-board { height: 50vw; }
  .result2 { height: auto; }
  .res-board { height: 60vw; }
  .tower { flex-basis: 3.4rem; }
  .gcard { scroll-margin: 7rem 0 15rem; }
  .fan { grid-template-columns: repeat(auto-fill, 6.6rem); }
  .gcard { width: 6.6rem; height: 8.6rem; }
}
