/* Engines: search, discovery, and news pages */

.engine-discovery {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 0 36px;
}

.discovery-heading {
  margin: 0 0 4px;
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: .02em;
}

.discovery-lead {
  margin: 0 0 24px;
  color: rgba(255, 255, 255, .68);
  font-size: 14px;
}

.discovery-section { margin: 0 0 28px; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}

.section-title {
  margin: 0;
  font-size: 19px;
  letter-spacing: .03em;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 18px;
  margin: 0 9px -2px 0;
  background: var(--accent);
}

.section-link,
.clear-filter {
  color: var(--accent);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.section-link:hover,
.clear-filter:hover { color: #8ad9e5; }

.engine-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.discovery-thumb {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 7px;
  background: #202020;
  aspect-ratio: 1 / 1;
}

.engine-rail .discovery-thumb:nth-child(n + 6) { display: none; }

.discovery-thumb img.engine-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .2s ease, opacity .2s ease;
}

.discovery-thumb:hover img.engine-thumb {
  transform: scale(1.04);
  opacity: .84;
}

.rail-official-mark {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 19px;
  height: 19px;
  padding: 2px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .67);
  object-fit: contain;
}

.latest-news-link {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: -10px 0 22px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .09);
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  color: rgba(255, 255, 255, .8);
  font-size: 14px;
  text-decoration: none;
}

.latest-news-link span:first-child {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.latest-news-link span:last-child {
  margin-left: auto;
  color: var(--accent);
  font-size: 20px;
  line-height: .5;
}

.latest-news-link:hover {
  color: #fff;
  border-color: rgba(48, 176, 199, .55);
}

.filter-panel {
  margin: 0 0 28px;
  border: 1px solid rgba(48, 176, 199, .34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(48, 176, 199, .10), rgba(255, 255, 255, .02));
}

.filter-panel summary {
  padding: 14px 16px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
}

.filter-panel summary::marker { color: var(--accent); }
.filter-panel[open] summary { border-bottom: 1px solid rgba(255, 255, 255, .09); }
.filter-panel .search-form { max-width: none; margin: 0; padding: 16px; }
.filter-panel .form-row label { color: rgba(255, 255, 255, .8); }
.filter-panel .form-row select { min-height: 44px; border-color: rgba(255, 255, 255, .25); }
.filter-panel .form-buttons { margin-top: 4px; }
.filter-panel .btn { min-width: 150px; }

.engine-result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.engine-result-title { margin: 0; font-size: 20px; }
.engine-count { color: rgba(255, 255, 255, .62); font-size: 14px; }

.engine-discovery #search-results {
  margin-top: 0;
  padding: 0;
  background: none;
  min-height: 0;
}

.engine-discovery .engine-grid {
  margin-top: 0;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
}

.engine-discovery a.engine-card {
  position: relative;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 7px;
  background: #202020;
}

.official-badge {
  position: absolute;
  left: 12px;
  bottom: 49px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 3px;
  border-radius: 14px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .03em;
}

.official-badge img {
  width: 20px !important;
  height: 20px !important;
  aspect-ratio: auto !important;
  border-radius: 50% !important;
  object-fit: contain !important;
}

.engine-discovery .engine-info {
  min-height: 38px;
  margin-top: 7px;
  line-height: 1.25;
}

.engine-discovery .placeholder { padding: 32px 0; }

.news-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 0 36px;
  /* iOS WebViewの横向き時に起きる自動文字拡大を抑止する。 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.news-page h1 { margin: 0 0 18px; font-size: clamp(25px, 3vw, 34px); }

.news-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, .10);
}

.news-list li {
  padding: 18px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  color: rgba(255, 255, 255, .82);
  font-size: 15px;
  line-height: 1.7;
}

.news-version {
  display: inline-block;
  min-width: 64px;
  margin-right: 8px;
  color: var(--accent);
  font-weight: 700;
}

.news-list a { color: var(--accent); }
.news-list a:hover { color: #8ad9e5; }

/* Upload rules follow the compact typography and dividers used by News. */
.upload-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 0 36px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.upload-page > h2 { margin: 0 0 18px; font-size: clamp(25px, 3vw, 34px); }
.upload-page p,
.upload-page li {
  color: rgba(255, 255, 255, .82);
  font-size: 15px;
  line-height: 1.7;
}
.upload-page p { margin: 0 0 14px; }
.upload-page h3 {
  margin: 22px 0 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .10);
  font-size: 19px;
}
.upload-page h3::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 18px;
  margin: 0 9px -2px 0;
  background: var(--accent);
}
.upload-page ul { margin: 0; padding-left: 1.4em; }
.upload-page li + li { margin-top: 6px; }
.upload-page strong { color: #fff; }

/* 横向き（またはタブレット以上の幅）は、一覧へ早く到達できる密度にする。 */
@media (orientation: landscape), (min-width: 769px) {
  .engine-discovery { padding-top: 12px; }
  .discovery-heading,
  .discovery-lead { display: none; }
  .discovery-section { margin-bottom: 12px; }
  .section-heading { margin-bottom: 6px; }
  .section-title { font-size: 15px; }
  .section-title::before { height: 14px; margin-right: 6px; }

  .engine-rail {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .engine-rail::-webkit-scrollbar { display: none; }

  /* Portraitの nth-child 非表示指定より詳細度を上げ、5台目以降も表示する。 */
  .engine-rail .discovery-thumb,
  .engine-rail .discovery-thumb:nth-child(n + 5) {
    display: block;
    flex: 0 0 clamp(78px, 8.5vw, 112px);
    aspect-ratio: 1 / 1;
  }

  .filter-panel { margin-bottom: 12px; }
  .filter-panel summary { padding: 9px 12px; font-size: 14px; }
}

/* 高さが特に限られる横向き端末（Galaxy A54等）は、一覧への到達を優先する。 */
@media (orientation: landscape) and (max-height: 420px) {
  .engine-rail .discovery-thumb,
  .engine-rail .discovery-thumb:nth-child(n + 5) {
    flex-basis: clamp(70px, 8vw, 78px);
  }
}
