﻿/* ─── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: #fff7ed;
  color: #1c1917;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─────────────────────────────────────── */
header {
  background: #ea580c;
  color: #fff;
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(234,88,12,.35);
}
.header-inner { max-width: 900px; width: 100%; margin: 0 auto; }
.logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }

/* ─── Main ───────────────────────────────────────── */
main { max-width: 900px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }

/* ─── Hero ───────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 1.5rem; }
.hero-icon { font-size: 3rem; margin-bottom: .5rem; }
.hero h1 { font-size: 1.75rem; font-weight: 800; color: #ea580c; margin-bottom: .5rem; }
.description { color: #57534e; font-size: .95rem; line-height: 1.7; }

/* ━━━ ヒーローバッジ ━━━ */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.hero-badges .badge {
  display: inline-block;
  padding: 5px 13px;
  background: #ffedd5;
  color: #9a3412;
  border: 1.5px solid #fdba74;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ─── Input Card ─────────────────────────────────── */
.input-card {
  background: #fff;
  border: 1.5px solid #fed7aa;
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(234,88,12,.07);
}
.input-row { position: relative; }

.text-area {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  border: 1.5px solid #e7e5e4;
  border-radius: 10px;
  padding: .85rem 1rem;
  font-size: .925rem;
  font-family: inherit;
  color: #1c1917;
  background: #fafaf9;
  line-height: 1.7;
  outline: none;
  transition: border-color .15s;
}
.text-area:focus { border-color: #ea580c; background: #fff; }
.text-area::placeholder { color: #a8a29e; }

/* Buttons over textarea */
.input-actions {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
  justify-content: flex-end;
}
.btn-clear {
  background: none;
  border: 1.5px solid #e7e5e4;
  border-radius: 7px;
  padding: .3rem .8rem;
  font-size: .8rem;
  color: #78716c;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-clear:hover { background: #f5f5f4; border-color: #d6d3d1; }

.btn-file {
  background: none;
  border: 1.5px solid #e7e5e4;
  border-radius: 7px;
  padding: .3rem .8rem;
  font-size: .8rem;
  color: #78716c;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
}
.btn-file:hover { background: #f5f5f4; border-color: #d6d3d1; }

/* Options Row */
.options-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: .85rem;
  flex-wrap: wrap;
}
.opt-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .875rem;
  color: #57534e;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.opt-label input[type="checkbox"] {
  accent-color: #ea580c;
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.opt-select {
  border: 1.5px solid #e7e5e4;
  border-radius: 6px;
  padding: .2rem .5rem;
  font-size: .875rem;
  color: #44403c;
  background: #fff;
  cursor: pointer;
  outline: none;
}
.opt-select:focus { border-color: #ea580c; }

.btn-analyze {
  margin-left: auto;
  background: #ea580c;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .45rem 1.2rem;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.btn-analyze:hover { background: #c2410c; }

/* ─── Stats Bar ──────────────────────────────────── */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border: 1.5px solid #fed7aa;
  border-radius: 12px;
  padding: .75rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(234,88,12,.06);
  flex-wrap: wrap;
  row-gap: .5rem;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.1rem;
  flex: 1;
  min-width: 80px;
}
.stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ea580c;
  line-height: 1.2;
}
.stat-key {
  font-size: .72rem;
  color: #a8a29e;
  font-weight: 600;
  margin-top: .1rem;
}
.stat-divider {
  width: 1px;
  height: 32px;
  background: #f0efed;
  flex-shrink: 0;
}

/* ─── Result Area ────────────────────────────────── */
.result-area {
  background: #fff;
  border: 1.5px solid #e7e5e4;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}

/* ─── Tabs ───────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1.5px solid #f0efed;
  background: #fafaf9;
}
.tab-btn {
  flex: 1;
  padding: .75rem .5rem;
  font-size: .875rem;
  font-weight: 600;
  color: #78716c;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}
.tab-btn:hover { color: #ea580c; background: #fff7ed; }
.tab-btn.active { color: #ea580c; border-bottom-color: #ea580c; background: #fff; }

.tab-pane { display: none; padding: 1.25rem; }
.tab-pane.active { display: block; }

/* Pane header */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: .75rem;
}
.pane-title { font-size: .95rem; font-weight: 700; color: #44403c; }
.export-row { display: flex; gap: .5rem; }
.btn-export {
  background: none;
  border: 1.5px solid #e7e5e4;
  border-radius: 7px;
  padding: .3rem .85rem;
  font-size: .8rem;
  color: #57534e;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s, border-color .15s;
}
.btn-export:hover { background: #f5f5f4; border-color: #d6d3d1; }

/* ─── Ranking List ───────────────────────────────── */
.ranking-list { display: flex; flex-direction: column; gap: .35rem; }

.rank-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto auto;
  align-items: center;
  gap: .6rem;
  padding: .42rem .6rem;
  border-radius: 8px;
  transition: background .12s;
}
.rank-row:hover { background: #fff7ed; }

.rank-num {
  font-size: .78rem;
  font-weight: 700;
  color: #a8a29e;
  text-align: center;
  width: 2rem;
}
.rank-row:nth-child(1) .rank-num { color: #d97706; font-size: .85rem; }
.rank-row:nth-child(2) .rank-num { color: #71717a; font-size: .85rem; }
.rank-row:nth-child(3) .rank-num { color: #b45309; font-size: .85rem; }

.rank-word { font-size: .92rem; font-weight: 600; color: #1c1917; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar-wrap { flex: 1; height: 6px; background: #f0efed; border-radius: 999px; overflow: hidden; min-width: 40px; }
.rank-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ea580c, #f97316); transition: width .4s cubic-bezier(.4,0,.2,1); }

.rank-count {
  font-size: .82rem;
  font-weight: 700;
  color: #ea580c;
  text-align: right;
  white-space: nowrap;
  min-width: 3.5rem;
}

.empty-state {
  text-align: center;
  color: #a8a29e;
  font-size: .875rem;
  padding: 2rem 1rem;
}

/* ─── Keyword Search Tab ─────────────────────────── */
.kw-search-row {
  display: flex;
  gap: .75rem;
  margin-bottom: 1rem;
}
.kw-input {
  flex: 1;
  border: 1.5px solid #e7e5e4;
  border-radius: 8px;
  padding: .5rem .9rem;
  font-size: .9rem;
  font-family: inherit;
  color: #1c1917;
  outline: none;
  transition: border-color .15s;
}
.kw-input:focus { border-color: #ea580c; }

.kw-results { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }

.kw-result-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  border-radius: 10px;
  border: 1.5px solid #f0efed;
  transition: border-color .15s;
}
.kw-result-row:hover { border-color: #fed7aa; background: #fff7ed; }

.kw-word { font-size: .95rem; font-weight: 700; color: #1c1917; }
.kw-detail { font-size: .82rem; color: #78716c; }
.kw-detail span { font-weight: 700; color: #44403c; }

/* Density badges */
.density-badge {
  font-size: .8rem;
  font-weight: 700;
  padding: .25rem .65rem;
  border-radius: 999px;
  white-space: nowrap;
}
.density-high { background: #fee2e2; color: #b91c1c; }
.density-ok   { background: #dcfce7; color: #15803d; }
.density-low  { background: #fef9c3; color: #a16207; }
.density-none { background: #f4f4f5; color: #71717a; }

/* Legend */
.density-legend {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  font-size: .78rem;
  color: #78716c;
  margin-top: .5rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-weight: 600;
}
.badge-high { background: #fee2e2; color: #b91c1c; }
.badge-ok   { background: #dcfce7; color: #15803d; }
.badge-low  { background: #fef9c3; color: #a16207; }
.badge-none { background: #f4f4f5; color: #71717a; }

/* ─── Info Card ──────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 14px;
  border: 1.5px solid #fed7aa;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(234,88,12,.07);
  margin-bottom: 1rem;
}
.card h2 { font-size: 1.1rem; font-weight: 700; color: #ea580c; margin-bottom: .75rem; }
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item  { display: flex; gap: .75rem; }
.tip-icon  { font-size: 1.5rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .2rem; font-size: .9rem; }
.tip-text p { font-size: .82rem; color: #78716c; line-height: 1.5; }

/* ─── Footer ─────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: .82rem;
  color: #a8a29e;
  border-top: 1px solid #e7e5e4;
  margin-top: auto;
}
footer a { color: #ea580c; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: .3rem; }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 680px) {
  .hero h1 { font-size: 1.4rem; }
  .stats-bar { padding: .65rem .75rem; }
  .stat-item { padding: 0 .6rem; min-width: 60px; }
  .stat-val { font-size: 1.15rem; }
  .tab-btn { font-size: .78rem; padding: .65rem .25rem; }
  .tips-grid { grid-template-columns: 1fr; }
  .scene-grid { grid-template-columns: 1fr; }
  .options-row { gap: .6rem; }
  .btn-analyze { margin-left: 0; width: 100%; justify-content: center; }
  .rank-row { grid-template-columns: 1.5rem 1fr auto; }
  .rank-bar-wrap { display: none; }
  .kw-result-row { grid-template-columns: 1fr auto; }
  .kw-detail { display: none; }
}

/* ━━━ Amazonおすすめ ━━━ */
.amazon-card h2 { margin-bottom: 0.25rem; }
.amazon-note { font-size: 0.82rem; color: #999; margin-bottom: 1rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.amazon-item {
  display: block;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.amazon-item:hover {
  border-color: #FF9900;
  box-shadow: 0 2px 8px rgba(255,153,0,0.15);
  transform: translateY(-1px);
}
.amazon-item-icon { font-size: 1.7rem; margin-bottom: 0.35rem; }
.amazon-item-name { font-size: 0.88rem; font-weight: bold; margin-bottom: 0.2rem; }
.amazon-item-desc { font-size: 0.76rem; color: #888; line-height: 1.5; margin-bottom: 0.45rem; }
.amazon-item-link { font-size: 0.78rem; color: #FF9900; font-weight: bold; }

.amazon-notice {
  font-size: 0.72rem;
  color: #bbb;
  margin-top: 0.2rem;
}

/* ━━━ 活用シーン ━━━ */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.scene-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #9a3412; margin-bottom: .2rem; }
.scene-body p { font-size: .78rem; color: #4b5563; line-height: 1.55; margin: 0; }

/* ━━━ 関連ツール ━━━ */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.related-tool-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid #e7e5e4;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #ea580c; box-shadow: 0 2px 8px rgba(234,88,12,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #ea580c; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #888; line-height: 1.5; margin: 0; }

/* ━━━ FAQ ━━━ */
.faq-list { display: flex; flex-direction: column; }
.faq-item { padding: .9rem 0; border-bottom: 1px solid #f0f0f0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .9rem; font-weight: 700; color: #ea580c; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }
