/* =========================================================
   XTrend — SocialXup 風デザイン
   清潔・ミニマル・白基調 + カラフルなアクセント
   ========================================================= */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e8eaed;
  --text: #1a1a1f;
  --text-sub: #6b7280;
  --text-mute: #9ca3af;

  --brand: #1d9bf0;          /* X ブルー */
  --brand-dark: #1a8cd8;

  --c-blue: #3b82f6;
  --c-purple: #8b5cf6;
  --c-pink: #ec4899;
  --c-orange: #f59e0b;
  --c-teal: #14b8a6;
  --c-green: #22c55e;
  --c-red: #ef4444;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);

  --maxw: 1120px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--c-blue), var(--c-purple));
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 18px;
}
.logo .x-accent { color: var(--brand); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--text-sub); transition: background .15s, color .15s;
}
.nav a:hover { background: #f0f2f5; color: var(--text); }
.nav-toggle { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }

/* ---------------- Hero ---------------- */
.hero { padding: 56px 0 40px; text-align: center; }
.hero h1 {
  font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.25;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--c-blue), var(--c-purple), var(--c-pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { margin-top: 14px; color: var(--text-sub); font-size: 16px; }

.badges { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-sub);
  box-shadow: var(--shadow);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-green); }

/* Search box */
.search-wrap { margin: 28px auto 0; max-width: 620px; }
.search-box {
  display: flex; align-items: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 6px 6px 20px;
  box-shadow: var(--shadow-md);
}
.search-box .at { color: var(--text-mute); font-weight: 700; margin-right: 2px; }
.search-box input {
  flex: 1; border: 0; outline: 0; font-size: 16px; background: transparent; padding: 10px 6px;
}
.search-box button {
  border: 0; cursor: pointer; background: var(--brand); color: #fff;
  font-weight: 700; font-size: 15px; padding: 11px 24px; border-radius: 999px;
  transition: background .15s;
}
.search-box button:hover { background: var(--brand-dark); }
.search-hint { margin-top: 10px; font-size: 13px; color: var(--text-mute); }

/* ---------------- Sections ---------------- */
section { padding: 36px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.section-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.section-head a { font-size: 14px; color: var(--brand); font-weight: 600; }

/* Feature cards */
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.feature-card .icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; margin-bottom: 14px;
}
.feature-card h3 { font-size: 17px; font-weight: 700; }
.feature-card p { color: var(--text-sub); font-size: 14px; margin-top: 6px; }

/* Account cards grid */
.account-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.account-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center;
  transition: transform .15s, box-shadow .15s;
}
.account-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.account-card .avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none; object-fit: cover; background: #eef1f4;
}
.account-card .meta { min-width: 0; flex: 1; }
.account-card .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-card .handle { color: var(--text-mute); font-size: 13px; }
.account-card .followers { margin-top: 4px; font-size: 14px; font-weight: 700; color: var(--c-blue); }
.rank-pill {
  font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; color: #fff;
}
.rank-A { background: var(--c-pink); }
.rank-B { background: var(--c-purple); }
.rank-C { background: var(--c-blue); }
.rank-D { background: var(--c-teal); }
.rank-E { background: var(--text-mute); }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.step .num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800; margin-bottom: 12px;
}
.step h3 { font-size: 16px; }
.step p { color: var(--text-sub); font-size: 14px; margin-top: 6px; }

/* FAQ */
.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0; margin-bottom: 10px; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; padding: 16px 20px; font-weight: 700; font-size: 15px; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "＋"; color: var(--text-mute); font-weight: 700; }
.faq-item[open] summary::after { content: "−"; }
.faq-item .answer { padding: 0 20px 16px; color: var(--text-sub); font-size: 14px; }

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 24px; }
.site-footer .container { padding: 36px 20px; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.footer-cols h4 { font-size: 13px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.footer-cols a { display: block; font-size: 14px; color: var(--text-sub); padding: 3px 0; }
.footer-cols a:hover { color: var(--brand); }
.footer-bottom { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-mute); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------------- Account detail page ---------------- */
.profile-banner { width: 100%; height: 200px; object-fit: cover; background: linear-gradient(135deg, var(--c-blue), var(--c-purple)); border-radius: var(--radius); }
.profile-head { display: flex; gap: 20px; align-items: flex-end; margin-top: -48px; padding: 0 8px; position: relative; }
.profile-head .avatar-lg {
  width: 110px; height: 110px; border-radius: 50%; border: 4px solid var(--surface);
  object-fit: cover; background: #eef1f4; flex: none;
}
.profile-head .who { padding-bottom: 8px; flex: 1; }
.profile-head .who h1 { font-size: 26px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.verified { color: var(--brand); font-size: 20px; }
.profile-head .who .handle { color: var(--text-mute); }
.profile-bio { margin: 16px 8px; color: var(--text-sub); white-space: pre-wrap; }
.profile-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 8px; }
.tag { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: #f0f2f5; color: var(--text-sub); }
.tag.dm-ok { background: #e7f8ef; color: var(--c-green); }
.tag.dm-no { background: #fdeaea; color: var(--c-red); }
.tag.frozen { background: #fdeaea; color: var(--c-red); }

/* stat cards (screenshot 風) */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.stat-card .value { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-card .label { font-size: 13px; color: var(--text-mute); margin-top: 6px; }
.stat-card .delta { font-size: 13px; font-weight: 700; margin-left: 8px; }
.delta.up { color: var(--c-green); }
.delta.down { color: var(--c-red); }
.v-blue { color: var(--c-blue); } .v-purple { color: var(--c-purple); }
.v-pink { color: var(--c-pink); } .v-orange { color: var(--c-orange); }
.v-teal { color: var(--c-teal); } .v-green { color: var(--c-green); }

.chart-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin: 22px 0;
}
.chart-card .chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.chart-card h3 { font-size: 16px; }
.chart-tabs { display: flex; gap: 6px; }
.chart-tabs button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-sub);
  font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.chart-tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chart-box { position: relative; height: 300px; }

/* analysis panel (投稿時間帯・トーン等) */
.analysis-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 22px 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel h3 { font-size: 15px; margin-bottom: 12px; }
.hours { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; align-items: end; height: 90px; }
.hours .bar { background: linear-gradient(180deg, var(--c-purple), var(--c-blue)); border-radius: 3px 3px 0 0; min-height: 4px; }
.hours-axis { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; margin-top: 4px; font-size: 9px; color: var(--text-mute); text-align: center; }

/* loading / states */
.loader { text-align: center; padding: 60px 0; color: var(--text-mute); }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { background: #fdeaea; color: var(--c-red); border-radius: var(--radius-sm); padding: 16px 20px; font-size: 14px; }
.skeleton { background: linear-gradient(90deg, #eef1f4 25%, #f6f8fa 50%, #eef1f4 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px; gap: 2px; }
  .nav.open { display: flex; }
  .nav-toggle { display: block; }
  .feature-grid, .steps, .analysis-grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 26px; }
}
@media (max-width: 520px) {
  .account-grid, .stat-grid { grid-template-columns: 1fr; }
  .profile-head { flex-direction: column; align-items: flex-start; }
}
