/* Detail page refinements: readable codes, screenshots and related games. */
.code-pill {
  color: #283b76 !important;
  background: #eaf0ff !important;
  border-color: #aebfff !important;
  font-weight: 800;
}
:root[data-theme="dark"] .code-pill {
  color: #e6f8ff !important;
  background: rgba(79, 112, 255, 0.2) !important;
  border-color: rgba(137, 164, 255, 0.45) !important;
}

.section-svg-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--primary);
  flex: none;
}
.section-svg-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.screenshot-head h2::before,
.related-section .section-head h2::before {
  display: none;
}
.screenshot-head h2,
.related-section .section-head h2 {
  gap: 7px;
}
.related-svg-icon { color: #f97362; }

.screenshot-section .gallery {
  columns: 2;
  column-gap: 8px;
}
.screenshot-section .gallery img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 8px;
  break-inside: avoid;
  aspect-ratio: auto;
  object-fit: contain;
  border: 2px solid transparent;
  border-radius: 8px;
  opacity: 0.84;
  transition: opacity 0.2s, border-color 0.2s, transform 0.28s, box-shadow 0.28s;
}
.screenshot-section .gallery img.active {
  opacity: 1;
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.2);
}
.screenshot-section .gallery img.is-portrait-shot {
  width: auto;
  height: 520px;
  max-width: 100%;
  margin-right: auto;
  margin-left: auto;
}
.screenshot-section .gallery img:hover {
  opacity: 1;
  border-color: rgba(99, 102, 241, 0.55);
  transform: scale(1.012);
}
:root[data-theme="light"] .screenshot-section .gallery img {
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.07);
}

.related-section {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.related-card {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #111827;
  isolation: isolate;
}
.related-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease, filter 0.3s ease;
}
.related-card::after {
  content: "";
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(180deg, transparent, rgba(7, 11, 20, 0.94));
  z-index: 1;
}
.related-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 10px 11px;
  color: #fff;
}
.related-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.related-meta {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.68);
}
.related-card:hover img {
  transform: scale(1.055);
  filter: brightness(1.08);
}
.related-card:hover {
  border-color: rgba(99, 102, 241, 0.55);
}

@media (max-width: 900px) {
  .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .related-section { padding: 14px; }
  .related-grid { gap: 8px; }
  .related-title { font-size: 12px; }
  .related-overlay { padding: 8px; }
  .related-meta { font-size: 10px; }
  .screenshot-section .gallery { gap: 6px; }
  .screenshot-section .gallery img.is-portrait-shot { height: 420px; }
}

body.detail-page {
  background: var(--bg);
}
body.detail-page .app-header {
  background: rgba(255, 255, 255, 0.92);
}

.detail-head {
  grid-template-columns: 528px minmax(0, 1fr);
}
.detail-head > * {
  min-width: 0;
}
.detail-title {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.detail-cover {
  aspect-ratio: 460 / 215;
  background: transparent;
}
.detail-cover img {
  object-fit: cover;
}
.download-box {
  width: 100%;
  max-width: none;
  padding: 20px;
  border-color: rgba(99, 102, 241, 0.42);
  box-shadow:
    0 14px 34px rgba(79, 70, 229, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.download-box-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}
.download-box-head > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.download-box-head span {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.download-box-head strong {
  color: var(--fg);
  font-size: 18px;
  line-height: 1.2;
}
.download-box-head small {
  color: var(--muted);
  font-size: 12px;
}
.download-box .dl-scan-hint {
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.08);
  font-size: 15px;
  letter-spacing: 0.01em;
}
.download-box .pan-list {
  gap: 12px;
}
.download-box .pan-option {
  min-height: 72px;
  padding: 16px 18px;
  border: 1px solid rgba(79, 70, 229, 0.46);
  border-radius: 15px;
  background:
    linear-gradient(100deg, rgba(99, 102, 241, 0.11), rgba(34, 211, 238, 0.035)),
    rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.download-box .pan-option:hover {
  transform: translateX(3px);
  border-color: rgba(99, 102, 241, 0.68);
  background:
    linear-gradient(100deg, rgba(99, 102, 241, 0.22), rgba(34, 211, 238, 0.07)),
    rgba(255, 255, 255, 0.055);
  box-shadow:
    0 10px 26px rgba(79, 70, 229, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.download-box .pan-option-name {
  gap: 10px;
  color: var(--fg);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.download-box .pan-service-icon {
  width: 26px !important;
  height: 26px !important;
  border-radius: 7px;
}
.download-box .pan-option .code-pill {
  padding: 4px 10px;
  border-color: #aebfff !important;
  background: #eaf0ff !important;
  color: #283b76 !important;
  font-size: 13.5px;
  font-weight: 800;
}
.download-box .pan-option-arrow {
  padding: 8px 14px;
  border: 1px solid #4338ca;
  border-radius: 999px;
  background: linear-gradient(135deg, #5145dc, #2563d9);
  box-shadow: 0 5px 14px rgba(67, 56, 202, 0.24);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
}
.download-box .pan-option:hover .pan-option-arrow {
  border-color: #3730a3;
  background: linear-gradient(135deg, #4338ca, #1d4ed8);
  color: #fff;
}
:root[data-theme="dark"] .download-box {
  background:
    radial-gradient(520px 120px at 10% 0%, rgba(99, 102, 241, 0.16), transparent 70%),
    linear-gradient(180deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.025));
}
:root[data-theme="dark"] .download-box .pan-option {
  background:
    linear-gradient(100deg, rgba(99, 102, 241, 0.16), rgba(34, 211, 238, 0.045)),
    rgba(255, 255, 255, 0.035);
}
:root[data-theme="dark"] .download-box .pan-option .code-pill {
  color: #6ee7d8;
}
:root[data-theme="light"] .download-box {
  background:
    radial-gradient(520px 120px at 10% 0%, rgba(99, 102, 241, 0.13), transparent 70%),
    linear-gradient(180deg, #fff, #f7f8ff);
  box-shadow: 0 14px 34px rgba(79, 70, 229, 0.09);
}
:root[data-theme="light"] .download-box .pan-option {
  background:
    linear-gradient(100deg, rgba(99, 102, 241, 0.12), rgba(34, 211, 238, 0.04)),
    #fff;
  box-shadow: 0 5px 16px rgba(30, 41, 59, 0.08);
}
:root[data-theme="light"] .download-box .pan-option:hover {
  background:
    linear-gradient(100deg, rgba(99, 102, 241, 0.14), rgba(34, 211, 238, 0.055)),
    #fff;
}

.comments-section {
  margin-top: 26px;
}
.comment-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.comment-section-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
}
.comment-section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.comment-title-icon {
  width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  color: #f08d74;
}
.comment-title-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.comment-count-pill {
  flex: none;
  padding: 6px 12px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.comment-panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.comment-composer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
}
.comment-composer-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  border: 2px solid rgba(99, 102, 241, 0.25);
}
.comment-composer-main {
  min-width: 0;
  flex: 1;
}
.comment-composer textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  line-height: 1.7;
  outline: none;
}
.comment-composer textarea:focus {
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.comment-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.comment-submit {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 9px 18px;
  box-shadow: none;
}
.comment-submit:hover {
  background: var(--primary-dark);
}

#comment-list {
  margin-top: 16px;
}
#comment-list .comment {
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}
#comment-list .comment:last-child {
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}
#comment-list .comment.is-reply {
  padding: 10px;
  margin: 8px 0 0;
  background: var(--bg-soft);
}
#comment-list .comment-replies {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}
.comment-empty {
  min-height: 310px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.comment-empty-art {
  width: 150px;
  color: #cbd5e1;
}
.comment-empty-art svg {
  width: 100%;
  height: auto;
  display: block;
}
.comment-empty-text {
  margin-top: 8px;
  font-size: 13px;
}
.comment-login-tip {
  border-color: var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
}

.dl-mobile-actions .btn-primary {
  width: 100%;
  justify-content: center;
}

@media (max-width: 560px) {
  body.detail-page {
    background: var(--bg);
  }
  .detail-meta {
    overflow-wrap: anywhere;
  }
  .download-box {
    overflow: hidden;
  }
  .download-box-head {
    align-items: flex-start;
  }
  .download-box-head small {
    display: none;
  }
  .pan-option {
    flex-wrap: wrap;
  }
  .pan-option-name {
    min-width: 0;
    flex: 1 1 150px;
  }
  .pan-option-arrow {
    flex: 1 1 100%;
    margin-left: 0;
    text-align: right;
  }
  .comment-section-head {
    align-items: flex-start;
  }
  .comment-section-head p {
    font-size: 12px;
  }
  .comment-panel {
    padding: 12px;
    border-radius: 14px;
  }
  .comment-composer {
    gap: 10px;
    padding: 12px;
  }
  .comment-composer-avatar {
    width: 32px;
    height: 32px;
  }
  .comment-composer textarea {
    min-height: 90px;
    padding: 11px 12px;
  }
  .comment-composer-actions {
    align-items: flex-end;
    flex-direction: column;
  }
  .comment-identity {
    align-self: flex-start;
  }
  .comment-submit {
    align-self: flex-end;
  }
  .comment-empty {
    min-height: 250px;
  }
  .comment-empty-art {
    width: 125px;
  }
}

@media (max-width: 1080px) {
  .detail-head {
    grid-template-columns: minmax(0, 1fr);
  }
  .download-box {
    max-width: none;
  }
}

/* 详情页暗色主题：覆盖详情专用的米白色样式，避免浅底配白字。 */
:root[data-theme="dark"] body.detail-page {
  color-scheme: dark;
  background:
    radial-gradient(900px 320px at 12% -80px, rgba(99, 102, 241, 0.14), transparent 68%),
    var(--bg);
  color: var(--fg);
}
:root[data-theme="dark"] body.detail-page .app-header {
  background: rgba(21, 26, 36, 0.96);
  border-bottom-color: var(--border);
}
:root[data-theme="dark"] .comment-count-pill {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.14);
  color: #a5b4fc;
}
:root[data-theme="dark"] .comment-panel {
  border-color: var(--border);
  background: var(--card);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}
:root[data-theme="dark"] .comment-composer {
  border-color: var(--border);
  background: var(--bg-soft);
}
:root[data-theme="dark"] .comment-composer-avatar {
  border-color: rgba(99, 102, 241, 0.35);
}
:root[data-theme="dark"] .comment-composer textarea {
  border-color: var(--border);
  background: var(--card);
  color: var(--fg);
}
:root[data-theme="dark"] .comment-composer textarea::placeholder {
  color: var(--muted);
}
:root[data-theme="dark"] .comment-composer textarea:focus {
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
:root[data-theme="dark"] #comment-list .comment {
  border-color: var(--border);
  background: var(--card);
}
:root[data-theme="dark"] #comment-list .comment:last-child {
  border-bottom-color: var(--border);
}
:root[data-theme="dark"] #comment-list .comment.is-reply {
  background: var(--bg-soft);
}
:root[data-theme="dark"] #comment-list .comment-replies {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.025);
}
:root[data-theme="dark"] .comment-empty {
  color: var(--muted);
  border-top-color: var(--border);
}
:root[data-theme="dark"] .comment-empty-art {
  color: #596579;
}
:root[data-theme="dark"] .comment-login-tip {
  border-color: var(--border);
  background: var(--bg-soft);
}

@media (max-width: 560px) {
  :root[data-theme="dark"] body.detail-page {
    background:
      radial-gradient(600px 220px at 20% -60px, rgba(99, 102, 241, 0.12), transparent 70%),
      var(--bg);
  }
}

html[data-brand="77"] body.detail-page {
  background-color: transparent;
}
