/* holo ranker 專用樣式 */

.ranker { padding-top: 40px; padding-bottom: 64px; }
.step[hidden] { display: none; }
.loading { text-align: center; color: var(--text-sub); padding: 80px 0; }

.title { font-size: 30px; font-weight: 800; color: var(--blue); margin: 0; text-align: center; letter-spacing: .03em; }
.title-sm { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.lead { text-align: center; color: var(--text-sub); margin: 4px 0 28px; }
.hint { color: var(--text-sub); font-size: 13px; margin: 0; }
.center { text-align: center; justify-content: center; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.panel { background: rgba(255, 255, 255, .92); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.panel.narrow { max-width: 480px; margin: 24px auto 0; }

/* 沒有圖片時的成員卡片（官方圖片關閉時）：代表色＋名字第一個字＋三角形點綴 */
.swatch {
  position: relative; overflow: hidden;
  display: flex !important; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 28px; line-height: 1;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.swatch::before, .swatch::after {
  content: ""; position: absolute; width: 36%; height: 31%;
  background: rgba(255, 255, 255, .28);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.swatch::before { right: 8%; top: 10%; transform: rotate(15deg); }
.swatch::after { left: 6%; bottom: 8%; transform: rotate(-25deg) scale(.6); }
.pick .art .swatch { font-size: 72px; }
.top .art .swatch { font-size: 56px; }
.rank-item .swatch { font-size: 20px; }

/* ===== 步驟 1：暱稱 ===== */
.label { display: block; font-weight: 800; margin-bottom: 6px; }
.input {
  width: 100%; height: 48px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 16px; color: var(--text); background: #fff;
}
.input:focus { border-color: var(--blue-mid); outline: none; }
.error { color: #d9467a; font-size: 13px; margin: 6px 0 0; }
.notice { margin: 16px 0 24px; padding: 12px 16px 12px 32px; background: var(--blue-pale); border-radius: 12px; font-size: 13px; color: var(--text-sub); }
.notice strong { color: var(--text); }
.btn-block { width: 100%; }
.resume { margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--line); text-align: center; }
.resume p { margin: 0 0 10px; color: var(--text-sub); }
.resume .row { justify-content: center; }

/* ===== 步驟 2：選擇成員 ===== */
.step-head { margin-bottom: 16px; }
.filters { background: rgba(255, 255, 255, .92); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; }
.filter-row + .filter-row { border-top: 1px dashed var(--line); }
.filter-label { font-size: 13px; font-weight: 800; color: var(--text-sub); min-width: 52px; }
.check { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; margin-right: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.chip {
  height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff; color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip:hover { border-color: var(--blue-mid); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.part { border-color: var(--blue-mid); color: var(--blue); background: var(--blue-pale); }
.chip.branch { font-weight: 800; }

.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 96px; }
.member {
  position: relative; border: 2px solid transparent; border-radius: 14px; background: #fff;
  padding: 6px 6px 8px; cursor: pointer; text-align: center; color: var(--text);
  box-shadow: 0 0 0 1px var(--line);
}
.member img, .member .swatch { width: 100%; aspect-ratio: 1; border-radius: 10px; display: block; object-fit: cover; background: var(--blue-pale); }
.member .name { font-size: 11px; line-height: 1.35; margin-top: 4px; display: block; word-break: break-word; }
.member .status { font-size: 10px; color: var(--text-muted); display: block; }
.member:not(.on) img, .member:not(.on) .swatch { opacity: .35; filter: grayscale(.6); }
.member:not(.on) .name { color: var(--text-muted); }
.member.on { border-color: var(--blue); box-shadow: none; }
.member.on::after {
  content: "✓"; position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 13px; line-height: 22px; font-weight: 800;
}

.select-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(24px, calc((100vw - 1100px) / 2 + 24px));
}
.select-count { font-size: 14px; color: var(--text-sub); }
.select-count strong { color: var(--blue); font-size: 18px; }

/* ===== 步驟 3：比較 ===== */
.progress { height: 8px; background: var(--blue-light); border-radius: 999px; overflow: hidden; max-width: 720px; margin: 0 auto; }
#progress-bar { height: 100%; width: 0; background: var(--blue); border-radius: 999px; transition: width .25s; }
.progress-text { text-align: center; font-size: 13px; color: var(--text-sub); margin: 6px 0 0; }
.question { text-align: center; font-size: 22px; font-weight: 800; margin: 12px 0 20px; }
.versus { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 760px; margin: 0 auto; }
.pick {
  border: 2px solid var(--line); border-radius: 20px; background: rgba(255, 255, 255, .95);
  padding: 16px 12px 14px; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .15s, transform .1s;
}
.pick:hover { border-color: var(--blue-mid); }
.pick:active { transform: scale(.98); }
.pick .art { height: 420px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.pick .art img { max-height: 100%; max-width: 100%; object-fit: contain; }
.pick .art .swatch { width: 70%; height: 70%; border-radius: 16px; }
.pick .pname { font-size: 17px; font-weight: 800; line-height: 1.4; }
.pick .pgroup { font-size: 12px; color: var(--text-sub); }
.compare-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; max-width: 760px; margin: 20px auto 0; }
.compare-actions #undo { justify-self: start; }
.keys { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px; }

/* ===== 步驟 4：結果 ===== */
.result-head { text-align: center; margin-bottom: 24px; }
.result-name { margin: 0; color: var(--text-sub); font-weight: 800; word-break: break-all; }
.result-date { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.badges { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 14px; }
.badges:empty { display: none; }
.badge {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff7dd; border: 1.5px solid var(--yellow); color: #8a6200;
  padding: 8px 16px; border-radius: 999px; font-size: 13px;
}
.badge-icon { color: var(--yellow); font-size: 20px; }

.podium { display: flex; justify-content: center; align-items: stretch; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.top {
  width: 200px; border: 2px solid var(--line); border-radius: 20px; background: rgba(255, 255, 255, .95);
  padding: 12px 10px; text-align: center; cursor: pointer; color: var(--text);
}
.top:hover { border-color: var(--blue-mid); }
.top .art { height: 280px; display: flex; align-items: flex-end; justify-content: center; }
.top .art img { max-height: 100%; max-width: 100%; object-fit: contain; }
.top .art .swatch { width: 70%; height: 70%; border-radius: 16px; }
.top .rank { font-size: 22px; font-weight: 800; color: var(--blue); }
.top.r1 { border-color: var(--yellow); }
.top.r1 .rank { color: #e0a800; }
.top .pname { font-size: 14px; font-weight: 800; line-height: 1.4; }

.rank-list { list-style: none; margin: 0 auto; padding: 0; max-width: 720px; display: grid; gap: 8px; }
.rank-item {
  display: flex; align-items: center; gap: 14px; padding: 8px 14px 8px 8px;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
}
.rank-item:hover { border-color: var(--blue-mid); }
.rank-item .no { width: 40px; text-align: center; font-size: 18px; font-weight: 800; color: var(--blue); flex: none; }
.rank-item img, .rank-item .swatch { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; background: var(--blue-pale); }
.rank-item .pname { font-size: 14px; font-weight: 800; line-height: 1.4; }
.rank-item .pgroup { font-size: 12px; color: var(--text-sub); }
.result-actions { margin-top: 12px; }
.turnstile { display: flex; justify-content: center; margin-top: 24px; min-height: 65px; }

/* 分享 */
.share { max-width: 720px; margin: 28px auto 0; padding: 18px 20px; background: rgba(255, 255, 255, .92); border: 1px solid var(--line); border-radius: var(--radius); }
.share-title { text-align: center; font-weight: 800; margin: 0 0 12px; }
.share-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.share-btn { min-height: 40px; padding: 0 16px; font-size: 14px; }
#share-msg { min-height: 1.7em; margin-top: 8px; }

/* 列印：只印結果，不印按鈕和背景 */
@media print {
  .bg, .site-header, .site-footer, .no-print, .result-actions { display: none !important; }
  body { background: #fff; }
  .ranker { padding: 0; }
  .top, .rank-item { break-inside: avoid; }
  .top { width: 160px; }
  .top .art { height: 220px; }
  .rank-list { grid-template-columns: 1fr 1fr; max-width: none; }
}

/* 切換衣裝視窗 */
.costume-dialog { border: none; border-radius: 20px; padding: 20px; max-width: min(520px, calc(100vw - 32px)); width: 100%; color: var(--text); }
.costume-dialog::backdrop { background: rgba(30, 50, 70, .45); }
.dialog-close { position: absolute; top: 8px; right: 12px; border: none; background: none; font-size: 28px; color: var(--text-sub); cursor: pointer; }
.costume-name { font-size: 16px; font-weight: 800; margin: 0 32px 8px 0; }
.costume-full { display: block; height: min(52vh, 460px); max-width: 100%; margin: 0 auto 12px; object-fit: contain; }
.costume-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.costume-list button { flex: none; width: 60px; height: 60px; padding: 0; border-radius: 12px; border: 2px solid var(--line); background: var(--blue-pale); overflow: hidden; cursor: pointer; }
.costume-list button.on { border-color: var(--blue); }
.costume-list img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ===== 手機版 ===== */
@media (max-width: 768px) {
  .ranker { padding-top: 24px; }
  .title { font-size: 24px; }
  .title-sm { font-size: 18px; }
  .panel { padding: 22px 18px; }
  .filters { padding: 12px 14px; }
  .member-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
  .member { padding: 4px 4px 6px; }
  .member .name { font-size: 10px; }
  .select-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 16px; }
  .select-bar .row { justify-content: space-between; }
  .select-bar #sel-start { flex: 1; }
  .question { font-size: 18px; margin: 10px 0 14px; }
  .versus { gap: 10px; }
  .pick { padding: 10px 6px; border-radius: 16px; }
  .pick .art { height: 44vh; max-height: 360px; }
  .pick .pname { font-size: 14px; }
  .podium { gap: 8px; }
  .top { width: calc(33.3% - 6px); padding: 8px 4px; border-radius: 14px; }
  .top .art { height: 160px; }
  .top .rank { font-size: 18px; }
  .top .pname { font-size: 11px; }
  .rank-item { gap: 10px; }
  .rank-item .no { width: 30px; font-size: 16px; }
  .rank-item img, .rank-item .swatch { width: 44px; height: 44px; }
  .badge { font-size: 12px; text-align: left; border-radius: 16px; }
}
