/* ===== Detail Page Styles ===== */

.detail-back {
    margin-bottom: 20px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

/* Detail Content（仅独立 detail.html，避免污染首页内嵌商店） */
body.detail-standalone .detail-content {
    padding: 32px;
    min-height: calc(100vh - 240px);
    overflow-y: auto;
}

/*
   Detail page uses `.app-store-content` container but does NOT have a sidebar.
   Override the store layout (flex + fixed height) from `css/style.css` to avoid broken layout.
*/
body.detail-standalone .app-store-content.detail-content {
    display: block;
    height: auto;
    min-height: calc(100vh - 240px);
    overflow: visible;
    background: white;
}

/* 首页商店内嵌详情：不受上面对 .detail-content 的全局 min-height/overflow 影响 */
#storeDetailStack .store-detail-scroll.detail-content,
#storeDetailStack .store-detail-inner.detail-content {
    padding: 0 0 28px;
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

#storeDetailStack.store-detail-embed {
    min-height: 0;
    position: relative;
}

#storeDetailStack.store-detail-embed .store-detail-scroll {
    min-height: 0;
}

/* Detail Header：小图标 + 右侧 2～3 行（标题+获取 / 分类·副标题 / 大小·版本） */
.detail-header {
    display: flex;
    align-items: center;
    gap: clamp(14px, 2.2vw, 22px);
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.detail-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

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

.detail-icon:has(> img) {
    background: #ffffff;
}

.detail-info {
    flex: 1;
    min-width: 0;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 标题与「获取」同一视觉行、紧挨名称（非整行两端对齐）；长名称可换行 */
.detail-title-row {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
}

.detail-name {
    display: inline;
    margin: 0;
    padding: 0;
    font-size: clamp(20px, 2.1vw, 26px);
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -0.03em;
    vertical-align: middle;
}

.detail-title-row .download-btn--get {
    display: inline-flex;
    margin: 0 0 0 10px;
    vertical-align: middle;
}

.detail-tagline {
    font-size: 12px;
    color: #6e6e73;
    margin: 0;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.detail-tagline:empty {
    display: none;
}

/* 大小 / 版本：同一行内联，接近 App Store 信息密度 */
.detail-meta-shelf {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 2px;
    margin-top: 2px;
    padding-top: 0;
    border-top: none;
}

.detail-meta-pair {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    flex-wrap: wrap;
    min-width: 0;
}

.detail-meta-dot {
    color: #aeaeb2;
    font-weight: 500;
    padding: 0 6px;
    user-select: none;
}

.detail-meta-label {
    font-size: 11px;
    font-weight: 600;
    color: #6e6e73;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

html[lang="en"] .detail-meta-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-meta-value {
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #007aff;
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.download-btn:hover {
    background: #0071e3;
}

/* App Store 风格「获取」：小号胶囊按钮 */
.download-btn--get {
    margin-top: 4px;
    padding: 5px 22px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    min-height: 28px;
    line-height: 1.2;
    box-shadow: none;
}

.download-btn--get:hover {
    opacity: 0.92;
    background: #007aff;
}

.detail-downloads {
    margin-top: 4px;
    font-size: 12px;
    color: #86868b;
}

/* Detail Sections */
.detail-section {
    margin-bottom: 28px;
}

.detail-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f2;
}

.detail-text {
    font-size: 15px;
    line-height: 1.6;
    color: #1d1d1f;
}

.detail-rich img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.detail-rich a {
    color: #0071e3;
}

/* 截图：默认栅格（其它页面若复用） */
.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* 商店详情：横向紧凑滚动，接近 App Store 大卡 */
#storeDetailStack .screenshots-grid,
body.detail-standalone .screenshots-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 8px;
    margin: 0 -2px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

#storeDetailStack .screenshot-item,
body.detail-standalone .screenshot-item {
    flex: 0 0 auto;
    width: min(46vw, 400px);
    max-width: 400px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    scroll-snap-align: start;
    background: #f5f5f7;
    cursor: pointer;
}

#storeDetailStack .screenshot-item:focus-visible,
body.detail-standalone .screenshot-item:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 3px;
}

#storeDetailStack .screenshot-item:hover,
body.detail-standalone .screenshot-item:hover {
    transform: none;
}

#storeDetailStack .screenshot-item img,
body.detail-standalone .screenshot-item img {
    width: 100%;
    height: clamp(160px, 22vw, 220px);
    display: block;
    object-fit: cover;
}

.screenshot-item {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* What's New & Requirements */
.whatsnew-content,
.requirements-list {
    background: #f5f5f7;
    padding: 20px;
    border-radius: 12px;
}

.whatsnew-content p,
.requirements-list p {
    font-size: 14px;
    color: #1d1d1f;
    margin-bottom: 8px;
}

.whatsnew-content .detail-rich,
.requirements-list .detail-rich {
    font-size: 14px;
    line-height: 1.6;
    color: #1d1d1f;
}

.whatsnew-content ul {
    margin: 12px 0 0 20px;
    font-size: 14px;
    color: #1d1d1f;
}

.whatsnew-content li {
    margin-bottom: 6px;
}

/* Reviews */
.reviews-list {
    margin-bottom: 32px;
}

.review-item {
    background: #f5f5f7;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.review-name {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 15px;
}

.review-rating {
    color: #ff9500;
    font-size: 14px;
}

.review-text {
    font-size: 14px;
    color: #1d1d1f;
    line-height: 1.5;
}

/* Review Form */
.review-form {
    background: #f5f5f7;
    padding: 24px;
    border-radius: 12px;
}

.review-form h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d1d1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007aff;
}

.rating-input {
    display: flex;
    gap: 8px;
}

.rating-input .star {
    font-size: 24px;
    cursor: pointer;
    color: #d1d1d1;
    transition: color 0.2s;
}

.rating-input .star.active,
.rating-input .star:hover {
    color: #ff9500;
}

.submit-btn {
    background: #007aff;
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-btn:hover {
    background: #0051d5;
}

/* Responsive */
@media (max-width: 768px) {
    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .detail-meta {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .screenshots-grid {
        grid-template-columns: 1fr;
    }
}

/* 首页商店列表/详情栈布局见 style.css（避免此处 display:flex 覆盖 [hidden]） */

.store-detail-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -4px 0 12px;
    padding-bottom: 10px;
    position: sticky;
    top: 0;
    z-index: 4;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.store-detail-toolbar-spacer {
    flex: 1;
}

.store-detail-back-btn,
.store-detail-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: #1d1d1f;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.store-detail-back-btn:hover,
.store-detail-share-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.store-detail-back-btn:focus-visible,
.store-detail-share-btn:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

/* -------------------------------------------------------------------------- */
/* 截图全屏预览（对齐 App Store：顶栏 + 大图 contain + 左右切图）              */
/* -------------------------------------------------------------------------- */

.mm-screenshot-lightbox[hidden] {
    display: none !important;
}

/* 默认：挂在详情容器内（不盖住首页左侧栏、不占满浏览器） */
.mm-screenshot-lightbox:not([hidden]) {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 40;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* 兜底：无可用挂载点时仍用全屏（理论上不应触发） */
.mm-screenshot-lightbox.mm-screenshot-lightbox--global:not([hidden]) {
    position: fixed;
    z-index: 9500;
}

.mm-shot-lb__shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #f6f6f8;
    color: #1d1d1f;
}

.mm-screenshot-lightbox.mm-screenshot-lightbox--global .mm-shot-lb__shell {
    min-height: 100dvh;
    min-height: 100vh;
}

.mm-shot-lb__toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-height: 52px;
    padding: 8px 14px 10px;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.mm-shot-lb__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: #1d1d1f;
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.mm-shot-lb__back:hover {
    background: rgba(0, 0, 0, 0.1);
}

.mm-shot-lb__back:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

.mm-shot-lb__brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.mm-shot-lb__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #e8e8ed;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #6e6e73;
}

.mm-shot-lb__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mm-shot-lb__title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mm-shot-lb__toolbar-fill {
    flex: 1;
    min-width: 8px;
}

.mm-shot-lb__iap {
    font-size: 13px;
    color: #6e6e73;
    margin-right: 4px;
    white-space: nowrap;
}

.mm-shot-lb__toolbar .mm-shot-lb__get.download-btn--get {
    margin-top: 0;
    padding: 6px 20px;
    min-height: 30px;
    flex-shrink: 0;
}

.mm-shot-lb__stage {
    /* 1 1 0%：占满顶栏下剩余高度，避免 align-items:center 把 img-wrap 收成「内容高度」导致超高图撑破区域 */
    flex: 1 1 0%;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 6px;
    padding: 18px 12px 24px;
    overflow: hidden;
}

.mm-shot-lb__nav {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(60, 60, 67, 0.74);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.mm-shot-lb__nav:hover:not(:disabled) {
    color: #1d1d1f;
    background: rgba(0, 0, 0, 0.05);
}

.mm-shot-lb__nav:focus-visible {
    outline: 2px solid #007aff;
    outline-offset: 2px;
}

.mm-shot-lb__nav:disabled {
    display: none;
}

.mm-shot-lb__img-wrap {
    flex: 1 1 0%;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* 截图外的浅灰衬底：整块圆角（与 App Store 大图底座一致） */
    background: #e8e8ed;
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* 全屏兜底：相对视口限制 */
.mm-screenshot-lightbox.mm-screenshot-lightbox--global .mm-shot-lb__img-wrap {
    max-width: min(92vw, 1680px);
    max-height: min(86vh, 1200px);
    max-height: min(86dvh, 1200px);
}

.mm-shot-lb__img {
    display: block;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    background: #fff;
}

/* 内嵌详情：大图不超出右侧详情区域（随容器缩放，仍设像素上限） */
.mm-screenshot-lightbox:not(.mm-screenshot-lightbox--global) .mm-shot-lb__img-wrap {
    max-width: 100%;
}

.mm-screenshot-lightbox:not(.mm-screenshot-lightbox--global) .mm-shot-lb__img {
    max-width: min(100%, 1680px);
    max-height: 100%;
    width: auto;
    height: auto;
}

.mm-screenshot-lightbox.mm-screenshot-lightbox--global .mm-shot-lb__img {
    max-width: 100%;
    max-height: min(86vh, 1200px);
    max-height: min(86dvh, 1200px);
}

@media (max-width: 600px) {
    .mm-screenshot-lightbox.mm-screenshot-lightbox--global .mm-shot-lb__img-wrap {
        max-width: min(96vw, 1680px);
    }

    .mm-shot-lb__nav {
        width: 40px;
        height: 40px;
    }
}

