:root {
  color-scheme: light;
  --page: #f3f6f4;
  --surface: #ffffff;
  --surface-muted: #eef2ef;
  --border: #d7dfda;
  --border-strong: #b8c5bd;
  --ink: #18231f;
  --muted: #64716b;
  --green: #14785b;
  --green-dark: #0f5d47;
  --green-soft: #e3f3ec;
  --blue: #2f5ea8;
  --blue-soft: #e6eefb;
  --amber: #895b09;
  --amber-soft: #fff2d3;
  --shadow: 0 16px 48px rgba(31, 47, 39, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }

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

a { color: inherit; }

.topbar {
  min-height: 64px;
  padding: 10px clamp(16px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--green);
  color: white;
  font-size: 18px;
  font-weight: 800;
}

.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 12px; }

.topbar nav { display: flex; align-items: center; gap: 22px; }
.topbar nav a { color: #33413b; font-size: 14px; font-weight: 650; text-decoration: none; }
.topbar nav a:hover { color: var(--green); }

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

.catalog-toolbar {
  padding: 34px clamp(16px, 4vw, 56px) 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.catalog-heading {
  max-width: 1440px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.heading-copy { display: flex; align-items: baseline; gap: 12px; }
.content-tabs { flex: 0 0 auto; }

.eyebrow {
  margin: 0 4px 0 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: 0; }
.result-count { color: var(--muted); font-size: 14px; }

.search-row, .filter-row {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: end;
  gap: 12px;
}

.filter-row { margin-top: 14px; align-items: center; justify-content: space-between; }

.search-field { flex: 1; }
.sort-field { width: 210px; }
.search-field span, .sort-field span {
  display: block;
  margin-bottom: 6px;
  color: #53615b;
  font-size: 12px;
  font-weight: 700;
}

input[type="search"], select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

input[type="search"] { padding: 0 14px; }
select { padding: 0 36px 0 12px; }
input[type="search"]:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 120, 91, 0.12); }

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(82px, auto);
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-muted);
}

.segmented button, .detail-tabs button {
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #53615b;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.segmented button.active { background: var(--surface); color: var(--green-dark); box-shadow: 0 1px 3px rgba(30, 45, 38, 0.12); }

.verified-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #43514b;
  font-size: 13px;
  font-weight: 700;
}

.verified-toggle input { width: 17px; height: 17px; accent-color: var(--green); }

.toolbar-actions { display: flex; align-items: center; gap: 18px; }

.primary-button, .secondary-action {
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.primary-button { border: 1px solid var(--green); background: var(--green); color: white; }
.primary-button:hover { background: var(--green-dark); border-color: var(--green-dark); }
.primary-button:disabled { cursor: wait; opacity: 0.65; }
.secondary-action { border: 1px solid var(--border-strong); background: var(--surface); color: #33413b; }

.catalog-content { max-width: 1552px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 56px) 52px; }

.model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.model-card {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.model-card:hover, .model-card:focus-visible {
  border-color: #94aa9e;
  box-shadow: 0 10px 26px rgba(37, 54, 45, 0.1);
  transform: translateY(-2px);
  outline: none;
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #dfe5e1;
  border-bottom: 1px solid var(--border);
}

.card-media img { width: 100%; height: 100%; display: block; object-fit: cover; }
.card-media.synthetic img { object-fit: contain; background: #cfd4d8; }
.card-media.repository-thumb img { object-fit: contain; background: #f7f9f8; }

.card-badges, .detail-badges { position: absolute; left: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.94);
  color: #33413b;
  border: 1px solid rgba(192, 202, 196, 0.9);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.verified { background: var(--green-soft); border-color: #afd9c8; color: var(--green-dark); }
.badge.community { background: var(--amber-soft); border-color: #ead29a; color: var(--amber); }
.badge.world { background: var(--blue-soft); border-color: #bfd0ed; color: var(--blue); }
.badge.license { background: var(--amber-soft); border-color: #ead29a; color: var(--amber); }
.badge.update { background: #fde8e7; border-color: #e8b8b4; color: #963c34; }

.card-body { min-height: 268px; padding: 18px; display: flex; flex-direction: column; }
.repo-name { margin: 0 0 5px; color: var(--muted); font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.card-body h2 { margin: 0; font-size: 20px; line-height: 1.25; letter-spacing: 0; }
.card-summary { min-height: 62px; margin: 10px 0 15px; color: #53615b; font-size: 14px; line-height: 1.5; }

.card-specs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.card-spec { min-width: 0; padding: 11px 8px 10px 0; }
.card-spec + .card-spec { padding-left: 10px; border-left: 1px solid var(--border); }
.card-spec small, .card-spec strong { display: block; }
.card-spec small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.card-spec strong { margin-top: 3px; color: #26342e; font-size: 12px; overflow-wrap: anywhere; }

.tag-list { margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 7px; border-radius: 4px; background: var(--surface-muted); color: #526059; font-size: 11px; }

.empty-state { min-height: 280px; display: grid; place-content: center; gap: 6px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 18px; }
.hidden { display: none !important; }

footer {
  min-height: 48px;
  padding: 12px clamp(16px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

footer a { color: var(--green-dark); font-weight: 700; text-decoration: none; }

.model-dialog {
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.model-dialog::backdrop { background: rgba(17, 28, 23, 0.6); }
.model-dialog article { position: relative; display: grid; grid-template-columns: minmax(280px, 38%) minmax(0, 1fr); max-height: calc(100vh - 32px); }

.close-button {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(190, 201, 195, 0.9);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.detail-media { position: relative; min-height: 100%; background: #dfe5e1; }
.detail-media img { width: 100%; height: 100%; min-height: 520px; display: block; object-fit: cover; }
.detail-media.repository-thumb img { object-fit: contain; background: #f7f9f8; }
.detail-body { min-width: 0; padding: 30px; overflow-y: auto; }
.detail-title-row { padding-right: 30px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.detail-title-row h2 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: 0; }
.secondary-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: #33413b;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.secondary-button:hover { border-color: var(--green); color: var(--green-dark); }
.detail-summary { margin: 15px 0 20px; color: #4f5e57; line-height: 1.55; }

.detail-specs { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.detail-specs div { min-width: 0; padding: 13px 10px 13px 0; border-bottom: 1px solid var(--border); }
.detail-specs div:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--border); }
.detail-specs dt { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.detail-specs dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 700; }

.detail-tabs { margin-top: 22px; display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.detail-tabs button { border-radius: 5px 5px 0 0; }
.detail-tabs button.active { background: var(--green-soft); color: var(--green-dark); }

.command-header { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.command-header span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.command-header button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--green);
  border-radius: 5px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

pre {
  margin: 9px 0 0;
  padding: 15px;
  overflow: auto;
  border-radius: 6px;
  background: #17211d;
  color: #eaf2ed;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.verification-panel { padding-top: 16px; }
.verification-meta { margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.curation-note { margin: 0 0 14px; color: #4f5e57; font-size: 13px; line-height: 1.5; }
.check-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.check-list li { padding: 9px 11px; border-left: 3px solid var(--green); background: var(--green-soft); color: #28483c; font-size: 13px; }
.manifest-output { max-height: 340px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 6px;
  background: #17211d;
  color: white;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 150ms ease, transform 150ms ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.submission-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.submission-dialog::backdrop { background: rgba(17, 28, 23, 0.6); }
.submission-dialog article { max-height: calc(100vh - 32px); padding: 28px; overflow-y: auto; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-header h2 { margin: 3px 0 0; font-size: 25px; letter-spacing: 0; }
.inline-close { position: static; flex: 0 0 auto; }
.submission-fields { margin-top: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.submission-fields label { min-width: 0; color: #53615b; font-size: 12px; font-weight: 700; }
.submission-fields .wide-field { grid-column: 1 / -1; }
.submission-fields input, .submission-fields select, .submission-fields textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.submission-fields input, .submission-fields select { height: 42px; padding: 0 11px; }
.submission-fields textarea { min-height: 88px; padding: 10px 11px; resize: vertical; line-height: 1.45; }
.submission-fields input:focus, .submission-fields select:focus, .submission-fields textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 120, 91, 0.12); }
.submission-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-actions { margin-top: 18px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.form-error { margin-top: 14px; padding: 10px 12px; border-left: 3px solid #a6463d; background: #fdeceb; color: #7f3029; font-size: 13px; }
.submission-result { padding-top: 22px; }
.submission-result h3 { margin: 0; font-size: 18px; letter-spacing: 0; }
.submission-result p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.warning-list { margin: 16px 0 0; padding: 0; display: grid; gap: 7px; list-style: none; }
.warning-list li { padding: 9px 11px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #684707; font-size: 13px; line-height: 1.45; }
.candidate-output { max-height: 410px; }

@media (max-width: 1050px) {
  .model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model-dialog article { grid-template-columns: minmax(240px, 34%) minmax(0, 1fr); }
  .detail-body { padding: 24px; }
}

@media (max-width: 720px) {
  .topbar { min-height: 58px; padding: 9px 14px; }
  .brand-mark { width: 34px; height: 34px; }
  .topbar nav a:first-child { display: none; }
  .topbar nav { gap: 12px; }
  .catalog-toolbar { padding: 24px 14px 18px; }
  .catalog-heading { margin-bottom: 18px; flex-wrap: wrap; }
  .heading-copy { flex: 1 1 100%; flex-wrap: wrap; }
  .heading-copy .eyebrow { flex-basis: 100%; }
  .content-tabs { width: 100%; }
  .content-tabs button { width: 100%; }
  h1 { font-size: 26px; }
  .search-row { align-items: stretch; flex-direction: column; }
  .sort-field { width: 100%; }
  .filter-row { align-items: stretch; flex-direction: column; }
  .segmented { width: 100%; grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segmented button { padding: 0 9px; }
  .verified-toggle { min-height: 32px; }
  .toolbar-actions { justify-content: space-between; }
  .catalog-content { padding: 18px 14px 36px; }
  .model-grid { grid-template-columns: 1fr; }
  .card-body { min-height: 0; }
  .card-summary { min-height: 0; }
  footer { padding: 12px 14px; }
  .model-dialog { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .model-dialog article { display: block; max-height: 100vh; overflow-y: auto; }
  .detail-media { min-height: 220px; height: 34vh; }
  .detail-media img { min-height: 220px; height: 100%; }
  .detail-body { padding: 22px 16px 32px; overflow: visible; }
  .detail-title-row { display: block; padding-right: 34px; }
  .detail-title-row h2 { font-size: 23px; }
  .secondary-button { margin-top: 14px; display: inline-block; }
  .detail-specs { grid-template-columns: 1fr; }
  .detail-specs div:nth-child(even) { padding-left: 0; border-left: 0; }
  .detail-tabs { overflow-x: auto; }
  .detail-tabs button { white-space: nowrap; }
  .submission-dialog { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .submission-dialog article { max-height: 100vh; padding: 22px 16px 30px; }
  .submission-fields { grid-template-columns: 1fr; }
  .submission-fields .wide-field { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .secondary-button, .form-actions button { width: 100%; text-align: center; }
}

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