:root {
  color-scheme: dark;
  --bg: #080a0f;
  --surface-0: #0b0e14;
  --surface-1: #10141c;
  --surface-2: #151a24;
  --surface-3: #1c2430;
  --surface-blue: #102747;
  --border: #2a313d;
  --border-strong: #3b4657;
  --text: #f4f7fb;
  --text-soft: #c8ceda;
  --text-muted: #8d96a7;
  --text-faint: #646d7d;
  --blue: #4da1ff;
  --blue-strong: #2d7ff0;
  --magenta: #dc5798;
  --violet: #8b5ee8;
  --green: #48d482;
  --amber: #f2bc4d;
  --danger: #ff6b8f;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.4);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --sidebar-width: 220px;
  --panel-width: 336px;
  --mono: "SFMono-Regular", "Cascadia Code", "Liberation Mono", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 45% 0%, rgba(77, 161, 255, 0.1), transparent 32rem),
    linear-gradient(180deg, #0a0d13 0%, #07090d 100%);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

svg {
  display: block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--panel-width);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 18rem),
    var(--surface-0);
}

.brand-block {
  display: flex;
  align-items: center;
  min-height: 74px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-link {
  display: block;
  width: 100%;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 196px;
  height: 40px;
  object-fit: contain;
  object-position: left center;
  image-rendering: pixelated;
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
  scrollbar-color: var(--surface-3) transparent;
  scrollbar-width: thin;
}

.nav-section + .nav-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.nav-section h2 {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  text-transform: uppercase;
}

.nav-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 36px;
  gap: 10px;
  margin: 2px 0;
  padding: 8px 9px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.2;
  text-align: left;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

.nav-item.is-active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(45, 127, 240, 0.34), rgba(45, 127, 240, 0.12));
  border-color: rgba(77, 161, 255, 0.2);
}

.nav-item span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 17px;
}

.nav-item.is-active .nav-icon {
  color: var(--blue);
}

.nav-count,
.panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 25px;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: var(--surface-3);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
}

.sidebar-footer {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--border);
}

.tip-panel {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
}

.tip-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}

.tip-title span:first-child {
  color: var(--amber);
}

.tip-panel p {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

.raw-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 14px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface-1);
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
}

.raw-button span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-content {
  min-width: 0;
  padding: 24px 28px 42px;
  border-right: 1px solid var(--border);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-height: 44px;
}

.mobile-brand {
  display: none;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ghost-button,
.outline-button,
.primary-button,
.filter-tab,
.link-button,
.icon-button,
.language-menu,
.quick-tags button,
.add-dropzone,
.row-download {
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background: rgba(13, 17, 24, 0.78);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
}

.ghost-button svg {
  font-size: 16px;
}

.ghost-button:hover,
.outline-button:hover,
.filter-tab:hover,
.quick-tags button:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.fixed-number {
  color: var(--text-soft);
}

.hero-section {
  padding: 7px 0 28px;
}

.hero-section h1 {
  margin: 0 0 44px;
  color: var(--text);
  font-size: 36px;
  font-weight: 760;
  line-height: 1.08;
}

.hero-title {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
}

.hero-title span:first-child {
  color: var(--blue);
}

.hero-title span:last-child {
  color: var(--magenta);
}

.search-box {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: rgba(7, 10, 16, 0.8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

.search-box:focus-within {
  border-color: rgba(77, 161, 255, 0.76);
  box-shadow: 0 0 0 3px rgba(77, 161, 255, 0.12);
}

.search-box svg {
  font-size: 19px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-family: var(--mono);
  font-size: 14px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box kbd {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.quick-tags button {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
}

.section-heading.compact {
  margin-top: 18px;
  margin-bottom: 10px;
}

.section-heading h2,
.panel-card h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
}

.link-button::after {
  content: "→";
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 216px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--surface-1);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
}

.template-card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 18% 0%, rgba(77, 161, 255, 0.12), transparent 13rem);
  content: "";
}

.template-card > * {
  position: relative;
}

.template-card:hover,
.catalog-row:hover {
  border-color: var(--border-strong);
  background-color: var(--surface-2);
}

.card-top {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.template-icon,
.row-icon,
.stack-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: white;
  background: linear-gradient(135deg, var(--blue-strong), var(--violet));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.template-icon {
  width: 38px;
  height: 38px;
  font-size: 20px;
}

.template-icon.command,
.row-icon.command,
.stack-icon.command {
  background: linear-gradient(135deg, var(--violet), var(--magenta));
}

.template-icon.skill,
.row-icon.skill,
.stack-icon.skill {
  background: linear-gradient(135deg, var(--magenta), #b14483);
}

.template-icon.mcp,
.row-icon.mcp,
.stack-icon.mcp {
  background: linear-gradient(135deg, #1f8fcb, var(--blue-strong));
}

.template-icon.cli,
.row-icon.cli,
.stack-icon.cli {
  background: linear-gradient(135deg, #2cb67d, #4da1ff);
}

.template-icon.hook,
.row-icon.hook,
.stack-icon.hook {
  background: linear-gradient(135deg, #2cb67d, #3576e6);
}

.template-title {
  min-width: 0;
}

.template-title h3 {
  margin: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.template-title span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: lowercase;
}

.template-card p {
  flex: 1;
  margin: 22px 0 14px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  color: #9ccaff;
  background: rgba(45, 127, 240, 0.28);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
}

.tag.skill,
.tag.docs,
.tag.security,
.tag.review {
  color: #ff9aca;
  background: rgba(220, 87, 152, 0.28);
}

.tag.command,
.tag.refactor {
  color: #d2c0ff;
  background: rgba(139, 94, 232, 0.28);
}

.tag.cli,
.tag.version {
  color: #9ee6ff;
  background: rgba(31, 143, 203, 0.28);
}

.tag.approved {
  color: #a9f3c2;
  background: rgba(72, 212, 130, 0.18);
  border: 1px solid rgba(72, 212, 130, 0.24);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.meta-pill svg {
  font-size: 13px;
}

.card-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid rgba(77, 161, 255, 0.24);
  border-radius: var(--radius-sm);
  color: var(--blue);
  background: rgba(77, 161, 255, 0.1);
  font-family: var(--mono);
  font-size: 11px;
}

.card-add.is-added {
  color: var(--green);
  border-color: rgba(72, 212, 130, 0.28);
  background: rgba(72, 212, 130, 0.1);
}

.catalog-section {
  padding-top: 30px;
}

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tab {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: var(--surface-1);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
}

.filter-tab.is-active {
  color: var(--blue);
  border-color: rgba(77, 161, 255, 0.72);
  background: rgba(77, 161, 255, 0.1);
}

.select-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-group label {
  display: grid;
  gap: 4px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.select-group select {
  min-width: 142px;
  min-height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-1);
  font-family: var(--mono);
  font-size: 12px;
}

.result-count {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.catalog-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(8, 11, 17, 0.64);
}

.catalog-row {
  display: grid;
  grid-template-columns: 38px minmax(220px, 1.45fr) minmax(190px, 1fr) 96px 96px minmax(34px, 96px);
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.catalog-row:last-child {
  border-bottom: 0;
}

.row-icon {
  width: 38px;
  height: 38px;
  font-size: 18px;
}

.row-copy {
  min-width: 0;
}

.row-copy h3 {
  margin: 0 0 4px;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-copy p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.row-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-self: end;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.row-stat svg {
  font-size: 13px;
}

.row-open {
  display: inline-grid;
  place-items: center;
  justify-self: end;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
}

.row-open:hover {
  color: var(--blue);
  background: rgba(77, 161, 255, 0.1);
}

.row-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  gap: 6px;
  min-width: 88px;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid rgba(72, 212, 130, 0.28);
  border-radius: var(--radius-sm);
  color: var(--green);
  background: rgba(72, 212, 130, 0.08);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  text-decoration: none;
}

.row-download:hover {
  border-color: rgba(72, 212, 130, 0.48);
  background: rgba(72, 212, 130, 0.14);
}

.row-download svg {
  flex: none;
  font-size: 13px;
}

.empty-state {
  margin-top: 14px;
  padding: 28px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
}

.empty-state p {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.app-shell.is-detail {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-shell.is-detail .main-content {
  border-right: 0;
  padding: 28px 38px 52px;
}

.app-shell.is-detail .topbar {
  display: none;
}

.detail-view {
  display: block;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  margin-bottom: 34px;
  color: var(--text-muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
}

.detail-back:hover {
  color: var(--text);
}

.detail-back svg {
  font-size: 20px;
}

.detail-hero-card,
.detail-install-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018)),
    var(--surface-1);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.26);
}

.detail-hero-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  min-height: 176px;
  padding: 30px 36px;
}

.detail-icon {
  display: inline-grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  color: white;
  background: linear-gradient(135deg, var(--blue-strong), var(--violet));
  font-size: 46px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.detail-icon.command {
  background: linear-gradient(135deg, var(--violet), var(--magenta));
}

.detail-icon.skill {
  background: linear-gradient(135deg, var(--magenta), #b14483);
}

.detail-icon.mcp {
  background: linear-gradient(135deg, #1f8fcb, var(--blue-strong));
}

.detail-icon.cli {
  background: linear-gradient(135deg, #2cb67d, #4da1ff);
}

.detail-icon.hook {
  background: linear-gradient(135deg, #2cb67d, #3576e6);
}

.detail-hero-copy {
  min-width: 0;
}

.detail-hero-copy h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 36px;
  font-weight: 780;
  line-height: 1.1;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-downloads {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid rgba(72, 212, 130, 0.32);
  border-radius: 999px;
  color: var(--green);
  background: rgba(72, 212, 130, 0.12);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}

.detail-install-card {
  margin-top: 32px;
  padding: 28px 30px 30px;
}

.detail-install-card header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.detail-install-card h3,
.detail-section-label {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-install-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(77, 161, 255, 0.3);
  border-radius: var(--radius-md);
  color: #9ccaff;
  background: rgba(77, 161, 255, 0.12);
  font-size: 18px;
}

.detail-copy-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  color: white;
  background: linear-gradient(135deg, #5d75e8, #7c67df);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}

.detail-install-card pre,
.detail-code {
  margin: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  background: rgba(8, 11, 17, 0.64);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-install-card pre {
  padding: 18px 20px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 34px 0 28px;
}

.detail-action {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
}

.detail-action:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.detail-content-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 22px;
  align-items: start;
}

.detail-content-main {
  min-width: 0;
}

.detail-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 18px 0 16px;
  padding: 5px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.detail-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 13px;
}

.detail-tabs button.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.detail-preview-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.detail-file-rail {
  display: grid;
  grid-template-rows: 28px auto;
  justify-items: center;
  gap: 8px;
  padding: 18px 0;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.detail-file-rail span {
  writing-mode: vertical-rl;
}

.detail-preview-body {
  padding: 28px 32px;
}

.detail-preview-body section + section {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.detail-preview-body h3,
.detail-copy h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 22px;
  font-weight: 760;
  line-height: 1.2;
}

.detail-preview-body p,
.detail-copy p {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
}

.detail-code {
  padding: 22px;
}

.detail-copy {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.detail-copy h3 + p + h3 {
  margin-top: 22px;
}

.detail-on-page {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 13px;
  padding: 18px 0 18px 18px;
  border-left: 1px solid var(--border);
}

.detail-on-page span {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-on-page a {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}

.detail-on-page a:hover {
  color: var(--blue);
}

.builder-panel {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 20rem),
    var(--surface-0);
  scrollbar-color: var(--surface-3) transparent;
  scrollbar-width: thin;
}

.panel-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.034), rgba(255, 255, 255, 0.012)),
    rgba(12, 15, 22, 0.88);
}

.stack-card {
  padding: 14px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.stack-list {
  display: grid;
  gap: 8px;
}

.stack-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.stack-icon {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

.stack-copy {
  min-width: 0;
}

.stack-copy h3 {
  display: -webkit-box;
  margin: 0 0 6px;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.stack-copy span {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  color: #9ccaff;
  background: rgba(77, 161, 255, 0.14);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
}

.remove-stack {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: transparent;
  font-size: 18px;
}

.remove-stack:hover {
  color: var(--danger);
  background: rgba(255, 107, 143, 0.1);
}

.add-dropzone {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  width: 100%;
  min-height: 70px;
  gap: 3px 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--blue);
  background: rgba(255, 255, 255, 0.015);
  font-family: var(--mono);
  text-align: left;
}

.add-dropzone svg {
  grid-row: 1 / 3;
  font-size: 20px;
}

.add-dropzone span {
  color: #9ccaff;
  font-size: 12px;
}

.add-dropzone small {
  color: var(--text-muted);
  font-size: 11px;
}

.install-card,
.export-card {
  padding: 14px;
}

.install-card h2,
.export-card h2 {
  margin-bottom: 16px;
}

.code-window {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #090c12;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 9px;
  border-bottom: 1px solid var(--border);
}

.language-menu,
.icon-button {
  color: var(--text-soft);
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
}

.language-menu::after {
  margin-left: 6px;
  color: var(--text-faint);
  content: "⌄";
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  font-size: 16px;
}

.icon-button:hover {
  color: var(--blue);
  background: rgba(77, 161, 255, 0.1);
}

.code-window pre {
  min-height: 202px;
  margin: 0;
  padding: 14px;
  overflow-x: hidden;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-comment {
  color: var(--text-faint);
}

.code-accent {
  color: #5fc9ff;
}

.primary-button,
.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius-md);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
}

.primary-button {
  width: 100%;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: white;
  background: linear-gradient(90deg, var(--blue), var(--magenta));
  box-shadow: 0 10px 24px rgba(77, 161, 255, 0.16);
}

.primary-button:hover {
  filter: brightness(1.08);
}

.primary-button svg,
.outline-button svg {
  font-size: 16px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.015);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
}

.notice span {
  min-width: 0;
}

.notice svg {
  flex: none;
  margin-top: 1px;
  color: var(--green);
  font-size: 16px;
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.outline-button {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-1);
}

.outline-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(77, 161, 255, 0.4);
  border-radius: var(--radius-md);
  color: var(--text);
  background: rgba(10, 14, 22, 0.96);
  box-shadow: var(--shadow);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1240px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .builder-panel {
    grid-column: 2;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
    height: auto;
    padding: 0 28px 32px;
    border-right: 1px solid var(--border);
  }

  .export-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1040px) {
  .featured-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catalog-row {
    grid-template-columns: 38px minmax(200px, 1fr) minmax(150px, 0.75fr) 84px minmax(34px, 96px);
  }

  .catalog-row .downloads {
    display: none;
  }

  .detail-content-shell {
    grid-template-columns: 1fr;
  }

  .detail-on-page {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: 16px 0 0;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand-block {
    min-height: 64px;
  }

  .brand-logo {
    max-width: 236px;
  }

  .side-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    overflow: visible;
    padding: 14px;
  }

  .nav-section + .nav-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    padding: 18px 18px 30px;
    border-right: 0;
  }

  .topbar {
    justify-content: space-between;
  }

  .hero-section h1 {
    margin-top: 16px;
    margin-bottom: 26px;
    font-size: 32px;
  }

  .hero-title {
    font-size: 18px;
  }

  .catalog-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .select-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .select-group select {
    width: 100%;
    min-width: 0;
  }

  .builder-panel {
    display: grid;
    grid-template-columns: 1fr;
    padding: 0 18px 28px;
    border-right: 0;
  }

  .app-shell.is-detail .main-content {
    padding: 18px 18px 34px;
  }

  .detail-back {
    margin-bottom: 22px;
  }

  .detail-hero-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 16px;
    min-height: auto;
    padding: 22px;
  }

  .detail-icon {
    width: 66px;
    height: 66px;
    font-size: 32px;
  }

  .detail-hero-copy h2 {
    font-size: 27px;
  }

  .detail-downloads {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .detail-install-card {
    padding: 20px;
  }

  .detail-install-card header {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .detail-copy-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .detail-preview-card {
    grid-template-columns: 1fr;
  }

  .detail-file-rail {
    display: none;
  }

  .detail-preview-body {
    padding: 22px;
  }
}

@media (max-width: 640px) {
  .side-nav {
    grid-template-columns: 1fr;
  }

  .top-actions {
    gap: 6px;
  }

  .ghost-button {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .ghost-button.fixed-number {
    display: none;
  }

  .hero-section {
    padding-top: 0;
  }

  .hero-section h1 {
    font-size: 29px;
  }

  .hero-title {
    font-size: 16px;
  }

  .search-box {
    grid-template-columns: 20px minmax(0, 1fr);
    min-height: 48px;
  }

  .search-box kbd {
    display: none;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .template-card {
    min-height: 190px;
  }

  .catalog-row {
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    gap: 10px;
    min-height: 78px;
  }

  .catalog-row .row-tags,
  .catalog-row .stars,
  .catalog-row .downloads {
    display: none;
  }

  .row-copy h3 {
    white-space: normal;
  }

  .catalog-row.type-cli {
    grid-template-columns: 38px minmax(0, 1fr) 34px;
  }

  .catalog-row.type-cli .row-tags {
    display: flex;
    grid-column: 2 / 4;
    margin-top: -2px;
  }

  .row-download {
    min-width: 30px;
    width: 30px;
    height: 30px;
    padding: 0;
  }

  .row-download span {
    display: none;
  }

  .select-group {
    grid-template-columns: 1fr;
  }

  .export-actions {
    grid-template-columns: 1fr;
  }

  .detail-tabs {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .detail-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .detail-action,
  .detail-tabs button {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
