/* SORT — 소트모음 목록 + 소트 진행 화면 */

.sort-wrap {
  max-width: 40rem;
  margin: 0 auto;
}

.sort-intro {
  margin: 0.25rem 0 1.5rem;
  font-size: 13px;
  line-height: 1.7;
  color: #525252;
}

/* ---------- 목록 (sort.html) ---------- */

.sort-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #111;
}

.sort-list-item {
  display: grid;
  grid-template-columns: 1.75rem 64px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.875rem;
  padding: 1rem 0;
  border-bottom: 1px solid #f1f1f1;
  color: inherit;
}

.sort-list-num {
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #a3a3a3;
}

.sort-list-thumb {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 0.375rem;
  background: #f5f5f5;
}

.sort-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sort-list-body {
  min-width: 0;
}

.sort-list-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.sort-list-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 12px;
  color: #737373;
}

.sort-list-arrow {
  font-size: 16px;
  color: #111;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sort-list-item.is-soon {
  cursor: default;
}

.sort-list-item.is-soon .sort-list-title {
  color: #c4c4c4;
}

@media (hover: hover) {
  a.sort-list-item:hover .sort-list-num {
    color: #111;
  }

  a.sort-list-item:hover .sort-list-arrow {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---------- 소트 페이지 공통 머리 ---------- */

.sort-back {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-size: 12px;
  font-weight: 600;
  color: #737373;
}

.sort-back:hover {
  color: #111;
}

.sort-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.sort-desc {
  margin: 0.5rem 0 1.5rem;
  font-size: 13px;
  line-height: 1.7;
  color: #525252;
}

.sort-wrap.is-playing .sort-desc,
.sort-wrap.is-playing .sort-back {
  display: none;
}

.sort-wrap.is-playing .sort-title {
  margin-bottom: 1rem;
  font-size: 15px;
  font-weight: 700;
  color: #737373;
}

/* Image boxes keep the inline aspect-ratio regardless of each file's own ratio */
.sort-preview-img,
.sort-choice-img,
.sort-top-img,
.sort-rank-img {
  position: relative;
  overflow: hidden;
}

.sort-preview-img img,
.sort-choice-img img,
.sort-top-img img,
.sort-rank-img img {
  position: absolute;
  inset: 0;
}

/* ---------- 버튼 ---------- */

.sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.125rem;
  border: 1px solid #d4d4d4;
  border-radius: 9999px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #171717;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.sort-btn:hover:not(:disabled) {
  border-color: #111;
}

.sort-btn--dark {
  border-color: #111;
  background: #111;
  color: #fff;
}

.sort-btn--dark:hover:not(:disabled) {
  background: #404040;
  border-color: #404040;
}

.sort-btn--wide {
  width: 100%;
}

.sort-btn:disabled {
  cursor: default;
  opacity: 0.4;
}

/* ---------- 설정 화면 ---------- */

.sort-resume {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid #111;
  border-radius: 0.75rem;
}

.sort-resume-text {
  margin: 0 0 0.75rem;
  font-size: 14px;
  font-weight: 700;
}

.sort-resume-text span {
  margin-left: 0.25rem;
  font-weight: 500;
  color: #737373;
}

.sort-resume-btns {
  display: flex;
  gap: 0.5rem;
}

.sort-resume-btns .sort-btn {
  flex: 1;
}

.sort-filters {
  margin: 0 0 1.25rem;
  padding: 0;
  border: none;
}

.sort-label {
  padding: 0;
  margin-bottom: 0.625rem;
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #111;
}

.sort-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid #f1f1f1;
}

.sort-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f1f1;
  font-size: 13px;
  cursor: pointer;
}

.sort-check input,
.sort-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sort-check-box {
  position: relative;
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid #c4c4c4;
  border-radius: 0.25rem;
  background: #fff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

input:checked + .sort-check-box {
  border-color: #111;
  background: #111;
}

input:checked + .sort-check-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input:focus-visible + .sort-check-box {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.sort-check-text {
  min-width: 0;
  font-weight: 600;
  color: #262626;
}

.sort-check-count {
  margin-left: auto;
  padding-right: 0.75rem;
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 12px;
  color: #a3a3a3;
}

.sort-groups {
  margin-bottom: 1.5rem;
  border-top: 1px solid #f1f1f1;
  border-bottom: 1px solid #f1f1f1;
}

.sort-groups-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.sort-groups-summary::-webkit-details-marker {
  display: none;
}

.sort-groups-summary::after {
  content: "+";
  margin-left: 0.5rem;
  font-size: 16px;
  font-weight: 500;
}

.sort-groups[open] .sort-groups-summary::after {
  content: "−";
}

.sort-groups-info {
  margin-left: auto;
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #a3a3a3;
}

.sort-groups-tools {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 12px;
  color: #a3a3a3;
}

.sort-groups-tools button {
  font-weight: 600;
  color: #525252;
}

.sort-groups-tools button:hover {
  color: #111;
}

.sort-group-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.5rem;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0;
  cursor: pointer;
}

.sort-group img {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 0.25rem;
  object-fit: cover;
  background: #f5f5f5;
}

.sort-group-body {
  min-width: 0;
  flex: 1;
}

.sort-group-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.sort-group-meta {
  display: block;
  font-size: 11px;
  color: #8a8a8a;
}

.sort-group-count {
  flex-shrink: 0;
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 12px;
  color: #525252;
}

.sort-group-count.is-zero {
  color: #d4d4d4;
}

.sort-group input:not(:checked) ~ img,
.sort-group input:not(:checked) ~ .sort-group-body {
  opacity: 0.35;
}

.sort-preview {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.875rem 0.625rem;
  margin: 0 0 1.75rem;
  padding: 0;
}

@media (min-width: 768px) {
  .sort-preview {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

.sort-preview-item {
  min-width: 0;
}

.sort-preview-img {
  display: block;
  overflow: hidden;
  border-radius: 0.375rem;
  background: #f5f5f5;
}

.sort-preview-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sort-preview-title {
  display: block;
  margin-top: 0.375rem;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  word-break: keep-all;
}

.sort-preview-sub {
  display: block;
  font-size: 10px;
  color: #8a8a8a;
}

.sort-start-row {
  text-align: center;
}

.sort-summary {
  margin: 0 0 0.75rem;
  font-size: 13px;
  color: #525252;
}

.sort-summary strong {
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #111;
}

.sort-note {
  margin: 0.75rem 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: #a3a3a3;
}

/* ---------- 대결 화면 ---------- */

.sort-progress {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: Oswald, Pretendard, sans-serif;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.sort-battle-no {
  font-size: 15px;
}

.sort-pct {
  font-size: 13px;
  color: #737373;
}

.sort-bar {
  height: 3px;
  margin: 0.5rem 0 1.25rem;
  background: #f1f1f1;
}

.sort-bar span {
  display: block;
  height: 100%;
  background: #111;
  transition: width 0.25s ease;
}

.sort-pair {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .sort-pair {
    gap: 1.5rem;
  }
}

.sort-side {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.sort-side .sort-choice {
  flex: 1;
}

.sort-listen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  border: 1px solid #e5e5e5;
  border-radius: 9999px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: #111;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

@media (hover: hover) {
  .sort-listen:hover {
    border-color: #111;
  }
}

.sort-listen.is-on {
  border-color: #111;
  background: #111;
  color: #fff;
}

.sort-player {
  margin-top: 0.75rem;
}

.sort-player[hidden] {
  display: none;
}

.sort-player-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 0.75rem;
  background: #000;
}

.sort-player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.sort-player-cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
  font-size: 12px;
  color: #525252;
}

.sort-player-cap span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sort-player-cap a {
  flex-shrink: 0;
  font-weight: 600;
  color: #111;
}

.sort-choice {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  border-radius: 0.75rem;
  background: #fff;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.sort-choice:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .sort-choice:hover {
    border-color: #111;
  }
}

.sort-choice:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.sort-choice-img {
  display: block;
  width: 100%;
  background: #f5f5f5;
}

.sort-choice-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sort-choice-body {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.75rem 0.75rem 0.875rem;
}

.sort-choice-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.35;
  word-break: keep-all;
}

.sort-choice-alt {
  font-size: 12px;
  font-weight: 500;
  color: #525252;
}

.sort-choice-sub {
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: #737373;
}

.sort-choice-meta {
  font-size: 11px;
  color: #a3a3a3;
}

.sort-choice-tie {
  align-self: flex-start;
  margin-top: 0.375rem;
  padding: 0.0625rem 0.4375rem;
  border: 1px solid #d4d4d4;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  color: #737373;
}

.sort-vs {
  position: absolute;
  top: 30%;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.sort-tie-top {
  margin-bottom: 0.75rem;
}

.sort-tie-bottom {
  margin-top: 0.75rem;
}

.sort-battle-sub {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
}

.sort-battle-sub button {
  font-size: 12px;
  font-weight: 600;
  color: #737373;
}

.sort-battle-sub button:hover:not(:disabled) {
  color: #111;
}

.sort-battle-sub button:disabled {
  cursor: default;
  color: #d4d4d4;
}

.sort-key-hint {
  display: none;
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 11px;
  color: #a3a3a3;
}

@media (hover: hover) and (pointer: fine) {
  .sort-key-hint {
    display: block;
  }
}

/* ---------- 결과 화면 ---------- */

.sort-ticket {
  border: 1px solid #111;
  border-radius: 1rem;
  padding: 1.25rem 1.125rem 1rem;
}

.sort-ticket-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 2px dashed #e5e5e5;
}

.sort-ticket-eyebrow {
  margin: 0;
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.sort-ticket-date {
  margin: 0;
  font-size: 11px;
  color: #8a8a8a;
}

.sort-top {
  display: grid;
  grid-template-columns: 42% minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 0;
}

.sort-top-img {
  display: block;
  overflow: hidden;
  border-radius: 0.625rem;
  background: #f5f5f5;
}

.sort-top-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sort-top-rank {
  display: block;
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}

.sort-top-title {
  margin: 0.5rem 0 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.3;
  word-break: keep-all;
}

.sort-top-alt,
.sort-top-sub {
  margin: 0.25rem 0 0;
  font-size: 12px;
  color: #525252;
}

.sort-top-meta {
  margin: 0.125rem 0 0;
  font-size: 11px;
  color: #a3a3a3;
}

.sort-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #f1f1f1;
}

.sort-rank-rest {
  border-top: none;
}

.sort-rank-row {
  display: grid;
  grid-template-columns: 2rem 44px minmax(0, 1fr);
  align-items: center;
  column-gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid #f5f5f5;
}

.sort-rank-num {
  font-family: Oswald, Pretendard, sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.sort-rank-img {
  display: block;
  width: 44px;
  overflow: hidden;
  border-radius: 0.25rem;
  background: #f5f5f5;
}

.sort-rank-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sort-rank-body {
  min-width: 0;
}

.sort-rank-title,
.sort-rank-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sort-rank-title {
  font-size: 14px;
  font-weight: 700;
}

.sort-rank-sub {
  margin-top: 0.125rem;
  font-size: 11px;
  color: #8a8a8a;
}

.sort-more {
  display: block;
  width: 100%;
  padding: 0.875rem 0 0.25rem;
  font-size: 12px;
  font-weight: 600;
  color: #525252;
}

.sort-more:hover {
  color: #111;
}

.sort-nick {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 1.25rem;
}

.sort-nick-label {
  font-size: 12px;
  font-weight: 700;
  color: #111;
}

.sort-nick-label em {
  font-style: normal;
  font-weight: 500;
  color: #a3a3a3;
}

.sort-nick input {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  border: 1px solid #e5e5e5;
  border-radius: 0.625rem;
  background: #fff;
  font: inherit;
  font-size: 16px;
  color: #111;
}

.sort-nick input::placeholder {
  color: #b5b5b5;
}

.sort-nick input:focus {
  outline: none;
  border-color: #111;
}

.sort-result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.sort-result-actions .sort-btn--wide {
  grid-column: 1 / -1;
}

.sort-toast {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #111;
}
