/* The paytable sheet (js/paytable.js). It reuses the palace sheet, the
   reel symbols, gems, plaques and pearls from style.css; this file only
   lays them out as swipeable pages. */

/* Taller than the other sheets, and a fixed height so pages don't jump
   as they are swiped. */
.paytable-panel {
  height: 86vh;
  height: 86dvh;
  max-height: calc(100dvh - var(--safe-top) - 24px);
  padding-left: 0;
  padding-right: 0;
  --cell: 34px;
}

/* ---------- Tabs ---------- */

.pt-tabs {
  flex: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin: 0 10px 8px;
  padding: 3px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.pt-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-height: 46px;
  padding: 4px 0 3px;
  border-radius: 11px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pt-tab-icon {
  font-size: 1.2rem;
  line-height: 1;
  filter: grayscale(0.5) brightness(0.8);
}

.pt-tab.on {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 50%),
    linear-gradient(180deg, #ff4a5e, var(--red) 55%, var(--red-dark));
  box-shadow: inset 0 0 0 1px var(--gold), 0 2px 4px rgba(0, 0, 0, 0.5);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

.pt-tab.on .pt-tab-icon {
  filter: none;
}

/* ---------- Pages ---------- */

/* Pages sit side by side and snap one at a time when swiped. Each page
   scrolls on its own if it is taller than the sheet. */
.pt-track {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}

.pt-track::-webkit-scrollbar {
  display: none;
}

.pt-page {
  flex: 0 0 100%;
  min-width: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 2px 14px 10px;
}

.pt-heading {
  margin: 10px 0 6px;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  background-image: var(--gold-bevel);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 var(--gold-deep)) drop-shadow(0 2px 1px rgba(0, 0, 0, 0.7));
}

.pt-page > .pt-heading:first-child {
  margin-top: 2px;
}

.pt-note {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: center;
}

.pt-coins {
  color: #fff;
  font-family: var(--display);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pt-coins::before {
  content: "● ";
  color: var(--gold);
  font-size: 0.7em;
  vertical-align: 0.15em;
}

.pt-small {
  color: var(--muted);
  font-size: 0.75rem;
}

/* ---------- Tables: dark plaques in a gold bevel ---------- */

.pt-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pt-row {
  display: grid;
  grid-template-columns: 52px 1fr 1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 3px 6px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 40%),
    linear-gradient(180deg, #221a5e, #0a0828);
  border: 2px solid var(--gold-dark);
  box-shadow: 0 0 0 1px var(--gold-deep);
  font-size: 0.85rem;
}

.pt-row.pt-head {
  min-height: 0;
  padding: 0 6px;
  background: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--gold);
  font-family: var(--display);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pt-sym .cell {
  margin: 0 auto;
}

/* Bet tiers, with the one in force lit. */
.pt-bets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  gap: 4px;
}

.pt-bet {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 2px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--gold-deep);
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pt-bet small {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.pt-bet.on {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 50%),
    linear-gradient(180deg, #3adf6e, #128a3a 60%, #075a24);
  border-color: var(--gold);
  color: #fff;
}

/* The three rows of the grid, with a three-symbol run lit. */
.pt-lines {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.pt-line {
  display: grid;
  grid-template-columns: repeat(5, 9px);
  gap: 2px;
  padding: 3px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--gold-deep);
}

.pt-line i {
  height: 9px;
  border-radius: 2px;
  background: #3a2a6a;
}

.pt-line i.lit {
  background: var(--gold);
  box-shadow: 0 0 4px rgba(255, 211, 77, 0.8);
}

/* ---------- Tower ---------- */

.pt-jackpots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}

.pt-meters .pt-row {
  grid-template-columns: 74px 1fr auto;
  justify-items: start;
  padding-right: 10px;
}

.pt-meter-name {
  justify-self: stretch;
  padding: 3px 4px;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 45%),
    linear-gradient(180deg, var(--c), var(--c-dark));
  color: #fff;
  font-family: var(--display);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

/* The top meter (Extreme) glows like it does on the tower. */
.pt-meters .pt-top {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-deep), 0 0 10px rgba(255, 79, 216, 0.45);
}

.pt-slots {
  display: flex;
  gap: 3px;
  --cell: 26px;
}

.pt-gems {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.pt-gem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  --cell: 40px;
}

.pt-gem small {
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

/* ---------- Dragon's Bargain ---------- */

.pt-chest-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 1.3rem;
  color: var(--gold);
}

.pt-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.pt-board .deal-pill {
  min-height: 24px;
}

.pt-rounds .pt-row,
.pt-rewards .pt-row {
  grid-template-columns: 1fr 1fr 1.4fr;
}

.pt-boosts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pt-boost {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--gold-dark);
  font-size: 0.8rem;
  line-height: 1.3;
}

.pt-boost strong {
  color: var(--gold);
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Fortune Pearls ---------- */

.pt-pearls .pt-row {
  grid-template-columns: 56px 1.5fr 1fr 0.8fr;
  min-height: 46px;
}

.pt-pearls .pt-row.pt-head {
  min-height: 0;
}

.pt-pearl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pt-pearl .pearl {
  width: 26px;
  height: 26px;
}

.pt-pearl small {
  font-size: 0.66rem;
  font-weight: 700;
}

.pt-pearls .pt-coins {
  font-size: 0.8rem;
}

/* ---------- League ---------- */

.pt-tiers {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.pt-tier {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--gold-deep);
  opacity: 0.6;
}

.pt-tier b {
  font-size: 1.4rem;
  line-height: 1.1;
}

.pt-tier small {
  font-size: 0.66rem;
  font-weight: 700;
}

.pt-tier.on {
  border: 2px solid var(--gold);
  box-shadow: 0 0 10px rgba(255, 211, 77, 0.5);
  opacity: 1;
}

.pt-rewards .pt-row.up {
  border-color: var(--jade);
}

.pt-rewards .pt-row.down {
  border-color: var(--ruby);
}

.pt-move {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.pt-rewards .up .pt-move { color: var(--jade); }
.pt-rewards .down .pt-move { color: var(--ruby); }

/* The info button in the top bar: a gold-ringed "i". */
.paytable-button {
  width: 28px;
  height: 28px;
  margin: 0 4px;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 1px var(--gold-deep), 0 0 6px rgba(255, 211, 77, 0.4);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
}

.paytable-button:active {
  transform: scale(0.92);
}

@media (prefers-reduced-motion: reduce) {
  .pt-track { scroll-behavior: auto; }
}
