/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg:         #f0f6ff;
  --card:       #ffffff;
  --card2:      #f8faff;
  --text:       #0f1e38;
  --subtext:    #4a5f7e;
  --primary:    #29b5e8;
  --primary-dk: #1891c0;
  --primary-lt: #e6f7fd;
  --accent:     #ff6b35;
  --border:     #d4e4f4;
  --shadow:     rgba(41,181,232,0.12);
  --radius:     16px;
  --radius-sm:  10px;
  --badge-bg:   rgba(255, 255, 255, 0.22);
}
[data-theme="dark"] {
  --bg:         #07111e;
  --card:       #0e1f33;
  --card2:      #0b1929;
  --text:       #e2edf8;
  --subtext:    #7fa3c4;
  --primary:    #29b5e8;
  --primary-dk: #4fcdf2;
  --primary-lt: #07243b;
  --accent:     #ff7e4a;
  --border:     #1c3550;
  --shadow:     rgba(0,0,0,0.4);
  --badge-bg:   rgba(0, 0, 0, 0.35);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Hiragino Sans", "Meiryo", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--primary-dk); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, #0f5485 0%, #29b5e8 60%, #46ccf7 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.5rem;
  color: #fff;
  box-shadow: 0 2px 16px rgba(0,0,0,0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.app-header p { font-size: 0.78rem; opacity: 0.88; margin-top: 0.1rem; }
.header-left { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.header-icon { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }

/* ── Layout ──────────────────────────────────────────────────── */
.container { max-width: 820px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.hidden { display: none !important; }

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: 0 4px 32px var(--shadow);
  transition: background 0.2s, border-color 0.2s;
}

/* ── Intro ───────────────────────────────────────────────────── */
.intro-hero {
  text-align: center;
  padding: 1rem 0 1.5rem;
}
.intro-hero .hero-icon { font-size: 4rem; line-height: 1; margin-bottom: 0.5rem; }
.intro-hero h2 {
  font-size: 1.7rem;
  font-weight: 800;
  background: linear-gradient(135deg, #1370a8, #29b5e8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.6rem;
}
[data-theme="dark"] .intro-hero h2 {
  background: linear-gradient(135deg, #4fcdf2, #9be0ff);
  -webkit-background-clip: text;
  background-clip: text;
}
.intro-hero p { color: var(--subtext); max-width: 540px; margin: 0 auto 1.4rem; font-size: 0.97rem; }
.intro-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin: 1.4rem auto 2rem;
  max-width: 620px;
  text-align: left;
}
.intro-feature {
  background: var(--primary-lt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  color: var(--text);
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}
.intro-feature .fi { font-size: 1.2rem; flex-shrink: 0; }
.intro-note { font-size: 0.78rem; color: var(--subtext); margin-top: 0.6rem; }

/* ── Buttons ─────────────────────────────────────────────────── */
.primary-button {
  background: linear-gradient(135deg, #29b5e8, #1370a8);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.8rem 2.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(41,181,232,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.02em;
}
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(41,181,232,0.45); }
.primary-button:active { transform: translateY(0); }

.secondary-button {
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.secondary-button:hover {
  border-color: var(--primary);
  background: var(--primary-lt);
  transform: translateY(-1px);
}
.secondary-button:active { transform: translateY(0); }

.ghost-button {
  background: transparent;
  color: var(--subtext);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.ghost-button:hover { color: var(--text); border-color: var(--primary); }

#theme-toggle {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  padding: 0.38rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
#theme-toggle:hover { background: rgba(255,255,255,0.28); }

/* ── Quiz View ───────────────────────────────────────────────── */
.progress-wrapper { margin-bottom: 1.4rem; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  color: var(--subtext);
  margin-bottom: 0.6rem;
  font-weight: 600;
}
.back-button {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}
.progress-bar {
  width: 100%;
  background: var(--border);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #29b5e8, #1370a8);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(.4,0,.2,1);
}
#question-text {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 1.4rem;
  color: var(--text);
}

/* 2択ビッグボタンレイアウト */
.options-2col {
  display: grid;
  gap: 0.9rem;
}
.option-button-2col {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  background: var(--card2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.15s;
}
.option-button-2col:hover {
  border-color: var(--primary);
  background: var(--primary-lt);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow);
}
.option-badge {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.option-content {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

/* ── Digital Card Result Header ─────────────────────────────── */
.result-digital-card {
  background: linear-gradient(135deg, #0e507f 0%, #1f94c4 50%, #29b5e8 100%);
  border-radius: var(--radius);
  padding: 1.8rem;
  color: #fff;
  margin-bottom: 1.8rem;
  box-shadow: 0 8px 32px rgba(15, 84, 133, 0.25);
  position: relative;
  overflow: hidden;
}

/* 結果カードの配色。アイコン画像の色に合わせて4分類に分ける。
   赤=Explorer×Craft / 青=Explorer×Value / 黄=Builder×Innovator / 緑=Builder×Optimizer */
.result-digital-card[data-color="craft"] {
  background: linear-gradient(135deg, #4A0206 0%, #8E1E1F 55%, #CD554B 100%);
  box-shadow: 0 8px 32px rgba(74, 2, 6, 0.3);
}
.result-digital-card[data-color="value"] {
  background: linear-gradient(135deg, #002852 0%, #12599E 55%, #2E95E3 100%);
  box-shadow: 0 8px 32px rgba(0, 40, 82, 0.3);
}
.result-digital-card[data-color="innovator"] {
  background: linear-gradient(135deg, #4A4404 0%, #A67806 55%, #E8B62A 100%);
  box-shadow: 0 8px 32px rgba(74, 68, 4, 0.3);
}
.result-digital-card[data-color="optimizer"] {
  background: linear-gradient(135deg, #0B3D12 0%, #2A7A1C 55%, #78B84A 100%);
  box-shadow: 0 8px 32px rgba(11, 61, 18, 0.3);
}

.result-digital-card::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.card-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}
.badge-chip {
  background: var(--badge-bg);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.result-header-content {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 0.8rem;
}
.result-header-icon {
  width: 112px;
  height: 112px;
  flex-shrink: 0;
  line-height: 1;
  font-size: 5.5rem;          /* 画像が無く絵文字にフォールバックしたとき用 */
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.28));
}
.type-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  opacity: 0.85;
  display: block;
}
.result-title {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0.1rem 0 0.2rem;
  color: #ffffff;
}
.result-subtitle {
  font-size: 0.9rem;
  opacity: 0.92;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.result-catchphrase {
  font-size: 1.05rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  border-left: 4px solid #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 0 8px 8px 0;
  margin: 1rem 0 0.8rem;
  color: #ffffff;
}

.result-description {
  font-size: 0.93rem;
  opacity: 0.95;
  line-height: 1.65;
}

/* ── Result Sections ─────────────────────────────────────────── */
.result-section { margin-top: 1.8rem; }
.result-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--subtext);
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.result-section h3::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 1em;
  background: var(--primary);
  border-radius: 2px;
}

/* ── Neighbor cards ──────────────────────────────────────────── */
#neighbor-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}
.neighbor-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 0.75rem 0.85rem;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
  position: relative;
}
.neighbor-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px var(--shadow); }
.match-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}
.neighbor-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  margin: 0 auto 0.6rem;
  display: block;
  background: var(--border);
}
.neighbor-avatar-placeholder {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid var(--border);
  margin: 0 auto 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--primary-lt);
  color: var(--primary);
}
.neighbor-name { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.neighbor-affiliation { font-size: 0.74rem; color: var(--subtext); margin-top: 0.2rem; min-height: 1.2em; }
.neighbor-links { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.5rem; }
.neighbor-link { font-size: 0.82rem; font-weight: 700; color: var(--primary-dk); }

.role-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

/* その他の類似するネイバー＆メイヤー（横スクロール） */
.other-people {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--border);
}
.other-neighbor-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.65rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.other-neighbor-list::-webkit-scrollbar { height: 6px; }
.other-neighbor-list::-webkit-scrollbar-track { background: transparent; }
.other-neighbor-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
.other-neighbor-list::-webkit-scrollbar-thumb:hover { background: var(--primary); }
.other-neighbor-card {
  flex: 0 0 132px;
  scroll-snap-align: start;
  padding: 0.85rem 0.5rem 0.7rem;
}
.other-neighbor-card .neighbor-avatar,
.other-neighbor-card .neighbor-avatar-placeholder {
  width: 48px;
  height: 48px;
  margin-bottom: 0.45rem;
}
.other-neighbor-card .neighbor-avatar-placeholder { font-size: 1.2rem; }
.other-neighbor-card .neighbor-name { font-size: 0.8rem; }
.other-neighbor-card .neighbor-affiliation { font-size: 0.68rem; }

/* ── Group cards ─────────────────────────────────────────────── */
#group-list { display: grid; gap: 0.8rem; }
.group-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.group-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px var(--shadow); }
.group-logo-wrap { width: 52px; height: 52px; flex-shrink: 0; }
.group-logo-img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.group-logo-abbr {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.group-info { flex: 1; }
.group-name { font-size: 0.98rem; color: var(--text); display: block; font-weight: 700; }
.group-desc { font-size: 0.82rem; color: var(--subtext); margin-top: 0.2rem; line-height: 1.45; }
.group-link { display: inline-block; font-size: 0.82rem; font-weight: 700; margin-top: 0.3rem; }

/* ── Other Groups ────────────────────────────────────────────── */
.other-groups {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--border);
}
.other-groups-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--subtext);
  margin-bottom: 0.55rem;
}
.other-group-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.65rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.other-group-list::-webkit-scrollbar { height: 6px; }
.other-group-list::-webkit-scrollbar-track { background: transparent; }
.other-group-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
.other-group-list::-webkit-scrollbar-thumb:hover { background: var(--primary); }
/* おすすめカードと同じ構造のまま、横に並べるため幅を固定して縦組みにする */
.other-group-card {
  flex: 0 0 232px;
  scroll-snap-align: start;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.85rem 0.9rem;
}
.other-group-card .group-logo-wrap { width: 40px; height: 40px; }
.other-group-card .group-info { width: 100%; }
.other-group-card .group-name { font-size: 0.88rem; line-height: 1.35; }
.other-group-card .group-desc {
  font-size: 0.76rem;
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.other-group-card .group-link { font-size: 0.76rem; }
.other-groups-note { margin-top: 0.6rem; font-size: 0.78rem; }

/* ── Feature Pills ───────────────────────────────────────────── */
.feature-pills { list-style: none; display: grid; gap: 0.65rem; }
.feature-pills li {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}
.feature-pills a { font-weight: 700; }
.feature-desc { color: var(--subtext); font-size: 0.85rem; }

/* ── Events & Actions ────────────────────────────────────────── */
.event-lead {
  font-size: 0.85rem;
  color: var(--subtext);
  margin: -0.4rem 0 0.7rem;
}

.event-list, .action-list { list-style: none; display: grid; gap: 0.5rem; }
.event-list li, .action-list li {
  background: var(--primary-lt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.88rem;
}
.event-date {
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  margin-right: 0.5rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ── Share Actions ───────────────────────────────────────────── */
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.share-x {
  background: #000;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.4rem;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.share-x:hover { opacity: 0.85; }

/* ── Toast Notification ──────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0f1e38;
  color: #fff;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  z-index: 200;
  transition: opacity 0.3s;
}

/* ── Modal Overlay ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 1rem;
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  padding: 1.8rem;
  position: relative;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--subtext);
  cursor: pointer;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .app-header { padding: 0.6rem 0.9rem; }
  .app-header h1 { font-size: 1rem; line-height: 1.3; }
  .app-header p { font-size: 0.68rem; line-height: 1.3; }
  .header-left { gap: 0.5rem; }
  .header-icon { font-size: 1.4rem; }
  #theme-toggle { white-space: nowrap; padding: 0.35rem 0.55rem; flex-shrink: 0; }
  .intro-hero { padding: 0.5rem 0 1rem; }
  .intro-hero .hero-icon { font-size: 3rem; }
  .intro-hero h2 { font-size: 1.35rem; }
  .intro-features { gap: 0.55rem; margin: 1.1rem auto 1.6rem; }
  .intro-feature { padding: 0.6rem 0.7rem; font-size: 0.8rem; gap: 0.4rem; }
  .intro-feature .fi { font-size: 1rem; }
  .container { padding: 1rem 0.6rem 2rem; }
  .card { padding: 1.2rem; }
  .result-header-content { flex-direction: column; text-align: center; }
  .result-header-icon { width: 96px; height: 96px; font-size: 4.6rem; }
  .card-badge-row { justify-content: center; }
  .result-catchphrase { border-left: none; border-top: 3px solid #fff; border-radius: 0 0 8px 8px; }
  .share-actions { flex-direction: column; }
  .share-actions button { width: 100%; text-align: center; }
}
