@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@500;700;900&display=swap');

:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface2: #eceefa;
  --border: #dadeef;
  --accent: #4f5dff;
  --accent2: #ff8a4c;
  --accent3: #1f2937;
  --text: #1f2433;
  --text2: #767c94;
  --info: #6b7fe0;
  --gold: #b8862e;
  --silver: #8d90a0;
  --bronze: #a06a3e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Zen Maru Gothic', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
}
/* 背景にふわっと浮かぶ色玉 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle 420px at 8% 12%, rgba(79,93,255,.06), transparent 70%),
    radial-gradient(circle 380px at 88% 80%, rgba(255,138,76,.05), transparent 70%);
}
a { color: inherit; }

/* ふわふわ・ゆらゆら系アニメーション */
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes gradient-slide { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes shine { 0% { transform: translateX(-150%) rotate(20deg); } 100% { transform: translateX(250%) rotate(20deg); } }

/* ヘッダー */
header {
  background: rgba(255,255,255,.85);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transform: rotate(-6deg);
  transition: transform .25s;
}
.logo:hover .logo-icon { animation: wiggle .5s ease; transform: rotate(0); }
.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.logo-sub { font-size: 10px; color: var(--text2); margin-top: 1px; }

.gnav { display: flex; gap: 4px; flex-wrap: wrap; }
.gnav a {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all .2s;
}
.gnav a:hover { color: var(--text); background: var(--surface2); }
.gnav a { border-radius: 20px; }
.gnav a:hover { transform: translateY(-2px); }
.gnav a.active { color: var(--accent); background: rgba(79,93,255,.1); }

/* メイン */
main { max-width: 1100px; margin: 0 auto; padding: 32px 24px 80px; }

/* ヒーロー */
.hero { text-align: center; padding: 48px 0 40px; }
.hero-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 1px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(79,93,255,.25);
}
.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--text);
}
/* ヒーロー横にふわふわ浮かぶ家 */
.hero { position: relative; }
.hero::before, .hero::after {
  position: absolute;
  font-size: 34px;
  opacity: .5;
  animation: floaty 3.5s ease-in-out infinite;
  pointer-events: none;
}
.hero::before { content: '🏠'; left: 6%; top: 30%; animation-delay: .3s; }
.hero::after { content: '🚃'; right: 6%; top: 40%; animation-delay: 1.2s; }
@media (max-width: 700px) { .hero::before, .hero::after { display: none; } }
.hero p { color: var(--text2); font-size: 15px; line-height: 1.7; }

/* カード共通 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(40,50,100,.04);
}

/* ホーム: コンテンツカード */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  text-decoration: none;
  display: block;
  transition: all .2s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(40,50,100,.04);
}
.content-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(79,93,255,.14);
}
.content-card .c-icon { font-size: 36px; margin-bottom: 14px; display: block; transition: transform .25s; }
.content-card:hover .c-icon { animation: wiggle .5s ease; }
.content-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.content-card p { font-size: 13px; color: var(--text2); line-height: 1.7; margin-bottom: 14px; }
.content-card .c-link { font-size: 13px; font-weight: 700; color: var(--accent); }
.content-card .c-badge {
  position: absolute; top: 16px; right: 16px;
  font-size: 10px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,138,76,.14); color: var(--accent2);
}

/* セクション見出し */
.section-title {
  font-size: 20px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.section-sub { font-size: 13px; color: var(--text2); margin: -10px 0 20px; }

/* プロファイル選択 */
.selector-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.profile-btn {
  padding: 14px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  text-align: center;
  transition: all .2s;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.profile-btn .p-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.profile-btn:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.profile-btn:hover .p-icon { display: block; animation: wiggle .5s ease; }
.profile-btn { transition: all .2s; }
.profile-btn.active {
  border-color: var(--accent);
  background: rgba(79,93,255,.08);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(79,93,255,.14);
}

/* フィルター */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.filter-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
.filter-group label { font-size: 11px; color: var(--text2); font-weight: 600; }
.filter-group select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}
.filter-group select:focus { border-color: var(--accent); }

/* ランキング */
.ranking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.ranking-title { font-size: 18px; font-weight: 700; }
.ranking-meta { font-size: 12px; color: var(--text2); }
.ranking-list { display: flex; flex-direction: column; gap: 10px; }
/* 上位カードはふわっと順番に登場 */
.ranking-list > div:nth-child(-n+8) { animation: pop-in .4s ease backwards; }
.ranking-list > div:nth-child(1) { animation-delay: .02s; }
.ranking-list > div:nth-child(2) { animation-delay: .06s; }
.ranking-list > div:nth-child(3) { animation-delay: .10s; }
.ranking-list > div:nth-child(4) { animation-delay: .14s; }
.ranking-list > div:nth-child(5) { animation-delay: .18s; }
.ranking-list > div:nth-child(6) { animation-delay: .22s; }
.ranking-list > div:nth-child(7) { animation-delay: .26s; }
.ranking-list > div:nth-child(8) { animation-delay: .30s; }

.rank-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: center;
  transition: all .2s;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(40,50,100,.04);
}
.rank-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 6px 18px rgba(79,93,255,.1);
}
.rank-card.top1 {
  border-color: rgba(184,134,46,.4);
  background: #fdfbf5;
  position: relative;
  overflow: hidden;
}
/* 1位カードにさりげない光が走る */
.rank-card.top1::after {
  content: '';
  position: absolute;
  top: -60%; left: 0;
  width: 50px; height: 220%;
  background: linear-gradient(90deg, transparent, rgba(184,134,46,.15), transparent);
  animation: shine 3.2s ease-in-out infinite;
  pointer-events: none;
}
.rank-card.top2 { border-color: rgba(142,154,174,.5); }
.rank-card.top3 { border-color: rgba(176,107,40,.4); }

.rank-num {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
  background: var(--surface2);
  color: var(--text2);
}
.rank-num.r1 { background: rgba(212,154,0,.12); color: var(--gold); animation: floaty 2.6s ease-in-out infinite; }
.rank-num.r2 { background: rgba(142,154,174,.15); color: var(--silver); animation: floaty 2.6s ease-in-out infinite .3s; }
.rank-num.r3 { background: rgba(176,107,40,.12); color: var(--bronze); animation: floaty 2.6s ease-in-out infinite .6s; }

.rank-station {
  font-size: 17px; font-weight: 700; margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.rank-line {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; background: rgba(79,93,255,.1); color: var(--accent);
}
.rank-pref {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; background: var(--surface2); color: var(--text2);
}
.rank-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border);
}
.tag.good { background: rgba(79,93,255,.08); color: var(--accent); border-color: rgba(79,93,255,.2); }
.tag.warn { background: rgba(255,138,76,.1); color: var(--accent2); border-color: rgba(255,138,76,.25); }

.rank-score { text-align: right; }
.score-val {
  font-size: 32px; font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.score-label { font-size: 10px; color: var(--text2); margin-top: 2px; }
.score-bar {
  width: 80px; height: 4px; background: var(--surface2);
  border-radius: 2px; margin-top: 6px; overflow: hidden;
}
.score-fill {
  height: 100%; border-radius: 2px;
  background: var(--accent);
  transition: width .6s ease;
}

/* 詳細パネル */
.detail-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-top: 8px;
  display: none;
  animation: fadeIn .2s ease;
}
.detail-panel.open { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.detail-stat { text-align: center; padding: 12px; background: var(--surface); border-radius: 12px; }
.detail-stat .val { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.detail-stat .lbl { font-size: 11px; color: var(--text2); }
.suumo-link {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent);
  color: white; text-decoration: none;
  padding: 10px 20px; border-radius: 12px;
  font-size: 13px; font-weight: 700;
  transition: opacity .2s;
}
.suumo-link:hover { opacity: .85; }

/* スコア説明バー */
.score-desc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(40,50,100,.04);
}
.score-item { flex: 1; min-width: 150px; }
.score-item .s-label { font-size: 11px; color: var(--text2); margin-bottom: 4px; font-weight: 600; }
.score-item .s-val {
  font-size: 13px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.rent { background: var(--accent); }
.dot.access { background: var(--accent2); }
.dot.life { background: var(--accent3); }
.dot.sec { background: var(--info); }
.dot.invest { background: var(--gold); }

/* 賃貸/購入トグル */
.mode-toggle {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.mode-toggle button {
  padding: 8px 18px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.mode-toggle button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(40,50,100,.12);
}

/* 駅の雰囲気 */
.rank-mood {
  font-size: 12px;
  color: var(--text2);
  font-style: italic;
  margin-bottom: 6px;
  line-height: 1.5;
}

/* カード内の物件リンク */
.card-suumo {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent2);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(255,138,76,.4);
  border-radius: 20px;
  transition: all .15s;
}
.card-suumo:hover { background: var(--accent2); color: white; }

/* ランキング内アフィリエイトカード */
.inline-ad {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.inline-ad-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.inline-ad-sub { font-size: 12px; color: var(--text2); }

/* アフィリエイトバナー */
.affiliate-banner {
  text-align: center;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  margin-top: 40px;
  box-shadow: 0 2px 12px rgba(40,50,100,.04);
}
.affiliate-banner p { font-size: 12px; color: var(--text2); margin-bottom: 12px; }
.affiliate-banner img.banner { max-width: 100%; height: auto; border-radius: 12px; }

/* 一括査定アフィリエイト導線 */
.kassai-card {
  display: flex; gap: 16px; align-items: flex-start;
  margin-top: 24px; padding: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.kassai-icon { font-size: 28px; flex-shrink: 0; }
.kassai-body h3 { font-size: 15px; margin-bottom: 6px; }
.kassai-body p { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 12px; }
.kassai-btn {
  display: inline-block; background: var(--accent); color: #fff;
  text-decoration: none; font-weight: 700; font-size: 14px;
  padding: 10px 20px; border-radius: 12px; transition: all .2s;
}
.kassai-btn:hover { opacity: .92; transform: translateY(-2px); }
.kassai-note { display: block; font-size: 11px; color: var(--text2); margin-top: 8px; }
@media (max-width: 480px) { .kassai-card { flex-direction: column; } }

/* フッター */
footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 24px;
  text-align: center;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.8;
}
footer nav { display: flex; gap: 16px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
footer nav a { color: var(--text2); text-decoration: none; }
footer nav a:hover { color: var(--text); }

/* CTAボタン */
.cta-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent);
  color: white; text-decoration: none;
  padding: 14px 32px; border-radius: 14px;
  font-size: 15px; font-weight: 700;
  transition: all .2s;
  margin-top: 24px;
  box-shadow: 0 4px 14px rgba(79,93,255,.22);
}
.cta-btn:hover { opacity: .92; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(79,93,255,.28); }
.cta-btn:active { transform: translateY(0); }

.cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.cta-row .cta-btn { margin-top: 0; }
.cta-btn.cta-2 { background: var(--accent3); box-shadow: 0 4px 14px rgba(31,41,55,.22); }
.cta-btn.cta-2:hover { box-shadow: 0 8px 20px rgba(31,41,55,.28); }
.cta-btn.cta-3 { background: var(--accent2); box-shadow: 0 4px 14px rgba(255,138,76,.22); }
.cta-btn.cta-3:hover { box-shadow: 0 8px 20px rgba(255,138,76,.28); }
@media (max-width: 640px) { .cta-row { flex-direction: column; align-items: stretch; } }

/* レスポンシブ */
@media (max-width: 640px) {
  .rank-card { grid-template-columns: 40px 1fr auto; gap: 12px; padding: 14px; }
  .rank-num { width: 40px; height: 40px; font-size: 16px; }
  .score-val { font-size: 26px; }
  .score-bar { width: 60px; }
  .gnav a { padding: 6px 10px; font-size: 12px; }
}
