:root {
  color-scheme: dark;
  --ink: oklch(98% 0.004 220);
  --muted: oklch(98% 0.004 220);
  --faint: oklch(98% 0.004 220);
  --panel: oklch(98% 0.015 220 / 7%);
  --panel-strong: oklch(98% 0.015 220 / 12%);
  --line: oklch(100% 0 0 / 14%);
  --line-strong: oklch(100% 0 0 / 28%);
  --gold: oklch(83% 0.12 93);
  --glass-blur: blur(18px) saturate(1.18);
  --shadow: 0 24px 80px oklch(2% 0.02 246 / 46%);
  --page-pad-x: clamp(10px, 1.6vw, 28px);
  --page-pad-top: clamp(16px, 2.2vw, 28px);
  --control-height: clamp(42px, 4.2vw, 46px);
  --card-gap: clamp(10px, 1.45vw, 26px);
  --card-min: clamp(168px, 14.8vw, 230px);
  --card-radius: clamp(18px, 1.4vw, 24px);
  --card-body-pad: clamp(11px, 1.1vw, 16px);
  --group-tile-size: clamp(58px, 4.8vw, 68px);
  --avatar-size: clamp(48px, 4vw, 52px);
  --member-width: clamp(62px, 5vw, 70px);
  font-family: "Noto Sans TC", "Noto Sans JP", "Microsoft JhengHei UI", "Microsoft JhengHei", "Yu Gothic UI", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  font-kerning: normal;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: oklch(100% 0 0 / 18%) transparent; scrollbar-width: thin; }
body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb { background: oklch(100% 0 0 / 16%); border-radius: 999px; }

body {
  color: var(--ink);
  line-height: 1.5;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 13% 0%, oklch(52% 0.16 330 / 25%), transparent 28rem),
    radial-gradient(circle at 90% 4%, oklch(61% 0.13 164 / 22%), transparent 28rem),
    linear-gradient(180deg, oklch(12% 0.036 246), oklch(8% 0.03 248));
}

body::before {
  background-image: linear-gradient(oklch(100% 0 0 / 3.5%) 1px, transparent 1px), linear-gradient(90deg, oklch(100% 0 0 / 3.5%) 1px, transparent 1px);
  background-size: 68px 68px;
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

a { color: inherit; text-decoration: none; }
button, input, select { color: inherit; font: inherit; }
button, select { touch-action: manipulation; }
.site-shell { margin: 0 auto; max-width: 1840px; padding: var(--page-pad-top) var(--page-pad-x) clamp(44px, 5vw, 64px); }

.compact-header { align-items: center; display: grid; gap: clamp(10px, 1.3vw, 18px); grid-template-columns: auto 1fr; margin-bottom: clamp(12px, 1.2vw, 18px); }
.brand { align-items: center; display: inline-flex; gap: clamp(8px, .8vw, 10px); min-width: 0; }
.brand-mark { background: var(--panel-strong); border: 1px solid var(--line); border-radius: 12px; display: grid; height: clamp(38px, 3vw, 42px); overflow: hidden; place-items: center; width: clamp(38px, 3vw, 42px); }
.brand-mark img { height: 100%; object-fit: cover; width: 100%; }
.brand strong { font-size: clamp(32px, 4.4vw, 58px); font-weight: 950; letter-spacing: -.075em; line-height: .9; }
.brand > span:last-child { color: var(--muted); font-size: clamp(14px, 1.2vw, 18px); font-weight: 850; letter-spacing: .24em; text-transform: uppercase; }
.total { color: var(--muted); font-size: clamp(13px, 1.1vw, 16px); font-weight: 850; letter-spacing: .18em; margin: 8px 0 0; text-align: center; text-transform: uppercase; white-space: nowrap; }
.header-actions { align-items: center; display: flex; gap: clamp(8px, 1vw, 12px); justify-content: flex-end; min-width: 0; }
.group-stage { margin: 8px 0 14px; }
.group-icons { display: flex; gap: clamp(10px, 1vw, 14px); justify-content: center; }
.group-tile { align-items: center; background: var(--panel); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; display: grid; height: var(--group-tile-size); padding: 0; place-items: center; transition: border-color .18s ease, transform .18s ease, background .18s ease; width: var(--group-tile-size); }
.group-tile:hover, .group-tile.active { background: var(--panel-strong); border-color: var(--line-strong); transform: translateY(-2px); }
.group-symbol { display: grid; height: 100%; place-items: center; width: 100%; }
.group-symbol img { height: 74%; max-width: 80%; object-fit: contain; object-position: center; width: 80%; }
.group-tile[data-group="equal-love"] .group-symbol img { height: 70%; transform: translateY(1px); width: 70%; }
.group-tile[data-group="not-equal-me"] .group-symbol img { height: 76%; transform: translateY(0); width: 76%; }
.group-tile[data-group="nearly-equal-joy"] .group-symbol img { height: 72%; transform: translateY(-1px); width: 72%; }
.group-symbol b, .group-copy { display: none; }
#resultText { color: var(--muted); font-size: 14px; font-weight: 850; margin: 0; white-space: nowrap; }
#resetButton { background: oklch(83% 0.12 93 / 18%); border: 1px solid oklch(83% 0.12 93 / 48%); border-radius: 999px; cursor: pointer; font-weight: 950; min-height: var(--control-height); padding: 0 clamp(16px, 1.2vw, 20px); }
.last-updated { color: var(--faint); font-size: 12px; font-weight: 850; letter-spacing: .08em; margin: 0; white-space: nowrap; }

main { padding-top: 0; }
.filter-strip { display: grid; gap: clamp(8px, .8vw, 10px); grid-template-columns: repeat(6, minmax(118px, 1fr)) minmax(220px, 1.45fr); margin-bottom: clamp(18px, 2vw, 26px); }
.filter-strip label { align-items: center; background: var(--panel); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--line); border-radius: 10px; display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: var(--control-height); overflow: hidden; }
.filter-strip label > span:not(.visually-hidden) { border-right: 1px solid var(--line); font-size: clamp(13px, .9vw, 15px); font-weight: 950; padding: 0 clamp(10px, 1vw, 14px); white-space: nowrap; }
select, .search-filter input { background: transparent; border: 0; color: var(--muted); font-size: clamp(14px, 1vw, 15px); font-weight: 760; min-height: calc(var(--control-height) - 2px); outline: none; padding: 0 34px 0 clamp(12px, 1vw, 14px); width: 100%; }
select { cursor: pointer; }
select option { background: oklch(98% 0.004 220); color: oklch(13% 0.025 246); }
.search-filter { grid-template-columns: 1fr; position: relative; }
.search-filter input { color: var(--ink); padding-left: 44px; }
.search-filter::before { border: 2px solid var(--muted); border-radius: 50%; content: ""; height: 13px; left: 17px; position: absolute; top: 14px; width: 13px; }
.search-filter::after { background: var(--muted); content: ""; height: 8px; left: 30px; position: absolute; top: 28px; transform: rotate(-45deg); width: 2px; }

.member-avatar-rail { display: grid; grid-template-rows: 0fr; margin: 0 0 8px; opacity: 0; overflow: hidden; transition: grid-template-rows .28s ease, margin .28s ease, opacity .2s ease; }
.member-avatar-rail.open { grid-template-rows: 1fr; margin: 0 0 clamp(18px, 1.8vw, 24px); opacity: 1; }
.member-avatar-rail::-webkit-scrollbar { display: none; }
#memberRail { display: flex; gap: clamp(8px, .8vw, 10px); justify-content: center; min-height: 0; min-width: 100%; overflow-x: auto; padding: 2px 0 8px; scroll-padding-inline: var(--page-pad-x); scrollbar-width: none; }
#memberRail::-webkit-scrollbar { display: none; }
.member-pill { align-items: center; background: transparent; border: 0; color: var(--ink); cursor: pointer; display: grid; flex: 0 0 var(--member-width); gap: clamp(7px, .65vw, 9px); justify-items: center; min-height: 76px; padding: 0; }
.member-pill img, .member-fallback { background: var(--panel-strong); border: 2px solid oklch(100% 0 0 / 78%); border-radius: 999px; box-shadow: 0 8px 22px oklch(2% 0.02 246 / 34%); display: grid; height: var(--avatar-size); object-fit: cover; place-items: center; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; width: var(--avatar-size); }
.member-fallback { color: var(--ink); font-weight: 950; }
.member-pill small { font-size: clamp(11px, .82vw, 12px); font-weight: 800; line-height: 1.18; max-width: calc(var(--member-width) + 18px); min-height: 15px; overflow: hidden; padding-top: 1px; text-overflow: ellipsis; white-space: nowrap; }
.member-pill:hover img, .member-pill:hover .member-fallback, .member-pill.active img, .member-pill.active .member-fallback { border-color: var(--gold); box-shadow: 0 0 0 4px oklch(83% 0.12 93 / 18%), 0 10px 30px oklch(2% 0.02 246 / 42%); transform: translateY(-2px); }
.member-pill.active small { color: var(--ink); }

.card-grid { display: grid; gap: var(--card-gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min)), 1fr)); }
.card { animation: cardIn .24s ease both; background: var(--panel); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--line); border-radius: var(--card-radius); box-shadow: 0 8px 34px oklch(2% 0.02 246 / 22%); content-visibility: auto; contain-intrinsic-size: 420px 620px; overflow: clip; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-4px); }
.card-link { display: block; }
.card-image-wrap { aspect-ratio: 722 / 1024; background: oklch(98% 0.01 95); display: grid; margin: 0; overflow: hidden; place-items: center; }
.card img { display: block; height: 100%; object-fit: cover; width: 100%; }
.card-body { padding: var(--card-body-pad); }
.card-kicker { align-items: center; display: flex; gap: 8px; justify-content: space-between; margin-bottom: clamp(8px, .75vw, 10px); }
.card-kicker span { align-items: center; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); display: inline-flex; font-size: 12px; font-weight: 950; min-height: 28px; padding: 4px 9px; }
.card-group.has-icon { justify-content: center; min-width: 38px; padding-inline: 7px; width: 38px; }
.card-group.has-icon img { display: block; max-height: 16px; max-width: 23px; object-fit: contain; object-position: center; }
.card h3 { font-size: clamp(16px, 1.25vw, 20px); letter-spacing: -.02em; line-height: 1.12; margin: 0 0 7px; overflow-wrap: anywhere; }
.card-label { color: var(--ink); font-size: clamp(12px, .95vw, 14px); font-weight: 820; line-height: 1.28; margin: 0 0 clamp(8px, .85vw, 12px); overflow-wrap: anywhere; }
.card-foot { color: var(--faint); font-size: clamp(11px, .85vw, 13px); font-weight: 850; margin: 0; overflow-wrap: anywhere; }
body.detail-open { overflow: hidden; }
.detail-backdrop { background: oklch(4% 0.03 252 / 72%); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); display: grid; inset: 0; padding: clamp(12px, 2vw, 28px); place-items: center; position: fixed; z-index: 20; }
.detail-backdrop[hidden] { display: none; }
.detail-panel { align-items: center; background: oklch(12% 0.035 246 / 92%); border: 1px solid var(--line-strong); border-radius: 28px; box-shadow: var(--shadow); display: grid; gap: clamp(16px, 2vw, 28px); grid-template-columns: minmax(260px, 520px) minmax(320px, 1fr); height: min(92dvh, 980px); justify-self: center; max-width: 1180px; overflow: hidden; padding: clamp(14px, 1.8vw, 24px); position: relative; width: min(100%, 1180px); }
.detail-panel:focus { outline: 2px solid oklch(83% 0.12 93 / 58%); outline-offset: 3px; }
.detail-close { background: oklch(98% 0.004 220 / 10%); border: 1px solid var(--line); border-radius: 999px; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 950; min-height: 40px; padding: 0 16px; position: absolute; right: 18px; top: 18px; z-index: 2; }
.detail-image-wrap { align-self: center; aspect-ratio: 722 / 1024; background: oklch(98% 0.01 95); border-radius: 22px; justify-self: center; margin: 0; max-height: calc(min(92dvh, 980px) - clamp(28px, 3.6vw, 48px)); overflow: hidden; width: min(100%, 520px); }
.detail-image-wrap img { display: block; height: 100%; object-fit: cover; width: 100%; }
.detail-content { align-self: stretch; min-height: 0; overflow: auto; padding: 4px 4px 4px 0; scrollbar-width: thin; }
.detail-kicker { align-items: center; display: flex; gap: 8px; margin-bottom: 12px; padding-right: 86px; }
.detail-kicker span { align-items: center; border: 1px solid var(--line); border-radius: 999px; display: inline-flex; font-size: 13px; font-weight: 950; min-height: 30px; padding: 4px 10px; }
.detail-group.has-icon { justify-content: center; min-width: 42px; width: 42px; }
.detail-group.has-icon img { display: block; max-height: 16px; max-width: 24px; object-fit: contain; }
.detail-content h2 { font-size: clamp(30px, 4vw, 56px); letter-spacing: -.05em; line-height: .95; margin: 0 0 10px; }
.detail-subtitle { color: var(--ink); font-size: clamp(16px, 1.5vw, 22px); font-weight: 850; line-height: 1.25; margin: 0 0 18px; }
.detail-stats { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; }
.detail-stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.detail-stats span, .detail-meta dt, .skill-facts dt { color: var(--faint); display: block; font-size: 11px; font-weight: 950; letter-spacing: .12em; margin-bottom: 4px; text-transform: uppercase; }
.detail-stats strong { color: var(--ink); display: block; font-size: clamp(15px, 1.4vw, 20px); line-height: 1.15; overflow-wrap: anywhere; }
.detail-block { margin-top: 18px; }
.detail-block h3 { color: var(--ink); font-size: 13px; font-weight: 950; letter-spacing: .16em; margin: 0 0 10px; text-transform: uppercase; }
.detail-skill { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.detail-skill + .detail-skill { margin-top: 10px; }
.detail-skill h4 { font-size: clamp(17px, 1.4vw, 22px); line-height: 1.2; margin: 0 0 8px; }
.detail-skill p, .detail-empty { color: var(--ink); font-size: 14px; font-weight: 780; line-height: 1.55; margin: 0 0 12px; white-space: pre-line; }
.skill-facts, .detail-meta { display: grid; gap: 8px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.skill-facts dd, .detail-meta dd { font-size: 14px; font-weight: 850; line-height: 1.25; margin: 0; overflow-wrap: anywhere; }
.detail-meta { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.detail-open-image { align-items: center; background: oklch(83% 0.12 93 / 18%); border: 1px solid oklch(83% 0.12 93 / 48%); border-radius: 999px; display: inline-flex; font-size: 14px; font-weight: 950; justify-content: center; margin-top: 18px; min-height: 42px; padding: 0 18px; }
.load-sentinel { height: 1px; }
.visually-hidden { clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; scroll-behavior: auto !important; transition-duration: .001ms !important; } }
@media (max-width: 1180px) {
  .filter-strip { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .search-filter { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  :root {
    --page-pad-x: 10px;
    --page-pad-top: 16px;
    --card-gap: 10px;
    --card-radius: 18px;
    --card-body-pad: 11px;
    --control-height: 44px;
    --group-tile-size: 60px;
    --avatar-size: 48px;
    --member-width: 62px;
  }

  .compact-header { align-items: flex-start; grid-template-columns: 1fr; }
  .brand strong { font-size: clamp(32px, 9vw, 42px); }
  .brand > span:last-child { font-size: 13px; letter-spacing: .2em; }
  .header-actions { justify-content: flex-start; margin-inline: calc(var(--page-pad-x) * -1); overflow-x: auto; padding: 0 var(--page-pad-x) 5px; scroll-padding-inline: var(--page-pad-x); scrollbar-width: none; }
  .header-actions::-webkit-scrollbar { display: none; }
  #resultText { display: none; }
  .last-updated { font-size: 11px; }

  .group-stage { margin-top: 6px; }
  .group-icons { justify-content: flex-start; margin-inline: calc(var(--page-pad-x) * -1); overflow-x: auto; padding: 0 var(--page-pad-x) 4px; scroll-padding-inline: var(--page-pad-x); scrollbar-width: none; }
  .group-icons::-webkit-scrollbar { display: none; }
  .total { text-align: left; }

  .filter-strip { display: flex; gap: 8px; margin-inline: calc(var(--page-pad-x) * -1); overflow-x: auto; padding: 0 var(--page-pad-x) 10px; scroll-padding-inline: var(--page-pad-x); scrollbar-width: none; }
  .filter-strip::-webkit-scrollbar { display: none; }
  .filter-strip label { flex: 0 0 min(72vw, 190px); }
  .filter-strip label > span:not(.visually-hidden) { font-size: 13px; padding-inline: 10px; }
  .search-filter { flex-basis: min(82vw, 230px); }

  #memberRail { -webkit-overflow-scrolling: touch; justify-content: flex-start; margin-inline: calc(var(--page-pad-x) * -1); min-width: 0; overscroll-behavior-inline: contain; padding: 2px var(--page-pad-x) 8px; width: calc(100% + (var(--page-pad-x) * 2)); }
  #memberRail::after { content: ""; flex: 0 0 max(44px, env(safe-area-inset-right)); }
  .member-pill { gap: 8px; min-height: 72px; }
  .member-pill small { font-size: 11px; max-width: 74px; }

  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-kicker span { font-size: 11px; min-height: 26px; padding: 3px 7px; }
  .card-group.has-icon { min-width: 34px; width: 34px; }
  .card-group.has-icon img { max-height: 14px; max-width: 21px; }
  .card-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

  .detail-backdrop { padding: 0; place-items: end center; }
  .detail-panel { border-radius: 24px 24px 0 0; gap: 14px; grid-template-columns: 1fr; height: auto; max-height: 96dvh; overflow: auto; padding: 12px; width: 100%; }
  .detail-close { min-height: 38px; right: 14px; top: 14px; }
  .detail-image-wrap { justify-self: center; max-height: 48dvh; width: min(72vw, 280px); }
  .detail-content { overflow: visible; padding: 0; }
  .detail-kicker { padding-right: 80px; }
  .detail-content h2 { font-size: 32px; }
  .detail-subtitle { font-size: 15px; margin-bottom: 14px; }
  .detail-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .detail-stats div, .detail-skill, .detail-meta { border-radius: 14px; padding: 11px; }
  .skill-facts, .detail-meta { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  :root {
    --card-gap: 8px;
    --card-radius: 16px;
    --card-body-pad: 9px;
  }

  .card h3 { font-size: 15px; }
  .card-label { font-size: 11px; }
  .card-foot { font-size: 10px; }
  .card-kicker { gap: 6px; margin-bottom: 7px; }
  .card-kicker span { min-height: 24px; }
}

@media (max-width: 330px) {
  .card-grid { grid-template-columns: 1fr; }
}
