.loop-marketplace,
.loop-detail {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

.loop-shell .header-search {
  display: none;
}

.loop-eyebrow {
  color: #2f6f64;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.loop-hero {
  align-items: end;
  border-bottom: 1px solid var(--border-color);
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 22px;
  padding: 6px 0 26px;
}

.loop-hero h1,
.loop-detail-header h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 0 0 12px;
}

.loop-hero p,
.loop-detail-header p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
  max-width: 680px;
}

.loop-hero-panel {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.loop-platform-strip,
.loop-hero-actions,
.loop-form-actions,
.loop-tags,
.loop-card-top,
.loop-card-footer,
.loop-breadcrumbs ol,
.loop-detail-topbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.loop-platform-strip {
  justify-content: flex-end;
}

.loop-platform-strip span {
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-primary);
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
}

.loop-platform-strip img {
  background: #ffffff;
  border-radius: 4px;
  height: 18px;
  object-fit: contain;
  padding: 2px;
  width: 18px;
}

.loop-hero-actions {
  justify-content: flex-end;
}

.loop-hero-actions a,
.loop-form-actions button {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  min-height: 38px;
  padding: 8px 13px;
  text-decoration: none;
}

.loop-hero-actions .loop-primary-action,
.loop-form-actions button[type="submit"] {
  background: #183f3a;
  border-color: #183f3a;
  color: #ffffff;
}

.loop-toolbar {
  align-items: center;
  display: flex;
  gap: 10px;
  margin: 0 0 18px;
}

.loop-toolbar input,
.loop-toolbar select,
.loop-submit-form input,
.loop-submit-form textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  min-height: 42px;
  padding: 9px 12px;
  width: 100%;
}

.loop-toolbar input {
  flex: 1 1 360px;
}

.loop-toolbar select {
  flex: 0 0 210px;
}

.loop-toolbar input:focus,
.loop-toolbar select:focus,
.loop-submit-form input:focus,
.loop-submit-form textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.loop-listings {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 42px;
}

.loop-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-height: 208px;
  padding: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.loop-card[hidden] {
  display: none;
}

.loop-card:hover {
  border-color: #cfd8d5;
  box-shadow: 0 8px 24px var(--shadow-light);
  transform: translateY(-1px);
}

.loop-card-top {
  justify-content: space-between;
}

.loop-card-pill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
}

.loop-card-pill {
  background: #eef4f2;
  border: 1px solid #d7e6e2;
  color: #204f49;
}

.loop-card h2 {
  font-size: 17px;
  line-height: 1.3;
  margin: 0;
}

.loop-card h2 a {
  color: var(--text-primary);
  text-decoration: none;
}

.loop-card p {
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
}

.loop-tags {
  gap: 6px;
}

.loop-tags span {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1;
  padding: 5px 8px;
}

.loop-card-footer {
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: auto;
  padding-top: 11px;
}

.loop-card-footer span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loop-submit {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 42px;
  padding: 18px;
  scroll-margin-top: 96px;
}

.loop-submit-form {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.loop-submit-header {
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding-bottom: 14px;
}

.loop-submit-title h2 {
  font-size: 20px;
  line-height: 1.25;
  margin: 0;
}

.loop-submit-tabs {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: inline-flex;
  flex: 0 0 auto;
  padding: 2px;
}

.loop-submit-tabs button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  padding: 7px 10px;
}

.loop-submit-tabs button.is-active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  font-weight: 650;
}

.loop-submit-tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.loop-submit-pane {
  display: grid;
  gap: 14px;
}

.loop-submit-pane[hidden],
.loop-markdown-preview[hidden] {
  display: none;
}

.loop-form-row {
  display: grid;
  gap: 6px;
}

.loop-form-row label {
  color: var(--text-secondary);
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.loop-submit-form textarea {
  resize: vertical;
}

.loop-checkbox {
  align-items: start;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
  line-height: 1.4;
}

.loop-checkbox input {
  height: 17px;
  margin-top: 2px;
  min-height: 0;
  width: 17px;
}

.loop-honeypot {
  left: -9999px;
  position: absolute;
}

.loop-submit-note {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.loop-markdown-preview {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12.5px;
  line-height: 1.55;
  margin: 0;
  max-height: 520px;
  overflow-wrap: break-word;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
  word-break: normal;
}

.loop-breadcrumbs {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 0;
}

.loop-breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.loop-breadcrumbs li {
  align-items: center;
  display: inline-flex;
  gap: 10px;
}

.loop-breadcrumbs li + li::before {
  color: var(--text-tertiary);
  content: "/";
}

.loop-breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}

.loop-breadcrumbs a:hover,
.loop-card h2 a:hover,
.loop-edit-action:hover,
.loop-copy-action:hover,
.loop-add-menu summary:hover {
  color: var(--text-primary);
}

.loop-detail-topbar {
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.loop-detail-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  position: relative;
}

.loop-edit-action,
.loop-copy-action,
.loop-add-menu summary {
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 650;
  gap: 7px;
  min-height: 30px;
  padding: 5px 10px;
  text-decoration: none;
}

.loop-copy-action {
  font: inherit;
}

.loop-add-menu {
  position: relative;
}

.loop-add-menu summary {
  color: var(--text-primary);
  list-style: none;
}

.loop-add-menu summary::-webkit-details-marker {
  display: none;
}

.loop-action-icon-stack {
  display: inline-flex;
}

.loop-action-icon-stack img {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  height: 18px;
  margin-left: -5px;
  object-fit: contain;
  padding: 2px;
  width: 18px;
}

.loop-action-icon-stack img:first-child {
  margin-left: 0;
}

.loop-add-menu-popover {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 14px 36px var(--shadow-medium);
  display: grid;
  gap: 6px;
  min-width: 160px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
}

.loop-detail-header {
  margin-bottom: 18px;
  max-width: 760px;
}

.loop-detail-header h1 {
  font-size: 30px;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.loop-detail-header p {
  font-size: 14px;
  line-height: 1.55;
  max-width: 620px;
}

.loop-detail-tags {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.loop-detail-tags span,
.loop-detail-tags a {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1;
  padding: 5px 8px;
  text-decoration: none;
}

.loop-related-header span {
  color: var(--text-tertiary);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.loop-platform-card {
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: 7px;
  justify-content: flex-start;
  min-height: 34px;
  padding: 5px 10px;
  text-align: left;
  width: 100%;
}

.loop-platform-card-cursor {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

.loop-platform-card img {
  background: #ffffff;
  border-radius: 4px;
  flex: 0 0 auto;
  height: 20px;
  object-fit: contain;
  padding: 2px;
  width: 20px;
}

.loop-platform-card-cursor img {
  background: #ffffff;
}

.loop-platform-card span {
  align-items: baseline;
  display: flex;
  gap: 5px;
  white-space: nowrap;
}

.loop-platform-card strong {
  font-size: 13px;
  line-height: 1.1;
}

.loop-platform-card small {
  color: currentColor;
  font-size: 11px;
  opacity: 0.72;
}

.loop-platform-card:hover,
.loop-copy-action:hover,
.loop-add-menu summary:hover,
.loop-form-actions button:hover,
.loop-hero-actions a:hover {
  border-color: var(--accent);
}

.loop-export-status {
  color: var(--text-secondary);
  flex-basis: 100%;
  font-size: 12px;
  line-height: 1.4;
  margin: 10px 0 0;
}

.loop-export-fallback {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: var(--text-primary);
  flex-basis: 100%;
  font-family: 'SF Mono', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px;
  resize: vertical;
  width: 100%;
}

.loop-detail-layout {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) 280px;
}

.loop-main-panel {
  min-width: 0;
}

.loop-body > * {
  max-width: none;
}

.loop-body h2 {
  font-size: 18px;
  margin: 0 0 8px;
}

.loop-body h3 {
  font-size: 15px;
}

.loop-body p,
.loop-body li {
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.65;
}

.loop-body ol,
.loop-body ul {
  padding-left: 19px;
}

.loop-related {
  border-left: 1px solid var(--border-color);
  padding-left: 16px;
  position: sticky;
  top: 84px;
}

.loop-related-header {
  margin-bottom: 6px;
}

.loop-related-item {
  border-top: 1px solid var(--border-color);
  color: var(--text-primary);
  display: block;
  padding: 10px 0;
  text-decoration: none;
}

.loop-related-item strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.loop-related-item span {
  color: var(--text-secondary);
  display: block;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
}

.loop-related-item:hover strong {
  text-decoration: underline;
}

[data-theme="dark"] .loop-card-pill {
  background: #20302d;
  border-color: #31504a;
  color: #bfe3da;
}

[data-theme="dark"] .loop-hero-actions .loop-primary-action,
[data-theme="dark"] .loop-form-actions button[type="submit"],
[data-theme="dark"] .loop-platform-card-cursor {
  background: #f5f5f5;
  border-color: #f5f5f5;
  color: #111111;
}

@media screen and (max-width: 900px) {
  .loop-hero,
  .loop-detail-layout {
    grid-template-columns: 1fr;
  }

  .loop-hero-panel,
  .loop-platform-strip,
  .loop-hero-actions {
    justify-content: flex-start;
    justify-items: start;
  }

  .loop-related {
    border-left: 0;
    border-top: 1px solid var(--border-color);
    padding-left: 0;
    padding-top: 16px;
    position: static;
  }

}

@media screen and (max-width: 640px) {
  .loop-marketplace,
  .loop-detail {
    padding-left: 16px;
    padding-right: 16px;
  }

  .loop-hero h1,
  .loop-detail-header h1 {
    font-size: 28px;
  }

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

  .loop-toolbar input,
  .loop-toolbar select,
  .loop-hero-actions a,
  .loop-form-actions button {
    flex: none;
    width: 100%;
  }

  .loop-hero-actions {
    width: 100%;
  }

  .loop-detail-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .loop-detail-actions {
    justify-content: flex-start;
  }

  .loop-add-menu-popover {
    left: 0;
    right: auto;
  }

  .loop-platform-card {
    justify-content: flex-start;
  }

  .loop-card {
    min-height: 0;
  }

  .loop-submit-header {
    align-items: stretch;
    flex-direction: column;
  }

  .loop-submit-tabs {
    width: 100%;
  }

  .loop-submit-tabs button {
    flex: 1;
  }

  .loop-submit {
    padding: 14px;
  }
}
