:root {
  --ink: #151515;
  --muted: #6f706f;
  --line: #deded9;
  --surface: #ffffff;
  --canvas: #f5f5f1;
  --orange: #ef6c35;
  --orange-soft: #fff0e9;
  --teal: #197c78;
  --blue: #2f6fec;
  --shadow: 0 8px 24px rgba(21, 21, 21, 0.06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { height: 100%; overflow: hidden; scroll-behavior: smooth; }

body {
  height: 100%;
  margin: 0;
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) auto;
  overflow: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
}

button, input { font: inherit; letter-spacing: 0; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.topbar-actions,.topbar-primary { display:flex; align-items:center; gap:6px; }
.topbar-link { min-height:38px; padding:0 11px; display:inline-flex; align-items:center; gap:7px; border-radius:6px; color:#555753; font-size:13px; font-weight:650; }
.topbar-link:hover { background:#f3f3ef; color:var(--ink); }
.topbar-link svg { width:17px; }

.topbar {
  position: relative;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; font-size: 18px; font-weight: 750; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; background: var(--ink); color: #fff; font-size: 13px; border-radius: 6px; }
.topbar-note { justify-self: center; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #2aa36b; box-shadow: 0 0 0 4px #e4f4eb; }
.github-link { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; font-weight: 650; }
.github-link:hover { border-color: #a7a7a1; background: #fafaf8; }
.github-link svg { width: 17px; }

.app-shell { min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr); overflow: hidden; }
.sidebar { position: relative; min-height: 0; height: 100%; padding: 28px 22px; overflow-y: auto; border-right: 1px solid var(--line); background: #eeeeea; overscroll-behavior: contain; }
.side-heading { margin: 0 8px 12px; color: #81827e; font-size: 11px; font-weight: 750; text-transform: uppercase; }
.mode-nav { display: grid; gap: 7px; }
.mode-button { width: 100%; min-height: 62px; padding: 8px 10px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; }
.mode-button:hover { background: rgba(255, 255, 255, 0.65); }
.mode-button.active { border-color: #d1d1cc; background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.04); }
.mode-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; background: #deded9; }
.mode-button.active .mode-icon { background: var(--orange-soft); color: var(--orange); }
.mode-icon svg { width: 18px; }
.mode-button strong, .mode-button small { display: block; }
.mode-button strong { font-size: 14px; line-height: 1.35; }
.mode-button small { margin-top: 2px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.mode-count { display: grid; place-items: center; min-width: 25px; height: 22px; padding: 0 6px; border-radius: 11px; color: #777873; background: #e2e2dd; font-size: 10px; font-variant-numeric: tabular-nums; }
.mode-button.active .mode-count { color: #94401f; background: var(--orange-soft); }
.sidebar-tip { position: absolute; left: 22px; right: 22px; bottom: 22px; padding: 14px; border-top: 1px solid #d3d3ce; color: var(--muted); font-size: 11px; line-height: 1.6; }
.sidebar-tip svg { width: 15px; margin-bottom: 2px; }
.sidebar-tip p { margin: 0; }

.content { width: 100%; max-width: 1500px; min-height: 0; padding: 42px clamp(24px, 4vw, 64px) 72px; overflow-y: auto; overscroll-behavior: contain; }
.site-announcement { min-height:38px; margin:-18px 0 22px; padding:8px 12px; display:flex; align-items:center; gap:9px; border:1px solid #b9dfe0; border-radius:6px; color:#174f62; background:linear-gradient(110deg,#eaf7fb,#e9f8f4); font-size:12px; }
.site-announcement svg { width:16px; flex:0 0 auto; color:#078d98; }
.site-announcement a,.site-announcement span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.site-announcement a { font-weight:700; }
.site-announcement a:hover { color:#006f7b; }
.intro-row { display: flex; justify-content: space-between; align-items: end; gap: 36px; }
.eyebrow { margin: 0 0 10px; color: var(--orange); font-size: 11px; font-weight: 800; }
h1 { margin: 0; font-size: clamp(29px, 3vw, 44px); line-height: 1.12; font-weight: 760; }
.subtitle { max-width: 640px; margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.search-wrap { flex: 0 1 430px; height: 48px; position: relative; display: flex; align-items: center; }
.search-wrap > svg { position: absolute; left: 15px; width: 19px; color: #81827e; }
.search-wrap input { width: 100%; height: 100%; padding: 0 48px 0 45px; border: 1px solid #cacac5; border-radius: 7px; outline: none; background: #fff; color: var(--ink); }
.search-wrap input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(21,21,21,.08); }
.search-wrap kbd { position: absolute; right: 13px; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid #d6d6d1; border-radius: 4px; color: #8a8b87; background: #f4f4f1; font-size: 12px; }

.category-bar {
  position: sticky;
  z-index: 12;
  top: -42px;
  margin-top: 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 245, 241, .96);
  box-shadow: 0 8px 18px rgba(21, 21, 21, .05);
  backdrop-filter: blur(12px);
}
.category-scroll { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.category-scroll::-webkit-scrollbar { display: none; }
.category-button { position: relative; flex: 0 0 auto; padding: 13px 15px 15px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 620; cursor: pointer; }
.category-button:hover { color: var(--ink); }
.category-button.active { color: var(--ink); }
.category-button.active::after { content: ""; position: absolute; left: 15px; right: 15px; bottom: -1px; height: 3px; border-radius: 2px 2px 0 0; background: var(--orange); }

.results-bar { height: 61px; display: flex; align-items: center; justify-content: space-between; }
.results-bar p { margin: 0; color: var(--muted); font-size: 12px; }
.results-bar strong { color: var(--ink); font-size: 13px; }
.clear-button { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.clear-button:hover { color: var(--ink); }
.clear-button svg { width: 14px; }

.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.model-card { min-width: 0; min-height: 214px; padding: 18px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor:pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.model-card:hover { transform: translateY(-2px); border-color: #bebeb8; box-shadow: var(--shadow); }
.card-head { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; align-items: center; }
.logo-wrap { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border: 1px solid #ecece8; border-radius: 7px; background: #fafaf8; }
.logo-wrap img { width: 27px; height: 27px; object-fit: contain; }
.logo-fallback { font-size: 13px; font-weight: 800; color: var(--teal); }
.card-title { min-width: 0; }
.card-title h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 1.35; }
.card-title p { margin: 3px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.model-detail-link{min-width:58px;height:30px;padding:0 8px;display:inline-flex;align-items:center;justify-content:center;gap:4px;border:1px solid #9bc9cf;border-radius:5px;color:#075c86;background:#eefafa;font-size:11px;font-weight:750;transition:color .18s ease,background-color .18s ease,transform .18s ease}
.model-detail-link svg{width:14px;height:14px}
.model-detail-link:hover{color:#fff;background:var(--brand-action);transform:translateX(2px)}
.model-detail-link.disabled{cursor:not-allowed;color:#8a8d89;border-color:#d7d8d3;background:#f4f4f1;box-shadow:none}
.card-actions { min-height:35px; margin-top:14px; padding-top:11px; display:flex; align-items:center; gap:7px; border-top:1px solid #ecece7; }
.card-action,.card-discuss,.rating-control { height:32px; display:inline-flex; align-items:center; justify-content:center; gap:5px; border:1px solid var(--line); border-radius:5px; background:#fff; color:#666864; font-size:12px; }
.card-action { width:34px; padding:0; cursor:pointer; }
.card-action.active { border-color:#edb7a1; background:var(--orange-soft); color:#d75520; }
.card-action svg,.card-discuss svg,.rating-control svg { width:15px; height:15px; }
.card-action.active svg { fill:currentColor; }
.card-discuss { margin-left:auto; padding:0 9px; }
.rating-control { padding:0 7px; }
.rating-control select { width:58px; border:0; outline:0; background:transparent; color:inherit; font:inherit; }
.description { margin: 15px 0 17px; display: -webkit-box; min-height: 39px; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: #5f605d; font-size: 12px; line-height: 1.65; }
.banner-slot { position:relative; min-height:150px; margin:30px 0 22px; overflow:hidden; border:1px solid var(--line); border-radius:8px; background:#eceee9; }
.banner-track,.banner-slide { width:100%; height:100%; min-height:150px; }
.banner-slide { position:absolute; inset:0; display:block; opacity:0; transition:opacity .35s ease; }
.banner-slide.active { opacity:1; z-index:1; }
.banner-slide img { width:100%; height:100%; min-height:150px; display:block; object-fit:cover; }
.banner-caption { position:absolute; left:20px; right:20px; bottom:18px; display:flex; flex-direction:column; gap:4px; color:#fff; text-shadow:0 1px 3px #0008; }
.banner-caption strong { font-size:18px; }
.banner-caption small { font-size:11px; }
.banner-arrow { position:absolute; z-index:2; top:50%; width:32px; height:32px; display:grid; place-items:center; border:1px solid #fff6; border-radius:50%; color:#fff; background:#0005; transform:translateY(-50%); }
.banner-arrow:hover { background:#0008; }
.banner-prev { left:12px; }
.banner-next { right:12px; }
.banner-dots { position:absolute; z-index:2; left:50%; bottom:10px; display:flex; gap:5px; transform:translateX(-50%); }
.banner-dot { width:18px; height:4px; padding:0; border:0; border-radius:4px; background:#fff8; }
.banner-dot.active { background:#fff; }
.card-meta { margin-top: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag { padding: 4px 7px; border-radius: 4px; color: #565754; background: #f0f0ec; font-size: 10px; }
.tag.mode-local { color: #246357; background: #e7f3ef; }
.tag.mode-api { color: #315fa6; background: #e9f0fc; }
.tag.mode-web { color: #934b29; background: var(--orange-soft); }

.empty-state { padding: 70px 20px; border: 1px dashed #cfcfca; text-align: center; background: #fafaf7; }
.empty-state svg { width: 30px; color: #8b8c88; }
.empty-state h2 { margin: 13px 0 5px; font-size: 17px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.empty-state button { padding: 9px 13px; border: 0; border-radius: 5px; background: var(--ink); color: #fff; cursor: pointer; }

footer { min-height: 72px; padding: 20px 32px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 11px; }
footer span:first-child { color: var(--ink); font-weight: 700; }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 190px auto 1fr auto; gap:12px; }
  .topbar-primary .topbar-link { width:38px; padding:0; justify-content:center; }
  .topbar-primary .topbar-link span { display:none; }
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intro-row { align-items: stretch; flex-direction: column; gap: 22px; }
  .search-wrap { flex-basis: 48px; max-width: 620px; }
}

@media (max-width: 760px) {
  body { grid-template-rows: 60px minmax(0, 1fr) auto; }
  .topbar { height: 60px; padding: 0 10px; grid-template-columns:auto auto 1fr auto; gap:5px; }
  .brand>span:last-child { display:none; }
  .topbar-note { display: none; }
  .topbar-link { width:38px; padding:0; justify-content:center; }
  .topbar-link span { display:none; }
  .topbar-primary { gap:2px; }
  .topbar-primary .topbar-link { width:34px; min-width:34px; }
  .topbar-actions { gap:2px; }
  .app-shell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { z-index: 15; width: 100%; height: auto; padding: 9px 14px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .side-heading, .sidebar-tip, .mode-button small, .mode-count { display: none; }
  .mode-nav { display: flex; gap: 6px; width: max-content; }
  .mode-button { width: auto; min-height: 40px; padding: 4px 11px 4px 5px; grid-template-columns: 32px auto; gap: 7px; }
  .mode-icon { width: 30px; height: 30px; }
  .mode-icon svg { width: 16px; }
  .content { padding: 30px 16px 54px; }
  .site-announcement { margin:-15px 0 18px; }
  .eyebrow { font-size: 10px; }
  h1 { font-size: 30px; }
  .subtitle { font-size: 13px; }
  .category-bar { top: -30px; margin-top: 25px; }
  .banner-slot { min-height:120px; margin:22px 0 18px; }
  .banner-track,.banner-slide,.banner-slide img { min-height:120px; }
  .banner-caption { left:14px; right:14px; bottom:14px; }
  .banner-caption strong { font-size:15px; }
  .category-button { padding-left: 11px; padding-right: 11px; }
  .category-button.active::after { left: 11px; right: 11px; }
  .model-grid { grid-template-columns: 1fr; }
  .model-card { min-height: 206px; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
