:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202124;
  background: #fff;
  font-synthesis: none;
  --muted: #5f6368;
  --purple: #6942ca;
  --border: #dfe1e5;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--purple); text-underline-offset: 3px; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid #9775ec; outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* Search */
#search-form { display: flex; flex-direction: column; align-items: center; gap: 22px; margin: 0; }
.brand { display: flex; align-items: center; gap: 12px; color: #202124; text-decoration: none; font-weight: 750; letter-spacing: -1.6px; font-size: clamp(34px, 7vw, 52px); }
.brand-name span { color: var(--purple); }
.brand-mark { display: grid; place-items: center; background: #292637; color: #fff; width: 1.15em; height: 1.15em; border-radius: .28em; font-size: .9em; letter-spacing: 0; }
.search-box { display: flex; align-items: center; width: 100%; max-width: 584px; border: 1px solid var(--border); border-radius: 24px; padding: 4px 4px 4px 20px; background: #fff; transition: box-shadow .15s; }
.search-box:hover, .search-box:focus-within { box-shadow: 0 1px 6px #20212447; border-color: transparent; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; min-height: 38px; color: #202124; }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
#search-button { border: 0; background: var(--purple); color: #fff; border-radius: 20px; min-height: 38px; padding: 0 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
#search-button:hover { background: #5733b2; }
#search-button:disabled { opacity: .65; cursor: wait; }
.tagline { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }

body.home main { display: flex; flex-direction: column; justify-content: center; padding-bottom: 12vh; }
body.searched #search-form { flex-direction: row; gap: 20px; padding: 20px 0 12px; border-bottom: 1px solid #ebebeb; position: sticky; top: 0; background: #fff; z-index: 1; }
body.searched .brand { font-size: 22px; letter-spacing: -.6px; gap: 8px; flex: none; }
body.searched .brand-name { display: none; }
body.searched .tagline { display: none; }
body.searched .search-box { max-width: none; }

/* Results */
.status { color: var(--muted); font-size: 13px; margin: 14px 0 10px; overflow-wrap: anywhere; }
.status.error { color: #a12537; }
.result-list { display: grid; gap: 2px; }
.result { border-radius: 12px; }
.result:has(input:checked) { background: #f8f6fd; box-shadow: inset 0 0 0 1px #d9cdf3; }
.option { display: block; padding: 14px 16px; border-radius: 12px; cursor: pointer; overflow-wrap: anywhere; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option:has(input:focus-visible) { outline: 3px solid #9775ec; outline-offset: -3px; }
.result:not(:has(input:checked)) .option:hover strong { text-decoration: underline; }
.option-body { display: grid; gap: 4px; min-width: 0; }
.option-heading { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 8px; min-width: 0; }
.option strong { font-size: 16px; font-weight: 650; color: var(--purple); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.option small { font-size: 13px; color: var(--muted); }
.option-heading .repository { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 48%; }
.option small.stars { margin-left: auto; padding-left: 8px; flex: none; white-space: nowrap; font-size: 12px; }
.option-body > span:not(.option-heading) { font-size: 14px; line-height: 1.55; color: #4d5156; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.more { display: block; margin: 16px auto 8px; border: 1px solid var(--border); background: #fff; color: #3c4043; border-radius: 20px; padding: 8px 20px; font-size: 13px; cursor: pointer; }
.more:hover { background: #f8f9fa; }

/* Actions for the selected result */
.actions { padding: 0 16px 16px; }
.action-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.launch-button { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 12px; border: 1px solid #d3c6ef; border-radius: 10px; background: #fff; color: #4c3b67; font-size: 13px; font-weight: 600; text-decoration: none; }
.launch-button:not([aria-disabled="true"]):hover { background: #f1ebfd; border-color: #af95df; }
.launch-button.primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.launch-button.primary:not([aria-disabled="true"]):hover { background: #5733b2; }
.launch-button[aria-disabled="true"] { background: #f4f2f6; border-color: #e8e4ed; color: #8a8494; cursor: not-allowed; }
.step-number { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1px solid currentColor; font-size: 11px; opacity: .8; }
.field-error { color: #a12537; font-size: 12px; margin: 6px 0 0; }
.field-error:empty { display: none; }
.actions-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.actions-note a { text-decoration: none; white-space: nowrap; }

footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; padding: 16px 20px; background: #f2f2f2; color: var(--muted); font-size: 13px; }
footer a { color: inherit; text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  body.searched #search-form { gap: 12px; }
  .action-row { grid-template-columns: 1fr; }
  }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Launch helper tab */
body.launch main { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding-bottom: 12vh; }
body.launch h1 { font-size: 28px; letter-spacing: -.6px; margin: 0 0 10px; }
body.launch p { color: var(--muted); font-size: 15px; margin: 0; }
.launch-actions { display: flex; gap: 16px; align-items: center; margin-top: 24px !important; }
#launch-close { border: 1px solid var(--border); background: #fff; color: #3c4043; border-radius: 20px; padding: 8px 18px; font-size: 13px; cursor: pointer; }
.launch-button.done .step-number { background: #1e8e3e; border-color: #1e8e3e; opacity: 1; font-size: 0; }
.launch-button.done .step-number::after { content: "✓"; color: #fff; font-size: 12px; }
