:root {
  --bg: #f4f7f2;
  --surface: #ffffff;
  --border: #d8e3d4;
  --text: #1f2e1f;
  --muted: #5c6b5c;
  --accent: #3d6b4f;
  --accent-soft: #e8f2eb;
  --accent-hover: #2f5540;
  --tag-bg: #edf5ef;
  --shadow: 0 8px 24px rgba(31, 46, 31, 0.08);
  --radius: 12px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, #e9f0e6 0%, var(--bg) 180px);
  min-height: 100vh;
}

a {
  color: var(--accent);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

.header {
  padding: 28px 0 20px;
}

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.search-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.search-form {
  display: flex;
  gap: 10px;
}

.search-form input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
}

.search-form input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.search-form button {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.search-form button:hover {
  background: var(--accent-hover);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

#category-filter {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 0.95rem;
}

.effect-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.effect-tag {
  border: 1px solid var(--border);
  background: var(--tag-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

.effect-tag:hover,
.effect-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 20px;
}

@media (min-width: 900px) {
  .content.has-detail {
    grid-template-columns: 1fr 380px;
  }
}

.results-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px 20px;
  min-height: 320px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.results-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.results-count {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-item {
  border-top: 1px solid var(--border);
  padding: 14px 4px;
  cursor: pointer;
}

.result-item:first-child {
  border-top: none;
}

.result-item:hover,
.result-item.active {
  background: var(--accent-soft);
  margin: 0 -8px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 8px;
}

.result-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.result-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.result-snippet {
  margin-top: 8px;
  font-size: 0.92rem;
  line-height: 1.55;
}

.result-snippet .field {
  color: var(--accent);
  font-weight: 600;
}

.empty {
  color: var(--muted);
  padding: 24px 8px;
  text-align: center;
}

.detail-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.detail-panel[hidden] {
  display: none;
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.detail-title {
  margin: 0 32px 4px 0;
  font-size: 1.4rem;
}

.detail-sci {
  color: var(--muted);
  font-style: italic;
  margin: 0 0 12px;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.badge {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
}

.detail-dl {
  margin: 0 0 14px;
}

.detail-dl dt {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 4px;
}

.detail-dl dd {
  margin: 0 0 12px;
  line-height: 1.6;
  font-size: 0.92rem;
}

.detail-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.92rem;
}

.footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.footer p {
  margin: 0 0 8px;
}

.disclaimer {
  color: #7a4a3a;
}

.meta {
  font-size: 0.78rem;
}
