/* ==========================================================================
   坂道喜好排序 · sort.css
   设计基准：HOME_V1_APPROVED（#F7F6F2 暖白 / 1px 细线 / 无阴影 / 4-64 间距刻度）
   字体：通过 .typography-scope 与 .type-* 完整语义角色使用 assets/typography.css
   token；本文件不自定义字号/字重/行高三元组（品牌站名 20px 为已确认基准例外）。
   ========================================================================== */

:root {
  --ps-bg: #F7F6F2;
  --ps-surface: #FCFBF8;
  --ps-text: #24272C;
  --ps-aux: #555A60;
  --ps-weak: #73716B;
  --ps-line: #DDDAD2;
  --ps-line-strong: #8B8880;
  --ps-brand: #EC4899;
  --ps-radius-s: 6px;
  --ps-radius-m: 10px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ps-bg);
  color: var(--ps-text);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ---- Header ---- */
.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 24px;
  border-bottom: 1px solid var(--ps-line);
}
/* 品牌站名：沿用已确认首页基准（editorial 20px/700 + 欲求分色），属保护例外 */
.site-head__wordmark {
  font-family: var(--type-font-ja);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  color: var(--ps-text);
}
.site-head__wordmark .brand-yoku,
.site-head__wordmark .brand-kyu { color: var(--ps-brand); }
.site-head__nav { display: flex; gap: 16px; }
.site-head__nav a {
  color: var(--ps-aux);
  text-decoration: none;
}
.site-head__nav a:hover { color: var(--ps-text); text-decoration: underline; }

/* ---- Page frame ---- */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}
.page-title-row { margin-bottom: 24px; }
.page-title { margin: 0 0 8px; }
.page-sub { margin: 0; color: var(--ps-aux); }

/* ---- Steps ---- */
.steps {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0 0 32px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--ps-line);
}
.steps__item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ps-weak);
}
.steps__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 50%;
  font-family: var(--type-font-latin);
}
.steps__item.is-active { color: var(--ps-text); }
.steps__item.is-active .steps__num {
  background: var(--ps-text);
  border-color: var(--ps-text);
  color: var(--ps-surface);
}
.steps__item.is-done { color: var(--ps-aux); }

/* ---- Notice / errors ---- */
.notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--ps-line-strong);
  border-radius: var(--ps-radius-s);
  background: var(--ps-surface);
  color: var(--ps-aux);
}
.load-error { margin: 48px 0; text-align: center; }
.load-error .btn { margin-top: 12px; }

/* ---- Resume ---- */
.resume-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 12px 16px;
  border: 1px solid var(--ps-line-strong);
  border-radius: var(--ps-radius-s);
  background: var(--ps-surface);
}
.resume-bar p { margin: 0; color: var(--ps-aux); }
.resume-bar__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Mode tabs ---- */
.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--ps-line);
}
.mode-tab {
  appearance: none;
  font-family: inherit;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  padding: 8px 12px;
  color: var(--ps-aux);
  cursor: pointer;
}
.mode-tab[aria-selected="true"] {
  color: var(--ps-text);
  border-bottom-color: var(--ps-text);
}

/* ---- Filters ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 12px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { color: var(--ps-weak); }
.field select,
.field input {
  font-family: inherit;
  padding: 6px 8px;
  border: 1px solid var(--ps-line-strong);
  border-radius: var(--ps-radius-s);
  background: var(--ps-surface);
  color: var(--ps-text);
  min-height: 34px;
}
.field--search { flex: 1 1 200px; }
.field--search input { width: 100%; }

.data-note { margin: 0 0 16px; color: var(--ps-weak); }

/* ---- Selection toolbar ---- */
.selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.selection-toolbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.selection-count { margin: 0; color: var(--ps-aux); }

/* ---- Pick list ---- */
.pick-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  border-top: 1px solid var(--ps-line);
  max-height: 420px;
  overflow-y: auto;
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--ps-line);
  cursor: pointer;
}
.pick-item:hover { background: var(--ps-surface); }
.pick-item input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--ps-text);
  flex: none;
}
.pick-item__thumb {
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--ps-radius-s);
  border: 1px solid var(--ps-line);
  background: var(--ps-surface);
  object-fit: cover;
  display: block;
}
.pick-item__initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--ps-radius-s);
  border: 1px solid var(--ps-line);
  background: var(--ps-surface);
  color: var(--ps-weak);
}
.pick-item__main { min-width: 0; flex: 1; }
.pick-item__name { display: block; }
/* 仅对已通过 Intl.Segmenter 插入 <wbr> 词间断点的日文长名局部启用 keep-all。 */
.js-wbr { word-break: keep-all; }
.pick-item__meta {
  display: block;
  color: var(--ps-weak);
}
.group-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: 1px;
}
.pick-empty { color: var(--ps-aux); }

/* ---- Start bar ---- */
.start-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.start-bar p { margin: 0; color: var(--ps-weak); }

/* ---- Buttons ---- */
.btn {
  appearance: none;
  font-family: inherit;
  border: 1px solid var(--ps-line-strong);
  border-radius: var(--ps-radius-s);
  background: var(--ps-surface);
  color: var(--ps-text);
  padding: 8px 16px;
  cursor: pointer;
}
.btn:hover { border-color: var(--ps-text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--ps-line-strong); }
.btn--primary {
  background: var(--ps-text);
  border-color: var(--ps-text);
  color: var(--ps-surface);
}
.btn--primary:hover { background: #000; }
.btn--large { padding: 12px 32px; }
.btn--quiet { border-color: transparent; color: var(--ps-weak); }
.btn--quiet:hover { border-color: var(--ps-line-strong); color: var(--ps-text); }

/* ---- Compare ---- */
.compare-progress { margin-bottom: 24px; }
.compare-progress p { margin: 0 0 4px; }
#progress-est { color: var(--ps-weak); }
.progress-track {
  height: 4px;
  border-radius: 2px;
  background: var(--ps-line);
  overflow: hidden;
  margin: 8px 0 4px;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--ps-text);
  transition: width 0.2s ease-out;
}

.compare-question { margin: 0 0 16px; color: var(--ps-aux); }

.compare-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}
.choice-panel {
  appearance: none;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px 16px;
  border: 1px solid var(--ps-line-strong);
  border-radius: var(--ps-radius-m);
  background: var(--ps-surface);
  color: var(--ps-text);
  cursor: pointer;
  text-align: center;
  min-width: 0;
}
.choice-panel:hover { border-color: var(--ps-text); }
.choice-panel:focus-visible {
  outline: 2px solid var(--ps-text);
  outline-offset: 2px;
}
.choice-panel__media {
  width: 120px; height: 120px;
  border-radius: var(--ps-radius-m);
  border: 1px solid var(--ps-line);
  background: var(--ps-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.choice-panel__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.choice-panel__media .initials { color: var(--ps-weak); }
.choice-panel__name { display: block; max-width: 100%; }
.choice-panel__meta { color: var(--ps-weak); }
.choice-panel__hint { color: var(--ps-weak); }

.compare-links { margin: 0 0 16px; color: var(--ps-weak); }
.compare-links a { color: var(--ps-aux); }

.compare-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.reset-row {
  border-top: 1px solid var(--ps-line);
  padding-top: 16px;
}
.reset-confirm,
.inline-confirm {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.reset-confirm { margin-left: 12px; }

/* ---- Result ---- */
.result-head { margin-bottom: 16px; }
.result-head h2 { margin: 0 0 4px; }
.result-head p { margin: 0; color: var(--ps-weak); }

.rank-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  border-top: 1px solid var(--ps-line);
}
.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--ps-line);
}
.rank-item__rank {
  flex: none;
  width: 40px;
  text-align: right;
  color: var(--ps-aux);
}
.rank-item__thumb,
.rank-item__initials {
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--ps-radius-s);
  border: 1px solid var(--ps-line);
  background: var(--ps-surface);
  object-fit: cover;
}
.rank-item__initials {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ps-weak);
}
.rank-item__main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.rank-item__name { display: block; }
.rank-item__meta {
  display: block;
  color: var(--ps-weak);
}

.export-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.copy-fallback {
  width: 100%;
  min-height: 160px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--ps-line-strong);
  border-radius: var(--ps-radius-s);
  background: var(--ps-surface);
  color: var(--ps-text);
  font-family: inherit;
  resize: vertical;
}
.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--ps-line);
  padding-top: 16px;
}

/* ---- Footer ---- */
.site-foot {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  border-top: 1px solid var(--ps-line);
  color: var(--ps-weak);
}
.site-foot p { margin: 0 0 4px; }
.site-foot a { color: var(--ps-aux); }

/* ---- Mobile ---- */
@media (max-width: 560px) {
  .page { padding: 24px 16px 40px; }
  .site-head { padding: 12px 16px; }
  .steps { gap: 12px; }
  .compare-panels { grid-template-columns: 1fr; gap: 12px; }
  .choice-panel { padding: 16px 12px 12px; }
  .choice-panel__media { width: 96px; height: 96px; }
  .choice-panel__hint { display: none; }
  .rank-item__rank { width: 32px; }
}
