:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
  /* パステル水色（タブボタン用） */
  --pastel-blue:        #dbeafe;
  --pastel-blue-hover:  #bfdbfe;
  --pastel-blue-active: #93c5fd;
  --pastel-blue-text:   #1e40af;
  /* パステル赤（抽出ボタン用） */
  --pastel-red:         #fee2e2;
  --pastel-red-hover:   #fecaca;
  --pastel-red-active:  #fca5a5;
  --pastel-red-text:    #991b1b;
  /* パステル緑（指定URL分析ボタン用） */
  --pastel-green:       #d1fae5;
  --pastel-green-hover: #a7f3d0;
  --pastel-green-active:#6ee7b7;
  --pastel-green-text:  #065f46;
  /* パステル紫（競合比較ボタン用） */
  --pastel-purple:        #ede9fe;
  --pastel-purple-hover:  #ddd6fe;
  --pastel-purple-active: #c4b5fd;
  --pastel-purple-text:   #5b21b6;
  /* パステル黄色（サブタブ用） */
  --pastel-yellow:        #fef3c7;
  --pastel-yellow-hover:  #fde68a;
  --pastel-yellow-active: #fbbf24;
  --pastel-yellow-text:   #78350f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== Dashboard 3-column layout ===== */
.dashboard-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  align-items: start;
}
/* サジェスト以外のタブでは右ウィジェットを隠してメインを広げる */
.dashboard-shell.no-widgets {
  grid-template-columns: 240px minmax(0, 1fr);
}
.dashboard-shell.no-widgets .dash-widgets {
  display: none;
}
.dash-sidebar {
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.dash-sidebar .search-form {
  flex-direction: column;
  margin: 0;
  gap: 10px;
}
.dash-sidebar .search-form input[type="text"] {
  padding: 10px 12px;
  font-size: 0.92rem;
}

/* ===== 検索ボックスを目立たせるスポットライト効果 ===== */
.search-form-spotlight {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #fbbf24;
  border-radius: 12px;
  padding: 14px !important;
  box-shadow: 0 0 0 4px rgba(251,191,36,0.15), 0 4px 14px rgba(245,158,11,0.18);
  animation: spotlight-pulse 3s ease-in-out infinite;
}
@keyframes spotlight-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(251,191,36,0.15), 0 4px 14px rgba(245,158,11,0.18); }
  50%      { box-shadow: 0 0 0 8px rgba(251,191,36,0.25), 0 6px 20px rgba(245,158,11,0.28); }
}
.search-hint-prompt {
  font-size: 0.82rem;
  font-weight: 700;
  color: #78350f;
  margin: 0;
  text-align: center;
  line-height: 1.4;
}
.search-hint-prompt strong {
  background: #fbbf24;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  margin-right: 4px;
  display: inline-block;
}
.search-form-spotlight input[type="text"] {
  font-size: 1rem !important;
  font-weight: 600;
  padding: 12px 14px !important;
  border: 2px solid #fbbf24 !important;
  background: #fff;
  text-align: center;
  letter-spacing: 0.02em;
}
.search-form-spotlight input[type="text"]:focus {
  outline: none;
  border-color: #d97706 !important;
  box-shadow: 0 0 0 4px rgba(217,119,6,0.2) !important;
}
.search-form-spotlight input[type="text"]::placeholder {
  color: #d97706;
  opacity: 0.6;
}

/* ===== 生成したいキーワード用 (紫スポットライト) ===== */
.search-form-gen {
  background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%);
  border-color: #a78bfa !important;
  box-shadow: 0 0 0 4px rgba(167,139,250,0.18), 0 4px 14px rgba(139,92,246,0.22) !important;
  animation: spotlight-pulse-purple 3s ease-in-out infinite;
}
@keyframes spotlight-pulse-purple {
  0%, 100% { box-shadow: 0 0 0 4px rgba(167,139,250,0.18), 0 4px 14px rgba(139,92,246,0.22); }
  50%      { box-shadow: 0 0 0 8px rgba(167,139,250,0.28), 0 6px 20px rgba(139,92,246,0.32); }
}
.search-hint-prompt-gen {
  color: #5b21b6 !important;
}
.search-hint-prompt-gen strong {
  background: #8b5cf6 !important;
  color: #fff !important;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  display: inline-block;
}
.search-form-gen input[type="text"] {
  border-color: #a78bfa !important;
}
.search-form-gen input[type="text"]:focus {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 4px rgba(124,58,237,0.2) !important;
}
.search-form-gen input[type="text"]::placeholder {
  color: #7c3aed !important;
}
/* 生成ボタン (search-form内のため適用優先度を上げる) */
.search-form-gen .seo-cta-purple {
  width: 100%;
  margin: 0;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}
.dash-sidebar .search-form button {
  padding: 10px 16px;
  font-size: 0.92rem;
}
.search-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.search-hint strong { color: var(--accent-dark); }
.dash-main {
  min-width: 0;
}
.dash-widgets {
  position: sticky;
  top: 12px;
  align-self: start;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* スクロールバーを少し控えめに */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.dash-widgets::-webkit-scrollbar { width: 8px; }
.dash-widgets::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.dash-widgets::-webkit-scrollbar-track { background: transparent; }
/* サイドバー垂直タブ */
.dash-sidebar .main-tabs {
  flex-direction: column;
  gap: 10px;
  border-bottom: none;
  margin: 0;
}

/* サイドバーのカテゴリブロック */
.sidebar-category {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-category-label {
  margin: 0;
  padding: 0 2px 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: none;
  border-bottom: 1px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-category-label span[aria-hidden] { font-size: 1rem; }
.sidebar-category-desc {
  margin: -2px 2px 4px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dash-sidebar .main-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--pastel-blue-active);
  border-radius: 8px;
  border-bottom: 1px solid var(--pastel-blue-active);
  margin-bottom: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--pastel-blue-text);
  text-align: center;
  background: var(--pastel-blue);
  width: 100%;
  min-height: 40px;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s;
}
.dash-sidebar .main-tab:hover {
  background: var(--pastel-blue-hover);
  border-color: var(--accent);
  color: var(--accent-dark);
}
.dash-sidebar .main-tab.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(37,99,235,0.25);
}
.dash-sidebar .main-tab.is-active .main-tab-icon { filter: brightness(1.15); }
.main-tab-icon { font-size: 1.05rem; flex: 0 0 auto; }
.main-tab-label { flex: 0 1 auto; }

/* ===== Right widget cards ===== */
.widget-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.widget-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.widget-kw {
  font-weight: 700;
  word-break: break-all;
}
.widget-explainer {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f0f9ff;
  border-left: 3px solid #38bdf8;
  border-radius: 0 6px 6px 0;
  font-size: 0.74rem;
  line-height: 1.55;
  color: #475569;
}
.widget-explainer strong { color: #0c4a6e; }
.widget-crown {
  font-size: 1.1rem;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}
.widget-row {
  margin: 10px 0;
}
.widget-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.widget-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.widget-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.widget-value {
  font-size: 0.9rem;
  color: var(--text);
}
.widget-bar {
  position: relative;
  background: #e5e7eb;
  height: 18px;
  border-radius: 9px;
  overflow: hidden;
}
.widget-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0;
  background: #9ca3af;
  border-radius: 9px;
  transition: width 0.3s, background 0.3s;
}
.widget-bar-text {
  position: relative; z-index: 1;
  display: block;
  padding: 0 8px;
  line-height: 18px;
  font-size: 0.75rem;
  color: #111827;
  font-weight: 600;
}
.widget-stars {
  font-size: 1rem;
  color: #f59e0b;
  letter-spacing: 1px;
}
.widget-intent-wrap { display: flex; }
.widget-intent {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: #6b7280;
  align-self: flex-start;
}
.widget-trend {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.widget-trend svg { display: block; width: 100%; height: 56px; }
.widget-na {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  padding: 6px 4px;
}
.widget-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}
.widget-source {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  background: #eef2ff;
  color: var(--accent-dark);
}
.widget-direction {
  font-weight: 700;
  font-size: 0.92rem;
}
.widget-targets {
  padding-bottom: 10px;
}
.widget-target-note {
  margin: 0 0 8px;
  font-size: 0.72rem;
  color: var(--muted);
}
.widget-target-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.widget-target-item {
  border-bottom: 1px dashed #f0f1f3;
  font-size: 0.85rem;
}
.widget-target-item:last-child { border-bottom: 0; }
.widget-target-item.is-target {
  background: linear-gradient(90deg, rgba(254,243,199,0.4) 0%, transparent 60%);
  border-radius: 4px;
}
.widget-target-item.is-target .kw-text { font-weight: 600; }
.widget-target-item .kw-row { padding: 5px 4px 2px; }
.widget-target-pv {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.3;
}
.widget-target-metrics {
  margin: 4px 4px 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f0f1f3;
}
.widget-target-item:last-child .widget-target-metrics { border-bottom: 0; }
.widget-target-trend {
  display: block;
  margin: 0 0 6px;
  min-height: 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px;
  overflow: hidden;
}
.widget-target-spark { display: block; width: 100%; height: auto; aspect-ratio: 200 / 60; max-height: 80px; }
.widget-target-spark-loading,
.widget-target-spark-na {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  line-height: 20px;
  padding: 2px 0;
}
.widget-target-spark-loading { font-style: italic; }

.widget-target-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}
.widget-target-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.widget-target-cell-label {
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.widget-target-cell-value {
  font-size: 0.74rem;
  color: var(--text);
}
.widget-target-stars {
  font-size: 0.78rem;
  color: #f59e0b;
  letter-spacing: 0.5px;
  line-height: 1.2;
}
.widget-target-intent {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  align-self: flex-start;
  white-space: nowrap;
}
.widget-target-direction {
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
}

.widget-tips {
  background: #f9fafb;
}
.widget-tip-list {
  margin: 0; padding-left: 18px;
  font-size: 0.78rem;
  color: var(--muted);
}
.widget-tip-list li { margin: 4px 0; }
.widget-tip-list strong { color: var(--text); }

/* レスポンシブ: 1100px以下で右ウィジェットを下に */
@media (max-width: 1100px) {
  .dashboard-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .dashboard-shell.no-widgets {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .dash-widgets {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    overflow-y: visible;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .dash-widgets > .widget-card { flex: 1 1 280px; }
}
/* レスポンシブ: 720px以下で左サイドバーも縦積み */
@media (max-width: 720px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 12px 30px;
  }
  .dash-sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .dash-sidebar .main-tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .dash-sidebar .main-tab {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    text-align: center;
  }
  .dash-widgets { flex-direction: column; }
}

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.header-nav { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; justify-content: flex-end; }
.header-link {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}
.header-link:hover { text-decoration: underline; }
.header-link-contact,
.header-link-corp {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  background: #f9fafb;
  color: #1e3a8a;
  transition: all 0.15s;
}
.header-link-contact:hover,
.header-link-corp:hover {
  background: #eff6ff;
  border-color: var(--accent);
  color: var(--accent-dark);
  text-decoration: none;
}
.plan-badge { font-weight: 700; }
.header-logout {
  padding: 6px 14px;
  border: 1px solid #dc2626;
  border-radius: 6px;
  color: #dc2626;
  background: #fff;
  font-weight: 600;
  transition: all 0.15s;
}
.header-logout:hover {
  color: #ffffff;
  background: #dc2626;
  border-color: #dc2626;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

/* === 動的ナビ（lp.html / terms.html / privacy.html / tokushoho.html）=== */
.auth-nav-slot {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-height: 28px; /* JSロード前のレイアウト崩れ防止 */
}
.auth-nav-link {
  font-size: 0.85rem;
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.15s;
}
.auth-nav-link.auth-nav-login {
  color: var(--accent);
  border: 1px solid transparent;
}
.auth-nav-link.auth-nav-login:hover {
  background: #eff6ff;
}
.auth-nav-link.auth-nav-account {
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
}
.auth-nav-link.auth-nav-account:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.auth-nav-link.auth-nav-logout {
  color: #dc2626;
  border: 1px solid #dc2626;
  background: #fff;
  font-weight: 600;
}
.auth-nav-link.auth-nav-logout:hover {
  color: #fff;
  background: #dc2626;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}
.plan-badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  background: #eef2ff; color: var(--accent-dark);
}
.plan-badge.plan-pro { background: #fef3c7; color: #92400e; }
.plan-badge.plan-anonymous { background: #f3f4f6; color: var(--muted); }

/* Account page */
.account-page { padding: 32px 0; max-width: 480px; margin: 0 auto; }
.account-page h1 { margin-top: 0; }
.account-info { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.account-info dt { font-weight: 600; color: var(--muted); }
.account-info dd { margin: 0; }
.upgrade-box {
  background: #fef3c7; border: 1px solid #fde68a; border-radius: 8px;
  padding: 16px; margin: 24px 0;
}
.upgrade-box h2 { margin: 0 0 8px; font-size: 1rem; }
.upgrade-box--pro {
  background: #eff6ff; border-color: #bfdbfe;
}
.billing-banner {
  padding: 12px 16px; border-radius: 8px; margin: 16px 0;
  font-size: 0.92rem;
}
.billing-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.billing-cancel  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.logout-form { margin-top: 32px; }
.auth-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.auth-tab {
  background: transparent; border: 0; padding: 10px 16px; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px;
  font-size: 0.95rem; font-weight: 500;
}
.auth-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.auth-form { display: none; flex-direction: column; gap: 16px; }
.auth-form.is-active { display: flex; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
.auth-form input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.95rem; background: var(--surface);
}
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.form-error { color: #dc2626; font-size: 0.85rem; min-height: 1.2em; }
.form-hint { font-size: 0.8rem; color: var(--muted); }
.form-hint a { color: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark { display: block; width: 40px; height: 40px; flex: 0 0 40px; }
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.02em; color: var(--accent); }
.brand-tagline { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* ===== Search form ===== */
.search-form { display: flex; gap: 8px; margin: 32px 0 16px; }
.search-form input[type="text"] {
  flex: 1; padding: 12px 16px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-form input[type="text"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.search-form button {
  padding: 10px 16px; font-size: 0.92rem; font-weight: 700;
  color: var(--pastel-red-text);
  background: var(--pastel-red);
  border: 1px solid var(--pastel-red-active);
  border-radius: 8px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-align: center;
  min-height: 40px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-form button:hover {
  background: var(--pastel-red-hover);
  border-color: #dc2626;
}
.search-form button:disabled {
  background: #f3f4f6;
  color: var(--muted);
  border-color: var(--border);
  cursor: not-allowed;
}

/* ===== Tabs ===== */
.main-tabs {
  display: flex; gap: 4px; margin: 16px 0 0;
  border-bottom: 2px solid var(--border);
}
.main-tab {
  background: transparent; border: 0; padding: 10px 16px;
  font-size: 0.95rem; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.main-tab:hover { color: var(--text); }
.main-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.sub-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
  margin: 8px 0 0;
}

/* サブタブの2カテゴリ表示（公式サジェスト / SNS site:検索） */
.sub-tabs-category {
  margin: 16px 0 0;
  padding: 14px 16px 14px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.sub-tabs-category:first-of-type { margin-top: 12px; }
.sub-tabs-category-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.sub-tabs-category-num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--pastel-blue);
  color: var(--pastel-blue-text);
  border: 1px solid var(--pastel-blue-active);
  font-size: 0.95rem;
  font-weight: 800;
}
.sub-tabs-category-text { flex: 1; min-width: 0; }
.sub-tabs-category-label {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.sub-tabs-category-desc {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.6;
}
.sub-tabs-category-desc strong { color: var(--accent-dark); font-weight: 700; }
.sub-tabs-category-note {
  margin: 6px 0 0;
  padding: 6px 10px;
  font-size: 0.74rem;
  line-height: 1.55;
  color: #b91c1c;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  border-radius: 0 4px 4px 0;
}
.sub-tabs-category-note strong { color: #991b1b; font-weight: 800; }
.sub-tab {
  background: var(--pastel-yellow);
  border: 1px solid var(--pastel-yellow-active);
  border-radius: 8px; padding: 8px 14px; font-size: 0.85rem;
  color: var(--pastel-yellow-text); cursor: pointer; transition: all 0.15s;
  text-align: center;
  min-height: 36px;
  font-weight: 600;
}
.sub-tab:hover {
  background: var(--pastel-yellow-hover);
  border-color: #d97706;
}
.sub-tab.is-active {
  background: #f59e0b;
  border-color: #b45309;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(217,119,6,0.3);
}

.tab-panel { padding: 16px 0; }

/* ===== Status ===== */
.status { min-height: 1.5em; font-size: 0.9rem; color: var(--muted); margin: 12px 0; }
.status.error { color: #dc2626; }
.hint { font-size: 0.88rem; color: var(--muted); margin: 0 0 12px; }

/* ===== Panel actions ===== */
.panel-actions {
  display: flex; gap: 8px; align-items: center; margin: 12px 0;
  flex-wrap: wrap;
}
.sort-control {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--muted);
}
.sort-control select {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); font-size: 0.85rem; cursor: pointer;
}
.sort-control select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.toggle-control { cursor: pointer; user-select: none; }
.toggle-control input[type="checkbox"] {
  margin-right: 4px; cursor: pointer; vertical-align: -1px;
}

/* フィルタバー */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 0 16px;
  flex-wrap: wrap;
}
.filter-input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--surface);
  min-width: 160px;
  flex: 1;
  max-width: 220px;
}
.filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.filter-input::placeholder { color: #9ca3af; font-size: 0.82rem; }
#filter-include { border-left: 3px solid #10b981; }
#filter-exclude { border-left: 3px solid #dc2626; }
.filter-clear {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
}
.filter-clear:hover { background: #f3f4f6; color: var(--text); }
.filter-stats {
  font-size: 0.8rem; color: var(--muted);
  display: none;
}
.filter-stats.is-active { display: inline; }
.badge {
  display: inline-block; padding: 4px 10px;
  background: #eef2ff; color: var(--accent-dark);
  border-radius: 999px; font-size: 0.85rem; font-weight: 600;
}
.btn-primary, .btn-secondary {
  display: inline-block; padding: 8px 14px; font-size: 0.9rem;
  border-radius: 6px; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background 0.15s, color 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f3f4f6; }
.btn-green {
  background: var(--pastel-green);
  color: var(--pastel-green-text);
  border: 1px solid var(--pastel-green-active);
  font-weight: 600;
}
.btn-green:hover {
  background: var(--pastel-green-hover);
  border-color: #059669;
}
.is-locked {
  background: #f3f4f6 !important;
  color: #6b7280 !important;
  border: 1px solid #e5e7eb !important;
  cursor: not-allowed;
  position: relative;
}
.is-locked:hover { background: #fef3c7 !important; color: #92400e !important; }

/* ===== Suggest groups ===== */
.groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.group-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; box-shadow: var(--shadow);
}
.group-card h3 {
  margin: 0 0 12px; font-size: 0.95rem; color: var(--accent-dark);
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.group-card ul { list-style: none; padding: 0; margin: 0; }
.group-card .kw-item {
  border-bottom: 1px dashed #f0f1f3;
  font-size: 0.9rem;
}
.group-card .kw-item:last-child { border-bottom: 0; }

.kw-show-more {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.kw-show-more:hover {
  background: #eff6ff;
  border-color: var(--accent);
  border-style: solid;
}
.kw-show-more.is-open {
  background: #dbeafe;
  border-color: var(--accent);
  border-style: solid;
}
.kw-hidden-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  border-top: 1px dashed #e5e7eb;
}

.kw-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0;
}
.kw-text {
  flex: 1;
  word-break: break-word;
}
.kw-diff-badge {
  flex: 0 0 auto;
  display: inline-block;
  min-width: 30px;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  cursor: help;
}
.kw-crown {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1;
  cursor: help;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}
.kw-item.is-target {
  background: linear-gradient(90deg, rgba(254,243,199,0.4) 0%, transparent 60%);
  border-radius: 4px;
}
.kw-item.is-target .kw-text { font-weight: 600; }

.kw-metrics-btn {
  flex: 0 0 auto;
  min-width: 108px;
  white-space: nowrap;
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.2;
}
.kw-metrics-btn:hover { background: #eff6ff; border-color: var(--accent); }
.kw-metrics-btn.is-open { background: #dbeafe; border-color: var(--accent); }
.kw-metrics-btn:disabled { opacity: 0.6; cursor: wait; }

.kw-metrics {
  background: #f9fafb;
  border-radius: 6px;
  margin: 4px 0 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.85rem;
}
.kw-metrics .metric { display: flex; flex-direction: column; gap: 3px; }
.kw-metrics .metric-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.kw-metrics .metric-value { font-size: 0.9rem; }
.kw-metrics .metric-stars { color: #f59e0b; font-size: 1rem; letter-spacing: 1px; }
.kw-metrics .metric-bar {
  position: relative;
  background: #e5e7eb;
  height: 18px;
  border-radius: 9px;
  overflow: hidden;
}
.kw-metrics .metric-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 9px;
  transition: width 0.3s;
}
.kw-metrics .metric-bar-text {
  position: relative; z-index: 1;
  display: block; padding: 0 8px;
  line-height: 18px; font-size: 0.75rem;
  color: #111827; font-weight: 600;
}
.kw-metrics .sparkline {
  display: block; width: 100%; height: auto; aspect-ratio: 480 / 180;
  max-height: 220px;
  background: #fff; border: 1px solid var(--border); border-radius: 4px;
  padding: 4px;
}
.kw-metrics .metric-sub { font-size: 0.75rem; color: var(--muted); }
.kw-metrics .metric-source {
  display: inline-block; margin-left: 6px;
  padding: 1px 6px; border-radius: 4px;
  font-size: 0.65rem; font-weight: 500;
  background: #eef2ff; color: var(--accent-dark);
}
.kw-metrics .metric-unit-badge {
  display: inline-block; margin-left: 6px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700;
  background: #fef3c7; color: #92400e;
  border: 1px solid #fbbf24;
}
.kw-metrics .metric-unit-badge.metric-unit-badge-pv {
  background: #dbeafe; color: #1e40af; border-color: #3b82f6;
}
.widget-target-spark-unit {
  font-size: 0.62rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 4px;
  padding: 1px 5px;
  margin: 0 0 3px;
  display: inline-block;
  letter-spacing: 0.02em;
}
.kw-metrics .metric-na { font-size: 0.82rem; color: var(--muted); font-style: italic; }
.kw-metrics .metric-error { color: #dc2626; font-size: 0.85rem; }
.kw-metrics .metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.kw-metrics .metric-intent {
  display: inline-block;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700;
  color: #fff;
  align-self: flex-start;
}

/* ===== Q&A ===== */
.qa-list { list-style: none; padding: 0; margin: 0; }
.qa-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 14px; margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.qa-item a { color: var(--accent-dark); text-decoration: none; font-size: 0.95rem; }
.qa-item a:hover { text-decoration: underline; }

/* ===== Headings ===== */
.headings-controls { margin: 12px 0; }
.advanced { margin: 16px 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.advanced summary { cursor: pointer; font-weight: 500; color: var(--muted); }
.advanced textarea {
  width: 100%; margin: 12px 0 8px; padding: 10px;
  border: 1px solid var(--border); border-radius: 6px;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
  font-size: 0.85rem;
}
.headings-results { margin-top: 16px; }
.page-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.page-card h3 { margin: 0 0 4px; font-size: 1rem; }
.page-card h3 a { color: var(--accent-dark); text-decoration: none; }
.page-card h3 a:hover { text-decoration: underline; }
.page-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; }
.heading-list { list-style: none; padding: 0; margin: 0; }
.heading-list li {
  padding: 3px 0; font-size: 0.88rem;
  border-left: 3px solid var(--border); padding-left: 10px; margin: 2px 0;
}
.heading-list li.h-1 { border-left-color: var(--accent); font-weight: 600; }
.heading-list li.h-2 { border-left-color: #60a5fa; margin-left: 12px; }
.heading-list li.h-3 { border-left-color: #93c5fd; margin-left: 24px; color: var(--muted); }

/* ===== Cooccurrence ===== */
.cooccur-results { margin-top: 16px; }
.cooccur-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.cooccur-table th, .cooccur-table td {
  padding: 8px 12px; text-align: left; font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.cooccur-table th { background: #f3f4f6; font-weight: 600; }
.cooccur-table tr:last-child td { border-bottom: 0; }
.cooccur-table td:nth-child(2) { text-align: center; width: 6ch; }
.cooccur-table td:nth-child(3), .cooccur-table td:nth-child(4) { text-align: right; width: 12ch; }
.cooccur-diff .kw-diff-badge { display: inline-block; min-width: 30px; }

/* ===== Audit page (自サイト分析) ===== */
.audit-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.audit-intro h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  color: var(--accent-dark);
}
.audit-intro p { margin: 4px 0; color: var(--muted); }
.audit-intro strong { color: var(--text); }
.audit-nav-back a { font-size: 0.85rem; color: var(--accent); text-decoration: none; }
.audit-nav-back a:hover { text-decoration: underline; }

.audit-form {
  display: flex; gap: 8px; margin: 20px 0 12px;
}
.audit-form input[type="url"] {
  flex: 1; padding: 12px 16px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
.audit-form input[type="url"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.audit-form button {
  padding: 12px 24px; font-size: 1rem; font-weight: 700;
  color: var(--pastel-green-text);
  background: var(--pastel-green);
  border: 1px solid var(--pastel-green-active);
  border-radius: 8px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.audit-form button:hover {
  background: var(--pastel-green-hover);
  border-color: #059669;
}
.audit-form button:disabled {
  background: #f3f4f6; color: var(--muted); border-color: var(--border);
  cursor: not-allowed;
}

.audit-result { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.audit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.audit-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--accent-dark);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.audit-score {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.audit-score-circle {
  flex: 0 0 110px; width: 110px; height: 110px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.audit-score-a { background: linear-gradient(135deg, #10b981, #059669); }
.audit-score-b { background: linear-gradient(135deg, #f59e0b, #d97706); }
.audit-score-c { background: linear-gradient(135deg, #f97316, #ea580c); }
.audit-score-d { background: linear-gradient(135deg, #dc2626, #991b1b); }
.audit-score-num { font-size: 2.2rem; line-height: 1; }
.audit-score-label { font-size: 0.78rem; opacity: 0.9; margin-top: 2px; }
.audit-score-meta { flex: 1 1 240px; min-width: 0; }
.audit-score-meta h2 { margin: 0 0 4px; font-size: 1.1rem; word-break: break-word; }
.audit-score-url { font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; word-break: break-all; }
.audit-score-url a { color: var(--accent); text-decoration: none; }
.audit-score-stats { font-size: 0.85rem; color: var(--muted); }
.audit-score-stats strong { color: var(--text); }

.audit-issues ul { list-style: none; padding: 0; margin: 0; }
.audit-issue {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-radius: 6px; margin-bottom: 4px;
  font-size: 0.9rem;
}
.audit-issue-error { background: #fef2f2; }
.audit-issue-warn  { background: #fef3c7; }
.audit-issue-info  { background: #eff6ff; }
.audit-issue-level {
  flex: 0 0 auto;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 700; color: #fff;
}
.audit-issue-error .audit-issue-level { background: #dc2626; }
.audit-issue-warn  .audit-issue-level { background: #f59e0b; }
.audit-issue-info  .audit-issue-level { background: #2563eb; }
.audit-issues-ok h3 { color: #10b981; border-bottom-color: #a7f3d0; }

.audit-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.audit-table th, .audit-table td {
  padding: 6px 8px; text-align: left;
  border-bottom: 1px solid #f3f4f6; vertical-align: top;
}
.audit-table th { font-weight: 600; color: var(--muted); width: 110px; white-space: nowrap; }
.audit-table tr:last-child th, .audit-table tr:last-child td { border-bottom: 0; }
.audit-len { color: var(--muted); font-size: 0.78rem; margin-left: 4px; }
.audit-muted { color: var(--muted); }
.audit-sub-label {
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  margin: 8px 0 4px;
}

.audit-heading-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.audit-h-box {
  background: #f9fafb; border: 1px solid var(--border);
  border-radius: 6px; padding: 6px; text-align: center;
}
.audit-h-label { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.audit-h-count { font-size: 1.2rem; font-weight: 700; color: var(--accent-dark); }
.audit-h1-list ul { font-size: 0.85rem; padding-left: 18px; margin: 4px 0 0; }
.audit-h1-list li { margin: 2px 0; }

.audit-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.audit-stat {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.audit-stat-num { font-size: 1.4rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.audit-stat-lbl { font-size: 0.72rem; color: var(--muted); font-weight: 600; }

.audit-mono-list { font-family: ui-monospace, "Cascadia Code", monospace; font-size: 0.78rem; padding-left: 18px; }
.audit-mono-list li { color: var(--muted); margin: 2px 0; word-break: break-all; }

.audit-kv summary { cursor: pointer; font-size: 0.85rem; color: var(--accent); padding: 4px 0; }
.audit-kv[open] summary { color: var(--accent-dark); font-weight: 600; }

.audit-trends-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.audit-trend-block {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.audit-trend-svg {
  display: block; width: 100%; height: 110px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 4px;
}
.audit-trend-meta {
  font-size: 0.78rem; color: var(--muted); margin-top: 6px;
}
.audit-trend-meta strong { color: var(--text); }
.audit-trend-na {
  font-size: 0.82rem; color: var(--muted); font-style: italic;
  padding: 24px 8px; text-align: center;
  background: #fff; border: 1px dashed var(--border); border-radius: 6px;
}
@media (max-width: 640px) {
  .audit-trends-grid { grid-template-columns: 1fr; }
}

/* index.php に置く「自サイト分析」ボタン (旧クラス) */
.audit-cta,
.seo-cta {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%;
  padding: 10px 12px;
  background: var(--pastel-green);
  color: var(--pastel-green-text);
  border: 1px solid var(--pastel-green-active);
  border-radius: 8px;
  font-size: 0.92rem; font-weight: 700;
  text-align: center;
  text-decoration: none;
  min-height: 40px;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.audit-cta:hover,
.seo-cta:hover {
  background: var(--pastel-green-hover);
  border-color: #059669;
  transform: translateY(-1px);
}

/* 競合サイトCTA - パステル紫 */
.competitor-cta {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%;
  padding: 10px 12px;
  background: var(--pastel-purple);
  color: var(--pastel-purple-text);
  border: 1px solid var(--pastel-purple-active);
  border-radius: 8px;
  font-size: 0.92rem; font-weight: 700;
  text-align: center;
  text-decoration: none;
  min-height: 40px;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s;
}
.competitor-cta:hover {
  background: var(--pastel-purple-hover);
  border-color: #7c3aed;
}

/* ===== Improvement 改善点ページ ===== */
.imp-result { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.imp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

/* スコアサマリ */
.imp-summary {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.imp-score-circle {
  flex: 0 0 100px; width: 100px; height: 100px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.imp-score-a { background: linear-gradient(135deg, #10b981, #059669); }
.imp-score-b { background: linear-gradient(135deg, #f59e0b, #d97706); }
.imp-score-c { background: linear-gradient(135deg, #f97316, #ea580c); }
.imp-score-d { background: linear-gradient(135deg, #dc2626, #991b1b); }
.imp-score-num { font-size: 2rem; line-height: 1; }
.imp-score-lbl { font-size: 0.7rem; opacity: 0.9; margin-top: 2px; }

.imp-summary-meta { flex: 1 1 240px; min-width: 0; }
.imp-summary-meta h2 { margin: 0 0 4px; font-size: 1.05rem; word-break: break-word; }
.imp-summary-url { font-size: 0.78rem; word-break: break-all; margin: 0 0 8px; }
.imp-summary-url a { color: var(--accent); text-decoration: none; }
.imp-tally {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.imp-tally-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700;
}
.imp-tally-error { background: #fef2f2; color: #b91c1c; }
.imp-tally-warn  { background: #fef3c7; color: #92400e; }
.imp-tally-info  { background: #eff6ff; color: #1e40af; }
.imp-tally-good  { background: #d1fae5; color: #047857; }

/* 各ブロック */
.imp-block h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  display: flex; align-items: center; gap: 10px;
}
.imp-count {
  font-size: 0.75rem; font-weight: 600;
  background: rgba(0,0,0,0.06);
  padding: 2px 8px; border-radius: 999px;
}
.imp-block-error  { border-top: 4px solid #dc2626; }
.imp-block-warn   { border-top: 4px solid #f59e0b; }
.imp-block-info   { border-top: 4px solid #2563eb; }
.imp-block-good   { border-top: 4px solid #10b981; background: #f0fdf4; }
.imp-block-next   { border-top: 4px solid #7c3aed; background: #faf5ff; }
.imp-block-empty .imp-empty-msg {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

.imp-issue-list,
.imp-good-list,
.imp-next-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.imp-issue {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.imp-issue-msg {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--text);
}
.imp-issue-action {
  font-size: 0.85rem;
  color: #047857;
  padding: 6px 10px;
  background: #ecfdf5;
  border-left: 3px solid #10b981;
  border-radius: 0 6px 6px 0;
}

.imp-good-list li {
  background: #fff;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  padding: 6px 12px;
  margin-bottom: 4px;
  font-size: 0.88rem;
  color: #064e3b;
}

.imp-next-list {
  margin: 8px 0 16px;
  padding-left: 20px;
}
.imp-next-list li {
  list-style: disc;
  margin: 6px 0;
  line-height: 1.7;
  font-size: 0.9rem;
}
.imp-next-cta {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 12px;
}

/* ===== Competitor 比較ページ ===== */
.cmp-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0 16px;
}
.cmp-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.cmp-form-input { display: flex; flex-direction: column; gap: 6px; }
.cmp-form-input label {
  font-size: 0.88rem;
  font-weight: 700;
}
.cmp-form-input.own label { color: #1e40af; }
.cmp-form-input.rival label { color: #b91c1c; }
.cmp-form-input input[type="url"] {
  padding: 12px 14px; font-size: 0.95rem;
  border: 2px solid var(--border); border-radius: 8px; background: var(--surface);
}
.cmp-form-input.own input { border-color: #93c5fd; }
.cmp-form-input.rival input { border-color: #fca5a5; }
.cmp-form-input input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.cmp-form button {
  padding: 12px 24px; font-size: 1rem; font-weight: 700;
  color: var(--pastel-purple-text);
  background: var(--pastel-purple);
  border: 1px solid var(--pastel-purple-active);
  border-radius: 8px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  align-self: stretch;
}
.cmp-form button:hover {
  background: var(--pastel-purple-hover);
  border-color: #7c3aed;
}
.cmp-form button:disabled {
  background: #f3f4f6; color: var(--muted); border-color: var(--border);
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .cmp-form-grid { grid-template-columns: 1fr; }
}

/* スコアサマリ */
.cmp-result { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.cmp-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.cmp-summary-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
}
.cmp-side { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cmp-side-label {
  font-size: 0.85rem; font-weight: 700;
}
.cmp-side.cmp-own .cmp-side-label { color: #1e40af; }
.cmp-side.cmp-rival .cmp-side-label { color: #b91c1c; }
.cmp-score-circle {
  width: 96px; height: 96px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.cmp-score-a { background: linear-gradient(135deg, #10b981, #059669); }
.cmp-score-b { background: linear-gradient(135deg, #f59e0b, #d97706); }
.cmp-score-c { background: linear-gradient(135deg, #f97316, #ea580c); }
.cmp-score-d { background: linear-gradient(135deg, #dc2626, #991b1b); }
.cmp-score-num { font-size: 1.9rem; line-height: 1; }
.cmp-score-lbl { font-size: 0.72rem; opacity: 0.9; margin-top: 2px; }
.cmp-side-title {
  font-size: 0.78rem; color: var(--text); font-weight: 600;
  text-align: center; line-height: 1.4;
  max-width: 240px;
}
.cmp-side-url {
  font-size: 0.7rem; color: var(--accent); text-decoration: none;
  word-break: break-all;
  text-align: center; max-width: 240px;
}
.cmp-side-url:hover { text-decoration: underline; }

.cmp-vs { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cmp-vs-text {
  font-size: 1.5rem; font-weight: 900;
  background: linear-gradient(135deg, #1e40af, #b91c1c);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.05em;
}
.cmp-verdict { font-size: 0.88rem; font-weight: 700; }
.cmp-tally { font-size: 0.74rem; color: var(--muted); }
.cmp-tally-own { color: #1e40af; font-weight: 600; }
.cmp-tally-rival { color: #b91c1c; font-weight: 600; }
.cmp-tally-tie { color: #6b7280; }

@media (max-width: 720px) {
  .cmp-summary-grid { grid-template-columns: 1fr; }
  .cmp-vs { order: -1; }
}

/* 比較テーブル */
.cmp-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.cmp-table-card h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  color: var(--accent-dark);
}
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.cmp-table thead th {
  text-align: center;
  font-weight: 700;
  padding: 8px 6px;
  border-bottom: 2px solid var(--border);
  background: #f9fafb;
  font-size: 0.82rem;
  color: var(--muted);
}
.cmp-table thead th:first-child { color: #1e40af; }
.cmp-table thead th:last-child { color: #b91c1c; }
.cmp-table tbody td {
  padding: 7px 8px;
  text-align: center;
  border-bottom: 1px solid #f3f4f6;
  font-variant-numeric: tabular-nums;
}
.cmp-table tbody tr:hover { background: #fafbfc; }
.cmp-label {
  text-align: left !important;
  color: #4b5563;
  font-weight: 500;
  font-size: 0.85rem;
}
.cmp-cell-win {
  background: linear-gradient(90deg, transparent 0%, #d1fae5 50%, transparent 100%);
  font-weight: 700;
  color: #047857;
}
.cmp-cell-lose {
  background: linear-gradient(90deg, transparent 0%, #fee2e2 50%, transparent 100%);
  color: #b91c1c;
}
.cmp-ind {
  font-size: 1.1rem;
  font-weight: 900;
  width: 30px;
}
.cmp-ind-own { color: #2563eb; }
.cmp-ind-rival { color: #dc2626; }
.cmp-ind-tie { color: #9ca3af; }

.cmp-legend {
  margin-top: 12px;
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 0.74rem; color: var(--muted);
}
.cmp-legend .cmp-cell-win,
.cmp-legend .cmp-cell-lose {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  background: #d1fae5;
  color: #047857;
  margin-right: 2px;
}
.cmp-legend .cmp-cell-lose { background: #fee2e2; color: #b91c1c; }

/* 改善ポイント */
.cmp-insight-card {
  background: linear-gradient(135deg, #fef3c7, #fed7aa);
  border: 1px solid #fbbf24;
  border-radius: 12px;
  padding: 18px 20px;
}
.cmp-insight-card.cmp-insight-good {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-color: #10b981;
}
.cmp-insight-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #78350f;
}
.cmp-insight-card.cmp-insight-good h3 { color: #047857; }
.cmp-insight-card ul {
  margin: 0;
  padding-left: 20px;
  font-size: 0.88rem;
}
.cmp-insight-card li {
  margin: 6px 0;
  line-height: 1.6;
}
.cmp-action {
  display: inline-block;
  color: #b91c1c;
  font-weight: 600;
  font-size: 0.82rem;
}


/* ===== キーワード未入力ポップアップ ===== */
.kw-required-popup {
  position: fixed;
  top: 80px;
  left: 50%;
  z-index: 100;
  transform: translate(-50%, -30px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.35s;
  max-width: 92vw;
  width: 460px;
}
.kw-required-popup.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}
.kw-required-popup-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fbbf24;
  border-radius: 12px;
  padding: 14px 16px 14px 18px;
  box-shadow: 0 14px 40px rgba(180, 83, 9, 0.25);
}
.kw-required-popup-icon {
  font-size: 2rem;
  line-height: 1;
  animation: kwReqShake 0.6s ease-in-out;
}
@keyframes kwReqShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-15deg) scale(1.1); }
  40% { transform: rotate(12deg) scale(1.1); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(5deg); }
}
.kw-required-popup-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #78350f;
  margin-bottom: 2px;
}
.kw-required-popup-msg {
  font-size: 0.82rem;
  color: #4b5563;
  line-height: 1.55;
}
.kw-required-popup-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1.3rem;
  color: #92400e;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  padding: 0;
  line-height: 1;
}
.kw-required-popup-close:hover { background: rgba(180, 83, 9, 0.15); }

/* 検索欄ハイライト */
.kw-required-highlight {
  animation: kwReqHi 0.5s ease-in-out 0s 3;
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18) !important;
}
@keyframes kwReqHi {
  0%, 100% { background-color: #fff; }
  50% { background-color: #fef3c7; }
}

/* ===== SEOキーワード生成: サイドバーボタン(紫) ===== */
.seo-cta-purple {
  background: var(--pastel-purple) !important;
  color: var(--pastel-purple-text) !important;
  border-color: var(--pastel-purple-active) !important;
}
.seo-cta-purple:hover {
  background: var(--pastel-purple-hover) !important;
  border-color: #7c3aed !important;
}

/* ===== SEOキーワード生成モーダル ===== */
.kw-gen-modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.kw-gen-modal[hidden] { display: none; }
.kw-gen-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}
.kw-gen-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
  padding: 28px 28px 24px;
  animation: kwGenIn 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes kwGenIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.kw-gen-close {
  position: absolute;
  top: 12px; right: 14px;
  background: transparent;
  border: 0;
  font-size: 1.8rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 50%;
  line-height: 1;
}
.kw-gen-close:hover { background: #f3f4f6; color: var(--text); }
.kw-gen-header h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  color: var(--accent-dark);
}
.kw-gen-header p {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--muted);
}
.kw-gen-header strong { color: var(--text); }

/* フォーム */
.kw-gen-form {
  background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.kw-gen-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.kw-gen-field { display: flex; flex-direction: column; gap: 4px; }
.kw-gen-field-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--pastel-purple-text);
}
.kw-gen-required { color: #dc2626; margin-left: 2px; }
.kw-gen-optional {
  margin-left: 4px;
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--muted);
}
.kw-gen-field input {
  padding: 10px 12px;
  border: 1px solid var(--pastel-purple-active);
  border-radius: 6px;
  background: #fff;
  font-size: 0.92rem;
}
.kw-gen-field input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}
.kw-gen-submit {
  margin-top: 14px;
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.kw-gen-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124,58,237,0.4);
}

/* 結果セクション */
.kw-gen-result { margin-top: 8px; }
.kw-gen-loading {
  display: flex; align-items: center; gap: 12px;
  padding: 24px;
  font-size: 0.9rem;
  color: var(--muted);
  background: #f9fafb;
  border-radius: 8px;
  justify-content: center;
}
.kw-gen-progress-text { flex: 1; max-width: 360px; }
.kw-gen-progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}
.kw-gen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #5b21b6);
  border-radius: 999px;
  transition: width 0.3s ease-out;
}
.kw-gen-pill-source {
  background: #6b7280 !important;
}
.kw-gen-error {
  padding: 18px 20px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.92rem;
  line-height: 1.6;
}
.kw-gen-auto-controls {
  margin: 8px 0 14px;
  display: flex;
  justify-content: flex-end;
}
.kw-gen-auto-controls .kw-gen-submit {
  width: auto;
  margin-top: 0;
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* 主要キーワード①②③ (トレンド) カード */
.kw-gen-trending-block {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 14px 18px 16px;
  margin-bottom: 16px;
}
.kw-gen-trending-block h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #78350f;
}
.kw-gen-trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.kw-gen-trend-card {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(217,119,6,0.15);
}
.kw-gen-trend-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.kw-gen-trend-num {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  background: #f59e0b;
  color: #fff;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}
.kw-gen-trend-kw {
  flex: 1;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  word-break: break-word;
}
.kw-gen-trend-traffic {
  font-size: 0.72rem;
  background: #fef3c7;
  color: #78350f;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.kw-gen-trend-news {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #f3f4f6;
}

/* サマリカード */
.kw-gen-summary-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fbbf24;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.kw-gen-summary-card h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  color: #78350f;
}
.kw-gen-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.kw-gen-summary-stat {
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.kw-gen-summary-stat-wide { grid-column: 1 / -1; }
.kw-gen-summary-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.kw-gen-summary-traffic { color: var(--accent-dark); font-size: 1.3rem; }
.kw-gen-summary-lbl {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 4px;
}
.kw-gen-low { color: #10b981; }
.kw-gen-mid { color: #f59e0b; }
.kw-gen-hi  { color: #dc2626; }
.kw-gen-summary-tip {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: #78350f;
  line-height: 1.6;
  background: rgba(255,255,255,0.6);
  padding: 8px 12px;
  border-radius: 6px;
}
.kw-gen-summary-tip strong { color: #422006; }

/* 候補一覧 */
.kw-gen-list-head h3 {
  margin: 16px 0 6px;
  font-size: 1.05rem;
  color: var(--accent-dark);
}
.kw-gen-list-head p {
  margin: 0 0 14px;
  font-size: 0.82rem;
  color: var(--muted);
}
.kw-gen-items { display: flex; flex-direction: column; gap: 8px; }
.kw-gen-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  transition: box-shadow 0.15s, transform 0.1s;
}
.kw-gen-item:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}
.kw-gen-item-p1 { border-left: 4px solid #10b981; }
.kw-gen-item-p2 { border-left: 4px solid #f59e0b; }
.kw-gen-item-p3 { border-left: 4px solid #fb923c; }
.kw-gen-item-p4 { border-left: 4px solid #dc2626; }
.kw-gen-item-rank {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--muted);
  width: 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.1;
}
.kw-gen-item-rank .kw-crown,
.kw-gen-item-rank .kw-hot {
  margin-left: 0;
  font-size: 1rem;
}
.kw-gen-item-body { min-width: 0; }
.kw-gen-item-kw {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  word-break: break-word;
}

/* 主要KW①②③ パーツ表示 */
.kw-gen-parts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.kw-gen-part {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1e40af;
}
.kw-gen-part em { color: #9ca3af; font-style: italic; font-weight: 400; }
.kw-gen-part-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  background: #2563eb;
  color: #fff;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
}
.kw-gen-plus {
  font-weight: 700;
  color: #94a3b8;
  font-size: 0.9rem;
}
.kw-gen-full-kw {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 6px;
  padding: 4px 0;
  border-top: 1px dashed #e5e7eb;
  border-bottom: 1px dashed #e5e7eb;
}
.kw-gen-full-kw strong { color: #1e40af; }

/* seed recap */
.kw-gen-seed-recap {
  flex: 1;
  font-size: 0.85rem;
  color: var(--muted);
}
.kw-gen-seed-recap strong {
  color: var(--accent-dark);
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.kw-gen-auto-controls {
  align-items: center;
  justify-content: space-between !important;
}
.kw-gen-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.kw-gen-meta-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
}
.kw-gen-pill-type    { background: #6366f1; }
.kw-gen-pill-intent  { background: #14b8a6; }
.kw-gen-pill-traffic { background: #f59e0b; }
.kw-gen-pill-priority { background: #6b7280; }
.kw-gen-item-actions { display: flex; flex-direction: column; gap: 6px; }
.kw-gen-item-btn {
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  background: #2563eb;
  color: #fff;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.kw-gen-item-btn:hover { background: #1d4ed8; }

.kw-gen-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .kw-gen-dialog { padding: 22px 16px 18px; }
  .kw-gen-fields { grid-template-columns: 1fr; }
  .kw-gen-item { grid-template-columns: auto 1fr; }
  .kw-gen-item-actions { grid-column: 1 / -1; flex-direction: row; }
}

/* ===== Footer & Misc ===== */
.site-footer {
  margin-top: 64px; padding: 24px 0;
  border-top: 1px solid var(--border); background: var(--surface);
  text-align: center; color: var(--muted);
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
  vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 入力欄の文字数カウンター ===== */
.search-input-meta {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 6px;
  padding: 0 4px;
}
.search-counter {
  font-size: 0.7rem;
  color: rgba(120, 80, 0, 0.55);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.search-counter-warn {
  color: #d97706;
  font-weight: 700;
}
.search-counter-error {
  color: #dc2626;
  font-weight: 700;
}

/* ===== キーワード生成: おすすめKW（縦並び1.2.3 + 黄色マーカー） ===== */
.kw-gen-related {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}
.kw-gen-related-label {
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
.kw-gen-related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-reset: kw-gen-num;
}
.kw-gen-related-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  counter-increment: kw-gen-num;
}
.kw-gen-related-list li::before {
  content: counter(kw-gen-num);
  background: #1e40af;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1;
}
.kw-gen-related-pick {
  /* ハイライト共通スタイル: 色・高さ・太さ・パディングを完全統一 */
  display: inline-block;
  background: linear-gradient(transparent 55%, #fef08a 55%);
  color: #1f2937;
  font-weight: 700;
  font-size: 0.92rem;
  font-style: normal;
  line-height: 1.6;
  padding: 1px 6px;
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  transition: box-shadow 0.15s, transform 0.1s;
}
.kw-gen-related-pick:hover {
  /* 色は変えずに枠線で hover を示す（高さ・背景を維持） */
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}
.kw-gen-related-pick:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}
.kw-gen-related-pick:active {
  transform: scale(0.97);
}
.kw-gen-related-pick.is-selected {
  /* 選択中も背景色は変えず、左の青ボーダーで識別（高さ・色は他と同じ） */
  box-shadow: inset 4px 0 0 #2563eb, 0 0 0 1px rgba(37, 99, 235, 0.3);
  padding-left: 10px;
}
.kw-gen-related-pick.is-selected::after {
  content: ' ✓';
  color: #2563eb;
  font-weight: 800;
}
/* 急上昇マーク */
.kw-hot {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.95em;
  vertical-align: -1px;
}
/* メインKW表記の太さ統一 */
.kw-gen-full-kw strong {
  font-weight: 700;
  font-size: 0.98rem;
}

/* ===== キーワード生成: 流入グラフ展開エリア ===== */
.kw-gen-chart-area {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  animation: kwGenChartFadeIn 0.25s ease-out;
}
@keyframes kwGenChartFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.kw-gen-chart-inner {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 16px 18px;
}
.kw-gen-chart-head h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  color: #1e3a8a;
  font-weight: 800;
}
.kw-gen-chart-head p {
  margin: 0 0 12px;
  font-size: 0.78rem;
  color: #6b7280;
}
.kw-gen-chart-svg-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}
.kw-gen-chart-svg-wrap svg {
  width: 100%;
  height: auto;
  max-height: 240px;
}
.kw-gen-chart-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.kw-gen-chart-kpi {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}
.kw-gen-chart-kpi-label {
  font-size: 0.72rem;
  color: #6b7280;
  margin-bottom: 4px;
  font-weight: 600;
}
.kw-gen-chart-kpi-value {
  font-size: 1.3rem;
  color: #1d4ed8;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.kw-gen-chart-kpi-value.kw-gen-chart-kpi-text {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
  color: #374151;
}
.kw-gen-chart-kpi-unit {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 2px;
}
.kw-gen-chart-note {
  margin: 10px 0 0;
  font-size: 0.72rem;
  color: #9ca3af;
  font-style: italic;
}
.kw-gen-chart-btn.is-open {
  background: #1e40af !important;
  color: #fff !important;
  border-color: #1e40af !important;
}

/* ===== リスティング広告分析（listing.php） ===== */
.listing-form-grid {
  grid-template-columns: 2fr 1fr;
}
.listing-result { margin-top: 20px; }

.listing-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.listing-summary-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.listing-summary-card-wide {
  grid-column: span 4;
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border-color: #93c5fd;
}
.listing-sum-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1e3a8a;
  line-height: 1.2;
}
.listing-summary-card-wide .listing-sum-num { color: #047857; font-size: 1.6rem; }
.listing-sum-lbl {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 4px;
}

.listing-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.listing-note {
  font-size: 0.75rem;
  color: #6b7280;
}

.listing-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.listing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #fff;
}
.listing-table thead th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  font-size: 0.78rem;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
}
.listing-table tbody td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.listing-table tbody tr:hover { background: #fafbfc; }
.listing-rank {
  width: 36px;
  text-align: center;
  font-weight: 700;
  color: #64748b;
}
.listing-kw {
  min-width: 160px;
  word-break: break-word;
}
.listing-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.listing-comp {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 80px;
}
.listing-comp-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
}
.listing-comp-fill { height: 100%; border-radius: 3px; }
.listing-comp-label {
  font-size: 0.72rem;
  font-weight: 700;
}
.listing-ad {
  min-width: 280px;
  max-width: 360px;
}
.listing-ad-title {
  color: #1d4ed8;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 2px;
  line-height: 1.35;
}
.listing-ad-desc {
  color: #334155;
  font-size: 0.78rem;
  line-height: 1.45;
  margin-bottom: 3px;
}
.listing-ad-url {
  color: #059669;
  font-size: 0.72rem;
  word-break: break-all;
}

@media (max-width: 720px) {
  .listing-summary { grid-template-columns: repeat(2, 1fr); }
  .listing-summary-card-wide { grid-column: span 2; }
  .listing-form-grid { grid-template-columns: 1fr; }
}

/* ===== サイドバー クリアボタン ===== */
.sidebar-clear-btn {
  width: 100%;
  margin: -10px 0 0;
  padding: 8px 12px;
  background: #fff;
  color: #6b7280;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.sidebar-clear-btn:hover {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #dc2626;
  border-style: solid;
}
.sidebar-clear-btn:active { transform: translateY(1px); }
/* ===== ヘッダー 解約リンク (薄い灰色) ===== */
.header-link-cancel {
  color: #9ca3af !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.header-link-cancel:hover {
  color: #4b5563 !important;
  background: #f3f4f6;
  border-color: #d1d5db;
  text-decoration: none;
}
/* ===== ヘッダー LPに戻るリンク ===== */
.header-link-lp {
  padding: 4px 9px;
  border: 1px solid #2563eb;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  background: #eff6ff;
  color: #1e40af !important;
  transition: all 0.15s;
}
.header-link-lp:hover {
  background: #2563eb;
  color: #fff !important;
  border-color: #1d4ed8;
  text-decoration: none;
}
/* ===== エラーステータス: 太字 + アップグレード煽り文字リンク ===== */
.status-error-bold {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.status-upgrade-link {
  display: inline-block;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #ef4444 100%);
  color: #fff !important;
  font-weight: 900;
  text-decoration: none !important;
  padding: 2px 12px;
  border-radius: 999px;
  margin: 0 2px;
  font-size: 1.02em;
  letter-spacing: 0.04em;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35);
  animation: upgrade-pulse 1.4s ease-in-out infinite;
  position: relative;
  transition: transform 0.15s;
}
.status-upgrade-link::before {
  content: "🚀 ";
  font-weight: normal;
}
.status-upgrade-link:hover {
  transform: translateY(-1px) scale(1.05);
  text-decoration: none !important;
  animation-play-state: paused;
  box-shadow: 0 5px 14px rgba(239, 68, 68, 0.5);
}
@keyframes upgrade-pulse {
  0%, 100% {
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35), 0 0 0 0 rgba(239, 68, 68, 0.45);
  }
  50% {
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5), 0 0 0 8px rgba(239, 68, 68, 0);
  }
}
/* ===== index.php H1 (SEO用・視覚的にもコンパクトに) ===== */
.dash-h1 {
  margin: 0 0 6px;
  padding: 10px 14px;
  font-size: 0.98rem;
  font-weight: 800;
  color: #1e3a8a;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  line-height: 1.45;
}
.dash-h1-keyword {
  display: inline;
  background: linear-gradient(transparent 60%, #fde047 60%, #fde047 92%, transparent 92%);
  padding: 0 3px;
  color: #1d4ed8;
}
.dash-h1-sub {
  margin: 0 0 14px;
  padding: 0 4px;
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.6;
}
.dash-h1-sub strong { color: #1d4ed8; font-weight: 700; }
@media (max-width: 720px) {
  .dash-h1 { font-size: 0.92rem; padding: 8px 10px; }
  .dash-h1-sub { font-size: 0.72rem; }
}