/* Degenesis cabinet hub (components/app-degenesis-hub.js). Through the sale the
   four quadrants of the Daily Drawing board carry buy buttons instead of
   trait reels. Each control lives inside its original replay quadrant; the
   board frame, centre flame and foil sockets keep their existing layout.
   The popup reuses the quest dialog (app.css .qst-action-dialog). */

/* The hub owns behavior only. Its controls are seated inside the existing
   replay quadrants, so the cabinet, center diamond and responsive geometry
   are exactly the same as the ordinary drawing. */
body.layout-basic app-pool-progress[hidden],
body.layout-basic .nav-jackpot-countdown[hidden] { display: none !important; }

body.layout-basic .jackpot-hero__machine > app-degenesis-hub { display: none; }
body.layout-basic .jackpot-hero__machine[data-degenesis] > .jackpot-board-current,
body.layout-basic .jackpot-hero__draw:has(> .jackpot-hero__machine[data-degenesis]) > :is(.jackpot-day-history, .jackpot-hero__summary-slot) {
  display: none !important;
}
body.layout-basic .jackpot-hero__machine replay-panel[data-degenesis] .replay-ticket-center {
  pointer-events: none;
  cursor: default;
}
body.layout-basic .jackpot-hero__machine replay-panel[data-degenesis] .replay-reveal-btn:disabled {
  opacity: 1;
}

body.layout-basic .jackpot-hero__machine .dgx-module {
  --dgx-rgb: 226, 181, 94;
  position: relative;
  display: grid;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto auto;
  justify-items: center;
  padding: 12% 10% 9%;
  gap: 0.3rem;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(var(--dgx-rgb), 0.26), transparent 64%),
    linear-gradient(180deg, #121816 0%, #070a09 100%);
  box-shadow: none;
  color: #f4dca7;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
body.layout-basic .jackpot-hero__machine .dgx-module--luckboxes { --dgx-rgb: 190, 150, 230; }
body.layout-basic .jackpot-hero__machine .dgx-module--passes { --dgx-rgb: 45, 212, 191; }
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis { --dgx-rgb: 251, 113, 133; }
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis {
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 9% 5% 7%;
}
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis .dgx-module__art {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis .dgx-module__art > img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

body.layout-basic .jackpot-hero__machine .dgx-module:hover,
body.layout-basic .jackpot-hero__machine .dgx-module:focus-visible {
  border-color: rgba(var(--dgx-rgb), 0.95);
  box-shadow:
    inset 0 0 0 2px rgba(9, 12, 11, 0.6),
    0 0 18px rgba(var(--dgx-rgb), 0.36),
    0 2px 8px rgba(0, 0, 0, 0.6);
  outline: none;
  transform: translateY(-1px);
}
body.layout-basic .jackpot-hero__machine .dgx-module:active { transform: translateY(1px); }

body.layout-basic .jackpot-hero__machine .dgx-module__art {
  position: relative;
  display: grid;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  place-items: center;
}
body.layout-basic .jackpot-hero__machine .dgx-module__art img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6));
}
/* The desk's TICKET face (purchase-desk.css, scoped by .app-decimator-panel). */
body.layout-basic .jackpot-hero__machine .dgx-ticket-art {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  place-items: center;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6));
}
body.layout-basic .jackpot-hero__machine .dgx-ticket-art .dec-ticket-face {
  box-sizing: border-box;
  width: auto;
  height: 100%;
  min-height: 0;
}
/* The portrait flame must not set the rotated square's height or grid track. */
body.layout-basic .jackpot-hero__machine .dgx-ticket-art .dec-ticket-center {
  height: 20%;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
body.layout-basic .jackpot-hero__machine .dgx-ticket-art .dec-ticket-center img {
  min-width: 0;
  min-height: 0;
  filter: none;
}

body.layout-basic .jackpot-hero__machine .dgx-module__label {
  overflow: hidden;
  color: rgb(var(--dgx-rgb));
  max-width: 100%;
  font: 950 calc(var(--jp-board-size) * 0.045)/1 "Roboto Mono", ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}

/* The artwork carries these names; keep their labels for screen readers. */
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis .dgx-module__label,
body.layout-basic .jackpot-hero__machine .dgx-module--passes .dgx-module__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

body.layout-basic .jackpot-hero__machine .dgx-module__lock {
  max-width: 100%;
  overflow: hidden;
  padding: 0.14rem 0.4rem;
  border: 1px solid rgba(var(--dgx-rgb), 0.5);
  border-radius: 999px;
  background: rgba(8, 6, 10, 0.88);
  color: #fecdd3;
  font: 900 calc(var(--jp-board-size) * 0.026)/1 "Roboto Mono", ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.layout-basic .jackpot-hero__machine .dgx-module__lock:empty { display: none; }
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis.is-locked {
  border-color: rgba(168, 173, 178, 0.28);
  background: linear-gradient(180deg, #0d100f 0%, #080b0a 100%);
  box-shadow: inset 0 0 0 2px rgba(9, 12, 11, 0.6), 0 2px 8px rgba(0, 0, 0, 0.6);
}
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis.is-locked .dgx-module__art img {
  filter: grayscale(1) brightness(0.45);
}
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis.is-locked .dgx-module__label { color: #8b9198; }
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis.is-locked .dgx-module__art::after {
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d6dce2' stroke-width='2' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / 38% no-repeat;
  content: "";
  opacity: 0.9;
}
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis.is-locked .dgx-module__lock {
  border-color: rgba(168, 173, 178, 0.35);
  color: #c5cad0;
}
body.layout-basic .jackpot-hero__machine .dgx-module--degenesis:not(.is-locked) {
  animation: dgx-ready 2.4s ease-in-out infinite;
}
@keyframes dgx-ready {
  50% { box-shadow: inset 0 0 0 2px rgba(9, 12, 11, 0.6), 0 0 22px rgba(251, 113, 133, 0.45), 0 2px 8px rgba(0, 0, 0, 0.6); }
}

/* ---- Popup ------------------------------------------------------------------ */

body.layout-basic .dgx-dialog__card {
  --qst-dialog-rgb: 251, 113, 133;
  --qst-dialog-accent: #fda4af;
  --qst-dialog-button-start: #fda4af;
  --qst-dialog-button-end: #e11d48;
  --qst-dialog-button-ink: #26040b;
  width: min(94vw, 34rem);
}
body.layout-basic .dgx-dialog__card[data-kind="tickets"] {
  --qst-dialog-rgb: 245, 166, 35;
  --qst-dialog-accent: #fbbf24;
  --qst-dialog-button-start: #ffd166;
  --qst-dialog-button-end: #e79419;
  --qst-dialog-button-ink: #211302;
}
body.layout-basic .dgx-dialog__card[data-kind="luckboxes"] {
  --qst-dialog-rgb: 167, 139, 250;
  --qst-dialog-accent: #c4b5fd;
  --qst-dialog-button-start: #c4b5fd;
  --qst-dialog-button-end: #7c3aed;
  --qst-dialog-button-ink: #12062a;
}
body.layout-basic .dgx-dialog .qst-action-dialog__sigil img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}
body.layout-basic .dgx-dialog__body { display: grid; gap: 0.6rem; }

body.layout-basic .dgx-dialog .dgx-shelf { gap: 0; }
body.layout-basic .dgx-dialog .dgx-shelf .dec-ticket-pieces {
  grid-template-columns: repeat(auto-fit, minmax(5.4rem, 1fr));
  gap: 0.5rem;
}
body.layout-basic .dgx-dialog .dgx-shelf .dec-ticket-piece { min-height: 6.4rem; }
body.layout-basic .dgx-dialog .dgx-shelf .dec-ticket-piece--foil.is-selected {
  border-color: rgba(253, 230, 138, 0.95);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.3);
}
body.layout-basic .dgx-dialog .dgx-shelf .dec-box-grid { gap: 0.5rem; }
body.layout-basic .dgx-dialog .dgx-shelf .dec-box-card { position: relative; }
body.layout-basic .dgx-dialog .dgx-shelf .dec-box-card__add { min-height: 7rem; }
body.layout-basic .dgx-dialog .dgx-shelf .dec-box-card__art { height: 4rem; }
body.layout-basic .dgx-dialog .dgx-piece-count {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  padding: 0.14rem 0.36rem;
  border-radius: 999px;
  background: #5d397a;
  color: #fff2ff;
  font: 900 0.62rem/1 "Roboto Mono", ui-monospace, monospace;
  pointer-events: none;
}
body.layout-basic .dgx-dialog .dgx-piece-count[hidden] { display: none; }

body.layout-basic .dgx-dialog .dgx-custom {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem;
}
body.layout-basic .dgx-dialog .dgx-custom__label,
body.layout-basic .dgx-dialog .dgx-order small,
body.layout-basic .dgx-dialog .dgx-credit small {
  color: #aeb3c7;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.14em;
}

body.layout-basic .dgx-dialog .dgx-order,
body.layout-basic .dgx-dialog .dgx-credit {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(var(--qst-dialog-rgb), 0.28);
  border-radius: 10px;
  background: rgba(var(--qst-dialog-rgb), 0.06);
}
body.layout-basic .dgx-dialog .dgx-order strong,
body.layout-basic .dgx-dialog .dgx-credit strong {
  color: #f8fafc;
  font: 900 0.86rem/1.2 "Roboto Mono", ui-monospace, monospace;
  text-align: right;
}
body.layout-basic .dgx-dialog .dgx-credit strong { color: var(--qst-dialog-accent); font-size: 1.05rem; }

body.layout-basic .dgx-dialog .dgx-max {
  padding-inline: 0.55rem;
  font: 900 0.62rem/1 "Roboto Mono", ui-monospace, monospace;
  letter-spacing: 0.08em;
}

body.layout-basic .dgx-dialog .dgx-contents {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
body.layout-basic .dgx-dialog .dgx-contents li {
  display: grid;
  gap: 0.18rem;
  padding: 0.5rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}
body.layout-basic .dgx-dialog .dgx-contents strong {
  color: var(--qst-dialog-accent);
  font: 950 0.95rem/1 "Roboto Mono", ui-monospace, monospace;
}
body.layout-basic .dgx-dialog .dgx-contents span { color: #d5d9e6; font-size: 0.68rem; line-height: 1.25; }

/* The player's orders: DegenesisBuy rows, each with its DegenesisOrderResolved result once settled. */
body.layout-basic .dgx-dialog .dgx-orders { display: grid; gap: 0.3rem; }
body.layout-basic .dgx-dialog .dgx-orders[hidden] { display: none; }
body.layout-basic .dgx-dialog .dgx-orders > small {
  color: #aeb3c7;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.14em;
}
body.layout-basic .dgx-dialog .dgx-orders ol {
  display: grid;
  gap: 0.25rem;
  max-height: 9.5rem;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
body.layout-basic .dgx-dialog .dgx-orders li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2rem 0.6rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font: 700 0.66rem/1.3 "Roboto Mono", ui-monospace, monospace;
}
body.layout-basic .dgx-dialog .dgx-orders li strong { color: #f8fafc; }
body.layout-basic .dgx-dialog .dgx-orders li span { color: var(--qst-dialog-accent); overflow-wrap: anywhere; }
body.layout-basic .dgx-dialog .dgx-orders li.is-pending span { color: #9ca3af; }

body.layout-basic .dgx-dialog__actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5rem;
}
body.layout-basic .dgx-dialog__actions:has(> .dgx-dialog__clear[hidden]) { grid-template-columns: minmax(0, 1fr); }
body.layout-basic .dgx-dialog__clear {
  padding: 0 0.9rem;
  border: 1px solid rgba(var(--qst-dialog-rgb), 0.4);
  border-radius: 10px;
  background: transparent;
  color: #e5e7eb;
  font: 900 0.7rem/1 "Roboto Mono", ui-monospace, monospace;
  letter-spacing: 0.1em;
  cursor: pointer;
}
body.layout-basic .dgx-dialog__clear[hidden] { display: none; }

@media (max-width: 520px) {
  body.layout-basic .dgx-dialog .dgx-custom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  body.layout-basic .dgx-dialog .dgx-custom__label { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  body.layout-basic .jackpot-hero__machine .dgx-module--degenesis:not(.is-locked) { animation: none; }
}

/* The quest stepper grid assumes a button on each side; these two fields drop
   the left button (ETH each) or put MAX on the right (Degenesis amount). */
body.layout-basic .dgx-dialog .qst-action-dgn__stepper.qst-action-adjust__stepper.dgx-custom__size {
  grid-template-columns: minmax(0, 1fr) auto;
  padding-right: 0.6rem;
}
body.layout-basic .dgx-dialog .dgx-amount .qst-action-dgn__stepper.qst-action-adjust__stepper {
  grid-template-columns: minmax(0, 1fr) auto 3.4rem;
}
