/* ==========================================================================
   Table & Crash Games – PlayTSOGO-style palette
   Everything is scoped to .tcg so it cannot leak into your theme.
   ========================================================================== */

.tcg {
  --tcg-bg: #0c0d12;
  --tcg-surface: #161822;
  --tcg-surface-2: #20222e;
  --tcg-text: #ffffff;
  --tcg-body: #c9cddb;
  --tcg-muted: #a3a8b8;
  --tcg-accent: #00bce6;
  --tcg-accent-contrast: #04141a;
  --tcg-gold: #bc9860;
  --tcg-line: rgba(255, 255, 255, 0.08);
  --tcg-brand: linear-gradient(90deg, #0aa7eb, #bd0efa);
  --tcg-radius: 16px;
  --tcg-radius-sm: 10px;
  --tcg-gap: clamp(1rem, 2.5vw, 2rem);
  --tcg-space: clamp(2.5rem, 6vw, 4.5rem);
  --tcg-width: 1120px;

  box-sizing: border-box;
  background: var(--tcg-bg);
  color: var(--tcg-text);
  font-family: "Montserrat", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

.tcg *,
.tcg *::before,
.tcg *::after {
  box-sizing: border-box;
}

.tcg img,
.tcg video,
.tcg iframe {
  display: block;
  max-width: 100%;
}

body.single-table_game,
body.single-crash_game,
body.post-type-archive-table_game,
body.post-type-archive-crash_game {
  background: #0c0d12;
}

.tcg-embed {
  padding: 1.5rem 0;
}

/* Shared width for every block */
.tcg-section,
.tcg-hero__inner,
.tcg-archive__head,
.tcg-grid-tiles,
.tcg-pagination {
  width: min(100% - 2rem, var(--tcg-width));
  margin-inline: auto;
}

.tcg-section {
  margin-top: var(--tcg-space);
}

/* ---------- Headings (forced white so themes can't grey them out) ---------- */
body .tcg h1,
body .tcg h2,
body .tcg h3,
body .tcg h4 {
  margin: 0;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  background: none !important;
  font-family: inherit;
  font-weight: 800;
  line-height: 1.15;
  opacity: 1 !important;
}

body .tcg h2 {
  margin-bottom: 1.25rem;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  text-transform: uppercase;
}

body .tcg h3 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

body .tcg h1 span,
body .tcg h2 span {
  color: var(--tcg-accent) !important;
  -webkit-text-fill-color: var(--tcg-accent) !important;
}

/* ---------- Buttons ---------- */
.tcg a.tcg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 2rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.tcg a.tcg-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.tcg a.tcg-btn--primary,
.tcg a.tcg-btn--primary:hover,
.tcg a.tcg-btn--primary:visited {
  background: var(--tcg-brand);
  color: #ffffff;
}

/* Play for Real Money: bright gold with near-black text for maximum contrast */
.tcg a.tcg-btn--real,
.tcg a.tcg-btn--real:hover,
.tcg a.tcg-btn--real:visited {
  background: linear-gradient(180deg, #ffe27a 0%, #ffb81f 100%);
  color: #1a1000;
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255, 226, 122, 0.4), 0 6px 20px rgba(255, 184, 31, 0.25);
}

.tcg a:focus-visible,
.tcg button:focus-visible {
  outline: 3px solid var(--tcg-accent);
  outline-offset: 3px;
}

/* ---------- Hero ---------- */
.tcg-hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: clamp(340px, 52vw, 560px);
  overflow: hidden;
  isolation: isolate;
}

.tcg-hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tcg-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, var(--tcg-bg) 0%, rgba(0, 0, 0, 0.45) 45%, rgba(0, 0, 0, 0) 100%);
}

.tcg-hero__inner {
  position: relative;
  z-index: 1;
  padding-block: clamp(1.5rem, 4vw, 3rem);
}

.tcg a.tcg-back {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--tcg-body);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.tcg a.tcg-back:hover {
  color: var(--tcg-accent);
}

body .tcg .tcg-hero__title {
  margin-bottom: 0.5rem;
  font-size: clamp(2.3rem, 7vw, 4.3rem);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.tcg-hero__desc {
  max-width: 62ch;
  margin: 0 0 1.5rem;
  color: #ffffff;
  opacity: 0.92;
}

.tcg-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

/* ---------- Stats ---------- */
.tcg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--tcg-line);
  border-radius: var(--tcg-radius);
  background: var(--tcg-line);
}

.tcg-stat {
  padding: 1.1rem 1.25rem;
  background: var(--tcg-surface);
}

.tcg-stat dt {
  margin: 0 0 0.25rem;
  color: var(--tcg-muted);
  font-size: 0.85rem;
}

.tcg-stat dd {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tcg-stat--key dd {
  color: var(--tcg-accent);
}

/* ---------- Demo ---------- */
.tcg-demo {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--tcg-line);
  border-radius: var(--tcg-radius);
  background: #000;
}

.tcg-demo iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- How to play (numbered steps) ---------- */
.tcg-steps {
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.tcg-steps li {
  position: relative;
  min-height: 56px;
  padding: 1rem 1.25rem 1rem 4.25rem;
  border-radius: var(--tcg-radius);
  background: var(--tcg-surface);
  counter-increment: step;
}

.tcg-steps li::before {
  content: counter(step);
  position: absolute;
  top: 1rem;
  left: 1.1rem;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: var(--tcg-accent);
  color: var(--tcg-accent-contrast);
  font-weight: 800;
}

.tcg-steps p {
  margin: 0;
  color: var(--tcg-body);
}

/* ---------- Features ---------- */
.tcg-feature {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: var(--tcg-gap);
  padding: var(--tcg-gap);
  border-radius: var(--tcg-radius);
  background: var(--tcg-surface);
}

.tcg-feature--text {
  grid-template-columns: 1fr;
}

.tcg-feature + .tcg-feature {
  margin-top: var(--tcg-gap);
}

.tcg-feature:nth-of-type(even) .tcg-feature__img {
  order: 2;
}

.tcg-feature__img {
  width: 100%;
  height: auto;
  border-radius: var(--tcg-radius-sm);
}

.tcg-feature__body p {
  max-width: 60ch;
  margin: 0;
  color: var(--tcg-body);
}

/* ---------- Page content + legal ---------- */
.tcg-content {
  color: var(--tcg-body);
  line-height: 1.75;
}

.tcg-content a {
  color: var(--tcg-accent);
}

.tcg-legal {
  margin-bottom: 0;
  padding-block: 2rem;
  border-top: 1px solid var(--tcg-line);
  color: var(--tcg-muted);
  font-size: 0.85rem;
}

/* ---------- Archive header + pills ---------- */
.tcg-archive {
  padding-bottom: var(--tcg-space);
}

.tcg-archive__head {
  padding-top: clamp(1.5rem, 4vw, 2.5rem);
}

.tcg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.tcg a.tcg-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.2rem;
  border: 1px solid var(--tcg-line);
  border-radius: 12px;
  background: var(--tcg-surface);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.tcg a.tcg-pill:hover,
.tcg a.tcg-pill.is-active {
  background: var(--tcg-accent);
  border-color: var(--tcg-accent);
  color: var(--tcg-accent-contrast);
}

/* ---------- Tiles ---------- */
.tcg-grid-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.9rem;
  padding-top: 1.75rem;
}

.tcg a.tcg-tile {
  position: relative;
  display: block;
  aspect-ratio: 148 / 215;
  color: #ffffff;
  text-decoration: none;
  transition: transform 0.18s ease;
}

.tcg-tile::before {
  content: "";
  position: absolute;
  inset: 22% 0 0 0;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.35) 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--tile) 100%, #fff 12%), color-mix(in srgb, var(--tile) 78%, #000));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.tcg-tile__art {
  position: absolute;
  inset: 0 0 34% 0;
}

.tcg-tile__art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
  transition: transform 0.18s ease;
}

.tcg-tile__label {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 15%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  text-transform: uppercase;
  line-height: 1.05;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.tcg-tile__label strong {
  font-size: clamp(0.9rem, 1.4vw, 1.05rem);
  font-weight: 800;
}

.tcg-tile__label em {
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 600;
}

.tcg-tile__provider {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 5%;
  text-align: center;
  text-transform: uppercase;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.tcg-tile--plain::before {
  display: none;
}

.tcg-tile--plain .tcg-tile__art {
  inset: 22% 0 0 0;
  overflow: hidden;
  border-radius: 14px;
  background: var(--tile);
}

.tcg-tile--plain .tcg-tile__art img {
  object-fit: cover;
  object-position: center;
  filter: none;
}

.tcg-tile--plain .tcg-tile__art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.75) 100%);
}

.tcg-tile--plain .tcg-tile__label,
.tcg-tile--plain .tcg-tile__provider {
  z-index: 1;
}

.tcg a.tcg-tile:hover {
  color: #ffffff;
  transform: translateY(-4px);
}

.tcg-tile:hover .tcg-tile__art img {
  transform: scale(1.04);
}

/* ---------- Pagination ---------- */
.tcg-pagination {
  margin-top: 2rem;
}

.tcg .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.tcg .page-numbers {
  min-width: 44px;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  background: var(--tcg-surface);
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.tcg .page-numbers.current,
.tcg a.page-numbers:hover {
  background: var(--tcg-accent);
  color: var(--tcg-accent-contrast);
}

.tcg .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .tcg-feature {
    grid-template-columns: 1fr;
  }

  .tcg-feature:nth-of-type(even) .tcg-feature__img {
    order: 0;
  }

  .tcg a.tcg-btn {
    width: 100%;
  }

  .tcg-stat dd {
    font-size: 1.1rem;
  }

  .tcg-grid-tiles {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tcg a.tcg-btn,
  .tcg a.tcg-tile,
  .tcg-tile__art img {
    transition: none;
  }

  .tcg a.tcg-btn:hover,
  .tcg a.tcg-tile:hover,
  .tcg-tile:hover .tcg-tile__art img {
    transform: none;
  }

  .tcg-hero__media {
    display: none;
  }
}
