/* ═══════════════════════════════════════════════════════════════════════════
   AVALON UI V4 · Wardrobe · Card · Inventory · Treasury · Weekly · Gift (batch ②+)
   Rules of the house:
   · warm sunlit parchment surfaces & crisp pixel pedestals;
   · rarity colour is printed on dark capsules or used as a subtle rim/glow;
   · scroll areas are flex:1 + min-height:0, category rail never scrolls or clips.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══ Workbench shell ═════════════════════════════════════════════════════ */
.game-document.v4-workbench {
  position: relative; border: 3px solid #2a1d12 !important; border-radius: 12px !important; color: var(--v4-ink);
  background:
    radial-gradient(ellipse 70% 38% at 50% 0%, rgba(255, 248, 226, .7), transparent 72%),
    radial-gradient(rgba(150, 118, 70, .14) .6px, transparent .8px) 0 0 / 7px 9px,
    linear-gradient(180deg, #e8d9b4 0%, #d8c59b 55%, #cbb488 100%) !important;
  box-shadow: inset 0 0 0 2px #c9a55c, inset 0 0 0 4px #3b2a17, inset 0 0 0 5px rgba(232, 198, 120, .4),
    inset 0 0 70px rgba(110, 78, 30, .22), 0 0 0 1px #0b0806, 0 26px 64px rgba(4, 2, 0, .66), 0 4px 0 rgba(0, 0, 0, .5) !important;
}
.game-document.v4-workbench::before {
  content: ""; position: absolute; inset: 9px; border-radius: 7px; pointer-events: none; z-index: 0;
  --c: #c99a45;
  background:
    linear-gradient(var(--c), var(--c)) top left / 22px 2px no-repeat, linear-gradient(var(--c), var(--c)) top left / 2px 22px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 22px 2px no-repeat, linear-gradient(var(--c), var(--c)) top right / 2px 22px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 22px 2px no-repeat, linear-gradient(var(--c), var(--c)) bottom left / 2px 22px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 22px 2px no-repeat, linear-gradient(var(--c), var(--c)) bottom right / 2px 22px no-repeat;
}
.v4-workbench > .document-title {
  display: flex !important; align-items: center; justify-content: center; gap: 16px; border: 0 !important;
  color: #36281a !important; letter-spacing: 6px; text-shadow: 0 1px 0 rgba(255, 246, 220, .85);
}
.v4-workbench > .document-title::before, .v4-workbench > .document-title::after {
  content: ""; flex: 0 1 110px; height: 8px; background:
    linear-gradient(90deg, transparent, #a87b34) center / 100% 2px no-repeat,
    linear-gradient(45deg, transparent 38%, #a87b34 38% 62%, transparent 62%) right center / 8px 8px no-repeat;
}
.v4-workbench > .document-title::after { transform: scaleX(-1); }
.v4-section-title { margin: 0; font-size: 22px; letter-spacing: 4px; color: #3a2a16; text-shadow: 0 1px 0 rgba(255, 246, 220, .8); }

/* ═══ Shared content card (light parchment for pixel visibility) ══════════ */
.v4-item.avalon-button, div.v4-item, article.v4-item {
  position: relative; isolation: isolate;
  background: radial-gradient(ellipse 72% 58% at 50% 36%, #fffdf6 0%, rgba(255, 251, 238, 0) 72%), linear-gradient(180deg, #f4e9cd 0%, #e2d0a4 100%) !important;
  border: 2px solid #8a7550 !important; border-radius: 8px !important; color: #3b2f1f !important; text-shadow: none !important;
  box-shadow: inset 0 1px 0 #fffaf0, inset 0 -3px 0 color-mix(in srgb, var(--r) 72%, #6e5530), 0 3px 0 rgba(0, 0, 0, .42), 0 5px 10px rgba(0, 0, 0, .22) !important;
  transition: transform 180ms var(--v4-ease-out), box-shadow 220ms var(--v4-ease-out), border-color 140ms !important;
}
.v4-item.avalon-button::before { content: none !important; display: none !important; }
@media (hover: hover) and (pointer: fine) {
.v4-item.avalon-button:hover:not(:disabled) {
  transform: translateY(-3px) !important; border-color: #5d4a2a !important;
  box-shadow: inset 0 1px 0 #fffaf0, inset 0 -3px 0 var(--r), 0 6px 0 rgba(0, 0, 0, .35), 0 10px 18px rgba(0, 0, 0, .25), 0 0 14px var(--r-glow, rgba(232, 184, 79, .35)) !important;
}
}
.v4-item.avalon-button:active:not(:disabled) { transform: translateY(0) scale(.97) !important; transition-duration: 60ms !important; }
.v4-item.avalon-button:is([aria-pressed="true"], [aria-checked="true"]) {
  border-color: #fff0c2 !important;
  background: radial-gradient(ellipse 72% 58% at 50% 36%, #fffef9 0%, rgba(255, 251, 238, 0) 72%), linear-gradient(180deg, #fbf1d6 0%, #ecd9a8 100%) !important;
  box-shadow: 0 0 0 2px #e8b84f, 0 0 0 4px #2a1c0c, inset 0 1px 0 #fffaf0, inset 0 -3px 0 var(--r), 0 6px 14px rgba(0, 0, 0, .35), 0 0 22px var(--r-glow, rgba(232, 184, 79, .5)) !important;
}
.v4-item.avalon-button:focus-visible { outline: 2px solid #fff3c4 !important; outline-offset: 2px !important; }
.v4-item .v4-gem { top: 7px; right: 7px; }
.wardrobe-item.v4-item[data-rarity]::after, .equipment-slot[data-rarity]::after, .cosmetic-content-option.v4-item[data-rarity]::after {
  content: "" !important; display: block !important; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  transform: rotate(45deg); background: var(--r) !important; box-shadow: 0 0 0 1px #1b140c, 0 0 6px var(--r); pointer-events: none;
}
/* Bright halo behind pixel art so dark pixels keep a crisp silhouette. */
.v4-item .collection-art, .v4-item .wardrobe-item-picture, .v4-item .cosmetic-avatar-art, .v4-receipt-art, .v4-detail-stage { position: relative; }
.v4-item .collection-art::before, .v4-item .wardrobe-item-picture::before {
  content: ""; position: absolute; inset: 4% 14%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(255, 253, 244, .55) 55%, transparent);
}
.v4-empty { margin: 0; padding: 36px 12px; text-align: center; color: #cdb98c; font-size: 16px; line-height: 1.6; }
.v4-stamp, .v4-luxury-stamp {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px 20px; margin: 0; border-radius: 8px; transform: none;
  font-size: 15px; letter-spacing: 2px; color: #fff4c8 !important;
  background:
    linear-gradient(110deg, transparent 32%, rgba(255, 248, 210, .48) 48%, transparent 64%) 160% 0 / 240% 100% no-repeat,
    radial-gradient(ellipse 90% 80% at 50% 0%, rgba(255, 215, 110, .32), transparent 70%),
    linear-gradient(135deg, #2d1f3a 0%, #4c2c52 36%, #6e451b 74%, #332010 100%) !important;
  border: 2px solid #e6b84f !important;
  box-shadow:
    inset 0 1px 0 #fff7d6,
    inset 0 0 0 2px rgba(45, 28, 12, .75),
    inset 0 -2px 8px rgba(255, 196, 75, .35),
    0 4px 12px rgba(20, 12, 4, .48),
    0 0 18px rgba(240, 186, 72, .45) !important;
  text-shadow: 0 1px 2px #120a04, 0 0 10px rgba(255, 212, 95, .75) !important;
  animation: v4-sheen 3.2s var(--v4-ease-out) infinite;
}
.v4-stamp-gem {
  color: #ffe48a; font-size: 14px;
  text-shadow: 0 0 8px #ffd25a, 0 0 14px #fff;
  animation: v4-gem-pulse 1.6s ease-in-out infinite alternate;
}
.v4-stamp-text { font-weight: 400; color: #fff6d6; }
@keyframes v4-gem-pulse { from { transform: scale(.88); opacity: .8; } to { transform: scale(1.18); opacity: 1; } }

/* ═══ Collection document (背包 / 宝箱 / 周任务 / 近期收获) ════════════════ */
.v4-collection-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; position: relative; z-index: 1; }
.v4-wallet { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.v4-wallet-note { margin: 0; font-size: 14px; color: #7a3a2a; }
.v4-wallet-badge { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px 0 6px; border-radius: 999px;
  background: linear-gradient(180deg, #211a13, #30261b); border: 1px solid #120c07; box-shadow: var(--v4-shadow-well); color: #cdb98d; font-size: 13px; }
.v4-wallet-badge strong { font-size: 20px; font-weight: 400; color: #ffe08a; text-shadow: 0 0 8px rgba(255, 200, 90, .5); min-width: 2ch; text-align: right; }
.v4-wallet-icon { position: relative; width: 24px; height: 24px; flex: none; }
.v4-wallet-badge[data-kind="coin"] .v4-wallet-icon { border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff5c0 0 16%, #f1c24f 40%, #a96f1b 100%); box-shadow: inset 0 0 0 2px #7a4d10, inset 0 0 0 4px rgba(255, 236, 160, .45), 0 0 8px rgba(255, 200, 80, .55); }
.v4-wallet-badge[data-kind="chest"] .v4-wallet-icon { height: 19px; border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #c07a33 0 40%, #3a2410 40% 52%, #9a5d25 52% 100%); box-shadow: inset 0 0 0 2px #2e1a08, 0 0 8px rgba(255, 190, 90, .35); }
.v4-wallet-badge[data-kind="chest"] .v4-wallet-icon::after { content: ""; position: absolute; left: calc(50% - 3px); top: 5px; width: 6px; height: 7px; border-radius: 1px; background: #ffd56a; box-shadow: 0 0 4px #ffd56a; }

.collection-document > .economy-content { flex: 1 1 auto !important; min-height: 0 !important; overflow: hidden; position: relative; z-index: 1; }
.collection-document > .economy-actions { flex-shrink: 0; display: flex; justify-content: flex-end; gap: 14px; position: relative; z-index: 1; }
.collection-document > .account-message:empty { display: none; }

/* Inventory + Breathable 2-Row Unified `.v4-pills` Filter & Rank Sort */
.collection-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; height: 100%; min-height: 0; }
.collection-browser { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
.v4-filter-stack {
  display: flex; flex-direction: column; gap: 10px; flex-shrink: 0;
}
.v4-filter-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.v4-rarity-bar, .v4-wardrobe-rarity-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; flex-shrink: 0;
}
.v4-rarity-pills.v4-pills .avalon-button[data-variant="pill"],
.v4-rarity-filters.v4-pills .avalon-button[data-variant="pill"],
.v4-sort-pills.v4-pills .avalon-button[data-variant="pill"],
.v4-layering-pills.v4-pills .avalon-button[data-variant="pill"],
.v4-ledger-pills.v4-pills .avalon-button[data-variant="pill"] {
  height: 28px !important; min-height: 28px !important; padding: 2px 12px !important; font-size: 13px !important;
}
.collection-grid.v4-well { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  grid-auto-rows: 134px; gap: 12px; padding: 14px; align-content: start; }
/* Fixed media/title tracks: wrapped names must never move the artwork. */
.collection-document .collection-item.v4-item.avalon-button { display: grid; grid-template-rows: minmax(0, 1fr) 32px; align-items: stretch; justify-items: center; gap: 6px;
  width: 100%; height: 100%; min-height: 0; padding: 8px 6px 9px; font-size: 13px; white-space: normal; }
.collection-item > .collection-art { grid-row: 1; width: 100%; height: 100%; min-height: 0; flex: none; display: grid; place-items: center; }
.collection-item > .collection-item-name { grid-row: 2; width: 100%; height: 32px; min-height: 32px; margin: 0; align-self: start; }
.collection-item .collection-art canvas.v4-animated-avatar { width: 68px; height: 68px; }
.collection-item .collection-art canvas:not(.v4-animated-avatar), .collection-item .collection-art .wardrobe-part-art { width: 68px; height: 68px; }
.collection-item .collection-art img { max-height: 72px; max-width: 100%; object-fit: contain; }
.collection-item-name { line-height: 16px; max-height: 32px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.collection-grid > .collection-empty { grid-column: 1 / -1; }

.collection-detail.v4-pedestal { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 18px 18px; min-height: 0;
  overflow-y: auto; border-left: 2px solid #7d6640 !important; text-align: center; }
.v4-detail-stage { width: 100%; height: 178px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; isolation: isolate;
  background: radial-gradient(ellipse 52% 56% at 50% 50%, #fffef9 0%, color-mix(in srgb, var(--r) 26%, #fbf3dd) 46%, transparent 76%); }
.v4-detail-stage::before { content: ""; position: absolute; inset: 12% 22%; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, var(--r-glow, rgba(255, 220, 140, .4)), transparent); animation: v4-breathe-glow 3.4s ease-in-out infinite; }
.v4-detail-stage::after { content: ""; position: absolute; left: 28%; right: 28%; bottom: 14px; height: 12px; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, rgba(70, 48, 18, .32), transparent); }
@keyframes v4-breathe-glow { 50% { transform: scale(1.12); opacity: .75; } }
.v4-detail-stage .collection-art { width: 100%; height: 160px; display: flex; align-items: center; justify-content: center; }
.v4-detail-stage .collection-art canvas, .v4-detail-stage .collection-art .wardrobe-part-art { width: 136px; height: 136px; }
.v4-detail-stage .collection-art img { max-width: 150px; max-height: 150px; }
.v4-detail-stage .collection-art .dynamic-nameplate { width: 100%; }
.v4-detail-meta { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.v4-type { font-size: 13px; color: #6a5a40; padding: 2px 10px; border: 1px solid rgba(106, 90, 64, .45); border-radius: 999px; background: rgba(255, 250, 235, .4); }
.collection-detail.v4-pedestal h3 { margin: 0; font-size: 22px; line-height: 1.3; color: #2e2415; overflow-wrap: anywhere; flex-shrink: 0; }
.collection-detail.v4-pedestal .collection-state { margin: 0; font-size: 14px; color: #5b4a30; }
.collection-detail .collection-colors { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; flex-shrink: 0; }
.collection-detail .collection-colors span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #3a2c18; box-shadow: inset 0 3px 2px rgba(255, 255, 255, .45), 0 1px 0 rgba(0, 0, 0, .4); }
.v4-detail-actions { margin-top: auto; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; padding-top: 6px; }
.collection-detail .v4-detail-actions .avalon-button:not(.v4-compact-unlock-btn) { width: 100%; min-height: 40px; height: auto; font-size: 16px; padding: 6px 16px; }
/* Compact Unlock Button matching `.v4-luxury-stamp` (`已收藏` / `配色全集`) dimensions */
.avalon-button.v4-compact-unlock-btn {
  width: auto !important; min-width: 0 !important;
  height: 34px !important; min-height: 34px !important;
  padding: 4px 18px !important; margin: 0 !important;
  font-size: 14px !important; line-height: 1.15 !important; letter-spacing: 1px !important;
  border-radius: 7px !important; white-space: nowrap !important;
}
.avalon-button.v4-compact-unlock-btn::before { left: 6px !important; width: 3px !important; height: 3px !important; }
.avalon-button.v4-compact-unlock-btn::after { right: 6px !important; width: 3px !important; height: 3px !important; }
.collection-detail .collection-hint { margin: 0; font-size: 13px; color: #7a5a35; }
.collection-detail.is-empty { justify-content: center; }
.v4-empty-crest { width: 84px; height: 84px; border-radius: 50%; border: 2px dashed rgba(120, 90, 45, .5); background: radial-gradient(circle, rgba(255, 250, 235, .8), transparent 70%); }

/* ═══ Treasury & Redesigned Royal Astrolabe Floor Dais (Items 7 & 16) ═══════ */
.treasury-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; height: 100%; min-height: 0; overflow: hidden; }
.treasury-hero.v4-pedestal {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  gap: 6px; padding: 18px 18px 16px !important; min-height: 0; overflow: visible !important; box-sizing: border-box;
}
.treasury-hero.v4-pedestal > .v4-section-title {
  display: block !important; margin: 2px 0 0 !important; font-size: 21px !important; line-height: 1.25;
  position: relative; z-index: 5; flex-shrink: 0;
}

/* Item 7: Royal Astrolabe Floor Dais + Overwatch-style PixelFX Launch Pad */
.v4-altar-stage {
  position: relative; z-index: 2; width: 232px; height: 146px; flex: 0 1 146px; min-height: 104px;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 14px; box-sizing: border-box; overflow: visible !important; isolation: isolate;
}
.v4-altar-launch-fx {
  position: absolute; left: 50%; bottom: -8px;
  width: 248px; height: 228px;
  translate: -50% 0;
  pointer-events: none; z-index: 6;
  image-rendering: pixelated;
}
.v4-altar-ring {
  position: absolute; z-index: 1; left: 50%; bottom: 5px;
  width: 214px; height: 52px;
  translate: -50% 0 !important; transform: none !important;
  border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(ellipse 52% 42% at 50% 48%, rgba(28, 18, 8, .38) 0%, rgba(168, 126, 54, .22) 52%, transparent 78%);
}
.v4-altar-ring::before {
  content: ""; position: absolute; inset: -4px -6px;
  animation: v4-astrolabe-breathe 3.4s ease-in-out infinite;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 64'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='120' cy='32' rx='112' ry='27' stroke='%23b88e44' stroke-width='1.4' stroke-dasharray='5 4' opacity='.68'/%3E%3Cellipse cx='120' cy='32' rx='98' ry='23' stroke='%23e8c678' stroke-width='1.8' opacity='.92'/%3E%3Cellipse cx='120' cy='32' rx='68' ry='15.5' stroke='%23cfa354' stroke-width='1.2' opacity='.8'/%3E%3Cpolygon points='120,7 142,24 218,32 142,40 120,57 98,40 22,32 98,24' stroke='%23f6dfa0' stroke-width='1.35' fill='rgba(246,223,160,0.08)'/%3E%3Cpolygon points='58,15 120,25 182,15 148,32 182,49 120,39 58,49 92,32' stroke='%23c89a48' stroke-width='1' opacity='.72'/%3E%3Ccircle cx='120' cy='7' r='2.4' fill='%23fff3c8'/%3E%3Ccircle cx='120' cy='57' r='2.4' fill='%23fff3c8'/%3E%3Ccircle cx='22' cy='32' r='2.4' fill='%23fff3c8'/%3E%3Ccircle cx='218' cy='32' r='2.4' fill='%23fff3c8'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
  filter: drop-shadow(0 0 6px rgba(240, 196, 98, .45));
}
.v4-altar-ring::after { content: none !important; display: none !important; }
@keyframes v4-astrolabe-breathe {
  0%, 100% { transform: scale(.96); opacity: .82; }
  50% { transform: scale(1.03); opacity: 1; }
}

.weekly-reward > :not(.v4-altar-stage),
.treasury-hero > :not(.v4-altar-stage),
.gift-welcome > :not(.v4-altar-stage) {
  position: relative; z-index: 5;
}
.v4-altar-stage .treasury-chest {
  width: 184px !important; height: 118px !important;
  position: relative; z-index: 4; overflow: visible; transform: none; margin: 0 !important;
  will-change: transform, opacity;
}
.treasury-chest > .chest-still { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 5px 5px rgba(24, 14, 4, .52)); }
/* Stock & Buy Supply Bar cleanly separated above the singular Open Chest CTA */
.v4-treasury-supply-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0;
  width: 100%; max-width: 296px; padding: 8px 12px; box-sizing: border-box;
  border-radius: 9px; position: relative; z-index: 8;
  background: rgba(255, 250, 236, .66); border: 1.5px solid rgba(138, 110, 62, .45);
  box-shadow: inset 0 1px 0 #ffffff, 0 2px 6px rgba(45, 28, 8, .12);
}
.treasury-count { display: inline-flex; align-items: baseline; gap: 6px; margin: 0; font-size: 14px; color: #5c4a30; line-height: 1; white-space: nowrap; }
.treasury-count strong { font-size: 24px; font-weight: 400; color: #312110; }
.avalon-button.v4-treasury-buy-btn {
  width: auto !important; min-width: 0 !important;
  height: 32px !important; min-height: 32px !important;
  padding: 2px 12px !important; margin: 0 !important;
  font-size: 13px !important; border-radius: 6px !important; white-space: nowrap !important;
}
.v4-altar-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; padding-top: 4px; flex-shrink: 0; position: relative; z-index: 10; pointer-events: auto; }
.v4-altar-actions .avalon-button.v4-cta { width: 256px !important; min-height: 48px !important; height: auto !important; font-size: 21px !important; letter-spacing: 3px; }
.treasury-hero .collection-hint { margin: 0; font-size: 13px; color: #7a5a35; }
.treasury-catalog.v4-well { padding: 16px 18px; overflow-y: auto; min-height: 0; border-left: 1px solid #120d08 !important; }
.v4-ledger-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 232, 186, .12);
}
.v4-ledger-title-group { display: flex; flex-direction: column; gap: 3px; }
.v4-ledger-head h3 { margin: 0; font-size: 20px; letter-spacing: 3px; color: #f2e1b6; }
.v4-ledger-head .collection-hint { margin: 0; font-size: 12px; color: #b7a47c; }
.v4-ledger-pills.v4-pills { background: linear-gradient(180deg, #18120c, #221a12); border: 1px solid rgba(212, 174, 98, .25); }
.treasury-catalog .treasury-tier { margin: 0 0 10px; border: 0 !important; border-left: 3px solid var(--r) !important; border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--r) 14%, transparent), rgba(255, 255, 255, .02) 65%); }
.treasury-catalog .treasury-tier > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; font-size: 14px; }
.treasury-tier > summary::-webkit-details-marker { display: none; }
.treasury-tier > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid #cdb98d; border-bottom: 2px solid #cdb98d; transform: rotate(-45deg); transition: transform var(--v4-mid) var(--v4-ease-back); }
.treasury-tier[open] > summary::after { transform: rotate(45deg); }

/* Gold treasury tier headers: reuse the warm collection palette without changing row layout. */
.treasury-catalog .treasury-tier > summary {
  background: linear-gradient(180deg, #f8dfa0 0%, #e4b955 57%, #dba44a 100%);
  color:#35230e; border-radius:5px; box-shadow:inset 0 0 0 1px #f6db90;
}
@media (hover: hover) and (pointer: fine) {
.treasury-catalog .treasury-tier > summary:hover {
  background:linear-gradient(180deg,#ffe9b1 0%,#ebc566 57%,#e3ae53 100%);
}
}
.treasury-catalog .treasury-tier > summary:focus-visible {
  outline:2px solid #6b4418;outline-offset:-2px;
}
.treasury-catalog .treasury-tier > summary .v4-chip-count { color:#39250c; }
.treasury-catalog .treasury-tier > summary .v4-chip {
  color:#39250c;background:#f8e2ae;border-color:#aa762e;
}
.treasury-catalog .treasury-tier > summary::after { border-color:#654118; flex-shrink:0; }
.treasury-catalog .treasury-tier[open] > summary { border-radius:5px 5px 0 0; }

.v4-chip { padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, .38); color: #f1e3bf; font-size: 13px; border: 1px solid rgba(255, 235, 190, .14); white-space: nowrap; }
.v4-chip-coin { color: #ffd86b; }
.v4-chip-count { margin-left: auto; color: #dfd0aa; font-size: 12px; white-space: nowrap; }
.treasury-catalog .treasury-rewards { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; padding: 8px 12px 14px; }

/* Mature Game Collection Card: Corner Seal Badge + Single Crisp Name Line */
.treasury-catalog .treasury-reward.v4-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  gap: 6px; padding: 24px 7px 9px; min-height: 112px; box-sizing: border-box;
  font-size: 12.5px; text-align: center; line-height: 1.25;
}
/* Reward ownership is a badge, not a disabled preview. Reuse the gold card face. */
.treasury-catalog .treasury-reward.v4-item:not(:disabled) {
  border-color: #d4a448 !important;
  background: radial-gradient(ellipse 75% 60% at 50% 38%, #ffffff 0%, rgba(255, 252, 240, 0) 72%), linear-gradient(180deg, #fdf5df 0%, #ecd8a6 100%) !important;
  opacity: 1;
  cursor: pointer;
}
.treasury-catalog .treasury-reward.v4-item:disabled {
  background: linear-gradient(180deg, #dfd3b6 0%, #cab994 100%) !important;
  border-color: #6d5c40 !important;
  opacity: .76;
  cursor: not-allowed;
}
.treasury-catalog .treasury-reward.v4-item:disabled .collection-art {
  filter: saturate(.72) contrast(.95);
}
.v4-own-corner {
  position: absolute; top: 5px; left: 5px; z-index: 2;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1.5px 6px; border-radius: 4px;
  font-size: 10.5px; line-height: 1.2; white-space: nowrap; pointer-events: none;
}
.v4-own-corner[data-owned="true"] {
  background: linear-gradient(180deg, #1d5732, #123b21);
  color: #d8ffe2; border: 1px solid #59c478;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.v4-own-corner[data-owned="false"] {
  background: rgba(38, 28, 18, .55);
  color: #e3d4b4; border: 1px solid rgba(120, 96, 62, .45);
}
.v4-treasury-item-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 100%; min-height: 16px;
  color: #2b1f11; font-size: 12.5px; line-height: 1.25;
}
.treasury-reward.is-unowned .v4-treasury-item-name {
  color: #463824;
}
.treasury-reward .collection-art { width: 100%; height: 56px; display: grid; place-items: center; }
.treasury-reward .collection-art canvas, .treasury-reward .collection-art .wardrobe-part-art { width: 52px; height: 52px; }
.treasury-reward .collection-art img { max-height: 52px; max-width: 92px; object-fit: contain; }
.treasury-reward .collection-art .dynamic-nameplate { width: 92px; }
.v4-well .collection-help { color: #cdbb90; font-size: 14px; margin-top: 12px; }
.v4-well .collection-help summary { color: #f0d996; cursor: pointer; }
.v4-well .collection-help p { color: #c4b287; font-size: 13px; line-height: 1.6; }

/* Weekly quest */
.weekly-layout { height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.weekly-card.v4-pedestal { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; padding: 26px 28px; align-items: stretch; flex-shrink: 0; }
.weekly-objective { display: flex; flex-direction: column; gap: 16px; justify-content: center; min-width: 0; }
.weekly-badge { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 4px 14px 4px 8px; border-radius: 999px;
  background: linear-gradient(180deg, #221a13, #30261b); color: #f1d58e; font-size: 14px; box-shadow: var(--v4-shadow-well); }
.weekly-badge svg { width: 20px; height: 20px; fill: currentColor; }
.weekly-objective h3 { margin: 0; font-size: 30px; color: #2e2415; letter-spacing: 2px; }
.v4-meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.v4-meter .weekly-progress { margin: 0; font-size: 22px; color: #3a2a16; }
.v4-stamps { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.v4-stamps-label { font-size: 14px; color: #6a5a40; }
.v4-stamp-slot { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 2px dashed rgba(106, 80, 40, .5); background: rgba(255, 250, 235, .45); }
.v4-stamp-slot[data-on="true"] { border: 2px solid #7a4f12; background: radial-gradient(circle at 36% 30%, #fff2b6, #e2a83a 58%, #8a5a12); box-shadow: 0 0 10px rgba(255, 190, 70, .6); }
.v4-stamp-slot[data-on="true"]::after { content: "✦"; position: absolute; inset: 0; display: grid; place-items: center; color: #4a2c06; font-size: 14px; }
.v4-stamps .collection-hint { margin: 0; font-size: 13px; color: #6a5a40; }
.weekly-reward.v4-well { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; color: #f0dfb4; isolation: isolate; }
.weekly-reward .v4-altar-stage { width: 224px; height: 142px; padding-bottom: 14px; }
.weekly-reward .v4-altar-stage .treasury-chest { width: 176px !important; height: 112px !important; }
.weekly-reward .v4-altar-ring { width: 204px; height: 48px; bottom: 0; }
.weekly-reward strong { font-size: 18px; font-weight: 400; color: #ffe9b0; text-shadow: 0 2px 4px #000; }
.weekly-reward p { margin: 0; text-shadow: 0 1px 3px #000; }
.v4-pending { color: #ffd86b; font-size: 15px; }
.weekly-reward .collection-state { color: #cdbb90; font-size: 14px; }
.weekly-reward > .avalon-button { width: 210px !important; min-height: 46px !important; height: auto !important; font-size: 18px !important; }

/* Recent rewards */
.v4-receipts.v4-well { height: 100%; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.v4-receipts .economy-receipt { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 8px 12px; margin: 0;
  border-radius: 8px; border: 2px solid #7d6640; border-left: 5px solid var(--r); flex-shrink: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--r) 16%, #f3e6c6), #e9dab4 70%); box-shadow: 0 2px 0 rgba(0, 0, 0, .45); }
.v4-receipt-art { width: 68px; height: 58px; display: grid; place-items: center; border-radius: 6px; background: radial-gradient(circle, #fffdf6, #ecdcb6); box-shadow: inset 0 0 0 1px rgba(120, 90, 45, .35); }
.v4-receipt-art .collection-art { height: 54px; width: 64px; display: flex; align-items: center; justify-content: center; }
.v4-receipt-art canvas, .v4-receipt-art .wardrobe-part-art { width: 50px; height: 50px; }
.v4-receipt-art img { max-height: 50px; max-width: 62px; }
.v4-receipt-art .dynamic-nameplate { width: 62px; }
.v4-coin-glyph { font-size: 30px; color: #c98a1c; text-shadow: 0 0 6px rgba(255, 200, 90, .7); }
.v4-receipt-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.v4-receipt-copy strong { font-size: 17px; font-weight: 400; color: #2e2415; overflow-wrap: anywhere; }
.v4-receipts .economy-receipt .avalon-button { width: 120px; min-width: 0; height: 38px; min-height: 38px; font-size: 15px; margin: 0; }
.v4-receipts .v4-rarity { font-size: 12px; padding: 1px 10px 1px 8px; }

/* ═══ Single-Line Horizontally Centered Nameplate Nickname (Item 21) ════════ */
.cosmetic-nameplate-name,
.menu-profile-plate .cosmetic-nameplate-name,
.cosmetic-nameplate-name[data-long="true"],
.menu-profile-plate .cosmetic-nameplate-name[data-long="true"] {
  position: absolute !important;
  left: 23% !important;
  width: 71% !important;
  max-width: 71% !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  overflow-wrap: normal !important;
  word-break: keep-all !important;
  line-height: 1.25 !important;
}
.cosmetic-nameplate-room .cosmetic-nameplate-name {
  left: 10% !important;
  width: 80% !important;
  max-width: 80% !important;
}

/* Item 20: Transparent PNG Avatars (no solid avatar background fill) */
.cosmetic-nameplate-avatar,
.cosmetic-avatar-art,
.v4-card-avatar-frame {
  background: transparent !important;
  box-shadow: none !important;
}

/* ═══ Wardrobe document (资料 / 衣柜 / 名片, Items 17, 18, 19) ══════════════ */
.cosmetics-document.v4-workbench .cosmetics-tabs { justify-self: center; align-self: center; border: 0 !important; width: max-content; position: relative; z-index: 1; }
.cosmetics-document.v4-workbench .cosmetics-content, .cosmetics-document.v4-workbench .cosmetics-footer { position: relative; z-index: 1; }
.cosmetics-document.v4-workbench .cosmetics-footer { border-top: 1px solid rgba(120, 90, 45, .42) !important; }
.wardrobe-preview.v4-stage { border-right: 0 !important; padding: 8px 10px 8px !important; overflow: hidden !important;
  background:
    radial-gradient(ellipse 58% 46% at 50% 52%, #fffaf0 0%, rgba(255, 248, 230, .62) 42%, transparent 74%),
    radial-gradient(ellipse 34% 6% at 50% 82%, rgba(80, 55, 20, .32), transparent 72%),
    linear-gradient(180deg, #f3e6c6 0%, #e3cfa2 70%, #cfb789 100%) !important; }
.wardrobe-preview.v4-stage > * { position: relative; z-index: 1; }
.wardrobe-preview-hint { display: flex; justify-content: center; margin: 2px 0 0 !important; color: #6a5a40; font-size: 12px; flex-shrink: 0; }
.cosmetics-document .wardrobe-equipment-stage { min-height: 0; flex: 1 1 auto; overflow: hidden !important; }
/* (2026-11-19) equipment rail rules moved to wardrobe-layout-contract.css V5 contract */
.equipment-count { background: #2a1d10 !important; color: #ffe9b0 !important; border-radius: 6px; }

/* Item 18: Clean Non-Scrolling Category Column with Concentric Corners */
.cosmetics-document .wardrobe-browse-mode {
  display: grid !important;
  grid-template-columns: 72px minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  gap: 0 14px !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.wardrobe-browse-mode > .wardrobe-categories.v4-well {
  grid-column: 1 !important;
  grid-row: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: space-between !important;
  width: 72px !important;
  height: 100% !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
  padding: 5px !important;
  gap: 4px !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}
.cosmetics-document .wardrobe-categories .wardrobe-category.avalon-button {
  flex: 1 1 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: 58px !important;
  padding: 2px !important;
  gap: 2px !important;
  box-sizing: border-box !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 7px !important;
  color: #d9c9a2 !important;
  box-shadow: none !important;
  text-shadow: 0 1px 0 #000;
}
@media (hover: hover) and (pointer: fine) {
.cosmetics-document .wardrobe-categories .wardrobe-category.avalon-button:hover:not(:disabled) {
  background: rgba(255, 238, 200, .09) !important; color: #fff3d2 !important; transform: none;
}
}
.cosmetics-document .wardrobe-categories .wardrobe-category.avalon-button[aria-pressed="true"] {
  background: linear-gradient(180deg, #f6e5b6, #dcbd73) !important; color: #2c1f0e !important;
  border-color: #fff2c6 !important; text-shadow: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5), inset 0 1px 0 #fffbe6 !important;
}
.wardrobe-category svg { width: 22px; height: 22px; flex-shrink: 0; }

.v4-wardrobe-browser {
  grid-column: 2 !important;
  grid-row: 1 !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.v4-wardrobe-top-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; flex-shrink: 0;
}
.v4-wardrobe-top-left, .v4-wardrobe-top-right {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.v4-wardrobe-part-title { margin: 0; font-size: 18px; font-weight: 400; color: #2e2415; letter-spacing: 1px; }
.wardrobe-subcategories.v4-pills { align-self: center; width: max-content; max-width: 100%; flex-shrink: 0; }
.wardrobe-count { padding: 2px 10px; border-radius: 999px; background: rgba(60, 40, 20, .12); color: #5d4b30; font-size: 12.5px; white-space: nowrap; }
.cosmetics-document .wardrobe-search.avalon-input {
  width: 148px !important; min-width: 118px !important; height: 34px !important; min-height: 34px !important;
  padding: 2px 12px !important; font-size: 13.5px !important; border-radius: 999px !important; text-align: left;
}
.wardrobe-grid.v4-well { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px !important; gap: 12px !important; grid-template-columns: repeat(auto-fill, minmax(106px, 1fr)); }
.wardrobe-grid.v4-well.wardrobe-sets { grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); }
.cosmetics-document .wardrobe-item.v4-item.avalon-button {
  display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important;
  gap: 6px !important; height: 102px !important; min-height: 102px !important; padding: 8px 6px !important;
}
.cosmetics-document .wardrobe-sets .wardrobe-item.v4-item.avalon-button {
  height: 134px !important; min-height: 134px !important;
}
.cosmetics-document .wardrobe-item-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-align: center; line-height: 1.25 !important; font-size: 12.5px !important; max-width: 100%;
}
.wardrobe-item-count { display: none !important; }
.wardrobe-empty h3 { color: #f0dfb4; } .wardrobe-empty .wardrobe-muted { color: #c4b287; }
.wardrobe-detail.v4-pedestal {
  flex-shrink: 0; max-height: 152px; overflow-y: auto;
  padding: 12px 16px !important;
  display: flex; flex-direction: column; gap: 8px;
  border-top: 2px solid #7d6640 !important; border-radius: 10px;
}
.wardrobe-detail-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.wardrobe-detail-heading h4 { font-size: 16px !important; color: #2e2415; margin: 0 !important; }
.wardrobe-detail-heading .v4-rarity { font-size: 12px; padding: 2px 10px 2px 8px; margin-right: auto; }
.wardrobe-detail-modes.v4-pills { padding: 3px; }
.wardrobe-detail-modes .avalon-button[data-variant="pill"] { height: 26px !important; min-height: 26px !important; font-size: 13px !important; padding: 2px 12px !important; }
.cosmetics-document .wardrobe-detail-heading .avalon-button[data-variant="ghost"] { width: auto; min-width: 56px; height: 30px; min-height: 30px; padding: 2px 12px; font-size: 13px; }
.v4-unlock-error { margin: 0 !important; color: #8c2820 !important; font-size: 12.5px !important; }

/* Swatches & Item 19 Circular Jewel Custom Color Orb */
.wardrobe-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 4px 4px; margin: 0; overflow: visible; }
.cosmetics-document .wardrobe-swatch.avalon-button { width: 32px !important; min-width: 32px; height: 32px; min-height: 32px; padding: 4px !important; border-radius: 50% !important;
  background: #f6ecd6 !important; border: 2px solid #8a7550 !important; box-shadow: 0 2px 0 rgba(0, 0, 0, .3) !important; transition: transform 180ms var(--v4-ease-back) !important; }
@media (hover: hover) and (pointer: fine) {
.cosmetics-document .wardrobe-swatch.avalon-button:hover:not(:disabled) { transform: translateY(-2px) scale(1.06); }
}
.cosmetics-document .wardrobe-swatch.avalon-button[aria-pressed="true"] { border-color: #c8902f !important; outline: none !important; box-shadow: 0 0 0 2px #f5d27a, 0 0 10px rgba(245, 200, 100, .6) !important; }
.wardrobe-swatch-fill { width: 100% !important; height: 100% !important; border-radius: 50%; box-shadow: inset 0 3px 3px rgba(255, 255, 255, .4), inset 0 -2px 2px rgba(0, 0, 0, .25); }

.wardrobe-dye-controls {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 10px;
  flex-basis: 100%; min-width: 0; margin-left: 0; padding-left: 0; border-left: 0;
}
.v4-dye-orb-chip {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 2px 10px 2px 3px; border-radius: 999px;
  background: rgba(255, 250, 235, .55); border: 1.5px solid #8a7550;
  box-shadow: inset 0 1px 0 #fffaf0, 0 2px 0 rgba(70, 50, 20, .22);
  transition: transform 160ms var(--v4-ease-back), border-color 140ms, box-shadow 180ms;
}
@media (hover: hover) and (pointer: fine) {
.v4-dye-orb-chip:hover {
  transform: translateY(-2px); border-color: #c8902f;
}
}
.v4-dye-orb-chip[data-active="true"] {
  border-color: #c8902f; background: #fff8e4;
  box-shadow: 0 0 0 2px #f5d27a, 0 0 10px rgba(245, 200, 100, .55);
}
.v4-dye-orb {
  position: relative; width: 28px; height: 28px; border-radius: 50%; flex: none;
  padding: 3px; box-sizing: border-box;
  background: conic-gradient(#ff6b8b, #ffd166, #6be09b, #57adff, #bd74ff, #ff6b8b);
  box-shadow: inset 0 0 0 1px rgba(45, 28, 10, .45), 0 1px 3px rgba(0, 0, 0, .35);
}
.v4-dye-orb-fill {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background: var(--swatch, #eeeeee);
  border: 1.5px solid #fffaf0; box-sizing: border-box;
  box-shadow: inset 0 3px 3px rgba(255, 255, 255, .42), inset 0 -2px 2px rgba(0, 0, 0, .28);
}
.v4-dye-color-input {
  position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important;
  opacity: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; cursor: pointer !important;
}
.v4-dye-orb-text { font-size: 13px; color: #3a2d19; white-space: nowrap; }
.wardrobe-dye-controls .avalon-button[data-variant="ghost"] {
  width: auto !important; min-width: 72px !important; height: 30px !important; min-height: 30px !important;
  padding: 2px 12px !important; font-size: 12px !important; border-radius: 999px !important;
}

.cosmetics-document .wardrobe-stack-row .avalon-button[data-variant="ghost"] { width: 46px; min-width: 46px; height: 30px; min-height: 30px; padding: 2px; font-size: 12px; }
/* Unclipped Basics & Card Editor Grids (generous inset padding so selected `.v4-item` rings are NEVER sliced!) */
.cosmetics-document .wardrobe-basics {
  padding: 8px 12px 16px !important; gap: 14px !important; box-sizing: border-box;
}
.wardrobe-basics > h3 { color: #2e2415; letter-spacing: 2px; margin: 0; }
.wardrobe-basics h4 { color: #4a3b25; margin: 0 0 6px; }
.wardrobe-basic-grid, .wardrobe-body-choices {
  padding: 8px !important; gap: 12px !important; overflow: visible !important;
}
.cosmetic-card-editor {
  display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 0;
}
.v4-card-editor-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; flex-shrink: 0;
}
.cosmetic-card-section {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
.cosmetic-avatar-grid.v4-well, .cosmetic-plate-grid.v4-well {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px !important; gap: 12px !important;
}
.cosmetic-avatar-art canvas.v4-animated-avatar,
.cosmetic-nameplate-avatar canvas.v4-animated-avatar {
  width: 100%; height: 100%; object-fit: contain; display: block; image-rendering: pixelated;
}
.cosmetic-card-section > h3 { color: #2e2415; letter-spacing: 2px; }

/* Footer: restore (ghost) · feedback · confirm (primary) + cancel (secondary). */
.cosmetics-document.v4-workbench .cosmetics-footer > .avalon-paired { grid-template-columns: 180px 180px; gap: 14px; }

/* ═══ Item 5: Redesigned Light-Parchment Equal-Height Traveler Card ═════════ */
.game-document.cosmetics-public-card.v4-card-shell {
  width: min(840px, calc((100vw - 36px) / var(--v4-ui-scale))) !important;
  max-width: none !important;
  padding: 20px 28px 22px !important;
  gap: 16px !important;
  display: flex !important; flex-direction: column; align-items: stretch;
  overflow: hidden !important;
}
.v4-card-shell > .document-title {
  margin: 0 !important; padding: 0 48px 4px !important; font-size: 26px !important; line-height: 34px !important;
}
.v4-card-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  position: relative; z-index: 1;
}
/* Left Column: Full-height Character Showcase Pedestal === Combined Right Panels */
.v4-card-stage.v4-pedestal {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  width: 100%; height: 100% !important; min-height: 326px;
  padding: 16px 14px 12px; box-sizing: border-box;
  border-radius: 10px; isolation: isolate; overflow: hidden;
  background:
    radial-gradient(ellipse 62% 54% at 50% 46%, #fffdf6 0%, rgba(255, 250, 236, .75) 48%, transparent 78%),
    linear-gradient(180deg, #f7ecd2 0%, #e5d2a7 100%) !important;
  border: 2px solid #8a7147 !important;
  box-shadow: var(--v4-shadow-pedestal) !important;
}
.v4-card-figure-box {
  position: relative; flex: 1 1 auto; width: 100%;
  display: flex; align-items: center; justify-content: center;
  isolation: isolate;
}
.v4-card-figure-box .v4-altar-ring {
  width: 196px; height: 46px; bottom: 8px;
}
.v4-card-figure-box .cosmetic-character-render {
  position: relative; z-index: 2;
}
.v4-card-figure-box .cosmetic-character-render canvas {
  width: 216px !important; height: 216px !important;
  filter: drop-shadow(0 6px 6px rgba(45, 28, 10, .28));
}
.v4-card-figure-caption {
  margin: 0 !important; padding: 3px 14px; border-radius: 999px;
  background: rgba(120, 90, 45, .12); border: 1px solid rgba(138, 113, 71, .35);
  font-size: 12px; letter-spacing: 2px; color: #5b482d;
}

/* Right Column: Two Stacked Light-Parchment Panels */
.v4-card-dossier {
  display: flex; flex-direction: column; gap: 14px; min-width: 0; justify-content: space-between;
}
.v4-card-crest-panel.v4-pedestal {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 16px; box-sizing: border-box;
  background: linear-gradient(180deg, #f8efd8 0%, #e8d7b0 100%) !important;
}
.v4-card-plate-wrap {
  width: 100%; max-width: 440px;
  border-radius: 8px; overflow: hidden;
  border: 2px solid #8a6e3e;
  box-shadow: 0 4px 12px rgba(38, 24, 8, .28);
}
.v4-card-plate-wrap .cosmetic-nameplate {
  width: 100% !important; max-width: none !important; margin: 0 !important; display: block;
}
.v4-card-crest-meta {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
  font-size: 13px; color: #5c492e;
}
.v4-card-crest-dot { color: #b58632; font-size: 11px; }

.v4-card-attire-panel.v4-pedestal {
  flex: 1 1 auto; padding: 12px 14px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(180deg, #f7edd4 0%, #e5d3aa 100%) !important;
}
.v4-card-gear-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 2px 6px; border-bottom: 1px solid rgba(138, 110, 62, .32);
  color: #3a2a16; font-size: 15px;
}
.v4-card-gear-head strong { font-weight: 400; letter-spacing: 1px; }
.v4-card-gear-head small { color: #6e5a3c; font-size: 12px; }
.v4-card-gear-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; flex: 1;
}
.v4-card-gear-slot.v4-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px 4px; min-height: 70px; text-align: center;
}
.v4-card-gear-slot .wardrobe-part-art,
.v4-card-gear-slot .wardrobe-part-art canvas { width: 40px !important; height: 40px !important; }
.v4-card-gear-empty { font-size: 18px; line-height: 40px; color: #9c8a68; }
.v4-card-gear-name {
  font-size: 12px; line-height: 1.2; color: #3b2f1f;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v4-card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding-top: 8px; border-top: 1px solid rgba(120, 90, 45, .38);
  position: relative; z-index: 1;
}
.v4-card-footer > .avalon-button {
  width: 156px !important; min-width: 0 !important; height: 44px !important; min-height: 44px !important; font-size: 18px !important; margin: 0 !important;
}
.v4-card-footer > .avalon-paired {
  display: grid; grid-template-columns: 168px 140px; gap: 12px; width: auto !important; margin: 0 !important;
}
.v4-card-footer > .avalon-paired > .avalon-button,
.v4-card-footer-right > .avalon-button {
  width: 100% !important; min-width: 0 !important; height: 44px !important; min-height: 44px !important; font-size: 18px !important; margin: 0 !important;
}
.v4-card-footer-right { width: 160px; margin-left: auto; }

/* ═══ Onboarding gift ═════════════════════════════════════════════════════ */
.game-document.gift-welcome.v4-gift .gift-chest.v4-altar-stage { width: 300px; height: 196px; padding-bottom: 18px; overflow: visible !important; animation: v4-modal-in 520ms var(--v4-ease-back) both; }
.gift-welcome .v4-altar-stage .v4-altar-launch-fx { width: 310px; height: 285px; bottom: -10px; }
.gift-welcome .v4-altar-stage .treasury-chest { width: 244px !important; height: 158px !important; }
.gift-welcome .v4-altar-stage .v4-altar-ring { width: 264px; height: 60px; bottom: 0; }
.gift-welcome.v4-gift > .gift-count { margin: 0; padding: 4px 20px; border-radius: 999px; font-size: 28px; line-height: 1.2; background: linear-gradient(180deg, #221a13, #30261b); color: #ffe08a; box-shadow: var(--v4-shadow-well); text-shadow: 0 0 10px rgba(255, 200, 90, .55); }
.game-document.gift-welcome.v4-gift > .avalon-button { width: 270px; min-height: 58px; font-size: 24px; letter-spacing: 3px; }

/* ═══ 1280×720 desktop composition (logical px; zoom scales it for 1080p–4K) ═ */
@media (min-width: 801px) and (min-height: 601px) {
  .game-document.collection-document.v4-workbench { width: 1140px; height: 640px; padding: 16px 26px 18px; gap: 12px; display: flex; flex-direction: column; overflow: hidden; }
  .collection-document.v4-workbench > .document-title { flex-shrink: 0; margin: 0; padding: 0 64px; font-size: 26px; line-height: 34px; }
  .collection-document.v4-workbench > .document-close, .cosmetics-document.v4-workbench > .document-close { top: 14px !important; right: 18px !important; width: 38px !important; height: 38px !important; min-width: 38px !important; min-height: 38px !important; font-size: 18px !important; }
  .collection-document.v4-workbench > .economy-actions > .avalon-button { width: 180px; min-height: 48px; height: 48px; font-size: 20px; margin: 0; }

  .game-modal-layer:has(.cosmetics-document) { padding: 20px; }
  .game-document.cosmetics-document.v4-workbench { width: 1140px; height: 640px; padding: 0 24px; grid-template-rows: 60px 50px minmax(0, 1fr) 70px; }
  .cosmetics-document.v4-workbench > .document-title { top: 14px; font-size: 26px; line-height: 34px; }
  .cosmetics-document.v4-workbench .cosmetics-content { padding: 10px 0; }
  .cosmetics-document.v4-workbench .wardrobe-workspace { grid-template-columns: 360px minmax(0, 1fr); gap: 20px; }
  .cosmetics-document.v4-workbench .cosmetics-footer .avalon-paired > .avalon-button { width: 180px; height: 48px; min-height: 48px; font-size: 22px; }
  .cosmetics-document.v4-workbench .cosmetics-footer > .cosmetics-restore.avalon-button { width: 150px; min-width: 150px; height: 44px; min-height: 44px; font-size: 20px; }

  .game-document.cosmetics-public-card.v4-card-shell { width: 840px !important; padding: 20px 28px 22px !important; }
  .game-document.gift-welcome.v4-gift { width: 540px; padding: 28px 34px 30px; gap: 14px; }
}

/* Compact landscape keeps V3 metrics but the new skin. */
@media (max-height: 600px) {
  .collection-layout { grid-template-columns: minmax(0, 1fr) 200px; gap: 10px; }
  .collection-grid.v4-well { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); grid-auto-rows: 96px; gap: 6px; padding: 6px; }
  .collection-document .collection-item.v4-item.avalon-button { padding: 4px 6px 5px; gap: 4px; }
  .collection-item > .collection-art { height: 100%; min-height: 0; } .collection-item .collection-art canvas, .collection-item .collection-art .wardrobe-part-art { width: 46px; height: 46px; }
  .v4-detail-stage { height: 92px; } .v4-detail-stage .collection-art { height: 86px; } .v4-detail-stage .collection-art canvas, .v4-detail-stage .collection-art .wardrobe-part-art { width: 72px; height: 72px; }
  .collection-detail.v4-pedestal { padding: 8px; gap: 4px; } .collection-detail.v4-pedestal h3 { font-size: 16px; }
  .collection-detail .v4-detail-actions .avalon-button { min-height: 34px; font-size: 14px; padding: 4px 8px; }
  .treasury-layout { grid-template-columns: 40% minmax(0, 1fr); gap: 10px; }
  .v4-altar-stage { width: 170px; height: 96px; padding-bottom: 10px; } .v4-altar-stage .treasury-chest { width: 130px !important; height: 84px !important; } .v4-altar-ring { width: 148px; height: 36px; }
  .v4-altar-actions .avalon-button.v4-cta { width: 180px !important; min-height: 38px !important; font-size: 16px !important; }
  .weekly-card.v4-pedestal { grid-template-columns: minmax(0, 1fr) 180px; padding: 10px 12px; gap: 12px; }
  .weekly-objective h3 { font-size: 20px; } .weekly-objective { gap: 8px; }
  .v4-wallet-badge { height: 28px; } .v4-wallet-badge strong { font-size: 16px; }
  .v4-card-body { grid-template-columns: 190px minmax(0, 1fr); gap: 10px; }
  .v4-card-stage.v4-pedestal { min-height: 200px; padding: 8px; } .v4-card-figure-box .cosmetic-character-render canvas { width: 136px !important; height: 136px !important; }
}
@media (prefers-reduced-motion: reduce) { .v4-altar-ring::before, .v4-altar-ring::after, .v4-detail-stage::before { animation: none !important; } }

/* 2026-11-17: local review. Existing V4 pills/materials only; no card-editor changes. */
.collection-document { --collection-nav-width: 392px; }
.collection-document .collection-tabs, .collection-document .collection-filters { width: var(--collection-nav-width); max-width: 100%; box-sizing: border-box; display:flex; }
.collection-document .collection-tabs > button, .collection-document .collection-filters > button { flex:1 1 0; min-width:0; }
.collection-document .v4-rarity-bar { justify-content:flex-start; flex-wrap:nowrap; }
.collection-document .v4-rarity-filters { flex:0 1 auto; width:max-content; max-width:100%; }
.collection-document .v4-sort-pills { margin-left:auto; flex:0 0 auto; }
.collection-item .collection-art[data-art-type="nameplate"] .dynamic-nameplate { width:100%; min-width:0; }
.collection-art[data-art-type="nameplate"] { overflow:hidden; }
.collection-item .collection-art[data-art-type="nameplate"] img { width:100%; aspect-ratio:3.3; object-fit:contain; }
.wardrobe-sets .wardrobe-item .wardrobe-set-progress { font-size:11px; line-height:14px; color:var(--v4-ink-soft); }
.cosmetics-document .wardrobe-sets .wardrobe-item.v4-item.avalon-button { gap:3px !important; }
@media (max-height:600px), (max-width:800px) {
 .collection-document { --collection-nav-width: 320px; }
 .collection-document .v4-rarity-bar { gap:5px; }
 .collection-document .v4-rarity-filters { overflow-x:auto; min-width:0; flex:1 1 auto; }
 .collection-document .v4-rarity-filters > button { flex:0 0 auto; padding:2px 7px !important; }
 .collection-document .v4-sort-pills > button { padding:2px 8px !important; }
 .collection-document .v4-filter-stack { gap:6px; }
}

/* Follow-up: fixed card tracks prevent a filtered single result stretching. */
.cosmetic-avatar-grid.v4-well { align-content:start; grid-auto-rows:112px; }
.cosmetic-plate-grid.v4-well { align-content:start; grid-auto-rows:132px; }
.cosmetics-document .cosmetic-content-option.avalon-button { height:100%; min-height:0; box-sizing:border-box; }
/* Only the ten visually audited 3:1 basic plates: crop plain top/bottom margins, never stretch artwork. */
img[src*="/cos-nameplate-"]:not([src*="moonlit"]):is([src$="-1.png"],[src$="-2.png"],[src$="-3.png"],[src$="-4.png"],[src$="-5.png"],[src$="-6.png"],[src$="-7.png"],[src$="-8.png"],[src$="-9.png"],[src$="-10.png"]) { aspect-ratio:3.3; object-fit:cover !important; object-position:center; }
.collection-art .nameplate-preview-frame { width:100% !important; height:auto !important; aspect-ratio:3.3; object-fit:contain; image-rendering:pixelated; }
@media(max-height:600px) {
 .cosmetic-avatar-grid.v4-well { grid-auto-rows:90px; }
 .cosmetic-plate-grid.v4-well { grid-auto-rows:110px; }
}

/* Set labels: reserve two text lines and progress inside the existing 134px card. */
.cosmetics-document .wardrobe-sets .wardrobe-item.v4-item.avalon-button { box-sizing:border-box; gap:2px !important; }
.cosmetics-document .wardrobe-sets .wardrobe-item-picture,
.cosmetics-document .wardrobe-sets .wardrobe-item-picture canvas { width:64px !important; height:64px !important; flex-shrink:0; }
.cosmetics-document .wardrobe-sets .wardrobe-item-name { flex:0 0 28px; height:28px; min-height:28px; line-height:14px !important; margin:0; }
.cosmetics-document .wardrobe-sets .wardrobe-set-progress { flex:0 0 14px; height:14px; min-height:14px; line-height:14px; margin:0; white-space:nowrap; }

/* Shared nameplate overlay. Artwork never determines avatar/text anchors. */
.cosmetic-nameplate { container-type:inline-size; }
.cosmetic-nameplate > .dynamic-nameplate { position:absolute; inset:0; width:100%; height:100%; z-index:-1; pointer-events:none; }
.cosmetic-nameplate .cosmetic-nameplate-avatar { left:1.5% !important; top:50% !important; width:18% !important; aspect-ratio:1; transform:translateY(-50%) !important; line-height:0; }
.cosmetic-nameplate .cosmetic-nameplate-avatar :is(img,canvas) { display:block; width:100% !important; height:100% !important; object-fit:contain; image-rendering:pixelated; }
.cosmetic-nameplate .cosmetic-nameplate-name { left:23% !important; width:71% !important; max-width:71% !important; top:50% !important; transform:translateY(-50%) !important; margin:0 !important; padding:0 !important; text-align:center !important; font-family:AvalonPixel,monospace !important; font-size:7.272727cqw !important; line-height:1.2 !important; white-space:nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important; }
.cosmetic-nameplate.cosmetic-nameplate-room .cosmetic-nameplate-avatar { display:none; }
.cosmetic-nameplate.cosmetic-nameplate-room .cosmetic-nameplate-name { left:10% !important; width:80% !important; max-width:80% !important; }
.court-labels button.court-nameplate.cosmetics-world-nameplate { aspect-ratio:3.3; height:auto; min-height:0; padding:0 !important; }
.court-labels button.court-nameplate.cosmetics-world-nameplate .court-label-name { position:absolute !important; left:10%; top:50%; transform:translateY(-50%); width:80% !important; max-width:80% !important; padding:0 !important; margin:0 !important; text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Room roster must not override the shared overlay font scale. */
.v4-room-plate-item .cosmetic-nameplate .cosmetic-nameplate-name { font-size:7.272727cqw !important; }

/* Preserve intrinsic background height after sharing the nameplate overlay. */
.cosmetic-nameplate > .dynamic-nameplate { position:relative; inset:auto; display:block; width:100%; height:auto; aspect-ratio:3.3; z-index:0; }
.menu-profile-plate .cosmetic-nameplate { height:auto; aspect-ratio:3.3; }
.cosmetic-nameplate .cosmetic-nameplate-art { z-index:0; }
.cosmetic-nameplate .cosmetic-nameplate-avatar,
.cosmetic-nameplate .cosmetic-nameplate-name { z-index:1; }
/* Character and floor FX use one sprite-space anchor; retain the existing ring artwork. */
.v4-card-figure-rig { --card-figure-size:216px; --card-foot-y:93.75%; position:relative; flex:none; width:var(--card-figure-size); height:var(--card-figure-size); isolation:isolate; }
.v4-card-figure-rig .cosmetic-character-render { position:absolute; inset:0; display:block; line-height:0; z-index:2; }
.v4-card-figure-rig .cosmetic-character-render canvas { display:block; width:100% !important; height:100% !important; filter:none; }
.v4-card-figure-box .v4-card-figure-rig .v4-altar-ring { left:50%; top:var(--card-foot-y); bottom:auto; width:90%; height:21%; translate:-50% -50% !important; z-index:0; }
.v4-card-contact-shadow { position:absolute; left:50%; top:var(--card-foot-y); width:38%; height:8%; translate:-50% -50%; border-radius:50%; background:radial-gradient(ellipse at center,rgba(48,32,16,.38) 0%,rgba(48,32,16,.18) 45%,transparent 74%); pointer-events:none; z-index:1; }
@media(max-height:600px) { .v4-card-figure-rig { --card-figure-size:136px; } }

/* Independent rarity gems with breathing room; wrap whole metadata groups on narrow cards. */
.v4-card-crest-meta { column-gap:22px; row-gap:10px; width:100%; }
.v4-card-crest-tag { display:inline-flex; align-items:center; gap:8px; min-width:0; max-width:100%; }
.v4-card-crest-tag .v4-gem { position:static; display:inline-block; flex:0 0 9px; margin:0 2px; }
.v4-card-crest-copy { min-width:0; overflow-wrap:anywhere; line-height:1.4; }
@media(max-width:860px), (max-height:620px) { .v4-card-crest-meta { column-gap:16px; row-gap:8px; } }

/* One avatar media size for static and animated art. Do not resize garments/nameplates. */
.collection-item .collection-art[data-art-type="avatar"] .v4-avatar-media { width:68px; height:68px; max-width:68px; max-height:68px; object-fit:contain; }
.v4-detail-stage .collection-art[data-art-type="avatar"] .v4-avatar-media { width:136px; height:136px; max-width:136px; max-height:136px; object-fit:contain; }
@media(max-height:600px) {
 .collection-item .collection-art[data-art-type="avatar"] .v4-avatar-media { width:46px; height:46px; max-width:46px; max-height:46px; }
 .v4-detail-stage .collection-art[data-art-type="avatar"] .v4-avatar-media { width:72px; height:72px; max-width:72px; max-height:72px; }
}

/* Personal plate: center the nickname on the entire artwork, not the avatar's remaining lane. */
.cosmetic-nameplate:not(.cosmetic-nameplate-room):not(.cosmetic-nameplate-plain) .cosmetic-nameplate-name {
 left:50% !important; top:50% !important; width:56% !important; max-width:56% !important;
 transform:translate(-50%,-50%) !important; text-align:center !important;
 white-space:nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important;
}

/* Receipt navigation is a compact secondary toolbar, not full-size action controls. */
.collection-document .receipt-pagination { display:flex; align-items:center; justify-content:center; gap:12px; flex-wrap:wrap; padding:12px 8px 4px; margin:0; flex-shrink:0; }
.collection-document .receipt-pagination .avalon-button { width:auto; min-width:72px; height:32px; min-height:32px; margin:0; padding:5px 12px; font:14px/1.3 AvalonPixel,monospace; letter-spacing:0; }
.collection-document .receipt-pagination .collection-hint { margin:0 4px; font-size:14px; white-space:nowrap; }
.collection-document .receipt-pagination .avalon-button:last-child { margin-left:12px; }
.collection-document[data-section="receipts"] .economy-content { display:flex; flex-direction:column; min-height:0; }
.collection-document[data-section="receipts"] .v4-receipts { flex:1 1 0; min-height:0; height:auto; }
.wardrobe-part-art[data-component-preview] { position:relative; }
.wardrobe-part-art .component-preview-label { position:absolute; right:0; bottom:0; padding:1px 3px; border-radius:3px; background:#30271fe6; color:#f6ecd3; font:11px/1.2 AvalonPixel,monospace; white-space:nowrap; }
@media(max-width:650px) { .collection-document .receipt-pagination { gap:8px; padding:10px 0 2px; } .collection-document .receipt-pagination .avalon-button { min-width:64px; padding:5px 8px; } .collection-document .receipt-pagination .avalon-button:last-child { margin-left:0; } }

/* Full-width compact tier status; never size empty copy like an item tile. */
.treasury-catalog .treasury-rewards > .treasury-empty { grid-column: 1 / -1; min-width: 0; width: auto; margin: 0; padding: 2px 0; min-height: 0; text-align: left; font-size: 14px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.treasury-catalog .treasury-rewards:has(> .treasury-empty) { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 2px 12px 10px; }

/* Prize cards: identical media/name slots regardless of wrapped titles or renderer. */
.treasury-catalog .treasury-reward.v4-item { justify-content:flex-start; }
.treasury-catalog .treasury-reward > .collection-art { flex:0 0 56px; min-height:56px; }
.treasury-catalog .treasury-reward > .v4-treasury-item-name { flex:0 0 2.5em; height:2.5em; min-height:2.5em; margin:0; }
.treasury-catalog .treasury-reward .collection-art[data-art-type="nameplate"] > .nameplate-preview-frame,
.treasury-catalog .treasury-reward .collection-art[data-art-type="nameplate"] > .dynamic-nameplate { width:92px !important; max-width:100%; height:auto !important; aspect-ratio:3.3; }

/* Component cards reserve two full text lines; never flex-shrink glyphs. */
.cosmetics-document .wardrobe-grid:not(.wardrobe-sets) .wardrobe-item.v4-item.avalon-button { box-sizing:border-box; height:118px !important; min-height:118px !important; gap:2px !important; justify-content:flex-start !important; }
.cosmetics-document .wardrobe-grid:not(.wardrobe-sets) .wardrobe-item-picture { flex:0 0 64px; height:64px; min-height:64px; }
.cosmetics-document .wardrobe-grid:not(.wardrobe-sets) .wardrobe-item-name { flex:0 0 32px; height:32px; min-height:32px; line-height:16px !important; margin:0; padding:0; }

/* (2026-11-19) equipment rail rules moved to wardrobe-layout-contract.css V5 contract */

/* Hover containment: fixed hit boxes in clipped/scrolling inventory surfaces.
   Keep rarity paint and feedback inside the card; never disable scroll clipping. */
/* (2026-11-19) equipment rail rules moved to wardrobe-layout-contract.css V5 contract */
@media (hover: hover) and (pointer: fine) {
:is(.collection-grid,.wardrobe-grid,.treasury-rewards,.cosmetic-avatar-grid,.cosmetic-plate-grid) .v4-item.avalon-button:is(:hover,:focus-visible):not(:disabled) {
 transform:none !important;
 box-shadow:inset 0 1px 0 #fffaf0,inset 0 -3px 0 var(--r),inset 0 0 0 2px #e8b84f,inset 0 0 12px var(--r-glow,rgba(232,184,79,.35)) !important;
 outline-offset:-4px !important;
}
}
:is(.collection-grid,.wardrobe-grid,.treasury-rewards,.cosmetic-avatar-grid,.cosmetic-plate-grid) .v4-item.avalon-button:is(:focus-visible):not(:disabled) {
 transform:none !important;
 box-shadow:inset 0 1px 0 #fffaf0,inset 0 -3px 0 var(--r),inset 0 0 0 2px #e8b84f,inset 0 0 12px var(--r-glow,rgba(232,184,79,.35)) !important;
 outline-offset:-4px !important;
}
:is(.collection-grid,.wardrobe-grid,.cosmetic-avatar-grid,.cosmetic-plate-grid) .v4-item.avalon-button:is([aria-pressed="true"],[aria-checked="true"]) {
 box-shadow:inset 0 0 0 2px #e8b84f,inset 0 -3px 0 var(--r),inset 0 0 12px var(--r-glow,rgba(232,184,79,.35)) !important;
}
/* Focus scrolling has the same safe inset as the existing grid padding. */
:is(.collection-grid,.wardrobe-grid,.cosmetic-avatar-grid,.cosmetic-plate-grid,.treasury-catalog) { scroll-padding:14px; }
:is(.collection-grid,.wardrobe-grid,.cosmetic-avatar-grid,.cosmetic-plate-grid,.treasury-catalog) .v4-item { scroll-margin:8px; }

/* Item-name contract: every card owns an art track and an unshrunk text track.
   Font glyphs get 3px vertical safety space. Long names wrap and grow the card;
   do not reintroduce fixed total heights, line clamps, or ellipsis here. */
:is(.cosmetics-document,.collection-document) {
  --item-name-line:20px; --item-name-space:3px; --item-name-min:46px;
}
.cosmetics-document .wardrobe-item.v4-item .wardrobe-item-name,
.collection-document .collection-item > .collection-item-name,
.treasury-catalog .treasury-reward > .v4-treasury-item-name {
  display:block !important; box-sizing:border-box; width:100%; min-width:0;
  flex:0 0 auto !important; height:auto !important; min-height:var(--item-name-min,46px) !important;
  max-height:none !important; padding:var(--item-name-space,3px) 0 !important; margin:0 !important;
  line-height:var(--item-name-line,20px) !important; font-size:12.5px !important;
  white-space:normal !important; overflow-wrap:anywhere; word-break:normal;
  overflow:visible !important; text-overflow:clip; -webkit-line-clamp:unset; text-align:center;
}
.cosmetics-document .wardrobe-item.v4-item.avalon-button,
.cosmetics-document .wardrobe-grid:not(.wardrobe-sets) .wardrobe-item.v4-item.avalon-button,
.cosmetics-document .wardrobe-sets .wardrobe-item.v4-item.avalon-button {
  box-sizing:border-box; height:max-content !important; min-height:132px !important; max-height:none !important;
  display:grid !important; grid-template-rows:64px minmax(var(--item-name-min),max-content); justify-content:stretch !important;
  align-items:start !important; justify-items:center; gap:2px !important; padding:8px 6px !important;
}
.cosmetics-document .wardrobe-item .wardrobe-item-picture {
  flex:0 0 64px !important; width:100%; height:64px !important; min-height:64px !important;
}
.cosmetics-document .wardrobe-item .wardrobe-item-picture canvas { max-height:64px; }
.cosmetics-document .wardrobe-sets .wardrobe-item.v4-item.avalon-button { min-height:148px !important; }
.cosmetics-document .wardrobe-grid { grid-auto-rows:minmax(132px,auto); align-items:stretch; }
.cosmetics-document .wardrobe-basic-grid { align-items:stretch; grid-auto-rows:minmax(132px,auto); }
.collection-document .collection-grid.v4-well { grid-auto-rows:minmax(148px,auto); }
.collection-document .collection-item.v4-item.avalon-button { grid-template-rows:76px minmax(var(--item-name-min),auto); height:max-content; }
.collection-document .collection-item > .collection-art { height:76px !important; min-height:76px; }
.treasury-catalog .treasury-reward.v4-item { height:auto; min-height:143px; justify-content:flex-start; }
.cosmetics-document .wardrobe-detail-heading h4,
.collection-document .collection-detail h3 { min-width:0; max-width:100%; overflow-wrap:anywhere; line-height:1.5 !important; padding-block:3px; }
/* (2026-11-19) equipment rail rules moved to wardrobe-layout-contract.css V5 contract */
