:root {
  --ink: #111;
  --paper: #fff;
  --muted: #666;
  --line: #222;
  --soft: #f3f3f3;
  --accent: #111;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.4 Arial, Helvetica, sans-serif;
  overflow: hidden;
}

canvas#game {
  position: fixed;
  inset: 0;
  display: block;
}
body.playing canvas#game { cursor: none; }
/* While playing, no selecting text with the mouse (Shift + click included); the chat box still can. */
body.playing { -webkit-user-select: none; user-select: none; }
body.playing input, body.playing textarea { -webkit-user-select: text; user-select: text; }

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
  overflow-y: auto;
}
.screen.overlay-low {
  background: transparent;
  align-items: flex-end;
  padding-bottom: 12vh;
  pointer-events: none;
}
.overlay-low .buttons { pointer-events: auto; display: flex; gap: 10px; }

.panel {
  background: var(--paper);
  border: 2px solid var(--line);
  padding: 22px 26px 18px;
  width: min(880px, 100%);
  max-height: 100%;
  overflow-y: auto;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.12);
}
.panel.small { width: min(320px, 100%); display: flex; flex-direction: column; gap: 10px; }
.panel h2 { margin: 0 0 6px; font-size: 22px; }

header h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 54px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 900;
  line-height: 1;
}
header .tag { margin: 6px 0 10px; color: var(--muted); }

.cols { display: grid; grid-template-columns: 1.25fr 1fr; gap: 26px; }
@media (max-width: 720px) { .cols { grid-template-columns: 1fr; gap: 14px; } }

.field { display: block; font-weight: bold; margin: 12px 0 6px; }
.field input, .field select { display: block; margin-top: 6px; font-weight: normal; }

input[type="text"], input[type="search"], input:not([type]), select {
  width: 100%;
  font: inherit;
  padding: 7px 9px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 0;
}
input[type="range"] { width: 100%; accent-color: var(--ink); }

.maps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  /* A scrolling box, so 18+ maps don't make the page long. */
  max-height: min(560px, 62vh);
  overflow-y: auto;
  padding: 2px 6px 2px 2px;
  align-content: start;
}
.experimental { margin: 4px 0 14px; }
.exp-head { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 0 6px; }
.map-card .made-for {
  position: absolute; top: 5px; left: 5px; font-size: 10px; padding: 1px 6px;
  background: var(--ink); color: var(--paper); letter-spacing: 0.02em;
}
.map-card {
  border: 1.5px solid #bbb;
  background: var(--paper);
  padding: 6px 6px 4px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.map-card canvas { display: block; width: 100%; height: 58px; }
.map-card span { display: block; font-size: 13px; margin-top: 3px; }
.map-card small { color: var(--muted); font-size: 11px; }
.map-card[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.map-card:focus-visible { outline: 2px dashed var(--ink); outline-offset: 2px; }

.seg { display: flex; border: 1.5px solid var(--line); }
.seg label { flex: 1; text-align: center; padding: 7px 6px; cursor: pointer; font-size: 14px; }
.seg label + label { border-left: 1.5px solid var(--line); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--paper); }
.seg label:has(input:focus-visible) { outline: 2px dashed var(--ink); outline-offset: -4px; }

button {
  font: inherit;
  font-weight: bold;
  padding: 9px 16px;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
button:hover { background: var(--soft); }
button.primary { background: var(--ink); color: var(--paper); }
button.primary:hover { background: #333; }
#play { width: 100%; margin-top: 18px; font-size: 20px; padding: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

.check { display: flex; gap: 8px; align-items: center; margin-top: 6px; color: var(--muted); }

.controls { margin-top: 14px; font-size: 13px; }
.controls summary { cursor: pointer; font-weight: bold; }
.controls table { border-collapse: collapse; margin-top: 6px; width: 100%; }
.controls td { padding: 3px 0; vertical-align: top; }
.controls td:first-child { color: var(--muted); padding-right: 10px; }
kbd {
  display: inline-block;
  border: 1px solid #999;
  border-bottom-width: 2px;
  padding: 0 5px;
  font: 12px/1.5 Arial, sans-serif;
  background: #fafafa;
}

.note { color: #b3261e; font-size: 13px; margin: 8px 0 0; }

footer { margin-top: 18px; padding-top: 10px; border-top: 1px solid #ddd; font-size: 12px; color: var(--muted); }
footer a { color: var(--ink); }

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.9);
}

/* ---- Menu additions ---- */
.field-row { display: flex; align-items: center; justify-content: space-between; }
button.small { font-size: 12px; padding: 4px 9px; border-width: 1.5px; }
.map-card { position: relative; }
.map-card .edit { position: absolute; top: 5px; right: 5px; font-size: 11px; padding: 2px 7px; border-width: 1.5px; font-weight: bold; }
.map-card.new-map { display: flex; align-items: center; justify-content: center; min-height: 108px; border-style: dashed; color: var(--muted); font-weight: bold; text-align: center; }
/* (Notes for Firefox's players only.) */
.firefox-only { display: none; }
html.firefox .firefox-only { display: inline; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; font-size: 14px; z-index: 50;
  max-width: calc(100% - 32px);
}

/* ---- Map maker ---- */
#editor {
  position: fixed; inset: 0; background: var(--paper);
  display: grid; grid-template-columns: 116px minmax(0, 1fr) 290px; grid-template-rows: auto minmax(0, 1fr);
  z-index: 20;
}
.ed-top {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 2px solid var(--line); flex-wrap: wrap;
}
.ed-top button { padding: 6px 12px; font-size: 14px; }
.ed-top input { width: min(260px, 40vw); font-weight: bold; font-size: 15px; padding: 6px 8px; border: 1.5px solid var(--line); }
.ed-top select { font-size: 13px; padding: 5px 4px; max-width: 170px; }
.ed-icon-hill { height: 10px; margin: 3px 0; border: 2px dashed #9646c8; background: rgba(150,70,200,0.15); }
.ed-icon-point { width: 14px; height: 14px; margin: 1px 0; border-radius: 50%; border: 2px solid #c8960a; }
.ed-icon-flag { width: 14px; height: 14px; margin: 1px 0; border-left: 2px solid currentColor; background: linear-gradient(135deg, #2f6fdb 50%, transparent 50%) 0 0 / 10px 8px no-repeat; }
.ed-icon-mcom { width: 10px; height: 14px; margin: 1px 0; background: #6a7079; border: 1.5px solid currentColor; box-shadow: inset 0 3px 0 #9fd39b; }
.ed-icon-site { height: 10px; margin: 3px 0; border: 2px dashed #c8501e; background: rgba(200,80,30,0.15); }
.ed-spacer { flex: 1; }
.ed-status { font-size: 12px; color: var(--muted); }
.ed-status.bad { color: #b3261e; font-weight: bold; }
.ed-tools { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-right: 2px solid var(--line); overflow-y: auto; }
.ed-tools button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px;
  font-size: 12px; border-width: 1.5px; position: relative;
}
.ed-tools button kbd { position: absolute; top: 3px; right: 4px; font-size: 9px; padding: 0 3px; border: none; background: none; color: #999; }
.ed-tools button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.ed-tools button[aria-pressed="true"] kbd { color: #bbb; }
.ed-icon { display: block; width: 26px; height: 16px; }
.ed-icon-select { background: linear-gradient(135deg, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%); width: 14px; }
.ed-icon-platform { border: 2px solid currentColor; height: 10px; margin: 3px 0; }
.ed-icon-pad { border: 2px solid currentColor; height: 10px; margin: 3px 0; background: #cfe0a8; }
.ed-icon-hard { border: 2px solid currentColor; height: 10px; margin: 3px 0; background: repeating-linear-gradient(45deg, transparent 0 3px, #9a9a9a 3px 4.5px); }
/* (Half paper, half solid block: a platform's look of its own.) */
.ed-icon-look { border: 2px solid currentColor; height: 10px; margin: 3px 0; background: linear-gradient(90deg, #fff 50%, #8a8d93 50%); }
.ed-icon-spawn { width: 10px; border-radius: 50%; border: 2px solid #2f6fdb; height: 10px; margin: 3px 0; }
.ed-icon-weapon { height: 4px; margin: 6px 0; background: currentColor; }
.ed-icon-health { width: 12px; height: 12px; margin: 2px 0; background: linear-gradient(#d21f1f, #d21f1f) center/4px 12px no-repeat, linear-gradient(#d21f1f, #d21f1f) center/12px 4px no-repeat; }
.ed-icon-armour { width: 12px; height: 12px; margin: 2px 0; background: #7d7d7d; clip-path: polygon(0 0, 35% 0, 50% 25%, 65% 0, 100% 0, 100% 100%, 0 100%); }
.ed-icon-jetpack { width: 10px; height: 14px; margin: 1px 0; border-left: 4px solid #5b5b5b; border-right: 4px solid #5b5b5b; }
.ed-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.ed-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.ed-hint { position: absolute; left: 10px; bottom: 6px; margin: 0; font-size: 12px; color: var(--muted); pointer-events: none; max-width: 70%; }
.ed-side { border-left: 2px solid var(--line); padding: 4px 12px 16px; overflow-y: auto; font-size: 13px; }
.ed-side h3 { font-size: 13px; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ed-num, .ed-field, .ed-range { display: block; font-size: 12px; color: var(--muted); margin: 6px 0; }
.ed-num input, .ed-field select { display: block; width: 100%; margin-top: 3px; font: inherit; color: var(--ink); padding: 5px 6px; border: 1.5px solid var(--line); background: var(--paper); }
.ed-range input { width: 100%; accent-color: var(--ink); }
.ed-range output { font-weight: bold; color: var(--ink); }
.ed-team { margin: 6px 0; }
.ed-team label { font-size: 12px; padding: 5px 4px; }
.ed-looks { margin: 6px 0; }
.ed-looks label { font-size: 12px; padding: 5px 3px; }
.ed-swatch { display: inline-block; width: 13px; height: 9px; border: 1.5px solid #111; vertical-align: -1px; }
.ed-row { display: flex; gap: 6px; margin-top: 8px; }
.ed-row button, .ed-files button { font-size: 12px; padding: 6px 8px; border-width: 1.5px; }
.ed-files { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
button.danger { color: #b3261e; border-color: #b3261e; }
.ed-note { color: var(--muted); font-size: 12px; margin: 6px 0; }
.ed-row button { flex: 1; }
.ed-wide input { width: 100%; }
.ed-jet { margin-top: 22px; }
#edProps details { margin: 6px 0; font-size: 12px; }
#edProps summary { cursor: pointer; font-weight: bold; color: var(--ink); }
.ed-loadout { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); padding: 4px 6px; margin-top: 4px; }
.ed-lo-group { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 3px 0; border-bottom: 1px dotted var(--line); }
.ed-lo-group:last-child { border-bottom: 0; }
.ed-lo-group > span { width: 100%; font-size: 10px; color: var(--muted); }
.ed-lo-group label { display: flex; gap: 3px; align-items: center; white-space: nowrap; }
.ed-stats { margin: 4px 0; line-height: 1.5; }
.ed-problem {
  display: block; width: 100%; text-align: left; font-weight: normal; font-size: 12px; padding: 6px 8px; margin: 4px 0;
  border-width: 1.5px; border-left-width: 5px;
}
.ed-problem.error { border-left-color: #b3261e; }
.ed-problem.warning { border-left-color: #d98a00; }
.ed-problem.ok { border-left-color: #3f9a3a; }
.ed-problem[disabled] { cursor: default; background: var(--paper); }
.ed-keys { margin-top: 14px; font-size: 12px; }
.ed-keys summary { cursor: pointer; font-weight: bold; }
.ed-keys td { padding: 2px 6px 2px 0; vertical-align: top; }
.ed-keys td:first-child { color: var(--muted); }
#edOpenDialog { border: 2px solid var(--line); padding: 16px 18px; width: min(460px, calc(100% - 32px)); max-height: 80vh; box-shadow: 6px 6px 0 rgba(0,0,0,0.12); }
#edOpenDialog::backdrop { background: rgba(255,255,255,0.7); }
#edOpenDialog form { display: flex; flex-direction: column; gap: 10px; }
.ed-list h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin: 10px 0 6px; }
.ed-list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #eee; }
.ed-list-row small { display: block; color: var(--muted); font-size: 11px; }
.ed-list-row button { font-size: 12px; padding: 4px 10px; border-width: 1.5px; }
@media (max-width: 900px) {
  #editor { grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) 40vh; }
  .ed-side { grid-column: 1 / -1; border-left: none; border-top: 2px solid var(--line); }
}

/* ---- Menu: tabs, online play ---- */
.menu-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.menu-head .tag { margin-bottom: 0; }
.name-field { margin: 0; width: min(240px, 100%); }
.tabs { display: flex; gap: 0; margin: 16px 0 14px; border-bottom: 2px solid var(--line); }
.tab { border: 2px solid var(--line); border-bottom: none; margin-right: -2px; padding: 9px 18px; background: var(--soft); }
.tab[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
#openLoadout { margin-left: auto; background: var(--paper); }
#openEditor { background: var(--paper); }
#openSettings { margin-right: 0; background: var(--paper); }
.muted-note { color: var(--muted); font-size: 13px; margin: 6px 0; }
.online-actions { display: flex; gap: 10px; flex-wrap: wrap; }
button.big { font-size: 18px; padding: 13px 24px; letter-spacing: 0.04em; }
.list-head { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.list-head h3 { margin: 0; font-size: 16px; }
.list-head .muted-note { flex: 1; margin: 0; }
.game-list { border: 1.5px solid var(--line); margin-top: 8px; min-height: 120px; max-height: 340px; overflow-y: auto; }
.game-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr) minmax(0, 1.2fr) 70px auto; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #ddd; }
.game-row:last-child { border-bottom: none; }
.game-row b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-row small { color: var(--muted); }
.game-row .players { text-align: right; font-variant-numeric: tabular-nums; }
.game-row.full, .game-row.old { opacity: 0.55; }
.game-row button { padding: 6px 14px; }
.game-list .empty { padding: 26px 12px; text-align: center; color: var(--muted); }
@media (max-width: 720px) { .game-row { grid-template-columns: minmax(0, 1fr) auto; } .game-row .hide-small { display: none; } }
/* ---- Worlds (the menu's Worlds tab) ---- */
.world-list { border: 1.5px solid var(--line); margin-top: 8px; min-height: 80px; max-height: 300px; overflow-y: auto; }
.world-list > .muted-note { padding: 22px 12px; text-align: center; margin: 0; }
.world-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #ddd; }
.world-card:last-child { border-bottom: none; }
.world-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world-info .muted-note { margin: 0; font-size: 12px; }
.world-card button { padding: 6px 14px; }
.world-online { display: flex; flex-wrap: wrap; align-items: end; gap: 6px 12px; margin-top: 8px; }
.world-online .field { margin: 0; }
.world-online .muted-note { margin: 0 0 6px; }
.new-world { display: flex; flex-wrap: wrap; align-items: end; gap: 6px 12px; margin-top: 14px; }
.new-world h3 { width: 100%; margin: 0; font-size: 16px; }
.new-world .field { margin: 0; flex: 1 1 160px; }
.new-world button { flex: 0 0 auto; }
@media (max-width: 720px) { .world-card { grid-template-columns: minmax(0, 1fr) auto; } }

/* ---- Worlds: your things (I, over the game) ---- */
.buy.inv { width: min(1040px, calc(100vw - 24px)); }
.inv-cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .inv-cols { grid-template-columns: minmax(0, 1fr); } }
.inv-craft { display: flex; flex-direction: column; min-width: 0; }
.craft-near { font-weight: normal; text-transform: none; letter-spacing: 0; }
.craft-only { display: block; margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.craft-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: min(560px, calc(100vh - 230px)); padding-right: 4px; }
.craft-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 8px; align-items: center; width: 100%; padding: 4px 8px; text-align: left; font-weight: normal; font-size: 13px; line-height: 1.25; }
.craft-row canvas { grid-row: 1 / span 3; width: 48px; height: 32px; }
.craft-name { font-weight: bold; }
.craft-name small { font-weight: normal; }
.craft-of, .craft-at { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.craft-row:disabled { opacity: 0.5; cursor: default; }
.craft-row.away { opacity: 0.3; }
.craft-row.can { box-shadow: inset 3px 0 0 #1f7a2e; }
html[data-game="remastered"] .craft-row.can { box-shadow: inset 3px 0 0 #7ee07a; }
/* (Dev mode's own: anything there is, from nothing.) */
.craft-row.dev .craft-at { color: #a052ea; font-weight: bold; }
.inv-label .small { margin-left: 8px; padding: 2px 8px; font-size: 11px; letter-spacing: 0; text-transform: none; }
.inv-label { margin: 8px 0 4px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.inv-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.inv-slot { position: relative; aspect-ratio: 1; padding: 0; display: flex; align-items: center; justify-content: center; font-weight: normal; }
.inv-slot canvas { width: 80%; height: auto; pointer-events: none; }
.inv-slot .inv-n { position: absolute; right: 3px; bottom: 5px; font-size: 11px; font-weight: bold; pointer-events: none; }
.inv-slot kbd { position: absolute; left: 2px; top: 2px; font-size: 9px; padding: 0 3px; pointer-events: none; }
.inv-slot.empty { opacity: 0.6; }
.inv-slot.in-hand { box-shadow: inset 0 0 0 2px #f2c230; }
.inv-slot.in-right { box-shadow: inset 0 0 0 2px #4a9ae8; }
.inv-slot.in-hand.in-right { box-shadow: inset 0 0 0 2px #f2c230, inset 0 0 0 4px #4a9ae8; }
.inv-hands { margin-top: 3px; }
.inv-hand { padding: 0 0 1px; font-size: 10px; line-height: 14px; min-height: 0; opacity: 0.55; }
.inv-hand.on { opacity: 1; background: #4a9ae8; color: #fff; border-color: #2a6ab8; }
.inv-hand:disabled { opacity: 0.2; }
.inv-slot.picked { outline: 2px solid var(--ink); outline-offset: -4px; background: var(--soft); }
.inv-what { flex: 1; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.inv-actions .buy-foot { margin: 0; }
html[data-game="remastered"] .inv .inv-slot.picked { outline-color: #f2c230; }
/* (Blocks keep their colours on Remastered's dark glass; only guns, drawn in ink, are turned light.) */
html[data-game="remastered"] .buy.inv canvas { filter: none; }
html[data-game="remastered"] .buy.inv canvas.ink, html[data-game="remastered"] .buy.talk canvas.ink { filter: invert(0.88) hue-rotate(180deg); }

/* ---- Worlds: the inventory's coins, item cards, kinds of things, finding a recipe ---- */
.inv-coins { font-weight: bold; color: #b8860b; white-space: nowrap; }
.inv-coins::before { content: '● '; color: #f2c230; }
html[data-game="remastered"] .inv-coins { color: #f2c230; }
.inv-tip { position: absolute; z-index: 5; width: 270px; padding: 9px 11px; pointer-events: none; background: rgba(16, 18, 24, 0.95); color: #eef2f7; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); font-size: 12.5px; line-height: 1.4; }
.inv-tip .tip-name { font-size: 15px; font-weight: bold; }
.inv-tip .tip-name small { font-weight: normal; color: #c8ccd4; }
.inv-tip .tip-kind { color: #9aa5b4; margin-bottom: 4px; }
.inv-tip .tip-line::before { content: '· '; color: #9aa5b4; }
.inv-tip .tip-worth { margin-top: 5px; color: #f2c230; }
.inv-tip .tip-made { margin-top: 3px; color: #9aa5b4; font-size: 11.5px; }
.inv-slot[data-cat]:not([data-cat=""])::after { content: ''; position: absolute; left: 3px; right: 3px; bottom: 2px; height: 3px; border-radius: 2px; background: var(--cat, transparent); pointer-events: none; }
.inv-slot[data-cat="coins"] { --cat: #e0b020; } .inv-slot[data-cat="gem"] { --cat: #a052ea; } .inv-slot[data-cat="potion"] { --cat: #e0304c; }
.inv-slot[data-cat="food"] { --cat: #e08a3a; } .inv-slot[data-cat="weapon"] { --cat: #e08a1a; } .inv-slot[data-cat="tool"] { --cat: #3a8ae0; }
.inv-slot[data-cat="ammo"] { --cat: #c8a040; } .inv-slot[data-cat="bar"] { --cat: #9aa4b2; } .inv-slot[data-cat="ore"] { --cat: #a0784c; }
.inv-slot[data-cat="contract"] { --cat: #c8b070; }
.craft-find { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 6px; }
.craft-find input[type="search"] { flex: 1 1 140px; min-width: 0; padding: 4px 8px; font-size: 13px; }
.craft-find .craft-only { margin: 0; }
/* (The crafting list's tabs: building, furniture, decor, lights, colours, kits...: craftitems.js.) */
.craft-tabs { display: flex; flex-wrap: wrap; gap: 3px; margin: 0 0 6px; }
.craft-tab { padding: 2px 7px; font-size: 11.5px; font-weight: normal; min-height: 0; line-height: 1.4; }
.craft-tab.on { font-weight: bold; box-shadow: inset 0 -2px 0 currentColor; }
.craft-tab .craft-count { margin-left: 4px; font-size: 10px; color: #1f7a2e; font-weight: bold; }
.craft-tab .craft-count:empty { display: none; }
html[data-game="remastered"] .craft-tab .craft-count { color: #7ee07a; }

/* ---- Worlds: what's worn (gear) ---- */
.inv-gear { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; max-width: 80%; }
.inv-worn .inv-wlabel { position: absolute; left: 3px; top: 1px; font-size: 9px; color: var(--muted); pointer-events: none; }
.inv-worn.empty canvas { opacity: 0; }
.inv-gear-sum { font-weight: normal; text-transform: none; letter-spacing: 0; color: #2f6fdb; margin-left: 6px; }
html[data-game="remastered"] .inv-gear-sum { color: #8fc4ff; }
.inv-slot[data-cat="gear"] { --cat: #f0f0f0; }

/* ---- Worlds: talking to townsfolk (right click on them) ---- */
.buy.talk { width: min(820px, calc(100vw - 24px)); }
.talk-head { align-items: center; }
.talk-face { width: 72px; height: 72px; flex: 0 0 auto; border: 2px solid var(--ink); border-radius: 50%; background: var(--soft); }
.talk-who { min-width: 0; }
.talk-title { font-size: 13px; color: var(--muted); }
.talk-said { margin: 4px 0 8px; font-size: 17px; font-style: italic; line-height: 1.4; }
.talk-news { margin: 0 0 10px; padding-left: 20px; font-size: 14px; line-height: 1.45; }
.talk-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.talk-opt { font-size: 14px; padding: 5px 12px; }
.talk-opt kbd { font-size: 10px; margin-right: 4px; }
.talk-opt.on { background: var(--ink); color: var(--paper, #fff); }
.talk-opt.on kbd { color: #1a1a1a; }
.talk-price { font-weight: bold; color: #b8860b; }
.talk-price::after { content: ' ●'; font-size: 9px; vertical-align: 2px; color: #f2c230; }
.talk-price.short { color: #c0392b; }
.talk-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .talk-cols { grid-template-columns: minmax(0, 1fr); } }
.talk-coins { float: right; font-weight: bold; text-transform: none; letter-spacing: 0; color: #b8860b; }
.talk-list { display: flex; flex-direction: column; gap: 3px; max-height: min(420px, calc(100vh - 360px)); overflow-y: auto; padding-right: 4px; }
.talk-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 58px; column-gap: 8px; align-items: center; width: 100%; padding: 3px 8px; text-align: left; font-weight: normal; font-size: 13px; }
.talk-row canvas { width: 40px; height: 28px; }
.talk-row:disabled { opacity: 0.45; cursor: default; }
.talk-row.rare { box-shadow: inset 3px 0 0 #a052ea; }
.talk-item { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talk-rare { color: #a052ea; font-weight: bold; }
.talk-left { font-size: 11px; color: var(--muted); text-align: right; }
html[data-game="remastered"] .talk-face { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); }
.talk-opt.turnin { border-color: #1f7a2e; box-shadow: inset 3px 0 0 #1f7a2e; }
.talk-quest.story { border-left-color: #a052ea; }
.talk-quest.personal { border-left-color: #2f6fdb; }
.tq-badge { display: inline-block; margin-right: 4px; padding: 0 6px; font-size: 11px; font-weight: bold; border-radius: 3px; background: #2f6fdb; color: #fff; vertical-align: 2px; }
.talk-quest.story .tq-badge { background: #a052ea; }
.journal-quest.story { border-left-color: #a052ea; }
.journal-quest.personal { border-left-color: #2f6fdb; }
.talk-work { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px; }
.talk-quest, .journal-quest { border: 1px solid var(--line, rgba(0, 0, 0, 0.25)); border-left: 4px solid #f2c230; padding: 8px 12px; background: var(--soft); }
.tq-title, .jq-title { font-weight: bold; font-size: 15px; }
.tq-text, .jq-text { margin: 4px 0; font-style: italic; font-size: 13px; line-height: 1.4; }
.tq-goals, .jq-goals { margin: 2px 0 6px; padding-left: 20px; font-size: 13px; }
.jq-goals li.met { color: #1f7a2e; text-decoration: line-through; }
.jq-goals li.back { color: #b8860b; font-weight: bold; list-style: '→ '; }
.tq-foot, .jq-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.jq-reward { font-size: 13px; font-weight: bold; color: #b8860b; }
html[data-game="remastered"] .talk-quest, html[data-game="remastered"] .journal-quest { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.12); border-left-color: #f2c230; }
html[data-game="remastered"] .jq-reward { color: #f2c230; }
html[data-game="remastered"] .jq-goals li.met { color: #7ee07a; }

/* ---- Worlds online: another player's menu, trading ---- */
.buy.pmenu { width: min(520px, calc(100vw - 24px)); top: 30vh; }
.buy.trade { width: min(760px, calc(100vw - 24px)); }
.trade-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.trade-table { min-height: 80px; display: flex; flex-direction: column; gap: 3px; padding: 6px; background: var(--soft); }
.trade-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.trade-item canvas, .trade-slot canvas { width: 32px; height: 22px; }
.trade-ok { color: #1f7a2e; text-transform: none; letter-spacing: 0; }
.trade-coins { display: block; margin-top: 6px; font-size: 13px; }
.trade-coins input { width: 90px; margin-left: 6px; }
.trade-bag { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; }
.trade-slot { position: relative; padding: 2px; min-height: 0; display: flex; flex-direction: column; align-items: center; font-weight: normal; }
.trade-slot small { font-size: 10px; line-height: 1; }
.trade-slot.on { outline: 2px solid #f2c230; outline-offset: -2px; }
html[data-game="remastered"] .trade-table { background: rgba(255, 255, 255, 0.05); }
html[data-game="remastered"] .trade-ok { color: #7ee07a; }

/* ---- Worlds: the journal (J): quests, level and perks ---- */
.buy.journal { width: min(820px, calc(100vw - 24px)); }
.journal-tabs { display: flex; gap: 4px; }
.journal-tab { padding: 4px 14px; font-size: 14px; }
.journal-tab.on { background: var(--ink); color: var(--paper, #fff); }
html[data-game="remastered"] .journal-tab.on { background: #f2c230; color: #1a1a1a; }
.journal-body { display: flex; flex-direction: column; gap: 8px; }
/* A new world's settings (the Worlds tab): worldrules.js. */
.world-settings { flex-basis: 100%; margin: 4px 0; }
.world-settings summary { cursor: pointer; font-weight: bold; padding: 4px 0; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 12px; padding: 6px 0 2px; }
.ws-grid select { width: 100%; }

/* The codex (questui.js): everything there is, how it's had, and what you've found. */
.codex-head { display: flex; gap: 12px; align-items: center; }
.codex-found { font-weight: bold; white-space: nowrap; }
.codex-search { flex: 1; min-width: 0; padding: 5px 8px; font: inherit; }
.codex-cats { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 8px; }
.codex-cats .on { background: var(--ink); color: var(--paper, #fff); }
html[data-game="remastered"] .codex-cats button.on, html[data-game="remastered"] .codex-cats button.on:hover { background: #f2c230; color: #1a1a1a; }
.codex-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; }
.codex-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border: 1px solid var(--line, rgba(0, 0, 0, 0.2)); border-left: 4px solid var(--c, #888); background: var(--soft); opacity: 0.72; }
.codex-row.found { opacity: 1; }
.codex-take { flex: none; align-self: center; margin-left: auto; padding: 2px 10px; font-size: 12px; }
/* A gun with attachments fitted (attachments.js). */
.inv-slot.fitted::before { content: '⌖'; position: absolute; top: 1px; right: 4px; font-size: 12px; line-height: 1; color: #2f62ee; pointer-events: none; }
html[data-game="remastered"] .inv-slot.fitted::before { color: #7fc8ff; }
/* The dev menu (worlds, in dev mode: devpanel.js). */
.buy.devpanel { width: min(980px, calc(100vw - 24px)); }
.dp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
@media (max-width: 760px) { .dp-grid { grid-template-columns: minmax(0, 1fr); } }
.dp-box { min-width: 0; }
.dp-wide { grid-column: 1 / -1; }
.dp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 0 0 6px; }
.dp-row .small { padding: 3px 9px; font-size: 12px; }
.dp-row .small.on, .dp-player .small.on { background: var(--ink); color: var(--paper, #fff); }
html[data-game="remastered"] .dp-row .small.on { background: #f2c230; color: #1a1a1a; }
.dp-sub { font-size: 12px; color: var(--muted); margin-right: 2px; }
.dp-where { font-weight: normal; text-transform: none; letter-spacing: 0; }
.dp-check { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; }
.dp-rar { border-left: 4px solid var(--c) !important; }
.dp-players { display: flex; flex-direction: column; gap: 5px; }
.dp-player { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.dp-name { font-weight: bold; min-width: 120px; }
.codex-rar { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; padding: 0 4px; border-radius: 2px; background: var(--c); color: #111; vertical-align: 1px; }
.codex-row canvas { flex: none; background: rgba(0, 0, 0, 0.55); border-radius: 3px; }
.codex-text { min-width: 0; }
.codex-name { font-weight: bold; color: var(--ink); }
html[data-game="remastered"] .codex-name { color: var(--c); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); }
.codex-where { font-size: 12px; color: var(--muted); line-height: 1.3; }
.codex-tick { color: #3fb950; }
.journal-quest.on { border-left-color: #2f6fdb; }
.journal-quest.ready { border-left-color: #1f7a2e; }
.jq-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.jq-ready { font-size: 12px; font-weight: bold; color: #1f7a2e; }
.jq-from { font-size: 12px; color: var(--muted); }
.jq-acts { display: flex; gap: 6px; align-items: center; }
.jq-following { font-size: 12px; font-weight: bold; color: #2f6fdb; }
.journal-empty { font-size: 15px; }
.journal-empty .mark { color: #b8860b; }
.journal-char { display: flex; flex-direction: column; gap: 6px; }
.jc-level { font-size: 22px; font-weight: bold; }
.jc-xp { height: 10px; border: 1px solid var(--ink); background: var(--soft); }
.jc-xpfill { height: 100%; background: #f2c230; }
.jc-points { color: #b8860b; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.journal-perks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 700px) { .journal-perks { grid-template-columns: minmax(0, 1fr); } }
.journal-perk { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--line, rgba(0, 0, 0, 0.2)); background: var(--soft); }
.journal-perk.has { border-left: 4px solid #f2c230; }
.journal-perk button { grid-row: 1 / span 2; grid-column: 2; min-width: 34px; }
.jp-name { font-weight: bold; }
.jp-rank { color: #b8860b; letter-spacing: 1px; font-size: 11px; margin-left: 4px; }
.jp-text { font-size: 12px; color: var(--muted); }
.jp-next { display: block; font-size: 11px; }
.journal-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 700px) { .journal-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.journal-stat { display: flex; justify-content: space-between; padding: 4px 10px; background: var(--soft); font-size: 13px; }
html[data-game="remastered"] .jc-xp { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.06); }
html[data-game="remastered"] .journal-perk, html[data-game="remastered"] .journal-stat { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.12); }
html[data-game="remastered"] .jp-rank, html[data-game="remastered"] .jc-points, html[data-game="remastered"] .journal-empty .mark { color: #f2c230; }
html[data-game="remastered"] .talk-opt.on { background: #f2c230; color: #1a1a1a; }
html[data-game="remastered"] .talk-price, html[data-game="remastered"] .talk-coins { color: #f2c230; }
html[data-game="remastered"] .talk-price.short { color: #ff7a6a; }

.setup-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.setup-head h2 { margin: 0; font-size: 20px; }
.seg-small { font-weight: normal; }
.seg-small label { padding: 3px 9px; font-size: 12px; white-space: nowrap; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: end; }
.field-pair .field { margin-top: 8px; }
/* ---- Settings: a full screen with sections down the side, like a game's ---- */
#settings .panel.set-panel {
  width: min(1120px, 100%); height: min(800px, 100%); max-height: none; padding: 0; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
}
.set-head { display: flex; align-items: baseline; gap: 18px; padding: 18px 28px 14px; border-bottom: 2px solid var(--line); }
.set-head h2 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.set-head .muted-note { margin: 0; }
.set-body { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 0; }
.set-tabs { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; border-right: 2px solid var(--line); overflow-y: auto; }
.set-tab { text-align: left; border: 2px solid transparent; padding: 11px 14px; font-size: 16px; background: transparent; }
.set-tab:hover { background: var(--soft); }
.set-tab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.set-pages { overflow-y: auto; min-height: 0; padding: 6px 30px 28px; }
.set-title { margin: 20px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.set-subhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.set-subhead .set-title { margin: 0; }
.set-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 360px); gap: 6px 28px; align-items: center;
  padding: 13px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.set-label b { display: block; font-size: 16px; }
.set-label small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 3px; }
.set-control select, .set-control input[type="color"] { width: 100%; }
.set-control input[type="color"] { height: 34px; padding: 0 2px; border: 1.5px solid var(--line); background: var(--paper); }
.set-range { display: flex; align-items: center; gap: 12px; }
.set-range input[type="range"] { flex: 1; }
.set-range output { min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; font-weight: bold; }
.set-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 12px 28px; border-top: 2px solid var(--line); font-size: 14px; }
.set-foot .muted-note { margin: 0; }
.set-foot button { min-width: 140px; }
/* (Rows for one of the games only: still rows.) */
html[data-game="remastered"] .set-row.rm-only { display: grid !important; }
/* Switches (checkboxes). */
input.switch {
  appearance: none; -webkit-appearance: none; margin: 0; width: 50px; height: 28px; border-radius: 99px; cursor: pointer;
  border: 2px solid var(--line); background: var(--soft); position: relative; transition: background 0.12s ease;
}
input.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); transition: transform 0.12s ease;
}
input.switch:checked { background: var(--ink); }
input.switch:checked::after { transform: translateX(22px); background: var(--paper); }
input.switch:focus-visible { outline: 2px dashed var(--ink); outline-offset: 2px; }
/* The crosshair: a picture of it on a light and a dark background, its settings beside it. */
.xhair { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 4px 28px; align-items: start; }
.xhair canvas { display: block; width: 100%; height: auto; aspect-ratio: 240 / 72; border: 1.5px solid var(--line); margin-top: 16px; }
.xhair .set-row { grid-template-columns: minmax(0, 1fr) minmax(200px, 300px); }
/* Controls: every action and its keys. */
.kb-group { margin: 18px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.kb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 18px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.kb-name { font-size: 15px; }
.kb-keys { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
button.kb-key, button.kb-add {
  min-width: 46px; padding: 5px 12px; font-size: 14px; font-weight: bold; border-width: 1.5px;
  border-bottom-width: 3px; background: var(--soft); font-variant-numeric: tabular-nums;
}
button.kb-add { min-width: 34px; padding: 5px 9px; color: var(--muted); border-style: dashed; border-bottom-width: 1.5px; background: transparent; }
/* A key and the × that removes it, side by side. */
.kb-chip { display: inline-flex; align-items: stretch; }
.kb-chip button.kb-key { border-top-right-radius: 0; border-bottom-right-radius: 0; }
button.kb-remove {
  min-width: 0; padding: 0 7px; font-size: 15px; line-height: 1; color: var(--muted); background: transparent;
  border-width: 1.5px; border-left-width: 0; border-bottom-width: 3px; border-top-left-radius: 0; border-bottom-left-radius: 0;
}
button.kb-remove:hover, button.kb-remove:focus-visible { color: #b3261e; }
button.kb-key.listening { background: var(--ink); color: var(--paper); animation: kb-pulse 1s ease-in-out infinite alternate; }
@keyframes kb-pulse { from { opacity: 1; } to { opacity: 0.65; } }
.kb-none { color: #b3261e; font-size: 13px; margin-right: 4px; }
.kb-note { min-height: 1.4em; }
/* Character: the skins, each pictured, and yours big. */
.skin-preview { display: block; width: 100%; height: auto; aspect-ratio: 960 / 300; border: 1.5px solid var(--line); margin: 10px 0 14px; }
.skin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
button.skin-card { display: flex; flex-direction: column; align-items: stretch; gap: 4px; text-align: left; padding: 8px 8px 10px; font-weight: normal; border-width: 1.5px; }
.skin-card canvas { width: 100%; height: auto; aspect-ratio: 240 / 150; display: block; border: 1px solid rgba(0, 0, 0, 0.12); }
.skin-card b { font-size: 15px; margin-top: 4px; }
.skin-card small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.skin-card[aria-checked="true"] { box-shadow: inset 0 0 0 2.5px var(--ink); background: var(--soft); }
/* Developer: the game's numbers. */
.dev-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 10px 0; }
.dev-sections { display: flex; flex-wrap: wrap; gap: 6px; }
button.dev-section { padding: 6px 12px; font-size: 14px; border-width: 1.5px; }
button.dev-section[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.dev-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 99px; background: #d98a00; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
input.dev-find { width: min(260px, 100%); }
.dev-weapon { display: flex; align-items: center; gap: 10px; font-weight: bold; margin: 6px 0; }
.dev-weapon select { width: min(340px, 100%); }
.dev-group { margin: 16px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.dev-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px 34px; gap: 4px 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.08); }
.dev-row.changed { box-shadow: inset 4px 0 0 #d98a00; padding-left: 10px; }
.dev-row.changed b { color: #b06a00; }
.dev-label b { display: block; font-size: 14px; }
.dev-label small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.dev-row input[type="number"] { width: 100%; font: inherit; padding: 5px 7px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); font-variant-numeric: tabular-nums; }
button.dev-reset { padding: 3px 0; font-size: 15px; }
/* (Players' choices: shown as chosen, not typed in here.) */
/* The defaults for players' choices: label, control, Pull, reset; the crosshair, keys and the like with a control for each part, below. */
.dev-row.dev-choice { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto 34px; }
.dev-row.dev-choice.dev-wide { grid-template-columns: minmax(0, 1fr) auto 34px; }
.dev-wide .dev-edit { grid-column: 1 / -1; grid-row: 2; }
.dev-edit select, .dev-edit input[type="text"] { padding: 5px 7px; font-size: 14px; }
.dev-edit input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.dev-edit input[type="color"] { display: block; width: 56px; height: 30px; padding: 0 2px; border: 1.5px solid var(--line); background: var(--paper); }
.dev-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; padding: 2px 0 4px; }
.dev-subs.dev-keys { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.dev-sub { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: bold; }
.dev-sub small { font-weight: normal; color: var(--muted); }
.dev-sub .dev-ctl { font-weight: normal; }
.dev-sub.changed > span { color: #b06a00; }
button.dev-pull { padding: 3px 10px; font-size: 13px; }
button.dev-pull:disabled { opacity: 0.25; cursor: default; }
.dev-choice-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.dev-value { font-size: 14px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
button.dev-reset:disabled { opacity: 0.25; cursor: default; }
.dev-io { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dev-io-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.dev-io textarea { width: 100%; min-height: 180px; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; padding: 8px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); resize: vertical; }
.dev-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.dev-foot .dev-msg { margin: 0; }
@media (max-width: 760px) {
  .set-head { padding: 14px 16px 10px; }
  .set-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .set-tabs { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 2px solid var(--line); padding: 8px; }
  .set-tab { white-space: nowrap; padding: 8px 12px; font-size: 14px; }
  .set-pages { padding: 4px 16px 20px; }
  .set-row, .xhair .set-row { grid-template-columns: 1fr; }
  .dev-io { grid-template-columns: 1fr; }
  .dev-row { grid-template-columns: minmax(0, 1fr) 100px 34px; }
  .dev-row.dev-choice { grid-template-columns: minmax(0, 1fr) auto 34px; }
  .dev-choice .dev-edit { grid-column: 1 / -1; grid-row: 2; }
  .xhair { grid-template-columns: 1fr; }
  .set-foot { padding: 10px 16px; }
}
.map-card small.by { display: block; }
.map-card .save { position: absolute; top: 5px; right: 5px; font-size: 11px; padding: 2px 7px; border-width: 1.5px; }
.over-note { align-self: center; background: var(--paper); border: 1.5px solid var(--line); padding: 8px 12px; font-weight: bold; }
.chat { position: fixed; left: 12px; bottom: 80px; width: min(420px, calc(100% - 24px)); z-index: 30; }
.chat input { border: 2px solid var(--line); box-shadow: 4px 4px 0 rgba(0,0,0,0.12); }
#connText { min-height: 1.4em; }

/* ---- Classes and progression: the Loadout screen, the class picker, the match's XP ---- */
.lo-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.lo-head h2 { margin: 0; }
.lo-top { margin: 8px 0 14px; }
.lo-top small, .lo-class small { color: var(--muted); }
.lo-class > small { display: block; line-height: 1.35; margin-top: 4px; }
.lo-classes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.lo-class { border: 1.5px solid var(--line); padding: 10px 12px 12px; }
.lo-class header { display: flex; justify-content: space-between; align-items: center; }
.lo-class h3 { margin: 0; font-size: 17px; }
.lo-pick { display: flex; gap: 5px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.lo-class:has(input[name=loClass]:checked) { box-shadow: inset 0 0 0 1.5px var(--ink); }
.lo-gadget { font-size: 12px; margin: 8px 0 4px; }
.lo-row { display: block; font-size: 13px; margin-top: 8px; }
.lo-row > span { display: flex; justify-content: space-between; font-weight: bold; }
.lo-row select { margin-top: 3px; font-size: 13px; padding: 4px 6px; }
.panel.picker { width: min(620px, 100%); }
.class-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
@media (max-width: 560px) { .class-cards { grid-template-columns: 1fr; } }
.class-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; font-weight: normal; padding: 10px 12px; }
.class-card b { font-size: 16px; }
.class-card span { font-size: 13px; }
.class-card small { color: var(--muted); font-size: 12px; }
.class-card i { font-size: 11px; color: var(--muted); }
.class-card[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); background: var(--soft); }
.picker-actions { display: flex; gap: 8px; justify-content: flex-end; }
/* Classes are switched off for now (?classes in the address turns them on). */
.no-classes .classes-only { display: none !important; }

/* ---- Defuse: the buy menu (over the game, which carries on) ---- */
.buy {
  position: fixed; left: 50%; top: 54px; transform: translateX(-50%); z-index: 30;
  width: min(1080px, calc(100vw - 24px)); max-height: calc(100vh - 140px); overflow: auto;
  background: rgba(255, 255, 255, 0.96); border: 2px solid var(--ink); padding: 12px 14px 10px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.12);
}
.buy-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 10px; }
.buy-head h2 { margin: 0; font-size: 20px; }
.buy-money { font-weight: bold; font-size: 20px; color: #1f7a2e; }
.buy-time { color: var(--muted); font-size: 13px; }
.buy-close { margin-left: auto; font-size: 13px; padding: 4px 10px; }
.buy-cols { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 860px) { .buy-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.buy-col h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.buy-col.picked h3 { color: var(--ink); }
.buy-col.picked .buy-item:not(:disabled) { border-color: var(--ink); }
.buy-item {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 6px; align-items: center;
  width: 100%; margin-bottom: 6px; padding: 5px 7px; text-align: left; font-weight: normal; font-size: 13px; line-height: 1.2;
}
.buy-item kbd { grid-row: 1 / span 3; align-self: start; }
.buy-item canvas { width: 72px; height: 30px; grid-column: 2; }
.buy-name { grid-column: 2; font-weight: bold; }
.buy-price { grid-column: 2; color: #1f7a2e; font-weight: bold; }
.buy-note { grid-column: 2; font-size: 11px; color: var(--muted); min-height: 0; }
.buy-item.poor .buy-price { color: #c22; }
.buy-item.owned { outline: 2px solid #1f7a2e; outline-offset: -2px; }
.buy-item:disabled { opacity: 0.55; cursor: default; }
.buy-item.other-side { opacity: 0.35; }
.buy-foot { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
html[data-game="remastered"] .buy {
  background: rgba(14, 18, 28, 0.88); color: #eef2f7; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 16px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  --ink: #eef2f7; --muted: #9aa5b4;
}
html[data-game="remastered"] .buy button { border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; background: rgba(255, 255, 255, 0.06); color: #eef2f7; }
html[data-game="remastered"] .buy button:not(:disabled):hover { background: rgba(255, 255, 255, 0.12); }
html[data-game="remastered"] .buy .buy-money, html[data-game="remastered"] .buy .buy-price { color: #7ee07a; }
html[data-game="remastered"] .buy .buy-item.poor .buy-price { color: #ff6a5a; }
html[data-game="remastered"] .buy .buy-item.owned { outline-color: #7ee07a; }
html[data-game="remastered"] .buy canvas { filter: invert(0.88) hue-rotate(180deg); }
html[data-game="remastered"] .buy kbd { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.25); color: #eef2f7; }
html[data-game="remastered"] .buy[data-side="T"] .buy-head h2 { color: #f2b04a; }
html[data-game="remastered"] .buy[data-side="CT"] .buy-head h2 { color: #6aa2ff; }

/* ---- The game picker (both games) ---- */
#gamePicker {
  background: radial-gradient(ellipse at 70% 0%, #2a2350 0%, #12131f 55%, #08090f 100%);
  color: #eef2f7;
  z-index: 40;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.pick { width: min(980px, 100%); text-align: center; }
.pick-title { margin: 0; font-size: clamp(34px, 7vw, 64px); font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.pick-tag { color: #a9b2c0; margin: 8px auto 26px; max-width: 560px; }
.pick-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .pick-cards { grid-template-columns: 1fr; } }
.game-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: left;
  padding: 12px 12px 16px; border-radius: 16px; font-weight: normal; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.game-card canvas { width: 100%; height: auto; aspect-ratio: 440 / 250; display: block; border-radius: 10px; }
.game-card .gc-name { font-size: 24px; font-weight: 800; letter-spacing: 0.04em; margin-top: 6px; }
.game-card .gc-name em { font-style: normal; font-size: 12px; vertical-align: middle; padding: 2px 8px; margin-left: 6px; border-radius: 99px; background: linear-gradient(90deg, #3d7ff0, #8a5cff); color: #fff; letter-spacing: 0.06em; }
.game-card .gc-text { font-size: 14px; line-height: 1.45; }
.game-card:hover, .game-card:focus-visible { transform: translateY(-4px); }
.og-card { background: #fff; color: #111; border: 2px solid #111; box-shadow: 8px 8px 0 rgba(255,255,255,0.12); }
.og-card canvas { border: 2px solid #111; border-radius: 0; }
.og-card .gc-text { color: #555; }
.rm-card { background: rgba(20,24,38,0.85); color: #eef2f7; border: 1px solid rgba(255,255,255,0.14); box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 0 1px rgba(122,92,255,0.25); }
.rm-card .gc-text { color: #a9b2c0; }
.rm-card:hover, .rm-card:focus-visible { box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 30px rgba(122,92,255,0.45); }
.game-card.current { outline: 3px solid #4a8bff; outline-offset: 3px; }
.switch-game { margin-left: 8px; vertical-align: middle; }
h1 .sub { display: none; }

/* Settings only for one of the games. */
.rm-only { display: none !important; }
html[data-game="remastered"] .rm-only { display: block !important; }
html[data-game="remastered"] .og-only { display: none !important; }

/* ---- Stick Soldiers Remastered: dark glass over the scenery ---- */
html[data-game="remastered"] {
  --ink: #eef2f7;
  --paper: rgba(14, 18, 28, 0.84);
  --muted: #9aa5b4;
  --line: rgba(255, 255, 255, 0.14);
  --soft: rgba(255, 255, 255, 0.07);
  --accent: #4a8bff;
  background: #0b0f17;
}
html[data-game="remastered"] body {
  background: #0b0f17;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* (The map maker keeps the original's look.) */
html[data-game="remastered"] #editor {
  --ink: #111; --paper: #fff; --muted: #666; --line: #222; --soft: #f3f3f3; --accent: #111;
  color: var(--ink); font-family: Arial, Helvetica, sans-serif;
}
html[data-game="remastered"] .screen { background: rgba(5, 8, 14, 0.3); }
html[data-game="remastered"] .screen.overlay-low { background: transparent; }
html[data-game="remastered"] #gamePicker { background: radial-gradient(ellipse at 70% 0%, #2a2350 0%, #12131f 55%, #08090f 100%); }
html[data-game="remastered"] .screen .panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}
html[data-game="remastered"] header h1 { letter-spacing: 0.08em; }
html[data-game="remastered"] h1 .sub {
  display: block; font-size: 0.42em; letter-spacing: 0.42em; margin-top: 6px;
  background: linear-gradient(90deg, #6aa2ff, #a07bff, #ff8a6a); -webkit-background-clip: text; background-clip: text; color: transparent;
}
html[data-game="remastered"] .screen button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  transition: background 0.12s ease, border-color 0.12s ease;
}
html[data-game="remastered"] .screen button:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.28); }
html[data-game="remastered"] .screen button.primary {
  background: linear-gradient(90deg, #3d7ff0, #7a5cff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 24px rgba(77, 110, 255, 0.35);
}
html[data-game="remastered"] .screen button.primary:hover { filter: brightness(1.12); background: linear-gradient(90deg, #3d7ff0, #7a5cff); }
html[data-game="remastered"] .screen :is(input[type="text"], input[type="search"], input:not([type]), select) {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}
html[data-game="remastered"] .screen select option { background: #141a26; color: #eef2f7; }
html[data-game="remastered"] .screen input[type="range"] { accent-color: #6a8cff; }
html[data-game="remastered"] .screen .tabs { border-bottom: 1px solid var(--line); gap: 6px; }
html[data-game="remastered"] .screen .tab {
  border: 1px solid var(--line); border-bottom: none; border-radius: 10px 10px 0 0; margin-right: 0;
  background: rgba(255, 255, 255, 0.04);
}
html[data-game="remastered"] .screen .tab[aria-pressed="true"] { background: linear-gradient(180deg, rgba(74, 139, 255, 0.35), rgba(74, 139, 255, 0.12)); color: #fff; }
html[data-game="remastered"] .screen .seg { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
html[data-game="remastered"] .screen .seg label + label { border-left: 1px solid var(--line); }
html[data-game="remastered"] .screen .seg label:has(input:checked) { background: rgba(74, 139, 255, 0.45); color: #fff; }
html[data-game="remastered"] .screen .map-card { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
html[data-game="remastered"] .screen .map-card canvas { border-radius: 8px; filter: invert(0.9) hue-rotate(180deg); }
html[data-game="remastered"] .screen .map-card[aria-checked="true"] { border-color: #6a8cff; box-shadow: 0 0 0 1px #6a8cff, 0 0 22px rgba(106, 140, 255, 0.35); }
html[data-game="remastered"] .screen .map-card .made-for { background: linear-gradient(90deg, #3d7ff0, #7a5cff); color: #fff; border-radius: 99px; }
html[data-game="remastered"] .screen kbd { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.25); color: var(--ink); border-radius: 4px; }
html[data-game="remastered"] footer { border-top-color: var(--line); }
html[data-game="remastered"] #loading { background: rgba(5, 8, 14, 0.75); color: #eef2f7; }
html[data-game="remastered"] .toast { background: linear-gradient(90deg, #3d7ff0, #7a5cff); color: #fff; border-radius: 10px; }
html[data-game="remastered"] .note { color: #ff7a6a; }
html[data-game="remastered"] .set-head, html[data-game="remastered"] .set-foot { border-color: var(--line); }
html[data-game="remastered"] .set-head h2 { background: linear-gradient(90deg, #6aa2ff, #a07bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-game="remastered"] .set-tabs { border-right: 1px solid var(--line); }
html[data-game="remastered"] .screen .set-tab { border: 1px solid transparent; border-radius: 10px; background: transparent; }
html[data-game="remastered"] .screen .set-tab:hover { background: rgba(255, 255, 255, 0.08); }
html[data-game="remastered"] .screen .set-tab[aria-selected="true"] { background: linear-gradient(90deg, rgba(74, 139, 255, 0.45), rgba(122, 92, 255, 0.25)); color: #fff; border-color: rgba(122, 140, 255, 0.4); }
html[data-game="remastered"] .set-row { border-bottom-color: rgba(255, 255, 255, 0.08); }
html[data-game="remastered"] .set-control input[type="color"] { border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.06); }
html[data-game="remastered"] input.switch { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.1); }
html[data-game="remastered"] input.switch::after { background: #c9d2e0; }
html[data-game="remastered"] input.switch:checked { background: linear-gradient(90deg, #3d7ff0, #7a5cff); border-color: transparent; }
html[data-game="remastered"] input.switch:checked::after { background: #fff; }
html[data-game="remastered"] .xhair canvas { border: 1px solid var(--line); border-radius: 10px; }
html[data-game="remastered"] .kb-row { border-bottom-color: rgba(255, 255, 255, 0.07); }
html[data-game="remastered"] .screen button.kb-key { border-radius: 8px; border-bottom-width: 3px; border-bottom-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.08); }
html[data-game="remastered"] .screen button.kb-add { border-radius: 8px; border-style: dashed; background: transparent; }
html[data-game="remastered"] .screen .kb-chip button.kb-key { border-top-right-radius: 0; border-bottom-right-radius: 0; }
html[data-game="remastered"] .screen button.kb-remove { border-radius: 0 8px 8px 0; border-bottom-width: 3px; border-bottom-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.04); }
html[data-game="remastered"] .screen button.kb-remove:hover { color: #ff7a6a; }
html[data-game="remastered"] .screen button.kb-key.listening { background: linear-gradient(90deg, #3d7ff0, #7a5cff); color: #fff; }
html[data-game="remastered"] .kb-none { color: #ff7a6a; }
html[data-game="remastered"] .skin-preview { border: 1px solid var(--line); border-radius: 12px; }
html[data-game="remastered"] .screen button.skin-card { border-radius: 12px; }
html[data-game="remastered"] .skin-card canvas { border: none; border-radius: 8px; }
html[data-game="remastered"] .screen button.skin-card[aria-checked="true"] { border-color: #6a8cff; box-shadow: 0 0 0 1px #6a8cff, 0 0 22px rgba(106, 140, 255, 0.35); background: rgba(74, 139, 255, 0.14); }
html[data-game="remastered"] .screen button.dev-section[aria-selected="true"] { background: linear-gradient(90deg, #3d7ff0, #7a5cff); color: #fff; border-color: transparent; }
html[data-game="remastered"] .dev-row { border-bottom-color: rgba(255, 255, 255, 0.07); }
html[data-game="remastered"] .dev-row.changed b, html[data-game="remastered"] .dev-sub.changed > span { color: #ffb648; }
html[data-game="remastered"] .dev-row input[type="number"], html[data-game="remastered"] .dev-io textarea, html[data-game="remastered"] input.dev-find { border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.06); color: var(--ink); }
@media (max-width: 760px) { html[data-game="remastered"] .set-tabs { border-right: none; border-bottom: 1px solid var(--line); } }

/* Hosting, choosing the next match from the results screen: only the setup, no tabs to wander off to. */
body.choosing-next .tabs { display: none; }
/* The menu's list of players in your game, each with a button to send them away. */
.kick-list { margin: 6px 0; text-align: left; }
.kick-list .muted-note { margin: 2px 0 4px; }
.kick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0; }
.kick-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Touch controls (touch.js): two halves for the thumbs, buttons down the right edge. */
.touch { position: fixed; inset: 0; z-index: 30; pointer-events: none; user-select: none; -webkit-user-select: none; touch-action: none; }
.touch.hidden { display: none; }
.touch-half { position: absolute; top: 18%; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
.touch-move { left: 0; }
.touch-aim { right: 0; }
.touch-ring, .touch-knob { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); display: none; pointer-events: none; }
.touch-half.on .touch-ring, .touch-half.on .touch-knob { display: block; }
.touch-ring { width: 124px; height: 124px; border: 2px solid rgba(120, 120, 120, 0.55); background: rgba(255, 255, 255, 0.12); }
.touch-knob { width: 52px; height: 52px; background: rgba(90, 90, 90, 0.55); }
.touch-btns { position: absolute; right: 10px; top: 20%; display: flex; flex-direction: column; gap: 10px; pointer-events: auto; }
.touch-btn { pointer-events: auto; min-width: 74px; padding: 14px 8px; font: bold 13px Arial, sans-serif; color: #222; background: rgba(255, 255, 255, 0.7); border: 2px solid rgba(60, 60, 60, 0.6); border-radius: 10px; touch-action: none; }
.touch-btn.on { background: rgba(60, 60, 60, 0.75); color: #fff; }
.touch-menu { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); min-width: 48px; padding: 8px 10px; font-size: 18px; }
