/* Components: the recurring shapes of the site, from the smallest badge to a game's page. */

.lift {
  transition: transform var(--normal) var(--ease-out), box-shadow var(--normal) var(--ease-out),
    border-color var(--fast) var(--ease);
}

.lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-up);
}

.hero {
  display: grid;
  gap: var(--s-4);
  justify-items: start;
  padding: var(--s-12) var(--s-8);
  margin-bottom: var(--s-10);
  border-radius: var(--r-xl);
  background: var(--brand);
  color: var(--n-0);
}

.hero h1 {
  font-size: var(--t-3xl);
  letter-spacing: -0.03em;
}

.hero p {
  max-width: 34rem;
  font-size: var(--t-md);
  color: oklch(100% 0 0 / 0.88);
}

.hero .button {
  background: var(--n-0);
  color: var(--n-900);
}

.hero .button:hover {
  background: var(--n-50);
}

.hero .button.ghost {
  background: oklch(100% 0 0 / 0.16);
  color: var(--n-0);
}

.hero .button.ghost:hover {
  background: oklch(100% 0 0 / 0.26);
}

/* ---- cards ---- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: var(--s-3);
}

.grid.people {
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
}

.tile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius);
  color: var(--text);
}

a.tile:hover {
  text-decoration: none;
  border-color: var(--accent);
}

.tile .pic {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface-3);
  object-fit: cover;
}

.tile .body {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
  flex: 1;
  padding: var(--s-2) var(--s-3) var(--s-3);
}

.tile .name {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile .sub {
  color: var(--muted);
  font-size: var(--t-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile .actions {
  display: flex;
  gap: var(--s-1);
  margin-top: auto;
  padding-top: var(--s-2);
}

/* ---- item cards ---- */

.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.375rem, 1fr));
  gap: var(--s-3);
}

.item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
  padding: var(--s-2) var(--s-2) var(--s-3);
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius);
  color: var(--text);
  transition: transform var(--normal) var(--ease-out), box-shadow var(--normal) var(--ease-out),
    border-color var(--fast) var(--ease);
}

a.item:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-up);
  text-decoration: none;
}

.item .thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  overflow: hidden;
  cursor: pointer;
}

.item .thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  transition: transform var(--slow) var(--ease-out);
}

a.item:hover .thumb img {
  transform: scale(1.04);
}

.item-name {
  margin-top: var(--s-2);
  font-weight: 600;
  font-size: var(--t-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-price {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--t-sm);
}

.item-price .rbx,
.item-price .free {
  color: var(--good);
}

.item-price .free {
  font-weight: 700;
}

.item-price .offsale,
.item-price .was {
  color: var(--muted);
}

.item-price .tix {
  font-size: var(--t-xs);
}

.remaining {
  color: var(--danger);
  font-weight: 700;
  font-size: var(--t-xs);
}

.serial {
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--accent-2);
}

.item-more {
  position: absolute;
  inset: var(--s-2) var(--s-2) auto;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.0625rem;
  aspect-ratio: 1;
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: linear-gradient(to top, oklch(12% 0.01 265 / 0.88) 30%, transparent);
  color: var(--n-0);
  font-size: var(--t-xs);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--normal) var(--ease);
}

a.item:hover .item-more {
  opacity: 1;
}

.card-play {
  position: absolute;
  right: var(--s-2);
  bottom: var(--s-2);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--n-0);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease-out), background var(--fast) var(--ease);
}

.item:hover .card-play,
.card-play:focus-visible {
  opacity: 1;
  transform: none;
}

.card-play:hover {
  background: var(--accent-hover);
}

.icon-play {
  width: 0;
  height: 0;
  margin-left: 0.2em;
  border-top: 0.5em solid transparent;
  border-bottom: 0.5em solid transparent;
  border-left: 0.75em solid currentColor;
}

.playing .icon-play {
  width: 0.7em;
  height: 0.9em;
  margin: 0;
  border: 0;
  border-right: 3px solid currentColor;
  border-left: 3px solid currentColor;
}

.card-play.playing .icon-play {
  border-top-width: 0.375em;
  border-bottom-width: 0.375em;
  border-left-width: 0.5em;
  margin-left: 0.15em;
}

/* ---- the catalog ---- */

.cat-top,
.games-top {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  flex-wrap: wrap;
  margin-bottom: var(--s-5);
}

.cat-top h1,
.games-top h1,
.hub-head h1 {
  margin: 0;
  font-size: var(--t-3xl);
  letter-spacing: -0.03em;
}

.cat-search {
  display: flex;
  gap: var(--s-2);
  flex: 1;
  min-width: 17.5rem;
}

.cat-search input,
.cat-search select {
  margin: 0;
  width: auto;
}

.cat-search input {
  flex: 1;
}

.cat-body {
  display: grid;
  grid-template-columns: 12.5rem 1fr;
  gap: var(--s-6);
  align-items: start;
}

.cat-side {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.side-group {
  display: flex;
  flex-direction: column;
  padding: var(--s-2);
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius);
}

.side-group h3 {
  margin: var(--s-1) var(--s-2);
  font-size: var(--t-xs);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.side-group a {
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-weight: 600;
  font-size: var(--t-sm);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.side-group a.sub {
  padding-left: var(--s-4);
  font-weight: 450;
  font-size: var(--t-base);
}

.side-group a:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.side-group a.on {
  background: var(--accent-soft);
  color: var(--accent);
}

.side-group legend {
  padding: var(--s-2);
  font-weight: 650;
  font-size: var(--t-sm);
  cursor: pointer;
}

.side-group p {
  padding: 0 var(--s-2) var(--s-2);
  color: var(--muted);
  font-size: var(--t-sm);
}

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}

.results-head h2 {
  margin: 0;
}

.results-head p {
  margin: 0;
  font-size: var(--t-sm);
}

.sort {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--muted);
}

.sort select {
  margin: 0;
  width: auto;
}

.cat-results,
.games-results {
  transition: opacity var(--normal) var(--ease);
}

.cat-results.loading,
.games-results.loading {
  opacity: 0.45;
  pointer-events: none;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  flex-wrap: wrap;
  margin: var(--s-6) 0 var(--s-2);
}

.pager a,
.pager span {
  min-width: 2.25rem;
  padding: var(--s-2) var(--s-3);
  border: var(--edge);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pager a:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.pager .on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
}

.pager .off {
  opacity: 0.4;
}

.pager .gap {
  border: 0;
  background: none;
  padding: 0 var(--s-1);
}

/* ---- an item's page ---- */

.item-page {
  display: grid;
  grid-template-columns: minmax(17.5rem, 26rem) 1fr;
  gap: var(--s-8);
  align-items: start;
  margin-bottom: var(--s-6);
}

.viewer {
  position: relative;
  aspect-ratio: 1;
  border: var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.viewer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  animation: fade var(--slow) var(--ease);
}

.viewer canvas:active {
  cursor: grabbing;
}

.viewer.three img {
  visibility: hidden;
}

.viewer .view-toggle {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  z-index: 2;
}

.viewer.three .view-toggle {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.viewer .spinner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
}

.viewer .spinner::after {
  content: "";
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: var(--r-pill);
  animation: spin 0.7s linear infinite;
}

.item-info h1 {
  margin-bottom: var(--s-1);
  font-size: var(--t-2xl);
}

.buy-box {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  max-width: 26rem;
  margin: var(--s-4) 0;
  padding: var(--s-4);
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius);
}

.buy-box .buy {
  width: 100%;
}

.price-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.price-line .rbx {
  color: var(--good);
}

.prices,
.buy-buttons {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  align-items: center;
}

.buy-buttons .buy {
  flex: 1;
  min-width: 8.75rem;
}

.owned-note {
  color: var(--good);
  font-weight: 650;
}

.actions-line {
  margin-bottom: var(--s-4);
}

.fav.on {
  border-color: var(--gold);
  color: var(--gold);
}

.fav.on span {
  color: var(--text);
}

.fav.bump {
  animation: bump var(--slow) var(--ease-out);
}

.tab-body {
  min-height: 7.5rem;
}

.avatar-big {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--surface-3);
}

.chart svg {
  display: block;
  width: 100%;
  height: 15rem;
  overflow: visible;
}

.chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-dasharray: 3000;
  stroke-dashoffset: 3000;
  animation: draw 1.2s var(--ease-out) forwards;
}

.chart .area {
  fill: var(--accent-soft);
  opacity: 0;
  animation: fade var(--slow) 0.3s forwards;
}

.chart .bar {
  fill: color-mix(in oklch, var(--accent-2) 35%, transparent);
}

.chart .axis {
  fill: var(--muted);
  font-size: 11px;
}

.chart .grid-line {
  stroke: var(--line);
}

.chart .tip {
  fill: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.chart .dot {
  fill: var(--accent);
}

/* buying */

.buy-top {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
}

.buy-top img {
  width: 5rem;
  height: 5rem;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--surface-3);
}

.bought {
  position: relative;
  text-align: center;
  padding: var(--s-4) 0;
}

.bought h2 {
  margin-top: var(--s-2);
}

.burst {
  position: absolute;
  left: 50%;
  top: 0;
  width: 5rem;
  height: 5rem;
  margin-left: -2.5rem;
  border-radius: var(--r-pill);
  background: radial-gradient(circle, color-mix(in oklch, var(--good) 45%, transparent), transparent 70%);
  animation: burst 0.8s var(--ease-out) forwards;
}

.sell {
  display: grid;
  gap: var(--s-2);
}

.sell-price {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

/* ---- games ---- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: var(--s-3);
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: var(--s-2) var(--s-2) var(--s-3);
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius);
  transition: transform var(--normal) var(--ease-out), box-shadow var(--normal) var(--ease-out),
    border-color var(--fast) var(--ease);
}

.game-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-up);
}

.game-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.game-card .creator,
.game-card .game-meta,
.game-card .game-name,
.game-card .game-by {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.game-card a.creator {
  pointer-events: auto;
}

.game-icon {
  position: relative;
  display: block;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  overflow: hidden;
}

.game-icon img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform var(--slow) var(--ease-out);
}

.game-card:hover .game-icon img {
  transform: scale(1.04);
}

.game-icon .live {
  position: absolute;
  left: var(--s-2);
  bottom: var(--s-2);
  padding: 0.0625rem 0.375rem;
  border-radius: var(--r-pill);
  background: var(--good);
  color: var(--n-0);
  font-size: var(--t-xs);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.game-name {
  margin-top: var(--s-2);
  font-weight: 680;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--t-sm);
}

.rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 650;
  color: var(--good);
  font-variant-numeric: tabular-nums;
}

.thumb-up {
  font-size: 0.9em;
}

.game-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  gap: var(--s-6);
  align-items: start;
  margin-bottom: var(--s-5);
}

.game-media {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--surface-3);
  overflow: hidden;
}

.game-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity var(--slow) var(--ease), transform 1.2s var(--ease-out);
}

.game-media img.on {
  opacity: 1;
  transform: none;
}

.game-media .dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--s-3);
  display: flex;
  justify-content: center;
  gap: var(--s-2);
}

.game-media .dots button {
  width: 0.5rem;
  height: 0.5rem;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: oklch(100% 0 0 / 0.5);
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
}

.game-media .dots button.on {
  background: var(--n-0);
  transform: scale(1.25);
}

.game-side {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.game-side h1 {
  margin: 0;
  font-size: var(--t-2xl);
}

.game-side .by {
  margin: 0;
  color: var(--muted);
  font-size: var(--t-sm);
}

.play {
  font-size: var(--t-xl);
  padding: var(--s-3);
  letter-spacing: 0.01em;
}

.play-on {
  display: flex;
  gap: 0.125rem;
  padding: 0.1875rem;
  border: var(--edge);
  border-radius: var(--r-pill);
  background: var(--surface-2);
}

.play-on button {
  flex: 1;
  min-height: 1.875rem;
  padding: var(--s-1) var(--s-3);
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--muted);
  box-shadow: none;
}

.play-on button:hover {
  background: none;
  color: var(--text);
}

.play-on button.on {
  background: var(--accent);
  color: var(--accent-text);
}

.creator-card {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border: var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.creator-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.creator-card img {
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}

.creator-card > span {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.vote-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-2);
  align-items: center;
}

.vote-row button {
  font-variant-numeric: tabular-nums;
}

.vote.on.up {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--good);
}

.vote.on.down {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.vote-bar {
  height: 0.5rem;
  border-radius: var(--r-pill);
  background: color-mix(in oklch, var(--danger) 70%, transparent);
  overflow: hidden;
}

.vote-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--good);
  transition: width var(--slow) var(--ease-out);
}

.server-people {
  display: flex;
  gap: 0.125rem;
  flex-wrap: wrap;
  margin: var(--s-2) 0;
}

.server-people img {
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}

.fill {
  max-width: 16rem;
  height: 0.375rem;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.fill span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width var(--slow) var(--ease-out);
}

/* ---- avatar editor ---- */

.avatar-page {
  display: grid;
  grid-template-columns: minmax(17rem, 21rem) minmax(0, 1fr);
  gap: var(--s-6);
  align-items: start;
}

.avatar-side {
  min-width: 0;
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
}

.avatar-viewer {
  width: 100%;
  min-height: 0;
  aspect-ratio: 1;
  background:
    radial-gradient(ellipse at 50% 40%, color-mix(in oklch, var(--accent) 12%, var(--surface-2)), transparent 68%),
    var(--surface-2);
}

.avatar-viewer img {
  object-fit: contain;
}

.wardrobe {
  min-width: 0;
}

.wardrobe-tools {
  min-width: 0;
}

.wardrobe-tools input,
.wardrobe-tools select {
  min-width: 0;
}

.wardrobe .tabs {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: thin;
}

.wardrobe-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(9.375rem, 100%), 1fr));
}

.body-colors {
  min-width: 0;
  grid-template-columns: minmax(5.5rem, 7.5rem) minmax(0, 1fr);
}

.avatar-side h3 {
  margin-top: var(--s-4);
}

.wardrobe .tabs {
  position: sticky;
  top: var(--header-h);
  z-index: var(--z-sticky);
  margin: 0;
  padding: var(--s-2) 0;
  background: var(--bg);
}

.tabs .tab {
  padding: var(--s-2) var(--s-3);
  border: var(--edge);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.tabs .tab.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.wardrobe-grid {
  margin-top: var(--s-2);
}

.wear-card {
  position: relative;
}

.wear-card.worn {
  border-color: var(--good);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--good) 35%, transparent);
}

.wear-card.worn .check {
  transform: none;
}

.wear-card .check {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--r-pill);
  background: var(--good);
  color: var(--n-0);
  font-weight: 800;
  transform: scale(0);
  transition: transform var(--normal) var(--ease-out);
}

.wear-card.busy {
  opacity: 0.55;
  pointer-events: none;
}

.wear-card.hide {
  display: none;
}

.wearing-strip {
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-3);
}

.wearing-strip .section-head {
  margin-bottom: var(--s-2);
}

.wearing-strip .warn {
  margin-left: auto;
  color: var(--gold);
  font-weight: 600;
}

.mini-worn {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
}

.mini-worn img {
  display: block;
  width: 4rem;
  height: 4rem;
  border: var(--edge);
  border-radius: var(--r-sm);
  background: var(--surface-3);
}

.mini-worn .x {
  position: absolute;
  top: -0.375rem;
  right: -0.375rem;
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--r-pill);
  background: var(--danger);
  color: var(--n-0);
  font-size: var(--t-xs);
  line-height: 1;
  transform: scale(0);
  transition: transform var(--fast) var(--ease-out);
}

.mini-worn:hover .x,
.mini-worn:focus-visible .x {
  transform: none;
}

.mini-worn.busy {
  opacity: 0.5;
}

.wardrobe-tools {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-1);
}

.wardrobe-tools input {
  flex: 1;
}

.mini-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}

.mini-items img {
  width: 3.25rem;
  height: 3.25rem;
  border: var(--edge);
  border-radius: var(--r-sm);
  transition: transform var(--fast) var(--ease-out);
}

.mini-items a:hover img {
  transform: translateY(-2px);
}

.body-colors {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: var(--s-3);
  align-items: start;
}

.figure rect {
  stroke: oklch(0% 0 0 / 0.25);
  stroke-width: 1.2;
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform var(--fast) var(--ease-out), stroke var(--fast) var(--ease);
}

.figure rect:hover {
  transform: scale(1.05);
}

.figure rect.on {
  stroke: var(--accent);
  stroke-width: 3;
}

.palette {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: var(--s-1);
}

.swatch {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid oklch(0% 0 0 / 0.2);
  border-radius: var(--r-xs);
  transition: transform var(--fast) var(--ease-out);
}

.swatch:hover {
  transform: scale(1.15);
}

.swatch.on {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  transform: scale(1.1);
}

.avatar-side .body-colors {
  grid-template-columns: minmax(5.5rem, 7.5rem) minmax(0, 1fr);
}

.avatar-side .body-colors > *,
.avatar-side .palette {
  min-width: 0;
}

.avatar-side .palette {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.avatar-side .swatch {
  width: 100%;
  min-width: 0;
}

/* ---- profiles, badges, inventory ---- */

.badge-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  gap: var(--s-2);
}

.badge-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--t-xs);
  text-align: center;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease-out);
}

.badge-tile:hover {
  background: var(--surface);
  text-decoration: none;
}

.badge-tile img,
.badge-blank {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: var(--r-pill);
  object-fit: cover;
}

.badge-blank {
  display: grid;
  place-items: center;
  background: var(--accent-2);
  color: var(--n-0);
  font-size: 1.75rem;
}

.badge-view .badge-blank {
  width: 100%;
  height: 100%;
  border-radius: var(--r-sm);
  font-size: 7.5rem;
}

.badge-list img,
.badge-list .badge-blank {
  width: 4rem;
  height: 4rem;
}

.badge-list li.have {
  background: color-mix(in oklch, var(--good) 6%, transparent);
}

.badge-list .rarity {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.inv-layout {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: var(--s-5);
  align-items: start;
}

/* ---- trades ---- */

.trade-with {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.trade-columns {
  display: grid;
  grid-template-columns: 1fr 18.75rem 1fr;
  gap: var(--s-4);
  align-items: start;
}

.trade-inventory {
  padding: var(--s-3);
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius);
}

.trade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.875rem, 1fr));
  gap: var(--s-2);
  max-height: 38rem;
  overflow-y: auto;
  padding: 0.125rem;
}

.trade-pick {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--s-2);
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--t-sm);
  font-weight: 500;
  text-align: left;
}

.trade-pick img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: var(--r-xs);
}

.trade-pick.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.trade-pick .item-name {
  margin-top: var(--s-1);
  width: 100%;
}

.trade-summary {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
}

.summary-items {
  display: flex;
  gap: var(--s-1);
  flex-wrap: wrap;
  min-height: 3.5rem;
  margin-bottom: var(--s-2);
}

.summary-items img {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  animation: pop var(--normal) var(--ease-out);
}

.offers {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--s-3);
  align-items: stretch;
}

.offer {
  display: flex;
  flex-direction: column;
  padding: var(--s-3);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.offer-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-2);
  flex: 1;
}

.offer-item {
  display: flex;
  flex-direction: column;
  padding: var(--s-2);
  border: var(--edge);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--t-sm);
}

.offer-item:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.offer-item img {
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: var(--r-xs);
}

.offer-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.swap {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: var(--t-xl);
}

.meter {
  display: inline-block;
  width: 5.5rem;
  height: 0.5rem;
  vertical-align: middle;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.meter > span {
  display: block;
  width: calc(var(--part, 0) * 100%);
  height: 100%;
  background: var(--good);
  transition: width var(--slow) var(--ease-out);
}

.meter.warm > span {
  background: var(--gold);
}

.meter.hot > span {
  background: var(--danger);
}

/* ---- money, upgrades, lottery ---- */

.money-head {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.balance-card {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
}

.balance-card .muted {
  color: oklch(100% 0 0 / 0.8);
}

.balance-card .tix {
  color: oklch(98% 0.05 85);
}

.balance-card .rbx-icon {
  color: oklch(98% 0.05 85);
}

.bc-hero {
  padding: var(--s-8);
  margin-bottom: var(--s-5);
  border-radius: var(--r-xl);
  background: var(--n-900);
  color: var(--n-50);
}

[data-theme="dark"] .bc-hero {
  background: var(--n-800);
}

.bc-hero p {
  margin: 0;
  max-width: 38rem;
  color: oklch(100% 0 0 / 0.8);
}

.bc-table {
  overflow-x: auto;
  padding: 0;
}

.bc-table th,
.bc-table td {
  text-align: center;
}

.bc-table th:first-child,
.bc-table td:first-child {
  text-align: left;
}

.bc-table th span {
  display: block;
  margin-top: var(--s-1);
}

.bc-table .current {
  background: var(--accent-soft);
}

.lottery-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-6);
  align-items: center;
  padding: var(--s-8);
  margin-bottom: var(--s-5);
  border-radius: var(--r-xl);
  background: var(--accent);
  color: var(--accent-text);
  overflow: hidden;
}

.lottery-hero > * {
  position: relative;
  z-index: 1;
}

.lottery-hero .eyebrow {
  color: oklch(100% 0 0 / 0.75);
}

.lottery-hero h1 {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  font-size: var(--t-2xl);
}

.lottery-hero .rbx {
  color: oklch(98% 0.06 85);
}

.lottery-hero .item {
  width: 11rem;
}

.lottery-hero .progress {
  max-width: 28rem;
}

.lottery-hero .progress::-webkit-progress-bar {
  background: oklch(100% 0 0 / 0.25);
}

.lottery-hero .progress::-webkit-progress-value,
.lottery-hero .progress::-moz-progress-bar {
  background: var(--n-0);
}

.lottery-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: var(--s-2) 0 var(--s-3);
}

.lottery-chips span,
.lottery-picks span {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0.1875rem 0.5rem;
  border-radius: var(--r-pill);
  background: oklch(100% 0 0 / 0.18);
  font-size: var(--t-sm);
}

.lottery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}

.lottery-grid + .lottery-grid {
  margin-top: var(--s-4);
}

.lottery-mine {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.lottery-mine > div {
  display: flex;
  flex-direction: column;
}

.lottery-mine .big-number {
  margin: 0;
}

.lottery-board li {
  gap: var(--s-2);
}

.lottery-board li.me {
  border-radius: var(--r-sm);
  background: var(--accent-soft);
}

.lottery-board .rank {
  width: 1.5rem;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}

.lottery-board li:first-child .rank {
  color: var(--gold);
}

.lottery-how {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin: 0;
  padding-left: var(--s-5);
  color: var(--muted);
}

.no-winner {
  width: 2.75rem;
  text-align: center;
  color: var(--muted);
}

.list img.prize-mini {
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-xs);
}

/* ---- create ---- */

.develop {
  display: grid;
  grid-template-columns: 26rem 1fr;
  gap: var(--s-5);
  align-items: start;
}

.drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: var(--s-2);
  min-height: 9rem;
  padding: var(--s-4);
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.drop:hover,
.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop.has-file {
  border-style: solid;
}

.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop img {
  max-height: 10rem;
  border-radius: var(--r-sm);
}

.drop-empty {
  display: grid;
  place-items: center;
  gap: var(--s-2);
}

.drop-empty .kind-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--accent);
}

.drop-empty b {
  color: var(--text);
}

.kind-icon {
  width: 1.75rem;
  height: 1.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.type-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}

.type-choice {
  display: grid;
  justify-items: center;
  gap: var(--s-1);
  padding: var(--s-3) var(--s-1);
  border: var(--edge);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--t-sm);
  font-weight: 600;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.type-choice:hover {
  border-color: var(--accent);
}

.type-choice.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.type-choice.staff {
  border-style: dashed;
}

.more-types {
  margin: 0 0 var(--s-2);
}

.preview {
  display: grid;
  place-items: center;
  gap: var(--s-2);
}

.preview img.template {
  max-height: 12.5rem;
  border-radius: var(--r-sm);
  background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px;
  image-rendering: pixelated;
}

.preview audio {
  width: 100%;
  min-width: 16rem;
}

.tshirt-on {
  display: grid;
  place-items: center;
  width: 9.375rem;
  height: 9.375rem;
  border-radius: var(--r-md);
  background: var(--surface-3);
}

.tshirt-on img {
  width: 6.875rem;
  height: 6.875rem;
  object-fit: contain;
}

.upload-card h1 {
  margin-bottom: var(--s-3);
}

.upload-card button[type="submit"] {
  width: 100%;
}

.upload-progress {
  display: grid;
  gap: var(--s-1);
  margin-bottom: var(--s-3);
}

.bar {
  display: block;
  height: 0.5rem;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width var(--normal) var(--ease);
}

.upload-done {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4);
  border-radius: var(--radius);
  background: var(--surface-2);
  animation: rise var(--normal) var(--ease-out);
}

.upload-done img {
  border-radius: var(--r-sm);
  background: var(--surface);
}

.creation-list li {
  flex-wrap: wrap;
}

.creation-list .pill {
  white-space: nowrap;
}

.edit-creation {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.edit-creation textarea {
  min-height: 4.5rem;
}

/* ---- creator hub ---- */

.hub-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}

.hub-tabs {
  display: flex;
  gap: var(--s-1);
  margin-bottom: var(--s-5);
  border-bottom: var(--edge);
}

.hub-tabs a {
  padding: var(--s-2) var(--s-4);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 600;
}

.hub-tabs a:hover {
  color: var(--text);
  text-decoration: none;
}

.hub-tabs a.on {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.hub-welcome {
  max-width: 35rem;
  margin: var(--s-10) auto;
}

.exp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18.75rem, 1fr));
  gap: var(--s-3);
}

.exp-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.exp-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-up);
}

.exp-card img {
  width: 4.5rem;
  height: 4.5rem;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  object-fit: cover;
}

.exp-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  flex: 1;
}

.exp-card-body b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-empty {
  padding: var(--s-10) var(--s-5);
  text-align: center;
  color: var(--muted);
}

.exp-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  max-width: 45rem;
}

.exp-form label {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.exp-form > form {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.exp-manage {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.exp-head {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.exp-head img {
  width: 6rem;
  height: 6rem;
  flex: none;
  border-radius: var(--r-md);
  background: var(--surface-3);
  object-fit: cover;
}

.exp-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: var(--s-4);
}

.exp-pictures {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}

.exp-pictures figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  margin: 0;
}

.exp-pictures img {
  width: 6rem;
  height: 6rem;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  object-fit: cover;
}

.exp-versions th,
.exp-versions td {
  padding: var(--s-2);
  border-bottom: var(--edge);
  text-align: left;
}

.exp-versions th {
  color: var(--muted);
  font-size: var(--t-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- download ---- */

.download-hero {
  padding: var(--s-8) var(--s-3) var(--s-4);
  text-align: center;
}

.download-hero h1 {
  font-size: var(--t-3xl);
  letter-spacing: -0.03em;
}

.download-hero p {
  color: var(--muted);
  font-size: var(--t-md);
}

.platforms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
  gap: var(--s-4);
  margin: var(--s-5) 0;
}

.platform {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.platform.main {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.platform-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.platform-icon {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--n-0);
}

.platform-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.platform-icon.windows {
  background: linear-gradient(135deg, var(--a-400), var(--a-600));
}

.platform-icon.xbox360 {
  background: linear-gradient(135deg, var(--g-300), var(--g-600));
}

.platform-icon.ps3 {
  background: linear-gradient(135deg, var(--a-300), var(--n-800));
}

.platform .buy {
  flex-direction: column;
  gap: 0;
}

.dl-meta {
  font-size: var(--t-xs);
  font-weight: 500;
  opacity: 0.85;
}

.platform .steps {
  margin: 0;
}

.dl-updated {
  margin: calc(var(--s-4) * -1 + var(--s-1)) 0 0;
  color: var(--muted);
  font-size: var(--t-sm);
  text-align: center;
}

.dl-updated time {
  color: var(--text);
  font-weight: 600;
}

.dl-details {
  padding-top: var(--s-3);
  border-top: var(--edge);
}

.dl-details summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-sm);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.dl-details summary::-webkit-details-marker {
  display: none;
}

.dl-details summary::after {
  content: "\203A";
  margin-left: auto;
  font-size: 1.1rem;
  line-height: 1;
  transition: transform var(--fast) var(--ease);
}

.dl-details[open] summary::after {
  transform: rotate(90deg);
}

.dl-details dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--s-2) var(--s-3);
  margin: var(--s-3) 0 0;
  font-size: var(--t-sm);
  animation: rise var(--fast) var(--ease-out);
}

.dl-details dt {
  color: var(--muted);
}

.dl-details dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.dl-hash {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}

.dl-hash code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: var(--t-xs) var(--mono);
}

.dl-more {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.dl-more .button {
  flex: 1;
  flex-direction: column;
  gap: 0;
}

.download-help {
  max-width: 51rem;
  margin: var(--s-8) auto 0;
}

.faq {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.faq details {
  padding: 0 var(--s-4);
  border: var(--edge);
  border-radius: var(--radius-s, var(--r-md));
  background: var(--surface);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 700;
}

.faq details[open] summary::after {
  content: "\2212";
}

.faq details p {
  margin: 0 0 var(--s-3);
  color: var(--muted);
}

.test-builds {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-12);
}

.test-builds h2 {
  margin: 0;
}

/* ---- comments ---- */

.comments {
  display: grid;
  gap: var(--s-3);
}

.comment-form {
  display: grid;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

/* ---- sounds ---- */

.audio-player {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-3);
  align-items: center;
  max-width: 35rem;
  margin: var(--s-3) 0;
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius);
}

.play-toggle {
  width: 3rem;
  height: 3rem;
  min-height: 0;
  padding: 0;
  border-radius: var(--r-pill);
}

.wave-wrap {
  min-width: 0;
}

.wave {
  display: block;
  width: 100%;
  height: 4rem;
  opacity: 0.45;
  cursor: pointer;
  touch-action: none;
  transition: opacity var(--slow) var(--ease);
}

.audio-player.ready .wave {
  opacity: 1;
}

.wave-times {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}

.volume {
  width: 5rem;
  margin: 0;
}

/* ---- admin panel ---- */

.admin-panel {
  display: grid;
  grid-template-columns: 13.75rem 1fr;
  gap: var(--s-6);
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
  padding: var(--s-2);
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius);
}

.admin-nav a {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--t-sm);
  font-weight: 500;
  transition: background var(--fast) var(--ease);
}

.admin-nav a:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.admin-nav a.on,
.admin-nav a[aria-current] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.admin-main,
.admin-view {
  min-width: 0;
}

.admin-main > *,
.admin-view > * {
  animation: rise var(--normal) var(--ease-out) both;
}

.admin-main > * + *,
.admin-view > * + * {
  margin-top: var(--s-4);
}

.admin-panel h3 {
  margin: var(--s-4) 0 var(--s-2);
  font-size: var(--t-base);
}

.admin-loading {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0;
  color: var(--muted);
}

.admin-panel button[aria-busy] {
  cursor: progress;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: var(--s-3);
}

.stat {
  padding: var(--s-4);
  background: var(--surface);
  border: var(--edge);
  border-radius: var(--radius);
}

.stat b {
  display: block;
  font-size: var(--t-xl);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  color: var(--muted);
  font-size: var(--t-sm);
}

.stat.warn b {
  color: var(--gold);
}

.stat.bad b {
  color: var(--danger);
}

.stat.good b {
  color: var(--good);
}

.admin-group {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
  padding: var(--s-1) 0 var(--s-2);
}

.admin-group + .admin-group {
  padding-top: var(--s-2);
  border-top: var(--edge);
}

.admin-group-name {
  margin: 0 0 var(--s-1);
  padding: 0 var(--s-3);
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.admin-subtabs {
  margin: 0;
}

.admin-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: var(--s-4);
  align-items: start;
}

.admin-two > .card,
.admin-stack > .card {
  margin: 0;
}

.admin-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  scroll-margin-top: calc(var(--header-h) + var(--s-4));
}

.admin-stats-tight {
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  margin-bottom: var(--s-3);
}

.admin-head {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.admin-back {
  font-size: var(--t-sm);
}

.admin-person {
  align-items: flex-start;
  gap: var(--s-4);
}

.admin-person > img {
  width: 6rem;
  height: 6rem;
  flex: none;
  border-radius: var(--radius);
  background: var(--surface-3);
}

.admin-person > div {
  flex: 1;
  min-width: 0;
}

.admin-stat-link {
  display: block;
  color: inherit;
}

.admin-stat-link:hover {
  text-decoration: none;
}

.admin-stat-link:hover .stat {
  border-color: var(--accent);
}

.admin-fallback {
  grid-column: 1 / -1;
}

.admin-viewer {
  width: 26rem;
  max-width: 100%;
}

.admin-filters {
  margin-top: var(--s-3);
}

.admin-auto {
  width: auto;
}

.admin-file {
  width: auto;
  max-width: 17.5rem;
  padding: var(--s-1);
}

.admin-flags {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.admin-said {
  display: inline-block;
  margin-left: var(--s-2);
  animation: fade var(--normal) var(--ease);
}

.admin-hint {
  margin: calc(var(--s-2) * -1) 0 var(--s-3);
}

.admin-nowrap {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.admin-detail {
  max-width: 26rem;
  overflow-wrap: anywhere;
}

.admin-pager {
  justify-content: flex-end;
}

.admin-pager span {
  margin-right: auto;
}

.admin-grow {
  flex: 1;
  min-width: 12.5rem;
}

.admin-narrow {
  width: 12.5rem;
}

.admin-tiny {
  width: 5rem;
}

.admin-panel .row > input,
.admin-panel .row > select {
  margin: 0;
}

.admin-made {
  align-items: flex-start;
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: var(--edge);
}

.admin-made img {
  width: 6.875rem;
  height: 6.875rem;
  border-radius: var(--r-sm);
  background: var(--surface-3);
}

.admin-pieces {
  margin-bottom: var(--s-3);
}

.admin-pictures {
  align-items: flex-start;
}

.admin-pictures img {
  margin-bottom: var(--s-1);
  border-radius: var(--r-sm);
  background: var(--surface-3);
}

.admin-panel .description {
  max-height: 10rem;
  overflow: auto;
}

.admin-drawn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  max-width: 100%;
}

.admin-drawn p {
  margin: 0;
}

.admin-panel .mono {
  font-family: var(--mono);
  font-size: 0.925em;
}

.admin-panel td.ok,
.admin-panel td.bad {
  min-height: 0;
}

.admin-panel .strong {
  font-weight: 700;
}

.admin-total td {
  border-top: 2px solid var(--line-strong);
  font-weight: 700;
}

.admin-struck td {
  opacity: 0.5;
}

.admin-expanded > td {
  background: var(--surface-2);
}

.admin-total .ok {
  color: var(--good);
}

.admin-total .bad {
  color: var(--danger);
}

.preview-box {
  display: grid;
  place-items: center;
  min-height: 12.5rem;
  padding: var(--s-3);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.admin-barcell {
  width: 40%;
}

.admin-bar {
  display: block;
  min-width: 2px;
  height: 0.625rem;
  border-radius: var(--r-pill);
  background: var(--good);
}

.admin-bar.bad {
  background: var(--danger);
}

.class-bars {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--s-2) var(--s-5);
}

.class-bars > div {
  display: grid;
  grid-template-columns: 1fr 5.5rem 3.5rem;
  gap: var(--s-2);
  align-items: center;
}

.class-bars .meter > span {
  background: var(--accent);
}

.stat-tree {
  margin: var(--s-2) 0 0;
  padding: 0 0 0 var(--s-4);
  list-style: none;
  font-size: var(--t-sm);
}

.stat-tree:first-child,
.card > .stat-tree {
  padding-left: 0;
}

.stat-tree li {
  margin: 0.0625rem 0;
}

.stat-tree summary {
  cursor: pointer;
}

.stat-tree b,
.stat-leaf b {
  margin-left: var(--s-2);
  font-family: var(--mono);
  font-size: 0.925em;
  font-weight: 600;
}

.stat-leaf > span {
  color: var(--muted);
}

/* the arbiter's slots */

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.375rem, 1fr));
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.slot {
  --tone: var(--line-strong);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-height: 6.5rem;
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--t-xs);
  line-height: 1.4;
  overflow: hidden;
  transition: transform var(--fast) var(--ease-out), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.slot::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tone);
}

.slot b {
  font-size: var(--t-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot .slot-kind {
  font-size: 0.625rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--tone);
}

.slot.free {
  border-style: dashed;
  opacity: 0.5;
}

.slot.green {
  --tone: var(--good);
  border-color: color-mix(in oklch, var(--good) 35%, var(--line));
  background: var(--good-soft);
}

.slot.yellow {
  --tone: var(--gold);
  border-color: color-mix(in oklch, var(--gold) 40%, var(--line));
  background: var(--gold-soft);
}

.slot.red {
  --tone: var(--danger);
  border-color: color-mix(in oklch, var(--danger) 40%, var(--line));
  background: var(--danger-soft);
}

a.slot:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-up);
}

.slot.on {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.slot.pulse::after {
  content: "";
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--r-pill);
  background: var(--tone);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
    transform: scale(0.7);
  }
}

.slot-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
  color: var(--muted);
  font-size: var(--t-sm);
}

.slot-dot {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  margin-left: var(--s-2);
  border-radius: 3px;
  background: var(--line-strong);
}

.slot-dot:first-child {
  margin-left: 0;
}

.slot-dot.green {
  background: var(--good);
}

.slot-dot.yellow {
  background: var(--gold);
}

.slot-dot.red {
  background: var(--danger);
}

.slot-dot.free {
  border: 1px dashed var(--muted);
  background: none;
}

/* gauges and the instance grid */

.gauges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.875rem, 1fr));
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.gauge {
  --ring: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
}

.gauge.warm {
  --ring: var(--gold);
}

.gauge.hot {
  --ring: var(--danger);
}

.gauge svg {
  width: 3.5rem;
  height: 3.5rem;
  flex: none;
  transform: rotate(-90deg);
}

.gauge circle {
  fill: none;
  stroke-width: 7;
}

.gauge-track {
  stroke: var(--surface-3);
}

.gauge-fill {
  stroke: var(--ring);
  stroke-linecap: round;
  transition: stroke-dasharray var(--slow) var(--ease);
}

.gauge > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gauge b {
  font-size: var(--t-md);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.gauge span {
  color: var(--muted);
  font-size: var(--t-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-card {
  padding: var(--s-4);
}

.grid-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-2);
}

.grid-group {
  margin-top: var(--s-4);
  padding: var(--s-3);
  border: var(--edge);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.grid-group-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  padding-bottom: var(--s-3);
  margin-bottom: var(--s-3);
  border-bottom: 1px dashed var(--line-strong);
}

.grid-group-head > div:not(.grid-group-sparks) {
  display: flex;
  flex-direction: column;
}

.grid-group-head .grow {
  flex: 1;
  min-width: 12.5rem;
}

.grid-group-sparks {
  display: flex;
  gap: var(--s-3);
}

.grid-group-sparks .spark {
  width: 10rem;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.125rem, 1fr));
  gap: var(--s-2);
}

.tile-state {
  font-size: 0.625rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tone);
}

.led {
  width: 0.5rem;
  height: 0.5rem;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--tone, var(--muted));
}

.led.green {
  --tone: var(--good);
}

.led.red {
  --tone: var(--danger);
}

.led.free,
.tile.free .led {
  --tone: var(--surface-3);
}

.tile.busy .led {
  animation: pulse 0.9s ease-in-out infinite;
}

.tile-top {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 0.625rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tile-kind {
  color: var(--tone);
}

.tile-where {
  margin-left: auto;
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.tile-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tile-title b {
  font-size: var(--t-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-load {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--muted);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}

.tile-load .meter {
  flex: 1;
  width: auto;
}

.tile-sparks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}

.tile-foot {
  margin-top: auto;
  color: var(--muted);
  font-size: var(--t-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-idle {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  margin: auto 0;
  text-align: center;
  color: var(--muted);
}

.tile-idle b {
  font-size: var(--t-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spark {
  --spark: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.spark.alt {
  --spark: var(--accent-2);
}

.spark-head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  color: var(--muted);
  font-size: 0.625rem;
}

.spark-head b {
  color: var(--text);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}

.spark svg {
  width: 100%;
  height: 1.75rem;
  border-radius: var(--r-xs);
  background: color-mix(in oklch, var(--surface-3) 55%, transparent);
}

.spark-line {
  fill: none;
  stroke: var(--spark);
  stroke-width: 1.4;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.spark-area {
  fill: color-mix(in oklch, var(--spark) 22%, transparent);
}

/* ---- responsive ---- */

@media (max-width: 62rem) {
  .item-page,
  .avatar-page,
  .develop,
  .catalog .cat-body,
  .cat-body,
  .game-page,
  .admin-panel,
  .inv-layout {
    grid-template-columns: 1fr;
  }

  .cat-side {
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }

  .cat-side .side-group {
    min-width: 12.5rem;
  }

  .avatar-side,
  .admin-nav,
  .trade-summary {
    position: static;
  }

  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .trade-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 44rem) {
  .money-head,
  .lottery-grid,
  .lottery-hero {
    grid-template-columns: 1fr;
  }

  .offers {
    grid-template-columns: 1fr;
  }

  .swap {
    transform: rotate(90deg);
  }

  .hero {
    padding: var(--s-8) var(--s-5);
  }

  .hero h1 {
    font-size: var(--t-2xl);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .exp-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
.viewer button.view-toggle,.viewer.three button.view-toggle { position:absolute; top:12px; right:12px; left:auto; z-index:5; min-width:52px; min-height:40px; padding:8px 14px; border:1px solid #60636a; border-radius:0; background:#191a1cf2; color:#f5f5f5; font-size:14px; line-height:1.4; font-weight:600; }

.viewer [data-preview-label]::after { content: "3D"; }
.viewer [data-preview-label][aria-pressed="true"]::after { content: "2D"; }
