/* /mode-page.css — desktop 模式專屬頁 layout
 * v60-fervent-shaw (2026-05-02)
 * 配合 /mode-page.js + /mode.html
 */

main.mode-page {
  max-width: 1280px;
  margin: 32px auto 60px;
  padding: 24px 24px 0;
}

/* Phase 5 (2026-05-04 mtab-cinemagraph-v3): mode tabs 從 pill 改成跟首頁一樣
   的 cinemagraph orb (vertical orb + label)。
   - 4 顆 orb 全用 h5.home.mode.* slot 跟首頁共用同一張 PNG
   - cinemagraph 動畫只給 .is-active 那顆 (避免 4 顆都動 = noise + fps drop)
   - inactive 3 顆: 靜態 orb + hover 微 lift
   - 沒有 pill 方框包住 (用戶 feedback「完全被方框包住的」修正) */
.mode-page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  margin: 0 auto 22px;
  padding: 0;
  max-width: 720px;
}
.mode-page-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 6px;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: rgba(240, 253, 255, 0.78);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: transform 220ms ease, color 220ms ease;
  -webkit-tap-highlight-color: transparent;
}
.mode-page-tab__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  /* Transparent frame: the PNG is a sealed orb that IS the visual identity.
     We don't put a navy disc behind it (that would compete with the orb's
     own glass tint). */
  background: transparent;
  border: none;
  box-shadow: none;
  flex-shrink: 0;
  isolation: isolate;
}
.mode-page-tab__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* clip-path forces drop-shadow to follow the orb circle (so PNG corner
     residual alpha doesn't leak square halo) */
  clip-path: circle(50% at 50% 50%);
  -webkit-clip-path: circle(50% at 50% 50%);
  filter:
    drop-shadow(0 4px 8px rgba(2, 8, 18, 0.5))
    drop-shadow(0 0 8px rgba(34, 211, 238, 0.32));
  transition: filter 240ms ease, transform 240ms ease;
}
.mode-page-tab__name {
  display: inline-block;
  white-space: nowrap;
}

/* Hover: subtle lift + brighter halo (works on inactive AND active) */
.mode-page-tab:hover {
  transform: translateY(-2px);
  color: #f0fdff;
}
.mode-page-tab:hover .mode-page-tab__icon img {
  filter:
    drop-shadow(0 6px 10px rgba(2, 8, 18, 0.55))
    drop-shadow(0 0 14px rgba(34, 211, 238, 0.55));
}

/* Active: cinemagraph orb-life on the img (only 1 animated orb on page,
   inactive 3 stay static — fps-safe per cinemagraph-icon-design SKILL).
   Plus a breathing cyan halo behind the orb. */
.mode-page-tab.is-active .mode-page-tab__name {
  color: #74f5ff;
  text-shadow: 0 0 10px rgba(116, 245, 255, 0.55);
}
.mode-page-tab.is-active .mode-page-tab__icon img {
  animation: mode-tab-orb-life 5.2s ease-in-out infinite;
  will-change: transform, filter;
}
@keyframes mode-tab-orb-life {
  0%, 100% {
    transform: rotate(-2deg) scale(1);
    filter:
      drop-shadow(0 5px 10px rgba(2, 8, 18, 0.5))
      drop-shadow(0 0 12px rgba(34, 211, 238, 0.55))
      saturate(1.05) brightness(1) hue-rotate(-6deg);
  }
  50% {
    transform: rotate(2deg) scale(1.05);
    filter:
      drop-shadow(0 7px 14px rgba(2, 8, 18, 0.55))
      drop-shadow(0 0 18px rgba(34, 211, 238, 0.78))
      drop-shadow(0 0 6px rgba(167, 139, 250, 0.35))
      saturate(1.12) brightness(1.06) hue-rotate(6deg);
  }
}
/* Breathing cyan halo behind active orb */
.mode-page-tab.is-active .mode-page-tab__icon::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(34, 211, 238, 0.32) 0%,
    rgba(34, 211, 238, 0.14) 38%,
    transparent 68%
  );
  filter: blur(5px);
  animation: mode-tab-breathe 2.4s ease-in-out infinite;
  z-index: -1;
}
@keyframes mode-tab-breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50%      { transform: scale(1.12); opacity: 1; }
}

/* Reduced-motion users get the static premium look (no idle animation). */
@media (prefers-reduced-motion: reduce) {
  .mode-page-tab.is-active .mode-page-tab__icon img,
  .mode-page-tab.is-active .mode-page-tab__icon::before {
    animation: none !important;
  }
}

/* Mode hero header — v3 緊湊化 + topbar breathing room */
.mode-page-hero {
  position: relative;
  padding: 36px 28px 24px;
  margin-bottom: 14px;
  background:
    radial-gradient(circle at 20% 0%, rgba(34, 211, 238, 0.22), transparent 60%),
    linear-gradient(180deg, rgba(34, 211, 238, 0.12), rgba(15, 30, 68, 0.5));
  border: 1px solid rgba(116, 245, 255, 0.32);
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(2, 8, 18, 0.4), inset 0 1px 0 rgba(165, 243, 252, 0.15);
  text-align: center;
  isolation: isolate;
}
.mode-page-back {
  position: absolute;
  top: 14px; left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #74f5ff;
  text-decoration: none;
  background: rgba(15, 30, 68, 0.6);
  border: 1px solid rgba(116, 245, 255, 0.4);
  border-radius: 999px;
  transition: background 160ms ease, border-color 160ms ease;
}
.mode-page-back:hover {
  background: rgba(20, 40, 88, 0.85);
  border-color: rgba(116, 245, 255, 0.7);
}
.mode-page-back > span:first-child {
  font-size: 16px;
  line-height: 1;
}
.mode-page-hero__title {
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.mode-page-hero__title-zh {
  font-size: 32px;
  font-weight: 900;
  color: #f0fdff;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.65), 0 0 28px rgba(34, 211, 238, 0.5);
}
.mode-page-hero__title-en {
  font-size: 12px;
  font-weight: 700;
  color: #74f5ff;
  letter-spacing: 0.36em;
  opacity: 0.82;
}
.mode-page-hero__desc {
  margin: 6px auto;
  max-width: 760px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(240, 253, 255, 0.82);
  line-height: 1.55;
}
.mode-page-hero__count {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 18px;
  font-size: 12px;
  font-weight: 800;
  color: #052e16;
  background: linear-gradient(135deg, #67e8f9 0%, #22d3ee 100%);
  border-radius: 999px;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 14px rgba(34, 211, 238, 0.4);
}

/* 進入遊戲 CTA (tower / rpg only) */
.mode-page-hero__cta {
  margin-top: 18px;
}
.mode-game-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #1b0f42;
  text-decoration: none;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  border: 2px solid rgba(251, 191, 36, 0.85);
  border-radius: 999px;
  box-shadow:
    0 8px 26px rgba(251, 191, 36, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: transform 200ms ease, box-shadow 240ms ease, background-position 380ms ease;
}
.mode-game-cta:hover {
  transform: translateY(-2px);
  background-position: 100% 50%;
  box-shadow:
    0 14px 36px rgba(251, 191, 36, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.mode-game-cta:active {
  transform: translateY(0);
}

/* Pool grid (auto-fit, 卡片 min 220px / max 1fr) — 大螢幕 5 col, 一般 4 col */
.mode-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
@media (max-width: 720px) {
  .mode-page-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
}

/* Pool card (desktop variant) */
.mode-page-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(15, 30, 68, 0.78), rgba(10, 26, 62, 0.72));
  border: 1px solid rgba(103, 232, 249, 0.32);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(2, 8, 18, 0.45), inset 0 1px 0 rgba(165, 243, 252, 0.1);
  text-decoration: none;
  color: #f0fdff;
  transition: transform 200ms ease, box-shadow 240ms ease, border-color 200ms ease;
  isolation: isolate;
  overflow: hidden;
}
.mode-page-card:hover {
  transform: translateY(-3px);
  border-color: rgba(116, 245, 255, 0.65);
  box-shadow: 0 16px 36px rgba(34, 211, 238, 0.36), inset 0 1px 0 rgba(165, 243, 252, 0.28);
}
.mode-page-card--soldout {
  opacity: 0.55;
}
.mode-page-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, rgba(34, 211, 238, 0.18), transparent 70%),
    linear-gradient(180deg, rgba(10, 22, 51, 0.7), rgba(5, 10, 28, 0.6));
  border: 1px solid rgba(103, 232, 249, 0.18);
}

/* R501z Phase 2.2.3 (2026-05-27): admin tagBadges overlay on desktop /mode?type=X
   分類頁 cards. styles-home.css 也有相同 .pool-tag-list rule (homepage), 此處
   重複 OK (mode.html load 兩個). SENTINEL: r501z-mode-page-pool-tag-css-desktop */
.mode-page-card__media .pool-tag-list {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  max-height: calc(100% - 16px);
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
  pointer-events: none;
  z-index: 3;
}
.mode-page-card__media .pool-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.mode-page-card__media .pool-tag-chip__icon { font-size: 12px; line-height: 1; }
.mode-page-card__media .pool-tag-chip__text { line-height: 1.2; }
.mode-page-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mode-page-card__tag {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  color: #052e16;
  background: linear-gradient(135deg, #67e8f9, #22d3ee);
  border-radius: 999px;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 8px rgba(34, 211, 238, 0.5);
  z-index: 2;
}
.mode-page-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 6px 6px;
}
.mode-page-card__name {
  font-size: 13px;
  font-weight: 700;
  color: #f0fdff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.mode-page-card__price {
  align-self: flex-start;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 800;
  color: #052e16;
  background: linear-gradient(135deg, #67e8f9 0%, #22d3ee 100%);
  border-radius: 999px;
}

/* Empty state */
.mode-page-empty {
  margin: 48px 0;
  padding: 48px 24px;
  text-align: center;
  font-size: 15px;
  color: rgba(240, 253, 255, 0.65);
  background: rgba(15, 30, 68, 0.4);
  border: 1px dashed rgba(116, 245, 255, 0.28);
  border-radius: 18px;
}

/* ============================================================
 * v60-fervent-shaw v2: 分類分組 + Filter chips + Search
 * ============================================================ */

/* Phase 1 (2026-05-02): 移除 mode-page-search (跟頂部 topbar-search 重複)
   .mode-page-filters 簡化成只裝 chips, 不再 grid 2-col */
.mode-page-filters {
  position: sticky;
  top: 88px;
  z-index: 5;
  display: flex;
  align-items: center;
  padding: 8px 6px;
  margin: 0 0 14px;
  /* v5 (mtab-cinemagraph-v5b): owner mandate「分類跟全部 IP 這些東西啊
     它們底下好像還有一層東西包住他們全部人的方框 隱藏看看」—
     拿掉 wrapper 的 bg / border / box-shadow / backdrop-filter，讓 chips
     直接落在 page bg 上更乾淨。仍保留 sticky 不變。 */
}

.mode-page-chips {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
  /* v7: 右邊 fade-out mask 暗示可往右滑看到更多分類 */
  mask-image: linear-gradient(to right, black calc(100% - 32px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 32px), transparent 100%);
}
.mode-page-chips::-webkit-scrollbar { display: none; }
/* tower/rpg 模式 chip ≤ 1 個時 JS 設 [hidden]; 必加 !important 壓過 display:flex */
.mode-page-chips[hidden] { display: none !important; }
.mode-page-chip {
  flex-shrink: 0;
}
.mode-page-chip {
  /* v9 fix: 加粗 border 1px → 1.5px + 加 inner box-shadow 讓 tone 從內側發光
     原本 1px soft alpha 太淡看不出 admin 設的顏色差異 (user feedback「對齊嗎」). */
  --tone-stroke: #67e8f9;
  --tone-soft: rgba(103, 232, 249, 0.32);
  --tone-glow: rgba(103, 232, 249, 0.55);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(240, 253, 255, 0.9);
  background: rgba(15, 30, 68, 0.6);
  border: 1.5px solid var(--tone-soft);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 160ms ease, background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.mode-page-chip:hover {
  background: rgba(20, 40, 88, 0.78);
  border-color: var(--tone-stroke);
  transform: translateY(-1px);
}
.mode-page-chip em {
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  background: var(--tone-soft);
  color: var(--tone-stroke);
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.mode-page-chip.is-active {
  background: linear-gradient(135deg, var(--tone-stroke) 0%, color-mix(in srgb, var(--tone-stroke), #052e16 25%) 100%);
  border-color: rgba(255, 255, 255, 0.78);
  color: #0b1223;
  box-shadow: 0 6px 18px var(--tone-glow);
}
.mode-page-chip.is-active em {
  background: rgba(11, 18, 35, 0.2);
  color: #0b1223;
}

/* Group section (按分類) — v3 緊湊 */
.mode-page-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.mode-page-group {
  /* v7: tone vars injected per-group from JS based on admin iconKey */
  --tone-stroke: #67e8f9;
  --tone-soft: rgba(103, 232, 249, 0.16);
  --tone-glow: rgba(103, 232, 249, 0.45);
  position: relative;
}
.mode-page-group__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 2px 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--tone-soft);
}
.mode-page-group__head::before {
  content: '';
  flex-shrink: 0;
  display: inline-block;
  width: 4px;
  height: 22px;
  align-self: center;
  background: linear-gradient(180deg, var(--tone-stroke), color-mix(in srgb, var(--tone-stroke), #0b1223 35%));
  border-radius: 2px;
  box-shadow: 0 0 12px var(--tone-glow);
}
.mode-page-group__name {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: #f0fdff;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 18px rgba(34, 211, 238, 0.35);
  flex: 1;
}
.mode-page-group__count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  color: #0b1223;
  background: linear-gradient(135deg, var(--tone-stroke) 0%, color-mix(in srgb, var(--tone-stroke), #0b1223 25%) 100%);
  border-radius: 999px;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px var(--tone-glow);
}

/* ============================================================
 * Phase 2 (2026-05-02): Pool card 加血肉
 *  - Badges (新品/熱門/剩不多) top-right stack
 *  - Sold out 大字斜印 veil
 *  - Meta row (stock + 已售 progress)
 *  - Skeleton shimmer placeholders
 *  - Error state with retry button
 * ============================================================ */

/* Card badges (top-right stack, 不擋左上的 mode tag) */
.mode-page-card__badges {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
}
.mode-page-card__badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}
.mode-page-card__badge--new {
  background: linear-gradient(135deg, #67e8f9 0%, #06b6d4 100%);
  color: #052e16;
}
.mode-page-card__badge--hot {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #4a1a05;
}
.mode-page-card__badge--low {
  background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  color: #fff;
}
/* v20b: 多箱系列 indicator — 紫藍漸層 (series brand color)。
   user audit「我一番賞裡面不是有很多個箱子嗎」, 多箱系列要明顯標示。 */
.mode-page-card__badge--box {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* Sold out veil (大字斜印 stamp) */
.mode-page-card__veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 8, 18, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 3;
}
.mode-page-card__veil-text {
  display: inline-block;
  padding: 10px 32px;
  font-size: 22px;
  font-weight: 900;
  color: #f0fdff;
  letter-spacing: 0.18em;
  background: rgba(220, 38, 38, 0.85);
  border: 2px solid rgba(254, 226, 226, 0.55);
  border-radius: 6px;
  transform: rotate(-8deg);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

/* Meta row (stock left + progress right) */
.mode-page-card__meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 6px;
}
.mode-page-card__meta {
  font-size: 12px;
  font-weight: 600;
  color: rgba(240, 253, 255, 0.7);
}
.mode-page-card__progress {
  font-size: 11px;
  font-weight: 700;
  color: rgba(116, 245, 255, 0.92);
  white-space: nowrap;
}

/* v19 UX: 視覺化 progress bar — 取代純文字「已售 X%」加緊張感 */
.mode-page-card__bar {
  position: relative;
  display: block;
  width: 100%;
  height: 6px;
  margin: 6px 0 4px;
  background: linear-gradient(90deg, rgba(8, 18, 42, 0.85), rgba(15, 30, 68, 0.85));
  border: 1px solid rgba(116, 245, 255, 0.18);
  border-radius: 999px;
  overflow: hidden;
}
.mode-page-card__bar__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.2, 0.9, 0.3, 1);
  box-shadow: 0 0 8px currentColor, inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.mode-page-card__bar[data-tone="fresh"] .mode-page-card__bar__fill {
  background: linear-gradient(90deg, #22d3ee, #67e8f9);
  color: rgba(34, 211, 238, 0.4);
}
.mode-page-card__bar[data-tone="normal"] .mode-page-card__bar__fill {
  background: linear-gradient(90deg, #22d3ee, #a5f3fc);
  color: rgba(34, 211, 238, 0.55);
}
.mode-page-card__bar[data-tone="warm"] .mode-page-card__bar__fill {
  background: linear-gradient(90deg, #fbbf24, #fcd34d);
  color: rgba(251, 191, 36, 0.55);
}
.mode-page-card__bar[data-tone="critical"] .mode-page-card__bar__fill {
  background: linear-gradient(90deg, #f87171, #fb7185, #fbbf24);
  color: rgba(248, 113, 113, 0.65);
  animation: mode-page-card-bar-pulse 1.6s ease-in-out infinite;
}
@keyframes mode-page-card-bar-pulse {
  0%, 100% { box-shadow: 0 0 8px currentColor, inset 0 1px 0 rgba(255, 255, 255, 0.25); }
  50%      { box-shadow: 0 0 14px currentColor, inset 0 1px 0 rgba(255, 255, 255, 0.4); }
}
@media (prefers-reduced-motion: reduce) {
  .mode-page-card__bar__fill { transition: none; animation: none !important; }
}

/* Skeleton shimmer */
.mode-page-card-skeleton {
  height: 280px;
  border-radius: 14px;
  background: linear-gradient(
    90deg,
    rgba(15, 30, 68, 0.5) 0%,
    rgba(34, 211, 238, 0.2) 50%,
    rgba(15, 30, 68, 0.5) 100%
  );
  background-size: 200% 100%;
  animation: mode-page-skeleton-shimmer 1.6s ease-in-out infinite;
  border: 1px solid rgba(116, 245, 255, 0.18);
}
@keyframes mode-page-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Error state with retry button */
.mode-page-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 36px auto;
  padding: 32px 24px;
  text-align: center;
  font-size: 14px;
  color: rgba(240, 253, 255, 0.65);
  background: rgba(15, 30, 68, 0.4);
  border: 1px dashed rgba(116, 245, 255, 0.28);
  border-radius: 14px;
  max-width: 480px;
}
.mode-page-error__icon {
  font-size: 36px;
  line-height: 1;
}
.mode-page-error__text {
  margin: 0 0 6px;
  font-size: 14px;
  color: rgba(240, 253, 255, 0.78);
}
.mode-page-retry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 800;
  color: #052e16;
  background: linear-gradient(135deg, #67e8f9 0%, #22d3ee 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 4px 14px rgba(34, 211, 238, 0.4);
}
.mode-page-retry:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.55);
}
.mode-page-retry:active { transform: scale(0.97); }

/* ============================================================
 * Phase 3 (2026-05-02): polish — sort dropdown (sticky 已有)
 *  + prefers-reduced-motion 支援
 * ============================================================ */

/* 桌機 .mode-page-filters 已 sticky top:88px (Phase 1), 加 chips flex:1 + sort 右靠 */
.mode-page-filters {
  gap: 16px;
}
.mode-page-chips {
  flex: 1;
  min-width: 0;
}

/* Sort dropdown (桌機版 native <select> 客製化) */
.mode-page-sort {
  flex: 0 0 auto;
  margin-left: auto;  /* chips hidden 時 (tower/rpg) 推到右邊, 避免黏在左邊 */
  height: 36px;
  padding: 0 32px 0 16px;
  font-size: 13px;
  font-weight: 700;
  color: #f0fdff;
  background-color: rgba(10, 22, 51, 0.78);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%2374f5ff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1 5 5 9 1'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid rgba(116, 245, 255, 0.32);
  border-radius: 999px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 200ms ease, background-color 200ms ease;
}
.mode-page-sort:hover {
  border-color: rgba(116, 245, 255, 0.55);
  background-color: rgba(15, 30, 68, 0.85);
}
.mode-page-sort:focus {
  border-color: rgba(116, 245, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}
.mode-page-sort option {
  background: #0a1633;
  color: #f0fdff;
}

/* prefers-reduced-motion: 關掉 skeleton + transform-based hover */
@media (prefers-reduced-motion: reduce) {
  .mode-page-card-skeleton {
    animation: none;
    background: rgba(15, 30, 68, 0.45);
  }
  .mode-page-card,
  .mode-page-tab,
  .mode-page-retry {
    transition: none;
  }
  .mode-page-tab:hover,
  .mode-page-retry:hover {
    transform: none;
  }
}

/* Phase 3 hotfix (2026-05-02): .mode-page-empty 預設 display:flex 蓋過 UA
 * [hidden]:display:none, 必加 !important 才能正確隱藏。沒這條 → 任何 mode page
 * 都會看到「目前沒有此模式的活動」文字殘留 */
.mode-page-empty[hidden] { display: none !important; }

/* ============================================================
 * Phase 4 (2026-05-02): Tier 預覽 (S/A/B 賞 ×N · 等 N 級)
 * ============================================================ */

.mode-page-card__tiers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 4px 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.mode-page-card__tiers__icon {
  font-size: 13px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
  margin-right: 2px;
}
/* v18 (2026-05-05 specificity-fix): fallback selector 加 :not([data-glow-color])
   讓它只套用沒設 glow 的 chip。原本 (0,3,1) 會贏 glow rule (0,2,1) 導致全 gold。 */
.mode-page-card__tiers > span:not(.mode-page-card__tiers__more):not(.mode-page-card__tiers__icon):not([data-glow-color]) {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 2px 8px;
  color: rgba(255, 215, 110, 0.95);
  background: rgba(15, 30, 68, 0.6);
  border: 1px solid rgba(255, 215, 110, 0.3);
  border-radius: 999px;
  white-space: nowrap;
}
/* v18: glow chip 共用 layout (沒被上面 fallback cover) */
.mode-page-card__tiers > span[data-glow-color] {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid;
}
.mode-page-card__tiers em {
  font-style: normal;
  color: rgba(116, 245, 255, 0.95);
  font-weight: 800;
}
.mode-page-card__tiers__more {
  font-size: 10px;
  color: rgba(240, 253, 255, 0.55);
  font-weight: 600;
  padding: 0 2px;
}

/* v15 (2026-05-04 owner audit): mode page 卡片 tier chip 套 admin glow color
   (gold/red/purple/blue/white/pink/orange/cyan/green; rainbow strip 出).
   data-glow-color specificity 高過上面 fallback 黃金色 (0,2,1 vs 0,1,2). */
.mode-page-card__tiers > span[data-glow-color="gold"] {
  color: #fbbf24; border-color: rgba(251, 191, 36, 0.55); background: rgba(251, 191, 36, 0.1);
}
.mode-page-card__tiers > span[data-glow-color="red"] {
  color: #f87171; border-color: rgba(239, 68, 68, 0.55); background: rgba(239, 68, 68, 0.1);
}
.mode-page-card__tiers > span[data-glow-color="purple"] {
  color: #c4b0ff; border-color: rgba(168, 85, 247, 0.55); background: rgba(168, 85, 247, 0.1);
}
.mode-page-card__tiers > span[data-glow-color="blue"] {
  color: #93c5fd; border-color: rgba(59, 130, 246, 0.55); background: rgba(59, 130, 246, 0.1);
}
.mode-page-card__tiers > span[data-glow-color="white"] {
  color: #f3f4f6; border-color: rgba(230, 235, 255, 0.55); background: rgba(230, 235, 255, 0.06);
}
.mode-page-card__tiers > span[data-glow-color="pink"] {
  color: #f9a8d4; border-color: rgba(244, 114, 182, 0.55); background: rgba(244, 114, 182, 0.1);
}
.mode-page-card__tiers > span[data-glow-color="orange"] {
  color: #fdba74; border-color: rgba(249, 115, 22, 0.55); background: rgba(249, 115, 22, 0.1);
}
.mode-page-card__tiers > span[data-glow-color="cyan"] {
  color: #67e8f9; border-color: rgba(34, 211, 238, 0.55); background: rgba(34, 211, 238, 0.1);
}
.mode-page-card__tiers > span[data-glow-color="green"] {
  color: #86efac; border-color: rgba(34, 197, 94, 0.55); background: rgba(34, 197, 94, 0.1);
}
/* em (× count) 顏色跟著 chip 變 — 避免 fallback cyan 在 gold chip 上看不見 */
.mode-page-card__tiers > span[data-glow-color] em {
  color: inherit;
  opacity: 0.85;
}

/* ──────────────────────────────────────────────────────────
   v19 UX (2026-05-05): MORE 介面深度優化
   - 桌機 hover lift + glow ring
   - 售完卡片 diagonal stripe + grayscale + opacity
   - filters bar sticky on scroll (zone-aware, 不擋 hero)
   - back-to-top floating button (>600px 顯示)
   - tier overflow chip hover 顯示完整 breakdown
   ────────────────────────────────────────────────────────── */

/* D. Card hover lift (desktop only — mobile 用 :active 輕觸效果) */
.mode-page-card {
  transition: transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1),
              box-shadow 220ms ease,
              border-color 220ms ease;
}
.mode-page-card:hover:not(.mode-page-card--soldout) {
  transform: translateY(-4px);
  border-color: rgba(116, 245, 255, 0.6);
  box-shadow:
    0 12px 32px rgba(34, 211, 238, 0.22),
    0 0 0 1px rgba(116, 245, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.mode-page-card:focus-visible {
  outline: 2px solid rgba(116, 245, 255, 0.85);
  outline-offset: 4px;
  border-radius: 16px;
}

/* E. Sold-out 強化視覺 — diagonal stripe + grayscale + dim */
.mode-page-card--soldout {
  filter: grayscale(0.7) brightness(0.65);
  opacity: 0.75;
  pointer-events: auto;
}
.mode-page-card--soldout:hover { transform: none; }
.mode-page-card--soldout::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgba(248, 113, 113, 0.05),
    rgba(248, 113, 113, 0.05) 8px,
    rgba(248, 113, 113, 0.12) 8px,
    rgba(248, 113, 113, 0.12) 16px
  );
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}
.mode-page-card--soldout .mode-page-card__veil {
  background: linear-gradient(135deg, rgba(8, 18, 42, 0.78), rgba(248, 113, 113, 0.42));
  backdrop-filter: blur(2px);
}
.mode-page-card--soldout .mode-page-card__veil-text {
  letter-spacing: 0.18em;
  font-weight: 900;
  font-size: 18px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

/* F. Sticky filter bar — v19b BUG FIX: top 88px (對齊 Phase 1 existing 桌機 topbar 高度
   原本 v19 寫 60px 跟 Phase 1 的 88px 衝突會跑到 topbar 下蓋住).
   只加強 background + backdrop-filter + box-shadow on stuck */
.mode-page-filters {
  background: linear-gradient(180deg, rgba(8, 18, 42, 0.96) 0%, rgba(8, 18, 42, 0.86) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(116, 245, 255, 0.12);
  transition: box-shadow 220ms ease;
}
.mode-page-filters.is-stuck {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

/* G. Tier overflow "等 N 級" 加 hover cursor + underline 表示可看更多 */
.mode-page-card__tiers__more {
  cursor: help;
  border-bottom: 1px dashed rgba(240, 253, 255, 0.35);
  transition: color 200ms ease, border-color 200ms ease;
}
.mode-page-card__tiers__more:hover {
  color: rgba(116, 245, 255, 0.95);
  border-bottom-color: rgba(116, 245, 255, 0.55);
}

/* Back-to-top floating button (shared between desktop + mobile via .dp-mode-totop) */
.dp-mode-totop {
  position: fixed;
  bottom: 92px; /* mobile 上面有 tabbar; desktop 留空間給 footer */
  right: 18px;
  z-index: 40;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(116, 245, 255, 0.5);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.95), rgba(15, 30, 68, 0.95));
  color: #f0fdff;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
  box-shadow: 0 8px 22px rgba(34, 211, 238, 0.45),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.dp-mode-totop.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.dp-mode-totop:hover {
  background: radial-gradient(circle, rgba(34, 211, 238, 1), rgba(15, 30, 68, 0.98));
  box-shadow: 0 12px 28px rgba(34, 211, 238, 0.6),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.dp-mode-totop:focus-visible {
  outline: 2px solid rgba(116, 245, 255, 1);
  outline-offset: 3px;
}
@media (max-width: 768px) {
  .dp-mode-totop { bottom: 96px; right: 14px; width: 44px; height: 44px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .dp-mode-totop { transition: opacity 200ms ease; }
  .mode-page-card { transition: none; }
}

/* v20e: 多箱系列改用「整套剩 N / N」前綴 (取代「跨 N 箱」抽象 suffix)。
   .mode-page-card__meta-cross 不再使用, 保留 selector 防 cache 殘留, 隱藏即可 */
.mode-page-card__meta-cross { display: none; }

/* v20h owner audit「之前不是有一版本要把 MORE 改成三個欄位一行 現在怎麼又
   變成兩個欄位了」+ v20i「網頁版本或許可以到四個感覺才正常」:
   桌機 /mode 改成 4 欄 (1280 container → 每張 ~300px, 視覺更密實)。
   中等寬度 (≤1100px) 降為 3 欄, 窄手機 (≤720px) 2 欄。 */
.mode-page-group .mode-page-grid,
.mode-page .mode-page-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1100px) {
  .mode-page-group .mode-page-grid,
  .mode-page .mode-page-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .mode-page-group .mode-page-grid,
  .mode-page .mode-page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* v20k owner audit「首頁卡片不是會有玻璃閃光」: 桌機 mode-page-card 加同款
   對角白光 sweep, 跟 /m/mode 一致。 */
.mode-page-card .mode-page-card__media::after {
  /* v20t: 同 mobile 重新打開, 但走 60s JS-sync */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(
    115deg,
    transparent 28%,
    rgba(255, 255, 255, 0.10) 46%,
    rgba(180, 240, 255, 0.06) 49%,
    rgba(255, 255, 255, 0.10) 52%,
    transparent 70%
  );
  background-size: 220% 100%;
  background-position: -120% 0;
  mix-blend-mode: screen;
  /* v20o: 跟 mobile 一樣改成 JS-driven sync (用 body.is-card-sweeping class) */
  animation: none;
  background-position: 220% 0;
}
body.is-card-sweeping .mode-page-card .mode-page-card__media::after {
  /* v20r: 1.5s → 1.2s, JS 30s 間隔 */
  animation: mode-page-card-sweep 1.2s ease-in-out 1 forwards;
}
@keyframes mode-page-card-sweep {
  0%   { background-position: -120% 0; }
  100% { background-position: 220% 0; }
}
.mode-page-card.mode-page-card--soldout .mode-page-card__media::after {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .mode-page-card .mode-page-card__media::after { animation: none; }
}
