/* The public creator pages need a branded ambient field; Bootstrap has no layered-background utility. */
body.home-page {
  position: relative;
  background:
    radial-gradient(circle at 12% 14%, rgba(var(--bs-info-rgb), 0.2), transparent 32rem),
    radial-gradient(circle at 90% 22%, rgba(var(--bs-warning-rgb), 0.16), transparent 34rem),
    var(--bs-body-bg);
}

body.home-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body.home-page::before {
  z-index: 0;
  background-image: radial-gradient(rgba(var(--bs-dark-rgb), 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
  opacity: 0.35;
}

body.home-page > * {
  position: relative;
  z-index: 1;
}

/* The brand icon's exact size, inset and hard offset shadow define the product mark. */
.site-brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.3rem;
  box-shadow: 4px 4px 0 0 var(--bs-dark);
}

/* Isolation keeps the hero's image and surface in one predictable stacking context. */
.home-hero-section {
  isolation: isolate;
}

/* The wordmark needs a content-specific bound unavailable as a Bootstrap utility. */
.site-home-title-image {
  width: min(100%, 28rem);
}

/* Commissioned feature cutouts share a readable bound while preserving their transparent margins. */
.landing-feature-art {
  width: min(88%, 30rem);
}

/* A soft brand-colored glow seats each transparent cutout on the page; Bootstrap has no radial background. */
.landing-art-stage {
  max-width: 32rem;
  background: radial-gradient(closest-side, rgba(var(--bs-info-rgb), 0.22), rgba(var(--bs-warning-rgb), 0.08) 60%, transparent);
}

/* Stacked under the copy on a phone, full-width cutouts would push the text a screen away. */
@media (max-width: 991.98px) {
  .landing-feature-art {
    width: min(72%, 22rem);
  }
}

/* Numbered setup steps need a fixed circular dimension that Bootstrap does not expose. */
.landing-step {
  width: 2rem;
  height: 2rem;
}

/* In-page anchors must clear the sticky navbar when a hero button scrolls to them. */
.landing-anchor {
  scroll-margin-top: 6.5rem;
}

/* Author portraits need one reusable responsive dimension; shape and appearance stay in Bootstrap classes. */
.author-avatar-large {
  width: 6rem;
  height: 6rem;
}

/* Section headings deliberately use a weight and tracking not exposed by the vendored utility set. */
.section-title {
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Linked game cards preserve text color and add the product's reusable hover lift. */
.game-card-link {
  color: inherit;
}

.game-card-link:hover {
  color: inherit;
}

.game-card-link.card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.game-card-link.card:hover {
  transform: translateY(-2px);
  box-shadow: 8px 8px 0 0 var(--bs-dark) !important;
}

/* Game banners are square media surfaces with generated backgrounds and card-edge geometry. */
.banner-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  padding: 1rem;
  overflow: hidden;
  border-top-left-radius: calc(var(--bs-border-radius-xxl) - 2px);
  border-top-right-radius: calc(var(--bs-border-radius-xxl) - 2px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(248, 249, 250, 0.96)),
    var(--bs-light);
  border-bottom: 2px solid var(--bs-dark);
}

.game-show-banner-frame {
  padding: 0;
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
}

.game-show-banner-frame .banner-image {
  border-radius: 1.8rem;
}

.banner-image {
  border-radius: 1.25rem;
}

.banner-image-placeholder {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(0, 0, 0, 0.045),
      rgba(0, 0, 0, 0.045) 16px,
      rgba(255, 255, 255, 0.7) 16px,
      rgba(255, 255, 255, 0.7) 32px
    ),
    var(--bs-light);
}

/* The showcase holds at most six curated games, so fixed thirds fill the row instead of leaving auto-fill gaps.
   A grid is used because Bootstrap row columns would need wrappers inside the shared card partial. */
.home-showcase {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* Auto-fill grids adapt to unknown result counts more precisely than fixed Bootstrap row columns. */

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}

/* Branding selection and transparency previews need stateful and generated backgrounds. */
.branding-asset-tile.active {
  background: var(--bs-primary-bg-subtle);
  border-color: var(--bs-primary) !important;
}

.branding-asset-tile-image {
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(-45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8d8d8 75%),
    linear-gradient(-45deg, transparent 75%, #d8d8d8 75%),
    #f3f3f3;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

/* The image editor uses pixel-accurate controls and overlays that Bootstrap cannot express. */
.crop-params-input {
  width: 5.5rem;
}

.tool-params-input {
  width: 5.75rem;
}

.tool-params-select {
  min-width: 9rem;
}

.tool-params-color-input {
  width: 3rem;
  min-width: 3rem;
  padding: 0.125rem;
}

.edit-asset-canvas-shell {
  padding: 1rem;
  border: 2px solid var(--bs-dark);
  border-radius: 1.8rem;
  background: var(--bs-body-bg);
  box-shadow: var(--bs-box-shadow-sm);
}

.edit-asset-canvas-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(72vh, 46rem);
  padding: 1rem;
  overflow: auto;
  background:
    linear-gradient(45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(-45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8d8d8 75%),
    linear-gradient(-45deg, transparent 75%, #d8d8d8 75%),
    #b7b7b7;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  border-radius: 1.2rem;
}

.edit-asset-canvas-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.edit-asset-canvas {
  position: relative;
  z-index: 2;
  display: block;
  max-width: none;
  max-height: none;
  border: 1px solid #000;
  background: transparent;
  box-shadow: none;
  touch-action: none;
}

.edit-asset-canvas.edit-asset-canvas-armed {
  cursor: crosshair;
}

.edit-asset-game-frame {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  box-sizing: border-box;
  border: 2px dashed rgba(13, 13, 13, 0.85);
  border-radius: 1rem;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45) inset;
}

.edit-asset-game-frame-label {
  position: absolute;
  top: -2.1rem;
  left: 0;
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 18rem);
  padding: 0.3rem 0.6rem;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: rgba(255, 248, 214, 0.95);
  color: var(--bs-dark);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edit-asset-crop-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: auto;
  touch-action: none;
}

.edit-asset-crop-region {
  position: absolute;
  border: 2px solid var(--bs-primary);
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  cursor: move;
  touch-action: none;
}

.edit-asset-crop-handle {
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: var(--bs-warning);
  padding: 0;
  box-shadow: 0 0.2rem 0 rgba(0, 0, 0, 0.12);
  touch-action: none;
}

.edit-asset-crop-handle.top-left {
  top: -0.55rem;
  left: -0.55rem;
  cursor: nwse-resize;
}

.edit-asset-crop-handle.top-right {
  top: -0.55rem;
  right: -0.55rem;
  cursor: nesw-resize;
}

.edit-asset-crop-handle.bottom-left {
  bottom: -0.55rem;
  left: -0.55rem;
  cursor: nesw-resize;
}

.edit-asset-crop-handle.bottom-right {
  bottom: -0.55rem;
  right: -0.55rem;
  cursor: nwse-resize;
}

.edit-asset-scale-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: auto;
  touch-action: none;
}

.edit-asset-scale-region {
  position: absolute;
  border: 2px solid var(--bs-success);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  touch-action: none;
}

.edit-asset-scale-handle {
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: var(--bs-success);
  padding: 0;
  box-shadow: 0 0.2rem 0 rgba(0, 0, 0, 0.12);
  touch-action: none;
}

.edit-asset-scale-handle.top-left {
  top: -0.55rem;
  left: -0.55rem;
  cursor: nwse-resize;
}

.edit-asset-scale-handle.top-right {
  top: -0.55rem;
  right: -0.55rem;
  cursor: nesw-resize;
}

.edit-asset-scale-handle.bottom-left {
  bottom: -0.55rem;
  left: -0.55rem;
  cursor: nesw-resize;
}

.edit-asset-scale-handle.bottom-right {
  bottom: -0.55rem;
  right: -0.55rem;
  cursor: nwse-resize;
}

.edit-asset-body-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: auto;
  touch-action: none;
}

.edit-asset-body-region {
  position: absolute;
  border: 2px solid #d63384;
  background: rgba(214, 51, 132, 0.12);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.82) inset;
  cursor: move;
  touch-action: none;
}

.edit-asset-body-label {
  position: absolute;
  top: -2rem;
  left: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: rgba(255, 240, 246, 0.96);
  color: #8c1d5b;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.edit-asset-body-handle {
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: #d63384;
  padding: 0;
  box-shadow: 0 0.2rem 0 rgba(0, 0, 0, 0.12);
  touch-action: none;
}

.edit-asset-body-handle.top-left {
  top: -0.55rem;
  left: -0.55rem;
  cursor: nwse-resize;
}

.edit-asset-body-handle.top-right {
  top: -0.55rem;
  right: -0.55rem;
  cursor: nesw-resize;
}

.edit-asset-body-handle.bottom-left {
  bottom: -0.55rem;
  left: -0.55rem;
  cursor: nesw-resize;
}

.edit-asset-body-handle.bottom-right {
  bottom: -0.55rem;
  right: -0.55rem;
  cursor: nwse-resize;
}

/* Bootstrap columns need an explicit zero minimum so long asset names can wrap instead of widening the grid. */
.asset-grid-item,
.asset-tile {
  min-width: 0;
}

.asset-tile-button {
  min-width: 0;
  text-align: inherit;
}

.asset-tile-content {
  min-width: 0;
}

/* Asset thumbnails and status markers use generated surfaces and exact overlay geometry. */
.asset-thumb-surface {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(248, 249, 250, 0.96)),
    var(--bs-light);
}

.asset-usage-badge {
  position: absolute;
  top: 0.45rem;
  left: auto;
  right: 0.45rem;
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: var(--bs-warning);
  color: var(--bs-dark);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  z-index: 2;
  box-shadow: 0 0.2rem 0 rgba(0, 0, 0, 0.12);
}

.asset-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0.6rem;
  box-sizing: border-box;
  display: block;
  object-fit: contain;
  border-radius: 0.9rem;
  z-index: 1;
}

.asset-name {
  min-width: 0;
  font-size: 0.88rem;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.asset-size {
  min-width: 0;
  font-size: 0.75rem;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Full-size asset previews retain checkerboards and viewport-aware image bounds. */
.asset-modal-image {
  max-width: 100%;
  max-height: min(64vh, 38rem);
  display: block;
  object-fit: contain;
  background:
    linear-gradient(45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(-45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8d8d8 75%),
    linear-gradient(-45deg, transparent 75%, #d8d8d8 75%),
    #b7b7b7;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  border: 1px solid #000;
  border-radius: 0;
  box-shadow: none;
}

/* Sprite extraction lists need bounded scrolling and transparent-image previews. */
.extract-sprites-name-list {
  max-height: min(58vh, 34rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.25rem;
}

.split-sprite-preview-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 5rem;
  max-height: 5rem;
  object-fit: contain;
  background:
    linear-gradient(45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(-45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8d8d8 75%),
    linear-gradient(-45deg, transparent 75%, #d8d8d8 75%),
    #b7b7b7;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  border: 1px solid #000;
}

/* The QR SVG is generated markup, so its physical bound and monochrome fill cannot live on the element. */
.game-qr-art svg {
  width: min(100%, 220px);
  height: auto;
  color: #000;
}

.game-qr-art svg path,
.game-qr-art svg rect {
  fill: #000;
}

/* Brite does not map these dropdown states to the site's primary color by default. */
.dropdown-menu {
  --bs-dropdown-link-active-bg: var(--bs-primary);
}

/* Dark-mode rules bridge Brite's light-oriented borders, controls and generated artwork. */
[data-bs-theme=dark] .site-navbar {
  box-shadow: 8px 8px 0 0 rgba(0, 0, 0, 0.45) !important;
}

[data-bs-theme=dark] .site-navbar,
[data-bs-theme=dark] .site-navbar .navbar-brand,
[data-bs-theme=dark] .site-navbar .nav-link,
[data-bs-theme=dark] .site-navbar .navbar-toggler,
[data-bs-theme=dark] .site-theme-toggle-label,
[data-bs-theme=dark] .site-theme-toggle-icon {
  color: var(--bs-body-color) !important;
}

[data-bs-theme=dark] .site-navbar .nav-link.active,
[data-bs-theme=dark] .site-navbar .nav-link:hover,
[data-bs-theme=dark] .site-navbar .navbar-brand:hover {
  color: var(--bs-primary) !important;
}

[data-bs-theme=dark] .site-navbar .navbar-toggler-icon {
  filter: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 248, 214, 0.96%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

[data-bs-theme=dark] .border-dark,
[data-bs-theme=dark] .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.92) !important;
}

[data-bs-theme=dark] .game-card-link.card:hover {
  box-shadow: 8px 8px 0 0 rgba(255, 255, 255, 0.85) !important;
}

[data-bs-theme=dark] .btn-outline-dark {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: rgba(255, 255, 255, 0.92);
  --bs-btn-hover-color: var(--bs-dark);
  --bs-btn-hover-bg: var(--bs-primary);
  --bs-btn-hover-border-color: rgba(255, 255, 255, 0.92);
  --bs-btn-active-color: var(--bs-dark);
  --bs-btn-active-bg: var(--bs-primary);
  --bs-btn-active-border-color: rgba(255, 255, 255, 0.92);
}

[data-bs-theme=dark] .btn-light,
[data-bs-theme=dark] .text-bg-light {
  background-color: #2a3038 !important;
  color: var(--bs-body-color) !important;
}

[data-bs-theme=dark] .dropdown-menu {
  background-color: #20242b;
  color: var(--bs-body-color);
  border-color: rgba(255, 255, 255, 0.92) !important;
}

[data-bs-theme=dark] .dropdown-header,
[data-bs-theme=dark] .dropdown-item {
  color: var(--bs-body-color) !important;
}

[data-bs-theme=dark] .dropdown-item:hover,
[data-bs-theme=dark] .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--bs-body-color) !important;
}

[data-bs-theme=dark] .dropdown-item.text-danger {
  color: #ff8f8f !important;
}

[data-bs-theme=dark] .banner-frame,
[data-bs-theme=dark] .asset-thumb-surface {
  background: rgba(33, 37, 41, 0.92);
}

[data-bs-theme=dark] .banner-frame {
  border-bottom-color: var(--bs-light);
}

/* The game page's frame is a bare mount for the image, so the general dark banner surface must not reach it. */
[data-bs-theme=dark] .banner-frame.game-show-banner-frame {
  background: transparent;
}

/* The placeholder must outrank the general dark banner surface or its stripes disappear. */
[data-bs-theme=dark] .banner-frame.banner-image-placeholder,
[data-bs-theme=dark] .banner-image-placeholder {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.08) 16px,
      rgba(0, 0, 0, 0.22) 16px,
      rgba(0, 0, 0, 0.22) 32px
    ),
    var(--bs-dark);
}

[data-bs-theme=dark] .edit-asset-canvas-shell {
  background: var(--bs-body-bg);
}

[data-bs-theme=dark] .edit-asset-canvas-stage {
  background:
    linear-gradient(45deg, #7d7d7d 25%, transparent 25%),
    linear-gradient(-45deg, #7d7d7d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #7d7d7d 75%),
    linear-gradient(-45deg, transparent 75%, #7d7d7d 75%),
    #5f5f5f;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

[data-bs-theme=dark] .edit-asset-game-frame {
  border-color: rgba(255, 248, 214, 0.92);
  box-shadow: 0 0 0 1px rgba(13, 13, 13, 0.5) inset;
}

[data-bs-theme=dark] .edit-asset-game-frame-label {
  background: rgba(33, 37, 41, 0.94);
  color: var(--bs-light);
  border-color: var(--bs-light);
}

[data-bs-theme=dark] .edit-asset-crop-region {
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(255, 255, 255, 0.92) inset;
}

[data-bs-theme=dark] .edit-asset-crop-handle {
  border-color: rgba(255, 255, 255, 0.92);
}

[data-bs-theme=dark] .edit-asset-scale-region {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92) inset;
}

[data-bs-theme=dark] .edit-asset-scale-handle {
  border-color: rgba(255, 255, 255, 0.92);
}

[data-bs-theme=dark] .edit-asset-body-region {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92) inset;
}

[data-bs-theme=dark] .edit-asset-body-label {
  background: rgba(53, 23, 40, 0.96);
  color: rgba(255, 214, 232, 0.98);
  border-color: rgba(255, 255, 255, 0.92);
}

[data-bs-theme=dark] .edit-asset-body-handle {
  border-color: rgba(255, 255, 255, 0.92);
}

[data-bs-theme=dark] .asset-modal-image {
  background:
    linear-gradient(45deg, #7d7d7d 25%, transparent 25%),
    linear-gradient(-45deg, #7d7d7d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #7d7d7d 75%),
    linear-gradient(-45deg, transparent 75%, #7d7d7d 75%),
    #5f5f5f;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

[data-bs-theme=dark] .split-sprite-preview-image {
  background:
    linear-gradient(45deg, #7d7d7d 25%, transparent 25%),
    linear-gradient(-45deg, #7d7d7d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #7d7d7d 75%),
    linear-gradient(-45deg, transparent 75%, #7d7d7d 75%),
    #5f5f5f;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

[data-bs-theme=dark] .branding-asset-tile.active {
  background: rgba(102, 184, 255, 0.18);
}

[data-bs-theme=dark] .branding-asset-tile-image {
  background:
    linear-gradient(45deg, #7d7d7d 25%, transparent 25%),
    linear-gradient(-45deg, #7d7d7d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #7d7d7d 75%),
    linear-gradient(-45deg, transparent 75%, #7d7d7d 75%),
    #5f5f5f;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

/* These component dimensions change where Bootstrap's fixed scale cannot preserve the layout. */
@media (max-width: 767.98px) {
  .site-brand-icon {
    width: 2.2rem;
    height: 2.2rem;
  }

  .site-home-title-image {
    width: min(100%, 19rem);
  }

  .author-avatar-large {
    width: 4.75rem;
    height: 4.75rem;
  }

  .banner-frame {
    padding: 0.8rem;
  }

  .asset-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.85rem;
  }

  .home-showcase {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }

  .asset-name {
    font-size: 0.8rem;
  }
}
