.app-directory {
  box-sizing: border-box;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  color: #203143;
}
.directory-intro {
  margin-bottom: 24px;
  padding: clamp(20px, 3vw, 32px);
  border-radius: 16px;
  background: linear-gradient(110deg, #e9f4fa, #f7fafc 76%);
}
.directory-intro h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
}
.directory-description, .directory-empty {
  margin: 0;
  color: #506477;
  font-size: 16px;
  line-height: 1.5;
}
.genre-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}
.genre-link {
  min-width: 0;
  border: 1px solid #dce5eb;
  border-radius: 14px;
  background: white;
}
.genre-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 12px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
}
.genre-list summary::-webkit-details-marker { display: none; }
.genre-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: #f0f6fa;
}
.genre-copy { flex: 1; min-width: 0; }
.genre-copy strong { display: block; font-size: 16px; line-height: 1.3; }
.category-app { display:flex; align-items:center; gap:14px; padding:16px; border:1px solid #dce5e6; border-radius:14px; color:#20363a; background:linear-gradient(125deg,#f3f9f8,#fff 58%); }
.category-app:is(:hover,:focus-visible) { border-color:#80aaa5; text-decoration:none; }
.category-app-icon { position:relative; flex:none; width:56px; height:56px; overflow:hidden; border-radius:12px; }
.category-app-icon img { width:100%; height:100%; object-fit:contain; }
.category-app-rating { display:flex; align-items:center; gap:6px; margin-top:6px; font-size:12px; font-weight:700; color:#986009; }
.category-app-rating i { width:75px; height:15px; background:linear-gradient(to right,#ffb430 var(--filled),#d4d7da var(--filled)); mask:url("/static/rating-star-rounded.svg") left center / 20% 100% repeat-x; }
.genre-preview {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: #617183;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.genre-count {
  color: #52697c;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.genre-link::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  margin-inline: 0 4px;
  border: solid #638297;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
}
.genre-link:hover { background:#f3f8fb; text-decoration:none; }
[dir="rtl"] .genre-link::after { transform:rotate(135deg); }
.genre-list details[open] summary::after { transform: rotate(225deg); }
.genre-list details[open] { border-color: #9dbfce; }
.genre-list summary:hover, .genre-list details[open] summary { background: #f3f8fb; }
.genre-apps {
  display: grid;
  max-height: min(52vh, 360px);
  overflow-y: auto;
  padding: 6px 10px;
  border-top: 1px solid #e3ebef;
}
.genre-apps a {
  display: block;
  padding: 12px 8px;
  border-radius: 6px;
  color: inherit;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.genre-apps a:hover { background: #f0f6fa; color: #135d80; }
.genre-dialog {
  box-sizing: border-box;
  width: min(780px, calc(100% - 28px));
  max-height: 80dvh;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: #203143;
  background: white;
  box-shadow: 0 20px 80px #172e4833;
}
.genre-dialog::backdrop { background: #162b4159; }
.genre-dialog[open] { display: flex; flex-direction: column; }
.genre-dialog-head {
  position: static;
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: #f1f7fb;
}
.genre-dialog-icon { box-sizing: border-box; padding: 8px; background: white; border-radius: 12px; }
.genre-dialog-head h2 { flex: 1; margin: 0; font-size: 22px; }
.genre-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: white; color: #344b60; font-size: 24px; cursor: pointer; }
.genre-dialog .genre-apps {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 12px;
  max-height: 57dvh;
  padding: 12px 16px 16px;
  overscroll-behavior: contain;
}
.genre-dialog .genre-apps a { display: flex; align-items: center; border-bottom: 1px solid #eef2f5; }
html:has(.genre-dialog[open]) { overflow: hidden; }
.genre-list :is(summary, a):focus-visible { outline: 2px solid #257390; outline-offset: -2px; }
@media (max-width: 900px) {
  .genre-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .genre-dialog .genre-apps { grid-template-columns: 1fr; }
  .genre-dialog-head h2 { font-size: 20px; }
  .app-directory { padding: 18px 14px 40px; }
  .directory-intro { margin-bottom: 16px; }
  .genre-list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .category-app .genre-copy strong { overflow-wrap: anywhere; }
}

.genre-list > .ads { grid-column: 1 / -1; }
