/* PlayForge platform base + component library (public site + studio + shared).
   Page-specific styles: site-pages.css (portal), admin.css, builder.css, shell.css.

   Geometry and colour follow the Tribastion estate design system (see tokens.css):
   8px controls, 12px cards, solid magenta primary, Space Grotesk headings. The one
   deliberate departure is `.btn-pill`, used on the marketing surfaces exactly as the
   sibling apps' landing pages use pill CTAs. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.55;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.18; margin: 0 0 var(--sp-3); color: var(--text); }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.7rem); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 var(--sp-4); }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); text-decoration: underline; }
img, svg, video, canvas { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }
::selection { background: var(--brand-tint-2); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-dim); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.74rem; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.inline { display: inline; }

.container { width: min(100% - 2 * var(--sp-5), var(--container)); margin-inline: auto; }
.section { padding: var(--sp-8) 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.eyebrow { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand); margin-bottom: var(--sp-2); }

/* ---- Brand lockup: company logo · divider · product mark · product name ----
   The same construction every Tribastion console uses, so the family reads as one. */
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; text-decoration: none !important; color: var(--text); }
.brand-lockup:hover { text-decoration: none !important; }
.brand-lockup .brand-logo { height: 26px; width: auto; max-width: none; max-height: none; display: block; }
/* The wordmark is black artwork, so it must invert on dark — for an explicit toggle
   AND for a system dark preference with no explicit choice. Scoped to .brand-lockup
   because site-pages.css also owns a `.brand-logo` (the TENANT's campaign logo). */
:root[data-theme="dark"] .brand-lockup .brand-logo { filter: brightness(0) invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-lockup .brand-logo { filter: brightness(0) invert(1); } }
.brand-divider { width: 1px; height: 22px; background: var(--border-strong); display: inline-block; }
.product-mark { display: inline-flex; align-items: center; }
.product-name { font-family: var(--display); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; color: var(--text); }
.brand-sub { color: var(--text-faint); font-size: 0.72rem; margin-top: 4px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.52rem 0.95rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.86rem; line-height: 1.2;
  cursor: pointer; white-space: nowrap; font-family: inherit; box-shadow: var(--shadow-sm);
  text-decoration: none !important; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 2px 8px rgba(236, 0, 140, 0.28); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--brand); border-color: var(--border-strong); }
.btn-danger { background: var(--tint-danger); border-color: color-mix(in srgb, var(--crit) 40%, transparent); color: var(--crit); box-shadow: none; }
.btn-danger:hover { background: color-mix(in srgb, var(--crit) 20%, transparent); border-color: var(--crit); color: var(--crit); }
.btn-sm { padding: 0.34rem 0.7rem; font-size: 0.78rem; }
.btn-lg { padding: 0.72rem 1.35rem; font-size: 0.98rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
/* Marketing CTA shape — the estate's landing pages use pills for the same job. */
.btn-pill { border-radius: var(--r-pill); padding: 0.6rem 1.2rem; }
.btn-pill.btn-lg { padding: 0.8rem 1.7rem; }
.actions { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; }

/* ---- Cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.2rem 1.3rem;
}
.card-pad-sm { padding: 0.9rem 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }
.card-head h3 { margin: 0; }
.card-sub { color: var(--text-faint); font-size: 0.78rem; }
.card-hover { transition: transform var(--t-med) var(--ease), box-shadow var(--t-med), border-color var(--t-med); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }

/* ---- KPI stat (same pattern as the other consoles' dashboards) ---- */
.stat { display: flex; flex-direction: column; gap: 0.25rem; position: relative; overflow: hidden; }
.stat-label { color: var(--text-dim); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-family: var(--display); }

/* ---- Badges & chips ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 0.16rem 0.55rem; border-radius: 20px;
  font-size: 0.71rem; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border);
}
.badge-primary { background: var(--brand-tint); color: var(--brand); border-color: var(--brand-tint-2); }
.badge-secondary { background: var(--secondary-tint); color: var(--secondary); border-color: var(--secondary-tint); }
.badge-accent { background: var(--tint-accent); color: var(--high); border-color: var(--tint-accent); }
.badge-success { background: var(--tint-success); color: var(--ok); border-color: var(--tint-success); }
.badge-danger { background: var(--tint-danger); color: var(--crit); border-color: var(--tint-danger); }
.badge-warning { background: var(--tint-warning); color: var(--warn); border-color: var(--tint-warning); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 0.36rem 0.8rem; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); font-size: 0.83rem; font-weight: 500; cursor: pointer; transition: all var(--t-fast); text-decoration: none !important; }
.chip:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--brand-tint); color: var(--brand); border-color: var(--brand); }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }
.input, .select, .textarea {
  width: 100%; padding: 0.5rem 0.7rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 0.88rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.textarea { min-height: 110px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
.input-color { width: 46px; height: 36px; padding: 2px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }
.help { font-size: 0.76rem; color: var(--text-faint); }
.error { color: var(--crit); font-size: 0.82rem; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.88rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong); position: relative; transition: background var(--t-fast); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-faint); transition: transform var(--t-fast), background var(--t-fast); }
.switch input:checked + .track { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-4); }

/* ---- Alerts ---- */
.alert { padding: 0.7rem 0.9rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); font-size: 0.87rem; }
.alert-success { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--tint-success); color: var(--ok); }
.alert-danger { border-color: color-mix(in srgb, var(--crit) 40%, transparent); background: var(--tint-danger); color: var(--crit); }
.alert-info { border-color: var(--secondary-tint); background: var(--secondary-tint); color: var(--secondary); }
.alert a { color: inherit; text-decoration: underline; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.table th, .table td { padding: 0.65rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 700; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }

/* ---- Grid ---- */
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } .section { padding: var(--sp-7) 0; } }

/* ---- Public site navigation ---- */
.site-nav { position: sticky; top: 0; z-index: 50; height: var(--nav-h); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom: 1px solid var(--border); }
.site-nav .container { display: flex; align-items: center; gap: var(--sp-5); height: 100%; }
.nav-links { display: flex; gap: 2px; align-items: center; margin-left: auto; }
.nav-links a { color: var(--text-dim); padding: 0.42rem 0.75rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.86rem; text-decoration: none !important; transition: all var(--t-fast); }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--brand); background: var(--brand-tint); }
.nav-toggle { display: none; margin-left: auto; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; align-items: stretch; padding: var(--sp-3) var(--sp-5) var(--sp-5); background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
}
.site-footer { border-top: 1px solid var(--border); padding: var(--sp-6) 0; color: var(--text-faint); font-size: 0.85rem; background: var(--surface); }
.site-footer .container { display: flex; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--text-dim); }
.site-footer .row { gap: var(--sp-4); }

/* ---- Game card (catalog) ---- */
.game-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; text-decoration: none !important; color: inherit; }
.game-card:hover { text-decoration: none !important; }
.game-card .thumb { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; border-bottom: 1px solid var(--border); }
.game-card .thumb img, .game-card .thumb svg { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-med) var(--ease); }
.game-card:hover .thumb img, .game-card:hover .thumb svg { transform: scale(1.04); }
.game-card .thumb .play-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 18, 24, 0.4); opacity: 0; transition: opacity var(--t-med); }
.game-card:hover .thumb .play-overlay { opacity: 1; }
.game-card .body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: var(--sp-2); }
.game-card .title { font-family: var(--display); font-weight: 700; font-size: 1rem; margin: 0; color: var(--text); }
.game-card .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---- Misc ---- */
.divider { height: 1px; background: var(--border); margin: var(--sp-5) 0; }
.empty { text-align: center; padding: var(--sp-7) var(--sp-5); color: var(--text-dim); border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.empty .icon { font-size: 2.2rem; margin-bottom: var(--sp-3); }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fade-up 0.5s var(--ease) both; }
.pagination { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; margin-top: var(--sp-5); }
.pagination a, .pagination span { padding: 0.38rem 0.7rem; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text-dim); text-decoration: none !important; font-size: 0.85rem; }
.pagination .active span, .pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination nav > div:first-child { display: none; }
