/* ── リセット ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: #f8fafc;
  color: #0f172a;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* ── ヘッダー ───────────────────────────────────────── */
.site-header {
  background: #0f172a;
  color: white;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.site-title { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; }
.site-sub   { font-size: 0.68rem; opacity: 0.55; margin-top: 1px; }

/* ── タブバー ───────────────────────────────────────── */
.tab-bar {
  display: flex;
  background: white;
  border-bottom: 2px solid #e2e8f0;
  padding: 0 12px;
  position: sticky;
  top: 52px;
  z-index: 99;
}
.tab-btn {
  padding: 11px 16px;
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: #0f172a; }
.tab-btn.active { color: #0f172a; border-bottom-color: #0f172a; }
.fav-badge {
  display: none;
  background: #f59e0b;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 1.6;
}

/* ── コンテンツ ─────────────────────────────────────── */
.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px 60px;
}

/* ── 最近使ったツール ──────────────────────────────── */
#recent-section { margin-bottom: 18px; }
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
}
#recent-list {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
#recent-list::-webkit-scrollbar { display: none; }
.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 5px;
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, box-shadow 0.12s;
  text-decoration: none;
}
.recent-chip:hover { border-color: #0f172a; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
.recent-chip-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── 検索 ───────────────────────────────────────────── */
.search-wrap {
  position: relative;
  margin-bottom: 16px;
}
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.95rem;
  pointer-events: none;
}
#search-input {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #0f172a;
  background: white;
  transition: border-color 0.15s;
}
#search-input:focus { outline: none; border-color: #0f172a; }
#search-input::placeholder { color: #94a3b8; }

/* ── ツールグリッド ─────────────────────────────────── */
#tool-grid, #fav-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 520px) {
  #tool-grid, #fav-list { grid-template-columns: 1fr 1fr; }
}

/* ── ツールカード ───────────────────────────────────── */
.tool-card {
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 14px 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
  text-decoration: none;
  display: block;
  color: inherit;
}
.tool-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.09);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}
.tool-cat {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.03em;
}
.fav-star {
  background: none;
  border: none;
  font-size: 1.05rem;
  cursor: pointer;
  color: #cbd5e1;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.fav-star:hover { transform: scale(1.25); color: #f59e0b; }
.fav-star.on { color: #f59e0b; }
.tool-name {
  font-size: 0.91rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
  line-height: 1.3;
}
.tool-desc {
  font-size: 0.74rem;
  color: #64748b;
}

/* ── 空メッセージ ───────────────────────────────────── */
.empty-msg {
  text-align: center;
  padding: 48px 20px;
  color: #94a3b8;
  font-size: 0.88rem;
  line-height: 1.9;
  grid-column: 1 / -1;
}

/* ── ツール専用ページ ───────────────────────────────── */
.tool-page-bar {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 11px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s;
}
.back-link:hover { border-color: #374151; }
.page-tool-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 13px;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  background: white;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.page-fav-btn:hover { border-color: #f59e0b; color: #d97706; }
.page-fav-btn.on { border-color: #f59e0b; background: #fef3c7; color: #92400e; }
