.detail-layout {
  display: grid;
  gap: 2rem;
  min-width: 0;
}

.detail-main {
  container: detail-main / inline-size;
  min-width: 0;
}

.app_view_pad .app-description-content {
  max-height: none;
  overflow: visible;
  overflow-wrap: anywhere;
}

.app-description-content :is(img, video) {
  height: auto;
  max-width: 100%;
}

.app-description-content :is(iframe, svg) {
  max-width: 100%;
}

.app-description-content pre {
  max-width: 100%;
  overflow-x: auto;
}

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

.app_view_pad .app_screens {
  order: 6;
}

.detail-sidebar-card {
  background: #fff;
  border: 1px solid rgba(18, 20, 22, 0.06);
  border-radius: 0.75rem;
  box-shadow: 0 0.25rem 1.5rem 1px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

.detail-sidebar-card + .detail-sidebar-card {
  margin-top: 1.5rem;
}

.detail-sidebar-card h2 {
  align-items: center;
  border-bottom: 1px solid #edf0f2;
  display: flex;
  font-size: 1.125rem;
  font-weight: 700;
  gap: 0.75rem;
  margin: 0;
  padding: 1.25rem 1.5rem;
}

.detail-sidebar-heading-icon {
  color: #68cb5b;
  flex: 0 0 1.25rem;
  height: 1.25rem;
  width: 1.25rem;
}

.detail-category-list,
.detail-popular ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.detail-category-list > li {
  border-bottom: 1px solid #edf0f2;
  padding: 0.25rem 0;
}

.detail-category-list > li:last-child {
  border-bottom: 0;
}

.detail-category-link {
  align-items: center;
  color: inherit;
  display: flex;
  font-weight: 700;
  justify-content: space-between;
  padding: 0.65rem 1.5rem;
}

.detail-category-link span {
  color: #68cb5b;
  font-size: 1.5rem;
  line-height: 1rem;
}

.detail-category-toggle-wrap {
  border-top: 1px solid #edf0f2;
  padding: 1rem 1.25rem;
}

.detail-category-toggle {
  align-items: center;
  background: #68cb5b;
  border: 0;
  border-radius: 1.5rem;
  box-shadow: 0 0.5rem 1.5rem 0 rgba(104, 203, 91, 0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1.25rem;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  transition:
    background-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out,
    transform 0.15s ease-in-out;
  width: 100%;
}

.detail-category-toggle:hover {
  background: #5fc253;
  box-shadow:
    0 0.5rem 1.5rem 0 rgba(104, 203, 91, 0.25),
    0 0 0 0.25rem rgba(104, 203, 91, 0.12);
}

.detail-category-toggle:active {
  background: #54b247;
  box-shadow: 0 0.125rem 0.25rem rgba(58, 121, 50, 0.18);
  transform: translateY(1px);
}

.detail-category-toggle:focus-visible {
  box-shadow:
    0 0.5rem 1.5rem 0 rgba(104, 203, 91, 0.2),
    0 0 0 0.25rem rgba(104, 203, 91, 0.28);
}

.detail-category-toggle-label {
  letter-spacing: 0.01em;
}

.detail-category-toggle-count {
  align-items: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0.625rem;
  display: inline-flex;
  font-size: 0.6875rem;
  height: 1.25rem;
  justify-content: center;
  margin-left: 0.5rem;
  min-width: 1.25rem;
  padding: 0 0.35rem;
}

.detail-category-toggle-icon {
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  height: 0.45rem;
  margin-left: 0.65rem;
  margin-top: -0.2rem;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  width: 0.45rem;
}

.detail-category-toggle-icon.is-expanded {
  margin-top: 0.2rem;
  transform: rotate(225deg);
}

@media (prefers-reduced-motion: reduce) {
  .detail-category-toggle,
  .detail-category-toggle-icon {
    transition: none;
  }
}

.detail-popular li + li {
  border-top: 1px solid #edf0f2;
}

.detail-popular li > a {
  align-items: center;
  color: inherit;
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
}

.detail-popular-icon {
  align-items: center;
  background: #f2f4f3;
  border-radius: 0.75rem;
  display: flex;
  flex: 0 0 3.25rem;
  font-weight: 700;
  height: 3.25rem;
  justify-content: center;
  overflow: hidden;
}

.detail-popular-icon img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.detail-popular-copy {
  display: block;
  min-width: 0;
}

.detail-popular-copy strong,
.detail-popular-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-popular-copy strong {
  font-size: 0.875rem;
}

.detail-popular-copy small {
  color: #9ba1a5;
  font-size: 0.6875rem;
  margin-top: 0.15rem;
}

.detail-popular em {
  background: #f77a4c;
  border-radius: 0.75rem;
  color: #fff;
  font-size: 0.5625rem;
  font-style: normal;
  font-weight: 700;
  margin-left: auto;
  padding: 0.2rem 0.4rem;
}

@media (min-width: 992px) {
  .detail-layout {
    align-items: start;
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .detail-sidebar {
    position: sticky;
    top: 7rem;
  }
}

@media (min-width: 1200px) {
  .detail-layout {
    gap: 4rem;
  }
}

/* Keep the summary in normal flow and release the legacy action columns. */
.detail-main .app_view_pad {
  display: block;
}

@media (min-width: 768px) {
  .detail-main .app_view_pad {
    padding-left: 0;
    padding-right: 0;
  }
}

.app-summary {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

.app-summary-icon {
  background-color: #fff;
  border-radius: 1rem;
  box-shadow: 0 1.5rem 2rem -1rem #00000029;
  height: 8.5rem;
  margin: 0;
  overflow: hidden;
  width: 8.5rem;
}

.app-summary-icon > img {
  border-radius: inherit;
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.app-summary-details {
  min-width: 0;
  overflow-wrap: anywhere;
}

.app-summary-details > .title {
  margin-bottom: 0.75rem;
}

.app-summary .spec {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
}

.app-summary .spec > li {
  margin: 0;
  max-width: 100%;
  min-width: 0;
}

.app-summary .developer {
  margin-top: 0.5rem;
}

@container detail-main (min-width: 40rem) {
  .app-summary {
    column-gap: 2rem;
    grid-template-columns: 10rem minmax(0, 1fr);
  }

  .app-summary-icon {
    height: 10rem;
    width: 10rem;
  }
}

html.darkmod .app-summary-icon {
  background: none;
  box-shadow: none;
}

@media (max-width: 991px) {
  .detail-sidebar {
    margin: 0 1rem;
  }
}

@media (max-width: 499px) {
  .detail-layout {
    gap: 1.5rem;
  }

  .detail-sidebar {
    margin: 0 0.75rem;
  }
}

html.darkmod .detail-sidebar-card {
  background: #1b1d1f;
  border-color: rgba(255, 255, 255, 0.06);
}

html.darkmod .detail-sidebar-card h2,
html.darkmod .detail-category-list > li,
html.darkmod .detail-category-toggle-wrap,
html.darkmod .detail-popular li + li {
  border-color: rgba(255, 255, 255, 0.1);
}

html.darkmod .detail-category-toggle {
  background: #5dbf51;
  color: #fff;
}

html.darkmod .detail-category-toggle:hover {
  background: #68cb5b;
}

html.darkmod .detail-popular-icon {
  background: #292c2f;
}

.app_versions {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #fff;
}

.app_versions .section-title {
  margin-bottom: 1rem;
}

.app_versions_list {
  display: grid;
  gap: 0.75rem;
}

.app_version_item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(54, 63, 70, 0.12);
  border-radius: 0.75rem;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.app_version_item:hover,
.app_version_item.latest {
  border-color: rgba(104, 203, 91, 0.7);
  background: rgba(104, 203, 91, 0.06);
}

.app_version_main {
  min-width: 0;
}

.app_version_heading,
.app_version_meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.app_version_badge {
  padding: 0.2rem 0.55rem;
  color: #397d31;
  background: rgba(104, 203, 91, 0.18);
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.app_version_notes {
  margin: 0.5rem 0 0;
}

.app_version_action {
  flex: 0 0 auto;
  color: #54b247;
}

html.darkmod .app_versions {
  background: #292c2f;
}

html.darkmod .app_version_item {
  border-color: rgba(255, 255, 255, 0.12);
}

html.darkmod .app_version_item:hover,
html.darkmod .app_version_item.latest {
  border-color: rgba(104, 203, 91, 0.7);
  background: rgba(104, 203, 91, 0.08);
}

@media (max-width: 575px) {
  .app_versions {
    padding: 1rem;
  }

  .app_version_item {
    align-items: flex-start;
  }
}
