/* Trang quay (bố cục 30/11): chọn banner thành một hàng ngang ở trên; cột trái là tên đợt, khung lượt còn lại + tỷ lệ
   và nút quay; cột phải là Top Hit xếp quạt trên sân khấu (cây thông khi bật giao diện Giáng Sinh).
   Mọi luật bắt đầu bằng #shop để thắng các lớp ghi đè cũ của app.css (nhiều media query). Màu và trang trí theo mùa
   nằm ở christmas-compat.css qua các biến --shop-*. Mã dựng ở features/shop/view.js. */
#shop {
  --shop-panel: linear-gradient(180deg, rgba(14, 33, 45, .8), rgba(8, 20, 28, .8));
  --shop-line: rgba(226, 197, 149, .2);
  --shop-line-soft: rgba(255, 255, 255, .08);
  --shop-ink: #f7f4ee;
  --shop-muted: #b9c6cf;
  --shop-dim: #8696a2;
  --shop-gold: var(--gold);
  --shop-display: var(--display, var(--heading));
  --shop-cta-fade: rgba(7, 17, 24, .94);
}
/* Nút quay nằm trong trang: không còn thanh dính đáy trên máy tính. */
body.shop-open { padding-bottom: 0; }
#shop .convene { display: block; height: auto; min-height: 0; border-bottom: 0; }
#shop .arena { display: block; height: auto; min-height: 0; }
#shop .shop-wrap { max-width: 1320px; margin: 0 auto; padding: 0 32px; }

/* ---------- Hàng chọn banner ---------- */
#shop .shop-bbar { display: flex; align-items: center; gap: 16px; padding-top: 46px; }
#shop .shop-bbar-label {
  flex: none;
  font: 700 13px/1 var(--shop-display);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--shop-gold);
}
#shop .shop-chips {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
#shop .banner-choice {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
  max-width: 320px;
  padding: 6px 16px 6px 6px;
  overflow: hidden;
  border: 1px solid var(--shop-line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
  box-shadow: none;
  color: var(--shop-ink);
  text-align: left;
  transform: none;
  transition: border-color .2s, background .2s;
}
#shop .banner-choice:hover { transform: none; border-color: var(--shop-line); }
#shop .banner-choice.active { border-color: rgba(243, 212, 140, .6); background: rgba(243, 212, 140, .08); box-shadow: none; }
#shop .banner-choice.active::before { content: none; }
#shop .banner-choice:focus-visible { outline: 2px solid var(--shop-gold); outline-offset: 2px; }
#shop .banner-choice .banner-thumb {
  position: relative;
  flex: none;
  width: 34px;
  height: 46px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(255, 255, 255, .06);
}
#shop .banner-choice .banner-thumb img {
  position: static;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transform: none;
  filter: none;
}
#shop .banner-choice .banner-caption { display: block; min-width: 0; padding: 0; }
#shop .banner-choice small { display: block; font-size: 10.5px; font-weight: 700; line-height: 1.5; letter-spacing: .08em; color: var(--shop-gold); }
#shop .banner-choice strong {
  display: block;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--shop-ink);
}
#shop .stage-tools { display: flex; flex: none; gap: 8px; }
#shop .icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border: 1px solid var(--shop-line-soft);
  border-radius: 50%;
  background: rgba(255, 255, 255, .03);
  color: var(--shop-muted);
}
#shop .icon-btn:hover { border-color: var(--shop-line); color: var(--shop-ink); }
#shop .icon-btn[aria-pressed="true"] { border-color: var(--shop-gold); color: var(--shop-gold); }
#shop .icon-btn svg { width: 18px; height: 18px; }

/* ---------- Hai cột ---------- */
#shop .banner-body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  min-height: 0;
  padding: 28px 0 64px;
}
#shop .banner-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 540px;
  min-width: 0;
}
#shop .shop-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#shop .shop-eyebrow .eyebrow {
  margin: 0;
  font: 600 12px/1.4 var(--font);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--shop-gold);
}
#shop .round-label {
  margin: 0;
  padding: 3px 9px;
  border: 1px solid rgba(243, 212, 140, .4);
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .06em;
  color: var(--shop-gold);
}
#shop .banner-copy h1 {
  margin: 0;
  font-size: clamp(32px, 3.5vw, 50px);
  line-height: 1.08;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

/* Khung lượt còn lại + tỷ lệ */
#shop .shop-panel {
  position: relative;
  padding: 26px 20px 18px;
  border: 1px solid var(--shop-line);
  border-radius: 16px;
  background: var(--shop-panel);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  text-shadow: none;
}
#shop .banner-capacity { max-width: none; margin: 0; font-size: 14px; color: var(--shop-muted); }
#shop .shop-stock { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
#shop #bannerCounter strong {
  margin-right: 6px;
  font: 700 34px/1 var(--shop-display);
  letter-spacing: 0;
  color: var(--shop-ink);
}
#shop .shop-opened { font-size: 12.5px; color: var(--shop-dim); }
#shop .capacity-track { height: 6px; margin-top: 12px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, .08); }
#shop .capacity-track span { border-radius: inherit; background: linear-gradient(90deg, #d9a951, #f8e0a8); }
#shop .shop-rates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--shop-line-soft);
}
#shop .shop-rates-head > span { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--shop-muted); }
#shop .shop-rates-head .subtle-btn { font-size: 12.5px; color: var(--shop-gold); }
#shop .shop-rates-head .subtle-btn:hover { text-decoration: underline; }
#shop .shop-rate-bar { display: flex; gap: 2px; height: 8px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, .06); }
#shop .shop-rate-bar i { min-width: 3px; background: var(--rank); }
/* Mỗi bậc rộng theo chữ, dàn đều cả hàng; hẹp quá thì xuống dòng thay vì cắt tên. */
#shop .rank-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  max-width: none;
  margin: 14px 0 0;
  padding: 0;
  overflow: visible;
  isolation: auto;
}
#shop .rank-strip .rank-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1px;
  min-width: 0;
  min-height: 0;
  padding: 0 0 0 12px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  text-align: left;
  transform: none;
}
#shop .rank-strip .rank-chip::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  right: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rank);
  opacity: 1;
}
#shop .rank-strip .rank-chip b { font: 600 12px/1.5 var(--font); letter-spacing: 0; white-space: nowrap; color: var(--rank); }
#shop .rank-strip .rank-chip span {
  font: 600 15px/1.4 var(--font);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--shop-ink);
}
#shop .rank-strip .rank-chip:hover { background: none; transform: none; }
#shop .rank-strip .rank-chip:hover b { text-decoration: underline; }
#shop .rank-strip .rank-chip:focus-visible { outline: 2px solid var(--rank); outline-offset: 3px; }
#shop .rank-strip .rank-chip.is-zero { opacity: .4; }
#shop .shop-zero-ranks { display: none; }

/* Nút quay: hai nút cùng hàng dưới khung */
#shop .shop-cta { position: static; padding: 0; border: 0; background: none; box-shadow: none; }
#shop .shop-cta .dock-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#shop .shop-cta .summon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  min-height: 72px;
  padding: 10px 14px;
  border-radius: 14px;
  clip-path: none;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(255, 255, 255, .12);
  transform: none;
  transition: transform .15s, filter .15s;
}
#shop .shop-cta .summon-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
#shop .shop-cta .summon-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; filter: none; }
#shop .shop-cta .summon-btn strong { font-size: 20px; line-height: 1.15; letter-spacing: 0; }
#shop .shop-cta .summon-btn span { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: 0; opacity: .92; }
#shop .shop-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: -8px 0 0; font-size: 13px; line-height: 1.5; color: var(--shop-muted); }
#shop #dockStatus { display: inline; max-width: none; font-size: 13px; font-weight: 700; text-align: left; color: var(--shop-gold); }
#shop #dockStatus:empty { display: none; }
#shop .banner-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; margin: -8px 0 0; }
#shop .banner-links .subtle-btn { gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--shop-gold); }
#shop .banner-links .subtle-btn:hover:not(:disabled) { text-decoration: underline; }
#shop .banner-links .subtle-btn:disabled { opacity: 1; color: var(--shop-dim); cursor: default; }
#shop .banner-links .subtle-btn svg { width: 15px; height: 15px; }

/* ---------- Top Hit ---------- */
#shop .shop-show { position: relative; min-width: 0; }
#shop .shop-show-head { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
#shop .top-hit-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font: 700 14px/1 var(--shop-display);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--shop-gold);
}
#shop .top-hit-label::after { content: ""; width: 56px; height: 1px; background: linear-gradient(90deg, var(--shop-gold), transparent); }
#shop .top-hit-label[hidden], #shop .feature-caption[hidden] { display: none; }
/* Sân khấu thấp lại theo chiều cao màn hình để tên thẻ và nút quay cùng nằm trong màn đầu (laptop 768–900px). */
#shop .card-scene {
  --hit-w: clamp(150px, min(16vw, 32svh - 50px), 240px);
  position: relative;
  inset: auto;
  display: block;
  width: 100%;
  height: clamp(360px, min(40vw, 100svh - 390px), 540px);
  margin: 0;
  perspective: none;
}
#shop .card-halo { z-index: 0; pointer-events: none; }
#shop .hit-stage { position: absolute; inset: 0; z-index: 2; }
/* Một thẻ (hoặc thẻ nổi bật khi chưa chọn Top Hit): đứng giữa dưới gốc cây như quà. */
#shop .hit-card {
  position: absolute;
  top: 64%;
  left: 50%;
  width: var(--hit-w);
  aspect-ratio: 600 / 825;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform: translate(-50%, -50%);
}
#shop .hit-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
  filter: drop-shadow(0 22px 24px rgba(0, 0, 0, .6));
}
#shop :is(.hit-card, .hit-run):focus-visible { outline: 2px solid var(--shop-gold); outline-offset: 4px; border-radius: 8px; }
#shop .hit-card .image-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--shop-line);
  border-radius: 10px;
  background: rgba(8, 20, 28, .85);
  font-size: 13px;
  text-align: center;
  overflow-wrap: anywhere;
  color: var(--shop-ink);
}
/* Từ 2 Top Hit: một dải ngang dưới gốc cây, trôi trái 18px/s và vòng lại liền mạch (view.js dựng thẻ và tính thời lượng).
   Khoảng cách bằng margin (không dùng gap) để nửa dải dài đúng bằng một lượt lặp. */
#shop .hit-stage.is-run {
  inset: auto 0;
  top: 64%;
  transform: translateY(-50%);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
#shop .hit-stage.is-marquee {
  overflow: hidden;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
}
#shop .hit-track { display: flex; width: max-content; padding: 8px 0 6px; }
#shop .hit-run {
  position: relative;
  flex: none;
  width: var(--hit-w);
  margin-right: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: center;
  cursor: pointer;
}
#shop .hit-run img {
  display: block;
  width: 100%;
  aspect-ratio: 600 / 825;
  object-fit: contain;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, .6));
  transition: transform .25s;
}
#shop .hit-run:hover img { transform: translateY(-4px); }
#shop .hit-run span {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  font: 700 14px/1.25 var(--shop-display);
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #fff7e6;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .6);
}
#shop .hit-run .image-fallback {
  display: grid;
  place-items: center;
  aspect-ratio: 600 / 825;
  padding: 10px;
  border: 1px solid var(--shop-line);
  border-radius: 10px;
  background: rgba(8, 20, 28, .85);
  font-size: 12px;
  overflow-wrap: anywhere;
  color: var(--shop-ink);
}
#shop .hit-track.marquee { animation: hit-drift var(--hit-dur, 40s) linear infinite; will-change: transform; }
@keyframes hit-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
/* Rê chuột hoặc chọn bằng phím Tab thì dừng để bấm cho dễ. */
@media (hover: hover) {
  #shop .hit-stage.is-run:hover .hit-track { animation-play-state: paused; }
}
#shop .hit-stage.is-run:has(:focus-visible) .hit-track { animation-play-state: paused; }
/* Giảm chuyển động: đứng yên, bỏ bản lặp, cuộn tay được. */
.slow-mode #shop .hit-track.marquee { animation: none; }
.slow-mode #shop .hit-track > [aria-hidden="true"] { display: none; }
.slow-mode #shop .hit-stage.is-marquee { overflow-x: auto; scrollbar-width: thin; -webkit-mask-image: none; mask-image: none; }
@media (prefers-reduced-motion: reduce) {
  #shop .hit-track.marquee { animation: none; }
  #shop .hit-track > [aria-hidden="true"] { display: none; }
  #shop .hit-stage.is-marquee { overflow-x: auto; scrollbar-width: thin; -webkit-mask-image: none; mask-image: none; }
  #shop .hit-run img { transition: none; }
}
#shop .feature-caption {
  position: relative;
  inset: auto;
  z-index: 3;
  min-height: 64px;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .6);
}
#shop .feature-caption .feature-name { font: 700 22px/1.2 var(--shop-display); letter-spacing: 0; overflow-wrap: anywhere; color: #fff7e6; }
#shop .feature-caption small { display: block; margin-top: 2px; font-size: 12.5px; letter-spacing: 0; text-transform: none; color: var(--shop-muted); }

/* ---------- Màn hẹp ---------- */
@media (max-width: 1100px) {
  #shop .shop-wrap { padding: 0 24px; }
}
@media (max-width: 980px) {
  #shop .banner-body { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 12px; }
  #shop .shop-show { order: -1; }
  #shop .banner-copy { max-width: 640px; margin: 0 auto; }
  #shop .card-scene { --hit-w: 196px; height: 440px; }
}
@media (max-width: 760px) {
  #shop .shop-wrap { padding: 0 16px; }
  #shop .shop-bbar { gap: 10px; padding-top: 40px; }
  #shop .shop-bbar-label { display: none; }
  #shop .card-scene { --hit-w: 160px; height: 400px; }
  #shop .hit-run { width: calc(var(--hit-w) * .9); margin-right: 12px; }
  #shop .hit-run span { font-size: 13px; }
  #shop .hit-stage.is-marquee {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  }
  #shop .feature-caption .feature-name { font-size: 19px; }
  #shop .shop-panel { padding: 24px 16px 16px; }
  /* Điện thoại: chỉ hiện bậc có tỷ lệ, gom các bậc 0% vào một dòng. */
  #shop .rank-strip .rank-chip.is-zero { display: none; }
  #shop .shop-zero-ranks:not([hidden]) { display: block; margin: 10px 0 0; font-size: 12.5px; color: var(--shop-dim); }
  /* Nút quay dính đáy màn hình; nằm trong lớp xếp chồng của .arena nên nâng cả lớp lên trên phần bên dưới. */
  #shop .arena { z-index: 4; }
  #shop .banner-copy { z-index: auto; }
  #shop .shop-cta {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    padding: 18px 16px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(rgba(0, 0, 0, 0), var(--shop-cta-fade) 35%);
  }
  #shop .shop-cta .dock-actions { gap: 10px; }
  #shop .shop-cta .summon-btn { min-height: 60px; }
  #shop .shop-cta .summon-btn strong { font-size: 18px; }
  body.shop-open { padding-bottom: 96px; }
  body.shop-open .toast { bottom: 104px; }
}

/* Giảm chuyển động: nút quay không trượt. */
.slow-mode #shop :is(.hit-run img, .shop-cta .summon-btn) { transition: none; }
@media (prefers-reduced-motion: reduce) {
  #shop .shop-cta .summon-btn { transition: none; }
}
