:root {
  color-scheme: dark;
  --ink: #e8f0f2;
  --muted: #91a5ad;
  --quiet: #6f838d;
  --canvas: #0d1720;
  --surface: #14232c;
  --surface-raised: #1a2d37;
  --line: #29404a;
  --teal: #71d8c2;
  --teal-strong: #42b89f;
  --amber: #f2bd73;
  --coral: #f08d7a;
  --danger: #ff9b91;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .55; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-header, main, .site-footer { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--teal);
  border-radius: 9px;
  color: var(--teal);
  font-weight: 750;
  letter-spacing: .04em;
}
.brand strong { display: block; font-size: 15px; letter-spacing: .02em; }
.brand small { display: block; margin-top: 2px; color: var(--quiet); font-size: 9px; letter-spacing: .22em; }
.header-meta { display: flex; align-items: center; gap: 24px; }
.service-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.service-status[data-state="ready"] .status-dot { background: var(--teal); }
.service-status[data-state="error"] .status-dot { background: var(--danger); }
.header-link { color: var(--muted); font-size: 12px; text-decoration: none; }
.header-link:hover { color: var(--teal); }

main { flex: 1; padding: 58px 0 72px; }
.catalog-intro { display: flex; justify-content: space-between; gap: 48px; padding-bottom: 48px; }
.intro-copy { max-width: 670px; }
.eyebrow { margin: 0 0 12px; color: var(--teal); font-size: 10px; font-weight: 750; letter-spacing: .2em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 680px; margin-bottom: 15px; font-size: clamp(36px, 5vw, 66px); line-height: 1.02; letter-spacing: -.03em; }
.intro-text { max-width: 600px; margin-bottom: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.catalog-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-self: end; min-width: 360px; border-top: 1px solid var(--line); }
.catalog-facts > div { padding: 14px 0 0 18px; border-left: 1px solid var(--line); }
.fact-label { display: block; margin-bottom: 9px; color: var(--quiet); font-size: 10px; letter-spacing: .08em; }
.catalog-facts strong { display: block; overflow-wrap: anywhere; font-size: 18px; font-weight: 600; }

.catalog-toolbar { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.search-field { position: relative; flex: 1 1 260px; }
.search-field input { width: 100%; padding: 12px 14px 12px 38px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: var(--surface); color: var(--ink); }
.search-field input:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgb(113 216 194 / 16%); }
.search-field input::placeholder { color: var(--quiet); }
.search-icon { position: absolute; top: 8px; left: 13px; color: var(--muted); font-size: 22px; line-height: 1; }
.filter-group { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-button, .refresh-button, .state-action { border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); }
.filter-button { padding: 9px 11px; font-size: 12px; }
.filter-button:hover, .filter-button.is-active { border-color: var(--teal); color: var(--teal); background: rgb(113 216 194 / 8%); }
.refresh-button { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; white-space: nowrap; font-size: 12px; }
.refresh-button:hover { color: var(--ink); border-color: var(--muted); }

.catalog-region { padding-top: 42px; }
.region-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.region-heading .eyebrow { margin-bottom: 8px; }
h2 { margin-bottom: 0; font-size: 24px; letter-spacing: -.02em; }
.result-count { color: var(--quiet); font-size: 12px; }
.extension-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.catalog-pagination { display: grid; justify-items: center; gap: 10px; padding-top: 24px; }
.load-more-button { min-width: 132px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--teal); }
.load-more-button:hover { border-color: var(--teal); background: rgb(113 216 194 / 8%); }
.load-more-message { max-width: 520px; margin: 0; color: var(--amber); font-size: 12px; line-height: 1.6; text-align: center; }
.extension-card { display: flex; min-height: 258px; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.extension-card:hover { border-color: rgb(113 216 194 / 70%); background: var(--surface-raised); transform: translateY(-2px); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kind-label, .risk-label, .maintenance-label { display: inline-flex; align-items: center; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.kind-label { padding: 5px 8px; color: var(--teal); background: rgb(113 216 194 / 11%); }
.risk-label { padding: 4px 7px; color: var(--amber); border: 1px solid rgb(242 189 115 / 30%); }
.extension-card h3 { margin: 20px 0 7px; font-size: 19px; line-height: 1.25; }
.publisher-line { margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.summary { display: -webkit-box; overflow: hidden; margin-bottom: 18px; color: var(--muted); font-size: 13px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.trust-line { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 16px; }
.trust-status { position: relative; padding-left: 11px; color: var(--muted); font-size: 10px; }
.trust-status::before { position: absolute; top: 4px; left: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--teal); content: ""; }
.card-bottom { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-top: auto; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { color: var(--quiet); font-size: 11px; }
.tag::before { content: "#"; color: var(--teal-strong); }
.version { color: var(--quiet); font-size: 11px; white-space: nowrap; }
.card-action { display: block; width: 100%; margin-top: 17px; padding: 9px 0 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--teal); text-align: left; text-decoration: none; font-size: 12px; }
.card-action:hover { color: var(--ink); }

.state-panel { display: grid; min-height: 250px; place-items: center; align-content: center; padding: 36px 20px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.state-icon { margin-bottom: 14px; color: var(--teal); font-size: 30px; }
.state-panel[data-state="error"] .state-icon, .state-panel[data-state="empty"] .state-icon { color: var(--amber); }
.state-panel h3 { margin-bottom: 8px; font-size: 18px; }
.state-panel p { max-width: 460px; margin-bottom: 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.state-action { padding: 9px 14px; color: var(--teal); }
.state-action:hover { border-color: var(--teal); }

.site-footer { display: flex; justify-content: space-between; gap: 24px; padding: 18px 0 24px; border-top: 1px solid var(--line); color: var(--quiet); font-size: 11px; }
.detail-dialog { width: min(680px, calc(100% - 30px)); max-height: min(760px, calc(100vh - 30px)); padding: 26px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgb(0 0 0 / 45%); }
.detail-dialog::backdrop { background: rgb(4 10 15 / 78%); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.dialog-kicker { color: var(--teal); font-size: 10px; font-weight: 750; letter-spacing: .16em; }
.icon-button { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }
.icon-button:hover { border-color: var(--teal); color: var(--teal); }
.detail-dialog h2 { margin-bottom: 8px; font-size: 30px; }
.detail-publisher { margin-bottom: 20px; color: var(--muted); font-size: 13px; }
.detail-description { color: var(--muted); font-size: 14px; line-height: 1.7; white-space: pre-line; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0; }
.detail-fact { padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); }
.detail-fact span { display: block; margin-bottom: 6px; color: var(--quiet); font-size: 10px; }
.detail-fact strong { font-size: 13px; font-weight: 600; }
.compatibility { margin-top: 22px; }
.compatibility h3 { margin-bottom: 10px; font-size: 13px; }
.compatibility p { margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.detail-notice { margin-top: 24px; padding: 13px; border-left: 2px solid var(--amber); background: rgb(242 189 115 / 7%); color: var(--muted); font-size: 12px; line-height: 1.6; }
.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; }

@media (max-width: 900px) {
  .catalog-intro { flex-direction: column; }
  .catalog-facts { align-self: stretch; min-width: 0; }
  .catalog-toolbar { align-items: stretch; flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
  .extension-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .site-header, main, .site-footer { width: min(100% - 30px, 1240px); }
  .site-header { min-height: 70px; flex-wrap: wrap; gap: 10px; padding: 12px 0; }
  .header-meta { flex: 1 1 100%; justify-content: flex-end; min-width: 0; }
  .service-status { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-link { display: none; }
  main { padding-top: 40px; }
  h1 { font-size: 42px; }
  .catalog-facts { width: 100%; min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .catalog-facts > div { padding-left: 9px; }
  .catalog-facts strong { max-width: 100%; overflow: hidden; font-size: 15px; text-overflow: ellipsis; }
  .filter-group { display: grid; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filter-button { min-width: 0; width: 100%; padding-inline: 4px; font-size: 10px; white-space: normal; overflow-wrap: anywhere; }
  .refresh-button { width: 100%; justify-content: center; margin-left: 0; }
  .extension-grid { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; gap: 7px; }
  .detail-dialog { padding: 20px; }
  .detail-grid { grid-template-columns: 1fr; }
}
