/* 모두의 티어표·월드컵 (play 에이전트). 월드컵 엔진(worldcup.js)의 .cup-* 도 여기 */

/* ================================================================ 모두의 티어표 */
.board .tile.agg-few { opacity: .42; filter: grayscale(.55); }
.board .tile.agg-few:hover, .board .tile.agg-few:focus-visible { opacity: .85; filter: none; }
.tile .agg-badge { min-width: 22px; text-align: center; }
.tile .agg-badge.is-n { color: var(--text); }
.agg-count { color: var(--gold-hi); font-weight: 700; }
.agg-help { margin: 0 0 14px; font-size: 13.5px; }
.agg-few-sample { opacity: .8; }
.agg-empty-actions { justify-content: center; }
.board.readonly .pool .pool-head { margin-bottom: 8px; }
.board.readonly .pool .pool-head h3 { font-size: 16px; }

/* ================================================================ 홈: 월드컵 안내 한 줄 */
.vs-promo-wrap { margin-top: 18px; }
.vs-promo {
  display: flex; align-items: center; gap: 12px;
  max-width: 820px; margin: 0 auto;
  padding: 10px 12px 10px 16px;
  border-radius: 14px; border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(229, 72, 77, .14), rgba(22, 24, 31, .7) 40%, rgba(22, 24, 31, .7) 60%, rgba(87, 167, 216, .14));
  color: var(--text); text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.vs-promo:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.vs-promo-icon { font-size: 22px; line-height: 1; }
.vs-promo-text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.vs-promo-text strong { font-family: var(--font-title); font-size: 17px; color: var(--gold-hi); white-space: nowrap; }
.vs-promo-text span { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.vs-promo-go { flex-shrink: 0; }

/* ================================================================ 월드컵 */
.vs-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 8px 16px; margin-bottom: 12px;
}
.vs-counter {
  padding: 3px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(217, 164, 65, .1);
  color: var(--gold-hi); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.vs-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 12px; }
.vs-tabs { flex-shrink: 0; }
.vs-tabs button { padding: 6px 16px; }
.vs-groups {
  flex: 1 1 260px; min-width: 0;
  display: flex; gap: 6px;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
  padding: 2px 2px 4px;
}
.vs-chip {
  --chip: var(--gold);
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.vs-chip[style]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chip); }
.vs-chip:hover { color: var(--text); border-color: rgba(255, 255, 255, .3); }
.vs-chip.on { color: var(--text); border-color: var(--chip); background: color-mix(in srgb, var(--chip) 24%, transparent); }
.vs-note { margin: 0 0 10px; font-size: 13px; }

/* 대결 판 */
.vs-arena { text-align: center; }
.vs-question { margin: 6px 0 14px; font-family: var(--font-title); font-size: clamp(19px, 2.6vw, 24px); color: var(--gold-hi); }
.vs-pair {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: stretch;
  max-width: 780px; margin: 0 auto;
  animation: vs-in .16s ease;
}
@keyframes vs-in { from { opacity: .35; transform: translateY(4px); } }
.vs-side { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.vs-left { --side: #e5484d; }
.vs-right { --side: #57a7d8; }
.vs-pick {
  position: relative;
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .1);
  background:
    radial-gradient(90% 60% at 50% 100%, color-mix(in srgb, var(--side) 16%, transparent), transparent 70%),
    var(--panel);
  color: var(--text); text-align: center; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .vs-pick:hover { border-color: var(--side); transform: translateY(-2px); box-shadow: 0 0 0 1px var(--side), 0 14px 32px rgba(0, 0, 0, .45); }
}
.vs-pick:focus-visible { border-color: var(--side); }
.vs-pick:active { transform: scale(.98); }
/* 그리드 칸의 % 높이는 정해지지 않아 큰 원화(캐릭터)가 카드 밖으로 넘쳤다: 플렉스 + 높이 고정으로 칸 안에 맞춘다 */
.vs-media { width: 100%; height: 280px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.vs-media img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .6)); pointer-events: none; }
.vs-pair.kind-card .vs-media { height: clamp(220px, 40vh, 330px); }
.vs-pair.kind-icon .vs-media { height: 128px; }
.vs-pair.kind-icon .vs-media img { width: 112px; height: 112px; }
.vs-pair.kind-creature .vs-media, .vs-pair.kind-portrait .vs-media { height: clamp(180px, 32vh, 260px); }
.vs-noimg {
  width: min(180px, 100%); height: 100%; display: grid; place-items: center;
  border-radius: 10px; background: linear-gradient(180deg, #2b2f38, #1c1f26); border: 1px solid rgba(255, 255, 255, .12);
  font-family: var(--font-game); font-size: 34px; color: var(--muted);
}
.vs-pair.kind-icon .vs-noimg { width: 112px; height: 112px; }
.vs-name { font-family: var(--font-game); font-weight: 700; font-size: 20px; line-height: 1.2; color: var(--gold-hi); overflow-wrap: anywhere; }
.vs-meta { font-size: 12.5px; color: var(--muted); }
.vs-pick .tip-text { width: 100%; margin-top: 2px; text-align: left; font-size: 13.5px; }
.vs-key {
  position: absolute; top: 8px; left: 10px;
  min-width: 26px; padding: 1px 6px; border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(0, 0, 0, .35);
  color: var(--muted); font-size: 13px; font-weight: 700;
}
.vs-right .vs-key { left: auto; right: 10px; }
.vs-mid {
  align-self: center;
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: radial-gradient(circle at 50% 35%, #3a2a14, #140f08);
  font-family: var(--font-game); font-weight: 700; font-size: 19px; color: var(--gold);
  box-shadow: 0 0 22px rgba(217, 164, 65, .25);
}
.vs-info { align-self: center; }
.vs-last { min-height: 1.6em; margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.vs-last strong { color: var(--gold-hi); }
.vs-last-label { opacity: .85; }
.vs-keys { margin: 2px 0 0; font-size: 12px; color: var(--muted); opacity: .8; }
.vs-head-group { color: var(--muted); font-size: .8em; }

/* 대진 크기 고르기 */
.cup-picker { text-align: center; max-width: 640px; margin: 0 auto; padding: 8px 0 4px; }
.cup-picker-lead { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--text); }
.cup-sizes { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.cup-size {
  flex: 0 1 108px; min-width: 88px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 10px 10px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .14); background: var(--panel);
  color: var(--muted); cursor: pointer; font: inherit;
  transition: border-color .12s ease, transform .12s ease, background .12s ease;
}
.cup-size strong { font-family: var(--font-game); font-size: 22px; line-height: 1.1; color: var(--text); }
.cup-size span { font-size: 12px; font-variant-numeric: tabular-nums; }
.cup-size:hover { border-color: rgba(255, 255, 255, .3); }
.cup-size.on {
  border-color: var(--gold); color: var(--gold-hi);
  background: linear-gradient(180deg, rgba(217, 164, 65, .22), rgba(217, 164, 65, .06)), var(--panel);
  box-shadow: 0 0 0 1px var(--gold), 0 8px 22px rgba(0, 0, 0, .35);
}
.cup-size.on strong { color: var(--gold-hi); }
.cup-size em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--gold); }
/* '전체 n개': 글자가 길어 칸을 넓게 */
.cup-size.is-full { flex-basis: 150px; }
.cup-size.is-full strong { font-size: 18px; white-space: nowrap; }
.cup-picker-note { margin: 14px 0 0; font-size: 13px; }
.cup-start-wrap { margin: 16px 0 0; }
.cup-start { min-width: 200px; font-size: 16px; padding: 10px 22px; }

/* 경기 중: 라운드·진행 막대·되돌리기 */
.cup-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "status tools" "bar bar";
  align-items: center; gap: 6px 12px;
  max-width: 780px; margin: 0 auto 6px; text-align: left;
}
.cup-status { grid-area: status; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.cup-round { font-family: var(--font-game); font-weight: 700; font-size: 20px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.cup-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cup-tools { grid-area: tools; display: flex; gap: 6px; }
.cup-tools .btn[disabled] { opacity: .4; cursor: default; }
.cup-abandon.armed { color: #ff8b8b; border-color: rgba(229, 72, 77, .6); }
.cup-progress { grid-area: bar; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.cup-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c48a28, #f0c76a); transition: width .2s ease; }

/* 예선 동안: 부전승 알림 */
.cup-byes {
  max-width: 780px; margin: 8px auto 4px; padding: 8px 12px; border-radius: 10px; text-align: left;
  border: 1px solid rgba(240, 199, 106, .28); background: rgba(240, 199, 106, .07);
  font-size: 13px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere;
}
.cup-byes-label { font-weight: 700; color: var(--gold-hi); }
.cup-byes-names { color: var(--text); }
.cup-byes-more {
  padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--gold); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}

/* 우승 화면 */
.cup-champ { text-align: center; max-width: 780px; margin: 0 auto; animation: vs-in .25s ease; }
.cup-champ-kicker { margin: 4px 0 0; font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.cup-champ-title { margin: 2px 0 12px; font-family: var(--font-title); font-size: clamp(28px, 5vw, 40px); color: var(--gold-hi); text-shadow: 0 0 24px rgba(240, 199, 106, .35); }
.cup-champ-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: 420px; margin: 0 auto; padding: 20px 16px 16px; border-radius: 18px;
  border: 1px solid var(--gold);
  background: radial-gradient(80% 60% at 50% 30%, rgba(240, 199, 106, .2), transparent 70%), var(--panel);
  box-shadow: 0 0 0 1px rgba(240, 199, 106, .25), 0 0 40px rgba(240, 199, 106, .18), 0 12px 32px rgba(0, 0, 0, .45);
}
.cup-champ-card .vs-media { height: 300px; }
.cup-champ-card.kind-card .vs-media { height: clamp(240px, 42vh, 360px); }
.cup-champ-card.kind-icon .vs-media { height: 140px; }
.cup-champ-card.kind-icon .vs-media img { width: 128px; height: 128px; }
.cup-champ-card.kind-icon .vs-noimg { width: 128px; height: 128px; }
.cup-champ-card.kind-creature .vs-media, .cup-champ-card.kind-portrait .vs-media { height: clamp(200px, 36vh, 300px); }
.cup-champ-name { font-size: 26px; }
.cup-champ-card .tip-text { width: 100%; text-align: left; font-size: 13.5px; }
.cup-after { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; margin: 18px 0 0; text-align: left; }
.cup-road, .cup-runner { padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); background: var(--panel); min-width: 0; }
.cup-road h3, .cup-runner h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 700; }
.cup-road ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cup-road li, .cup-runner-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cup-road-round { flex: 0 0 4.6em; font-size: 12.5px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.cup-road li.final .cup-road-round { color: var(--gold-hi); }
.cup-road li.bye .cup-road-name { color: var(--muted); font-style: italic; }
.cup-road-name { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.cup-road .tile, .cup-runner .tile { flex-shrink: 0; cursor: default; --tile-w: 34px; --tile-h: 46px; --icon: 34px; --creature-w: 44px; --creature-h: 38px; }
.cup-mini {
  flex-shrink: 0; width: 38px; height: 38px; display: grid; place-items: center; overflow: hidden;
  border-radius: 8px; background: #23262e; color: var(--muted); font-weight: 700;
}
.cup-mini img { width: 100%; height: 100%; object-fit: cover; }
.cup-actions { justify-content: center; margin: 18px 0 0; flex-wrap: wrap; }

/* 순위 */
.vs-rank-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 10px; }
.vs-rank-head .vs-rank-status { margin: 0; }
.vs-rank-sort { flex-wrap: wrap; max-width: 100%; }
.vs-rank-sort button { padding: 5px 12px; }
.vs-rank-few-sep { list-style: none; margin: 8px 0 2px; font-size: 12.5px; color: var(--muted); }
@media (min-width: 900px) { .vs-rank-few-sep { grid-column: 1 / -1; } }
.vs-rank-rating small { font-size: .62em; font-weight: 600; color: var(--muted); margin-left: 1px; }
.vs-rank-rating.is-none { color: var(--muted); }
.vs-rank-status { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.vs-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.vs-rank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px 8px 8px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 10px;
  cursor: pointer;
}
.vs-rank-row:hover { border-color: var(--line-strong); }
.vs-rank-row.few { opacity: .6; }
.vs-rank-row .tile { cursor: inherit; --tile-w: 44px; --tile-h: 58px; --icon: 44px; --creature-w: 56px; --creature-h: 48px; }
.vs-rank-no {
  flex: 0 0 2.4em; text-align: center;
  font-family: var(--font-game); font-weight: 700; font-size: 17px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.vs-rank-no.top1 { color: #f0c76a; }
.vs-rank-no.top2 { color: #d4dae2; }
.vs-rank-no.top3 { color: #d8955a; }
.vs-rank-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.vs-rank-name { font-family: var(--font-game); font-weight: 700; font-size: 15.5px; line-height: 1.25; color: var(--gold-hi); overflow-wrap: anywhere; }
.vs-rank-bar { display: block; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.vs-rank-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c48a28, #f0c76a); }
.vs-rank-bar.is-cup span { background: linear-gradient(90deg, #8a6bd8, #c9a6ff); }
.vs-rank-sub { font-size: 12px; line-height: 1.5; color: var(--muted); font-variant-numeric: tabular-nums; }
.vs-rank-cup.has { color: var(--gold); }
.vs-rank-rating { font-family: var(--font-game); font-weight: 700; font-size: 18px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.vs-more { margin: 14px 0 0; text-align: center; }
.vs-rank-help { margin: 12px 0 0; font-size: 13px; }
@media (min-width: 900px) {
  .vs-rank { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- 모바일 ---- */
@media (max-width: 640px) {
  .vs-promo { gap: 10px; padding: 10px 10px 10px 12px; }
  .vs-promo-text strong { font-size: 15.5px; }
  .vs-promo-text span { font-size: 12.5px; }
  .vs-controls { gap: 8px; }
  .vs-groups { flex-basis: 100%; }
  .vs-question { margin: 2px 0 10px; }
  .vs-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .vs-mid {
    position: absolute; left: 50%; top: 38%; z-index: 2;
    transform: translate(-50%, -50%);
    width: 40px; height: 40px; font-size: 15px;
    pointer-events: none;
  }
  .vs-pick { padding: 12px 8px 12px; border-radius: 12px; gap: 4px; }
  .vs-pair.kind-card .vs-media { height: 205px; }
  .vs-pair.kind-icon .vs-media { height: 92px; }
  .vs-pair.kind-icon .vs-media img { width: 84px; height: 84px; }
  .vs-pair.kind-creature .vs-media, .vs-pair.kind-portrait .vs-media { height: 170px; }
  .vs-name { font-size: 16px; }
  .vs-key { display: none; }
  .vs-pair.kind-icon .vs-noimg { width: 84px; height: 84px; }
  .vs-pick .tip-text { font-size: 12.5px; line-height: 1.45; }
  .cup-size { flex-basis: calc(33.333% - 7px); min-width: 0; padding: 10px 6px 8px; }
  .cup-size strong { font-size: 19px; }
  .cup-size.is-full { flex-basis: calc(66.666% - 3px); }
  .cup-size.is-full strong { font-size: 17px; }
  .cup-start { width: 100%; }
  .cup-round { font-size: 17px; }
  .cup-tools .btn { padding-left: 9px; padding-right: 9px; }
  .cup-after { grid-template-columns: minmax(0, 1fr); }
  .cup-champ-card { padding: 16px 12px 12px; }
  .cup-champ-card .vs-media { height: 240px; }
  .cup-champ-card.kind-card .vs-media { height: 260px; }
  .cup-champ-card.kind-creature .vs-media, .cup-champ-card.kind-portrait .vs-media { height: 220px; }
  .cup-champ-name { font-size: 22px; }
  .cup-actions .btn { flex: 1 1 calc(50% - 8px); }
  .vs-rank-row { gap: 8px; padding: 6px 10px 6px 4px; }
  .vs-rank-no { flex-basis: 2em; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .vs-pair, .cup-champ { animation: none; }
  .cup-progress span { transition: none; }
  .vs-pick, .vs-promo { transition: none; }
}
