feat(store): cache official media and autoplay pack demos
Cache allowlisted official media so the in-game browser can load it locally. Match the official catalog snapshot and start pack demos muted and looping on entry.
This commit is contained in:
1 parent
e4227bb8ba
commit
5c9204c031
14 files changed
+645
-140
No files matched your search
@@ -7,15 +7,15 @@ const T = {
|
||||
premiumOff: '未开通', premiumLeft: '剩余 {days} 天',
|
||||
tabPacks: '高级载具', tabEagles: '金鹰', tabPremium: '高级账户', tabRedeem: '兑换码',
|
||||
search: '搜索礼包或载具', allCountries: '所有国家', allRanks: '所有等级', rank: '{rank} 级',
|
||||
sort: '商品排序', sortBest: '默认排序', sortPriceAsc: '价格从低到高', sortPriceDesc: '价格从高到低',
|
||||
sort: '商品排序', sortBest: '最畅销', sortNewest: '最新上架', sortPriceAsc: '价格从低到高', sortPriceDesc: '价格从高到低',
|
||||
containsEagles: '{n} 金鹰', containsSilver: '{n} 银狮', containsPremium: '{days} 天高级账户',
|
||||
buy: '购买', freeBuy: '老福爷付过了', owned: '已拥有', pickAccount: '请先选择账号',
|
||||
redeem: '兑换', codePlaceholder: '输入兑换码', empty: '没有符合条件的商品',
|
||||
featured: '推荐礼包', viewPack: '查看礼包', related: '更多推荐', packPrice: '礼包价格',
|
||||
featured: '推荐礼包', bestSeller: '畅销', viewPack: '查看礼包', related: '更多推荐', packPrice: '礼包价格',
|
||||
includes: '礼包内容', back: '返回目录', bonusTitle: '高级载具权益',
|
||||
bonusText: '驾驶高级载具可在战斗中获得额外的研发点和银狮。',
|
||||
footer: '购买后关闭商城窗口,机库会自动刷新。',
|
||||
gallery: '礼包媒体', cover: '封面', screenshot: '截图 {index}', screenshotPending: '官方截图尚未加载', previousMedia: '上一项', nextMedia: '下一项',
|
||||
gallery: '礼包媒体', cover: '封面', screenshot: '截图 {index}', screenshotLoading: '正在加载官方截图…', screenshotUnavailable: '官方截图暂不可用,当前显示游戏载具图。', previousMedia: '上一项', nextMedia: '下一项',
|
||||
video: '演示视频', videoNumber: '演示视频 {index}', playVideo: '播放演示',
|
||||
videoLoading: '正在加载演示视频…', videoUnavailable: '暂时无法播放官方视频,可以继续浏览其他素材。',
|
||||
cart: '购物车', addCart: '加入购物车', inCart: '已在购物车', confirmPurchase: '确认购买',
|
||||
@@ -29,15 +29,15 @@ const T = {
|
||||
premiumOff: 'Inactive', premiumLeft: '{days} days left',
|
||||
tabPacks: 'Premium vehicles', tabEagles: 'Golden Eagles', tabPremium: 'Premium account', tabRedeem: 'Redeem code',
|
||||
search: 'Search packs or vehicles', allCountries: 'All nations', allRanks: 'All ranks', rank: 'Rank {rank}',
|
||||
sort: 'Sort products', sortBest: 'Default order', sortPriceAsc: 'Price: low to high', sortPriceDesc: 'Price: high to low',
|
||||
sort: 'Sort products', sortBest: 'Top sellers', sortNewest: 'Newest', sortPriceAsc: 'Price: low to high', sortPriceDesc: 'Price: high to low',
|
||||
containsEagles: '{n} Golden Eagles', containsSilver: '{n} Silver Lions', containsPremium: '{days} days of Premium Account',
|
||||
buy: 'Buy', freeBuy: '老福爷付过了', owned: 'Owned', pickAccount: 'Pick an account first',
|
||||
redeem: 'Redeem', codePlaceholder: 'Enter a code', empty: 'Nothing matches the filters',
|
||||
featured: 'Featured packs', viewPack: 'View pack', related: 'Explore other packs', packPrice: 'Pack price',
|
||||
featured: 'Featured packs', bestSeller: 'Top seller', viewPack: 'View pack', related: 'Explore other packs', packPrice: 'Pack price',
|
||||
includes: 'Pack contents', back: 'Back to catalog', bonusTitle: 'Premium bonuses',
|
||||
bonusText: 'Premium vehicles earn extra research points and Silver Lions in battle.',
|
||||
footer: 'Close the store window after buying to refresh the hangar.',
|
||||
gallery: 'Pack media', cover: 'Cover', screenshot: 'Screenshot {index}', screenshotPending: 'Official screenshot has not loaded', previousMedia: 'Previous item', nextMedia: 'Next item',
|
||||
gallery: 'Pack media', cover: 'Cover', screenshot: 'Screenshot {index}', screenshotLoading: 'Loading official screenshot…', screenshotUnavailable: 'The official screenshot is unavailable. Showing game artwork.', previousMedia: 'Previous item', nextMedia: 'Next item',
|
||||
video: 'Demo video', videoNumber: 'Demo video {index}', playVideo: 'Play demo',
|
||||
videoLoading: 'Loading demo video…', videoUnavailable: 'The official video is unavailable. You can still browse the other media.',
|
||||
cart: 'Cart', addCart: 'Add to cart', inCart: 'In cart', confirmPurchase: 'Confirm purchase',
|
||||
@@ -156,14 +156,24 @@ function renderCatalog() {
|
||||
$('packFilters').hidden = !isPacks;
|
||||
const sort = $('sortSelect').value;
|
||||
const filtered = $('countryFilter').value || $('rankFilter').value || $('searchInput').value.trim();
|
||||
renderFeatured($('featured'), isPacks && !filtered && sort === 'best' ? state.products : [], openProduct);
|
||||
|
||||
const items = state.products.filter((p) => p.kind === currentTab && (!isPacks || matchesPack(p)));
|
||||
if (isPacks && sort === 'priceAsc') items.sort((a, b) => a.gjnCostCents - b.gjnCostCents);
|
||||
if (isPacks && sort === 'priceDesc') items.sort((a, b) => b.gjnCostCents - a.gjnCostCents);
|
||||
const grid = $('grid');
|
||||
grid.replaceChildren(...items.map((item) => productCard(item, checkout, openProduct)));
|
||||
if (!items.length) grid.append(makeElement('p', 'empty', t('empty')));
|
||||
if (isPacks) sortPacks(items, sort);
|
||||
|
||||
const cards = items.map((item) => productCard(item, checkout, openProduct));
|
||||
if (isPacks && !filtered && sort === 'best' && items.length) {
|
||||
const featured = items.find((item) => item.id === 'wto_pack_f-4s') || items[0];
|
||||
cards.unshift(featuredBanner(featured, openProduct));
|
||||
}
|
||||
if (!cards.length) cards.push(makeElement('p', 'empty', t('empty')));
|
||||
$('grid').replaceChildren(...cards);
|
||||
}
|
||||
|
||||
function sortPacks(items, mode) {
|
||||
const ids = WtoUi.storeOrder(mode === 'newest' ? 'newest' : 'best');
|
||||
const positions = new Map(ids.map((id, index) => [id, index]));
|
||||
items.sort((a, b) => (positions.get(a.id) ?? ids.length) - (positions.get(b.id) ?? ids.length));
|
||||
if (mode === 'priceAsc') items.sort((a, b) => a.gjnCostCents - b.gjnCostCents);
|
||||
if (mode === 'priceDesc') items.sort((a, b) => b.gjnCostCents - a.gjnCostCents);
|
||||
}
|
||||
|
||||
function openProduct(product) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Image gallery and on-demand playback for public demo clips.
|
||||
// Images and demo clips for pack details.
|
||||
'use strict';
|
||||
|
||||
const galleryPlayers = new WeakMap();
|
||||
@@ -18,7 +18,7 @@ function galleryItems(product) {
|
||||
sources,
|
||||
}));
|
||||
screenshots.forEach((url, index) => {
|
||||
entries.push({ label: t('screenshot', { index: index + 1 }), image: () => WtoUi.tieredImg([url], [], ''), screenshot: true });
|
||||
entries.push({ label: t('screenshot', { index: index + 1 }), screenshot: url });
|
||||
});
|
||||
entries.push({ label: t('cover'), image: cover });
|
||||
if (product.vehicles && (videos.length || screenshots.length || product.vehicles.length > 1)) {
|
||||
@@ -29,11 +29,17 @@ function galleryItems(product) {
|
||||
return entries;
|
||||
}
|
||||
|
||||
function playStoreClip(stage, sources, poster, onReady, onUnavailable) {
|
||||
function playStoreClip(stage, sources, poster, autoplay, onReady, onUnavailable) {
|
||||
galleryPlayers.get(stage)?.();
|
||||
const video = document.createElement('video');
|
||||
video.controls = true;
|
||||
video.playsInline = true;
|
||||
if (autoplay) {
|
||||
video.autoplay = true;
|
||||
video.defaultMuted = true;
|
||||
video.muted = true;
|
||||
video.loop = true;
|
||||
}
|
||||
if (poster) video.poster = poster;
|
||||
const playable = sources.filter((url) => video.canPlayType(/\.webm(?:$|\?)/i.test(url) ? 'video/webm' : 'video/mp4'));
|
||||
let nextSource = 0;
|
||||
@@ -58,7 +64,7 @@ function playStoreClip(stage, sources, poster, onReady, onUnavailable) {
|
||||
return;
|
||||
}
|
||||
video.src = url;
|
||||
timer = setTimeout(attempt, 5500);
|
||||
timer = setTimeout(attempt, 23_000);
|
||||
void video.play().catch(() => {});
|
||||
}
|
||||
|
||||
@@ -72,18 +78,21 @@ function playStoreClip(stage, sources, poster, onReady, onUnavailable) {
|
||||
attempt();
|
||||
}
|
||||
|
||||
function appendGalleryImage(container, item, placeholder) {
|
||||
const image = item.image();
|
||||
if (item.screenshot && !image.naturalWidth) {
|
||||
const pending = makeElement('span', 'media-placeholder', placeholder);
|
||||
image.addEventListener('load', () => pending.remove(), { once: true });
|
||||
container.append(pending);
|
||||
}
|
||||
function appendScreenshot(container, item, loaded, eager = false) {
|
||||
const image = makeElement('img', 'gallery-screenshot');
|
||||
image.alt = eager ? item.label : '';
|
||||
image.loading = eager ? 'eager' : 'lazy';
|
||||
image.onload = () => {
|
||||
image.classList.add('ready');
|
||||
loaded(true);
|
||||
};
|
||||
image.onerror = () => loaded(false);
|
||||
image.src = item.screenshot;
|
||||
container.append(image);
|
||||
return image;
|
||||
}
|
||||
|
||||
function mountStoreGallery(root, product) {
|
||||
function mountStoreGallery(root, product, autoplay) {
|
||||
const items = galleryItems(product);
|
||||
root.innerHTML = '<div class="media-stage"></div><div class="media-navigation"><button type="button">‹</button>'
|
||||
+ '<div class="media-thumbs"></div><button type="button">›</button></div>'
|
||||
@@ -100,21 +109,43 @@ function mountStoreGallery(root, product) {
|
||||
|
||||
function showImage(item, showPlay) {
|
||||
stage.replaceChildren();
|
||||
const image = appendGalleryImage(stage, item, t('screenshotPending'));
|
||||
if (item.screenshot) {
|
||||
showScreenshot(item);
|
||||
return;
|
||||
}
|
||||
const image = item.image();
|
||||
image.loading = 'eager';
|
||||
image.alt = item.label;
|
||||
stage.append(image);
|
||||
if (!showPlay) return;
|
||||
const play = storeButton('media-play', '▶ ' + t('playVideo'));
|
||||
play.onclick = () => playItem(item);
|
||||
stage.append(play);
|
||||
}
|
||||
|
||||
function playItem(item) {
|
||||
function showScreenshot(item) {
|
||||
const gameArt = WtoUi.tieredImg([], productArtwork(product), '');
|
||||
gameArt.loading = 'eager';
|
||||
stage.append(gameArt);
|
||||
status.textContent = t('screenshotLoading');
|
||||
status.hidden = false;
|
||||
const image = appendScreenshot(stage, item, (ok) => {
|
||||
if (image.parentNode !== stage) return;
|
||||
if (ok) {
|
||||
gameArt.remove();
|
||||
status.hidden = true;
|
||||
} else {
|
||||
status.textContent = t('screenshotUnavailable');
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
function playItem(item, autoplay = false) {
|
||||
const image = stage.querySelector('img');
|
||||
const poster = image?.currentSrc || image?.getAttribute('src');
|
||||
status.textContent = t('videoLoading');
|
||||
status.hidden = false;
|
||||
playStoreClip(stage, item.sources, poster, () => { status.hidden = true; }, () => {
|
||||
playStoreClip(stage, item.sources, poster, autoplay, () => { status.hidden = true; }, () => {
|
||||
showImage(item, true);
|
||||
status.textContent = t('videoUnavailable');
|
||||
status.hidden = false;
|
||||
@@ -144,7 +175,13 @@ function mountStoreGallery(root, product) {
|
||||
button.setAttribute('aria-label', item.label);
|
||||
button.setAttribute('aria-pressed', 'false');
|
||||
button.title = item.label;
|
||||
appendGalleryImage(button, item, item.label);
|
||||
if (item.screenshot) {
|
||||
const label = makeElement('span', 'media-placeholder', item.label);
|
||||
button.append(label);
|
||||
appendScreenshot(button, item, (ok) => { if (ok) label.remove(); });
|
||||
} else {
|
||||
button.append(item.image());
|
||||
}
|
||||
if (item.sources) button.append(makeElement('span', 'thumb-play', '▶'));
|
||||
button.onclick = () => select(index, true);
|
||||
return button;
|
||||
@@ -162,4 +199,6 @@ function mountStoreGallery(root, product) {
|
||||
};
|
||||
nav.hidden = caption.hidden = items.length === 1;
|
||||
select(0, false, false);
|
||||
const initial = items[0];
|
||||
if (autoplay && initial.sources) playItem(initial, true);
|
||||
}
|
||||
@@ -51,12 +51,12 @@
|
||||
<input id="searchInput" type="search" data-label="search" />
|
||||
<select id="sortSelect" data-label="sort">
|
||||
<option value="best" data-t="sortBest"></option>
|
||||
<option value="newest" data-t="sortNewest"></option>
|
||||
<option value="priceAsc" data-t="sortPriceAsc"></option>
|
||||
<option value="priceDesc" data-t="sortPriceDesc"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<section class="featured" id="featured" hidden></section>
|
||||
<div class="grid" id="grid"></div>
|
||||
</section>
|
||||
<section class="detail" id="detail" hidden></section>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
.detail { padding: 23px 0 42px; }
|
||||
.detail-head { margin-bottom: 17px; }
|
||||
.detail-head h1 { margin: 6px 0 8px; font-size: clamp(28px, 4.1vw, 45px); line-height: 1.15; }
|
||||
.detail { padding: 18px 0 38px; }
|
||||
.detail-head { margin-bottom: 14px; }
|
||||
.detail-head h1 { margin: 5px 0 7px; font-size: clamp(27px, 3.5vw, 41px); line-height: 1.14; overflow-wrap: anywhere; }
|
||||
.detail-meta:empty { display: none; }
|
||||
.back { padding: 2px 0; border: 0; background: transparent; color: var(--accent); font-weight: 600; }
|
||||
.back:hover { text-decoration: underline; }
|
||||
.detail-grid { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(270px, 1fr); gap: 22px; align-items: start; }
|
||||
.detail-grid { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(250px, 1fr); gap: 20px; align-items: start; }
|
||||
.detail-main, .detail-grid > aside { min-width: 0; }
|
||||
|
||||
.gallery {
|
||||
padding: 8px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
background: #18252e;
|
||||
min-width: 0;
|
||||
padding-bottom: 5px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.media-stage {
|
||||
position: relative;
|
||||
@@ -18,24 +18,26 @@
|
||||
place-items: center;
|
||||
aspect-ratio: 16 / 9;
|
||||
overflow: hidden;
|
||||
border-radius: 5px;
|
||||
background: radial-gradient(ellipse, #314c5c, #101a22);
|
||||
border-radius: 4px;
|
||||
background: radial-gradient(ellipse, #405368, #182632);
|
||||
}
|
||||
.media-stage img, .media-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
|
||||
.media-stage video { background: #000; }
|
||||
.gallery-screenshot { visibility: hidden; }
|
||||
.gallery-screenshot.ready { visibility: visible; }
|
||||
.media-placeholder { color: var(--muted); text-align: center; }
|
||||
.media-thumb .media-placeholder { position: absolute; inset: 0; display: grid; place-items: center; padding: 3px; font-size: 12px; }
|
||||
.media-play {
|
||||
position: relative;
|
||||
min-height: 44px;
|
||||
padding: 8px 18px;
|
||||
border: 1px solid #b6f1e8;
|
||||
border-radius: 22px;
|
||||
background: #10292bea;
|
||||
color: #cff8f1;
|
||||
border: 1px solid #e0bf82;
|
||||
border-radius: 18px;
|
||||
background: #251f1be8;
|
||||
color: #ffe9bd;
|
||||
font-weight: 700;
|
||||
}
|
||||
.media-play:hover { background: #1c4d4e; }
|
||||
.media-play:hover { background: #463527; }
|
||||
.media-navigation { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: stretch; gap: 6px; margin-top: 8px; }
|
||||
.media-navigation > button {
|
||||
padding: 0;
|
||||
@@ -58,7 +60,7 @@
|
||||
border-radius: 5px;
|
||||
background: #283b48;
|
||||
}
|
||||
.media-thumb[aria-pressed="true"] { border-color: var(--accent); }
|
||||
.media-thumb[aria-pressed="true"] { border-color: var(--gold); }
|
||||
.media-thumb:focus-visible { outline-offset: -4px; }
|
||||
.media-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
|
||||
.thumb-play {
|
||||
@@ -71,15 +73,15 @@
|
||||
height: 28px;
|
||||
padding-left: 2px;
|
||||
border-radius: 50%;
|
||||
background: #112f32dc;
|
||||
color: var(--accent-hover);
|
||||
background: #382d22ec;
|
||||
color: var(--gold);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.media-caption { display: flex; justify-content: space-between; gap: 8px; padding: 7px 3px 0; color: var(--muted); font-size: 13px; }
|
||||
.media-position { white-space: nowrap; }
|
||||
.media-status { margin: 8px 3px 2px; color: #ffd5b3; font-size: 13px; }
|
||||
|
||||
.buy-panel { padding: 18px 18px 15px; border: 1px solid var(--line); border-top: 2px solid #679d93; border-radius: 9px; background: var(--surface); }
|
||||
.buy-panel { padding: 17px 17px 15px; border: 1px solid #546371; border-top: 2px solid #c0a570; border-radius: 5px; background: linear-gradient(#303c49, #23303d); }
|
||||
.detail-price { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 10px; padding-bottom: 14px; color: var(--muted); }
|
||||
.detail-price strong { color: var(--gold); font-size: 25px; }
|
||||
.detail-actions { display: grid; gap: 9px; }
|
||||
@@ -103,8 +105,8 @@
|
||||
margin-top: 18px;
|
||||
padding: 25px 26px;
|
||||
border: 1px solid #e1c38d;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(108deg, #e4cd98, #d1aa62 62%, #9b713c);
|
||||
border-radius: 5px;
|
||||
background: linear-gradient(108deg, #e6cf9b, #d7b474 62%, #a17948);
|
||||
color: #2e2214;
|
||||
}
|
||||
.bonus-art {
|
||||
@@ -124,7 +126,9 @@
|
||||
.bonus-copy h2 { margin: 0 0 6px; font-size: clamp(21px, 3vw, 29px); }
|
||||
.bonus-copy p { margin: 0; font-size: 15px; font-weight: 550; }
|
||||
|
||||
@media (max-width: 800px) {
|
||||
@media (max-width: 760px) {
|
||||
.detail-grid { grid-template-columns: minmax(0, 1fr); }
|
||||
.detail-main { display: contents; }
|
||||
.detail-grid > aside { grid-row: 2; }
|
||||
.bonus { margin-top: 0; }
|
||||
}
|
||||
@@ -61,6 +61,9 @@ function productCard(product, checkout, openProduct) {
|
||||
const open = storeButton('product-open');
|
||||
const art = makeElement('span', 'product-art');
|
||||
art.append(productImage(product));
|
||||
if (WtoUi.storeOrder('bestSellers').includes(product.id)) {
|
||||
art.append(makeElement('span', 'product-badge', t('bestSeller')));
|
||||
}
|
||||
const info = makeElement('span', 'product-info');
|
||||
info.append(makeElement('span', 'product-title', WtoUi.text(product.title)));
|
||||
if (product.unitName) {
|
||||
@@ -90,14 +93,7 @@ function recommendationTile(product, openProduct) {
|
||||
return tile;
|
||||
}
|
||||
|
||||
function renderFeatured(root, products, openProduct) {
|
||||
const [lead, ...more] = recommendedPacks(products);
|
||||
root.hidden = !lead;
|
||||
if (!lead) {
|
||||
root.replaceChildren();
|
||||
return;
|
||||
}
|
||||
root.setAttribute('aria-label', t('featured'));
|
||||
function featuredBanner(lead, openProduct) {
|
||||
const hero = storeButton('featured-hero');
|
||||
const { screenshots } = WtoUi.storeMedia(lead.id);
|
||||
const image = screenshots.length ? productScreenshot(lead, screenshots[0]) : productImage(lead);
|
||||
@@ -111,12 +107,12 @@ function renderFeatured(root, products, openProduct) {
|
||||
);
|
||||
hero.append(image, copy);
|
||||
hero.onclick = () => openProduct(lead);
|
||||
const tiles = makeElement('div', 'recommendation-list');
|
||||
tiles.append(...more.map((product) => recommendationTile(product, openProduct)));
|
||||
root.replaceChildren(hero, tiles);
|
||||
return hero;
|
||||
}
|
||||
|
||||
function renderPackDetail(root, product, checkout, products, openProduct, backToCatalog) {
|
||||
const autoplay = !root.firstElementChild || root.dataset.productId !== product.id;
|
||||
root.dataset.productId = product.id;
|
||||
root.innerHTML = '<header class="detail-head"><button type="button" class="back"></button><h1 tabindex="-1"></h1><div class="detail-meta"></div></header>'
|
||||
+ '<div class="detail-grid"><div class="detail-main"><section class="gallery"></section><section class="bonus" hidden></section></div>'
|
||||
+ '<aside><div class="buy-panel"><div class="detail-price"></div><div class="detail-actions"></div><div class="includes"></div></div>'
|
||||
@@ -126,7 +122,7 @@ function renderPackDetail(root, product, checkout, products, openProduct, backTo
|
||||
back.onclick = backToCatalog;
|
||||
root.querySelector('h1').textContent = WtoUi.text(product.title);
|
||||
if (product.unitName) root.querySelector('.detail-meta').append(vehicleMeta(product));
|
||||
mountStoreGallery(root.querySelector('.gallery'), product);
|
||||
mountStoreGallery(root.querySelector('.gallery'), product, autoplay);
|
||||
|
||||
const price = root.querySelector('.detail-price');
|
||||
price.append(makeElement('span', '', t('packPrice')), makeElement('strong', '', storePrice(product.gjnCostCents)));
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
--background: #111b23;
|
||||
--surface: #1c2933;
|
||||
--surface-raised: #243541;
|
||||
--line: #344753;
|
||||
--text: #f1f4f4;
|
||||
--muted: #b4c1c8;
|
||||
--accent: #83dfcf;
|
||||
--accent-hover: #adf1e4;
|
||||
--gold: #e6c681;
|
||||
--background: #222d39;
|
||||
--surface: #303e4d;
|
||||
--surface-raised: #3c4b5a;
|
||||
--line: #4a5b6a;
|
||||
--text: #f2f4f7;
|
||||
--muted: #bac7d2;
|
||||
--accent: #78d6e3;
|
||||
--accent-hover: #afeef5;
|
||||
--gold: #f0d396;
|
||||
--font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
html, body { margin: 0; }
|
||||
body {
|
||||
min-height: 100vh;
|
||||
background: radial-gradient(ellipse at 45% 0, #263845, var(--background) 540px);
|
||||
background: radial-gradient(ellipse at 50% 0, #455463, var(--background) 620px);
|
||||
color: var(--text);
|
||||
font: 15px/1.45 var(--font);
|
||||
}
|
||||
@@ -29,15 +29,16 @@ button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible
|
||||
outline-offset: 3px;
|
||||
}
|
||||
a { color: var(--accent); text-decoration: none; }
|
||||
.page { width: min(1280px, calc(100% - 64px)); margin: 0 auto; }
|
||||
.page { width: min(1248px, calc(100% - 56px)); margin: 0 auto; }
|
||||
|
||||
.store-header {
|
||||
min-height: 76px;
|
||||
min-height: 52px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
padding: 12px 0;
|
||||
padding: 8px 12px;
|
||||
background: #141e29;
|
||||
}
|
||||
.store-brand {
|
||||
display: inline-flex;
|
||||
@@ -46,17 +47,17 @@ a { color: var(--accent); text-decoration: none; }
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
font-size: 19px;
|
||||
font-size: 17px;
|
||||
font-weight: 650;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.store-mark {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
width: 31px;
|
||||
height: 31px;
|
||||
border: 1px solid #b99c65;
|
||||
border-radius: 9px;
|
||||
border-radius: 5px;
|
||||
background: #352e23;
|
||||
color: var(--gold);
|
||||
font-size: 14px;
|
||||
@@ -67,11 +68,13 @@ a { color: var(--accent); text-decoration: none; }
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 16px;
|
||||
min-width: 0;
|
||||
gap: 6px 12px;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
.balance { white-space: nowrap; }
|
||||
.account-strip select { max-width: min(230px, 100%); }
|
||||
.balance b { margin-left: 3px; color: var(--text); font-weight: 600; }
|
||||
.account-strip select, .filters select, .filters input, .redeem-row input {
|
||||
min-height: 38px;
|
||||
@@ -82,11 +85,11 @@ a { color: var(--accent); text-decoration: none; }
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.store-nav { display: flex; justify-content: space-between; gap: 10px 20px; border-bottom: 1px solid var(--line); }
|
||||
.store-nav { display: flex; justify-content: space-between; gap: 8px 16px; padding: 0 3px; border-bottom: 1px solid var(--line); }
|
||||
.tabs, .store-links { display: flex; align-items: center; gap: 8px; }
|
||||
.tabs { flex-wrap: wrap; }
|
||||
.tabs button {
|
||||
min-height: 48px;
|
||||
min-height: 56px;
|
||||
padding: 0 13px;
|
||||
border: 0;
|
||||
border-bottom: 2px solid transparent;
|
||||
@@ -96,25 +99,25 @@ a { color: var(--accent); text-decoration: none; }
|
||||
}
|
||||
.tabs button:hover, .tabs button[aria-pressed="true"] { color: var(--accent); }
|
||||
.tabs button[aria-pressed="true"] { border-color: var(--accent); }
|
||||
.store-links { gap: 16px; padding-bottom: 6px; white-space: nowrap; }
|
||||
.store-links { gap: 15px; white-space: nowrap; }
|
||||
.cart-link {
|
||||
min-height: 38px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
padding: 4px 10px;
|
||||
border: 1px solid #518477;
|
||||
border-radius: 6px;
|
||||
background: #233e40;
|
||||
border: 1px solid #5c8b9b;
|
||||
border-radius: 4px;
|
||||
background: #283e4e;
|
||||
color: var(--accent-hover);
|
||||
font-weight: 650;
|
||||
}
|
||||
.cart-link:hover:not(:disabled) { background: #305453; }
|
||||
.cart-link:hover:not(:disabled) { background: #35566a; }
|
||||
.cart-link b {
|
||||
min-width: 22px;
|
||||
padding: 1px 5px;
|
||||
border-radius: 12px;
|
||||
background: #132a2c;
|
||||
background: #172c3a;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -139,23 +142,24 @@ a { color: var(--accent); text-decoration: none; }
|
||||
box-shadow: 8px 0 currentColor;
|
||||
}
|
||||
|
||||
.catalog-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; padding: 24px 0 18px; }
|
||||
.catalog-head h1, .redeem h1 { margin: 0; font-size: clamp(25px, 3vw, 34px); line-height: 1.2; }
|
||||
.filters { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; }
|
||||
.filters input { width: clamp(150px, 21vw, 245px); }
|
||||
.catalog-head { display: grid; gap: 11px; padding: 18px 0; }
|
||||
.catalog-head h1, .redeem h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); line-height: 1.2; }
|
||||
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 7px 0; border-block: 1px solid var(--line); font-size: 13px; }
|
||||
.filters input { width: clamp(130px, 22vw, 270px); }
|
||||
.filters input::placeholder { color: var(--muted); }
|
||||
.filters #sortSelect { margin-left: auto; }
|
||||
|
||||
.featured { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr); gap: 14px; margin-bottom: 24px; }
|
||||
.featured-hero {
|
||||
position: relative;
|
||||
min-height: 260px;
|
||||
grid-column: span 2;
|
||||
min-height: 275px;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
overflow: hidden;
|
||||
padding: 24px;
|
||||
border: 1px solid #617987;
|
||||
border-radius: 10px;
|
||||
background: #263c4a;
|
||||
border-radius: 5px;
|
||||
background: #2b4051;
|
||||
text-align: left;
|
||||
isolation: isolate;
|
||||
}
|
||||
@@ -165,16 +169,14 @@ a { color: var(--accent); text-decoration: none; }
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
inset: 0;
|
||||
background: linear-gradient(88deg, #111e29ee 3%, #14212cbb 34%, transparent 76%),
|
||||
linear-gradient(0deg, #101c26cc, transparent 66%);
|
||||
background: linear-gradient(86deg, #131c2be8 4%, #263344aa 36%, transparent 75%),
|
||||
linear-gradient(0deg, #101a27dc, transparent 64%);
|
||||
}
|
||||
.featured-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
|
||||
.featured-label { color: var(--gold); font-size: 13px; font-weight: 650; }
|
||||
.featured-title { max-width: 540px; font-size: clamp(25px, 3.4vw, 42px); line-height: 1.13; overflow-wrap: anywhere; }
|
||||
.featured-link { margin-top: 6px; color: var(--accent-hover); font-weight: 650; }
|
||||
.featured-hero:hover .featured-link { text-decoration: underline; }
|
||||
.recommendation-list { display: grid; grid-auto-rows: 1fr; gap: 9px; }
|
||||
.recommendation-list:empty { display: none; }
|
||||
.recommendation-tile {
|
||||
display: grid;
|
||||
grid-template-columns: min(38%, 132px) minmax(0, 1fr);
|
||||
@@ -184,7 +186,7 @@ a { color: var(--accent); text-decoration: none; }
|
||||
padding: 0 12px 0 0;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
border-radius: 5px;
|
||||
background: var(--surface);
|
||||
text-align: left;
|
||||
}
|
||||
@@ -193,20 +195,22 @@ a { color: var(--accent); text-decoration: none; }
|
||||
.recommendation-copy { display: grid; gap: 4px; padding: 5px 0; overflow-wrap: anywhere; }
|
||||
.recommendation-copy > span { color: var(--gold); font-size: 13px; }
|
||||
|
||||
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding-bottom: 38px; }
|
||||
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding-bottom: 38px; }
|
||||
.product-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
border-radius: 5px;
|
||||
background: var(--surface);
|
||||
}
|
||||
.product-card:hover { border-color: #627e89; }
|
||||
.product-open { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; }
|
||||
.product-open:focus-visible { outline-offset: -3px; }
|
||||
.product-art { display: block; aspect-ratio: 2 / 1; background: radial-gradient(ellipse, #3b5563, #253947); }
|
||||
.product-art { position: relative; display: block; aspect-ratio: 16 / 9; background: radial-gradient(ellipse, #465866, #293b4a); }
|
||||
.product-art::after { content: ""; position: absolute; inset: auto 0 0; height: 24%; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
|
||||
.product-badge { position: absolute; z-index: 1; top: 10px; left: 10px; padding: 3px 8px; border: 1px solid #b28f5a; border-radius: 4px; background: #362f28f2; color: var(--gold); font-size: 12px; font-weight: 650; }
|
||||
.product-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
|
||||
.product-info { display: grid; gap: 6px; padding: 12px 13px 8px; }
|
||||
.product-title { font-size: 17px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
|
||||
@@ -214,12 +218,12 @@ a { color: var(--accent); text-decoration: none; }
|
||||
.product-meta img { width: 25px; height: 16px; object-fit: contain; }
|
||||
.product-meta .rank { padding: 1px 6px; border-radius: 4px; background: #ffffff13; color: var(--text); white-space: nowrap; }
|
||||
.product-rewards { color: var(--muted); font-size: 12px; }
|
||||
.card-price { margin-top: auto; padding: 10px 13px; color: var(--gold); font-size: 19px; font-weight: 650; }
|
||||
.card-price { margin-top: auto; padding: 10px 13px; color: var(--gold); font-size: 19px; font-weight: 650; text-align: right; }
|
||||
.card-actions { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.35fr); border-top: 1px solid var(--line); }
|
||||
.card-actions button { min-height: 41px; padding: 6px; border: 0; background: transparent; font-size: 14px; font-weight: 600; }
|
||||
.card-actions .card-buy { color: var(--accent); border-right: 1px solid var(--line); }
|
||||
.card-actions .card-add { color: var(--text); }
|
||||
.card-actions button:hover:not(:disabled), .card-actions .in-cart { background: #2a4649; }
|
||||
.card-actions .card-buy { color: var(--gold); border-right: 1px solid var(--line); }
|
||||
.card-actions .card-add { color: #e6edf0; }
|
||||
.card-actions button:hover:not(:disabled), .card-actions .in-cart { background: #415365; }
|
||||
.empty { grid-column: 1 / -1; color: var(--muted); }
|
||||
|
||||
.btn-main, .btn-outline {
|
||||
@@ -229,10 +233,10 @@ a { color: var(--accent); text-decoration: none; }
|
||||
border-radius: 6px;
|
||||
font-weight: 650;
|
||||
}
|
||||
.btn-main { background: var(--accent); color: #172925; }
|
||||
.btn-main:hover:not(:disabled) { background: var(--accent-hover); }
|
||||
.btn-outline { border-color: #697c85; background: transparent; color: var(--text); }
|
||||
.btn-outline:hover:not(:disabled), .btn-outline.in-cart { background: #2b4549; }
|
||||
.btn-main { border-color: #c47359; background: linear-gradient(#ad513c, #923e30); color: #fff; }
|
||||
.btn-main:hover:not(:disabled) { background: linear-gradient(#bc5f47, #a24937); }
|
||||
.btn-outline { border-color: #bca674; background: transparent; color: var(--gold); }
|
||||
.btn-outline:hover:not(:disabled), .btn-outline.in-cart { background: #3b4c5a; }
|
||||
|
||||
.notice { display: none; margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; }
|
||||
.notice.ok { display: block; background: #18362f; color: #b4eed9; }
|
||||
@@ -248,14 +252,21 @@ a { color: var(--accent); text-decoration: none; }
|
||||
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
||||
}
|
||||
|
||||
@media (max-width: 730px) {
|
||||
.store-header, .store-nav { flex-wrap: wrap; }
|
||||
@media (max-width: 880px) {
|
||||
.store-header { flex-wrap: wrap; gap: 7px 16px; }
|
||||
.account-strip { justify-content: flex-start; }
|
||||
.featured { grid-template-columns: minmax(0, 1fr); }
|
||||
.recommendation-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
||||
.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
|
||||
}
|
||||
|
||||
@media (max-width: 390px) {
|
||||
.grid, .recommendation-list { grid-template-columns: minmax(0, 1fr); }
|
||||
@media (max-width: 730px) {
|
||||
.store-nav { flex-wrap: wrap; }
|
||||
.store-links { padding-bottom: 7px; }
|
||||
.featured-hero { min-height: 215px; }
|
||||
.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
|
||||
}
|
||||
|
||||
@media (max-width: 410px) {
|
||||
.page { width: calc(100% - 24px); }
|
||||
.grid { grid-template-columns: minmax(0, 1fr); }
|
||||
.featured-hero { grid-column: 1; }
|
||||
.filters #sortSelect { margin-left: 0; }
|
||||
}
|
||||
Reference in new issue
Block a user