#store {
  padding: 0;
  overflow: hidden;
  background: #fffdf7;
  border: 1px solid #c9bda9;
}
#store [hidden] { display: none !important; }
.gift-mast {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 25px;
  background: #f5ead2;
  color: #453626;
}
.gift-mast img { width: 64px; height: 64px; object-fit: contain; }
#store .gift-mast h2 {
  flex: 1;
  margin: 0;
  padding: 0;
  border: 0;
  font: bold 28px/1.18 "Songti SC", SimSun, serif;
}
.gift-balance { display: grid; text-align: right; font-size: 13px; }
.gift-balance strong { color: #823c20; font-size: 24px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.gift-nav { display: flex; padding: 0 22px; border-block: 1px solid #d8ccb6; }
.gift-nav button {
  appearance: none; flex: 0 1 136px; min-height: 47px; padding: 6px 9px;
  border: 0; border-bottom: 3px solid transparent;
  color: #625648; background: transparent; font-size: 15px; cursor: pointer;
}
.gift-nav button[aria-pressed="true"] { border-bottom-color: #a04625; color: #823817; font-weight: bold; }
.gift-nav button:hover { background: #f8efdc; }
.gift-nav button:focus-visible { outline-offset: -4px; }
#store .shop-columns { display: block; }
#store .shop-lane {
  padding: 17px 22px 22px; margin: 0; border: 0; background: transparent; box-shadow: none;
}
#store .lane-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 3px 16px; padding: 0 0 10px; margin: 0 0 12px; border: 0; border-bottom: 1px solid #e7dfcf;
}
#store .lane-head h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#store .lane-head p, #store .lane-count { margin: 0; padding: 0; font-size: 13px; color: #665847; background: none; border: 0; }
#store .gift-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; column-count: auto; align-items: start; }
#store .gift {
  display: flex; flex-direction: column; min-width: 0; height: 100%; margin: 0;
  padding: 14px 16px; background: #fffdf8; border: 1px solid #cbbfae; border-radius: 5px;
  color: #33291f; box-shadow: none;
}
#store .gift.locked, #store .gift.completed { opacity: 1; filter: none; background: #f6f3eb; border-color: #ddd5c7; }
#store .gift-head { gap: 5px 8px; align-items: baseline; margin-bottom: 6px; }
#store .gift-head h3 { font-size: 17px; font-weight: bold; line-height: 1.45; }
#store .tag { color: #6e5439; background: #f3ebd9; border: 0; border-radius: 2px; font-size: 12px; }
#store .rewards { display: grid; gap: 0; margin: 3px 0 6px; }
#store .reward {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 4px 0; border: 0; border-radius: 0; background: none; color: #433a31; font-size: 13px; line-height: 1.5;
}
#store .reward + .reward { border-top: 1px dotted #dfd8cb; }
#store .trade { flex: none; font-size: 12px; color: #4a674d; }
#store .bound { color: #87523e; }
#store .gift-reward-details { margin: 3px 0 6px; }
#store .gift-reward-details summary { padding: 5px 0; color: #764326; background: none; border: 0; font-size: 13px; }
#store .gift-progress { margin: auto 0 5px; padding-top: 7px; font-size: 12px; color: #675b4e; }
#store .gift-foot { display: grid; grid-template-columns: 1fr auto; gap: 5px; align-items: center; border-top: 1px solid #ded5c4; padding-top: 9px; }
#store .price { color: #843d20; font-variant-numeric: tabular-nums; }
#store .gift-foot .btn { margin: 0; min-height: 36px; font-size: 13px; }
#store .btn:disabled { opacity: 1; background: #e4dfd4; color: #645d53; border-color: #d6cfc2; box-shadow: none; }
#store .choice .select { width: 100%; }
#store .choice .quantity-picker { grid-template-columns: auto minmax(80px,128px) 1fr; gap: 8px 12px; }
#store .choice .quantity-hint { grid-column: auto; }
#store #choiceRewards { max-width: 620px; }
#store .empty { grid-column: 1 / -1; }
@media (max-width: 1000px) {
  #store .gift-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .gift-mast { gap: 10px; padding: 12px 14px; }
  .gift-mast img { width: 48px; height: 48px; }
  #store .gift-mast h2 { font-size: 23px; }
  .gift-balance strong { font-size: 20px; }
  .gift-nav { padding: 0; }
  .gift-nav button { flex: 1; }
  #store .shop-lane { padding: 13px 12px 16px; }
  #store .gift-grid { grid-template-columns: minmax(0,1fr); gap: 9px; }
  #store .gift-foot .btn { min-height: 44px; }
  #store .choice .quantity-picker { grid-template-columns: auto minmax(0,1fr); }
  #store .choice .quantity-hint { grid-column: 1 / -1; }
}

#store .gift-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
#store .gift-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#store .gift-foot .gift-actions { margin-left: auto; }
#store .gift-actions .btn { width: auto; margin: 0; padding-inline: 10px; white-space: nowrap; }
#store .gift-actions .gift-preview-btn { color: #694827; border-color: #c8b597; background: #faf4e7; }
#store .gift-actions .gift-preview-btn:hover:not(:disabled) { background: #eee2cd; }

.gift-preview:not([open]) { display: none; }
.gift-preview[open] {
  display: flex; flex-direction: column; box-sizing: border-box;
  width: 620px; max-width: calc(100% - 24px);
  max-height: 80vh; max-height: min(80dvh, 680px);
  margin: auto; padding: 0; overflow: hidden;
  background: #fffdf7; color: #392e23; border: 1px solid #bca887; border-radius: 6px;
  box-shadow: 0 12px 42px rgba(40, 28, 17, .22);
}
.gift-preview.short-list { width: 440px; }
.gift-preview.short-list ul { justify-content: center; }
.gift-preview.short-list #giftPreviewItems li { width: 25%; min-width: 74px; }
.gift-preview::backdrop { background: rgba(36, 29, 22, .66); }
html.gift-preview-open { overflow: hidden; }
.gift-preview.legacy-open { position: fixed; top: 10%; left: 0; right: 0; z-index: 10002; }
.gift-preview-shade { position: fixed; inset: 0; top: 0; right: 0; bottom: 0; left: 0; z-index: 10001; background: rgba(36, 29, 22, .66); }
.gift-preview-head { display: flex; flex: none; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 20px; background: #f5ead2; border-bottom: 1px solid #d9c8ac; }
.gift-preview-head h2 { margin: 0; font: bold 22px/1.4 "Songti SC", SimSun, serif; overflow-wrap: anywhere; }
.gift-preview-head p { margin: 3px 0 0; color: #695944; font-size: 13px; }
.gift-preview-head .btn { width: auto; flex: none; margin: 0; }
.gift-preview-body { overflow: auto; min-height: 0; padding: 18px; overscroll-behavior: contain; }
.gift-preview-body:focus-visible { outline: 2px solid #955527; outline-offset: -3px; }
#giftPreviewItems { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
#giftPreviewItems li { width: 20%; box-sizing: border-box; padding: 5px 3px 13px; text-align: center; overflow-wrap: anywhere; }
.gift-slot {
  position: relative; margin: 0 auto 6px; width: 56px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  background: #453c34; border: 1px solid #88765f; border-radius: 4px;
}
.gift-slot img { display: block; width: auto; height: auto; max-width: 38px; max-height: 36px; margin-bottom: 6px; }
.gift-slot .gift-icon-missing { color: #fff2d7; font-size: 11px; }
.gift-slot b { position: absolute; right: 1px; bottom: 1px; padding: 0 3px; color: #fff6da; background: #322820; border-radius: 2px; font: bold 12px/1.3 Arial, sans-serif; font-variant-numeric: tabular-nums; }
.gift-item-name { display: block; font-size: 13px; line-height: 1.4; }
.gift-item-binding { display: block; font-size: 12px; color: #705f4e; }
@media (max-width: 640px) {
  .gift-preview-head { padding: 12px 14px; }
  .gift-preview-head h2 { font-size: 19px; }
  .gift-preview-body { padding: 12px 6px; }
  #giftPreviewItems li { width: 25%; }
}
@media (max-width: 360px) {
  #giftPreviewItems li { width: 33.333%; }
}
