.software-grid {
  display: flex;
  gap: 4px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.software-card {
  position: relative;
  flex: 0 0 112px;
  width: 112px;
  height: 112px;
  margin: 0;
  padding: 0;
  overflow: visible;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 2px 7px rgba(15, 23, 42, .12);
}

.software-summary {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  border-radius: 9px;
  cursor: pointer;
}
.software-summary::-webkit-details-marker { display: none; }
.software-summary:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.app-icon {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background-color: #f8fafc;
}

.app-icon-image {
  position: absolute;
  top: 18px;
  left: 18px;
  display: block;
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.app-name {
  position: absolute;
  right: 3px;
  bottom: 4px;
  left: 3px;
  display: -webkit-box;
  overflow: hidden;
  color: #fff;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 3px #000, 0 0 5px rgba(0, 0, 0, .8);
  background: transparent;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.software-icon-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
}

.software-popup {
  position: fixed;
  top: var(--software-popup-top, 0);
  left: var(--software-popup-left, 0);
  z-index: 1001;
  display: none;
  box-sizing: border-box;
  width: min(280px, calc(100vw - 12px));
  max-height: calc(100vh - 12px);
  padding: 10px;
  overflow-y: auto;
  color: #e2e8f0;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(2, 6, 23, .32);
}
.software-card[open] .software-popup { display: block; }
.app-overlay-name { min-height: 36px; margin: 0; padding: 5px 40px 3px 0; font-weight: 800; }
.app-overlay-desc { margin: 2px 0 7px; color: #cbd5e1; font-size: .86rem; line-height: 1.3; }

.software-popup-close {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #e2e8f0;
  font: inherit;
  font-size: 1.25rem;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 50%;
  cursor: pointer;
}
.software-popup-close:focus-visible { outline: 2px solid #93c5fd; }

.software-downloads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.software-download {
  display: grid;
  min-height: 42px;
  padding: 2px;
  place-items: center;
  border-radius: 7px;
}
.software-download:hover, .software-download:focus-visible { background: #1e293b; }
.software-download img, .software-download > span { width: 32px; height: 32px; object-fit: contain; }
.software-empty { margin: 0; padding: 6px; color: #64748b; border: 1px dashed #94a3b8; }

.software-search { width: 100%; max-width: 1050px; margin: 6px auto; }
.software-search-toolbar, .software-search-count { margin: 5px 0; }
.software-search-toolbar form { width: 100%; gap: 4px; }
.software-search-toolbar input[type="search"] { flex: 1 1 220px; width: auto; }
.software-search-toolbar select { width: 180px; }
.software-search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.software-search-results a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; align-items: center; min-height: 48px; padding: 6px; color: #0f172a; text-decoration: none; border: 1px solid #e2e8f0; border-radius: 8px; }
.software-search-results strong { padding: 2px 5px; color: #2563eb; font-size: .72rem; background: #eff6ff; border-radius: 999px; }
.software-search-results span:not(.software-result-download) { min-width: 0; overflow-wrap: anywhere; }
.software-result-download { color: #2563eb; font-size: 1.1rem; }

@media (max-width: 600px) {
  .software-grid { gap: 3px; }
  .software-card, .software-summary { flex-basis: 96px; width: 96px; height: 96px; }
  .app-icon-image { top: 16px; left: 16px; width: 64px; height: 64px; }
  .app-name { font-size: .68rem; }
  .software-popup { width: min(272px, calc(100vw - 8px)); max-height: calc(100vh - 8px); padding: 8px; }
  .software-popup-close { width: 40px; height: 40px; top: 4px; right: 4px; }
  .app-overlay-name { min-height: 40px; padding-right: 44px; }
  .software-download { min-height: 44px; padding: 0; }
  .software-search-toolbar form { display: grid; gap: 3px; }
  .software-search-toolbar input[type="search"], .software-search-toolbar select { width: 100%; min-height: 42px; }
  .software-search-results { grid-template-columns: 1fr; }
}
