:root {
  --void: #07080a;
  --panel: rgba(12, 12, 10, 0.86);
  --panel-solid: #0f0f0c;
  --brass: #c9a24e;
  --brass-hi: #efd28a;
  --brass-dim: #6e5830;
  --bone: #ece4d2;
  --dim: #a39884;
  --blood: #9a2a26;
  --blood-hi: #d84a3a;
  --heal: #7ad89a;
  --line: rgba(201, 162, 78, 0.45);
  --gothic: "Cinzel", Palatino, "Palatino Linotype", Georgia, serif;
  --prose: "IM Fell English", Palatino, Georgia, serif;
  --pixel: "Silkscreen", ui-monospace, "Cascadia Code", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--bone);
  font-family: var(--prose);
}

body.ingame { cursor: none; }
body.ingame .overlay.modal, body.ingame .overlay.modal * { cursor: default; }
body.ingame .overlay.modal button { cursor: pointer; }

button, input { font: inherit; color: inherit; }

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  /* Even the very first thumb on the game must not start a page pan, which cancels the touch. */
  touch-action: none;
}

kbd {
  font-family: var(--pixel);
  font-size: 10px;
  padding: 0 4px;
  border: 1px solid var(--brass-dim);
  color: var(--brass-hi);
  margin-left: 6px;
}

/* ---------- common chrome ---------- */

.panel, .sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), 0 12px 40px rgba(0, 0, 0, 0.5);
  position: relative;
}

.panel::before, .sheet::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(201, 162, 78, 0.14);
  pointer-events: none;
}

.kicker {
  margin: 0 0 4px;
  color: var(--brass);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 10px;
  font-family: var(--pixel);
}

.fine { color: var(--dim); font-size: 13px; line-height: 1.4; margin: 6px 0 0; }
.prose { font-size: 16px; line-height: 1.5; color: #ddd3bd; }

h1, h2, h3 { font-family: var(--gothic); font-weight: 700; margin: 0; letter-spacing: 0.06em; }

button {
  background: linear-gradient(#1c1c16, #121210);
  border: 1px solid var(--brass-dim);
  padding: 10px 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: var(--gothic);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  color: var(--bone);
}
button:hover { border-color: var(--brass); color: var(--brass-hi); }
button:disabled { opacity: 0.4; cursor: default; }
button.primary {
  background: linear-gradient(#5a1a16, #3a0e0c);
  border-color: #c9a24e;
  color: #fff0d0;
}
button.primary:hover { background: linear-gradient(#7a2420, #4a1210); }

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: #0c0c0a;
  border: 1px solid var(--brass-dim);
  outline: none;
  font-family: var(--pixel);
  font-size: 13px;
}
input:focus { border-color: var(--brass); }

label {
  display: block;
  margin: 14px 0 8px;
  color: var(--dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 10px;
  font-family: var(--pixel);
}

.track {
  position: relative;
  height: 6px;
  background: #1a120e;
  border: 1px solid #3a2e1c;
}
.track > span {
  display: block;
  height: 100%;
  width: 0;
  background: #8b9364;
  transition: width 120ms linear;
}
.track.xp > span { background: linear-gradient(90deg, #7a6a30, #c9a24e); }

/* ---------- title ---------- */

#title {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: safe center;
  overflow-y: auto;
  padding: 16px 16px 16px max(16px, 7vw);
  background: linear-gradient(90deg, rgba(5, 5, 4, 0.92) 0%, rgba(5, 5, 4, 0.7) 38%, rgba(5, 5, 4, 0) 70%);
}
body.ingame #title { display: none; }

.title-card { width: min(440px, 100%); }
#recent { margin-top: 12px; }
#recent .kicker { margin-bottom: 4px; }
#recent-list { display: grid; gap: 4px; }
.recent-row { display: grid; grid-template-columns: 1fr auto; gap: 4px; }
.recent-row button { text-align: left; text-transform: none; letter-spacing: 0.02em; font-size: 13px; padding: 6px 10px; }
.recent-row button b { font-family: var(--pixel); letter-spacing: 0.2em; color: var(--brass-hi); margin-right: 8px; }
.recent-row button small { display: block; font-family: var(--pixel); font-size: 9px; color: var(--dim); margin-top: 2px; }
.recent-row .forget { padding: 6px 9px; font-size: 12px; }
#continue-derelict { margin-bottom: 6px; }

#title h1 {
  font-size: clamp(54px, 9vw, 104px);
  line-height: 0.88;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #efe2c0;
  text-shadow: 0 2px 0 #3a1a10, 0 0 40px rgba(200, 80, 40, 0.35);
  margin: 8px 0 14px;
}

.lede { font-size: 17px; line-height: 1.5; color: #d8ccb2; margin: 0 0 16px; }

.career {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(201, 162, 78, 0.3);
  background: rgba(10, 10, 8, 0.7);
}
.career img { width: 60px; height: 78px; image-rendering: pixelated; }
.career > div { flex: 1; }
#career-title { font-family: var(--gothic); font-size: 20px; margin: 0 0 6px; }

.row { margin: 8px 0; }
.row button { width: 100%; }
.join { display: flex; gap: 8px; }
.join input { width: 120px; margin: 0; text-align: center; letter-spacing: 0.35em; text-transform: uppercase; }
.join button { flex: 1; }
/* In the flow under the card: a long list of companies pushes it down instead of under it. */
.credits { margin-top: 10px; }

#link-lost {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  margin: 0;
  padding: 6px 12px;
  background: var(--blood);
  font-family: var(--pixel);
  font-size: 11px;
}

/* ---------- HUD ---------- */

#hud { display: none; }
body.ingame #hud { display: block; }
#hud > * { position: fixed; z-index: 2; }

#objective {
  top: 14px;
  left: 14px;
  width: min(300px, 42vw);
  padding: 10px 12px 12px;
  pointer-events: none;
}
#obj-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--pixel);
  font-size: 10px;
  font-weight: 400;
  color: var(--brass-hi);
  pointer-events: auto;
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 1;
}
#obj-toggle:hover { color: var(--bone); border: 0; }
#obj-compact { display: none; }
#objective.collapsed {
  width: min(280px, 40vw);
  padding: 0;
  pointer-events: auto;
}
#objective.collapsed #obj-body { display: none; }
#objective.collapsed #obj-toggle {
  position: static;
  width: 100%;
  padding: 6px 8px;
}
#objective.collapsed #obj-compact {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bone);
  font-size: 11px;
}
#objective:not(.collapsed) {
  pointer-events: auto;
  max-height: min(70vh, 520px);
  overflow: auto;
}
#obj-title { font-size: 18px; margin-bottom: 6px; }
#obj-steps { margin: 0 0 8px; padding: 0; list-style: none; font-size: 14px; }
#obj-steps li { padding: 2px 0 2px 18px; position: relative; color: var(--dim); }
#obj-steps li::before { content: "◇"; position: absolute; left: 0; color: var(--brass-dim); }
#obj-steps li.now { color: var(--bone); }
#obj-steps li.now::before { content: "◆"; color: var(--brass-hi); }
#obj-steps li.done { color: #6a7a5a; text-decoration: line-through; }
#obj-steps li.done::before { content: "✓"; color: #7ad89a; }
#obj-fill { background: linear-gradient(90deg, #8a6a2a, #efd28a) !important; }
#obj-extra { font-family: var(--pixel); font-size: 11px; color: var(--brass-hi); }
.tickets { margin-top: 8px; font-family: var(--pixel); font-size: 10px; color: var(--dim); display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.tickets i { display: inline-block; width: 7px; height: 11px; background: #c9a24e; box-shadow: inset -1px -1px 0 #6e5830; }
.tickets i.spent { background: #2a2418; box-shadow: none; }

#bossbar {
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 46vw);
  text-align: center;
  pointer-events: none;
}
#boss-name {
  margin: 0 0 4px;
  font-family: var(--gothic);
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 16px;
  color: #f0c8b0;
  text-shadow: 0 0 12px rgba(200, 40, 30, 0.7), 0 2px 0 #000;
}
.boss-track {
  position: relative;
  height: 14px;
  background: #140806;
  border: 1px solid #8a3a2a;
  box-shadow: 0 0 0 2px #0a0404, 0 0 20px rgba(160, 30, 20, 0.4);
}
.boss-track span { display: block; height: 100%; width: 100%; background: linear-gradient(#d84a3a, #7a1a14); transition: width 150ms; }
.boss-track .pip { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #efd28a; }
.boss-track .p1 { left: 33%; }
.boss-track .p2 { left: 66%; }
.boss-track .p3 { display: none; }
#bossbar.epic .p1 { left: 25%; }
#bossbar.epic .p2 { left: 50%; }
#bossbar.epic .p3 { display: block; left: 75%; }
#bossbar.epic .boss-track { box-shadow: 0 0 0 2px #0a0404, 0 0 28px rgba(190, 60, 255, 0.55); }
#bossbar.shield .boss-track span { background: linear-gradient(#efd28a, #8a6a2a); }

#hud-menu {
  top: 8px;
  right: 14px;
  z-index: 6;
  padding: 4px 10px;
  font-size: 11px;
  pointer-events: auto;
  cursor: pointer;
}
body.touch #hud-menu { display: none; }
body:not(.touch).ingame #feed { top: 44px; }

#feed {
  top: 14px;
  right: 14px;
  width: min(210px, 26vw);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  pointer-events: none;
}
#squad {
  margin: 0;
  padding: 6px 8px;
  list-style: none;
  width: auto;
  pointer-events: none;
}
#squad li { display: grid; grid-template-columns: 10px 1fr auto; gap: 4px 8px; align-items: center; padding: 3px 0; font-family: var(--pixel); font-size: 10px; }
#squad li .sw { width: 10px; height: 10px; }
#squad li .nm { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#squad li .lv { color: var(--dim); }
#squad li .hb { grid-column: 2 / 4; height: 3px; background: #2a1410; }
#squad li .hb span { display: block; height: 100%; background: #c9a24e; }
#squad li.downed .nm { color: #ff7060; }
#squad li.dead { opacity: 0.4; }
#squad li.me .nm { color: var(--brass-hi); }

#vox {
  width: auto;
  pointer-events: none;
  text-align: right;
}
#vox p {
  margin: 0 0 2px;
  font-size: 11px;
  text-shadow: 0 1px 0 #000, 0 0 6px #000;
  animation: fade 12s forwards;
}
#vox p.alert { color: #ff9a80; }
#vox p.orders { color: var(--brass-hi); }
#vox p.rank { color: #b8e0a0; }
#vox p.chat { color: #a8c8e8; }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

#vitals {
  left: 14px;
  bottom: 14px;
  width: 160px;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  pointer-events: none;
}
#vitals::before { display: none; }
.vital-row { display: grid; grid-template-columns: 1fr; align-items: center; gap: 0; margin: 3px 0; }
.vital-row .label,
#hp-text { display: none; }
.vital-row .track.big { height: 10px; }
#hp-fill { background: linear-gradient(#d4c08a, #8a7440) !important; }
#hp-fill.low { background: linear-gradient(#e05a4a, #8a1c16) !important; }
#hp-text { position: absolute; inset: 0; font-family: var(--pixel); font-size: 10px; font-weight: normal; text-align: center; line-height: 14px; text-shadow: 0 1px 0 #000; }
#heat-fill { background: linear-gradient(90deg, #d0a040, #ff5a20) !important; }
#heat-fill.over { background: repeating-linear-gradient(45deg, #9a2a26 0 6px, #3a0e0c 6px 12px) !important; }
.vital-row.small { grid-template-columns: auto 1fr; font-family: var(--pixel); font-size: 10px; color: var(--dim); }

#actions {
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: none;
}
.act {
  position: relative;
  width: 58px;
  height: 64px;
  background: var(--panel);
  border: 1px solid var(--brass-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 5px;
  overflow: hidden;
}
.act img { width: 32px; height: 32px; image-rendering: pixelated; }
.act b { position: absolute; top: 2px; left: 4px; font-family: var(--pixel); font-size: 9px; color: var(--brass-hi); }
.act small { font-family: var(--pixel); font-size: 8px; color: var(--dim); text-align: center; line-height: 1.1; margin-top: 3px; padding: 0 2px; }
.act .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.72); }
.act .cdt { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--pixel); font-size: 14px; color: #fff; text-shadow: 0 1px 0 #000; }
.act.ready { border-color: var(--brass); }
.act.locked { opacity: 0.45; filter: grayscale(1); }
.act.locked .cdt { font-size: 14px; }
.act.sep { margin-left: 10px; }
.act .count { position: absolute; right: 4px; top: 2px; font-family: var(--pixel); font-size: 10px; color: #fff; }

#prompt {
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--brass-dim);
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--brass-hi);
  pointer-events: none;
}

/* The heat line sits where the use prompt sits; when both show, it tucks in right under it. */
#vent-msg {
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  margin: 0;
  padding: 4px 10px;
  background: rgba(40, 8, 4, 0.75);
  border: 1px solid #a0402a;
  font-family: var(--pixel);
  font-size: 11px;
  color: #ffb080;
  pointer-events: none;
}
#vent-msg.under { bottom: 84px; }
body.touch #vent-msg { bottom: calc(var(--eb) + var(--b) + 12px); left: 44%; }
body.touch #vent-msg.under { bottom: calc(var(--eb) + var(--b) + 40px); }

#hubbar {
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  text-align: center;
  width: min(420px, 40vw);
}
#hubbar .hub-buttons { display: flex; gap: 8px; }
#hubbar button { flex: 1; font-size: 12px; padding: 8px; }
#room-code { color: var(--bone); letter-spacing: 0.3em; font-size: 13px; }

#chat-form { right: 14px; bottom: 168px; width: min(180px, 22vw); pointer-events: auto; opacity: 0.5; }
#chat-form:focus-within { opacity: 1; }
#chat { margin: 0; font-size: 10px; padding: 3px 6px; }

#ping { right: 14px; bottom: 148px; margin: 0; font-family: var(--pixel); font-size: 8px; color: var(--dim); }

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  pointer-events: none;
}
.overlay[hidden] { display: none; }
.overlay.modal { pointer-events: auto; background: rgba(4, 4, 3, 0.62); z-index: 6; }
.overlay.slim { align-items: end; padding-bottom: 200px; }
.overlay.slim .sheet { width: min(420px, 100%); padding: 12px 18px; text-align: center; background: rgba(20, 6, 4, 0.78); }
.overlay.slim h2 { font-size: 22px; margin-bottom: 4px; }
.overlay.slim p { margin: 0; font-size: 14px; }
.sheet { width: min(560px, 100%); padding: 22px 26px; max-height: calc(100vh - 32px); overflow: auto; }
.sheet.wide { width: min(980px, 100%); }
.sheet h2 { font-size: 30px; margin-bottom: 10px; }
.sheet h3 { font-size: 18px; margin: 18px 0 8px; }
.close { position: absolute; top: 10px; right: 10px; padding: 4px 10px; }
.countdown { font-family: var(--pixel); color: var(--brass-hi); font-size: 12px; margin: 14px 0 0; }
.countdown b { font-size: 18px; }

#brief-steps, #op-steps { padding-left: 20px; margin: 10px 0; color: var(--brass-hi); font-family: var(--gothic); font-size: 14px; }
#brief .sheet { border-color: rgba(201, 162, 78, 0.7); }
#death h2 { color: #ff8a70; }

#debrief-table { width: 100%; border-collapse: collapse; font-family: var(--pixel); font-size: 11px; margin-top: 10px; }
#debrief-table th, #debrief-table td { padding: 6px 8px; text-align: right; border-bottom: 1px solid rgba(201, 162, 78, 0.15); }
#debrief-table th:first-child, #debrief-table td:first-child { text-align: left; }
#debrief-table th { color: var(--brass); font-weight: normal; }
#debrief.won h2 { color: #d8e8b0; }
#debrief.lost h2 { color: #ff8a70; }

/* strategium */
.act-block { margin-bottom: 14px; }
.act-block h4 { margin: 0 0 6px; font-family: var(--gothic); font-size: 14px; color: var(--brass); letter-spacing: 0.1em; }
.act-block .place { font-family: var(--prose); font-style: italic; color: var(--dim); font-size: 13px; margin: -4px 0 8px; }
.ops { display: flex; flex-wrap: wrap; gap: 6px; }
.op {
  flex: 1 1 140px;
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: none;
}
.op small { display: block; font-family: var(--pixel); font-size: 9px; color: var(--dim); margin-top: 3px; letter-spacing: 0.1em; }
.op.cleared small { color: #7ad89a; }
.op.locked { opacity: 0.35; }
.op.sel { border-color: var(--brass-hi); background: linear-gradient(#2a2416, #16140c); box-shadow: 0 0 12px rgba(201, 162, 78, 0.3); }
#op-title { font-size: 22px; }
.diff { display: flex; gap: 4px; margin: 12px 0; flex-wrap: wrap; }
.diff button { flex: 1; padding: 6px; font-size: 11px; }
.diff button.sel { border-color: var(--brass-hi); color: var(--brass-hi); }
#launch { width: 100%; padding: 14px; font-size: 15px; }

/* armoury */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.card {
  text-align: left;
  padding: 10px;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--prose);
  font-weight: normal;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card img { width: 60px; height: 78px; image-rendering: pixelated; align-self: center; }
.card strong { font-family: var(--gothic); font-size: 15px; }
.card .meta { font-family: var(--pixel); font-size: 9px; color: var(--dim); }
.card .abs { font-family: var(--pixel); font-size: 9px; color: var(--brass); line-height: 1.5; }
.card p { margin: 0; font-size: 13px; color: #cfc4ac; }
.card.sel { border-color: var(--brass-hi); box-shadow: 0 0 14px rgba(201, 162, 78, 0.35); }
.card.locked { opacity: 0.35; }
.doctrines { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.doctrines button { text-align: left; text-transform: none; letter-spacing: 0.02em; font-size: 13px; }
.doctrines button small { display: block; font-family: var(--pixel); font-size: 9px; color: var(--dim); margin-top: 2px; }
.doctrines button.sel { border-color: var(--brass-hi); color: var(--brass-hi); }
.doctrines button.locked { opacity: 0.35; }

.menu-buttons { display: grid; gap: 8px; }
.manual { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; }
@media (max-width: 760px) { .manual { grid-template-columns: 1fr; } }
.manual dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 15px; }
.manual dt { font-family: var(--pixel); font-size: 11px; color: var(--brass-hi); }
.manual dd { margin: 0; }

@media (max-width: 900px) {
  #feed { width: min(170px, 32vw); }
  #vitals { width: 140px; }
  .act { width: 48px; height: 56px; }
  .act img { width: 24px; height: 24px; }
  #hubbar { top: auto; bottom: 90px; }
}

/* ---------- touch controls (body.touch) ---------- */

#stick-base, #stick-knob, #touch-extra { display: none; }

body.touch, body.touch #view { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }

body.touch.ingame #stick-base {
  display: block;
  position: fixed;
  z-index: 4;
  width: 124px;
  height: 124px;
  margin: -62px 0 0 -62px;
  border-radius: 50%;
  border: 2px solid rgba(201, 162, 78, 0.55);
  background: radial-gradient(rgba(20, 16, 10, 0.25), rgba(20, 16, 10, 0.55));
  pointer-events: none;
}
body.touch.ingame #stick-base[hidden] { display: none; }
#stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #efd28a, #8a6a2a 70%);
  box-shadow: 0 0 0 2px #1a140a, 0 4px 14px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
}
body.touch.ingame #stick-knob { display: block; }

/* Buttons hug the edges: abilities up the right edge, the rest along the bottom.
   The free middle of the right half belongs to the aim stick. */
body.touch {
  --b: 52px;
  --g: 8px;
  --er: calc(10px + env(safe-area-inset-right));
  --eb: calc(10px + env(safe-area-inset-bottom));
}
@media (max-height: 340px) {
  body.touch { --b: 44px; --g: 6px; }
}
body.touch #actions { left: auto; right: 0; bottom: 0; transform: none; pointer-events: none; display: block; }
body.touch .act {
  position: fixed;
  width: var(--b);
  height: var(--b);
  border-radius: 50%;
  touch-action: none;
  pointer-events: auto;
  margin: 0;
}
body.touch .act.sep { margin-left: 0; }
body.touch .act img { width: calc(var(--b) * 0.5); height: calc(var(--b) * 0.5); margin-top: calc(var(--b) * 0.1); }
body.touch .act small { display: none; }
body.touch .act b { left: 50%; transform: translateX(-50%); top: 2px; font-size: 10px; }
body.touch .act .count { top: auto; bottom: 3px; right: 50%; transform: translateX(50%); font-size: 10px; }
body.touch .act[data-touch="roll"] { right: var(--er); bottom: var(--eb); }
body.touch .act[data-touch="1"] { right: var(--er); bottom: calc(var(--eb) + 1 * (var(--b) + var(--g))); }
body.touch .act[data-touch="2"] { right: var(--er); bottom: calc(var(--eb) + 2 * (var(--b) + var(--g))); }
body.touch .act[data-touch="3"] { right: var(--er); bottom: calc(var(--eb) + 3 * (var(--b) + var(--g))); }
body.touch .act[data-touch="grenade"] { right: calc(var(--er) + 1 * (var(--b) + var(--g))); bottom: var(--eb); }
body.touch .act.pressed, body.touch #touch-extra button.pressed { background: rgba(201, 162, 78, 0.35); }

body.touch.ingame #touch-extra { display: block; }
#touch-extra button {
  position: fixed;
  z-index: 2;
  width: var(--b);
  height: var(--b);
  border-radius: 50%;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  display: grid;
  place-items: center;
  background: var(--panel);
  touch-action: none;
}
#touch-extra small { display: block; font-family: var(--pixel); font-size: 9px; letter-spacing: 0; margin-top: -8px; }
#touch-extra [data-touch="interact"] { right: calc(var(--er) + 2 * (var(--b) + var(--g))); bottom: var(--eb); }
/* Squad orders: two small buttons at the end of the bottom row, out of the aim stick's way. (Venting is on the keyboard and pad only.) */
#touch-extra [data-touch="advance"],
#touch-extra [data-touch="recall"],
#touch-extra [data-touch="hold"] {
  --s: calc(var(--b) * 0.66);
  width: var(--s);
  height: var(--s);
  font-size: 13px;
  bottom: var(--eb);
  border-color: rgba(122, 208, 255, 0.6);
  color: #bfe6ff;
}
#touch-extra [data-touch="advance"] small,
#touch-extra [data-touch="recall"] small,
#touch-extra [data-touch="hold"] small { font-size: 8px; margin-top: -6px; }
#touch-extra [data-touch="advance"] { right: calc(var(--er) + 3 * (var(--b) + var(--g))); }
#touch-extra [data-touch="recall"] { right: calc(var(--er) + 3 * (var(--b) + var(--g)) + var(--b) * 0.66 + var(--g)); }
/* Hold sits above the two, between them. */
#touch-extra [data-touch="hold"] { right: calc(var(--er) + 3 * (var(--b) + var(--g)) + var(--b) * 0.33 + var(--g) * 0.5); bottom: calc(var(--eb) + var(--b) * 0.66 + var(--g)); }
/* Map and menu are rare taps: small, top right, left of the minimap. */
#touch-extra [data-touch="map"],
#touch-extra [data-touch="menu"] { width: 36px; height: 36px; font-size: 14px; top: calc(8px + env(safe-area-inset-top)); }
#touch-extra [data-touch="menu"] { right: calc(var(--er) + 128px); }
#touch-extra [data-touch="map"] { right: calc(var(--er) + 170px); }
#touch-extra [data-touch="map"] small, #touch-extra [data-touch="menu"] small { display: none; }

body.touch.ingame #aim-base {
  display: block;
  position: fixed;
  z-index: 4;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  border-radius: 50%;
  border: 2px solid rgba(255, 110, 80, 0.55);
  background: radial-gradient(rgba(40, 10, 6, 0.2), rgba(40, 10, 6, 0.5));
  pointer-events: none;
}
body.touch.ingame #aim-base[hidden] { display: none; }
#aim-base, #aim-knob { display: none; }
body.touch.ingame #aim-knob {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffb090, #a03020 70%);
  box-shadow: 0 0 0 2px #1a0a06, 0 4px 14px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
}

/* Keep the rest of the HUD compact and out of the thumbs' way. */
body.touch #vitals { bottom: auto; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(140px, 22vw); padding: 0; }
body.touch .vital-row { grid-template-columns: 1fr; margin: 2px 0; }
body.touch .vital-row .track.big { height: 8px; }
body.touch #vitals .vital-row.small { display: none; }
body.touch #objective, body.pad #objective { width: min(220px, 34vw); padding: 6px 8px; top: 8px; left: 8px; }
body.touch #objective.collapsed, body.pad #objective.collapsed { width: min(168px, 28vw); padding: 0; max-height: none; }
body.touch #objective.collapsed #obj-toggle, body.pad #objective.collapsed #obj-toggle { padding: 4px 6px; }
body.touch #objective:not(.collapsed), body.pad #objective:not(.collapsed) { max-height: 36vh; }
body.touch #objective .kicker { display: none; }
body.touch .tickets span { display: none; }
body.touch #objective h2 { font-size: 15px; margin-bottom: 2px; }
body.touch #obj-steps { font-size: 14px; }
body.touch #objective, body.touch #objective.collapsed { width: min(260px, 38vw); }
body.touch #objective.collapsed #obj-compact { font-size: 13px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
body.touch #obj-caret { font-size: 12px; }
body.touch #obj-steps li:not(.now) { display: none; }
body.touch #squad, body.touch #chat-form, body.touch #ping { display: none; }
/* The minimap sits top right on touch: the vox lines go under it, each on its own dark strip so they read over the fight. */
body.touch #feed { top: calc(122px + env(safe-area-inset-top)); right: 8px; width: min(260px, 40vw); }
body.touch #vox p { font-size: 13px; line-height: 1.2; width: fit-content; max-width: 100%; margin: 0 0 3px auto; padding: 2px 7px; background: rgba(8, 6, 4, 0.72); text-shadow: none; }
/* Two lines at most, so they never reach the ability buttons below. */
body.touch #vox p:nth-last-child(n + 3) { display: none; }
/* On touch both lines sit low, just above the Vent and Use buttons, off the fight in the middle. */
body.touch #prompt { bottom: calc(var(--eb) + var(--b) + 12px); left: 44%; }
body.touch #bossbar { top: calc(64px + env(safe-area-inset-top)); }
body.touch #hubbar { top: auto; left: 43%; transform: none; bottom: calc(10px + env(safe-area-inset-bottom)); width: min(220px, 26vw); padding: 6px; }
body.touch #hubbar .kicker { font-size: 11px; }
body.touch #hubbar .hub-buttons { flex-direction: column; gap: 4px; }
body.touch #hubbar button { font-size: 13px; padding: 7px 6px; }
body.touch #hubbar kbd { display: none; }
body.touch #hubbar .fine { display: none; }
body.touch .overlay.slim { padding-bottom: 36vh; }
body.touch.ingame { cursor: default; }


#restart-campaign { width: 100%; margin-top: 8px; font-size: 11px; padding: 8px; }
.op { cursor: default; }

.side-ops { margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(201, 162, 78, 0.25); display: grid; gap: 6px; }
.side-ops button { text-align: left; text-transform: none; letter-spacing: 0.04em; font-size: 14px; }
.run-opts { display: grid; gap: 2px; margin: 0 0 6px 10px; }
.run-opts .diff { margin: 2px 0 6px; }
.run-opts.company { margin: 0 0 10px; }
.side-ops button small { display: block; font-family: var(--pixel); font-size: 9px; color: var(--dim); margin-top: 3px; letter-spacing: 0.08em; }

#boons { margin: 14px 0 6px; pointer-events: auto; }
#gate { margin: 14px 0 6px; pointer-events: auto; }
.gate-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 640px) { .gate-row { grid-template-columns: 1fr; } }
.gate-row button { text-align: left; text-transform: none; padding: 10px 12px; }
.gate-row button strong { display: block; font-size: 15px; }
.gate-row button small { display: block; font-family: var(--pixel); font-size: 9px; color: var(--dim); margin-top: 4px; letter-spacing: 0.06em; }
.gate-row .hell { border-color: #a040c0; box-shadow: 0 0 14px rgba(190, 70, 255, 0.35) inset; }
.gate-row .hell strong { color: #e0a0ff; }
.gate-row .sel { outline: 2px solid var(--gold, #c9a24e); }
.boon-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
/* Boon tiers: grey, green, blue, gold. */
.boon strong em { display: block; font-style: normal; font-family: var(--pixel); font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; }
.boon.tier-common strong em { color: #b8b0a0; }
.boon.tier-uncommon { border-color: rgba(122, 208, 138, 0.6); }
.boon.tier-uncommon strong em, .boon.tier-uncommon strong { color: #a8f0b8; }
.boon.tier-rare { border-color: rgba(122, 184, 255, 0.75); box-shadow: 0 0 10px rgba(80, 150, 255, 0.25) inset; }
.boon.tier-rare strong em, .boon.tier-rare strong { color: #bcdcff; }
.boon.tier-legendary { border-color: rgba(240, 192, 80, 0.95); box-shadow: 0 0 16px rgba(240, 180, 60, 0.4) inset; }
.boon.tier-legendary strong em, .boon.tier-legendary strong { color: #ffe08a; }
@media (max-width: 640px) { .boon-row { grid-template-columns: 1fr; } }
.boon {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  text-align: left;
  text-transform: none;
  letter-spacing: 0.02em;
  padding: 8px 10px;
  cursor: pointer;
}
.boon img { grid-row: 1 / 3; width: 32px; height: 32px; image-rendering: pixelated; }
.boon strong { font-family: var(--gothic); font-size: 14px; }
.boon small { font-family: var(--pixel); font-size: 9px; color: var(--dim); }
.boon b { position: absolute; top: 3px; right: 6px; font-family: var(--pixel); font-size: 9px; color: var(--brass-hi); }
.boon.sel { border-color: var(--brass-hi); box-shadow: 0 0 14px rgba(201, 162, 78, 0.4); opacity: 1; }
.boon.dim { opacity: 0.35; }
.credits { pointer-events: none; }
.perks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; margin-bottom: 8px; }
.perk { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid rgba(201, 162, 78, 0.25); background: rgba(10, 9, 7, 0.6); }
.perk img { width: 24px; height: 24px; image-rendering: pixelated; }
.perk strong { display: block; font-size: 13px; }
.perk small { display: block; font-family: var(--pixel); font-size: 9px; color: var(--dim); }
.perk .pips { display: flex; gap: 3px; align-items: center; }
.perk .pips i { width: 8px; height: 8px; border: 1px solid var(--brass); display: inline-block; }
.perk .pips i.on { background: var(--brass-hi); }
.perk button { padding: 2px 8px; min-width: 26px; }
#perk-points { margin-left: 8px; letter-spacing: 0.06em; }

/* Strategium: Space Hulk is the watch. Campaign and Horde sit under it. */
.main-mode { margin-bottom: 4px; }
.extras-kicker { margin: 18px 0 8px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.modes.extra { gap: 12px; }
@media (max-width: 760px) { .modes { grid-template-columns: 1fr; } }
.mode-card.extra h3 { font-size: 18px; }
.mode-card.extra .prose { font-size: 13px; }
.mode-card.extra > button { width: 100%; padding: 10px; font-size: 13px; }
.mode-card { border: 1px solid rgba(201, 162, 78, 0.35); background: linear-gradient(rgba(42, 36, 22, 0.55), rgba(14, 12, 8, 0.55)); padding: 14px 16px; display: grid; gap: 8px; align-content: start; }
.mode-card.hulk { border-color: rgba(120, 160, 140, 0.4); background: linear-gradient(rgba(20, 34, 30, 0.6), rgba(8, 12, 10, 0.6)); }
.mode-card h3 { margin: 0; font-size: 22px; }
.mode-card .prose { margin: 0; }
.mode-card ol { margin: 0; padding-left: 18px; font-size: 13px; }
.mode-card > button.primary { width: 100%; padding: 14px; font-size: 15px; }
.mode-card .run-opts { margin: 4px 0 0; padding-top: 8px; border-top: 1px solid rgba(201, 162, 78, 0.2); }
.mode-card #acts .act-block { margin-bottom: 6px; }
.mode-card #acts .act-block .place { display: none; }
.mode-card #acts .ops { display: flex; flex-wrap: wrap; gap: 4px; }
.mode-card #acts .op { flex: 1 1 auto; padding: 4px 6px; font-size: 11px; }
.mode-card .best { color: var(--brass-hi); margin: 0; }
.run-opts.company { margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(201, 162, 78, 0.25); }

/* The Derelict: optional finds, champions, rare classes, the dead's slates. */
#obj-steps li.optional { color: #b8a878; font-size: 0.92em; }
#obj-steps li.optional::before { content: "✧"; color: #c8a050; }
#obj-steps li.optional.done::before { content: "✓"; color: #7ad89a; }
body.touch #obj-steps li.optional:not(.done) { display: list-item; }
#bossbar.champion .boss-track span { background: linear-gradient(#ffd060, #8a5a10); }
.card.rare strong { color: #d8a8ff; }
.card.rare:not(.locked) { box-shadow: 0 0 10px rgba(180, 90, 255, 0.35); }
#vox p.lore { color: #8ae0a8; font-style: italic; }

/* A controller's cursor in menus and panels. */
.pad-focus { outline: 2px solid var(--brass-hi) !important; outline-offset: 2px; box-shadow: 0 0 12px rgba(240, 200, 100, 0.45); }

/* ---------- the Rogue Trader ---------- */

.mode-card.trader { border-color: rgba(200, 140, 80, 0.45); background: linear-gradient(rgba(44, 26, 14, 0.62), rgba(12, 8, 6, 0.62)); margin-top: 10px; }
.trader-sheet h2 { margin-bottom: 6px; }
.tr-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-family: var(--pixel); font-size: 11px; color: var(--dim); margin-bottom: 10px; }
.tr-thrones { color: var(--brass-hi); font-size: 15px; }
.tr-bonus { color: #9ae0ff; }
.tr-role { margin-left: auto; padding: 2px 8px; border: 1px solid var(--line); }
.tr-role.cap { color: var(--brass-hi); border-color: var(--brass); }
.tr-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tr-tabs button { flex: 1; padding: 8px 6px; font-size: 12px; }
.tr-tabs button.sel { border-color: var(--brass-hi); color: var(--brass-hi); background: rgba(201, 162, 78, 0.12); }
.tr-map { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.tr-svg { width: 100%; aspect-ratio: 1; background: radial-gradient(circle at 40% 40%, #12141c, #050508); border: 1px solid var(--line); }
.tr-svg text { font-family: "Silkscreen", ui-monospace, monospace; pointer-events: none; }
.tr-node:hover circle { filter: brightness(1.4); }
.tr-ring { animation: tr-pulse 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes tr-pulse { 50% { opacity: 0.35; transform: scale(1.25); } }
.tr-sys { display: grid; gap: 8px; align-content: start; }
.tr-sys h3 { margin: 0; }
.tr-sys .prose { margin: 0; font-size: 14px; }
.tr-sys button { padding: 10px; }
.tr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tr-card { border: 1px solid rgba(201, 162, 78, 0.35); background: rgba(20, 16, 10, 0.6); padding: 12px; display: grid; gap: 6px; align-content: start; }
.tr-card.t4 { border-color: rgba(220, 110, 60, 0.6); }
.tr-card.t5 { border-color: rgba(200, 60, 220, 0.6); background: rgba(30, 10, 30, 0.6); }
.tr-card h4 { margin: 0; font-size: 16px; }
.tr-card .prose { margin: 0; font-size: 13px; }
.tr-card button { padding: 9px; }
.tr-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tr-threat { font-family: var(--pixel); font-size: 10px; color: var(--dim); display: inline-flex; gap: 6px; align-items: center; }
.tr-threat.t4 { color: #f0a060; }
.tr-threat.t5 { color: #e080ff; }
.tr-pips { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 6px; }
.tr-pips i { width: 7px; height: 7px; border: 1px solid var(--brass); display: inline-block; }
.tr-pips i.on { background: var(--brass-hi); }
.tr-threat .tr-pips i.on { background: #d05030; border-color: #d05030; }
.tr-rows { display: grid; gap: 6px; }
.tr-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid rgba(201, 162, 78, 0.2); background: rgba(14, 12, 8, 0.5); }
.tr-row .fine { margin: 2px 0 0; }
.tr-row button { white-space: nowrap; padding: 8px 12px; }
.tr-done { color: var(--brass-hi); font-family: var(--pixel); font-size: 11px; }
.tr-log { list-style: none; margin: 4px 0 0; padding: 0; max-height: 120px; overflow: auto; font-size: 12px; color: var(--dim); }
.tr-log li { padding: 2px 0; border-bottom: 1px solid rgba(201, 162, 78, 0.08); }
.tr-log li:first-child { color: #ddd3bd; }
.trader-sheet > .kicker:last-of-type { margin-top: 14px; }
@media (max-width: 700px) {
  .tr-map { grid-template-columns: 1fr; }
  .tr-role { margin-left: 0; }
}

/* ---------- the Space Hulk: the deck chart at Varro's Anchorage ---------- */

.mode-card.chart { border-color: rgba(201, 162, 78, 0.6); background: linear-gradient(rgba(48, 38, 18, 0.7), rgba(14, 11, 6, 0.7)); box-shadow: 0 0 18px rgba(201, 162, 78, 0.12) inset; }
.archive-toggle { width: 100%; margin: 16px 0 10px; padding: 10px 12px; text-align: left; display: flex; align-items: baseline; gap: 10px; }
.archive-toggle::before { content: "▸"; color: var(--brass); }
.archive-toggle.open::before { content: "▾"; }
.archive-toggle small { font-family: var(--pixel); font-size: 9px; color: var(--dim); letter-spacing: 0.08em; text-transform: none; }
#archive { display: grid; gap: 10px; margin-bottom: 6px; }
#archive[hidden] { display: none; }
#archive .mode-card.trader { margin-top: 0; }
.hulk-sheet { width: min(1120px, 100%); }
.hk-raid { margin: 0 0 10px; padding: 8px 12px; border: 1px solid #d84a3a; background: rgba(90, 14, 10, 0.7); color: #ffb0a0; font-family: var(--gothic); font-size: 14px; letter-spacing: 0.04em; animation: hk-alarm 1.6s ease-in-out infinite; }
@keyframes hk-alarm { 50% { box-shadow: 0 0 16px rgba(216, 74, 58, 0.55); } }
.hk-chart { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.hk-mapwrap { position: relative; }
.hk-svg { display: block; width: 100%; aspect-ratio: 1 / 0.78; background: radial-gradient(circle at 50% 50%, #17150f 0%, #0b0a08 55%, #050504 100%); border: 1px solid var(--line); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.hk-mapwrap.compact .hk-svg { aspect-ratio: 1 / 0.62; max-height: 28vh; touch-action: pan-y; }
.hk-svg.dragging { cursor: grabbing; }
.hk-svg text { font-family: "Silkscreen", ui-monospace, monospace; pointer-events: none; }
.hk-svg .hk-arm { letter-spacing: 0.12em; }
.hk-node { cursor: pointer; }
.hk-node:hover > :first-child { filter: brightness(1.5); }
.hk-pulse { animation: tr-pulse 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.hk-here { pointer-events: none; animation: hk-bob 1.8s ease-in-out infinite; }
@keyframes hk-bob { 50% { transform: translateY(-0.6px); } }
.hk-zoom { position: absolute; right: 6px; top: 6px; display: flex; flex-direction: column; gap: 4px; }
.hk-zoom button { width: 30px; height: 30px; padding: 0; font-size: 16px; line-height: 1; background: rgba(12, 12, 10, 0.85); }
.hk-side { gap: 10px; }
.hk-hint { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid rgba(201, 162, 78, 0.3); background: rgba(14, 12, 8, 0.6); }
.hk-hint h3 { margin: 0; font-size: 19px; }
.hk-hint .kicker { margin: 0; }
.hk-hint .prose { margin: 0; font-size: 14px; }
.hk-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.hk-meta .fine { margin: 0; }
.hk-pay { margin: 0; font-family: var(--pixel); font-size: 11px; color: var(--brass-hi); }
.hk-side > button { padding: 10px; }
.hk-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-family: var(--pixel); font-size: 9px; color: var(--dim); }
.hk-legend span { display: flex; align-items: center; gap: 6px; }
.hk-legend i { width: 9px; height: 9px; border: 1.5px solid #c9a24e; display: inline-block; flex: none; }
.hk-legend .lg-deck { border-radius: 50%; }
.hk-legend .lg-boss { transform: rotate(45deg) scale(0.85); }
.hk-legend .lg-gate { border-radius: 50%; border-color: #e080ff; box-shadow: 0 0 0 2px #1a0820, 0 0 0 3px #e080ff; transform: scale(0.7); }
.hk-legend .lg-hell { border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%; border-color: #b040e0; }
.hk-legend .lg-distress { border-radius: 50%; border-color: #ff8070; }
.hk-legend .lg-elite { clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); background: #ff9040; border-color: #ff9040; }
.hk-legend .lg-assault { clip-path: polygon(50% 0, 100% 55%, 100% 100%, 50% 45%, 0 100%, 0 55%); background: #b8d070; border-color: #b8d070; }
.hk-legend .lg-done { border-radius: 50%; background: #c9a24e; }
.hk-legend .lg-next { border-radius: 50%; border-color: #fff0c0; box-shadow: 0 0 0 2px #0b0a08, 0 0 0 3px #fff0c0; transform: scale(0.75); }
.hk-stock { margin-left: 8px; font-family: var(--pixel); font-size: 10px; color: var(--brass); }
.hk-wide { width: 100%; margin-top: 12px; padding: 10px; }
.hulk-sheet .hk-logk { margin-top: 14px; }
#obj-steps li.raid { color: #ffb0a0; }
#obj-steps li.raid::before { content: "⚠"; color: #d84a3a; }

/* The debrief after a chart deck. */
#hulk-debrief { margin: 12px 0 6px; pointer-events: auto; display: grid; gap: 8px; }
/* The report scrolls when it runs past the screen (the chart, the onward buttons). */
/* The after-action report sits over the whole HUD and takes the pointer: nothing behind it catches a scroll or a click. */
#debrief { z-index: 7; pointer-events: auto; background: rgba(4, 4, 3, 0.5); }
#debrief .sheet { pointer-events: auto; overscroll-behavior: contain; touch-action: pan-y; }
#hulk-debrief[hidden] { display: none; }
.hk-paid { margin: 0; font-family: var(--pixel); font-size: 12px; color: var(--dim); }
.hk-paid b { color: var(--brass-hi); font-size: 16px; font-weight: normal; }
.hk-event { padding: 8px 12px; border: 1px solid rgba(201, 162, 78, 0.45); background: rgba(30, 24, 12, 0.7); }
.hk-event .kicker { margin: 0 0 2px; }
.hk-event .prose { margin: 0; font-size: 14px; }
.hk-event.k-raid { border-color: #d84a3a; background: rgba(90, 14, 10, 0.72); }
.hk-event.k-raid .kicker { color: #ff8a70; }
.hk-event.k-raid .prose { color: #ffd0c4; }
.hk-event.k-distress { border-color: rgba(255, 120, 100, 0.6); }
.hk-event.k-windfall .kicker, .hk-event.k-bounty .kicker, .hk-event.k-merchant .kicker { color: var(--brass-hi); }
.hk-pick { margin: 0; font-size: 13px; color: var(--bone); }
.hk-pick b { font-family: var(--gothic); color: var(--brass-hi); margin-right: 4px; }
.hk-onward { display: flex; flex-wrap: wrap; gap: 6px; }
.hk-onward button { flex: 1 1 200px; padding: 10px; text-transform: none; letter-spacing: 0.03em; }
.hk-onward .hk-defend { border-color: #d84a3a; color: #ffb0a0; background: rgba(90, 14, 10, 0.6); }
#hulk-debrief > .fine { margin: 0; }
@media (max-width: 760px) {
  .hk-chart { grid-template-columns: 1fr; }
  .hk-svg { aspect-ratio: 1 / 0.95; }
  .hk-mapwrap.compact .hk-svg { aspect-ratio: 1 / 0.75; max-height: 26vh; }
}
.hk-svg .hk-arm, .hk-svg .hk-ring-label, .hk-svg .hk-home-label { paint-order: stroke; stroke: #0b0a08; stroke-width: 0.35px; stroke-linejoin: round; }
.hulk-sheet .tr-body > .fine { margin-bottom: 8px; }
.hk-paid b.lost { color: #ff8a70; }

/* The Space Hulk: wares and training at the Anchorage. */
.hk-ware .hk-tier { margin-left: 8px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.8; }
.hk-ware.tier-uncommon strong { color: #8fd07a; }
.hk-ware.tier-rare strong { color: #70b0ff; }
.hk-ware.tier-legendary strong { color: #ffb040; }
.hk-rank { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 4px 0 8px; }
.hk-rank .track { flex-basis: 100%; }
/* The Space Hulk: the company's comrades at the mercenary hall. */
.hk-sub { margin: 14px 0 4px; font-family: var(--pixel); font-size: 12px; letter-spacing: 0.06em; color: var(--brass-hi); }
.hk-vet { margin-left: 8px; padding: 1px 6px; font-size: 11px; color: #ffd060; border: 1px solid rgba(255, 208, 96, 0.55); }
.hk-affix { padding: 1px 6px; font-size: 11px; color: #ffb070; border: 1px solid rgba(255, 144, 64, 0.55); }
.hk-trait { margin-left: 8px; padding: 1px 6px; font-size: 11px; color: #8fd07a; border: 1px solid rgba(143, 208, 122, 0.45); }
.hk-pers { margin-left: 8px; padding: 1px 6px; font-size: 11px; color: #9fc4ff; border: 1px solid rgba(159, 196, 255, 0.45); }
.hk-bio { font-style: italic; opacity: 0.8; }
.hk-pick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.hk-pick button, .hk-acts button { padding: 5px 9px; }
.hk-pick button.on, .hk-acts button.on { color: var(--brass-hi); border-color: var(--brass-hi); }
.hk-pick button.on:disabled { opacity: 1; }
.hk-acts { display: flex; flex-direction: column; gap: 4px; }
.hk-troop.waiting { opacity: 0.6; }

/* Soulward: the hero's level, and a new level's talents in the middle of the fight. */
.hero-lv { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; font-family: Georgia, serif; }
.hero-bar { position: relative; width: 240px; height: 14px; background: rgba(20, 14, 8, .78); border: 1px solid #8a6c40; border-radius: 3px; overflow: hidden; }
.hero-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#e8c060, #a87a28); }
.hero-bar b { position: relative; z-index: 1; display: block; text-align: center; font: 600 10px/14px Georgia, serif; letter-spacing: .12em; text-transform: uppercase; color: #fff2d0; text-shadow: 0 1px 2px #000; }
.hero-offer { pointer-events: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 92vw; padding: 10px 12px; background: rgba(14, 10, 7, .9); border: 1px solid #c9a248; border-radius: 6px; box-shadow: 0 0 24px rgba(201, 162, 72, .35); animation: hero-in .4s ease-out; }
.hero-offer .kicker { flex-basis: 100%; margin: 0; text-align: center; color: #ffe7a0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.hero-offer .talent { width: 190px; padding: 8px 10px; text-align: left; background: #1c140d; color: #e8dcc0; border: 1px solid #6b5436; border-radius: 5px; cursor: pointer; font: 13px Georgia, serif; }
.hero-offer .talent:hover { border-color: #ffe7a0; background: #2a1e12; }
.hero-offer .talent b { float: right; color: #8a6c40; }
.hero-offer .talent strong { display: block; color: #f2d79a; font-weight: normal; font-size: 15px; margin-bottom: 3px; }
.hero-offer .talent small { color: #cdbb98; font-size: 12px; line-height: 1.3; }
@keyframes hero-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- first steps: the guide and the in-game checklist ---------- */

.guide-sheet { width: min(640px, 100%); }
.guide-sheet h2 { font-size: 26px; padding-right: 36px; }
.guide-sheet .prose { margin: 10px 0; }
.guide-sheet kbd { margin: 0 2px; font-size: 11px; padding: 1px 5px; }
.g-press {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  border: 1px dashed var(--brass-dim);
  background: rgba(0, 0, 0, 0.35);
}
.g-label { font-family: var(--pixel); font-size: 10px; color: var(--dim); }
.g-input { border: 1px solid var(--brass-dim); background: #0a0a08; padding: 6px 10px; color: var(--dim); min-width: 120px; font-size: 14px; }
.g-input.code { min-width: 70px; letter-spacing: 0.3em; font-family: var(--pixel); }
.g-btn {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(#1c1c16, #121210);
  border: 1px solid var(--brass-dim);
  padding: 8px 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--gothic);
  font-weight: 700;
  font-size: 12px;
}
.g-btn.primary { background: linear-gradient(#5a1a16, #3a0e0c); border-color: var(--brass); color: #fff0d0; }
.g-pill { font-family: var(--pixel); font-size: 10px; padding: 5px 8px; border: 1px solid var(--brass-dim); color: var(--dim); }
.g-pill.on { color: var(--brass-hi); border-color: var(--brass); }
.g-small { font-family: var(--pixel); font-size: 10px; color: var(--brass); width: 100%; text-align: center; }
.g-hubbar { justify-content: center; }
.g-keys span { font-size: 14px; color: #ddd3bd; margin-right: 8px; }
.g-node { width: 22px; height: 22px; border-radius: 50%; background: #3a3426; border: 3px solid #fff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.6); }
.g-arrow { color: var(--brass-hi); font-size: 18px; }
.g-hi, .coach-hi { animation: coach-glow 1.4s ease-in-out infinite; }
@keyframes coach-glow {
  0%, 100% { box-shadow: 0 0 0 1px var(--brass), 0 0 6px rgba(239, 210, 138, 0.35); }
  50% { box-shadow: 0 0 0 2px var(--brass-hi), 0 0 18px rgba(239, 210, 138, 0.85); }
}
@media (prefers-reduced-motion: reduce) {
  .g-hi, .coach-hi { animation: none; box-shadow: 0 0 0 2px var(--brass-hi), 0 0 12px rgba(239, 210, 138, 0.7); }
}
.g-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.g-dots { display: flex; gap: 8px; }
.g-dots button { flex: none; min-width: 0; min-height: 0; width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 1px solid var(--brass-dim); background: transparent; }
.g-dots button.on { background: var(--brass); border-color: var(--brass-hi); }
#help-guide { padding: 4px 10px; font-size: 11px; margin: 0 4px; }

#coach {
  top: 64px;
  left: 14px;
  width: min(300px, 42vw);
  padding: 10px 12px;
  border-color: var(--brass);
  pointer-events: none;
}
#coach p { margin: 0; }
#coach-text { font-size: 15px; line-height: 1.35; color: var(--brass-hi); margin-top: 2px; }
#coach-sub { margin-top: 4px; }
#coach-off { pointer-events: auto; margin-top: 8px; padding: 3px 8px; font-size: 10px; }
/* A panel is open and the tip points into it: sit over the panel, at the bottom. */
#coach.over { top: auto; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 7; width: min(420px, 92vw); text-align: center; }
@media (max-width: 640px) {
  .guide-sheet h2 { font-size: 21px; }
  #coach { width: min(260px, 60vw); }
}
/* Phones held sideways: keep a whole step and its buttons on one screen. */
@media (max-height: 500px) {
  .guide-sheet { padding: 12px 16px; }
  .guide-sheet h2 { font-size: 19px; margin-bottom: 4px; }
  .guide-sheet .prose { font-size: 14px; margin: 6px 0; line-height: 1.35; }
  .g-press { margin: 6px 0; padding: 6px 8px; }
  .g-nav { margin-top: 8px; }
  .g-nav button { padding: 6px 12px; }
}
