:root { color-scheme: light dark; --gap: 1rem; }
body { font: 16px/1.5 system-ui, sans-serif; margin: 0 auto; max-width: 46rem; padding: var(--gap); }
body.staff { max-width: 72rem; }
nav a { margin-right: var(--gap); }
form { display: grid; gap: .5rem; max-width: 22rem; }
form.inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; max-width: none; }
form.inline input { flex: 1 1 12rem; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid #8884; padding: .35rem .5rem; text-align: left; }
.error { color: #b00020; }
.ok { color: #0a7; }
.muted { color: #888; font-size: .9rem; }
.balance { font-size: 2rem; font-variant-numeric: tabular-nums; }
code { font-size: .85em; }

body.staff {
  max-width: 76rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
  background: #0e1424;
  color: #e7eefc;
  font-family: "Segoe UI", system-ui, sans-serif;
}
body.staff .staff-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
body.staff .staff-kicker {
  margin: 0;
  color: #8ea0cc;
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}
body.staff h1 { margin: .1rem 0 0; font-size: 1.7rem; }
body.staff.staff-signed-out #view {
  max-width: 24rem;
  margin: 4rem auto 0;
}
body.staff nav[hidden],
body.staff #staff-blurb[hidden] {
  display: none;
}
body.staff nav {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 1rem 0 .75rem;
}
body.staff nav a {
  margin: 0;
  text-decoration: none;
  color: #d5def5;
  background: #18233f;
  border: 1px solid #2c3c66;
  border-radius: 999px;
  padding: .35rem .8rem;
}
body.staff nav a:hover,
body.staff nav a[aria-current="page"] {
  background: #2c4fbe;
  border-color: #2c4fbe;
  color: #fff;
}
body.staff #view {
  background: #141c33;
  border: 1px solid #263456;
  border-radius: 16px;
  padding: 1.15rem 1.2rem 1.4rem;
}
body.staff h2 { margin: 0 0 .4rem; }
body.staff h3 { margin: 1.3rem 0 .4rem; }
body.staff .muted { color: #9aabcE; }
body.staff .ok { color: #3ddc97; }
body.staff .error {
  color: #ffb4c0;
  background: #3a1824;
  border-radius: 10px;
  padding: .55rem .75rem;
}
body.staff .error:empty,
body.staff .error[hidden] { display: none; }
body.staff table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  width: 100%;
  margin-top: .6rem;
}
body.staff th,
body.staff td {
  border-bottom: 1px solid #2a3b60;
  padding: .5rem .55rem;
  vertical-align: top;
}
body.staff th {
  color: #b7c6ea;
  font-size: .78rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}
body.staff tbody tr:hover td,
body.staff tr:hover td { background: #1a2748; }
body.staff code {
  font-size: .82em;
  background: #0d1428;
  padding: .05rem .3rem;
  border-radius: 4px;
}
body.staff button,
body.staff .lang-picker button {
  background: #3157d5;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: .4rem .7rem;
  cursor: pointer;
  font: inherit;
}
body.staff button:hover { background: #3d66ee; }
body.staff input,
body.staff select {
  background: #0e1424;
  color: inherit;
  border: 1px solid #31467a;
  border-radius: 8px;
  padding: .4rem .55rem;
  font: inherit;
}
body.staff form.inline { align-items: end; }
body.staff .lang-picker { display: flex; gap: .35rem; }
body.staff .lang-picker button {
  background: transparent;
  color: #d5def5;
  border: 1px solid #31467a;
}
body.staff .lang-picker button[aria-pressed="true"] {
  background: #3157d5;
  border-color: #3157d5;
  color: #fff;
}

/* ------------------------------------------------------------------ games
 * Dev B screens. The stage carries its own dark palette so every title reads
 * the same whichever scheme the page is in. Tokens first; titles reuse them.
 */
:root {
  --g-bg: #0f1320;
  --g-panel: #171c2e;
  --g-line: #28304a;
  --g-text: #e8ecf8;
  --g-dim: #8b95b3;
  --g-accent: #7c5cff;
  --g-win: #2fd49a;
  --g-loss: #ff5d73;
  --g-gold: #ffc44d;
  --g-radius: 14px;
}
body:has(.game) { max-width: 60rem; }

.lobby { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .75rem; margin: .5rem 0 1.5rem; }
.tile {
  display: grid; gap: .15rem; padding: .9rem 1rem 1rem; border-radius: var(--g-radius);
  background: linear-gradient(160deg, #1d2440, var(--g-bg)); color: var(--g-text);
  text-decoration: none; border: 1px solid var(--g-line); min-height: 5.5rem; align-content: end;
  transition: transform .15s ease, border-color .15s ease;
}
.tile:hover, .tile:focus-visible { transform: translateY(-2px); border-color: var(--g-accent); }
.tile strong { font-size: 1.05rem; }
.tile-mode { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--g-gold); }

.game {
  background: var(--g-bg); color: var(--g-text); border-radius: 18px; padding: 1rem 1.1rem 1.2rem;
  border: 1px solid var(--g-line);
}
.game .muted { color: var(--g-dim); }
.game .fine { font-size: .75rem; margin: .8rem 0 0; }
.game-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.game-bar h2 { margin: 0; flex: 1; font-size: 1.3rem; }
.game-bar .back { color: var(--g-dim); text-decoration: none; }
.game-bar .wallet { font-variant-numeric: tabular-nums; font-weight: 600; background: var(--g-panel); padding: .3rem .7rem; border-radius: 999px; }

.flash { margin: .7rem 0 0; padding: .5rem .75rem; border-radius: 10px; background: var(--g-panel); }
.flash.win { color: var(--g-win); }
.flash.loss { color: var(--g-loss); }

.play { display: grid; grid-template-columns: minmax(13rem, 17rem) 1fr; gap: 1rem; margin-top: 1rem; }
@media (max-width: 42rem) { .play { grid-template-columns: 1fr; } }
.controls { display: grid; gap: .7rem; align-content: start; background: var(--g-panel); padding: .9rem; border-radius: var(--g-radius); }
.controls form { max-width: none; }
.board { background: var(--g-panel); border-radius: var(--g-radius); padding: .9rem; min-height: 16rem; position: relative; overflow: hidden; }

.game input, .game select {
  font: inherit; color: var(--g-text); background: var(--g-bg); border: 1px solid var(--g-line);
  border-radius: 10px; padding: .5rem .6rem; min-width: 0;
}
.game .field { display: grid; gap: .3rem; font-size: .85rem; }
.game button {
  font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent;
  padding: .6rem .9rem; background: var(--g-accent); color: #fff; font-weight: 600;
  transition: filter .15s ease, transform .1s ease;
}
.game button:hover { filter: brightness(1.12); }
.game button:active { transform: scale(.98); }
.game button:disabled { opacity: .5; cursor: progress; }
.game button.chip, .game button.ghost { background: var(--g-bg); border-color: var(--g-line); color: var(--g-text); padding: .45rem .65rem; }
.game button.ghost[aria-pressed="true"], .game button.chip[aria-pressed="true"] { border-color: var(--g-accent); background: #2a2350; }
.segmented { display: flex; gap: .35rem; flex-wrap: wrap; }

.outcome { font-size: 1.1rem; font-weight: 700; min-height: 1.6em; margin: .2rem 0 0; }
.outcome.win { color: var(--g-win); }
.outcome.loss { color: var(--g-dim); }
.big-mult { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.entries { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .3rem; }
.entries li { display: grid; grid-template-columns: 1fr auto auto auto; gap: .6rem; align-items: center; padding: .35rem .55rem; background: var(--g-bg); border-radius: 8px; font-variant-numeric: tabular-nums; }
.entries li.you { outline: 1px solid var(--g-accent); }
.entries .paid { color: var(--g-win); }
.entries .paid.zero { color: var(--g-dim); }
.room-head { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.phase { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--g-gold); }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .game *, .tile { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------ cases
 * D79/D80. Rarity colours are new tokens (none of the --g-* set is a tier
 * colour); everything else reuses the stage palette above.
 */
:root {
  --r-common: #aab3cf;
  --r-rare: #4d9bff;
  --r-epic: #b184ff;
  --r-legendary: #ffc44d;
  --r-mythic: #ff5d73;
  --g-glow: #3b4a85;
  --g-on-gold: #1a1405;
  --g-card-top: #1d2440;
  --g-banner-glow: #2b2468;
  --g-gold-glow: color-mix(in srgb, var(--g-gold) 27%, transparent);
  --g-gold-glow-strong: color-mix(in srgb, var(--g-gold) 33%, transparent);
  --g-edge-glow: color-mix(in srgb, var(--g-glow) 40%, transparent);
  --s-field-bg: #0e1424;
  --s-field-line: #31467a;
}

.cases-banner {
  display: grid; gap: .25rem; padding: 1.4rem 1.5rem; margin: 0 0 1rem; border-radius: 18px;
  text-decoration: none; color: var(--g-text); border: 1px solid var(--g-glow);
  background: radial-gradient(120% 140% at 85% 0%, var(--g-banner-glow) 0%, var(--g-panel) 45%, var(--g-bg) 100%);
  box-shadow: 0 0 22px var(--g-edge-glow); transition: border-color .15s ease, box-shadow .15s ease;
}
.cases-banner:hover, .cases-banner:focus-visible { border-color: var(--g-gold); box-shadow: 0 0 26px var(--g-gold-glow-strong); }
.cases-banner__eyebrow { font-size: .75rem; letter-spacing: .16em; color: var(--g-gold); }
.cases-banner__title { font-size: clamp(1.4rem, 5vw, 2rem); line-height: 1.15; }
.cases-banner__cta { justify-self: start; margin-top: .5rem; padding: .45rem 1rem; border-radius: 10px; background: var(--g-gold); color: var(--g-on-gold); font-weight: 700; }

.rarity-common { --rc: var(--r-common); }
.rarity-rare { --rc: var(--r-rare); }
.rarity-epic { --rc: var(--r-epic); }
.rarity-legendary { --rc: var(--r-legendary); }
.rarity-mythic { --rc: var(--r-mythic); }
.rarity-common, .rarity-rare, .rarity-epic, .rarity-legendary, .rarity-mythic { color: var(--rc); border-color: var(--rc); }

.cases { display: grid; gap: 1rem; margin-top: 1rem; min-width: 0; }
.cases__row { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .4rem; scroll-snap-type: x proximity; }
.game button.case-card {
  flex: 0 0 11rem; display: grid; gap: .25rem; text-align: left; align-content: start; scroll-snap-align: start;
  background: linear-gradient(160deg, var(--g-card-top), var(--g-panel)); color: var(--g-text);
  border: 1px solid var(--g-line); border-radius: var(--g-radius); padding: .8rem;
}
.cases__row.is-busy .case-card:not(.is-selected) { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.cases__row.is-busy .case-card { pointer-events: none; }
.game button.case-card:hover { border-color: var(--g-glow); }
.game button.case-card.is-selected { border-color: var(--g-gold); box-shadow: 0 0 16px var(--g-gold-glow); }
.case-card img, .case-card__art { width: 100%; height: 5.5rem; object-fit: contain; display: grid; place-items: center; font-size: 2.4rem; color: var(--g-dim); }
.case-card .muted { font-size: .75rem; }
.case-card__price { color: var(--g-gold); font-weight: 700; font-variant-numeric: tabular-nums; }

.case-panel { display: grid; gap: .8rem; min-width: 0; }
.case-panel__head { display: flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: baseline; }
.case-panel__head h2 { margin: 0; font-size: 1.3rem; }

.reel { overflow: hidden; position: relative; background: var(--g-panel); border: 1px solid var(--g-line); border-radius: var(--g-radius); padding: .6rem; }
.reel__track { display: flex; gap: 12px; will-change: transform; }
.reel__cell {
  flex: 0 0 120px; display: grid; gap: .3rem; justify-items: center; padding: .5rem .4rem; box-sizing: border-box;
  background: var(--g-bg); border: 1px solid var(--rc, var(--g-line)); border-bottom-width: 3px; border-radius: 10px; font-size: .75rem; text-align: center;
}
.reel__cell img, .reel__art { width: 100%; height: 4.2rem; object-fit: contain; }
.reel__art { background: radial-gradient(circle, var(--rc, var(--g-line)) 0%, transparent 70%); opacity: .45; }
/* A skin's picture sits on the same glow, so one that fails to load leaves the glow and not an empty tile. */
.reel__cell img, .drop img, .case-card img, .inv-item img {
  background: radial-gradient(circle, color-mix(in srgb, var(--rc, var(--g-line)) 45%, transparent) 0%, transparent 70%);
}
.reel__marker { position: absolute; z-index: 1; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--g-gold); box-shadow: 0 0 10px var(--g-gold); pointer-events: none; }

.case-panel__actions { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; }
.game button.open-case {
  background: var(--g-gold); color: var(--g-on-gold); font-size: 1.05rem; padding: .75rem 1.6rem; box-shadow: 0 0 18px var(--g-gold-glow);
}
.game button.open-case:disabled { background: var(--g-line); color: var(--g-dim); box-shadow: none; cursor: not-allowed; }
.game button.upgrade-case {
  background: var(--g-gold); color: var(--g-on-gold); font-size: .95rem; padding: .45rem 1rem;
}
.contents { font-size: .85rem; }
.contents td { border-bottom: 1px solid var(--g-line); }
.game a { color: var(--g-gold); }

.drops { min-width: 0; } /* a grid item: without this the row of tiles stretches the whole screen */
.drops h3 { margin: 0 0 .4rem; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--g-dim); }
.drops__row { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .3rem; }
.drop {
  flex: 0 0 7.5rem; display: grid; gap: .2rem; justify-items: center; align-content: start; padding: .5rem .4rem; box-sizing: border-box;
  background: var(--g-panel); border: 1px solid var(--rc, var(--g-line)); border-bottom-width: 3px; border-radius: 10px; font-size: .75rem; text-align: center;
}
.drop img, .drop__art { width: 100%; height: 3.4rem; object-fit: contain; }
.drop__art { background: radial-gradient(circle, var(--rc, var(--g-line)) 0%, transparent 70%); opacity: .45; }
.drop strong { overflow-wrap: anywhere; }
.drop time { font-size: .7rem; }

.trade-url { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; max-width: none; margin: 1rem 0 0; }
.trade-url label { display: grid; gap: .3rem; flex: 1 1 18rem; font-size: .85rem; }
.inventory__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .75rem; margin-top: 1rem; }
.inv-item { display: grid; gap: .3rem; align-content: start; padding: .8rem; background: var(--g-panel); border: 1px solid var(--g-line); border-radius: var(--g-radius); overflow-wrap: anywhere; }
.inv-item img { width: 100%; height: 5.5rem; object-fit: contain; }
.inv-item__value { color: var(--g-gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.inv-item__actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.inv-item.status-sold, .inv-item.status-withdrawn, .inv-item.status-lost { opacity: .7; }

.cases-staff textarea { width: 100%; min-height: 16rem; box-sizing: border-box; font: .85rem/1.4 ui-monospace, monospace; background: var(--s-field-bg); color: inherit; border: 1px solid var(--s-field-line); border-radius: 8px; padding: .6rem; }

@media (max-width: 640px) {
  .case-panel__actions { flex-direction: column; align-items: stretch; }
  .game button.open-case { width: 100%; }
  .game { padding: .8rem; }
  .game button.case-card { flex-basis: 9.5rem; }
  .trade-url button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cases-banner, .case-card { transition: none !important; }
}

/* Sandbox promo management: forms stay usable on narrow staff screens. */
.promo-form { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr)); gap:16px; align-items:end; margin:24px 0; }
.promo-form label, .promo-card label { display:grid; gap:6px; min-width:0; }
.promo-form input, .promo-card input { width:100%; min-width:0; box-sizing:border-box; }
.promo-form button, .promo-card button { min-height:44px; }
.promo-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr)); gap:16px; }
.promo-card { min-width:0; padding:20px; border:1px solid #41516d; border-radius:14px; }
.promo-card h3, .promo-card p { overflow-wrap:anywhere; }
.promo-card form { display:grid; gap:12px; }

/* Commercial terms are a separate, responsive staff form. */
body.staff #commission-save { max-width: 52rem; margin-top: 1.5rem; }
#commission-save fieldset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; border: 1px solid #35415a; border-radius: .75rem; padding: 1.25rem; min-width: 0; }
#commission-save label, #commission-search label { display: grid; gap: .4rem; min-width: 0; }
#commission-save input { width: 100%; min-width: 0; box-sizing: border-box; }
#commission-save .muted, #commission-save button { grid-column: 1 / -1; }
#commission-players button { max-width: 100%; text-align: left; overflow-wrap: anywhere; }
@media (max-width: 640px) { #commission-save fieldset { grid-template-columns: minmax(0, 1fr); } }
