:root {
  color-scheme: light;
  --ink: #15211f;
  --muted: #64716e;
  --line: #dce4e1;
  --soft: #f3f7f6;
  --paper: #ffffff;
  --green: #143f3a;
  --green-2: #21675d;
  --mint: #b9e5da;
  --amber: #9b6517;
  --shadow: 0 24px 70px rgba(22, 50, 45, .16);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #f7f9f8;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  height: 68px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--green);
  color: white;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 10px 10px 17px 10px;
  color: var(--mint);
  font-family: serif;
  font-size: 18px;
}

.trial-label {
  padding: 5px 11px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 99px;
  color: #e2f2ee;
  font-size: 13px;
}

.topbar-actions { display: flex; align-items: center; gap: 16px; }
[hidden] { display: none !important; }
.account-logout { border: 0; padding: 0; background: none; color: inherit; font: inherit; }
.account-logout:disabled { cursor: wait; opacity: .7; }
.account-notice { margin: 16px auto; padding: 12px 18px; max-width: 1160px; color: var(--green); background: #edf6f1; border-radius: 8px; }
.account-notice.error { color: #8d3636; background: #fff0f0; }
.style-switch { display: flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid rgba(255,255,255,.22); border-radius: 99px; }
.style-switch a { padding: 4px 10px; border-radius: 99px; color: rgba(255,255,255,.72); text-decoration: none; font-size: 13px; }
.style-switch a[aria-current="page"] { color: var(--green); background: white; }
.section-mark { display: none; }

main { min-height: calc(100vh - 68px); }

.search-shell {
  padding: 26px clamp(20px, 7vw, 108px) 24px;
  background:
    linear-gradient(115deg, rgba(185,229,218,.22), transparent 35%),
    var(--paper);
  border-bottom: 1px solid var(--line);
}

.title-row {
  max-width: 1160px;
  margin: 0 auto 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.eyebrow {
  margin: 0;
  color: var(--green-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(29px, 4vw, 44px); line-height: 1.15; letter-spacing: -.035em; }
h2 { line-height: 1.3; }

.database-meta { color: var(--muted); font-size: 14px; text-align: right; }

.search-form {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.search-input-wrap {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border: 1px solid #b9c8c4;
  border-radius: 14px;
  background: white;
  box-shadow: 0 8px 24px rgba(23, 68, 61, .06);
}

.search-input-wrap:focus-within { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(33,103,93,.12); }
.search-input-wrap svg { width: 23px; fill: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; }
.search-input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); font-size: 17px; background: transparent; }
.search-input-wrap input::placeholder { color: #89938f; }
kbd { padding: 2px 8px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; color: var(--muted); background: var(--soft); font-size: 13px; }

.primary-button, .secondary-button {
  border-radius: 12px;
  padding: 0 25px;
  min-height: 48px;
  border: 1px solid var(--green);
  font-weight: 700;
}
.primary-button { background: var(--green); color: white; min-width: 104px; }
.primary-button:hover { background: #0e312d; }
.secondary-button { background: white; color: var(--green); }

.quick-searches {
  max-width: 1160px;
  margin: 14px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}
.quick-searches button, .text-button {
  border: 0;
  padding: 3px 7px;
  background: transparent;
  color: var(--green-2);
}
.quick-searches button:hover, .text-button:hover { text-decoration: underline; }

.workspace {
  max-width: 1300px;
  margin: 0 auto;
  padding: 30px clamp(20px, 4vw, 54px) 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 34px;
}

.workspace.filters-open { grid-template-columns: 245px minmax(0, 1fr); }

.filters { position: sticky; top: 24px; align-self: start; }
.filter-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.filter-heading h2 { margin: 0; font-size: 18px; }
.filters > label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 14px; font-weight: 650; }
.filters select { width: 100%; min-height: 46px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; }

.advanced-search { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.advanced-search summary { font-weight: 650; cursor: pointer; }
.check-row { margin-top: 14px; display: flex; align-items: start; gap: 10px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--green); }
.check-row strong { display: block; font-size: 14px; }
.check-row small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.45; }

.quality-note { margin-top: 24px; padding: 16px; border-radius: 12px; background: #eaf3f0; color: #36524d; font-size: 13px; }
.quality-note strong { font-size: 14px; }
.quality-note p { margin: 6px 0 0; }

.results-heading { min-height: 52px; display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.results-heading h2 { margin: 0 0 3px; font-size: 22px; }
.results-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.filter-toggle { min-height: 38px; padding: 0 16px; border-color: var(--line); font-size: 14px; }

.results-list { display: grid; gap: 11px; }
.result-card {
  width: 100%;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: inherit;
  text-align: left;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.result-card:hover { transform: translateY(-1px); border-color: #9fb4ae; box-shadow: 0 10px 25px rgba(25,58,52,.06); }
.card-top { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.result-card h3 { margin: 0; font-size: 18px; line-height: 1.4; overflow-wrap: anywhere; }
.maker { flex: 0 0 auto; margin-top: 2px; color: var(--muted); font-size: 13px; text-align: right; }
.inci { margin: 11px 0 0; color: #34433f; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.claims { margin: 8px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin-top: 14px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tag { padding: 3px 8px; border-radius: 5px; background: var(--soft); color: #4e5f5b; font-size: 12px; }
.tag.review { background: #fff3dc; color: var(--amber); }

.state-card { padding: 36px 20px; border: 1px dashed #b8c6c2; border-radius: 13px; text-align: center; color: var(--muted); background: rgba(255,255,255,.55); }
.state-card strong { display: block; color: var(--ink); font-size: 17px; }
.state-card p { margin: 5px 0 0; }
.state-card.error { border-color: #deb8b8; }

.pagination { margin-top: 22px; display: flex; justify-content: center; gap: 8px; }
.pagination button { min-width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
.pagination button[aria-current="page"] { background: var(--green); border-color: var(--green); color: white; }
.pagination button:disabled { opacity: .45; cursor: default; }

.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(12,27,24,.42); backdrop-filter: blur(2px); }
.drawer { position: fixed; z-index: 11; top: 0; right: 0; width: min(720px, 94vw); height: 100vh; overflow: auto; background: white; box-shadow: var(--shadow); transform: translateX(105%); transition: transform .22s ease; }
.drawer.open { transform: translateX(0); }
.drawer-header { position: sticky; top: 0; z-index: 2; padding: 25px 30px 19px; display: flex; justify-content: space-between; align-items: start; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.drawer-header h2 { margin: 0; font-size: 25px; overflow-wrap: anywhere; }
.icon-button { width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--ink); font-size: 27px; line-height: 1; }
.drawer-content { padding: 26px 30px 70px; }
.detail-section { margin-bottom: 28px; }
.detail-section h3 { margin: 0 0 10px; color: var(--green); font-size: 15px; letter-spacing: .03em; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.detail-item { padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.detail-item.wide { grid-column: 1 / -1; }
.detail-item dt { color: var(--muted); font-size: 13px; }
.detail-item dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.source-block { margin-top: 14px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.source-block p { margin: 4px 0 0; }
.source-block small { color: var(--muted); }

@media (max-width: 760px) {
  .topbar { height: 60px; padding-inline: 17px; }
  .trial-label { display: none; }
  .topbar-actions { gap: 0; }
  .topbar-actions { gap: 12px; font-size: 13px; }
  .style-switch { display: none; }
  .style-switch a { padding-inline: 8px; }
  .search-shell { padding: 22px 17px 20px; }
  .title-row { align-items: start; }
  .database-meta { display: none; }
  .search-form { grid-template-columns: 1fr; }
  .primary-button { min-height: 50px; }
  kbd { display: none; }
  .workspace, .workspace.filters-open { display: block; padding: 22px 17px 55px; }
  .filters { position: static; margin-bottom: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: white; }
  .card-top { display: block; }
  .maker { margin-top: 5px; text-align: left; }
  .result-card { padding: 18px; }
  .drawer-header, .drawer-content { padding-left: 20px; padding-right: 20px; }
  .detail-grid { grid-template-columns: 1fr; gap: 0; }
  .detail-item.wide { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.site-footer {
  padding: 24px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer a:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
