:root {
  --market-bg: #08090c;
  --market-surface: #111720;
  --market-surface-raised: #171e29;
  --market-surface-muted: #0d1219;
  --market-ink: #f3f6fa;
  --market-muted: #96a1b0;
  --market-line: #273242;
  --market-line-soft: #1d2632;
  --market-accent: #00d8ee;
  --market-accent-soft: rgba(0, 216, 238, .12);
  --market-green: #35c995;
  --market-gold: #d6a94a;
  --market-coral: #ed7968;
}

* { box-sizing: border-box; }
html { background: var(--market-bg); }
body { margin: 0; min-height: 100vh; color: var(--market-ink); background: var(--market-bg); font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }

.market-header { height: 68px; border-bottom: 1px solid var(--market-line-soft); background: #0b0f15; }
.market-header-inner { width: min(1480px, calc(100vw - 48px)); height: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.market-header-left { display: flex; align-items: center; min-width: 0; }
.market-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.market-brand img { width: 66px; height: 42px; object-fit: contain; }
.market-nav { display: flex; align-items: center; gap: 4px; margin-left: 30px; }
.market-nav a { min-height: 36px; display: inline-flex; align-items: center; padding: 0 13px; border-radius: 6px; color: #97a2b1; font-size: 13px; font-weight: 700; text-decoration: none; }
.market-nav a:hover, .market-nav a.active { color: var(--market-ink); background: var(--market-surface-raised); }
.market-main { width: min(1480px, calc(100vw - 48px)); margin: 0 auto; padding: 28px 0 42px; }
.market-intro { display: block; }
.market-intro-copy { padding: 5px 0; }
.market-eyebrow { margin: 0 0 8px; color: var(--market-accent); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.market-intro h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.2; }
.market-intro-copy > p:last-child { margin: 0; color: var(--market-muted); font-size: 13px; line-height: 1.65; }
.market-toolbar { margin-top: 23px; display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 10px; }
.market-search, .market-filter { min-height: 44px; display: flex; align-items: center; border: 1px solid var(--market-line); border-radius: 7px; background: var(--market-surface-muted); }
.market-search { gap: 9px; padding: 0 13px; }
.market-search img { width: 16px; height: 16px; opacity: .55; filter: invert(80%); }
.market-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--market-ink); background: transparent; font-size: 13px; }
.market-search input::placeholder { color: #657183; }
.market-filter { justify-content: space-between; gap: 7px; padding: 0 11px; color: #8995a5; font-size: 11px; font-weight: 700; }
.market-filter select, .market-sort select { min-width: 0; border: 0; outline: 0; color: var(--market-ink); background: transparent; font-size: 12px; font-weight: 800; }
.market-filter select option, .market-sort select option { color: #10151d; background: #fff; }
.market-category-row { min-height: 58px; display: flex; align-items: center; gap: 7px; border-bottom: 1px solid var(--market-line-soft); overflow-x: auto; }
.category-chip { min-height: 32px; flex: 0 0 auto; border: 1px solid transparent; border-radius: 6px; padding: 0 11px; color: #8c98a8; background: transparent; font-size: 12px; font-weight: 700; }
.category-chip:hover { color: var(--market-ink); background: var(--market-surface-raised); }
.category-chip.active { border-color: rgba(0, 216, 238, .3); color: var(--market-accent); background: var(--market-accent-soft); }
.market-result-count { margin-left: auto; padding-left: 12px; color: #6d7a8b; font-size: 11px; white-space: nowrap; }
.market-section-head { min-height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.market-section-head h2 { margin: 0; font-size: 17px; }
.market-section-head p { margin: 4px 0 0; color: #758193; font-size: 11px; }
.market-sort { display: inline-flex; align-items: center; gap: 8px; color: #758193; font-size: 11px; white-space: nowrap; }

.pack-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pack-card { min-width: 0; min-height: 286px; display: grid; grid-template-columns: 122px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--market-line); border-radius: 8px; background: var(--market-surface); transform: translateY(0) scale(1); transform-origin: center; transition: transform 460ms cubic-bezier(.65, 0, .35, 1), border-color 460ms cubic-bezier(.65, 0, .35, 1), box-shadow 460ms cubic-bezier(.65, 0, .35, 1); }
.pack-card:hover, .pack-card:focus-within { position: relative; z-index: 1; border-color: rgba(0,216,238,.48); box-shadow: 0 18px 38px rgba(0,0,0,.28), 0 0 0 1px rgba(0,216,238,.08); transform: translateY(-3px) scale(1.018); }
.pack-cover { position: relative; min-height: 286px; overflow: hidden; border-right: 1px solid var(--market-line); }
.pack-cover::before, .pack-cover::after { content: ""; position: absolute; }
.pack-cover::after { left: 15px; right: 15px; bottom: 22px; height: 1px; background: rgba(255,255,255,.24); box-shadow: 0 -34px 0 rgba(255,255,255,.11), 0 -68px 0 rgba(255,255,255,.07); }
.cover-camera::before { inset: 0; background: repeating-linear-gradient(145deg, transparent 0 15px, rgba(0,216,238,.1) 15px 16px), #10232a; }
.cover-person::before { inset: 0; background: radial-gradient(circle at 50% 34%, #d1b6a2 0 17px, transparent 18px), radial-gradient(ellipse at 50% 72%, #35526a 0 39px, transparent 40px), #172029; }
.cover-commerce::before { inset: 0; background: linear-gradient(145deg, transparent 0 37%, rgba(214,169,74,.24) 37% 64%, transparent 64%), #211d18; }
.cover-story::before { inset: 0; background: repeating-linear-gradient(0deg, transparent 0 31px, rgba(235,115,95,.16) 31px 32px), repeating-linear-gradient(90deg, transparent 0 40px, rgba(235,115,95,.12) 40px 41px), #25191a; }
.cover-platform::before { inset: 0; background: radial-gradient(circle at 28% 30%, rgba(0,216,238,.34) 0 18px, transparent 19px), radial-gradient(circle at 71% 49%, rgba(53,201,149,.28) 0 23px, transparent 24px), #12201f; }
.cover-negative::before { inset: 0; background: repeating-linear-gradient(-45deg, rgba(235,115,95,.13) 0 2px, transparent 2px 16px), #211719; }
.pack-cover.has-cover::before { background-image: linear-gradient(180deg, rgba(4, 8, 12, .14), rgba(4, 8, 12, .76)), var(--cover-image); background-position: center; background-size: cover; }
.cover-code { position: absolute; z-index: 1; left: 14px; top: 14px; color: rgba(255,255,255,.62); font: 700 8px Arial; }
.pack-content { min-width: 0; display: flex; flex-direction: column; padding: 15px 15px 13px; }
.pack-content-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.pack-content h3 { margin: 0; font-size: 14px; line-height: 1.4; }
.pack-author { margin-top: 5px; color: #748092; font-size: 10px; }
.market-badge { min-height: 23px; display: inline-flex; align-items: center; padding: 0 7px; border-radius: 5px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.market-badge.free { color: #67d9ae; background: rgba(53,201,149,.11); }
.market-badge.paid { color: #e0b963; background: rgba(214,169,74,.12); }
.market-badge.installed { color: #62deeb; background: rgba(0,216,238,.11); }
.market-badge.update { color: #f28e7d; background: rgba(237,121,104,.12); }
.market-badge.featured { color: #f0ca73; background: rgba(214,169,74,.14); }
.pack-badges { display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.pack-summary { height: 38px; overflow: hidden; margin: 12px 0 10px; color: #99a5b4; font-size: 10px; line-height: 1.7; }
.pack-tags { display: flex; gap: 5px; overflow: hidden; }
.pack-tag { min-height: 21px; display: inline-flex; align-items: center; flex: 0 0 auto; border: 1px solid #2a3645; border-radius: 4px; padding: 0 6px; color: #808d9e; font-size: 9px; }
.pack-meta { display: flex; gap: 12px; margin-top: 11px; color: #697688; font-size: 10px; }
.pack-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 11px; border-top: 1px solid var(--market-line-soft); }
.pack-updated { color: #687587; font-size: 9px; white-space: nowrap; }
.pack-action { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(0,216,238,.44); border-radius: 6px; padding: 0 10px; color: #04191d; background: var(--market-accent); font-size: 10px; font-weight: 900; line-height: 1; text-align: center; text-decoration: none; white-space: nowrap; }
.pack-action:hover { filter: brightness(1.07); text-decoration: none; }
.pack-action:focus-visible { outline: 2px solid rgba(0,216,238,.68); outline-offset: 2px; }
.pack-action.secondary { border-color: #344253; color: #bdc9d4; background: #131b24; }
.pack-action.update { border-color: var(--market-coral); color: #32110d; background: var(--market-coral); }
.market-empty { margin: 0; padding: 48px 0; color: var(--market-muted); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .pack-card, .pack-card:hover, .pack-card:focus-within { transition: none; transform: none; }
}

.pack-dialog { width: min(900px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--market-line-strong, #354258); border-radius: 8px; color: var(--market-ink); background: #121822; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.pack-dialog::backdrop { background: rgba(3, 5, 8, .72); }
.pack-dialog-shell { padding: 21px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 15px; border-bottom: 1px solid var(--market-line-soft); }
.dialog-head h2 { margin: 0; font-size: 21px; }
.dialog-close { width: 32px; height: 32px; border: 1px solid var(--market-line); border-radius: 6px; color: #aab5c2; background: var(--market-surface-muted); font-size: 21px; line-height: 1; }
.dialog-summary { margin: 17px 0; color: #a4afbc; font-size: 13px; line-height: 1.7; }
.dialog-section { margin-top: 18px; }
.dialog-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dialog-section h3 { margin: 0; font-size: 13px; }
.dialog-section > h3 { margin-bottom: 9px; }
.dialog-section-head span { color: var(--market-muted); font-size: 10px; }
.dialog-info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dialog-info-card { min-width: 0; min-height: 68px; display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 11px 12px; border: 1px solid var(--market-line); border-radius: 6px; background: var(--market-surface-muted); }
.dialog-info-card > strong { color: #e8edf3; font-size: 14px; }
.dialog-info-label { color: #758294; font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.dialog-platform-info { grid-column: 1 / -1; min-height: 66px; }
.dialog-platform-list { display: flex; flex-wrap: wrap; gap: 6px; }
.dialog-platform-list span { min-height: 24px; display: inline-flex; align-items: center; border: 1px solid rgba(0,216,238,.24); border-radius: 5px; padding: 0 8px; color: #a8e9ef; background: var(--market-accent-soft); font-size: 10px; font-weight: 700; }
.dialog-rating { min-width: 0; display: flex; align-items: center; gap: 7px; }
.dialog-rating strong { color: #f0c767; font-size: 14px; }
.dialog-rating small { overflow: hidden; color: #798697; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.dialog-rating-stars { --rating-percent: 0%; position: relative; width: 70px; height: 14px; flex: 0 0 70px; overflow: hidden; color: #364150; font-size: 14px; line-height: 1; letter-spacing: 1px; }
.dialog-rating-stars::before, .dialog-rating-stars::after { content: "★★★★★"; position: absolute; inset: 0 auto auto 0; white-space: nowrap; }
.dialog-rating-stars::after { width: var(--rating-percent); overflow: hidden; color: var(--market-gold); }
.dialog-rating-stars.empty::after { display: none; }
.dialog-loading, .dialog-empty { color: var(--market-muted); font-size: 12px; }
.dialog-directory-section { min-width: 0; }
.dialog-directory-tools { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.dialog-preset-search { min-width: 0; flex: 1 1 360px; height: 34px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--market-line); border-radius: 6px; padding: 0 8px; background: var(--market-surface-muted); }
.dialog-preset-search:focus-within { border-color: rgba(0,216,238,.54); box-shadow: 0 0 0 2px rgba(0,216,238,.08); }
.dialog-preset-search img { width: 14px; height: 14px; opacity: .55; filter: invert(80%); }
.dialog-preset-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--market-ink); background: transparent; font-size: 11px; }
.dialog-preset-search input::placeholder { color: #657183; }
.dialog-search-clear { width: 22px; height: 22px; flex: 0 0 22px; border: 0; border-radius: 4px; color: #aab5c2; background: transparent; font-size: 18px; line-height: 1; }
.dialog-search-clear:hover, .dialog-search-clear:focus-visible { color: var(--market-ink); background: var(--market-surface-raised); }
.dialog-search-clear:focus-visible { outline: 2px solid rgba(0,216,238,.68); outline-offset: 1px; }
.dialog-directory-count { color: var(--market-muted); font-size: 10px; white-space: nowrap; }
.dialog-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: min(46vh, 480px); overflow: auto; padding: 0 3px 2px 0; }
.dialog-preset { min-width: 0; min-height: 76px; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 9px; align-items: start; padding: 10px 11px; border: 1px solid var(--market-line); border-radius: 6px; background: var(--market-surface-muted); }
.dialog-preset-index { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; color: var(--market-accent); background: var(--market-accent-soft); font-size: 10px; font-weight: 800; }
.dialog-preset strong { display: block; margin: 2px 0 5px; font-size: 12px; }
.dialog-preset p { display: -webkit-box; overflow: hidden; margin: 0; color: #9aa6b5; font-size: 11px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.dialog-preset em { color: var(--market-coral); font-size: 10px; font-style: normal; }
.dialog-actions { display: flex; align-items: stretch; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dialog-actions .pack-action { min-height: 38px; padding: 0 14px; font-size: 11px; }
.dialog-purchase-action { min-width: 112px; }
.market-toast { position: fixed; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); padding: 12px 14px; border: 1px solid #3a5561; border-radius: 7px; color: #d9f5f6; background: #102229; box-shadow: 0 16px 40px rgba(0,0,0,.4); font-size: 12px; line-height: 1.5; }

@media (max-width: 1040px) { .pack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .market-header, .market-header-inner { height: auto; }
  .market-header-inner { width: min(100% - 28px, 560px); flex-wrap: wrap; padding: 12px 0; }
  .market-nav { margin-left: 13px; }
  .market-nav a { padding: 0 8px; font-size: 11px; }
  .market-brand img { width: 54px; }
  .market-main { width: min(100% - 28px, 560px); padding-top: 20px; }
  .market-intro h1 { font-size: 26px; }
  .market-toolbar { grid-template-columns: 1fr; }
  .market-filter { min-height: 40px; }
  .market-category-row { margin-right: -14px; padding-right: 14px; }
  .market-result-count { margin-left: 0; }
  .market-section-head { align-items: flex-start; flex-direction: column; justify-content: center; gap: 7px; }
  .pack-grid { grid-template-columns: 1fr; }
  .pack-card, .pack-cover { min-height: 250px; }
  .pack-card { grid-template-columns: 112px minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .pack-dialog-shell { padding: 16px; }
  .dialog-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-platform-info, .dialog-rating-info { grid-column: 1 / -1; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .dialog-actions .pack-action { width: 100%; }
}
@media (max-width: 760px) {
  .dialog-presets { grid-template-columns: 1fr; }
}
