:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --paper: #fbfcff;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-2: #a23b72;
  --accent-3: #c97a20;
  --soft: #e8f5f2;
  --shadow: 0 16px 50px rgba(31, 41, 55, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(162, 59, 114, 0.08), transparent 30%),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 56px) 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  line-height: 1.05;
}

.site-subtitle {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto 48px;
}

.search-band {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.2fr);
  gap: 28px;
  align-items: start;
  min-height: 260px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.68)),
    url("data:image/svg+xml,%3Csvg width='900' height='420' viewBox='0 0 900 420' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%230f766e' stroke-opacity='.16'%3E%3Cpath d='M82 78l110 64 110-64 110 64 110-64 110 64 110-64'/%3E%3Cpath d='M82 206l110 64 110-64 110 64 110-64 110 64 110-64'/%3E%3Cpath d='M192 142v128M302 78v128M412 142v128M522 78v128M632 142v128'/%3E%3C/g%3E%3Cg fill='%23a23b72' fill-opacity='.30'%3E%3Ccircle cx='82' cy='78' r='8'/%3E%3Ccircle cx='192' cy='142' r='8'/%3E%3Ccircle cx='302' cy='78' r='8'/%3E%3Ccircle cx='412' cy='142' r='8'/%3E%3Ccircle cx='522' cy='78' r='8'/%3E%3Ccircle cx='632' cy='142' r='8'/%3E%3Ccircle cx='742' cy='78' r='8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: var(--shadow);
}

.search-copy p,
.toolbar p {
  max-width: 56ch;
  color: var(--muted);
  line-height: 1.55;
}

.search-panel {
  padding: 20px;
  border: 1px solid rgba(216, 222, 232, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.search-panel label,
.filters label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 700;
}

.picker-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.picker-links button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  padding: 0 10px;
}

.picker-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 8px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.95);
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.quick-chips button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  padding: 0 10px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.result-panel,
.tensor-panel,
.table-wrap,
.reference-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.result-panel {
  min-height: 260px;
  padding: 24px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
}

.badge.yes {
  background: var(--soft);
  color: #0f766e;
}

.badge.no {
  background: #fff1f2;
  color: #be123c;
}

.badge.neutral {
  background: #f2f4f7;
  color: #475467;
}

.coupling-label {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tensor-form {
  margin: 8px 0 16px;
  padding: 16px;
  border-left: 4px solid var(--accent-2);
  background: #fff7fb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.6;
  overflow-x: auto;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.detail {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail strong {
  display: block;
  margin-top: 4px;
}

.tensor-panel {
  display: grid;
  place-items: center;
  min-height: 260px;
  overflow: hidden;
  background: #111827;
}

.tensor-panel img {
  width: 100%;
  height: auto;
  min-height: 260px;
  max-height: 420px;
  display: block;
  object-fit: contain;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 32px;
}

.filters {
  display: flex;
  gap: 12px;
}

.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 6px 8px 6px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.active-filter[hidden] {
  display: none;
}

.active-filter button {
  min-height: 28px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--accent);
  padding: 0 10px;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.pagination button {
  min-width: 38px;
  min-height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  padding: 0 10px;
}

.pagination button.active {
  background: var(--accent);
  color: #fff;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.page-jump input {
  width: 72px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
}

.page-gap {
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #344054;
  font-size: 0.82rem;
  text-transform: uppercase;
}

td {
  color: #344054;
  line-height: 1.45;
}

td:first-child {
  color: var(--ink);
  font-weight: 800;
}

.empty-row {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.reference-band {
  margin-top: 24px;
  padding: 24px;
}

.reference-band p {
  max-width: 78ch;
  color: var(--muted);
  line-height: 1.55;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.class-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 800;
}

.legend-item.linear {
  background: #047857;
}

.legend-item.higher {
  background: #9d174d;
}

.legend-item.non {
  background: #475467;
}

.class-card {
  border: 1px solid var(--line);
  border-left: 8px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 14px;
  text-align: left;
}

.class-card.linear {
  border-left-color: #047857;
  background: #ecfdf3;
}

.class-card.higher {
  border-left-color: #9d174d;
  background: #fdf2f8;
}

.class-card.chiral {
  border-left-color: #047857;
  background: #ecfdf3;
}

.class-card.centrosymmetric {
  border-left-color: #475467;
  background: #f2f4f7;
}

.class-card strong {
  display: block;
  margin-bottom: 6px;
}

.class-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
  padding: 22px 0 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.citation-block {
  width: min(820px, 100%);
  margin-bottom: 8px;
  text-align: center;
}

.citation-block h2 {
  margin-bottom: 8px;
  font-size: 1rem;
  text-transform: uppercase;
}

.citation-block p {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.citation-block a {
  color: var(--accent);
  font-weight: 800;
}

.citation-figure {
  margin: 18px auto 0;
  width: min(720px, 100%);
}

.citation-figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.citation-figure figcaption {
  margin-top: 8px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
}

.site-footer > a img {
  width: 210px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 820px) {
  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-band,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .search-band {
    padding: 22px;
  }

  .search-row,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
  }

  .site-footer {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }
}
