:root {
  color-scheme: dark;
  --ink: #f7f2e8;
  --muted: #ada89f;
  --surface: #171717;
  --surface-raised: #20201f;
  --line: #393733;
  --accent: #d5a447;
  --accent-deep: #7d5520;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: #0d0d0d; color: var(--ink); }
button, input { font: inherit; }
.login-shell { width: min(560px, calc(100% - 32px)); margin: 12vh auto; }
.login-card { display: grid; gap: 12px; margin-top: 32px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.login-card input { border: 1px solid #4b4842; border-radius: 10px; padding: 14px; color: var(--ink); background: #0f0f0f; }
.login-card button { border: 0; border-radius: 10px; padding: 12px; color: #17120a; background: var(--accent); font-weight: 800; cursor: pointer; }
.login-error { margin: 0; color: #ff9d92; }
.logout { float: right; color: var(--muted); }
.masthead, .app-shell { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.masthead { padding: 64px 0 32px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.7rem, 7vw, 5.8rem); font-weight: 500; line-height: .95; }
.lede { max-width: 620px; color: var(--muted); font-size: 1.08rem; }
.app-shell { padding: 28px 0 80px; }
.mode-switch { display: flex; gap: 8px; margin-bottom: 28px; }
.mode-button { border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; color: var(--muted); background: transparent; cursor: pointer; }
.mode-button.is-active { border-color: var(--accent); background: var(--accent); color: #17120a; font-weight: 800; }
.search-panel { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.search-panel label { display: block; margin-bottom: 8px; font-weight: 750; }
.search-panel input { width: 100%; border: 1px solid #4b4842; border-radius: 10px; padding: 14px 16px; background: #0f0f0f; color: var(--ink); }
.search-panel input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.rating-filter { display: flex; align-items: center; gap: 2px; margin-top: 10px; color: var(--muted); font-size: .85rem; }
.rating-filter span { margin-right: 6px; }
.rating-filter button { border: 0; padding: 0 1px; color: var(--muted); background: transparent; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.rating-filter button:hover, .rating-filter button:focus-visible, .rating-filter button.is-active { color: var(--accent); }
.rating-filter button:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.status { margin: 10px 0 0; color: var(--muted); font-size: .85rem; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.status-block { min-width: 0; }
.mapping-review { margin-top: 6px; color: var(--muted); font-size: .85rem; }
.mapping-review summary { color: var(--accent); cursor: pointer; }
.mapping-review p { margin: 8px 0 4px; }
.mapping-review ul { columns: 2; margin: 6px 0 0; padding-left: 20px; }
.result-card mark { border-radius: 3px; padding: 0 .08em; color: #17120a; background: var(--accent); }
.sync-controls { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.search-panel .sync-key { width: 190px; padding: 7px 10px; }
.sync-button { margin-top: 10px; border: 1px solid var(--accent-deep); border-radius: 8px; padding: 7px 10px; color: var(--accent); background: transparent; cursor: pointer; }
.sync-controls .sync-button { margin-top: 0; }
.sync-button:disabled { opacity: .55; cursor: wait; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.content-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; margin-top: 24px; }
.browse-panel, .results-panel { min-width: 0; }
.browse-panel { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.browse-panel h2, .results-heading h2 { margin-top: 0; }
.browse-panel details { margin: 8px 0; }
.browse-panel summary { padding: 6px 0; color: var(--ink); font-weight: 750; cursor: pointer; }
.browse-children { display: grid; gap: 5px; margin: 5px 0 10px 12px; padding-left: 10px; border-left: 1px solid var(--line); }
.browse-leaf, .clear-filter { width: 100%; border: 0; border-radius: 7px; padding: 7px 9px; color: var(--muted); background: transparent; text-align: left; cursor: pointer; }
.browse-root-leaf { margin: 8px 0; padding: 6px 0 6px 18px; color: var(--ink); font-weight: 750; }
.browse-leaf:hover { color: var(--ink); background: var(--surface-raised); }
.browse-leaf.is-selected { color: #17120a; background: var(--accent); font-weight: 800; }
.clear-filter { margin-bottom: 10px; border: 1px solid var(--accent-deep); color: var(--accent); text-align: center; }
.plugin-facets { display: grid; gap: 4px; max-height: 65vh; overflow: auto; }
.results-heading { display: flex; align-items: baseline; justify-content: space-between; }
#result-count { color: var(--muted); }
.results { display: grid; gap: 14px; }
.result-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-raised); }
.result-card h3 { margin: 0 0 14px; font-family: Georgia, serif; font-size: 1.45rem; }
.result-card .field-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: start; gap: 12px; margin: 7px 0; color: #ded9cf; }
.result-card .field-label { color: var(--muted); font-size: .83rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.result-card .field-value { min-width: 0; color: #ded9cf; }
.result-card .star-rating { color: var(--accent); letter-spacing: .08em; }
.result-card .description { margin: 0 0 14px; color: #ded9cf; }
.plugin-card .description { display: block; margin: 12px 0 16px; padding-left: 12px; border-left: 2px solid var(--accent); color: var(--ink); line-height: 1.55; }
.empty-state { padding: 44px 24px; border: 1px dashed var(--line); border-radius: 14px; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  .masthead { padding-top: 40px; }
  .content-grid { grid-template-columns: 1fr; }
  .browse-panel { display: none; }
  .result-card .field-row { grid-template-columns: 1fr; gap: 2px; }
}
