/* Local presentation layer: native transactions, window placement and viewport
   safety own behavior. No animation on the outer draggable window; no new art. */
#hwGachaWindow.pxg-enhanced,
#wgGachaWindow.pxg-enhanced {
  --pxg-ink: #f5edda;
  --pxg-muted: #aebbd1;
  --pxg-edge: #34465f;
  --pxg-gold: #e8c47c;
  --pxg-deep: #111c2e;
  --pxg-panel: #1a2940;
  --pxg-wash: rgba(157, 190, 228, .09);
  width: 870px;
  color: var(--pxg-ink);
}
body.theme-wood #hwGachaWindow.pxg-enhanced,
body.theme-wood #wgGachaWindow.pxg-enhanced {
  --pxg-ink: #fff0d4;
  --pxg-muted: #c8b99d;
  --pxg-edge: #67503b;
  --pxg-deep: #2a2019;
  --pxg-panel: #3a2c22;
  --pxg-wash: rgba(235, 191, 111, .07);
}
.pxg-enhanced .win-body { padding: 16px; min-width: 0; }
.pxg-enhanced .hw-tabs {
  display: flex; flex-wrap: nowrap; gap: 3px; margin: 0 0 15px;
  padding: 4px; border: 1px solid var(--pxg-edge); border-radius: 9px;
  background: var(--pxg-deep);
}
#hwGachaWindow.pxg-enhanced .hw-tab,
#wgGachaWindow.pxg-enhanced .hw-tab {
  min-width: 0; min-height: 36px; padding: 8px 10px;
  border: 1px solid transparent; border-radius: 6px;
  color: var(--pxg-muted); background: transparent;
  font: inherit; font-size: 13px; line-height: 1.35; font-weight: 700;
}
#hwGachaWindow.pxg-enhanced .hw-tab.on,
#wgGachaWindow.pxg-enhanced .hw-tab.on {
  color: #fff0cc; background: #35415a; border-color: #7f704f;
  box-shadow: inset 0 -2px 0 var(--pxg-gold);
}
.pxg-enhanced .hw-pane { min-width: 0; }
.pxg-enhanced .pxg-draw-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.03fr); gap: 18px; }
.pxg-enhanced .pxg-showcase,
.pxg-enhanced .pxg-action-rail { min-width: 0; }
.pxg-enhanced .pxg-showcase {
  padding: 14px; border: 1px solid var(--pxg-edge); border-radius: 12px;
  background: radial-gradient(ellipse at 50% 16%, var(--pxg-wash), transparent 70%), var(--pxg-deep);
}
.pxg-enhanced .pxg-feature { text-align: center; }
.pxg-enhanced .pxg-feature-art {
  display: grid; place-items: center; position: relative; height: 194px;
  isolation: isolate;
}
.pxg-enhanced .pxg-feature-art::before {
  content: ''; position: absolute; z-index: -1; width: 160px; height: 160px;
  border: 1px solid rgba(232, 196, 124, .2); border-radius: 50%;
  box-shadow: 0 0 0 11px rgba(232, 196, 124, .025), 0 0 0 12px rgba(232, 196, 124, .07);
}
.pxg-enhanced .pxg-feature-art > .hw-look { width: 132px; height: 184px; filter: none; }
.pxg-enhanced .pxg-feature-art > .wg-pair { width: 258px; max-width: 100%; height: 190px; filter: none; }
.pxg-enhanced .pxg-feature-name {
  min-height: 24px; margin: 9px 0 16px; color: var(--pxg-ink);
  font-size: 16px; line-height: 1.5; font-weight: 700; overflow-wrap: anywhere;
}
.pxg-enhanced .pxg-feature-good .pxg-feature-name { color: var(--pxg-gold); }
.pxg-enhanced .hw-looks {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch; gap: 6px; padding: 0; margin: 0 0 12px;
  border-radius: 0; background: none;
}
.pxg-enhanced .wg-looks { display: flex; flex-direction: column; gap: 6px; }
.pxg-enhanced .wg-looks .wg-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 6px; }
.pxg-enhanced .pxg-art-option {
  display: grid; place-items: center; min-width: 0; min-height: 65px;
  padding: 5px 2px; border: 1px solid var(--pxg-edge); border-radius: 8px;
  background: var(--pxg-panel); cursor: pointer; box-shadow: none;
}
.pxg-enhanced .pxg-art-option.pxg-art-good { border-color: #756047; }
.pxg-enhanced .pxg-art-option.on { border-color: var(--pxg-gold); box-shadow: inset 0 0 0 1px var(--pxg-gold); }
.pxg-enhanced .pxg-art-option .hw-look { width: 36px; height: 50px; filter: none; }
.pxg-enhanced .pxg-art-option .wg-pair { max-width: 100%; filter: none; }
.pxg-enhanced .pxg-art-option > span { max-width: 100%; }
.pxg-enhanced .hw-when {
  margin: 12px 0 0; padding: 8px; color: var(--pxg-muted); font-size: 12px;
  border-top: 1px solid var(--pxg-edge); line-height: 1.5;
}
.pxg-enhanced .hw-when b { color: var(--pxg-gold); font-weight: 700; }
.pxg-enhanced .hw-lines { gap: 8px; margin: 12px 0; color: var(--pxg-muted); font-size: 12px; line-height: 1.65; }
.pxg-enhanced .hw-pity { padding: 10px; border-radius: 7px; color: var(--pxg-gold); background: rgba(232, 196, 124, .075); }
.pxg-enhanced .pxg-draw-group {
  padding: 12px; margin-bottom: 10px; border: 1px solid #796442;
  border-radius: 10px; background: var(--pxg-panel);
}
.pxg-enhanced .pxg-draw-group.pxg-draw-boost { border-color: var(--pxg-edge); }
.pxg-enhanced .hw-row-h { margin: 0 0 8px; color: var(--pxg-gold); font-size: 12px; line-height: 1.6; font-weight: 700; }
.pxg-enhanced .hw-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
#hwGachaWindow.pxg-enhanced .hw-go,
#wgGachaWindow.pxg-enhanced .hw-go {
  min-width: 0; min-height: 66px; padding: 10px 4px; border-radius: 7px;
  border: 1px solid #be9454; color: #241c11; background: linear-gradient(#f3d593, #d6ad67);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24); line-height: 1.5;
}
.pxg-enhanced .hw-go b { font-size: 16px; font-weight: 800; }
.pxg-enhanced .hw-go small { font-size: 11px; opacity: 1; overflow-wrap: anywhere; }
#hwGachaWindow.pxg-enhanced .hw-go.ruby,
#wgGachaWindow.pxg-enhanced .hw-go.ruby {
  color: #f7dce5; border-color: #796274; background: linear-gradient(#44384e, #302a3d);
}
#hwGachaWindow.pxg-enhanced .hw-go:disabled,
#wgGachaWindow.pxg-enhanced .hw-go:disabled {
  color: #a5acb9; background: #2a3447; border-color: #46526a; opacity: .75; box-shadow: none; cursor: not-allowed;
}
.pxg-enhanced .hw-note { color: var(--pxg-muted); font-size: 11px; line-height: 1.75; margin: 10px 0 0; }
.pxg-enhanced .hw-link { color: var(--pxg-gold); padding: 10px 0; text-decoration: underline; text-underline-offset: 3px; }
.pxg-enhanced .hw-odds,
.pxg-enhanced .hw-board { border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 1.5; }
.pxg-enhanced .hw-odds td,
.pxg-enhanced .hw-odds th,
.pxg-enhanced .hw-board td,
.pxg-enhanced .hw-board th { padding: 10px 8px; border-bottom: 1px solid var(--pxg-edge); }
.pxg-enhanced .hw-odds th,
.pxg-enhanced .hw-board th { color: var(--pxg-muted); font-size: 11px; }
.pxg-enhanced .hw-odds tr:nth-child(even),
.pxg-enhanced .hw-board tr:nth-child(even) { background: var(--pxg-wash); }
.pxg-enhanced .hw-pane > .hw-row-h { margin-top: 20px; }
.pxg-enhanced .hw-trade-row { gap: 12px; padding: 12px; margin: 7px 0; border: 1px solid var(--pxg-edge); border-radius: 8px; background: var(--pxg-panel); }
.pxg-enhanced .hw-trade-name { min-width: 0; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.pxg-enhanced .hw-trade-name small { color: var(--pxg-muted); line-height: 1.6; }
.pxg-enhanced .hw-trade-row > button {
  flex-shrink: 0; min-height: 36px; padding: 7px 14px; border: 1px solid #7c6848;
  border-radius: 7px; background: #3c3b39; color: #f3d593; cursor: pointer; font: inherit;
}
.pxg-enhanced .hw-trade-row > button:disabled { opacity: .55; cursor: not-allowed; }
.pxg-enhanced .hw-claim { padding: 15px; line-height: 1.6; border-color: #8e774f; background: rgba(232, 196, 124, .07); }
.pxg-enhanced .hw-claim-row { gap: 10px; }
.pxg-enhanced .hw-claim-row button { min-width: 0; padding: 10px 6px; background: var(--pxg-panel); border-color: var(--pxg-edge); }
.pxg-enhanced .hw-claim-row small { overflow-wrap: anywhere; }
.pxg-enhanced button:focus-visible,
.pxg-enhanced a:focus-visible,
.pxg-enhanced .hw-pane:focus-visible { outline: 2px solid #f5d895; outline-offset: 3px; }
@media (hover: hover) {
  .pxg-enhanced .pxg-art-option:hover,
  .pxg-enhanced .hw-tab:not(.on):hover { border-color: #8b805f; background-color: var(--pxg-panel); }
  .pxg-enhanced .hw-go:not(:disabled):hover { filter: brightness(1.07); }
}
/* Native UI safety still supplies actual inverse-scaled touch dimensions. */
body.touch .pxg-enhanced .hw-tab,
body.touch .pxg-enhanced .pxg-art-option,
body.touch .pxg-enhanced .hw-trade-row > button,
body.touch .pxg-enhanced .hw-go { min-height: var(--ui-window-touch-target, 44px); }
@media (max-width: 760px) {
  .pxg-enhanced .win-body { padding: 11px; }
  .pxg-enhanced .pxg-draw-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .pxg-enhanced .pxg-showcase { padding: 11px; }
  .pxg-enhanced .pxg-feature-art { height: 145px; }
  .pxg-enhanced .pxg-feature-art::before { width: 120px; height: 120px; }
  .pxg-enhanced .pxg-feature-art > .hw-look { width: 96px; height: 138px; }
  .pxg-enhanced .pxg-feature-art > .wg-pair { width: 200px; height: 140px; }
  .pxg-enhanced .pxg-feature-name { margin: 5px 0 12px; font-size: 15px; }
  .pxg-enhanced .hw-looks { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .pxg-enhanced .wg-looks { flex-direction: row; gap: 4px; }
  .pxg-enhanced .wg-looks .wg-row { width: calc(50% - 2px); gap: 4px; }
  .pxg-enhanced .pxg-art-option { min-height: 48px; padding: 4px 1px; }
  .pxg-enhanced .pxg-art-option .hw-look { width: 27px; height: 38px; }
  .pxg-enhanced .pxg-art-option .wg-pair { max-height: 42px; }
  #hwGachaWindow.pxg-enhanced .hw-tab,
  #wgGachaWindow.pxg-enhanced .hw-tab { padding: 7px 3px; font-size: 12px; }
  .pxg-enhanced .hw-odds td,
  .pxg-enhanced .hw-odds th,
  .pxg-enhanced .hw-board td,
  .pxg-enhanced .hw-board th { padding: 8px 3px; font-size: 11px; }
}
/* Result presentation only: retain native card flips/skip/outcomes and stop the
   old infinite gold-card filter animation. No new reveal timers or purchase path. */
#hwReveal .hw-pop,
#wgReveal .hw-pop {
  box-sizing: border-box; display: flex; flex-direction: column; min-height: 0;
  max-height: calc(100vh * var(--ui-inv, 1) - 24px);
  max-height: calc(100dvh * var(--ui-inv, 1) - 24px);
  overflow: hidden;
  padding: 20px; border: 1px solid #8f7b57; border-radius: 14px;
  background: linear-gradient(145deg, #23334b, #111a2b);
  box-shadow: 0 18px 55px rgba(0,0,0,.45); animation: pxg-reveal-in .18s ease-out;
}
#hwReveal .hw-cards,
#wgReveal .hw-cards {
  flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain;
  padding: 2px; align-content: flex-start;
}
#hwReveal .hw-card.good.open,
#wgReveal .hw-card.good.open,
#hwReveal .hw-card.normal.open,
#wgReveal .hw-card.normal.open { animation: none; filter: none; }
#hwReveal .hw-back,
#wgReveal .hw-back { border-color: #9d865b; background: linear-gradient(145deg, #3a4a65, #202d43); }
#hwReveal .hw-back::after,
#wgReveal .hw-back::after { content: ''; width: 16px; height: 16px; border: 1px solid #d5b571; transform: rotate(45deg); }
#hwReveal .hw-sum,
#wgReveal .hw-sum {
  flex: 0 1 auto; min-height: 0; max-height: min(180px, calc(28vh * var(--ui-inv, 1)));
  overflow: auto; overscroll-behavior: contain;
  margin-top: 16px; padding: 13px; gap: 9px; border: 1px solid #35445b;
  border-radius: 8px; background: #111c2e; line-height: 1.6;
}
#hwReveal .hw-pop-btns,
#wgReveal .hw-pop-btns {
  position: sticky; bottom: 0; z-index: 1; flex: 0 0 auto;
  flex-wrap: wrap; gap: 8px; margin-top: 16px; background: #152034;
}
#hwReveal .hw-pop-btns button,
#wgReveal .hw-pop-btns button { min-height: 40px; border-color: #6c7890; border-radius: 7px; background: #2c3b53; }
#hwReveal .hw-pop-btns .hw-again,
#wgReveal .hw-pop-btns .hw-again { color: #241c11; border-color: #be9454; background: linear-gradient(#f3d593, #d6ad67); }
body.touch #hwReveal .hw-pop-btns button,
body.touch #wgReveal .hw-pop-btns button { min-height: calc(44px * var(--ui-inv, 1)); }
@media (max-height: 480px) {
  #hwReveal .hw-pop, #wgReveal .hw-pop { padding: 12px; }
  #hwReveal .hw-sum, #wgReveal .hw-sum { margin-top: 9px; padding: 9px; }
  #hwReveal .hw-pop-btns, #wgReveal .hw-pop-btns { margin-top: 9px; }
}
@keyframes pxg-reveal-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  #hwReveal .hw-pop, #wgReveal .hw-pop,
  #hwReveal .hw-card, #wgReveal .hw-card { animation: none; }
  #hwReveal .hw-face, #wgReveal .hw-face { transition: none; }
}
