/* Compare page — visual picker + empty states */

body.page-compare {
  padding-bottom: calc(var(--mbn-h) + var(--safe-bottom) + 16px);
}

body.page-compare .toast {
  bottom: calc(var(--mbn-h) + var(--safe-bottom) + 16px);
}

body.page-compare .compat-pct {
  font-size: clamp(36px, 8vw, 48px) !important;
}

.compare-page-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.compare-page-head {
  padding-top: 20px;
  margin-bottom: 24px;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.compare-page-title {
  font-family: 'Playfair Display', serif !important;
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  color: var(--white);
  margin: 0 0 6px;
  line-height: 1.15;
}

.compare-page-sub {
  font-size: 13px;
  color: var(--muted2);
  max-width: 520px;
  line-height: 1.6;
  margin: 0;
}

.compare-mode-bar {
  display: inline-flex;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.compare-mode-btn {
  padding: 10px 20px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: none;
  border: none;
  color: var(--muted2);
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
}

.compare-mode-btn:hover {
  color: var(--text);
}

.compare-mode-btn.active {
  color: var(--gold);
  background: rgba(200, 169, 110, 0.08);
}

.compare-picker-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.compare-picker-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold2);
  margin-bottom: 14px;
}

.compare-friend-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.compare-friend-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 2px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
  min-width: 0;
  min-height: 44px;
}

.compare-friend-chip:hover {
  border-color: var(--gold2);
  transform: translateY(-1px);
}

.compare-friend-chip.active {
  border-color: var(--gold);
  background: rgba(200, 169, 110, 0.06);
}

.compare-friend-chip.no-profile {
  opacity: 0.65;
}

.chip-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  color: var(--gold);
  flex-shrink: 0;
}

.chip-meta {
  min-width: 0;
}

.chip-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.chip-types {
  font-size: 11px;
  color: var(--muted2);
}

.compare-picker-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}

.compare-picker-hint a {
  color: var(--gold);
}

.compare-results {
  opacity: 1;
  transition: opacity 0.25s;
}

.compare-results.is-empty .profiles-strip,
.compare-results.is-empty .compare-score-block {
  opacity: 0.35;
  pointer-events: none;
}

.compare-results.is-empty .compare-tabs-wrap,
.compare-results.is-ready .compare-tabs-wrap,
.compare-results.is-pending .compare-tabs-wrap {
  opacity: 1;
  pointer-events: auto;
}

.compare-results.is-empty .compare-content {
  display: block;
}

.compare-results.is-ready .compare-content,
.compare-results.is-pending .compare-content {
  display: block;
}

.compare-results.is-ready .compare-panel-empty {
  display: none;
}

.compare-score-block.is-hidden {
  display: none;
}

.compare-data-notice {
  font-size: 12px;
  color: var(--muted2);
  line-height: 1.55;
  padding: 12px 28px 0;
  max-width: 1000px;
  margin: 0 auto;
  border-left: 2px solid var(--gold2);
  padding-left: 14px;
  margin-bottom: 8px;
}

.compare-tabs-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 16px 0;
  border: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-bottom: none;
  background: var(--surface);
  position: sticky;
  top: calc(var(--nav-h) + var(--compare-mode-h, 44px) + env(safe-area-inset-top, 0px));
  z-index: 210;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.compare-results.is-pending .compare-content .c-panel {
  opacity: 0.5;
}

/* ── Visual tab cards ── */
.compare-stack .compare-tabs-wrap,
.compare-stack .compare-share-bar,
.compare-stack .compare-content {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.compare-stack .compare-tabs-wrap {
  border-left: none;
  border-right: none;
}

.compare-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.compare-tabs::-webkit-scrollbar {
  height: 4px;
}

.compare-tabs::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}

.compare-tab {
  flex: 1 1 0;
  min-width: 108px;
  max-width: 180px;
}

@media (min-width: 901px) {
  .compare-tab {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }
}

.compare-panel-card .ai-block-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
}

.compare-panel-card .ai-block-text p {
  margin: 0 0 14px;
}

.compare-panel-card .ai-block-text p:last-child {
  margin-bottom: 0;
}

.compare-panel-card .ai-block {
  padding: 18px 20px;
  border-left: 3px solid var(--gold2);
}

.compare-panel-card .ai-section-title {
  font-size: 10px;
  letter-spacing: 0.22em;
  margin-bottom: 10px;
}

.compare-ai-note {
  text-align: left;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 2px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  font-size: 12px;
}

.compare-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 88px;
  padding: 12px 10px;
  border: 1px solid var(--border2);
  border-radius: 2px;
  background: var(--bg);
  color: var(--muted2);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition:
    border-color 0.2s,
    background 0.2s,
    color 0.2s,
    transform 0.15s,
    box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.compare-tab::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.compare-tab[data-panel='ai']::before {
  background: radial-gradient(ellipse at 50% 0%, rgba(200, 169, 110, 0.18), transparent 70%);
}
.compare-tab[data-panel='cognition']::before {
  background: radial-gradient(ellipse at 50% 0%, rgba(120, 160, 220, 0.16), transparent 70%);
}
.compare-tab[data-panel='personality']::before {
  background: radial-gradient(ellipse at 50% 0%, rgba(200, 120, 150, 0.14), transparent 70%);
}
.compare-tab[data-panel='philosophy']::before {
  background: radial-gradient(ellipse at 50% 0%, rgba(140, 130, 220, 0.16), transparent 70%);
}
.compare-tab[data-panel='summary']::before {
  background: radial-gradient(ellipse at 50% 0%, rgba(74, 158, 106, 0.14), transparent 70%);
}

.compare-tab:hover {
  color: var(--text);
  border-color: var(--gold2);
  transform: translateY(-2px);
}

.compare-tab.active {
  color: var(--white);
  border-color: var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
  text-shadow: none;
}

.compare-tab.active::before {
  opacity: 1;
}

.compare-tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--surface2);
  transition: border-color 0.2s, background 0.2s;
}

.compare-tab-icon svg {
  width: 20px;
  height: 20px;
}

.compare-tab.active .compare-tab-icon {
  border-color: var(--gold2);
  background: rgba(200, 169, 110, 0.12);
  color: var(--gold);
}

.compare-tab[data-panel='cognition'].active .compare-tab-icon {
  border-color: rgba(120, 160, 220, 0.5);
  background: rgba(120, 160, 220, 0.12);
  color: #8cb4e8;
}
.compare-tab[data-panel='personality'].active .compare-tab-icon {
  border-color: rgba(200, 120, 150, 0.5);
  background: rgba(200, 120, 150, 0.1);
  color: #d49aaa;
}
.compare-tab[data-panel='philosophy'].active .compare-tab-icon {
  border-color: rgba(140, 130, 220, 0.5);
  background: rgba(140, 130, 220, 0.12);
  color: #a89ee8;
}
.compare-tab[data-panel='summary'].active .compare-tab-icon {
  border-color: rgba(74, 158, 106, 0.5);
  background: rgba(74, 158, 106, 0.12);
  color: var(--green);
}

.compare-tab-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.compare-tab-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px;
  letter-spacing: 0.08em;
  line-height: 1;
  color: inherit;
}

.compare-tab-desc {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.compare-tab.active .compare-tab-desc {
  color: var(--muted2);
}

/* ── Panel cards ── */
.compare-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 24px 32px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 2px 2px;
}

.c-panel {
  display: none;
}

.c-panel.active {
  display: block;
  animation: comparePanelIn 0.35s ease;
}

.c-panel.panel-enter {
  animation: comparePanelIn 0.35s ease;
}

@keyframes comparePanelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.compare-panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 24px 26px 28px;
  margin-top: 16px;
  box-shadow: none;
}

.compare-panel-head {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.compare-panel-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 0.06em;
  color: var(--white);
  line-height: 1;
  margin: 0 0 6px;
  font-weight: 400;
}

.compare-panel-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted2);
}

.compare-legend-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px !important;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.compare-legend-pills .dual-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.legend-dot {
  flex-shrink: 0;
}

.legend-you {
  background: linear-gradient(135deg, var(--gold2), var(--gold));
}

.legend-them {
  background: linear-gradient(135deg, var(--green2), var(--green));
}

.compare-legend-pills .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.compare-panel-card .dual-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 16px 8px;
  margin-bottom: 20px;
}

.compare-panel-card .dual-section-title {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--gold2);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.compare-panel-card .dual-section-title::before {
  width: 24px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold2), var(--gold));
}

.compare-panel-card .dual-row {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.compare-panel-card .dual-row:hover {
  border-color: var(--border2);
  background: rgba(200, 169, 110, 0.03);
}

.compare-panel-card .dual-bar-wrap {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  display: block;
}

.compare-panel-card .dual-bar-you,
.compare-panel-card .dual-bar-them {
  display: block;
  height: 100%;
  width: 0;
  min-width: 0;
  border-radius: 999px;
  transition: width 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

.compare-panel-card .dual-bar-you {
  background: linear-gradient(90deg, var(--gold2), var(--gold));
  box-shadow: 0 0 12px rgba(200, 169, 110, 0.35);
}

.compare-panel-card .dual-bar-them {
  background: linear-gradient(90deg, var(--green2), var(--green));
  box-shadow: 0 0 12px rgba(74, 158, 106, 0.3);
}

.dual-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.dual-label {
  flex: 0 0 88px;
  min-width: 72px;
  font-size: 11px;
  line-height: 1.3;
}

.dual-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.dual-nums {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 36px;
  text-align: right;
  font-size: 12px;
  line-height: 1;
}

.ph-mbti-name {
  font-size: 11px;
  color: var(--muted2);
  font-style: italic;
  margin-top: 2px;
  line-height: 1.35;
}

.compare-panel-card .dual-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.compare-panel-card .dual-label strong {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* AI blocks */
.compare-panel-card .ai-section {
  margin-bottom: 22px;
}

.compare-panel-card .ai-block {
  border-radius: 8px;
  border-left-width: 3px;
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface) 100%);
}

.compare-panel-card .ai-section-title {
  color: var(--gold);
  font-size: 10px;
}

/* Summary table */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.summary-table th,
.summary-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.summary-table tbody tr:last-child td {
  border-bottom: none;
}

.summary-table-wrap {
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface2);
}

.compare-panel-card .summary-table th {
  background: var(--bg);
  padding: 14px 16px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted2);
}

.compare-panel-card .summary-table td {
  padding: 12px 16px;
}

.compare-panel-card .summary-table tbody tr:hover td {
  background: rgba(200, 169, 110, 0.04);
}

.compare-share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-top: none;
  border-bottom: none;
}

.btn-share-comp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  min-height: 44px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  box-sizing: border-box;
}

.compare-share-bar .btn-share-comp {
  border-radius: 8px;
  min-height: 44px;
}

.btn-share-comp.btn-gold {
  background: var(--gold);
  color: #000;
}

.btn-share-comp.btn-gold:hover {
  background: var(--gold3, #d4b87a);
  color: #000;
}

.btn-share-comp.btn-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text);
}

.btn-share-comp.btn-outline:hover {
  border-color: var(--gold2);
  color: var(--gold);
}

.compare-panel-empty {
  padding: 48px 24px;
  border: 1px dashed var(--border2);
  border-radius: 10px;
  background: var(--surface2);
}

.compare-empty-banner {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--gold);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.55;
}

.compare-results.is-ready .compare-empty-banner {
  display: none;
}

/* Unified results stack — hero + tabs + panels read as one surface */
.compare-stack {
  max-width: 1000px;
  margin: 0 auto;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}

.compare-hero {
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  overflow: hidden;
  background: var(--surface);
  position: relative;
}

.compare-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(200, 169, 110, 0.08) 0%, transparent 58%);
  pointer-events: none;
}

.compare-hero-inner {
  position: relative;
  z-index: 1;
  padding: 8px 0 4px;
}

.profiles-strip {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: center;
  padding: 12px 28px 8px;
  border-bottom: 1px solid var(--border);
}

.profile-half {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  min-width: 0;
}

.ph-info {
  min-width: 0;
}

.profile-half.right {
  flex-direction: row-reverse;
  text-align: right;
}

.ph-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  color: var(--gold);
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.ph-avatar.them {
  border-color: var(--green2);
  color: var(--green);
}

.ph-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--white);
}

.ph-username {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.ph-type {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  color: var(--gold);
  letter-spacing: 0.06em;
  line-height: 1;
}

.ph-type.them {
  color: var(--green);
}

.ph-enn {
  font-size: 11px;
  color: var(--muted2);
}

.vs-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
  letter-spacing: 0.14em;
  border-color: var(--gold2);
  color: var(--gold);
  background: var(--bg);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(200, 169, 110, 0.08);
}

.compat-bar-wrap {
  background: var(--surface2);
  margin: 16px 28px 8px;
  padding: 20px 24px;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.compat-label {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  text-align: center;
}

.compat-score-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.compat-pct {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 48px;
  color: var(--white);
  letter-spacing: 0.04em;
  line-height: 1;
  min-width: 90px;
}

.compat-pct span {
  font-size: 24px;
  color: var(--muted2);
}

.compat-verdict {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--muted2);
  min-width: 0;
  line-height: 1.5;
}

.compat-track {
  flex: 1;
  border-radius: 999px;
  overflow: hidden;
  height: 8px;
  background: var(--border);
}

.compat-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 901px) {
  .compat-rings {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    padding: 16px 28px 28px;
  }

  .ring-item {
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .compare-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    grid-template-columns: unset;
  }

  .compare-tab {
    flex: 0 0 auto;
    min-width: 100px;
    scroll-snap-align: start;
  }
}

.profiles-strip .ph-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.compat-rings .ring-svg circle:last-of-type {
  transition: stroke-dashoffset 0.8s ease;
}

.compare-mode-pair.hidden,
.compare-mode-group:not(.active) {
  display: none !important;
}

.compare-mode-group.active {
  display: block;
}

body.page-compare .compare-page-wrap {
  padding-top: 8px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

body.page-compare .compare-mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 16px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  overflow: hidden;
  position: sticky;
  top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  z-index: 211;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

body.page-compare .compare-mode-btn {
  flex: 1;
  min-height: 44px;
}

body.page-compare .friends-picker-bar {
  margin-top: 0;
}

.compare-picker-card {
  margin-top: 0;
}

.compare-panel-empty,
.compare-ai-loading,
.compare-ai-note {
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.65;
  padding: 20px 0;
  text-align: center;
}

.compare-ai-loading strong {
  color: var(--text);
  font-weight: 500;
}

.ai-block-text {
  white-space: pre-line;
}

.compare-ai-note {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 16px;
  text-align: left;
  border-left: 2px solid var(--gold2);
  padding-left: 12px;
}

.c-panel .dual-row {
  margin-bottom: 14px;
}

.c-panel .dual-bar-you,
.c-panel .dual-bar-them {
  min-width: 2px;
}

@media (max-width: 768px) {
  .compare-page-wrap {
    padding-left: 14px;
    padding-right: 14px;
  }

  .compare-picker-card {
    padding: 16px;
  }

  .compare-friend-chip {
    flex: 1 1 100%;
  }

  .chip-name {
    max-width: none;
  }

  .compare-hero-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .compare-data-notice {
    padding-left: 16px;
    padding-right: 16px;
  }

  .compare-tabs-wrap {
    padding: 12px 12px 0;
  }

  .compare-share-bar {
    padding: 12px 16px;
  }

  .compare-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 12px;
    scrollbar-width: none;
  }

  .compare-tabs::-webkit-scrollbar {
    display: none;
  }

  .compare-tab {
    flex: 0 0 auto;
    min-width: 92px;
    min-height: 96px;
    scroll-snap-align: start;
    padding: 10px 8px;
  }

  .compare-tab-icon {
    width: 36px;
    height: 36px;
  }

  .compare-tab-icon svg {
    width: 18px;
    height: 18px;
  }

  .compare-tab-label {
    font-size: 14px;
  }

  .compare-tab-desc {
    font-size: 8px;
  }

  .compare-content {
    padding: 16px 14px calc(var(--mbn-h) + var(--safe-bottom) + 24px) !important;
  }

  .compare-panel-card {
    padding: 18px 14px 22px;
    margin-top: 14px;
    border-radius: 10px;
  }

  .compare-panel-title {
    font-size: 24px;
  }

  .compare-legend-pills {
    padding: 8px 10px;
  }

  .compare-legend-pills .dual-legend-item {
    font-size: 11px;
    padding: 5px 10px;
  }

  .compare-panel-card .dual-section {
    padding: 14px 10px 6px;
  }

  .compare-panel-card .dual-row {
    padding: 8px 8px;
  }

  .compare-share-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .btn-share-comp {
    width: 100%;
    justify-content: center;
  }

  .dual-row {
    gap: 8px;
    margin-bottom: 14px;
  }

  .dual-label {
    min-width: 56px;
    flex-shrink: 0;
    font-size: 10px;
  }

  .dual-bars {
    flex: 1;
    min-width: 0;
    gap: 4px;
  }

  .dual-bar-wrap {
    height: 8px;
  }

  .dual-nums {
    font-size: 11px;
  }

  .profiles-strip {
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: center;
  }
  .profile-half,
  .profile-half.right {
    flex-direction: column;
    text-align: center;
  }
  .vs-circle {
    margin: 0 auto;
  }
  .compat-score-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }
  .compat-pct {
    font-size: 40px;
    min-width: 0;
  }
  .compat-verdict {
    min-width: 0;
    width: 100%;
    text-align: center;
    font-size: 13px;
  }
  .compat-bar-wrap {
    margin: 0 16px;
    padding: 16px;
  }

  .compat-rings {
    justify-content: center;
    gap: 12px;
    padding: 8px 16px 20px;
  }

  .ring-item {
    min-width: 72px;
    padding: 8px;
  }

  .ring-svg {
    width: 48px;
    height: 48px;
  }
  .summary-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.page-compare .compare-mode-bar {
    top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  }

  .compare-tabs-wrap {
    top: calc(var(--nav-h) + var(--compare-mode-h, 44px) + env(safe-area-inset-top, 0px));
  }

  .compare-mode-group {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

/* ── Group compare mode ── */
.compare-mode-group {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-right)) 24px max(20px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.group-page-header {
  margin-bottom: 20px;
  padding-top: 4px;
}

.group-page-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(28px, 5vw, 36px);
  letter-spacing: 0.08em;
  color: var(--white);
  margin-bottom: 6px;
}

.group-page-sub {
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.6;
}

.selector-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.selector-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold2);
  margin-bottom: 14px;
}

.selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.selector-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}

.person-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  min-height: 44px;
}

.person-chip:hover {
  border-color: var(--gold2);
  transform: translateY(-1px);
}

.person-chip.selected {
  border-color: var(--gold);
  background: rgba(200, 169, 110, 0.06);
}

.person-chip.you {
  border-left: 2px solid var(--green);
}

.person-chip .chip-info {
  flex: 1;
  min-width: 0;
}

.person-chip .chip-type {
  font-size: 11px;
  color: var(--muted2);
}

.person-chip .chip-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--gold);
  flex-shrink: 0;
}

.person-chip.selected .chip-check {
  border-color: var(--gold);
  background: rgba(200, 169, 110, 0.12);
}

.group-content {
  min-height: 120px;
}

.group-placeholder {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--border2);
  border-radius: 2px;
  background: var(--surface2);
  color: var(--muted2);
  font-size: 13px;
  line-height: 1.65;
}

.group-placeholder-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
}

.group-content .section-title {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold2);
  margin: 24px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.profile-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 20px 16px;
  text-align: center;
}

.profile-card.is-you {
  border-color: var(--gold2);
  background: linear-gradient(180deg, rgba(200, 169, 110, 0.06) 0%, var(--surface) 100%);
}

.pc-you-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid var(--green2);
  padding: 2px 8px;
}

.pc-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  color: var(--gold);
  margin: 0 auto 10px;
}

.pc-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--white);
  margin-bottom: 2px;
}

.pc-username {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

.pc-mbti {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 0.06em;
  color: var(--gold);
  line-height: 1;
}

.pc-enn {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 6px;
  line-height: 1.45;
}

.pc-no-data {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.matrix-section {
  margin-bottom: 24px;
}

.matrix-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 480px;
}

.matrix-table th,
.matrix-table td {
  padding: 12px 14px;
  border: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}

.matrix-table th {
  background: var(--surface2);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
}

.matrix-table td.matrix-name {
  text-align: left;
  font-weight: 500;
  background: var(--surface2);
  white-space: nowrap;
}

.matrix-table td.self {
  color: var(--muted);
  background: var(--bg);
}

.matrix-pct {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 0.04em;
}

.matrix-pct.compat-high { color: var(--green); }
.matrix-pct.compat-mid { color: var(--gold); }
.matrix-pct.compat-low { color: var(--muted2); }

.group-content .insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 18px 16px;
  text-align: center;
}

.insight-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold2);
  margin-bottom: 8px;
}

.insight-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 0.04em;
  color: var(--white);
  line-height: 1.1;
  margin-bottom: 4px;
}

.insight-value.compat-high { color: var(--green); }
.insight-value.compat-mid { color: var(--gold); }
.insight-value.compat-low { color: var(--muted2); }

.insight-sub {
  font-size: 11px;
  color: var(--muted);
}

.compare-panel-card .ai-block {
  padding: 16px 18px;
  margin-bottom: 12px;
  border-left: 3px solid var(--gold2);
}

.compare-panel-card .ai-block-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-style: italic;
  color: var(--gold);
  margin-bottom: 8px;
}

.compare-panel-card .ai-block-text {
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.75;
}

.compare-panel-empty {
  text-align: center;
  color: var(--muted2);
}

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

  .profiles-grid {
    grid-template-columns: 1fr 1fr;
  }

  .group-content .insights-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .profiles-grid,
  .group-content .insights-grid {
    grid-template-columns: 1fr;
  }
}

body.light-mode .compare-mode-bar {
  background: rgba(244, 241, 236, 0.97);
  border-color: var(--border);
}

body.light-mode .compare-tabs-wrap {
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

body.light-mode .compare-stack {
  background: var(--bg);
}

body.light-mode .compare-hero,
body.light-mode .compare-panel-card,
body.light-mode .compare-share-bar {
  background: var(--surface);
  border-color: var(--border);
}

body.light-mode .compare-tab {
  color: var(--muted);
}

body.light-mode .compare-tab.active {
  color: var(--text);
  border-color: var(--gold);
}

body.light-mode .dual-bar-track {
  background: rgba(0, 0, 0, 0.06);
}
