:root {
  /* Rocket Row (table 1) palette, "Pulp Serial Poster" direction. Keep in
     sync with INK in src/art.js; later tables swap the spot inks. */
  --paper: #efe2c4;
  --aged: #e6d4ae;
  --ink: #1e1a16;
  --ground: #17130f;
  --red: #d2452f;
  --teal: #2e7f86;
  --mustard: #e3a92b;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--ground);
  color: var(--paper);
  font-family: 'Fredoka', 'Trebuchet MS', sans-serif;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
}

/* The table fills the window height. It shows the 400 x 700 table down to
   y 672 (LAYOUT.viewHeight): the layers are drawn 700 tall and the wrap
   crops the bottom, under the drain. RENDER_SCALE (layout.js) keeps the
   canvases sharp at this size. */
#table-wrap {
  position: relative;
  height: calc(100vh - 32px);
  aspect-ratio: 400 / 672;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

#table-wrap > * {
  position: absolute;
  inset: 0;
  /* Matter sets an inline pixel width/height on its canvas; override it so
     all three layers scale together. */
  width: 100% !important;
  height: calc(100% * 700 / 672) !important;
  display: block;
}

#playfield-art svg {
  width: 100%;
  height: 100%;
  display: block;
}

#hud {
  width: 240px;
  /* same height as the table beside it */
  height: calc(100vh - 32px);
  box-sizing: border-box;
  overflow-y: auto;
  background: var(--paper);
  color: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 8px;
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 5px var(--red);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#table-name {
  font-family: 'Rye', Georgia, serif;
  font-size: 22px;
  color: var(--red);
  text-transform: uppercase;
  line-height: 1.1;
}

#score {
  font-family: 'Rye', Georgia, serif;
  font-size: 34px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* Ball · combo · bonus on one line */
#status {
  display: flex;
  flex-wrap: wrap;
  column-gap: 10px;
  font-weight: 600;
  font-size: 13px;
}

#combo {
  color: var(--ink);
  opacity: 0.5;
}

#combo.hot {
  color: var(--red);
  opacity: 1;
}

#bonus-line b {
  color: var(--teal);
}

#combo-meter {
  height: 3px;
  background: var(--aged);
}

#combo-bar {
  height: 100%;
  width: 0;
  background: var(--red);
}

#message {
  min-height: 20px;
  font-family: 'Rye', Georgia, serif;
  font-size: 14px;
  line-height: 1.3;
  color: var(--teal);
}

/* The mission in three short lines */
#mission {
  padding: 8px 10px;
  border: 2px solid var(--ink);
  background: var(--aged);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mission-head,
.mission-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

#mission .tag,
#mission-status {
  white-space: nowrap;
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#mission .tag {
  color: var(--red);
}

#mission-name {
  font-family: 'Rye', Georgia, serif;
  font-size: 15px;
  line-height: 1.2;
}

#mission-count {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

#mission-goal {
  font-size: 12px;
  line-height: 1.3;
  opacity: 0.8;
}

.progress {
  height: 5px;
  background: var(--paper);
  border: 1px solid var(--ink);
}

#mission-bar {
  height: 100%;
  width: 0;
  background: var(--teal);
  transition: width 0.2s;
}

#mission.urgent #mission-status {
  color: var(--red);
  font-weight: 600;
}

.hud-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

#help-toggle {
  width: 36px;
  font: 400 18px 'Rye', Georgia, serif;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
}

#help-toggle[aria-expanded='true'] {
  background: var(--ink);
  color: var(--paper);
}

#help {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
  border-top: 2px dashed var(--ink);
  font-size: 13px;
}

#help .help-row {
  display: flex;
  justify-content: space-between;
}

#help .help-row b {
  font-family: 'Rye', Georgia, serif;
  font-weight: 400;
}

#rank-next {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 10px;
  text-transform: uppercase;
  opacity: 0.7;
}

#hint {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 12px;
}

#hint p {
  margin: 4px 0;
}

kbd {
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'Special Elite', monospace;
}

/* --- charge meter and skills ------------------------------------------- */

.charge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.charge-row .tag {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--red);
}

#charge-meter {
  position: relative;
  flex: 1;
  height: 10px;
  border: 2px solid var(--ink);
  background: var(--paper);
}

/* With Double Charge the meter holds two charges: mark the halfway point. */
/* One notch per extra charge the meter holds (--charges: 1, 2 or 3). */
#charge-meter::after {
  content: '';
  position: absolute;
  inset: -2px 0;
  background: repeating-linear-gradient(to right, transparent 0 calc(100% / var(--charges, 1) - 2px), var(--ink) 0 calc(100% / var(--charges, 1)));
  pointer-events: none;
}

#charge-bar {
  height: 100%;
  width: 0;
  background: var(--mustard);
  transition: width 0.15s;
}

#skill-list {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

#skill-list button {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 13px 'Fredoka', sans-serif;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  text-align: left;
}

#skill-list button:disabled {
  opacity: 0.45;
  cursor: default;
}

#skill-list button.active {
  opacity: 1;
  background: var(--red);
  color: var(--paper);
}

#skill-list .name {
  flex: 1;
}

#skill-list .cost {
  font-family: 'Special Elite', monospace;
  font-size: 12px;
}

#open-upgrades,
#open-tables {
  font: 600 14px 'Fredoka', sans-serif;
  color: var(--paper);
  background: var(--ink);
  border: none;
  border-radius: 4px;
  padding: 8px 10px;
  cursor: pointer;
}

/* Pinned to the page's top right, over everything but the Upgrade Tree. */
#open-upgrades {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5;
  font-size: 15px;
  padding: 10px 14px;
  border: 2px solid var(--paper);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

#open-tables {
  margin-top: 6px;
  font-size: 13px;
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
}

#open-upgrades kbd {
  background: var(--paper);
  color: var(--ink);
}

#open-upgrades b,
#open-tables b {
  font-family: 'Rye', Georgia, serif;
  font-weight: 400;
  color: var(--mustard);
}

#open-upgrades:not(:disabled):hover,
#open-upgrades:focus-visible,
#open-tables:not(:disabled):hover,
#open-tables:focus-visible {
  background: var(--red);
  color: var(--paper);
}

/* During a turn the tree waits: the buttons grey out. */
#open-upgrades:disabled,
#open-tables:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Between turns, a title card on the table says how to start. */
#table-wrap > #start-prompt {
  height: 100% !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

/* puts the card just above the drop targets, clear of the flippers */
#start-prompt::before {
  content: '';
  flex: 0 0 56%;
}

#start-prompt[hidden] {
  display: none !important;
}

#start-prompt .card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 26px 14px;
  background: rgba(30, 26, 22, 0.88);
  color: var(--paper);
  outline: 2px solid var(--paper);
  outline-offset: -6px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  animation: prompt-pulse 1.6s ease-in-out infinite;
}

#start-prompt b {
  font: 400 26px 'Rye', Georgia, serif;
  letter-spacing: 0.03em;
}

#start-prompt span {
  font: 15px 'Special Elite', monospace;
  color: var(--mustard);
}

@keyframes prompt-pulse {
  50% { transform: scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  #start-prompt .card { animation: none; }
}

#open-tables b {
  color: inherit;
}

/* Skill effects on the table */
#table-wrap.slow-reels {
  filter: sepia(0.55) contrast(1.05);
}

#table-wrap.ink-surge {
  box-shadow: 0 0 0 4px var(--red), 0 16px 36px rgba(0, 0, 0, 0.6);
}

#hud [hidden] {
  display: none !important;
}

/* --- Upgrade Tree screen: an art deco stepped tower, black and gold ------ */

#upgrade-screen {
  --gold: #d4a646;
  --gold-dim: rgba(212, 166, 70, 0.45);
  --black: #0b0b0b;
  --cream: #f1e4c6;
  --deco: 'Limelight', 'Rye', Georgia, serif;
  /* small labels: a geometric deco-era face that stays legible when small */
  --thin: 'Josefin Sans', 'Fredoka', sans-serif;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.88);
  padding: 12px;
  display: flex;
}

#upgrade-screen[hidden] {
  display: none;
}

#upgrade-screen .board {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  color: var(--cream);
  background: var(--black);
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 6px var(--black), inset 0 0 0 7px var(--gold-dim), 0 20px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

/* stepped deco brackets in the corners */
#upgrade-screen .board::before,
#upgrade-screen .board::after {
  content: '';
  position: absolute;
  width: 46px;
  height: 46px;
  top: 14px;
  left: 14px;
  border-top: 2px solid var(--gold);
  border-left: 2px solid var(--gold);
  box-shadow: inset 7px 7px 0 -5px var(--gold-dim);
  pointer-events: none;
  z-index: 2;
}

#upgrade-screen .board::after {
  left: auto;
  right: 14px;
  border-left: none;
  border-right: 2px solid var(--gold);
  box-shadow: inset -7px 7px 0 -5px var(--gold-dim);
}

.board-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
  padding: 14px 72px;
  border-bottom: 2px solid var(--gold);
}

#upgrade-screen h2 {
  margin: 0;
  font: 400 28px var(--deco);
  letter-spacing: 0.06em;
  color: var(--gold);
}

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

#upgrade-screen button {
  font: 600 13px 'Fredoka', sans-serif;
  cursor: pointer;
  border-radius: 0;
}

.tabs button {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--gold);
  padding: 7px 14px;
}

.tabs button[aria-selected='true'] {
  background: var(--gold);
  color: var(--black);
}

#upgrade-screen .balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font: 700 12px var(--thin);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

/* the deco face draws 0 as a half moon, so numbers use the body face */
#upgrade-screen .balance b {
  font: 600 24px 'Fredoka', sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--cream);
}

#upgrade-screen [data-close] {
  background: var(--cream);
  color: var(--black);
  border: none;
  padding: 9px 14px;
}

.panel {
  position: relative;
  flex: 1;
  min-height: 0;
}

.panel[hidden] {
  display: none;
}

/* the tower on the left, the detail card and counts in their own column */
.tree-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
}

.tower-wrap {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.tree-view .tower {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.tree-view .tower.dragging {
  cursor: grabbing;
}

.tower .setback {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-opacity: 0.35;
}

.tower .setback.open {
  stroke-opacity: 0.85;
}

.tower .setback.inner {
  stroke-width: 1.2;
  stroke-opacity: 0.12;
}

.tower .setback.inner.open {
  stroke-opacity: 0.35;
}

.tier-tags {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}

/* pinned to the left edge, level with the top of their step */
.tier-tags span {
  position: absolute;
  left: 22px;
  top: 0;
  white-space: nowrap;
  padding: 2px 8px;
  background: var(--black);
  font: 14px var(--deco);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.45;
}

.tier-tags span.open {
  opacity: 1;
}

.tower .lane-guide {
  stroke: var(--gold);
  stroke-opacity: 0.05;
}

.tower .plinth {
  stroke: var(--gold);
  stroke-width: 3;
  stroke-opacity: 0.9;
}

.tower .plinth.inner {
  stroke-width: 1.2;
  stroke-opacity: 0.3;
}

.tower .branch-name {
  font: 700 13px var(--thin);
  letter-spacing: 2px;
}

.tower .link path {
  fill: none;
}

.tower .link .glow {
  stroke: none;
}

.tower .link .line {
  stroke: var(--gold);
  stroke-opacity: 0.3;
  stroke-width: 1.5;
  stroke-dasharray: 2 5;
}

.tower .link.ready .line {
  stroke: var(--c);
  stroke-opacity: 0.65;
  stroke-width: 1.8;
  stroke-dasharray: none;
}

.tower .link.live .glow {
  stroke: var(--c);
  stroke-opacity: 0.22;
  stroke-width: 10;
}

.tower .link.live .line {
  stroke: var(--c);
  stroke-opacity: 1;
  stroke-width: 2.8;
  stroke-dasharray: none;
}

/* Second Reel's links (to the plinth, and up to each branch's first
   upgrade) stay dashed whatever their state. */
.tower .link.root .line {
  stroke-dasharray: 7 5;
}

.tower .link.root:not(.ready):not(.live) .line,
.tower .link.root.ready .line {
  stroke: var(--gold);
  stroke-opacity: 0.55;
  stroke-width: 1.8;
}

.tower .link.root.live .line {
  stroke: var(--c);
  stroke-opacity: 1;
  stroke-width: 2.4;
}

.tower .diamond {
  cursor: pointer;
}

.tower .diamond .halo {
  fill-opacity: 0.12;
}

.tower .diamond .frame {
  fill: var(--black);
  stroke: var(--gold);
  stroke-width: 1.8;
}

.tower .diamond .face {
  stroke-width: 2.2;
}

.tower .diamond.locked:not(.lit) .face {
  stroke-width: 1;
  stroke-opacity: 0.45;
}

.tower .diamond .ready-ring {
  fill: none;
  stroke-width: 1.6;
  opacity: 0;
}

.tower .diamond.can-buy .ready-ring {
  animation: diamond-ready 1.4s ease-in-out infinite;
}

@keyframes diamond-ready {
  50% { opacity: 1; }
}

.tower .diamond.gated {
  opacity: 0.3;
}

.tower .diamond.selected .frame {
  stroke: var(--cream);
  stroke-width: 3;
}

.tower .diamond:focus {
  outline: none;
}

.tower .diamond:focus-visible .frame {
  stroke: #fff;
  stroke-width: 4;
}

.tower .diamond .level {
  font: 700 14px var(--thin);
  fill: var(--gold);
}

/* links from another branch: stepped, square corners */
.tower .link.cross path {
  stroke-linejoin: miter;
}

/* hovering or selecting an upgrade: its incoming links and their sources
   stand out, everything else steps back */
.tower.focusing .link:not(.hot) {
  opacity: 0.25;
}

.tower.focusing .diamond:not(.hot):not(.selected) {
  opacity: 0.55;
}

.tower.focusing .diamond.gated:not(.hot) {
  opacity: 0.2;
}

.tower .link.hot .line {
  stroke: var(--c);
  stroke-opacity: 1;
  stroke-width: 3;
}

.tower .link.hot .glow {
  stroke: var(--c);
  stroke-opacity: 0.3;
  stroke-width: 10;
}

.tower .diamond .plaque {
  fill: var(--black);
  stroke: var(--gold);
  stroke-opacity: 0.35;
}

.tower .diamond .name {
  font: 700 11px var(--thin);
  letter-spacing: 0.3px;
  fill: var(--cream);
  fill-opacity: 0.7;
}

/* Zoomed far out, names and levels would be specks: show diamonds only
   (the detail card still names whatever is hovered). */
.tower.far .diamond .plaque,
.tower.far .diamond .name,
.tower.far .diamond .level,
.tower.far .branch-name {
  display: none;
}

.tower .diamond.lit .name,
.tower .diamond.can-buy .name {
  fill-opacity: 0.95;
}

.padlock path {
  fill: none;
  stroke: var(--cream);
  stroke-width: 1.8;
}

.padlock rect {
  fill: var(--cream);
}

.zoom {
  position: absolute;
  right: 16px;
  top: 14px;
  display: flex;
  gap: 4px;
}

.zoom button {
  min-width: 34px;
  background: var(--black);
  color: var(--cream);
  border: 1px solid var(--gold);
  padding: 5px 9px;
}

.tree-view .hint {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  margin: 0;
  font: 700 11px var(--thin);
  letter-spacing: 0.08em;
  color: rgba(241, 228, 198, 0.5);
  pointer-events: none;
  white-space: nowrap;
}

.tree-view .side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 20px 16px 4px;
  overflow-y: auto;
}

/* detail card: a gold frame with chamfered corners */
.node-card {
  --cut: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px), 0 16px);
  position: relative;
  background: var(--gold);
  clip-path: var(--cut);
  padding: 20px 22px;
  font-size: 14px;
  color: var(--cream);
}

.node-card::before {
  content: '';
  position: absolute;
  inset: 2px;
  background: var(--black);
  clip-path: var(--cut);
}

.node-card > * {
  position: relative;
}

.node-card h3 {
  margin: 4px 0 6px;
  font: 400 23px var(--deco);
  color: var(--gold);
}

.node-card p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.node-card .card-branch {
  font: 700 12px var(--thin);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.node-card .badge {
  display: inline-block;
  font: 700 11px var(--thin);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--gold);
  color: var(--gold);
}

.node-card .per,
.node-card .level {
  font: 700 13px var(--thin);
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.node-card button[data-buy] {
  margin-top: 12px;
  width: 100%;
  background: var(--gold);
  color: var(--black);
  border: none;
  padding: 10px;
  font-size: 14px;
}

.node-card button[data-buy]:disabled {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--gold-dim);
  opacity: 0.8;
  cursor: default;
}

.node-card .maxed {
  font: 400 15px var(--deco);
  letter-spacing: 0.1em;
  color: var(--gold);
}

.node-card .reasons {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: #ff8a6b;
}

.node-card .cost {
  font-size: 12px;
  opacity: 0.75;
}

.legend {
  border: 1px solid var(--gold-dim);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font: 700 13px var(--thin);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.legend h4 {
  margin: 0 0 4px;
  font: 400 15px var(--deco);
  letter-spacing: 3px;
  color: var(--gold);
}

.legend div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.legend b {
  font: 600 14px 'Fredoka', sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

/* table picker: lobby cards on the black board */
.tables-view,
.loadout-view {
  overflow-y: auto;
  padding: 20px 72px 26px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.lobby {
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  outline: 1px solid var(--gold);
  outline-offset: 4px;
}

.lobby.locked {
  filter: grayscale(0.75) brightness(0.75);
  outline-color: var(--gold-dim);
}

.lobby .poster {
  position: relative;
  background: var(--c1);
  padding: 16px 14px 14px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
}

.lobby .poster::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.13) 1px, transparent 1.3px);
  background-size: 5px 5px;
  pointer-events: none;
}

.lobby .poster svg {
  width: 64px;
  height: 64px;
  position: relative;
  z-index: 1;
}

.lobby .titles {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
  color: var(--paper);
}

.lobby .world,
.lobby .serial {
  font: 11px 'Special Elite', monospace;
  letter-spacing: 0.08em;
}

.lobby .world {
  text-transform: uppercase;
}

.lobby h3 {
  margin: 0;
  font: 400 20px 'Rye', Georgia, serif;
  line-height: 1.1;
}

.lobby .tag {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  font: 10px 'Special Elite', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--paper);
  color: var(--ink);
  padding: 2px 6px;
}

.lobby-body {
  padding: 12px 14px 14px;
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.lobby dl {
  margin: 0;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 4px 8px;
}

.lobby dt {
  font: 11px 'Special Elite', monospace;
  text-transform: uppercase;
  opacity: 0.7;
  padding-top: 2px;
}

.lobby dd {
  margin: 0;
}

.lobby .state {
  margin: 0;
  border-top: 2px dashed #c8b48c;
  padding-top: 8px;
}

.lobby .state.playing {
  font: 400 15px 'Rye', Georgia, serif;
  color: var(--red);
}

.lobby button[data-play] {
  justify-self: start;
  background: var(--red);
  color: var(--paper);
  border: 2px solid var(--ink);
  padding: 7px 12px;
}

.lobby button[data-play]:disabled {
  opacity: 0.5;
  cursor: default;
}

.lobby .state-note {
  margin: 0;
  font-size: 12px;
  opacity: 0.75;
}

.lobby button[data-find] {
  justify-self: start;
  background: var(--black);
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 6px 10px;
}

/* skill loadout */
.loadout-intro {
  margin: 0 0 16px;
  font: 700 14px var(--thin);
  letter-spacing: 0.04em;
  color: rgba(241, 228, 198, 0.8);
}

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.slot {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: var(--black);
  border: 1px solid var(--gold-dim);
  cursor: pointer;
}

.slot.current {
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--black), inset 0 0 0 4px var(--gold-dim);
}

.slot.locked {
  opacity: 0.45;
  cursor: default;
}

.slot kbd {
  justify-self: start;
  background: var(--gold);
  color: var(--black);
  border-radius: 0;
}

.slot span {
  font: 400 17px var(--deco);
  color: var(--gold);
}

.slot small {
  font: 700 12px var(--thin);
  letter-spacing: 0.04em;
  opacity: 0.8;
}

.slot [data-unequip] {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  color: var(--cream);
  border: 1px solid var(--gold-dim);
  width: 26px;
  height: 26px;
  padding: 0;
}

.skill-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.skill-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 8px 14px;
  align-items: start;
  background: var(--black);
  border: 1px solid var(--gold-dim);
  padding: 14px;
}

.skill-card.locked {
  opacity: 0.5;
}

.skill-card h4 {
  margin: 0;
  font: 400 18px var(--deco);
  color: var(--gold);
}

.skill-card p {
  margin: 3px 0;
  font-size: 13px;
}

.skill-card small {
  font: 700 12px var(--thin);
  letter-spacing: 0.04em;
  opacity: 0.8;
}

.skill-card button {
  grid-column: 1 / -1;
  background: var(--gold);
  color: var(--black);
  border: none;
  padding: 8px;
}

/* a gold diamond with the skill's glyph */
.glyph-chip {
  width: 46px;
  height: 46px;
  background: var(--gold);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  display: grid;
  place-items: center;
}

.glyph-chip svg {
  width: 24px;
  height: 24px;
}

.board-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 72px 14px;
  border-top: 2px solid var(--gold);
  font: 700 13px var(--thin);
  letter-spacing: 0.06em;
  color: rgba(241, 228, 198, 0.8);
}

#upgrade-screen [data-reset] {
  background: none;
  border: 1px solid var(--gold-dim);
  color: var(--cream);
  padding: 6px 12px;
}

#upgrade-screen [data-reset].armed {
  background: var(--red);
  border-color: var(--red);
}

#upgrade-screen button:focus-visible,
#upgrade-screen .slot:focus-visible,
#skill-list button:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .board-bar,
  .board-foot,
  .tables-view,
  .loadout-view {
    padding-left: 18px;
    padding-right: 18px;
  }

  .zoom {
    right: 12px;
  }

  #upgrade-screen h2 {
    font-size: 21px;
  }

  .tree-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .tree-view .side {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 0;
    overflow: visible;
    pointer-events: none;
  }

  .tree-view .side > * {
    pointer-events: auto;
  }

  .node-card.intro,
  .legend,
  .tree-view .hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tower .diamond.can-buy .ready-ring {
    animation: none;
    opacity: 0.9;
  }
}
