:root {
  color-scheme: light;
  --page-bg: #f7f6f3;
  --surface: #ffffff;
  --surface-muted: #f0efea;
  --border: #dcd9d3;
  --accent: #2563eb;
  --accent-muted: rgba(37, 99, 235, 0.1);
  --text-primary: #2f3437;
  --text-secondary: #5b6166;
  --text-muted: #8a8f94;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-xs: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 12px 24px rgba(15, 23, 42, 0.12);
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  padding: 2.5rem 1.25rem 3rem;
  display: flex;
  justify-content: center;
}

.content {
  width: min(1200px, 100%);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.page__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  padding: 1.75rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.page__title {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.page__icon {
  font-size: 2.5rem;
  background: var(--surface-muted);
  border-radius: 16px;
  padding: 0.6rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.page__title h1 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  margin: 0 0 0.3rem;
  font-weight: 700;
}

.page__title p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.96rem;
  line-height: 1.4;
}

.page__main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.search-panel,
.detail-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-xs);
}

.search-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.search-panel__top {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-panel__label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.search-panel__input input {
  width: 100%;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fdfdfc;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-panel__input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.search-panel__meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 0.75rem;
}

.search-panel__results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-result:hover,
.search-result:focus-visible,
.search-result.active {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.search-result__title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.search-result__title strong {
  font-size: 1rem;
  font-weight: 600;
}

.search-result__alias {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.search-result__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.78rem;
}

.tag-pill {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.tag-pill.is-emphasis {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 600;
}

.detail-panel {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.detail-header__main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.detail-header__cas {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.detail-header__english {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.detail-header h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
}

.detail-header__aliases {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.detail-aliases {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-start;
  margin-top: 0.35rem;
}

.detail-aliases__label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  padding-top: 0.25rem;
}

.detail-aliases__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.alias-chip {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(47, 52, 55, 0.08);
  font-size: 0.78rem;
}

.detail-highlight {
  margin: 0.75rem 0 1.1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid rgba(220, 217, 211, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-mini-list {
  display: grid;
  gap: 0.85rem;
}

.detail-mini-list--ghs {
  gap: 1rem;
}

.mini-card {
  border: 1px solid rgba(220, 217, 211, 0.8);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  background: var(--surface);
  display: grid;
  gap: 0.6rem;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.mini-card__head {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
  align-items: flex-start;
}

.mini-card__head h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mini-card__head p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.mini-card__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  white-space: nowrap;
}

.mini-card__chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-secondary);
  white-space: nowrap;
}

.mini-card__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.45rem 0.8rem;
  font-size: 0.82rem;
}

.mini-card__meta div {
  display: grid;
  gap: 0.2rem;
}

.mini-card__meta dt {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mini-card__meta dd {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.mini-card__meta-line {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.mini-card__note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.mini-card__note.is-muted {
  color: var(--text-muted);
}

.detail-highlight__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.detail-highlight__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.highlight-metric {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(47, 52, 55, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  display: grid;
  gap: 0.25rem;
  min-width: 160px;
}

.highlight-metric span {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.highlight-metric strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.hazard-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.hazard-list li {
  display: grid;
  gap: 0.25rem;
}

.hazard-list__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.hazard-list__value {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.45;
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid rgba(47, 52, 55, 0.08);
}

.detail-badge--critical {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.25);
}

.detail-badge--accent {
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
  border-color: rgba(37, 99, 235, 0.3);
}

.detail-badge--info {
  background: rgba(16, 185, 129, 0.12);
  color: #0f766e;
  border-color: rgba(16, 185, 129, 0.25);
}

.detail-badge--neutral {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-secondary);
  border-color: rgba(15, 23, 42, 0.12);
}

.detail-badge--metric {
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
  border-color: rgba(99, 102, 241, 0.3);
}

.detail-badge--muted {
  background: var(--surface);
  color: var(--text-muted);
  border-style: dashed;
  border-color: rgba(47, 52, 55, 0.2);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-chip--positive {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

.status-chip--negative {
  background: rgba(248, 113, 113, 0.18);
  color: #be123c;
}

.external-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.external-link::after {
  content: '↗';
  font-size: 0.75rem;
}

.external-link:hover,
.external-link:focus-visible {
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent);
}

.external-link:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.citation-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.3rem;
  background: var(--surface);
  display: grid;
  gap: 0.75rem;
}

.citation-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.citation-card__header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.citation-card__body {
  margin: 0;
  padding: 0.9rem 1rem;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(47, 52, 55, 0.25);
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-primary);
  max-height: 260px;
  overflow-y: auto;
  font-family: inherit;
}

.citation-card__footnote {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.citation-card__status {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.copy-button {
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.copy-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.copy-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.copy-button.is-success {
  background: #16a34a;
}

.copy-button.is-error {
  background: #dc2626;
}

.section-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.3rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.section-card__title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.section-card__body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem 1.1rem;
  font-size: 0.88rem;
}

.definition-list {
  display: grid;
  gap: 0.4rem;
}

.definition-list dt {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.definition-list dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: pre-line;
  line-height: 1.5;
}

.definition-list.is-muted dd {
  color: var(--text-secondary);
}

.detail-placeholder {
  text-align: left;
  color: var(--text-secondary);
  display: grid;
  gap: 0.75rem;
}

.detail-placeholder h2 {
  margin: 0;
  font-size: 1.35rem;
}

.detail-placeholder ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}

.detail-footer {
  margin-top: auto;
  justify-self: flex-end;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (min-width: 960px) {
  .page__main {
    flex-direction: row;
  }

  .search-panel {
    flex: 0 0 360px;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding-right: 1.5rem;
  }

  .detail-panel {
    flex: 1 1 auto;
  }
}

@media (max-width: 768px) {
  .page__header,
  .search-panel,
  .detail-panel {
    padding: 1.35rem 1.2rem;
  }

  .search-panel__top {
    gap: 0.8rem;
  }

  .detail-highlight {
    margin: 0.6rem 0 0.85rem;
    padding: 0.85rem 0.9rem;
  }

  .highlight-metric {
    min-width: 140px;
  }

  .citation-card__header {
    flex-direction: column;
    align-items: stretch;
  }

  .copy-button {
    width: 100%;
  }

  .mini-card {
    padding: 0.8rem 0.85rem;
  }
}
