:root {
  --ink: #171716;
  --muted: #6d6a63;
  --paper: #f4f0e8;
  --panel: #fffdf8;
  --line: #dcd6ca;
  --accent: #ff5c35;
  --lime: #d8ff65;
  --blue: #2747ff;
  --shadow: 0 22px 70px rgba(37, 31, 21, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 3%, rgba(39, 71, 255, 0.12), transparent 26rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  min-height: 76px;
  padding: 14px clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 23, 22, 0.15);
}

.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; background: var(--ink); color: white; border-radius: 50%; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.topbar nav { display: flex; gap: 24px; }
.topbar nav a { color: var(--ink); text-decoration: none; font-size: 13px; border-bottom: 1px solid transparent; }
.topbar nav a:hover { border-color: var(--ink); }

.hero {
  max-width: 1500px;
  margin: 0 auto;
  min-height: 420px;
  padding: 72px clamp(20px, 5vw, 80px) 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr);
  align-items: end;
  gap: 48px;
}

.eyebrow, .result-label { margin: 0 0 14px; font-size: 11px; line-height: 1; font-weight: 800; letter-spacing: .16em; color: var(--blue); }
.hero h1 { margin: 0; font-size: clamp(54px, 8vw, 112px); line-height: .87; letter-spacing: -.07em; font-weight: 780; }
.hero h1 em { color: var(--accent); font-family: Georgia, "Songti SC", serif; font-weight: 400; }
.hero-copy { max-width: 610px; margin: 30px 0 0; color: var(--muted); font-size: 16px; line-height: 1.8; }

.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ink); background: var(--lime); box-shadow: 10px 10px 0 var(--ink); }
.hero-stats div { padding: 24px 18px; border-right: 1px solid var(--ink); }
.hero-stats div:last-child { border-right: 0; }
.hero-stats strong, .hero-stats span { display: block; }
.hero-stats strong { font-size: clamp(25px, 3vw, 42px); letter-spacing: -.05em; }
.hero-stats span { margin-top: 8px; font-size: 11px; color: #34332e; }

.workspace { max-width: 1640px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 48px) 80px; display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 34px; }
.filters { align-self: start; position: sticky; top: 18px; padding: 22px; border: 1px solid var(--line); background: rgba(255, 253, 248, .88); backdrop-filter: blur(16px); }
.filter-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.filter-heading span { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.filter-heading h2, .result-toolbar h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.03em; }
.text-button { padding: 0; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 12px; }
.text-button:hover { color: var(--accent); }

.search-field, .select-filters label { display: block; margin-bottom: 14px; }
.search-field > span, .select-filters label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
input, select { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 0; background: white; color: var(--ink); padding: 0 11px; outline: 0; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(39, 71, 255, .12); }

.type-chart-wrap { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.type-chart-wrap h3 { margin: 0 0 15px; font-size: 12px; }
.type-chart { display: grid; gap: 9px; }
.chart-row { display: grid; grid-template-columns: 76px 1fr 30px; align-items: center; gap: 7px; padding: 0; border: 0; background: none; text-align: left; color: var(--muted); cursor: pointer; font-size: 10px; }
.chart-row:hover, .chart-row.active { color: var(--blue); }
.chart-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-track { height: 5px; background: #e4dfd5; }
.chart-fill { display: block; height: 100%; background: var(--accent); }
.chart-row.active .chart-fill { background: var(--blue); }
.chart-count { text-align: right; }

.results-panel { min-width: 0; }
.result-toolbar { min-height: 70px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--ink); }
.toolbar-actions { display: flex; gap: 8px; }
.toolbar-actions select { width: auto; min-width: 128px; }
.outline-button, .primary-button { min-height: 42px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--ink); background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; }
.outline-button:hover { background: var(--lime); }
.primary-button { background: var(--ink); color: white; }
.primary-button:hover { background: var(--blue); border-color: var(--blue); }

.keyword-section { padding: 18px 0 20px; display: flex; align-items: flex-start; gap: 16px; }
.keyword-section > span { flex: 0 0 auto; padding-top: 7px; color: var(--muted); font-size: 11px; }
.keyword-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.keyword-cloud button, .card-tags span, .detail-tags span { border: 1px solid var(--line); background: rgba(255,255,255,.55); padding: 5px 8px; color: #555149; font-size: 10px; }
.keyword-cloud button { cursor: pointer; }
.keyword-cloud button:hover { border-color: var(--accent); color: var(--accent); }

.gallery-grid { columns: 4 220px; column-gap: 16px; }
.card { break-inside: avoid; margin: 0 0 16px; border: 1px solid var(--line); background: var(--panel); transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-open { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: zoom-in; }
.card figure { position: relative; min-height: 110px; margin: 0; overflow: hidden; background: #e6e1d7; }
.card figure img { display: block; width: 100%; height: auto; transition: transform .35s ease; }
.card:hover figure img { transform: scale(1.018); }
.asset-count { position: absolute; right: 9px; bottom: 9px; padding: 4px 7px; background: rgba(23,23,22,.82); color: white; font-size: 10px; backdrop-filter: blur(5px); }
.card-copy { padding: 14px; }
.card-kicker { margin: 0 0 5px; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.card h3 { margin: 0; font-size: 15px; line-height: 1.3; text-transform: capitalize; }
.card-description { margin: 8px 0 11px; display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.55; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-tags, .detail-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.card-tags span { padding: 3px 6px; font-size: 9px; }
.load-sentinel { height: 2px; }
.empty-state { margin-top: 30px; padding: 70px 20px; border: 1px dashed var(--line); text-align: center; color: var(--muted); }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 8px; color: var(--ink); }

footer { min-height: 92px; padding: 30px clamp(20px, 4vw, 64px); display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

dialog { width: min(1180px, calc(100vw - 30px)); max-height: calc(100vh - 30px); padding: 0; border: 1px solid var(--ink); background: var(--panel); box-shadow: 16px 16px 0 rgba(23,23,22,.9); }
dialog::backdrop { background: rgba(21, 19, 16, .72); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; top: 10px; right: 12px; z-index: 3; width: 38px; height: 38px; border: 1px solid var(--ink); border-radius: 50%; background: var(--panel); cursor: pointer; font-size: 25px; line-height: 1; }
.dialog-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .72fr); min-height: 620px; }
.preview-pane { padding: 22px; display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; background: #dfdbd2; }
#detail-image { display: block; max-width: 100%; max-height: 70vh; object-fit: contain; box-shadow: 0 6px 22px rgba(22,20,16,.18); }
.asset-strip { width: 100%; margin-top: 14px; display: flex; gap: 7px; overflow-x: auto; padding-bottom: 5px; }
.asset-strip button { flex: 0 0 74px; height: 54px; padding: 0; border: 2px solid transparent; background: #ccc; cursor: pointer; overflow: hidden; }
.asset-strip button.active { border-color: var(--blue); }
.asset-strip img { width: 100%; height: 100%; object-fit: cover; }
.detail-copy { padding: 54px 34px 34px; overflow-y: auto; }
.detail-copy h2 { margin: 0; font-size: clamp(28px, 4vw, 52px); line-height: 1; letter-spacing: -.05em; text-transform: capitalize; }
.detail-description { margin: 20px 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.detail-copy dl { margin: 0 0 20px; border-top: 1px solid var(--line); }
.detail-copy dl div { padding: 9px 0; display: grid; grid-template-columns: 90px 1fr; border-bottom: 1px solid var(--line); font-size: 11px; }
.detail-copy dt { color: var(--muted); }
.detail-copy dd { margin: 0; }
.detail-tags { margin-top: 18px; }
.detail-actions { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-stats { max-width: 620px; }
  .workspace { grid-template-columns: 230px minmax(0, 1fr); }
  .gallery-grid { columns: 3 200px; }
}

@media (max-width: 760px) {
  .topbar nav a:first-child { display: none; }
  .hero { padding-top: 50px; }
  .hero h1 { font-size: clamp(52px, 18vw, 86px); }
  .hero-stats div { padding: 18px 12px; }
  .workspace { display: block; }
  .filters { position: static; margin-bottom: 28px; }
  .select-filters { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 10px; }
  .type-chart-wrap { display: none; }
  .result-toolbar { align-items: flex-end; }
  .toolbar-actions { flex-direction: column; }
  .gallery-grid { columns: 2 150px; }
  .dialog-layout { display: block; }
  .preview-pane { min-height: 44vh; }
  .detail-copy { padding: 35px 20px 25px; }
  footer { display: block; }
  footer span { display: block; margin: 5px 0; }
}

@media (max-width: 430px) {
  .topbar { padding-inline: 14px; }
  .hero { padding-inline: 16px; }
  .hero-stats { grid-template-columns: 1fr; box-shadow: 6px 6px 0 var(--ink); }
  .hero-stats div { border-right: 0; border-bottom: 1px solid var(--ink); }
  .hero-stats div:last-child { border-bottom: 0; }
  .gallery-grid { columns: 1; }
  .keyword-section { display: block; }
  .keyword-section > span { display: block; margin-bottom: 9px; }
}

