﻿/* マイページ専用コンテナ幅の拡張 */
.container { max-width: 1080px !important; width: 95% !important; padding: 20px 16px 40px !important; }
#quiz-card { max-width: 1040px !important; width: 100% !important; margin: 0 auto !important; padding: 24px !important; box-sizing: border-box; }
.response-name-clickable { white-space: nowrap; }
.response-info-left { flex-wrap: nowrap; min-width: 0; }
/* --- 共通・コンテナ設定 --- */
#quiz-card {
  max-width: 1040px !important;
  width: 95% !important;
  margin: 0 auto !important;
  text-align: left;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}
.input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}
.text-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 1rem;
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s;
}
.text-input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.intro-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 3px 10px;
  border-radius: 9999px;
  margin-bottom: 10px;
}

/* --- プロファイル切り替えバー --- */
.profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 20px;
}
.profile-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.profile-select-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}
.profile-select {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
}
.profile-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-icon-sub {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-icon-sub:hover { background: #f1f5f9; border-color: #94a3b8; }
.btn-icon-danger {
  background: #ffffff;
  border: 1px solid #fca5a5;
  color: #dc2626;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-icon-danger:hover { background: #fee2e2; }

.dashboard-header {
  text-align: left;
  margin-bottom: 16px;
}
.dashboard-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
  margin-top: 4px;
  margin-bottom: 0;
}

/* --- 相互フレンド（プロフ帳）スタイル --- */
.friend-bar-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.friend-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.friend-bar-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.friend-bar-icon { font-size: 1.25rem; }
.friend-bar-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}
.friend-count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: #eef2ff;
  color: #4f46e5;
  padding: 2px 8px;
  border-radius: 9999px;
}
.friend-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-friend-action {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-friend-exchange { background: #4f46e5; color: #ffffff; }
.btn-friend-exchange:hover { background: #4338ca; transform: translateY(-1px); }
.btn-friend-config { background: #f8fafc; color: #475569; border-color: #cbd5e1; }
.btn-friend-config:hover { background: #f1f5f9; color: #1e293b; }

.friend-guest-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 12px;
}
.friend-guest-icon { font-size: 1.4rem; }
.friend-guest-text strong { display: block; font-size: 0.85rem; color: #1e293b; margin-bottom: 2px; }
.friend-guest-text p { font-size: 0.76rem; color: #64748b; margin: 0; line-height: 1.4; }

.friend-list-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.friend-list {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 8px;
}
.friend-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 9999px;
  padding: 5px 14px 5px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.friend-chip:hover { background: #eef2ff; border-color: #a5b4fc; transform: translateY(-1px); }
.friend-chip-avatar {
  width: 28px;
  height: 28px;
  background: #4f46e5;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
}
.friend-chip-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend-empty-text { font-size: 0.8rem; color: #94a3b8; margin: 4px 0; }

/* --- 2カラムグリッドレイアウト --- */
.mypage-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 16px;
  align-items: start;
}
@media (min-width: 860px) {
  .mypage-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(290px, 1fr);
    gap: 24px;
  }
}
.mypage-main-column { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.mypage-sub-column { min-width: 0; }

/* シェアボックス */
.share-box {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  text-align: left;
}
.share-box-label { font-size: 0.8rem; font-weight: 700; color: #475569; margin-bottom: 8px; }
.share-url-row { display: flex; gap: 8px; }
.share-url-input {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #64748b;
  outline: none;
}
.copy-btn {
  background: #4f46e5;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.copy-btn:hover { background: #4338ca; }
.share-hint { font-size: 0.75rem; color: #64748b; margin-top: 6px; line-height: 1.4; }

/* 関係性タブ */
.relation-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 6px;
  justify-content: flex-start;
}
.tab-btn {
  padding: 6px 11px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn.active { background: #4f46e5; color: #ffffff; border-color: #4f46e5; }

/* 総合判定カード */
.result-summary-card {
  border-radius: 14px;
  padding: 24px 20px;
  text-align: center;
  border: 1px solid transparent;
}
.summary-sub { font-size: 0.82rem; font-weight: 700; margin-bottom: 4px; }
.summary-type { font-size: 2.4rem; font-weight: 900; margin: 4px 0 8px; }
.summary-desc { font-size: 0.88rem; color: #475569; line-height: 1.5; margin: 0; }
.theme-nt { background: linear-gradient(135deg, #f5f3ff, #faf5ff); border-color: #ddd6fe; }
.theme-nt .summary-sub { color: #7c3aed; } .theme-nt .summary-type { color: #5b21b6; }
.theme-nf { background: linear-gradient(135deg, #f0fdf4, #f7fee7); border-color: #bbf7d0; }
.theme-nf .summary-sub { color: #16a34a; } .theme-nf .summary-type { color: #14532d; }
.theme-sj { background: linear-gradient(135deg, #f0f9ff, #f8fafc); border-color: #bae6fd; }
.theme-sj .summary-sub { color: #0284c7; } .theme-sj .summary-type { color: #0c4a6e; }
.theme-sp { background: linear-gradient(135deg, #fffbeb, #fefce8); border-color: #fde68a; }
.theme-sp .summary-sub { color: #d97706; } .theme-sp .summary-type { color: #78350f; }

/* 関係性ミニカード群 */
.mini-cards-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
@media (max-width: 680px) {
  .mini-cards-grid { grid-template-columns: repeat(2, 1fr); }
}
.mini-summary-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mini-card-title { font-size: 0.72rem; font-weight: 700; color: #64748b; }
.mini-card-type { font-size: 1.05rem; font-weight: 900; }
.mini-card-count { font-size: 0.65rem; color: #94a3b8; }
.mini-theme-nt { background: #faf5ff; border-color: #e9d5ff; } .mini-theme-nt .mini-card-type { color: #6b21a8; }
.mini-theme-nf { background: #f0fdf4; border-color: #bbf7d0; } .mini-theme-nf .mini-card-type { color: #15803d; }
.mini-theme-sj { background: #f0f9ff; border-color: #bae6fd; } .mini-theme-sj .mini-card-type { color: #0369a1; }
.mini-theme-sp { background: #fffbeb; border-color: #fde68a; } .mini-theme-sp .mini-card-type { color: #b45309; }
.mini-theme-empty { background: #f8fafc; border-color: #e2e8f0; } .mini-theme-empty .mini-card-type { color: #cbd5e1; }

/* 4軸スライダー */
.axes-container { display: flex; flex-direction: column; gap: 14px; }
.axis-row { background: #ffffff; border: 1px solid #f1f5f9; border-radius: 10px; padding: 10px 14px; }
.axis-labels { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 700; margin-bottom: 8px; }
.left-trait { color: #4f46e5; } .right-trait { color: #0ea5e9; } .axis-val { color: #64748b; font-size: 0.75rem; }
.axis-bar-wrap { position: relative; height: 8px; background: #e2e8f0; border-radius: 9999px; }
.axis-indicator {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  background: #4f46e5;
  border: 2px solid #ffffff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: left 0.3s ease;
}

/* SNSシェアボタン */
.btn-share-result-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 380px;
  background: linear-gradient(135deg, #1e1b4b, #4338ca);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(49, 46, 129, 0.25);
}

/* フィルターボックス */
.date-filter-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
}
.date-filter-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.date-filter-title { font-size: 0.82rem; font-weight: 800; color: #1e293b; }
.btn-date-clear {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.filter-sub-group { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.filter-sub-label { font-size: 0.72rem; font-weight: 700; color: #64748b; width: 36px; flex-shrink: 0; }
.date-input-row { display: flex; align-items: center; gap: 8px; flex: 1; }
.date-input { flex: 1; padding: 6px 10px; font-size: 0.82rem; border: 1px solid #cbd5e1; border-radius: 6px; }
.filter-text-input { flex: 1; padding: 6px 10px; font-size: 0.82rem; border: 1px solid #cbd5e1; border-radius: 6px; }
.filter-pill-group { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.filter-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
}
.filter-pill.active { background: #4f46e5; color: #ffffff; border-color: #4f46e5; }
.custom-limit-wrap { display: inline-flex; align-items: center; gap: 4px; border: 1px solid #e2e8f0; border-radius: 9999px; padding: 2px 8px; }
.custom-limit-input { width: 44px; padding: 2px 4px; font-size: 0.75rem; border: 1px solid #cbd5e1; border-radius: 4px; text-align: center; }
.custom-type-row { display: flex; align-items: center; gap: 8px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 8px 12px; margin-top: 8px; }

/* 回答履歴リスト */
.log-section { border-top: 1px solid #e2e8f0; padding-top: 20px; text-align: left; }
.log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.log-title { font-size: 0.95rem; font-weight: 700; color: #0f172a; margin: 0; }
.delete-btn { background: #fee2e2; color: #b91c1c; border: none; padding: 6px 12px; border-radius: 6px; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.delete-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.response-list { display: flex; flex-direction: column; gap: 8px; }
.response-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.response-card-main { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-size: 0.85rem; gap: 8px; }
.response-info-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.response-name-clickable { font-weight: 600; color: #1e293b; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.response-toggle-arrow { font-size: 0.65rem; color: #94a3b8; transition: transform 0.2s ease; }
.response-card.open .response-toggle-arrow { transform: rotate(180deg); color: #4f46e5; }
.memo-wrap { display: inline-flex; align-items: center; }
.response-memo-tag { background: #f1f5f9; border: 1px dashed #cbd5e1; color: #475569; font-size: 0.72rem; padding: 2px 7px; border-radius: 6px; cursor: pointer; }
.btn-add-memo { background: transparent; border: 1px dashed #cbd5e1; color: #94a3b8; font-size: 0.68rem; padding: 1px 6px; border-radius: 4px; cursor: pointer; }
.response-info-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.badge-rel { padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; }
.rel-friend { background: #e0e7ff; color: #3730a3; }
.rel-partner { background: #fce7f3; color: #9d174d; }
.rel-work { background: #e0f2fe; color: #0369a1; }
.rel-family { background: #ffedd5; color: #9a3412; }
.rel-hobby { background: #f3e8ff; color: #6b21a8; }
.rel-other { background: #f1f5f9; color: #475569; }
.response-type { font-weight: 800; font-size: 0.82rem; padding: 2px 6px; border-radius: 4px; }
.type-nt { background: #ede9fe; color: #6d28d9; }
.type-nf { background: #dcfce7; color: #15803d; }
.type-sj { background: #e0f2fe; color: #0369a1; }
.type-sp { background: #fef3c7; color: #b45309; }
.response-date { font-size: 0.75rem; color: #94a3b8; }
.response-detail { display: none; background: #ffffff; border-top: 1px dashed #e2e8f0; padding: 12px 14px; }
.response-card.open .response-detail { display: block; }
.detail-header-label { font-size: 0.72rem; font-weight: 700; color: #64748b; margin-bottom: 8px; }
.detail-axes { display: flex; flex-direction: column; gap: 8px; }
.detail-axis-row { background: #f8fafc; border-radius: 6px; padding: 6px 10px; }
.detail-axis-labels { display: flex; justify-content: space-between; font-size: 0.72rem; font-weight: 700; margin-bottom: 4px; }
.detail-axis-bar-wrap { position: relative; height: 6px; background: #e2e8f0; border-radius: 9999px; }
.detail-axis-indicator {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: #4f46e5;
  border: 2px solid #ffffff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* 右カラム: 各診断カード */
.sub-column-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.sub-column-header {
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}
.sub-column-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sub-column-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.sub-column-count-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  padding: 1px 7px;
  border-radius: 9999px;
  white-space: nowrap;
}
.sub-column-header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.sub-column-desc {
  font-size: 0.75rem;
  color: #64748b;
}
.sub-column-swipe-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #4338ca;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 1px solid #c7d2fe;
  padding: 2px 8px;
  border-radius: 9999px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.15);
}
.swipe-hand-anim {
  display: inline-block;
  animation: swipeNudge 1.4s infinite ease-in-out;
}
@keyframes swipeNudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

/* サブカラム診断検索フィルター */
.sub-search-filter-wrap {
  margin-top: 10px;
}
.sub-filter-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  font-size: 0.85rem;
  color: #1e293b;
  background: #ffffff;
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sub-filter-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.sub-filter-input::placeholder {
  color: #94a3b8;
}

/* サブ診断カード一覧（スマホ: 横スワイプ / カルーセル） */
@media (max-width: 600px) {
  #quiz-card {
    padding: 20px 12px !important;
  }
  .sub-column-box {
    padding: 14px 10px !important;
  }
}

.sub-test-list {
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /* 左右対称カルーセル: 12%パディングにより中央にアクティブカード、左右に前後のカードが対称チラ見え */
  padding: 4px 12% 12px 12%;
  margin: -4px -10px -12px -10px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  overscroll-behavior-x: contain;
}
.sub-test-list::-webkit-scrollbar {
  height: 5px;
}
.sub-test-list::-webkit-scrollbar-track {
  background: transparent;
}
.sub-test-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

.sub-test-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  overflow: hidden;
  /* スマホでのカード幅: 235px (または画面の約75vw) で中央にスナップし、左右均等に対称チラ見え */
  flex: 0 0 min(226px, 72vw);
  max-width: 280px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
}

.sub-test-header {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}
.sub-test-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
  background: #eef2ff;
  color: #4f46e5;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}
.sub-test-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.35;
  word-break: break-word;
}
.sub-test-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 100%;
  box-sizing: border-box;
  flex: 1;
  justify-content: space-between;
}

/* PC表示時（min-width: 860px）: 縦スクロール（3カードまるまる見えて4カード目が少しはみ出す高さ） */
@media (min-width: 860px) {
  .sub-column-swipe-hint {
    display: none;
  }
  .sub-test-list {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: none;
    max-height: 950px;
    padding: 0 6px 6px 0;
    margin: 0;
    overscroll-behavior-y: contain;
  }
  .sub-test-list::-webkit-scrollbar {
    width: 6px;
    height: auto;
  }
  .sub-test-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }
  .sub-test-card {
    flex: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

/* 受検済みと未受検の明確なカード区別スタイル */
.sub-test-card.card-completed {
  background: #ffffff;
  border-color: #cbd5e1;
}
.sub-test-card.card-uncompleted {
  background: #fafbfe;
  border-color: #e2e8f0;
}

/* ヘッダータグの区別 */
.sub-test-tag.tag-completed {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.sub-test-tag.tag-uncompleted {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* ユーザー草案に準拠した横幅ぴったりカードサムネイル */
.sub-test-card-link {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  background: #f8fafc;
  text-decoration: none;
  box-sizing: border-box;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.sub-test-card-link.link-uncompleted {
  border: 1.5px dashed #cbd5e1;
  background: #f8fafc;
}
.sub-test-card-link.link-uncompleted .sub-test-card-img {
  opacity: 0.85;
  filter: saturate(0.7) brightness(0.96);
  transition: opacity 0.2s ease, filter 0.2s ease;
}
.sub-test-card-link.link-uncompleted:hover .sub-test-card-img {
  opacity: 1;
  filter: saturate(1) brightness(1);
}

/* サムネイル右上の未受検・受検済みバッジ */
.sub-test-thumb-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  backdrop-filter: blur(4px);
  line-height: 1.3;
}
.sub-test-thumb-badge.badge-completed {
  background: rgba(236, 253, 245, 0.95);
  color: #059669;
  border: 1px solid #a7f3d0;
}
.sub-test-thumb-badge.badge-uncompleted {
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 未受検カード用のスタートボタン */
.btn-sub-test-start {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 5px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-sub-test-start:hover {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
}
.sub-test-card-link:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.sub-test-card-img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  display: block;
  aspect-ratio: 1200 / 630;
  box-sizing: border-box;
}

.sub-test-result-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}
.sub-test-summary, .sub-test-result-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sub-test-result-title { font-size: 1.05rem; font-weight: 800; color: #0f172a; }
.sub-test-result-date { font-size: 0.7rem; color: #94a3b8; }
.sub-test-detail { font-size: 0.78rem; color: #475569; background: #f1f5f9; padding: 4px 8px; border-radius: 6px; }
.sub-test-footer { display: flex; justify-content: flex-end; margin-top: 4px; }
.btn-sub-test-action { font-size: 0.78rem; font-weight: 600; color: #4f46e5; text-decoration: none; }
.btn-sub-test-action:hover { text-decoration: underline; }
.sub-test-empty { font-size: 0.8rem; color: #94a3b8; margin: 0; }

/* モーダル共通 */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.modal-content {
  background: #ffffff;
  border-radius: 16px;
  max-width: 440px;
  width: 100%;
  padding: 24px 20px;
  text-align: left;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-title { font-size: 1.15rem; font-weight: 800; color: #0f172a; margin: 0; }
.btn-modal-close { background: transparent; border: none; font-size: 1.5rem; line-height: 1; color: #94a3b8; cursor: pointer; }
.modal-desc { font-size: 0.82rem; color: #64748b; line-height: 1.5; margin-bottom: 20px; }
.btn-sns-action {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px; border-radius: 10px; font-size: 0.92rem; font-weight: 700;
  text-decoration: none; cursor: pointer; box-sizing: border-box;
}
.btn-sns-x { background: #000000; color: #ffffff; border: 1px solid #000000; }
.btn-sns-copy { background: #f8fafc; border: 1.5px solid #cbd5e1; color: #334155; }
.btn-sns-image { background: #eef2ff; border: 1.5px solid #c7d2fe; color: #4338ca; }

/* 引継ぎモーダルタブ */
.backup-tab-row { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 16px; gap: 8px; }
.backup-tab-btn { background: transparent; border: none; padding: 8px 12px; font-size: 0.85rem; font-weight: 700; color: #64748b; cursor: pointer; }
.backup-tab-btn.active { color: #4f46e5; border-bottom: 2px solid #4f46e5; }
.file-input-custom { width: 100%; padding: 8px 10px; font-size: 0.8rem; border: 1px dashed #cbd5e1; border-radius: 8px; background: #f8fafc; }

/* プロフ帳交換モーダル */
.my-friend-code-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.my-code-label { display: block; font-size: 0.75rem; font-weight: 700; color: #64748b; margin-bottom: 6px; }
.my-code-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.my-code-val { font-family: monospace; font-size: 1.25rem; font-weight: 800; color: #4f46e5; letter-spacing: 0.08em; }
.btn-copy-code-sm { background: #ffffff; border: 1px solid #cbd5e1; color: #334155; font-size: 0.75rem; font-weight: 700; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.btn-copy-invite-url { width: 100%; background: #eef2ff; border: 1px dashed #c7d2fe; color: #4338ca; font-size: 0.82rem; font-weight: 700; padding: 9px; border-radius: 8px; cursor: pointer; }
.modal-divider { border: none; border-top: 1px dashed #cbd5e1; margin: 16px 0; }

/* 公開設定トグル */
.privacy-toggles-list { display: flex; flex-direction: column; gap: 10px; }
.privacy-toggle-item { display: flex; justify-content: space-between; align-items: center; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.toggle-info strong { display: block; font-size: 0.84rem; color: #1e293b; }
.toggle-info span { display: block; font-size: 0.72rem; color: #64748b; }
.privacy-checkbox { width: 18px; height: 18px; accent-color: #4f46e5; cursor: pointer; }

/* 友達プロフ帳モーダル */
.friend-book-card { background: #ffffff; border: 2px solid #e2e8f0; }
.friend-book-header { border-bottom: 2px solid #f1f5f9; padding-bottom: 12px; }
.friend-book-avatar-wrap { display: flex; align-items: center; gap: 10px; }
.friend-book-avatar-icon { font-size: 1.8rem; }
.friend-book-user-name { font-size: 1.15rem; font-weight: 800; color: #0f172a; }
.friend-modal-code { font-family: monospace; font-size: 0.72rem; color: #94a3b8; }
.friend-book-body { display: flex; flex-direction: column; gap: 12px; padding: 16px 0 8px; max-height: 60vh; overflow-y: auto; }
.friend-diag-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; }
.friend-diag-tag { display: inline-block; font-size: 0.65rem; font-weight: 700; padding: 2px 6px; border-radius: 9999px; background: #eef2ff; color: #4f46e5; margin-bottom: 4px; }
.friend-diag-title { font-size: 0.95rem; font-weight: 800; color: #0f172a; margin-bottom: 2px; }
.friend-diag-val { font-size: 1.15rem; font-weight: 800; color: #4f46e5; }
.friend-diag-date { font-size: 0.7rem; color: #94a3b8; margin-top: 4px; }
.friend-book-footer { border-top: 1px dashed #e2e8f0; margin-top: 14px; padding-top: 12px; display: flex; justify-content: flex-end; }
.btn-text-danger { background: none; border: none; color: #dc2626; font-size: 0.76rem; font-weight: 700; cursor: pointer; }

/* トースト */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #ffffff; padding: 10px 18px; border-radius: 9999px;
  font-size: 0.85rem; font-weight: 600; z-index: 300;
}

/* --- 相性サマリーカード --- */
.compat-hero-box {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  text-align: left;
}
.compat-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  margin-bottom: 8px;
}
.compat-vs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.92rem;
  font-weight: 800;
}
.compat-type-chip {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: 0.05em;
  font-size: 0.88rem;
}
.compat-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 4px 0;
  color: #fbbf24;
}
.compat-desc {
  font-size: 0.78rem;
  color: #e0e7ff;
  line-height: 1.5;
  margin: 0;
}

/* 診断カード内の比較ヒント枠 */
.compat-sub-hint {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f1f5f9;
  border-left: 3px solid #4f46e5;
  border-radius: 0 6px 6px 0;
  font-size: 0.76rem;
  color: #334155;
  line-height: 1.45;
  text-align: left;
}

/* 診断解説へ戻るピルボタン */
.back-to-guide-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}
.back-to-guide-btn:hover {
  background: #f8fafc;
  border-color: #4f46e5;
  color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
  transform: translateY(-1px);
}

/* ========================================================
   スマホ・レスポンシブ表示＆余白最適化（統合・決定版）
   ======================================================== */

/* 1. プロファイル操作バーの整流化 */
.profile-bar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 14px !important;
  box-sizing: border-box !important;
}
.profile-select-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 1 1 200px !important;
  min-width: 0 !important;
}
.profile-select-label {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  color: #475569 !important;
}
.profile-select {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: 100% !important;
  padding: 6px 10px !important;
  font-size: 0.85rem !important;
  box-sizing: border-box !important;
}
.profile-actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
}

/* 2. 回答用URLボックス & コピーボタンの枠内収容 */
.share-box {
  box-sizing: border-box !important;
  width: 100% !important;
  margin-bottom: 26px !important;
}
.share-url-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.share-url-input {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.copy-btn {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

/* 3. 絞り込みタブボタン群とINFPリザルトカードの間の余白 */
.relation-filter-row,
.relation-tabs,
.cat-tabs,
div:has(> button[data-rel="all"]),
div:has(> .btn-rel-tab) {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-top: 14px !important;
  margin-bottom: 26px !important;
}

/* 4. 日付入力欄（iOS Safari 未入力時の高さ潰れ防止） */
input[type="date"],
input[type="date"].date-input,
.date-input {
  -webkit-appearance: none !important;
  appearance: none !important;
  height: 38px !important;
  min-height: 38px !important;
  line-height: 38px !important;
  padding: 0 10px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
}

input[type="date"]::-webkit-date-and-time-value,
.date-input::-webkit-date-and-time-value {
  height: 38px !important;
  min-height: 38px !important;
  line-height: 38px !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
}

.filter-sub-group {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.date-input-row {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* 5. 回答履歴アイテムのメモ縦改行＆重なり防止 */
.response-memo-tag {
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 180px !important;
  font-size: 0.75rem !important;
  line-height: 1.4 !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  background: #f1f5f9 !important;
  border: 1px dashed #cbd5e1 !important;
  color: #475569 !important;
  vertical-align: middle !important;
}
.memo-wrap {
  display: inline-flex !important;
  align-items: center !important;
  min-width: 0 !important;
  flex-shrink: 1 !important;
}

/* 6. モバイル表示（640px以下）のレイアウト最適化 */
@media (max-width: 640px) {
  /* 回答履歴カードの2段化 */
  .response-item-header,
  .response-header,
  div:has(> .response-info-left) {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 12px 14px !important;
  }
  .response-info-left {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
  }
  .response-name-wrap {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  .response-memo-tag {
    max-width: calc(100vw - 190px) !important;
  }
  .response-info-right {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    padding-top: 6px !important;
    border-top: 1px dashed #f1f5f9 !important;
  }

  /* ★ ヘッダー2段化（イメージ画像2枚目を完全再現） ★ */
  #test-nav-header,
  #test-nav-header .global-nav-header {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    row-gap: 12px !important;
    margin-bottom: 14px !important;
  }

  /* ラッパーの枠を消去して子要素を直接配置 */
  #test-nav-header .nav-header-left,
  #test-nav-header .nav-header-right {
    display: contents !important;
  }

  /* 【上段】ログインボタン / ユーザーアイコン（幅100%・右寄せ） */
  #test-nav-header #clerk-auth-slot {
    order: 1 !important;
    width: 100% !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  #test-nav-header #btn-open-signin,
  #test-nav-header #clerk-auth-slot .cl-userButton-root {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  /* 【下段・左】← テスト一覧 */
  #test-nav-header a.main-link,
  #test-nav-header .nav-header-left a {
    order: 2 !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: fit-content !important;
    white-space: nowrap !important;
    font-size: 0.8rem !important;
    padding: 6px 14px !important;
    margin: 0 !important;
  }

  /* 【下段・右】📊 マイページ */
  #test-nav-header .nav-header-right > a,
  #test-nav-header a[href*="mypage"] {
    order: 3 !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: fit-content !important;
    white-space: nowrap !important;
    font-size: 0.8rem !important;
    padding: 6px 14px !important;
    margin: 0 !important;
  }
}