:root {
  --hull: #14181c;
  --plate: #6b7b87;
  --rivet: #c7d3dc;
  --oil: #212b33;
  --stamp: #b8c4cc;
  --hazard: #c98a3e;
  --salvage: #d9b054;
  --radius: 10px;
  --radius-sm: 6px;
  --profiteer: #c4a35a;
  --crafty: #6b8f71;
  --vicious: #8a3a32;
  --fragile: #aab6ba;
  --rental: #5f7a6b;
  --unstable: #8a9a3a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Science Gothic", ui-sans-serif, system-ui, sans-serif;
  font-stretch: condensed;
  color: var(--stamp);
  background: var(--hull);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 16px min(5vw, 24px);
  background: var(--oil);
  border-bottom: 1px solid var(--rivet);
  border-radius: var(--radius);
}

.brand {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rivet);
}

.game-version {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--plate);
}

.topbar-lead {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 16px;
}

#tiles {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stamp);
  background: transparent;
  border: 1px solid var(--plate);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hud-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--plate);
}

.remaining, .money, .name, .armor {
  font-size: clamp(15px, 4vw, 20px);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--stamp);
  min-width: 0;
  max-width: 40vw;
  overflow-wrap: anywhere;
}

.money {
  color: var(--salvage);
}

.armor {
  color: var(--plate);
}

.armor[data-charged] {
  color: var(--rivet);
}

.field {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  width: min(94vw, 26rem);
  margin: 20px auto 0;
  padding: 6px;
  background: var(--oil);
  border: 1px solid var(--rivet);
  border-radius: var(--radius);
  user-select: none;
}

.space {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--rivet);
  background: var(--oil);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--stamp);
  user-select: none;
  touch-action: manipulation;
  border-radius: var(--radius-sm);
}

.space[data-hidden] {
  background: var(--plate);
  box-shadow: inset 0 1px 0 var(--rivet);
}

.space[data-biome="water"] {
  background: #3d6a78;
}

.space[data-biome="desert"] {
  background: #a67c52;
}

.space[data-biome="jungle"] {
  background: #4a6b4e;
}

.space[data-biome="snow"] {
  background: #FFFAFA;
}

.space[data-biome="wasteland"] {
  background: #ECFF00;
}

.space .effect-badge,
.space .tactics-badge,
.space .strategy-badge {
  position: absolute;
  z-index: 1;
  font-weight: 700;
  line-height: 1;
  letter-spacing: normal;
  background: var(--oil);
}

.space .effect-badge {
  top: 3px;
  right: 3px;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--rivet);
  font-size: 9px;
  color: var(--rivet);
}

.space[data-effect="profiteer"] .effect-badge { border-color: var(--profiteer); }
.space[data-effect="crafty"] .effect-badge { border-color: var(--crafty); }
.space[data-effect="vicious"] .effect-badge { border-color: var(--vicious); }

.space[data-entering] .effect-badge {
  animation: 0.3s cubic-bezier(.34, 1.56, .64, 1) effect-badge-pop both;
  animation-delay: calc(var(--delay, 0ms) + 0.3s);
}

.space .tactics-badge,
.space .strategy-badge {
  bottom: 3px;
  padding: 1px 4px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--salvage);
  border-radius: 3px;
  line-height: 1.3;
}

.space .tactics-badge { left: 3px; }
.space .strategy-badge { right: 3px; }

.space[data-flagged]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  border-top: 14px solid var(--hazard);
  border-right: 14px solid transparent;
}

.space .face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.space[data-entering] {
  background: var(--plate);
}

.space[data-biome="water"] .face { background: #3d6a78; }
.space[data-biome="desert"] .face { background: #a67c52; }
.space[data-biome="jungle"] .face { background: #4a6b4e; }
.space[data-biome="snow"] .face { background: #FFFAFA; }
.space[data-biome="wasteland"] .face { background: #ECFF00; }

.space[data-entering] .face {
  animation: 0.35s cubic-bezier(.25, 1, .30, 1) hatch-iris-open both;
  animation-delay: var(--delay, 0ms);
}

.space .toast {
  position: absolute;
  left: 50%;
  bottom: 58%;
  z-index: 2;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #c23a32;
  pointer-events: none;
  animation: 1.4s ease-out score-toast both;
  animation-delay: calc(var(--delay, 0ms) + 0.12s);
}

.space[data-hit] .face {
  animation: 0.2s ease-out plate-shatter both, 0.45s ease-out hazard-pulse;
  background: var(--oil);
}

.space[data-just-defused] .face {
  animation: 0.4s ease-out shield-flash;
  background: var(--oil);
}

.space:not([data-hidden]):not([data-biome]) {
  background: var(--oil);
  border-color: var(--hazard);
}

.space[data-defused]:not([data-biome]) {
  border-color: var(--rivet);
}

.space[data-retriggered] .face::after {
  content: attr(data-count);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--rivet);
  animation: 0.3s ease-out retrigger-echo;
  animation-delay: calc(var(--delay, 0ms) + 0.35s);
  pointer-events: none;
}

.field[data-alert] {
  animation: 0.3s linear board-rumble;
}

.score {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.score-value {
  font-size: clamp(20px, 7vw, 32px);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--stamp);
  min-width: 0;
  overflow-wrap: anywhere;
}

.score-quota {
  font-size: clamp(12px, 3.4vw, 15px);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--plate);
  white-space: nowrap;
}

.score-meter {
  height: 4px;
  margin-top: 8px;
  background: var(--hull);
  border: 1px solid var(--rivet);
}

.score-meter-fill {
  height: 100%;
  width: 0%;
  background: var(--hazard);
  transition: width 0.25s ease-out;
}

.score[data-ticking] {
  animation: 0.12s ease-out score-tick;
}

.score[data-quota-met]::after {
  content: attr(data-quota-met);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--oil);
  color: var(--rivet);
  animation: 0.55s cubic-bezier(.2, .8, .2, 1) quota-stamp forwards;
  pointer-events: none;
}

@keyframes hatch-iris-open {
  from { clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%); }
  to   { clip-path: polygon(-50% 50%, 50% -50%, 150% 50%, 50% 150%); }
}

@keyframes plate-shatter {
  0%   { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
  100% { clip-path: polygon(8% 0, 100% 4%, 92% 100%, 0% 96%); }
}

@keyframes hazard-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hazard) 0%, transparent); }
  35%      { box-shadow: 0 0 0 12px color-mix(in srgb, var(--hazard) 55%, transparent); }
}

@keyframes shield-flash {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rivet) 0%, transparent); }
  40%  { box-shadow: 0 0 0 12px color-mix(in srgb, var(--rivet) 55%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rivet) 0%, transparent); }
}

@keyframes board-rumble {
  0%, 100% { transform: translate(0, 0); }
  20%      { transform: translate(-3px, 1px); }
  40%      { transform: translate(3px, -2px); }
  60%      { transform: translate(-2px, 2px); }
  80%      { transform: translate(2px, -1px); }
}

@keyframes effect-badge-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes retrigger-echo {
  from { transform: translateY(0); opacity: 0.85; }
  to   { transform: translateY(-6px); opacity: 0; }
}

@keyframes quota-stamp {
  0%   { transform: scale(2.2) rotate(-6deg); opacity: 0; }
  45%  { transform: scale(0.92) rotate(-6deg); opacity: 1; }
  65%  { transform: scale(1.05) rotate(-6deg); }
  100% { transform: scale(1) rotate(-6deg); opacity: 0; }
}

@keyframes score-tick {
  50% { transform: scale(1.08); }
}

@keyframes score-toast {
  from { transform: translateX(-50%) scale(0.4); opacity: 0; }
  10%  { transform: translateX(-50%) scale(1.15); opacity: 1; }
  70%  { transform: translateX(-50%) translateY(-4px) scale(1); opacity: 1; }
  to   { transform: translateX(-50%) translateY(-14px) scale(1); opacity: 0; }
}

@keyframes leave-ready-active {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hazard) 0%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--hazard) 25%, transparent); }
}

@keyframes leave-ready-complete {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rivet) 0%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--rivet) 35%, transparent); }
}

.field[data-status="over"] {
  border-color: var(--hazard);
}

.field-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  width: min(94vw, 26rem);
  margin: 14px auto 24px;
  user-select: none;
}

.stat {
  flex: 1 1 8rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--oil);
  border: 1px solid var(--rivet);
  border-radius: var(--radius-sm);
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--plate);
}

.payout {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  min-width: 0;
}

.payout-value {
  font-size: clamp(20px, 7vw, 32px);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--plate);
  min-width: 0;
  overflow-wrap: anywhere;
}

.payout[data-state="active"] .payout-value {
  color: var(--hazard);
}

.payout[data-state="complete"] .payout-value {
  color: var(--rivet);
}

.payout[data-state="retreat"] .payout-value {
  color: #c23a32;
}

.payout[data-state="restart"] .payout-value {
  color: var(--hazard);
}

.payout-hint {
  flex-basis: 100%;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--plate);
}

.leave {
  flex: 1 1 100%;
  order: 3;
  margin: 0;
  padding: 14px 20px;
  font: inherit;
  font-size: clamp(15px, 4.4vw, 18px);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--plate);
  background: var(--oil);
  border: 1px solid var(--plate);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.leave[hidden] {
  display: none;
}

.leave:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.leave[data-state="active"] {
  color: var(--hazard);
  border-color: var(--hazard);
  animation: 2.4s ease-in-out infinite leave-ready-active;
}

.leave[data-state="complete"] {
  color: var(--hull);
  background: var(--rivet);
  border-color: var(--rivet);
  animation: 2.4s ease-in-out infinite leave-ready-complete;
}

.leave[data-state="retreat"] {
  color: var(--hull);
  background: #c23a32;
  border-color: #c23a32;
}

.leave[data-state="restart"] {
  color: var(--hazard);
  background: var(--hull);
  border-color: var(--hazard);
}

.shop {
  width: min(94vw, 26rem);
  margin: 20px auto;
  padding: 20px;
  color: var(--rivet);
  background: var(--oil);
  border: 1px solid var(--rivet);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.shop-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.shop-stats .stat {
  flex: 1 1 8rem;
}

.stat-value {
  font-size: clamp(15px, 4.2vw, 19px);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--stamp);
  overflow-wrap: anywhere;
}

.stat-armor {
  gap: 6px;
}

.armor-buy {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hazard);
  background: var(--oil);
  border: 1px solid var(--hazard);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
}

.armor-buy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.armor-buy[data-owned] {
  color: var(--hull);
  background: var(--rivet);
  border-color: var(--rivet);
  opacity: 1;
}

.shop-toast {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--rivet);
  border-left: 3px solid var(--salvage);
  border-radius: var(--radius-sm);
  background: var(--hull);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.shop-toast[hidden] {
  display: none;
}

#field-rack {
  width: min(94vw, 26rem);
  margin: 16px auto 0;
}

.rack {
  border: 1px solid var(--rivet);
  border-radius: var(--radius);
  background: var(--hull);
  overflow: hidden;
}

.rack-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rivet);
}

.rack-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--salvage);
}

.rack-count {
  font-size: 11px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--plate);
}

.rack-plates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
}

.plate {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1 1 6.4rem;
  min-width: 6.4rem;
  padding: 7px 10px 7px 13px;
  font: inherit;
  text-align: left;
  color: var(--stamp);
  background: var(--oil);
  border: 1px solid var(--rivet);
  border-radius: var(--radius-sm);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  cursor: pointer;
}

.plate::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--salvage);
}

.plate-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--rivet);
}

.plate-hint {
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--plate);
  overflow-wrap: anywhere;
}

.plate:hover {
  border-color: var(--salvage);
}

.plate:focus-visible {
  outline: 2px solid var(--salvage);
  outline-offset: 2px;
}

.plate.is-selected {
  border-color: var(--salvage);
  background: var(--hull);
}

.plate.is-empty {
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  border-style: dashed;
  border-color: var(--plate);
  color: var(--plate);
  cursor: default;
  clip-path: none;
}

.plate.is-empty::before {
  content: none;
}

.plate.is-empty .plate-empty {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rack-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.18s ease-out;
  border-top: 0 solid var(--rivet);
}

.rack-detail.is-open {
  max-height: 8rem;
  border-top-width: 1px;
}

.rack-detail-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  background: var(--oil);
}

.detail-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.detail-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rivet);
}

.detail-hint {
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--stamp);
  overflow-wrap: anywhere;
}

.sell-btn {
  flex: 0 0 auto;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hull);
  background: var(--salvage);
  border: 1px solid var(--salvage);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
}

.shop-sections {
  display: flex;
  flex-direction: column;
}

.shop-sections section {
  padding: 16px 0;
  border-top: 1px solid var(--plate);
}

.shop-sections section:first-child {
  padding-top: 0;
  border-top: none;
}

.shop-sections section[data-section="market"] {
  border-top-style: dashed;
}

.shop-sections header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.shop-sections h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--salvage);
}

.shop-sections section[data-section="market"] h2::after,
.shop-sections section[data-section="tiles"] h2::after {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

.shop-sections section[data-section="market"] h2::after {
  content: "marked";
  color: var(--rivet);
  border-color: var(--rivet);
}

.shop-sections section[data-section="tiles"] h2::after {
  content: "hits 2 random Tiles";
  color: var(--hazard);
  border-color: var(--hazard);
}

.offer-empty {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  font-style: italic;
  color: var(--plate);
}

.reroll {
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--plate);
  background: var(--oil);
  border: 1px solid var(--plate);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
}

.reroll:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.offer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  font: inherit;
  text-align: left;
  color: var(--stamp);
  background: var(--oil);
  border: 1px solid var(--rivet);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 8px;
  cursor: pointer;
}

.offer:last-of-type {
  margin-bottom: 0;
}

.offer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.offer-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.offer-cost {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--hazard);
}

.offer-hint {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--plate);
}

.offer:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.offer.is-hit {
  cursor: default;
  color: var(--hazard);
  border-color: var(--hazard);
}

.offer-downside {
  flex: 1 0 100%;
  margin-top: 8px;
  padding-top: 8px;
  padding-left: 8px;
  border-top: 1px dashed var(--plate);
  border-left: 3px solid var(--downside-color, var(--plate));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stamp);
  text-align: left;
}

.offer-downside[data-downside="fragile"] { --downside-color: var(--fragile); }
.offer-downside[data-downside="rental"] { --downside-color: var(--rental); }
.offer-downside[data-downside="unstable"] { --downside-color: var(--unstable); }

#deploy {
  align-self: flex-start;
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hazard);
  background: var(--hull);
  border: 1px solid var(--hazard);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
}

#deploy:disabled {
  color: var(--plate);
  border-color: var(--plate);
  opacity: 0.6;
  cursor: not-allowed;
}

body[data-screen="shop"] .field,
body[data-screen="shop"] .field-bar,
body[data-screen="shop"] .field-key,
body[data-screen="shop"] #field-rack {
  display: none;
}

.field-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
  width: min(94vw, 26rem);
  margin: 0 auto 24px;
  padding: 8px 12px;
  background: var(--oil);
  border: 1px solid var(--rivet);
  border-radius: var(--radius-sm);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.key-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--plate);
}

.key-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--stamp);
}

.key-glyph {
  display: inline-grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  font-size: 9px;
  font-weight: 700;
  background: var(--hull);
}

.key-glyph[data-key="profiteer"],
.key-glyph[data-key="crafty"],
.key-glyph[data-key="vicious"] {
  border-radius: 50%;
  border: 2px solid var(--rivet);
  color: var(--rivet);
}

.key-glyph[data-key="profiteer"] { border-color: var(--profiteer); }
.key-glyph[data-key="crafty"] { border-color: var(--crafty); }
.key-glyph[data-key="vicious"] { border-color: var(--vicious); }

.key-glyph[data-key="tactics"],
.key-glyph[data-key="strategy"] {
  border-radius: 3px;
  color: var(--salvage);
}

body[data-screen="field"] .shop {
  display: none;
}

.tile-bag {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
}

.tile-bag[hidden] {
  display: none;
}

.tile-bag-backdrop {
  position: absolute;
  inset: 0;
  background: #14181ccc;
}

.tile-bag-panel {
  position: relative;
  z-index: 1;
  width: min(94vw, 40rem);
  max-height: min(90vh, 52rem);
  overflow: auto;
  padding: 20px;
  color: var(--rivet);
  background: var(--oil);
  border: 1px solid var(--rivet);
  border-radius: var(--radius);
}

.tile-bag-panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tile-bag-panel header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--salvage);
}

.tile-bag-close {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stamp);
  background: transparent;
  border: 1px solid var(--plate);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
}

.tile-bag .shop-sections {
  margin-bottom: 16px;
}

.tile-bag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tile-bag-chips .space {
  width: 48px;
  flex: 0 0 48px;
}

.tile-bag-key {
  width: 100%;
  margin: 0;
}

body[data-screen="shop"] .tile-bag-key {
  display: flex;
}

.tile-bag-key .key-glyph[data-biome] {
  border: 1px solid var(--rivet);
}

.tile-bag-key .key-glyph[data-biome="water"] { background: #3d6a78; }
.tile-bag-key .key-glyph[data-biome="desert"] { background: #a67c52; }
.tile-bag-key .key-glyph[data-biome="jungle"] { background: #4a6b4e; }
.tile-bag-key .key-glyph[data-biome="snow"] { background: #FFFAFA; }
.tile-bag-key .key-glyph[data-biome="wasteland"] { background: #ECFF00; }

@media (min-width: 640px) {
  .field, .field-bar, .field-key, .shop, #field-rack {
    width: min(90vw, 30rem);
  }

  .field {
    margin-top: 28px;
  }

  .leave {
    flex: 0 1 12rem;
    order: 0;
  }

  .stat-score, .stat-payout {
    flex: 1 1 0;
  }
}

@media (min-width: 1000px) {
  .field, .field-bar, .field-key, #field-rack {
    width: min(60vw, 40rem);
  }

  .shop {
    width: min(70vw, 44rem);
  }
}
