/* ============================================================
   components —— 卡片、徽章、按鈕、評分、rail、模式標、空狀態
   ============================================================ */

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; font-size: 14px; font-weight: 700;
  border-radius: var(--r-pill); border: 1px solid transparent;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, filter .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn__ico {
  display: inline-flex;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  align-items: center;
  justify-content: center;
}
.btn__ico svg {
  display: block;
  width: 100%;
  height: 100%;
}
.btn--lg .btn__ico {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: linear-gradient(135deg, var(--accent), #38d0ff); color: var(--accent-ink);
  box-shadow: var(--ring-cyan), 0 8px 22px rgba(0, 229, 255, .28); }
.btn--primary:hover { filter: brightness(1.05);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, .7), 0 10px 30px rgba(0, 229, 255, .45); }
.btn--ghost { background: rgba(255,255,255,.025); border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--soft { background: var(--surface-2); color: var(--text); }
.btn--soft:hover { background: var(--surface); }
.btn--block { width: 100%; }
.btn--lg { padding: 14px 22px; font-size: 15px; }
.btn:disabled, .btn.is-owned { background: var(--surface-2); color: var(--text-dim); cursor: default; filter: none; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; font-size: 11px; font-weight: 700;
  border-radius: var(--r-pill); line-height: 1.6;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.045);
}
.badge--official { background: color-mix(in srgb, var(--badge-official) 22%, transparent); color: var(--badge-official); }
.badge--new  { background: color-mix(in srgb, var(--badge-new) 20%, transparent);  color: var(--badge-new); }
.badge--hot  { background: color-mix(in srgb, var(--badge-hot) 20%, transparent);  color: var(--badge-hot); }
.badge--free { background: color-mix(in srgb, var(--badge-free) 18%, transparent); color: var(--badge-free); }
.badge--sale { background: color-mix(in srgb, var(--badge-sale) 20%, transparent); color: var(--badge-sale); }

/* ---------- 模式標 ---------- */
.modes { display: flex; flex-wrap: wrap; gap: 6px; }
.mode {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; font-size: 11px; font-weight: 700;
  border-radius: var(--r-pill); border: 1px solid var(--line);
  color: var(--text-soft);
}
.mode::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.mode--寵物::before   { background: var(--mode-pet); }
.mode--工作夥伴::before { background: var(--mode-work); }
.mode--娛樂::before   { background: var(--mode-play); }

/* ---------- 評分 ---------- */
.stars { display: inline-flex; align-items: center; gap: 1px; font-size: 13px; }
.stars .star { color: var(--line); }
.stars .star.on { color: var(--badge-new); }
.stars .count { color: var(--text-dim); font-size: 12px; margin-left: 4px; }

/* ---------- 價格 ---------- */
.price { font-weight: 800; font-size: 15px; color: var(--text); }
.price small { font-size: 11px; font-weight: 600; color: var(--text-dim); }
.price--free { color: var(--accent); }
.price__old { color: var(--text-dim); text-decoration: line-through; font-size: 12px; font-weight: 600; margin-right: 6px; }

/* ---------- 商品卡 ---------- */
.card {
  display: flex; flex-direction: column;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 34%),
    var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md); overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  box-shadow: var(--shadow-card);
}
.card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(0,229,255,.12), transparent 28%, rgba(124,77,255,.10) 74%, transparent);
  opacity: 0; transition: .16s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, .3), 0 16px 34px rgba(0, 0, 0, .5), 0 0 26px rgba(0, 229, 255, .14); }
.card:hover::after { opacity: 1; }
.card__art { aspect-ratio: 1 / 1; border: none; border-radius: 0; }
.card__body { position: relative; z-index: 1; padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 6px; }
.card__badges { display: flex; flex-wrap: wrap; gap: 4px; min-height: 18px; }
.card__name { font-weight: 800; font-size: 14px; color: var(--text); line-height: 1.35; min-height: 38px; }
.card__author { font-size: 12px; color: var(--text-dim); }
.card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }

/* ---------- rail（橫向捲動列）---------- */
.rail { margin-bottom: var(--sp-6); }
.rail__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--sp-3); }
.rail__head h2 { font-size: 18px; font-weight: 800; }
.rail__more { font-size: 13px; color: var(--accent-3); font-weight: 600; }
.rail__track {
  display: grid; grid-auto-flow: column; grid-auto-columns: 200px;
  gap: var(--sp-3); overflow-x: auto; padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
}
.rail__track .card { scroll-snap-align: start; }
.rail__track::-webkit-scrollbar { height: 8px; }
.rail__track::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

/* ---------- 格狀清單 ---------- */
.grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* ---------- 分類 chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill); color: var(--text-soft);
}
.chip:hover { color: var(--text); border-color: var(--accent-3); box-shadow: 0 0 18px rgba(70,177,255,.16); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 0 16px rgba(0, 229, 255, .4); }

/* ---------- 區塊標題（霓虹左標）---------- */
.section-title, .rail__head h2 { position: relative; padding-left: 14px; }
.section-title::before, .rail__head h2::before {
  content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent-2)); box-shadow: 0 0 12px var(--accent);
}
.section-title { font-size: 18px; font-weight: 800; margin-bottom: var(--sp-3); }

/* ---------- 空狀態 ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--sp-3); padding: var(--sp-7) var(--sp-4);
  border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  background: radial-gradient(100% 120% at 50% 0, rgba(0,229,255,.08), transparent 58%), rgba(17,24,48,.42);
}
.empty__art { width: 200px; max-width: 60%; aspect-ratio: 4 / 3; }
.empty__title { font-size: 17px; font-weight: 700; }
.empty__sub { font-size: 14px; color: var(--text-dim); max-width: 340px; }

/* ---------- 卡片式面板 ---------- */
.panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 42%),
    rgba(17, 24, 48, .92);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(255,255,255,.02);
}

/* ---------- 麵包屑 / 返回 ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 14px; margin-bottom: var(--sp-4); }
.back:hover { color: var(--text); }

/* ---------- Soft Store skin ---------- */
.btn {
  border-radius: 12px;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 18px rgba(24, 169, 153, .18);
}
.btn--primary:hover {
  filter: none;
  box-shadow: 0 10px 22px rgba(24, 169, 153, .22);
}
.btn--ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn--soft {
  background: var(--surface-2);
}
.badge {
  border-radius: 8px;
  box-shadow: none;
}
.badge--official { background: #eef0ff; color: var(--badge-official); }
.badge--new { background: #fff5df; color: #9a6814; }
.badge--hot { background: #ffe9ee; color: var(--badge-hot); }
.badge--free { background: #e5f7f4; color: var(--badge-free); }
.badge--sale { background: #fff0ea; color: var(--badge-sale); }
.mode {
  background: var(--surface);
  border-color: var(--line);
}
.card {
  background: var(--surface);
  border-color: var(--line-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  will-change: transform;
}
.card::after { display: none; }
.card:hover {
  transform: translateY(-4px) rotate(-.2deg);
  border-color: #cbd7e2;
  box-shadow: 0 14px 30px rgba(24, 34, 45, .12);
}
.card__art {
  transition: transform .2s ease, filter .2s ease;
}
.card:hover .card__art {
  transform: scale(1.025);
  filter: saturate(1.03);
}
.card__name {
  font-weight: 760;
  min-height: 38px;
}
.rail__track::-webkit-scrollbar-thumb { background: #cbd7e2; }
.chip {
  background: var(--surface);
  border-color: var(--line);
  border-radius: 12px;
}
.chip:hover {
  border-color: #c5d1dc;
  color: var(--text);
  box-shadow: none;
}
.chip.on {
  background: #e5f7f4;
  color: #126d65;
  border-color: rgba(24, 169, 153, .28);
  box-shadow: none;
}
.section-title::before, .rail__head h2::before {
  background: var(--accent-2);
  box-shadow: none;
}
.empty {
  background: var(--surface);
  border-color: var(--line-soft);
}
.panel {
  background: var(--surface);
  border-color: var(--line-soft);
  box-shadow: var(--shadow-card);
}
@media (prefers-reduced-motion: reduce) {
  .card,
  .card__art,
  .btn {
    transition: none;
  }
  .card:hover,
  .card:hover .card__art,
  .btn:hover {
    transform: none;
  }
}
