/* Rank It — the "rank" theme (mint green) and the parts only this game has:
   ready-made list chips, the option builder, tap-to-rank, and the leaderboard.
   Loaded on this game's pages and for its card in the hub; the class comes
   from `theme` in config/rank_it.php. */
.rank {
  --blue: #16a37f;
  --blue-deep: #0d7a5e;
  --line: #8fdcc3;
  --soft: #cdeee3;
}
body.rank {
  background-color: #e0f5ee;
  background-image: url("../shared/sky.svg"), linear-gradient(180deg, #c7ecdf 0%, #e2f6ef 40%, #f6fcfa 100%);
}
.rank .tbtn:not(.tbtn-pink):not(.tbtn-green):not(.tbtn-white) { --face: linear-gradient(180deg, #34c49e, #16a37f); }
.rank .tbtn .arrow { color: var(--blue); }
.rank .tbtn-pink .arrow { color: var(--pink); }
.rank .tbtn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.rank .note::before { background-image: radial-gradient(circle at 12px 12px, #e0f5ee 0 6px, #a9d7c6 6px 8px, transparent 8.5px); }
.rank .note h1 small { display: block; font-size: .5em; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.rank .review li { background: #f3fbf8; }
.rank .review .avatar { flex: none; width: 40px; height: 40px; }
.rank .howto li:nth-child(1) .tile { background: #d6f2e8; }
.rank .field > label { font-size: 17px; }
.rank .tcard .field + .field { margin-top: 6px; }
.rank-sub { margin-top: 0; }

/* — maker: ready-made lists and the option rows — */
.templates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.templates-label { font-size: 14.5px; color: var(--ink-soft); margin-right: 2px; }
.template-chip {
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font-family: var(--font-toon); font-weight: 600; font-size: 14.5px; color: var(--blue-deep);
  background: #effaf6; border: 2px solid var(--soft);
}
.template-chip:hover, .template-chip.is-picked { background: var(--blue); border-color: var(--blue); color: #fff; }
.template-chip:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.rank-option { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; }
.rank-option .input { flex: 1; min-width: 0; }
.rank-option .q-remove { flex: none; }
.rank #q-list { gap: 12px; }

/* — friend: ranking. Without script each option has a place drop-down; with
   rank.js (form.is-tapping) the drop-downs hide and options are tapped in order. — */
.rank-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rank-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: #fff; border: 3px solid var(--soft); border-radius: 20px;
  box-shadow: 0 4px 0 var(--soft);
}
.rank-label { flex: 1; min-width: 0; font-weight: 600; font-size: 17.5px; overflow-wrap: anywhere; }
.rank-select { flex: none; width: 92px; min-height: 44px; padding: 6px 10px; }
.rank-badge { display: none; }
.is-tapping .rank-select { display: none; }
.is-tapping .rank-item { cursor: pointer; user-select: none; transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.is-tapping .rank-item:hover { border-color: var(--line); transform: translateY(-2px); }
.is-tapping .rank-item:active { transform: translateY(2px); }
.is-tapping .rank-item:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.is-tapping .rank-label { cursor: pointer; }
.is-tapping .rank-badge {
  display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%;
  font-weight: 700; font-size: 18px; color: var(--ink-soft);
  background: #f1f5f4; border: 2px dashed #b9c9c3;
}
.is-tapping .rank-item.is-ranked { background: #effaf6; border-color: var(--blue); box-shadow: 0 4px 0 var(--blue); }
.is-tapping .rank-item.is-ranked .rank-badge { color: #fff; background: var(--blue); border: 2px solid #fff; animation: pop .25s ease-out; }
.rank-reset { align-self: flex-start; }

.voter-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.voter-chips li {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px;
  background: #fff; border: 3px solid var(--soft); border-radius: 999px;
}
.voter-chips .avatar { width: 34px; height: 34px; }
.voter-chips b { font-weight: 600; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* — leaderboard — */
.standings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.standing {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px;
  background: #fff; border: 3px solid var(--soft); border-radius: 22px;
  box-shadow: 0 5px 0 rgba(13, 122, 94, .1);
}
.standing.is-top { border-color: var(--yellow); background: #fffbea; box-shadow: 0 5px 0 var(--yellow-deep); }
.standing-place {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px;
  font-size: 28px; font-weight: 700; color: var(--ink-soft);
}
.standing:nth-child(n+4) .standing-place { font-size: 18px; border-radius: 50%; background: #eef5f2; width: 38px; height: 38px; }
.standing-main { flex: 1; min-width: 0; }
.standing-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.standing-item { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.standing.is-top .standing-item { font-size: 20px; }
.standing-share { flex: none; font-weight: 700; font-size: 20px; color: var(--blue-deep); }
.standing .bar { background: #dff3ec; }
.standing .bar i { background: linear-gradient(90deg, #34c49e, #16a37f); }
.standing.is-top .bar i { background: linear-gradient(90deg, #ffd84d, #f4b62a); }
.standing-meta { display: block; margin-top: 4px; font-size: 13.5px; color: var(--ink-soft); }
.standings-note { text-align: center; font-size: 13.5px; }
.my-ranking .td-num {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%;
  font-weight: 700; font-size: 14px; color: #fff !important; background: var(--blue);
}

@media (prefers-reduced-motion: reduce) {
  .is-tapping .rank-item, .is-tapping .rank-item.is-ranked .rank-badge { transition: none; animation: none; }
}

/* — individual rankings: one fold-out per voter — */
.votes { gap: 0; }
.votes > summary { font-size: 19px; }
.votes-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vote { background: #f3fbf8; border: 2px solid var(--soft); border-radius: 18px; }
.vote.is-me { border-color: var(--blue); background: #fff; }
.vote > summary {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer;
  list-style: none; font-size: 16px; font-weight: 400;
}
.vote > summary::-webkit-details-marker { display: none; }
.vote > summary::after { content: "▾"; margin-left: auto; color: var(--ink-soft); transition: transform .15s ease; }
.vote[open] > summary::after { transform: rotate(180deg); }
.vote .avatar { flex: none; width: 38px; height: 38px; }
.vote-who { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.vote-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-who span { font-size: 14px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote.is-me .vote-who b::after { content: " (you)"; font-weight: 400; color: var(--blue-deep); }
.vote-when { flex: none; font-size: 12.5px; color: var(--ink-soft); }
.vote-order { list-style: none; margin: 0; padding: 0 14px 12px 60px; display: flex; flex-direction: column; gap: 6px; }
.vote-order li { display: flex; align-items: center; gap: 10px; font-size: 15.5px; overflow-wrap: anywhere; }
.vote-order .td-num {
  display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%;
  font-weight: 700; font-size: 13px; color: #fff; background: var(--blue);
}
.visibility-note { text-align: center; padding: 0 6px; }

/* — maker's choice: may voters see each other's rankings? — */
.public-votes { flex-direction: row; align-items: flex-start; gap: 12px; cursor: pointer; padding: 16px 18px; }
.public-votes input { flex: none; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--blue); }
.public-votes span { display: flex; flex-direction: column; gap: 4px; }
.public-votes small { font-size: 14px; line-height: 1.4; color: var(--ink-soft); }
