:root {
  --bg: #f6f7f9;
  --surface: rgba(255,255,255,.88);
  --surface-solid: #fff;
  --text: #17191c;
  --muted: #70757d;
  --line: #e4e7eb;
  --accent: #17191c;
  --mark: #fff0a6;
  --radius: 18px;
  --shadow: 0 16px 45px rgba(22, 27, 34, .07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(0,0,0,.035), transparent 28rem),
    var(--bg);
}

button, input, select { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.hero {
  max-width: 820px;
  margin-bottom: 28px;
}

.eyebrow {
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.04;
  letter-spacing: -.045em;
}

.hero p {
  max-width: 660px;
  margin: 16px 0 28px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.search-box {
  display: grid;
  grid-template-columns: 24px minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 18px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.search-box:focus-within {
  border-color: #aeb4bc;
  box-shadow: 0 18px 50px rgba(22,27,34,.10);
}

.search-box svg {
  width: 22px;
  fill: none;
  stroke: #777d85;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 50px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 17px;
}

.search-box input::placeholder { color: #a0a5ac; }

.search-box button {
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.toolbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  padding: 10px;
  background: var(--surface);
  border: 1px solid rgba(228,231,235,.9);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 30px rgba(22,27,34,.055);
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr auto;
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  padding-left: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--surface-solid);
  color: var(--text);
}

.field input:focus,
.field select:focus { border-color: #aeb4bc; }

.clear-btn {
  height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--muted);
  cursor: pointer;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 14px 2px 8px;
}

#status {
  color: var(--muted);
  font-size: 14px;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.chip {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 12px;
}

.results {
  display: grid;
  gap: 12px;
}

.result-card {
  display: grid;
  grid-template-columns: 132px minmax(0,1fr);
  gap: 20px;
  padding: 16px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.result-card:hover {
  transform: translateY(-2px);
  border-color: #d6d9de;
  box-shadow: 0 14px 34px rgba(22,27,34,.07);
}

.result-thumb,
.thumb-placeholder {
  width: 132px;
  height: 132px;
  border-radius: 13px;
  object-fit: cover;
  background: #eceef1;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  color: #a4a9b0;
  font-size: 12px;
}

.result-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.result-title {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.4;
  letter-spacing: -.015em;
}

.result-title a {
  color: inherit;
  text-decoration: none;
}

.result-snippet {
  display: -webkit-box;
  margin-top: 9px;
  overflow: hidden;
  color: #555b63;
  font-size: 14px;
  line-height: 1.75;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

mark {
  padding: 0 .12em;
  border-radius: 3px;
  background: var(--mark);
  color: inherit;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 12px;
  color: #8a9098;
  font-size: 12px;
}

.empty-state {
  padding: 64px 24px;
  text-align: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.empty-state span {
  color: var(--muted);
  line-height: 1.7;
}

.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 28px;
}

.page-btn {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--text);
  cursor: pointer;
}

.page-btn:hover:not(:disabled) { border-color: #aeb4bc; }

.page-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.page-btn:disabled {
  opacity: .4;
  cursor: default;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: #eceef1;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
  animation: shimmer 1.15s infinite;
}

.thumb-skeleton {
  width: 132px;
  height: 132px;
  border-radius: 13px;
}

.line {
  height: 14px;
  margin: 8px 0;
  border-radius: 6px;
}

.title-skeleton { width: 58%; height: 22px; }
.text-skeleton { width: 92%; }
.text-skeleton.short { width: 68%; }
.meta-skeleton { width: 38%; height: 11px; margin-top: 16px; }

@keyframes shimmer { 100% { transform: translateX(100%); } }

@media (max-width: 780px) {
  .shell { padding-top: 36px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .clear-btn { width: 100%; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1080px); padding-top: 26px; }
  .hero p { font-size: 14px; }
  .search-box { grid-template-columns: 20px minmax(0,1fr); padding-right: 10px; }
  .search-box button { grid-column: 1 / -1; width: 100%; }
  .filters { grid-template-columns: 1fr; }
  .toolbar { position: static; }
  .summary-row { align-items: flex-start; flex-direction: column; }
  .active-filters { justify-content: flex-start; }
  .result-card { grid-template-columns: 96px minmax(0,1fr); gap: 13px; padding: 12px; }
  .result-thumb, .thumb-placeholder, .thumb-skeleton { width: 96px; height: 96px; }
  .result-snippet { -webkit-line-clamp: 2; line-height: 1.6; }
  .result-meta { margin-top: 8px; }
}

#category-filter, #tag-filter { text-overflow: ellipsis; cursor: pointer; }
