:root {
  color-scheme: dark;
  --paper: #080e16;
  --card: #111c27;
  --ink: #dae3e9;
  --muted: #8595a5;
  --line: #283643;
  --teal: #65c5bd;
  --rust: #db9b52;
  --gold: #dbb376;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', Arial, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #080e16;
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  background-image: radial-gradient(ellipse at 45% 0, #24303355, transparent 70%);
  min-height: 100vh;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  transition:
    background 0.16s,
    border-color 0.16s,
    color 0.16s;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button:hover:not(:disabled) {
  color: #fff;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
a {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
canvas:focus-visible {
  outline: 2px solid #e7b16e;
  outline-offset: 3px;
}
input,
select {
  background: #0b1420;
  border: 1px solid #32424f;
  padding: 10px 12px;
  border-radius: 3px;
  min-width: 0;
}
input:focus,
select:focus {
  border-color: #ad8b58;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
}
h1 {
  font-size: 46px;
  letter-spacing: -1px;
  line-height: 1.1;
}
h2 {
  font-size: 27px;
  line-height: 1.2;
}
h3 {
  font-size: 21px;
  line-height: 1.3;
}
.topbar {
  height: 76px;
  padding: 0 38px;
  display: flex;
  align-items: center;
  gap: 40px;
  border-bottom: 1px solid #a27a3b38;
  background: #0a111bee;
  position: relative;
  z-index: 3;
  box-shadow: 0 8px 24px #0003;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 40px;
  background: linear-gradient(145deg, #d4b47e, #8b613a);
  color: #0b1520;
  font-size: 39px;
  clip-path: polygon(50% 0, 100% 25%, 90% 80%, 50% 100%, 10% 80%, 0 25%);
}
.brand-sub {
  display: block;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 3px;
  margin-top: 7px;
  color: #a0abb1;
}
.topbar nav {
  height: 100%;
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.nav {
  position: relative;
  padding: 0 23px;
  font-size: 12px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #8396a7;
}
.nav.active {
  color: #f1d3a3;
  background: linear-gradient(0deg, #c996411a, transparent);
}
.nav.active:after {
  content: '';
  position: absolute;
  height: 2px;
  background: #e6bc78;
  bottom: 0;
  left: 15px;
  right: 15px;
  box-shadow: 0 -4px 18px #ffc46b66;
}
.profile {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #a8b7c2;
}
.profile > button:first-of-type {
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.connection {
  display: inline-block;
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b16b57;
}
.connection.online {
  background: #66c3a4;
  box-shadow: 0 0 9px #66c3a444;
}
.sound-button {
  border-left: 1px solid var(--line);
  padding-left: 17px;
  margin-left: 8px;
  font-size: 20px;
  color: #baa780;
}
main {
  max-width: 1640px;
  margin: auto;
  padding: 26px 38px 50px;
  min-height: calc(100vh - 145px);
}
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1564px;
  margin: auto;
  padding: 20px 0;
  border-top: 1px solid #25323d;
  font-size: 9px;
  letter-spacing: 1.7px;
  color: #556777;
}
footer button {
  font-size: 11px;
  letter-spacing: 0;
}
.eyebrow,
.panel-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.8px;
  color: #94a3ae;
  line-height: 1.5;
}
.panel-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.panel-label button {
  font-size: 11px;
  letter-spacing: 0;
  color: #c4ac81;
}
.panel-label > span {
  font-size: 10px;
  letter-spacing: 0.5px;
  color: #6d8294;
}
.muted,
.fine-print {
  color: var(--muted);
}
.lead {
  font-size: 13px;
  line-height: 1.8;
  color: #8194a5;
  margin-top: 14px;
}
.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 12px 20px;
  font-size: 12px;
  border: 1px solid #566372;
  border-radius: 2px;
}
.primary {
  background: linear-gradient(#dbac65, #ac793e);
  border-color: #dfb372;
  box-shadow:
    inset 0 1px #fce1aa55,
    0 0 24px #dba25415;
  color: #161918;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.primary:hover:not(:disabled) {
  background: linear-gradient(#ebc183, #bd8a4a);
  color: #11171c;
  box-shadow: 0 0 28px #dba25435;
}
.secondary {
  background: linear-gradient(#1c2b38, #101c28);
  border-color: #394b5b;
  color: #b2c1cc;
}
.secondary:hover:not(:disabled) {
  background: #243a49;
  border-color: #627587;
}
.text-link {
  color: #c2a16c;
  font-size: 11px;
  border-bottom: 1px solid #c2a16c44;
  padding: 4px 0;
}
.lobby-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
}
.lobby-stage {
  position: relative;
  min-height: 650px;
  border: 1px solid #5d4e363e;
  background:
    linear-gradient(0deg, #060d19 0%, transparent 45%),
    linear-gradient(90deg, #080e1744, transparent 65%),
    url('/assets/foundry-keyart.png') 57% 45% / cover;
  overflow: hidden;
  box-shadow: inset 0 0 60px #0005;
}
.lobby-stage:after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 5px solid #080f153d;
  box-shadow: inset 0 0 1px 1px #d0a46822;
}
.stage-title {
  position: relative;
  padding: 48px 42px;
  z-index: 1;
}
.stage-title .eyebrow {
  font-size: 9px;
  letter-spacing: 3px;
  color: #a08e78;
}
.stage-title h1 {
  font-family: var(--serif);
  font-size: clamp(48px, 5.2vw, 80px);
  font-weight: 600;
  letter-spacing: 4px;
  line-height: 0.96;
  margin-top: 18px;
  text-shadow: 0 4px 15px #000b;
  color: #e8d3b0;
}
.stage-title h1 span {
  font-size: 0.59em;
  letter-spacing: 11px;
  color: #bca984;
  display: block;
  margin-top: 13px;
}
.stage-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 27px 32px;
  display: flex;
  align-items: end;
  gap: 20px;
  justify-content: space-between;
  background: linear-gradient(transparent, #07101cec);
}
.stage-bottom .eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: #9a7b53;
}
.stage-bottom h2 {
  font-size: 33px;
  margin-top: 7px;
  color: #ebd9bb;
}
.stage-bottom p {
  font-size: 12px;
  color: #8fa0ad;
  margin-top: 9px;
}
.stage-bottom .secondary {
  font-size: 10px;
  white-space: nowrap;
}
.match-panel {
  border: 1px solid #33424f;
  background: linear-gradient(135deg, #17232e, #0e1823);
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.panel-heading {
  border-bottom: 1px solid #2c3b46;
  padding-bottom: 15px;
  margin-bottom: 14px;
}
.panel-heading .eyebrow {
  font-size: 9px;
  color: #c7a56d;
}
.panel-heading h2 {
  font-size: 23px;
  margin-top: 7px;
}
.mode-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mode {
  position: relative;
  display: flex;
  text-align: left;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #253643;
  background: #101b26;
  min-height: 59px;
}
.mode:hover:not(:disabled) {
  background: #1b2b38;
  border-color: #466073;
}
.mode.chosen {
  background: linear-gradient(90deg, #9c793126, #182934);
  border-color: #ae895355;
}
.mode.chosen:before {
  content: '';
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: #e3b571;
  box-shadow: 0 0 12px #e3b57155;
}
.mode-icon {
  font-family: var(--serif);
  font-size: 21px;
  width: 25px;
  text-align: center;
  color: #789199;
  flex: none;
}
.chosen .mode-icon {
  color: #c5ab7b;
}
.mode strong {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: #c5d2db;
}
.mode small {
  display: block;
  font-size: 9px;
  color: #738a9c;
  margin-top: 3px;
}
.radio {
  margin-left: auto;
  display: grid;
  place-items: center;
  border: 1px solid #50606a;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  font-size: 7px;
  color: #e3b571;
}
.chosen .radio {
  border-color: #aa8b57;
}
.difficulty-panel {
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line);
}
.difficulty-panel .panel-label {
  font-size: 9px;
  letter-spacing: 1px;
}
.difficulty-panel output {
  font: 17px var(--serif);
  color: #e6bf81;
}
.difficulty-presets {
  display: flex;
  margin: 10px 0 6px;
  gap: 5px;
}
.difficulty-presets button {
  flex: 1;
  border: 1px solid #2d4050;
  padding: 5px 0;
  font-size: 9px;
  color: #7e93a4;
}
.difficulty-presets button.chosen {
  border-color: #8b744e;
  background: #96763d20;
  color: #e1c397;
}
.difficulty-panel input {
  width: 100%;
  height: 4px;
  padding: 0;
  margin: 10px 0 5px;
  accent-color: #d9a75e;
  cursor: pointer;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  color: #6f8190;
}
.difficulty-panel p {
  font-size: 9px;
  line-height: 1.6;
  color: #6f8595;
  margin-top: 8px;
}
.loadout {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.loadout .panel-label {
  font-size: 8px;
  letter-spacing: 1px;
}
.loadout h3 {
  font-size: 19px;
  margin: 6px 0;
}
.loadout p {
  font-size: 10px;
  color: #6d8495;
}
.loadout p span {
  margin: 0 7px;
}
.room-box {
  padding: 15px 0;
}
.room-actions {
  display: flex;
  gap: 7px;
}
.room-actions .secondary {
  padding: 9px 10px;
  font-size: 10px;
  white-space: nowrap;
}
.room-actions form {
  display: flex;
  border: 1px solid #304555;
  min-width: 0;
  flex: 1;
}
.room-actions input {
  border: 0;
  width: 100%;
  background: #0c1723;
  padding: 7px 9px;
  font-size: 10px;
}
.room-actions form button {
  font-size: 10px;
  padding: 0 8px;
  color: #c8ac77;
  background: #192836;
}
.room-code {
  font: 24px monospace;
  letter-spacing: 5px;
  padding: 6px 0;
  color: #b6d3c8;
}
.room-code small {
  font-size: 15px;
}
.room-members {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}
.room-members small {
  font-size: 10px;
  color: #758c9b;
}
.match-panel > .primary {
  width: 100%;
  margin-top: auto;
  justify-content: space-between;
  padding: 14px 20px;
}
.queue-status {
  font-size: 11px;
  color: #cab283;
  margin-bottom: 9px;
}
.lobby-bottom {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
.unit-inspector {
  display: flex;
  min-height: 265px;
  border: 1px solid #2b3948;
  background: radial-gradient(ellipse at 25% 65%, #32454955, transparent 60%), #101a26;
  overflow: hidden;
}
.inspector-model {
  width: 43%;
  flex: none;
  min-height: 250px;
  background: linear-gradient(90deg, transparent, #0e182255);
}
#showcase {
  width: 100%;
  height: 100%;
  min-height: 265px;
  display: block;
}
.inspector-info {
  align-self: center;
  padding: 20px 25px 20px 0;
}
.inspector-info > .eyebrow {
  font-size: 8px;
  color: #a4885b;
}
.inspector-info select {
  display: block;
  font: 21px var(--serif);
  padding: 8px 22px 8px 0;
  background: transparent;
  border: 0;
  width: 100%;
  color: #ddc39c;
}
.inspector-info select option {
  background: #14202c;
  color: #d8e3e8;
}
.unit-role {
  font-size: 10px;
  color: #65b0aa;
  margin: 0 0 10px;
}
.unit-lore {
  font: italic 13px/1.65 var(--serif);
  color: #8c9ba6;
  max-width: 290px;
}
.inspector-stats {
  display: flex;
  gap: 23px;
  margin: 14px 0;
  font-size: 8px;
  letter-spacing: 0.5px;
  color: #6a8191;
}
.inspector-stats b {
  display: block;
  font: 19px var(--serif);
  color: #c6cfd2;
  margin-bottom: 3px;
}
.map-brief {
  border: 1px solid #2b3948;
  background: #0f1b26;
  padding: 17px 20px;
  display: flex;
  flex-direction: column;
}
.map-brief .panel-label {
  font-size: 9px;
}
#preview {
  width: 100%;
  height: 190px;
  display: block;
  margin: 8px 0;
}
.route-stats {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid #293943;
  padding-top: 11px;
  font-size: 8px;
  letter-spacing: 1px;
  color: #6d8797;
}
.route-stats b {
  display: block;
  margin-top: 4px;
  font: 18px var(--serif);
  color: #b9c9ce;
}
.route-stats em {
  font: 10px var(--sans);
  color: #d4ae6f;
  margin-left: 10px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 0 30px;
}
.page-heading .eyebrow {
  font-size: 9px;
  color: #a78a5c;
}
.page-heading h1 {
  margin-top: 10px;
  font-size: 40px;
  color: #d6c5a8;
}
.arsenal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 24px;
}
.collection-tools {
  display: flex;
  gap: 15px;
  justify-content: space-between;
  margin-bottom: 20px;
  align-items: center;
}
.filters {
  display: flex;
  gap: 4px;
}
.filters button {
  padding: 8px 12px;
  font-size: 10px;
  color: #8097a7;
  border: 1px solid transparent;
}
.filters button.chosen {
  background: #b28b4220;
  border: 1px solid #866c444d;
  color: #d6b983;
}
#card-search {
  font-size: 11px;
  max-width: 190px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.unit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid #3d4b50;
  background: linear-gradient(#172735, #0d1723);
  padding: 0 13px 12px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 6px 12px #0003;
  transition:
    transform 0.2s,
    border-color 0.2s;
}
.unit-card:hover {
  transform: translateY(-4px);
  border-color: #a68f60;
}
.unit-card.legendary {
  border-color: #987039;
  background: linear-gradient(#3d2c1e, #141b23);
}
.card-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 7px;
  letter-spacing: 0.8px;
  color: #acbac0;
  z-index: 1;
  text-shadow: 0 1px 5px #000;
}
.cost {
  display: grid;
  place-items: center;
  width: 28px;
  height: 31px;
  background: linear-gradient(#235169, #102533);
  border: 1px solid #6999a7;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  font: 17px var(--serif);
  color: #d1eff5;
  flex: none;
  filter: drop-shadow(0 2px 4px #000);
}
.legendary .cost {
  background: linear-gradient(#8e6936, #362515);
  color: #ffe0a9;
}
.copy-count {
  margin-left: auto;
  background: #080e17a8;
  padding: 2px 4px;
  font: 9px monospace;
}
.card-art {
  height: auto;
  aspect-ratio: 1.28;
  margin: 0 -13px;
  overflow: hidden;
  background: #0b151e;
}
.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.unit-card h3 {
  font-size: 17px;
  color: #d9d4c2;
  position: relative;
  margin: -8px 0 5px;
}
.legendary h3 {
  color: #dcbc7f;
}
.card-role {
  font-size: 8px;
  letter-spacing: 0.5px;
  color: #66ada8;
  min-height: 12px;
}
.flavor {
  font: italic 11px/1.65 var(--serif);
  color: #8a99a2;
  min-height: 57px;
  padding: 9px 0;
}
.unit-card details {
  font-size: 9px;
  color: #728c9f;
  margin-bottom: 12px;
}
.unit-card summary {
  cursor: pointer;
}
.unit-card details p {
  font-size: 10px;
  line-height: 1.8;
  padding-top: 8px;
}
.card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}
.card-actions button {
  background: #1b2a36;
  border: 1px solid #324958;
  padding: 6px;
  font-size: 9px;
  color: #aec1cb;
}
.card-actions button:first-child {
  width: 26px;
  font-size: 13px;
}
.card-actions button:last-child {
  flex: 1;
}
.card-actions button:hover:not(:disabled) {
  background: #30434e;
  border-color: #9a865e;
}
.deck-panel {
  position: sticky;
  top: 20px;
  align-self: start;
  background: linear-gradient(145deg, #1b2933, #101925);
  border: 1px solid #35434c;
  padding: 20px;
}
.deck-panel > .eyebrow {
  color: #b0976a;
  font-size: 9px;
}
.deck-panel > select,
.deck-panel > input {
  width: 100%;
  margin-top: 13px;
}
.deck-panel > input {
  font: 20px var(--serif);
  color: #c8c3b4;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #32404a;
  padding: 10px 0;
}
.deck-counter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 17px 0;
}
.deck-counter strong {
  font: 27px var(--serif);
  color: #d9c597;
}
.deck-counter small {
  font: 10px var(--sans);
  color: #6f8798;
}
.deck-counter > span {
  font-size: 10px;
  color: #82a09f;
}
.deck-list {
  max-height: 350px;
  overflow: auto;
  scrollbar-color: #405362 #111c27;
  scrollbar-width: thin;
}
.deck-list > div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #293944;
  font-size: 10px;
  color: #a1b2bb;
}
.deck-list button {
  margin-left: auto;
  font-size: 10px;
  color: #8fa5b2;
}
.tiny-cost {
  display: grid;
  place-items: center;
  flex: none;
  width: 18px;
  height: 20px;
  color: #96cfdb;
  background: #1c3949;
  border: 1px solid #386174;
  font: 11px var(--serif);
}
.deck-validation {
  font-size: 10px;
  color: #7cba9c;
  margin: 16px 0;
}
.deck-validation.invalid {
  color: #c69b6a;
}
.deck-panel > .primary,
.full {
  width: 100%;
  margin-bottom: 8px;
}
.deck-utilities {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin: 12px 0;
  color: #7694a4;
}
.import-label {
  display: block;
  font-size: 10px;
  color: #7991a3;
  margin: 16px 0 10px;
}
.import-label input {
  font-size: 8px;
  width: 100%;
  padding: 6px;
  margin-top: 8px;
}
.fine-print {
  font-size: 9px;
  line-height: 1.7;
}
.archive-list {
  border-bottom: 1px solid #253744;
}
.replay-row {
  display: flex;
  align-items: center;
  gap: 24px;
  border-top: 1px solid #253744;
  padding: 24px 20px;
  background: #101c2744;
}
.replay-row:nth-child(2n) {
  background: #18252b44;
}
.replay-row > div {
  flex: 1;
}
.replay-row .eyebrow {
  font-size: 9px;
}
.replay-row h3 {
  font-size: 21px;
  margin: 8px 0;
}
.replay-row h3 em {
  color: #b2986c;
  font-size: 14px;
  padding: 0 10px;
}
.replay-row p {
  font-size: 11px;
  color: #8398a4;
}
.replay-seal {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  font: 32px var(--serif);
  color: #ac9163;
  border: 1px solid #6b5736;
  border-radius: 50%;
  flex: none;
}
.empty-state {
  padding: 80px 25px;
  text-align: center;
  border: 1px solid #2b3b49;
  background: #111c27;
}
.empty-state > span {
  font-size: 50px;
  color: #b59866;
}
.empty-state h2 {
  margin: 20px 0;
}
.empty-state p {
  max-width: 550px;
  color: #8196a5;
  margin: 0 auto 25px;
  font-size: 13px;
}
.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.manual-grid article {
  border: 1px solid #293c4a;
  background: linear-gradient(120deg, #182530, #101923);
  padding: 25px;
}
.manual-number {
  font: 20px var(--serif);
  color: #b99c6a;
}
.manual-grid h2 {
  font-size: 24px;
  margin: 12px 0;
}
.manual-grid p {
  font-size: 12px;
  line-height: 1.95;
  color: #91a1ad;
}
body[data-screen='battle'] main,
body[data-screen='replay'] main {
  max-width: 1800px;
  padding: 12px 24px 25px;
}
body[data-screen='battle'] footer {
  display: none;
}
.battle-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0 12px;
}
.battle-heading .eyebrow {
  font-size: 8px;
}
.battle-heading h2 {
  font-size: 22px;
  color: #cdbb9b;
  margin-top: 3px;
}
.battle-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.battle-actions .secondary {
  font-size: 10px;
  padding: 8px 14px;
}
.battle-actions select {
  font-size: 11px;
  padding: 8px;
}
.difficulty-badge {
  font: 9px var(--sans);
  color: #a08e6e;
  border: 1px solid #5c4c33;
  padding: 4px 7px;
  margin-left: 10px;
  vertical-align: middle;
  white-space: nowrap;
}
.battle-score {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  background: linear-gradient(90deg, #172e32, #111a26 40%, #111a26 60%, #352720);
  border: 1px solid #35404a;
  border-bottom: 0;
  padding: 10px 23px;
}
.battle-score > div:last-child {
  text-align: right;
}
.battle-score strong {
  font: 24px var(--serif);
  display: block;
  color: #c4d7da;
}
.battle-score strong small {
  font: 9px var(--sans);
  color: #64818c;
}
.team-name {
  font-size: 8px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.union {
  color: #66bdb7;
}
.rust-text {
  color: #cd8b6c;
}
.match-clock {
  text-align: center;
}
.match-clock strong {
  font-size: 22px;
}
.match-clock span {
  font-size: 8px;
  letter-spacing: 1px;
  color: #b29c72;
}
.battle-field {
  position: relative;
  border: 1px solid #38454d;
  background: #080f17;
  overflow: hidden;
}
#battle {
  display: block;
  width: 100%;
  height: calc(100dvh - 355px);
  min-height: 380px;
  max-height: 1000px;
  touch-action: none;
  cursor: crosshair;
}
.field-label {
  position: absolute;
  bottom: 12px;
  left: 18px;
  color: #8ba3a280;
  font-size: 9px;
  pointer-events: none;
}
.camera-controls {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  border: 1px solid #41565b;
  background: #0b1720dd;
  border-radius: 3px;
  font-size: 10px;
  color: #9fb9bd;
}
.camera-controls button {
  padding: 7px 11px;
  font-size: 12px;
}
.camera-controls button:last-child {
  font-size: 9px;
  border-left: 1px solid #37464c;
}
.camera-controls span {
  padding: 0 5px;
  min-width: 38px;
  text-align: center;
}
.hand-tray {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 22px;
  background: linear-gradient(#172532, #0f1b28);
  border: 1px solid #344753;
  border-top: 0;
  box-shadow: 0 -10px 35px #0003;
}
.energy-panel {
  width: 135px;
  flex: none;
}
.energy-panel > .eyebrow {
  font-size: 8px;
  color: #8ca4b1;
}
.energy-panel > div:nth-child(2) {
  margin: 7px 0;
}
.energy-panel strong {
  font: 36px var(--serif);
  color: #9ee0df;
}
.energy-panel > div > span {
  font-size: 11px;
  color: #5a8595;
  margin-left: 7px;
}
.energy-track {
  height: 5px;
  border: 1px solid #314758;
  background: #0a1722;
  margin: 10px 0;
}
.energy-track i {
  display: block;
  height: 100%;
  background: #78c8d0;
  box-shadow: 0 0 9px #78c8d050;
  transition: width 0.1s linear;
}
.energy-panel > small {
  font-size: 9px;
  color: #7ca7b5;
}
.hand {
  display: flex;
  justify-content: center;
  gap: 9px;
  flex: 1;
}
.hand-card {
  position: relative;
  flex: 1;
  max-width: 156px;
  min-width: 0;
  border: 1px solid #526577;
  border-radius: 5px 5px 2px 2px;
  background: #0d1824;
  padding: 0 0 8px;
  overflow: hidden;
  transition:
    transform 0.15s,
    border-color 0.15s,
    filter 0.15s;
  box-shadow: 0 3px 8px #0007;
}
.hand-card.legendary {
  border-color: #ae8041;
}
.hand-card.unaffordable {
  filter: saturate(0.45) brightness(0.65);
}
.hand-card.selected {
  transform: translateY(-13px);
  border-color: #dcefc5;
  box-shadow: 0 0 18px #dace8f55;
  filter: none;
}
.hand-card:hover {
  transform: translateY(-7px);
  filter: none;
}
.hand-card .cost {
  position: absolute;
  z-index: 1;
  left: 6px;
  top: 5px;
  width: 23px;
  height: 27px;
  font-size: 14px;
}
.hotkey {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 15px;
  height: 16px;
  background: #070e18cc;
  border: 1px solid #5d6d7466;
  font: 9px monospace;
  color: #91a7b4;
}
.hand-glyph {
  display: block;
  height: 82px;
  overflow: hidden;
}
.hand-glyph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hand-card strong {
  display: block;
  font: 12px var(--serif);
  color: #d1d6ce;
  margin: 0 4px;
  line-height: 1.2;
  min-height: 16px;
}
.hand-card small {
  display: block;
  font-size: 7px;
  color: #6f9ca6;
  margin-top: 3px;
}
.hand-help {
  font-size: 8px;
  line-height: 1.9;
  color: #6e8596;
  flex: none;
}
.hand-help span {
  font-size: 8px;
}
.replay-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border: 1px solid #354752;
  background: #101c28;
  font: 11px monospace;
}
.replay-controls .secondary {
  padding: 7px 14px;
  min-width: 85px;
  font-size: 10px;
}
.replay-controls input {
  flex: 1;
  padding: 0;
  accent-color: #caa36b;
  min-width: 40px;
}
.replay-controls select {
  padding: 7px;
  font-size: 10px;
}
.replay-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
.replay-details > section {
  border: 1px solid #2c4050;
  padding: 20px;
  background: #101b27;
}
.replay-details .eyebrow {
  font-size: 9px;
}
#replay-deck {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}
#replay-deck span {
  font-size: 10px;
  border: 1px solid #324859;
  padding: 6px 9px;
  background: #172836;
  color: #9db3bd;
}
#command-log {
  height: 220px;
  overflow: auto;
  margin-top: 14px;
  font-size: 11px;
  scrollbar-color: #425b6b #101b27;
  scrollbar-width: thin;
}
#command-log > div {
  border-bottom: 1px solid #263b49;
  padding: 6px 0;
  color: #a6b6bf;
}
#command-log time {
  font: 10px monospace;
  color: #bfa16f;
  margin-right: 10px;
}
#command-log small {
  float: right;
  color: #5b7c91;
}
#result-overlay:not(:empty) {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: #03081388;
  backdrop-filter: blur(4px);
}
.result {
  text-align: center;
  max-width: 90%;
  min-width: 330px;
  padding: 36px 45px;
  border: 1px solid #9b7d4a;
  background: radial-gradient(ellipse at 50% 10%, #87643133, transparent), #0a1522ee;
  box-shadow: 0 20px 60px #0009;
}
.result > .eyebrow {
  font-size: 9px;
  color: #a58b60;
}
.result h2 {
  font: 46px var(--serif);
  color: #e3c590;
  margin: 18px 0 10px;
  text-shadow: 0 0 25px #e3c59033;
}
.result p {
  color: #72889a;
  font-size: 11px;
  margin-bottom: 20px;
}
.result button {
  margin: 5px;
}
.result .secondary {
  font-size: 10px;
}
#toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 25px;
  transform: translate(-50%, 15px);
  max-width: 90vw;
  padding: 13px 23px;
  background: #162938;
  border: 1px solid #59798a;
  box-shadow: 0 7px 30px #0006;
  color: #bfd1db;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
#connection-note {
  padding: 10px;
  text-align: center;
  background: #59472c;
  color: #e3ccaa;
  font-size: 11px;
}
#connection-note[hidden] {
  display: none;
}
@media (min-width: 1600px) {
  .lobby-stage {
    min-height: 740px;
  }
  .stage-title {
    padding: 65px;
  }
  .stage-title h1 {
    font-size: 90px;
  }
  .match-panel {
    padding: 25px;
  }
  .mode {
    min-height: 65px;
  }
  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1200px) {
  .topbar {
    padding: 0 25px;
    gap: 22px;
  }
  .nav {
    padding: 0 15px;
  }
  .profile > button:first-of-type {
    max-width: 120px;
  }
  main {
    padding: 22px 25px 40px;
  }
  .lobby-layout {
    grid-template-columns: minmax(0, 1fr) 315px;
    gap: 15px;
  }
  .lobby-stage {
    background-position: 60% 50%;
    min-height: 700px;
  }
  .stage-title {
    padding: 35px 26px;
  }
  .stage-title h1 {
    font-size: 58px;
  }
  .stage-bottom {
    padding: 24px;
    flex-wrap: wrap;
  }
  .stage-bottom h2 {
    font-size: 29px;
  }
  .match-panel {
    padding: 17px;
  }
  .lobby-bottom {
    gap: 15px;
  }
  .inspector-info {
    padding-right: 16px;
  }
  .inspector-info select {
    font-size: 18px;
  }
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .arsenal-layout {
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 18px;
  }
  .hand-help {
    display: none;
  }
  .hand-tray {
    gap: 20px;
  }
  footer {
    margin: 0 25px;
  }
}
@media (max-width: 900px) {
  .topbar {
    gap: 16px;
    height: 68px;
  }
  .brand {
    font-size: 17px;
  }
  .brand-mark {
    width: 30px;
    height: 35px;
    font-size: 34px;
  }
  .brand-sub {
    font-size: 7px;
  }
  .nav {
    font-size: 10px;
    padding: 0 10px;
    letter-spacing: 0.9px;
  }
  .profile {
    gap: 7px;
    font-size: 10px;
  }
  .profile > button:first-of-type {
    max-width: 100px;
  }
  .sound-button {
    margin-left: 0;
    padding-left: 10px;
  }
  .lobby-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .lobby-stage {
    background-position: 67% 50%;
  }
  .stage-title h1 {
    font-size: 44px;
    letter-spacing: 2px;
  }
  .stage-title h1 span {
    letter-spacing: 8px;
  }
  .stage-bottom {
    padding: 20px;
  }
  .stage-bottom p {
    font-size: 11px;
  }
  .lobby-bottom {
    grid-template-columns: 1fr 1fr;
  }
  .inspector-model {
    width: 42%;
  }
  .inspector-info {
    padding: 16px 12px 16px 0;
  }
  .inspector-info select {
    font-size: 16px;
  }
  .unit-lore {
    font-size: 11px;
  }
  .inspector-stats {
    gap: 13px;
  }
  .inspector-stats b {
    font-size: 16px;
  }
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .collection-tools {
    flex-wrap: wrap;
  }
  #card-search {
    max-width: 100%;
    width: 100%;
  }
  .filters button {
    padding: 6px 9px;
  }
  .energy-panel {
    width: 110px;
  }
  .hand-tray {
    gap: 15px;
    padding: 12px;
  }
  .hand-glyph {
    height: 73px;
  }
  .hand-card strong {
    font-size: 11px;
  }
  .hand {
    gap: 7px;
  }
  .battle-heading h2 {
    font-size: 19px;
  }
  .difficulty-badge {
    font-size: 8px;
  }
  .battle-score strong {
    font-size: 21px;
  }
  .hand-card small {
    font-size: 6px;
  }
  .manual-grid article {
    padding: 20px;
  }
  .replay-row {
    gap: 15px;
  }
  .replay-row h3 {
    font-size: 19px;
  }
}
@media (max-width: 680px) {
  .topbar {
    height: auto;
    min-height: 72px;
    flex-wrap: wrap;
    padding: 16px 18px 0;
    gap: 14px;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    height: 40px;
    justify-content: space-between;
    gap: 0;
  }
  .nav {
    padding: 0 13px;
    font-size: 10px;
  }
  .brand {
    margin-right: auto;
  }
  .profile {
    margin-left: 0;
  }
  .profile > button:first-of-type {
    max-width: 110px;
  }
  main {
    padding: 16px 16px 30px;
  }
  .lobby-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  .lobby-stage {
    min-height: 360px;
    background-position: 50% 36%;
    border-bottom: 0;
  }
  .stage-title {
    padding: 24px;
  }
  .stage-title h1 {
    font-size: 49px;
  }
  .stage-title .eyebrow {
    font-size: 7px;
    letter-spacing: 2px;
  }
  .stage-bottom {
    padding: 20px;
    flex-wrap: nowrap;
  }
  .stage-bottom h2 {
    font-size: 25px;
  }
  .stage-bottom p {
    font-size: 10px;
    max-width: 220px;
  }
  .stage-bottom .secondary {
    padding: 8px 10px;
    font-size: 9px;
  }
  .match-panel {
    padding: 20px;
    min-height: 0;
    border-color: #41433d;
  }
  .panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 13px;
  }
  .panel-heading h2 {
    font-size: 21px;
    margin: 0;
  }
  .mode-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  .mode:first-child {
    grid-column: 1/-1;
  }
  .mode {
    padding: 10px 8px;
    gap: 8px;
  }
  .mode-icon {
    width: 18px;
    font-size: 18px;
  }
  .mode strong {
    font-size: 11px;
  }
  .mode small {
    font-size: 8px;
  }
  .difficulty-panel p {
    font-size: 10px;
  }
  .difficulty-panel .panel-label {
    font-size: 10px;
  }
  .difficulty-presets button {
    font-size: 10px;
    padding: 7px;
  }
  .room-actions .secondary,
  .room-actions input,
  .room-actions form button {
    font-size: 11px;
  }
  .lobby-bottom {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
  }
  .unit-inspector {
    min-height: 240px;
  }
  .inspector-info select {
    font-size: 22px;
  }
  .unit-lore {
    font-size: 12px;
  }
  .inspector-stats {
    gap: 22px;
  }
  .inspector-stats b {
    font-size: 20px;
  }
  .inspector-model {
    width: 43%;
  }
  .map-brief {
    padding: 16px;
  }
  #preview {
    height: 230px;
  }
  .page-heading {
    padding: 12px 0 25px;
  }
  .page-heading h1 {
    font-size: 34px;
  }
  .page-heading .lead {
    font-size: 12px;
  }
  .page-heading > .secondary {
    font-size: 10px;
    padding: 9px 12px;
    white-space: nowrap;
  }
  .arsenal-layout {
    display: flex;
    flex-direction: column-reverse;
  }
  .deck-panel {
    position: static;
    padding: 18px;
  }
  .deck-list {
    max-height: 160px;
  }
  .deck-panel > .eyebrow {
    font-size: 9px;
  }
  .deck-panel > select {
    margin-top: 8px;
  }
  .deck-counter {
    padding: 12px 0;
  }
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .unit-card {
    padding: 0 10px 10px;
  }
  .card-art {
    margin: 0 -10px;
  }
  .unit-card h3 {
    font-size: 15px;
  }
  .card-role {
    font-size: 7px;
  }
  .card-top {
    left: 6px;
    right: 6px;
    top: 6px;
    font-size: 6px;
    gap: 5px;
  }
  .cost {
    width: 23px;
    height: 27px;
    font-size: 14px;
  }
  .flavor {
    font-size: 10px;
    min-height: 65px;
  }
  .card-actions button {
    font-size: 8px;
  }
  .card-actions button:first-child {
    width: 23px;
  }
  .collection-tools {
    flex-wrap: nowrap;
  }
  #card-search {
    max-width: 150px;
    width: auto;
  }
  .filters {
    gap: 0;
  }
  .filters button {
    font-size: 9px;
    padding: 6px 8px;
  }
  .manual-grid {
    grid-template-columns: 1fr;
  }
  .manual-grid h2 {
    font-size: 22px;
  }
  .replay-row {
    padding: 20px 10px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .replay-row > .secondary {
    margin-left: 57px;
    font-size: 10px;
  }
  .replay-row h3 {
    font-size: 18px;
  }
  .replay-row .eyebrow {
    font-size: 8px;
  }
  .replay-row p {
    font-size: 10px;
  }
  body[data-screen='battle'] main,
  body[data-screen='replay'] main {
    padding: 12px 10px 20px;
  }
  .battle-heading {
    flex-wrap: wrap;
    padding-bottom: 10px;
  }
  .battle-heading h2 {
    font-size: 19px;
  }
  .battle-actions {
    gap: 5px;
  }
  .battle-actions .secondary {
    font-size: 9px;
    padding: 7px 10px;
  }
  .battle-actions select {
    font-size: 10px;
    padding: 7px;
  }
  .battle-score {
    padding: 9px 12px;
  }
  .team-name {
    font-size: 6px;
    letter-spacing: 0.8px;
  }
  .battle-score strong {
    font-size: 18px;
  }
  .battle-score strong small {
    font-size: 8px;
  }
  .match-clock span {
    font-size: 6px;
    letter-spacing: 0.5px;
  }
  #battle {
    height: 54dvh;
    min-height: 330px;
  }
  .camera-controls {
    top: 8px;
    right: 8px;
    font-size: 8px;
  }
  .camera-controls button {
    padding: 6px 8px;
    font-size: 11px;
  }
  .camera-controls button:last-child {
    font-size: 8px;
  }
  .camera-controls span {
    min-width: 31px;
  }
  .field-label {
    font-size: 7px;
    bottom: 8px;
    left: 10px;
  }
  .hand-tray {
    flex-wrap: wrap;
    padding: 10px;
    gap: 9px;
  }
  .energy-panel {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
  }
  .energy-panel > .eyebrow {
    font-size: 7px;
  }
  .energy-panel strong {
    font-size: 24px;
  }
  .energy-panel > div:nth-child(2) {
    margin: 0;
  }
  .energy-panel > div > span {
    font-size: 9px;
  }
  .energy-panel .energy-track {
    flex: 1;
    margin: 0;
  }
  .energy-panel > small {
    font-size: 8px;
  }
  .hand {
    width: 100%;
    gap: 6px;
    flex: auto;
  }
  .hand-glyph {
    height: 68px;
  }
  .hand-card {
    max-width: none;
    padding-bottom: 6px;
  }
  .hand-card strong {
    font-size: 10px;
    min-height: 24px;
    line-height: 1.15;
  }
  .hand-card small {
    display: none;
  }
  .hand-card .cost {
    width: 20px;
    height: 23px;
    font-size: 12px;
    left: 4px;
    top: 3px;
  }
  .hotkey {
    right: 4px;
    top: 4px;
    width: 12px;
    height: 14px;
    font-size: 8px;
  }
  .replay-controls {
    gap: 8px;
    padding: 9px;
    flex-wrap: wrap;
  }
  .replay-controls .secondary {
    font-size: 9px;
    padding: 6px 9px;
    min-width: 65px;
  }
  .replay-controls input {
    order: 5;
    width: 100%;
    flex: auto;
  }
  .replay-controls select {
    font-size: 9px;
    padding: 6px;
  }
  #replay-time {
    margin-left: auto;
    font-size: 9px;
  }
  .replay-details {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .result {
    min-width: 0;
    width: 85%;
    padding: 25px 18px;
  }
  .result h2 {
    font-size: 34px;
  }
  .result button {
    font-size: 10px;
    padding: 9px 14px;
  }
  .result p {
    margin-bottom: 12px;
  }
  .result > .eyebrow {
    font-size: 8px;
  }
  footer {
    margin: 0 16px;
    font-size: 8px;
    letter-spacing: 1px;
  }
}
@media (max-width: 440px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .collection-tools {
    flex-wrap: wrap;
  }
  #card-search {
    width: 100%;
    max-width: 100%;
  }
  .filters {
    width: 100%;
    justify-content: space-between;
  }
  .page-heading h1 {
    font-size: 31px;
  }
  .page-heading .eyebrow {
    font-size: 8px;
  }
  .stage-title h1 {
    font-size: 44px;
  }
  .lobby-stage {
    min-height: 330px;
  }
  .stage-bottom p {
    max-width: 170px;
  }
  .stage-bottom .secondary {
    font-size: 8px;
    padding: 7px 9px;
  }
  .mode-icon {
    display: none;
  }
  .mode {
    padding: 10px;
  }
  .mode strong {
    font-size: 11px;
  }
  .mode small {
    font-size: 8px;
  }
  .unit-inspector {
    min-height: 225px;
  }
  .inspector-info select {
    font-size: 18px;
  }
  .inspector-stats {
    gap: 13px;
  }
  .inspector-stats b {
    font-size: 18px;
  }
  .inspector-info .unit-lore {
    font-size: 11px;
  }
  .inspector-model {
    width: 43%;
  }
  #showcase {
    min-height: 225px;
  }
  .hand-glyph {
    height: 58px;
  }
  .hand-card strong {
    font-size: 9px;
  }
  .field-label {
    font-size: 6px;
  }
  .difficulty-badge {
    font-size: 7px;
    padding: 3px 5px;
    margin-left: 5px;
  }
  .energy-panel > small {
    font-size: 7px;
  }
  .replay-row > .secondary {
    margin-left: 0;
  }
  .replay-seal {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Keep the battlefield, score, cards and replay transport together in fullscreen. */
.battle-shell:fullscreen,
.battle-shell.expanded {
  box-sizing: border-box;
  width: 100%;
  height: 100dvh;
  padding: 12px;
  background: #080f17;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
.battle-shell.expanded {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.battle-shell:is(:fullscreen, .expanded) .battle-heading,
.battle-shell:is(:fullscreen, .expanded) .battle-score,
.battle-shell:is(:fullscreen, .expanded) .hand-tray,
.battle-shell:is(:fullscreen, .expanded) .replay-controls {
  flex-shrink: 0;
  margin: 0;
}
.battle-shell:is(:fullscreen, .expanded) .battle-field {
  flex: 1 0 180px;
  min-height: 180px;
}
.battle-shell:is(:fullscreen, .expanded) #battle {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
}
.battle-shell:is(:fullscreen, .expanded) .replay-details {
  display: none;
}
@media (max-height: 650px) {
  .battle-shell:is(:fullscreen, .expanded) .battle-heading .eyebrow,
  .battle-shell:is(:fullscreen, .expanded) .hand-help,
  .battle-shell:is(:fullscreen, .expanded) .field-label {
    display: none;
  }
  .battle-shell:is(:fullscreen, .expanded) .hand-card {
    height: 100px;
  }
  .battle-shell:is(:fullscreen, .expanded) .hand-glyph {
    height: 40px;
  }
}

/* Tatarorot: one consistent card frame, with roles readable without opening a toggle. */
.stage-title h1 {
  font-size: clamp(38px, 5.6vw, 86px);
  letter-spacing: -0.045em;
}
.brand {
  font-size: 20px;
  letter-spacing: 0.04em;
}
.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
  align-items: stretch;
  gap: 18px;
}
.unit-card,
.unit-info {
  --role-color: #d5a66b;
}
.role-ranged {
  --role-color: #63bebd;
}
.role-air {
  --role-color: #aaa0e7;
}
.role-support {
  --role-color: #89cca1;
}
.role-spell {
  --role-color: #db91ba;
}
.unit-card {
  padding: 16px;
  border: 1px solid #35434a;
  border-top: 3px solid var(--role-color);
  background: linear-gradient(145deg, #19252d, #101820 75%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.unit-card.legendary {
  border-top-color: #edc477;
}
.unit-card .card-top {
  padding: 0;
  min-height: 36px;
  font-size: 10px;
  letter-spacing: 0.07em;
}
.unit-card .copy-count {
  font-size: 10px;
}
.card-identity {
  display: grid;
  grid-template-columns: 105px 1fr;
  align-items: center;
  gap: 10px;
}
.card-identity .card-art {
  height: 112px;
  margin: 0;
  background: radial-gradient(ellipse, #35454c55, transparent 70%);
  overflow: visible;
}
.card-identity .card-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.card-identity h3 {
  margin: 0 0 7px;
  font-size: 21px;
  line-height: 1.13;
}
.card-identity .card-role {
  margin: 0;
  color: var(--role-color);
  font-size: 11px;
}
.trait-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-content: start;
}
.trait {
  font-size: 10px;
  font-weight: 650;
  border: 1px solid #485259;
  border-radius: 4px;
  padding: 4px 6px;
  background: #0d151c;
  color: #dce5e5;
  white-space: nowrap;
}
.trait-ranged,
.trait-chain {
  color: #8bdddc;
  border-color: #477a7b;
}
.trait-air,
.trait-spell,
.trait-legend {
  color: #d2bff5;
  border-color: #716482;
}
.trait-melee,
.trait-aoe,
.trait-burn {
  color: #f1b686;
  border-color: #846546;
}
.trait-heal {
  color: #a5e0b8;
  border-color: #50836a;
}
.trait-slow {
  color: #9ad9f3;
  border-color: #4a7a92;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: #36434a;
  border: 1px solid #36434a;
  border-radius: 6px;
  overflow: hidden;
  margin: 0;
}
.stat-grid > div {
  padding: 10px 7px;
  background: #111b23;
  min-width: 0;
}
.stat-grid dt {
  font-size: 9px;
  text-transform: uppercase;
  color: #9cb0b9;
  margin-bottom: 5px;
}
.stat-grid dd {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  color: #eff4e9;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.ability-list {
  padding: 0;
  margin: 0;
  list-style: none;
  color: #b8c8cf;
  font-size: 11px;
  line-height: 1.55;
}
.ability-list li {
  padding: 5px 0;
  border-bottom: 1px solid #ffffff0a;
}
.variant-stats {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: #bdcbd1;
}
.variant-stats b {
  color: #edd39b;
}
.unit-card .card-actions {
  margin-top: auto;
  padding-top: 8px;
}
.base-health-track {
  height: 12px;
  background: #070e15;
  border: 1px solid #708384;
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
  min-width: 100px;
  margin-top: 5px;
}
.base-health-track i {
  display: block;
  height: 100%;
  transition: width 0.1s linear;
}
.battle-score strong {
  font-variant-numeric: tabular-nums;
}
.queue-note {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 165px;
  z-index: 15;
  padding: 10px 14px;
  background: #142932f5;
  border: 1px solid #83c7b2;
  border-radius: 8px;
  box-shadow: 0 6px 25px #0009;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.queue-note[hidden] {
  display: none;
}
.queue-note span {
  color: #a5c8c5;
}
.battle-shell {
  position: relative;
}
.unit-info {
  position: absolute;
  right: 12px;
  top: 88px;
  z-index: 30;
  width: min(360px, calc(100% - 24px));
  max-height: calc(100% - 110px);
  overflow: auto;
  background: #111c25fa;
  border: 1px solid var(--role-color);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 12px 50px #000b;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.info-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #b2c4c9;
}
.info-heading button {
  font-size: 24px;
  padding: 2px 10px;
}
.live-unit-health {
  margin: 0;
  color: #9be4bd;
  font-size: 12px;
}
@media (max-width: 650px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  .queue-note {
    bottom: 130px;
    width: 95%;
    flex-wrap: wrap;
    gap: 6px;
  }
}
.unit-card .card-top,
.unit-info .card-top {
  position: static;
}
.card-identity .card-art {
  width: 105px;
  aspect-ratio: auto;
  min-width: 0;
  overflow: hidden;
}
.card-identity > div:last-child {
  min-width: 0;
}
.card-identity h3 {
  overflow-wrap: break-word;
}
.unit-info .card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.stat-grid dt {
  font-size: 10px;
}
.hand-card.queueable {
  border-color: #cdb879;
  filter: saturate(0.8) brightness(0.9);
}
.hand-card.queueable::after {
  content: 'CAN QUEUE';
  position: absolute;
  top: 8px;
  left: 35px;
  color: #e6d5a7;
  font-size: 8px;
  background: #1f2526;
  padding: 3px;
}
.difficulty-panel input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  vertical-align: middle;
}
.difficulty-panel a {
  color: #9edbd0;
}

/* Foundry composition: the illustration never inherits a mode panel's height. */
.lobby-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: clamp(430px, 38vw, 560px) auto;
  grid-template-areas: 'art setup' 'details setup';
  align-items: start;
  gap: 18px;
}
.lobby-stage {
  grid-area: art;
  height: 100%;
  min-height: 0;
  background-position: 57% 42%;
  border-radius: 5px;
}
.stage-title {
  padding: 32px;
}
.stage-title h1 {
  font-size: clamp(42px, 4.5vw, 66px);
  letter-spacing: 2px;
}
.stage-bottom {
  padding: 25px 30px;
}
.stage-bottom p {
  color: #b3c1cb;
}
.match-panel {
  grid-area: setup;
  padding: 18px;
  border-radius: 5px;
}
.panel-heading {
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.panel-heading h2 {
  font-size: 24px;
}
.mode {
  min-height: 57px;
  padding: 10px 12px;
  border-radius: 3px;
}
.mode strong {
  font-size: 13px;
}
.mode small {
  font-size: 11px;
  color: #9aafbf;
}
.mode-settings {
  min-height: 188px;
}
.mode-settings.has-remote {
  min-height: 305px;
}
.difficulty-panel .panel-label,
.loadout .panel-label {
  font-size: 10px;
}
.difficulty-panel p {
  font-size: 11px;
  color: #a0b2c0;
  line-height: 1.6;
}
.difficulty-presets button {
  font-size: 11px;
  min-height: 32px;
  color: #b3c2cd;
}
.difficulty-panel input[type='range'] {
  height: 16px;
  margin: 4px 0;
}
.difficulty-panel input[type='checkbox'] {
  width: 17px;
  height: 17px;
  margin: 0;
  flex: none;
}
.slider-labels {
  font-size: 10px;
  color: #9bafbe;
}
.online-brief h3 {
  margin-top: 12px;
  font-size: 20px;
  color: #dbc398;
}
.loadout {
  padding: 12px 0;
}
.loadout p,
.room-actions input,
.room-actions form button,
.room-actions .secondary {
  font-size: 12px;
}
.room-actions .secondary,
.room-actions form {
  min-height: 40px;
}
.lobby-bottom {
  grid-area: details;
  width: 100%;
  margin-top: 0;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
}
.lobby-bottom .unit-inspector {
  min-height: 268px;
}
.lobby-bottom .inspector-model {
  width: 40%;
}
.lobby-bottom .inspector-info {
  padding-right: 16px;
  min-width: 0;
}
.inspector-info > .eyebrow,
.map-brief .panel-label {
  font-size: 10px;
}
.inspector-stats {
  gap: 15px;
  color: #a1b4c0;
  font-size: 9px;
}
.unit-role {
  font-size: 12px;
}
.unit-lore {
  color: #aab9c3;
}
.training-preferences {
  margin-top: 18px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #101a24;
}
.training-preferences label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.training-preferences input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--teal);
}
.training-preferences p {
  margin: 8px 0;
  color: #9aafbf;
  font-size: 12px;
  max-width: 95ch;
}
.training-preferences a {
  color: var(--teal);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.field-label {
  color: #aec1cc;
  padding: 5px 9px;
  background: #08111dde;
  border-radius: 3px;
}
.camera-controls {
  box-shadow: 0 3px 14px #0005;
}
.camera-controls button {
  min-height: 36px;
}
.team-name,
.match-clock span,
.battle-heading .eyebrow {
  font-size: 10px;
}
@media (min-width: 901px) {
  #battle {
    height: calc(100dvh - 410px);
    min-height: 330px;
  }
}
@media (max-width: 1100px) and (min-width: 681px) {
  .lobby-layout {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
  .lobby-bottom {
    grid-template-columns: 1fr;
  }
  .stage-title {
    padding: 24px;
  }
  .stage-title h1 {
    font-size: 42px;
  }
}
@media (max-width: 680px) {
  .lobby-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 290px auto auto;
    grid-template-areas: 'art' 'setup' 'details';
    gap: 14px;
  }
  .lobby-stage {
    min-height: 0;
    height: 290px;
    background-position: 58% 40%;
    border: 1px solid #5d4e365e;
  }
  .stage-title {
    padding: 23px;
  }
  .stage-title h1 {
    font-size: 42px;
  }
  .stage-bottom {
    padding: 18px;
  }
  .stage-bottom p {
    max-width: 190px;
    font-size: 11px;
  }
  .stage-bottom h2 {
    font-size: 26px;
  }
  .stage-bottom .secondary {
    min-height: 40px;
  }
  .match-panel {
    padding: 16px;
  }
  .mode {
    min-height: 64px;
  }
  .mode strong {
    font-size: 12px;
  }
  .mode small {
    font-size: 10px;
  }
  .mode-settings {
    min-height: 198px;
  }
  .difficulty-presets button {
    min-height: 38px;
  }
  .lobby-bottom {
    grid-template-columns: 1fr;
  }
  .lobby-bottom .inspector-model {
    width: 42%;
  }
  .training-preferences {
    padding: 16px;
  }
}
/* Larger art within a common frame, with the statistical rows left intact. */
.card-identity {
  grid-template-columns: minmax(112px, 42%) minmax(0, 1fr);
  gap: 12px;
}
.card-identity .card-art {
  width: 100%;
  height: 132px;
  border-radius: 4px;
  border: 1px solid #41535a;
}
.card-identity .card-art img {
  object-fit: cover;
}
.card-identity h3 {
  font-size: 22px;
}
.unit-card {
  border-radius: 5px;
  box-shadow: 0 5px 16px #0002;
}
.unit-card .stat-grid {
  background: #0b141d;
  border-radius: 3px;
}
.card-actions button {
  min-height: 38px;
}
@media (max-width: 680px) {
  .arsenal-layout {
    flex-direction: column;
  }
  .deck-panel {
    scroll-margin-top: 80px;
  }
  .card-identity {
    grid-template-columns: 42% minmax(0, 1fr);
  }
}
/* Definite canvas height prevents backing-store dimensions feeding grid row sizing. */
.lobby-bottom .unit-inspector {
  height: 290px;
  min-height: 290px;
}
.lobby-bottom .inspector-model {
  height: 288px;
  min-height: 0;
}
.lobby-bottom #showcase {
  height: 288px;
  min-height: 0;
}
/* Battle layout spends remaining viewport space on the arena, without hiding the hand. */
body[data-screen='battle'] .battle-shell:not(:fullscreen, .expanded) {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: calc(100dvh - 113px);
  min-height: 450px;
}
body[data-screen='battle'] .battle-shell:not(:fullscreen, .expanded) .battle-field {
  min-height: 0;
}
body[data-screen='battle'] .battle-shell:not(:fullscreen, .expanded) #battle {
  height: 100%;
  min-height: 0;
  max-height: none;
}
.battle-score {
  padding: 7px 20px;
}
.base-health-track {
  height: 8px;
}
.battle-score strong {
  font-size: 22px;
}
.hand-tray {
  padding: 12px 16px;
  gap: 16px;
}
.hand-glyph {
  height: 68px;
}
.mobile-deck-summary,
.mobile-deck-back {
  display: none;
}
#card-collection,
#deck-editor {
  scroll-margin-top: 90px;
}
@media (max-height: 850px) and (min-width: 681px) {
  body[data-screen='battle'] .topbar {
    height: 60px;
  }
  body[data-screen='battle'] .battle-shell:not(:fullscreen, .expanded) {
    height: calc(100dvh - 97px);
  }
  .battle-heading {
    padding-bottom: 7px;
  }
  .battle-heading h2 {
    font-size: 20px;
  }
  .battle-score {
    padding-top: 5px;
    padding-bottom: 5px;
  }
  .hand-tray {
    padding-top: 9px;
    padding-bottom: 9px;
  }
  .hand-glyph {
    height: 58px;
  }
  .hand-help {
    display: none;
  }
}
@media (max-width: 680px) {
  body[data-screen='battle'] .battle-shell:not(:fullscreen, .expanded) {
    height: calc(100dvh - 138px);
    min-height: 480px;
  }
  .battle-score {
    padding: 7px 10px;
    grid-template-columns: minmax(0, 1fr) minmax(80px, 0.9fr) minmax(0, 1fr);
  }
  .team-name {
    font-size: 8px;
    letter-spacing: 0.5px;
  }
  .match-clock span {
    font-size: 8px;
  }
  .battle-score strong {
    font-size: 19px;
  }
  .base-health-track {
    min-width: 0;
  }
  .hand-tray {
    padding: 8px;
    gap: 7px;
  }
  .hand-glyph {
    height: 62px;
  }
  .field-label {
    font-size: 8px;
    max-width: calc(100% - 20px);
  }
  .mobile-deck-summary {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 4;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #172731;
    border: 1px solid #466068;
    margin-bottom: 16px;
    font-size: 12px;
  }
  .mobile-deck-summary button,
  .mobile-deck-back {
    color: #f0cd93;
    min-height: 40px;
    font-size: 12px;
  }
  .mobile-deck-back {
    display: block;
    margin-bottom: 14px;
  }
}
