:root {
  color-scheme: light;
  --page: #f7f8fa;
  --surface: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --subtle: #80868b;
  --line: #dfe3e8;
  --line-strong: #c8cdd3;
  --accent: #1a73e8;
  --accent-hover: #1558b0;
  --accent-soft: #e8f0fe;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

a {
  color: inherit;
}

.topbar {
  height: 56px;
  flex: 0 0 56px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  width: min(960px, calc(100% - 40px));
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
}

.wordmark {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  border-radius: 7px;
  color: #ffffff;
  background: #303134;
  font-size: 12px;
  font-weight: 700;
}

.wordmark-section {
  color: var(--subtle);
  font-weight: 450;
}

.quiet-link,
.back-link,
.secondary-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 550;
}

.quiet-link,
.secondary-link {
  white-space: nowrap;
}

.quiet-link:hover,
.back-link:hover,
.secondary-link:hover {
  color: var(--accent);
}

.page-shell {
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
}

.intro {
  max-width: 620px;
  padding: 50px 0 34px;
}

.section-label {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.intro h1,
.detail-heading h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 680;
  line-height: 1.2;
}

.intro > p:last-child {
  max-width: 590px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.catalog-section {
  padding: 0 0 72px;
}

.section-heading {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.section-heading span {
  color: var(--subtle);
  font-size: 11px;
}

.script-list {
  display: grid;
  gap: 10px;
}

.script-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.script-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 4px 14px rgba(32, 33, 36, .07);
}

.script-icon {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 40px;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 15px;
  font-weight: 700;
}

.script-summary {
  min-width: 0;
}

.script-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.script-title h3 {
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.version {
  flex: 0 0 auto;
  color: var(--subtle);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.script-summary > p {
  max-width: 600px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.primary-button {
  min-width: 88px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  color: #ffffff;
  background: var(--accent);
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.primary-button:hover {
  background: var(--accent-hover);
}

.button-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-shell {
  padding: 34px 0 72px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 26px;
}

.detail-summary {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-icon {
  width: 48px;
  height: 48px;
  font-size: 17px;
}

.detail-heading {
  min-width: 0;
}

.detail-heading > p:last-child {
  max-width: 640px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
  padding-top: 32px;
}

.detail-grid article {
  min-width: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.detail-grid h2 {
  margin: 0 0 11px;
  font-size: 13px;
  font-weight: 650;
}

.detail-grid p,
.match-list {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.match-list {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

code {
  padding: 3px 5px;
  color: #4d5156;
  background: #eef0f2;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.empty-state {
  margin: 0;
  padding: 40px 18px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  font-size: 12px;
}

footer {
  width: min(960px, calc(100% - 40px));
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: auto auto 0;
  color: var(--subtle);
  border-top: 1px solid var(--line);
  font-size: 10px;
}

@media (max-width: 680px) {
  .topbar-inner,
  .page-shell,
  footer {
    width: min(100% - 28px, 960px);
  }

  .wordmark-section {
    display: none;
  }

  .intro {
    padding: 36px 0 28px;
  }

  .intro h1,
  .detail-heading h1 {
    font-size: 25px;
  }

  .catalog-section {
    padding-bottom: 52px;
  }

  .script-card {
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: start;
    gap: 13px;
    padding: 15px;
  }

  .script-icon {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .card-actions {
    grid-column: 2;
    justify-content: flex-start;
    margin-top: 2px;
  }

  .detail-shell {
    padding-top: 26px;
  }

  .detail-summary {
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    padding: 22px 0;
  }

  .detail-icon {
    width: 40px;
    height: 40px;
  }

  .detail-summary .primary-button {
    grid-column: 2;
    justify-self: start;
    margin-top: 2px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 26px;
  }

  footer {
    min-height: 76px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
