:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #10131b; color: #eef1f8; }
body { margin: 0; }
main { max-width: 72rem; margin: auto; padding: clamp(1rem, 4vw, 3rem); }
header { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding-bottom: .75rem; border-bottom: 1px solid #343b4c; }
#round-controls:not([hidden]), #viewer-controls:not([hidden]) { display: flex; flex-wrap: wrap; gap: .4rem; }
#dev-heading { margin: 0 0 .4rem; }
#dev-controls { padding: .75rem 0; border-bottom: 1px solid #343b4c; }
#dev-controls > div { display: flex; flex-wrap: wrap; gap: .4rem; }
#admin-search { margin-top: 1rem; }
#admin-search label { display: block; margin-bottom: .35rem; }
#tile-search { box-sizing: border-box; width: min(100%, 26rem); min-height: 44px; padding: .45rem .7rem; border: 1px solid #586788; border-radius: .4rem; background: #171c28; color: inherit; font: inherit; }
#tile-search-empty { color: #bbc5dc; }
#viewer-controls label { position: relative; cursor: pointer; }
#viewer-controls input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
#viewer-controls label span {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .35rem .75rem;
  border: 1px solid #7082a8;
  border-radius: .15rem;
  color: #d7e2fa;
}
#viewer-controls label:hover span { border-color: #a6bbe4; }
#viewer-controls input:checked + span { background: #3b5e9b; border-color: #799bda; color: #fff; }
#viewer-controls input:focus-visible + span { outline: 2px solid #a6bbe4; outline-offset: 2px; }
main:has(#viewer-controls:not([hidden]) #available-only:checked) #board .tile[data-empty="true"],
main:has(#viewer-controls:not([hidden]) #available-only:checked) #board > section:not(:has(.tile[data-empty="false"])) { display: none; }
main:has(#viewer-controls:not([hidden]) #tile-preview:not(:checked)) #board {
  --tile-preview-display: none;
  --tile-preview-row: 0;
  --compact-tile-min-height: 0;
}
h2 { margin: 1.5rem 0 .6rem; font-size: 1.1rem; }
#round { margin: 0; font-size: 1.2rem; font-weight: 700; }
#status { color: #ffb895; }
#status:empty { display: none; }
#availability-summary { margin-top: .75rem; }
.summary-key { margin: 0 0 .35rem; color: #bbc5dc; font-size: .85rem; }
#availability-summary ul { display: flex; flex-wrap: wrap; gap: .45rem 1.25rem; list-style: none; margin: 0; padding: 0; }
#availability-summary li { display: flex; align-items: center; gap: .45rem; }
#availability-summary strong { font-variant-numeric: tabular-nums; }
.category-heading { display: flex; align-items: center; gap: .45rem; }
.category-heading::before { content: ""; }
.summary-dot, .category-heading::before { flex: none; width: .65rem; height: .65rem; border-radius: 50%; background: var(--category-color); }
.military { --category-color: #ed777d; }
.grid { --category-color: #9babca; }
.nano { --category-color: #f2c75c; }
.rare { --category-color: #bd91ee; }
.development { --category-color: #72d4b3; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); gap: .55rem; }
.tile { display: grid; gap: .5rem; align-content: space-between; padding: .7rem; border-radius: .6rem; border: 1px solid #424e6b; background: #252e43; }
.tile[data-empty="true"] { color: #a4adbf; background: #171c28; border-color: #303747; }
.tile:is(.military, .grid, .nano, .rare, .development) { border-color: color-mix(in srgb, var(--category-color) 55%, #343b4c); }
.tile-name { font-weight: 600; }
.tile-title { display: flex; justify-content: space-between; align-items: baseline; gap: .35rem; min-width: 0; text-align: left; }
.tile-title .tile-name { min-width: 0; overflow-wrap: anywhere; }
.tile-cost { flex: none; color: #d7e2fa; font-size: .85em; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile.development .tile-title { flex-direction: column; gap: .2rem; }
.tile.development .tile-cost { white-space: normal; }
.resource-cost-amount[data-resource="Materials"] { color: #d0a589; }
.resource-cost-amount[data-resource="Money"] { color: #ffae62; }
.resource-cost-amount[data-resource="Science"] { color: #f4a9d1; }
button.tile { text-align: left; grid-template-rows: auto var(--tile-preview-row, 1fr) auto; align-items: start; cursor: pointer; }
button.tile:hover, button.tile:focus-visible { border-color: #9eaccc; }
.tile-image { display: var(--tile-preview-display, block); width: 100%; min-width: 0; height: clamp(3.25rem, 7vw, 5.25rem); object-fit: contain; }
.tile[data-empty="true"] .tile-image { opacity: .55; }
button.tile .count { grid-row: 3; }
.count { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
button { min-height: 44px; padding: .25rem .6rem; border: 1px solid #586788; border-radius: .4rem; background: #303e5e; color: inherit; font: inherit; touch-action: manipulation; }
button:disabled { opacity: .55; }
main:has(.projector-board) { max-width: none; padding: clamp(.5rem, 2vw, 1.5rem); }
main:has(.projector-board) header { border-bottom: 0; }
.compact-board { display: flex; flex-wrap: wrap; gap: .6rem; padding-top: .35rem; }
#availability-summary:not([hidden]) ~ .compact-board { margin-top: 1rem; }
.compact-board > section, .compact-board .tiles { display: contents; }
.compact-board .category-heading { display: none; }
.compact-board .tile {
  box-sizing: border-box;
  position: relative;
  display: block;
  width: clamp(4.5rem, 14vw, 6.5rem);
  aspect-ratio: 1;
  padding: 0;
  background: transparent;
  text-align: center;
}
.compact-board .tile[data-empty="true"] { background: transparent; }
#board .tile[hidden] { display: none; }
.compact-board .tile-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.compact-board .tile:has(.tile-image) > :is(.tile-name, .tile-title) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.compact-board .tile:not(:has(.tile-image)) { display: flex; align-items: center; justify-content: center; padding: .35rem; }
.compact-board .tile:not(:has(.tile-image)) .tile-cost { display: none; }
.compact-board .tile .count {
  position: absolute;
  top: -.35rem;
  right: -.35rem;
  box-sizing: border-box;
  min-width: 1.6em;
  padding: .1em .4em;
  border: 1px solid #a6bbe4;
  border-radius: 999px;
  background: #10131b;
  color: #fff;
  font-size: .95rem;
  line-height: 1.3;
  text-align: center;
}
.compact-board .tile[data-empty="true"] .count { border-color: #424e6b; color: #a4adbf; }
.projector-board { display: flex; flex-wrap: wrap; gap: .5rem; }
.projector-board .tile {
  box-sizing: border-box;
  width: min(7.5rem, 100%);
  grid-template: 1fr auto / minmax(0, 1fr);
  gap: .25rem;
  padding: .45rem;
  text-align: center;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.projector-board .tile-title { flex-direction: column; align-items: center; justify-content: center; gap: .25rem; text-align: center; }
.projector-board .count { font-size: 1.25rem; }
.projector-board[data-density="dense"] { gap: .3rem; }
.projector-board[data-density="dense"] .tile { width: min(6.25rem, 100%); padding: .3rem; font-size: .85rem; }
.projector-board[data-density="dense"] .count { font-size: 1rem; }
:is(.compact-board, .projector-board) > .development-section { display: block; width: 100%; }
:is(.compact-board, .projector-board) .development-section .category-heading { display: flex; margin: .45rem 0; }
:is(.compact-board, .projector-board) .development-section .tiles { display: flex; flex-wrap: wrap; gap: inherit; }
:is(.compact-board, .projector-board) .development-section { gap: inherit; }
.projector-board .development-section:not(:has(.tile:not([hidden]))) { display: none; }
#tech-details { box-sizing: border-box; position: fixed; inset: 0 0 0 auto; margin: 0; width: min(100%, 26rem); height: 100%; max-width: none; max-height: none; padding: 1.5rem; border: 0; border-left: 1px solid #424e6b; background: #171c28; color: #eef1f8; }
#tech-details::backdrop { background: rgb(8 10 16 / 60%); }
#tech-details form { text-align: right; }
#tech-category { color: #bbc5dc; margin-bottom: .3rem; }
#tech-name { font-size: 1.65rem; margin: 0 0 1rem; }
#tech-cost { margin: 0 0 1rem; color: #d7e2fa; font-weight: 600; font-variant-numeric: tabular-nums; }
#tech-image { width: 9rem; height: 9rem; object-fit: contain; }
#tech-effect { line-height: 1.55; }
@media (max-width: 540px) {
  #tech-details { inset: auto 0 0; width: 100%; height: auto; max-height: 85dvh; border-left: 0; border-top: 1px solid #424e6b; border-radius: 1rem 1rem 0 0; }
}
