:root {
  color-scheme: dark;
  --ink: #edf1e8;
  --muted: #a8b8b0;
  --panel: rgba(22, 39, 39, 0.96);
  --line: #435650;
  --gold: #dfc590;
  --blue: #7fc2d8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background: #233c3b;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: #2b4140;
  border: 1px solid #55645a;
  border-radius: 4px;
  padding: 9px 13px;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover {
  background: #3b5550;
  border-color: #bac5ab;
}
button:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button.active {
  border-color: var(--gold);
  background: #495348;
}
h1,
h2,
p {
  margin: 0;
}
h1,
h2,
.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}
h2 {
  font-size: 17px;
}
button small {
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
#game {
  height: 100dvh;
  min-height: 610px;
  position: relative;
  overflow: hidden;
}
#arena {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 83px;
  background: linear-gradient(#1c3030f7, #1c3030de);
  border-bottom: 1px solid #78846e55;
  display: flex;
  align-items: center;
  padding: 0 26px;
  gap: 32px;
}
.brand {
  font-size: 21px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  white-space: nowrap;
}
.brand small {
  display: block;
  font:
    16px "Segoe UI",
    Arial,
    sans-serif;
  color: var(--muted);
  margin-top: 5px;
  letter-spacing: 1px;
}
.crest {
  font-size: 39px;
  color: var(--gold);
}
.castle-status {
  width: 180px;
  font-size: 16px;
}
.castle-status .meter {
  margin: 7px 0 5px;
  height: 5px;
}
.castle-status small {
  color: var(--muted);
  font-size: 16px;
}
.meter {
  background: #132827;
  border-radius: 2px;
  height: 6px;
  overflow: hidden;
}
.meter i {
  height: 100%;
  width: 100%;
  background: #8dbd9c;
  display: block;
  transition: width 0.15s;
}
.enemy .meter i {
  background: #d88970;
}
.match-time {
  text-align: center;
}
.match-time strong {
  font:
    23px Georgia,
    serif;
  letter-spacing: 1px;
}
.match-time span {
  display: block;
  font-size: 16px;
  color: var(--muted);
  margin-top: 5px;
}
.top-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.top-actions button {
  height: 32px;
  min-width: 32px;
  padding: 4px 8px;
  font-size: 17px;
  background: transparent;
}
.economy {
  position: absolute;
  top: 103px;
  left: 26px;
  display: flex;
  gap: 23px;
  background: #203633e8;
  border: 1px solid #64786466;
  border-radius: 4px;
  padding: 11px 17px;
  box-shadow: 0 4px 18px #122b3430;
}
.economy div {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 7px;
  align-items: center;
}
.economy strong {
  font-size: 18px;
  font-weight: 500;
  color: var(--gold);
}
.economy span:last-child {
  grid-column: 2;
  font-size: 16px;
  color: #bac7b9;
}
.economy div:not(:first-child) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.coin {
  color: var(--gold);
  font-size: 22px;
  grid-row: span 2;
}
.economy b {
  font-weight: 400;
}
.map-title {
  position: absolute;
  top: 110px;
  right: 27px;
  text-align: right;
  color: #d0d7c1;
  text-shadow: 0 2px 5px #14332b;
}
.map-title span {
  font:
    16px Georgia,
    serif;
  letter-spacing: 3px;
}
.map-title small {
  display: block;
  margin-top: 6px;
  color: #b5c4ac;
  font:
    italic 12px Georgia,
    serif;
}
.command-deck {
  position: absolute;
  bottom: 38px;
  left: 18px;
  right: 18px;
  display: grid;
  grid-template-columns: 245px 1fr 1.27fr;
  background: var(--panel);
  border: 1px solid #78856b;
  border-top: 2px solid #a6ac86;
  border-radius: 7px;
  box-shadow: 0 10px 35px #10232170;
  min-height: 161px;
}
.command-deck article {
  padding: 15px 18px;
}
.command-deck article + article {
  border-left: 1px solid var(--line);
}
.hero-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.hero-sigil {
  width: 43px;
  height: 43px;
  background: #455650;
  border: 1px solid #9c9d7f;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  color: var(--gold);
}
.hero-heading h2 {
  font-size: 20px;
}
.hero-heading span:not(.hero-sigil) {
  color: var(--muted);
  font-size: 16px;
}
.hero-heading > b {
  font-size: 16px;
  color: var(--gold);
  margin-left: auto;
  white-space: nowrap;
}
.vital {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
  font-size: 16px;
}
.vital > span {
  width: 32px;
  color: var(--muted);
}
.vital .meter {
  flex: 1;
}
.vital > b {
  width: 52px;
  text-align: right;
  font-size: 16px;
  font-weight: 400;
}
.mana .meter i {
  background: #7ab6d0;
}
.subtle {
  border: 0;
  background: transparent;
  padding: 7px 0;
  color: var(--muted);
  font-size: 16px;
}
.subtle:hover {
  background: transparent;
  color: var(--ink);
}
#focus-btn {
  margin-top: 3px;
  width: 100%;
  text-align: left;
}
kbd {
  font:
    16px "Segoe UI",
    Arial,
    sans-serif;
  padding: 2px 4px;
  border: 1px solid #697b6c80;
  border-radius: 3px;
  color: #c6d0c3;
  white-space: nowrap;
}
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}
.panel-title > span {
  font-size: 16px;
  color: var(--muted);
}
.abilities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.ability {
  position: relative;
  padding: 9px 5px 7px;
  text-align: center;
  min-height: 101px;
  background: #314643;
}
.ability .ability-icon {
  display: block;
  color: var(--hero-color, var(--gold));
  font:
    29px Georgia,
    serif;
  line-height: 32px;
}
.ability kbd {
  position: absolute;
  left: 5px;
  top: 5px;
  font-size: 16px;
}
.ability .ability-name {
  display: block;
  margin-top: 5px;
  font-size: 16px;
}
.ability small {
  display: block;
  margin-top: 5px;
  font-size: 16px;
}
.ability.cooldown {
  background: #263936;
}
.buildings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.build-button {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 7px 8px;
  min-height: 50px;
  background: #2e4240;
  text-align: left;
}
.build-icon {
  font:
    25px Georgia,
    serif;
  color: #b9c9b4;
  width: 24px;
  text-align: center;
}
.build-button strong {
  display: block;
  font-size: 16px;
  font-weight: 400;
}
.build-button small {
  display: block;
  font-size: 16px;
  color: var(--gold);
  margin-top: 4px;
}
.build-button kbd {
  float: right;
  margin-left: 5px;
  font-size: 16px;
}
.message {
  position: absolute;
  bottom: 218px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 75%;
  padding: 8px 17px;
  color: #e3e7d7;
  background: #20352deb;
  border: 1px solid #7c8a6866;
  border-radius: 4px;
  text-align: center;
  font-size: 16px;
  pointer-events: none;
}
.control-strip {
  position: absolute;
  bottom: 0;
  height: 37px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 16px;
  color: #b6c5b7;
}
.control-strip kbd {
  margin-right: 3px;
}
.control-strip button {
  margin-left: auto;
  font-size: 16px;
  padding: 4px 10px;
  background: #203632;
}
.inspector {
  position: absolute;
  right: 25px;
  bottom: 225px;
  width: 255px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid #78856b;
  border-radius: 5px;
  box-shadow: 0 5px 20px #132d3650;
}
.inspector p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  margin: 8px 0;
}
.inspector button {
  width: 100%;
  font-size: 16px;
}
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: #142b2b7d;
  backdrop-filter: blur(5px);
}
.selection-dialog {
  width: min(1030px, 100%);
  background: linear-gradient(130deg, #233c3aed, #1b3030fc);
  border: 1px solid #768470;
  border-radius: 9px;
  padding: 27px 36px 17px;
  box-shadow: 0 35px 100px #10272590;
}
.intro {
  text-align: center;
}
.ornament {
  font-size: 36px;
  color: var(--gold);
  display: block;
}
.eyebrow {
  font:
    16px Georgia,
    serif;
  color: var(--gold);
  margin: 6px 0 14px;
}
.intro h1 {
  font-size: clamp(28px, 3.3vw, 44px);
  color: #f1eee0;
}
.intro > p:last-child {
  color: #b8c7be;
  font-size: 16px;
  line-height: 1.7;
  margin-top: 12px;
}
.hero-choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin-top: 25px;
}
.hero-choice {
  position: relative;
  text-align: left;
  padding: 0;
  background: #263d3b;
  border: 1px solid #52665b;
  overflow: hidden;
}
.hero-choice.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
.hero-art {
  height: 137px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 100%, var(--tint), #203533 80%);
}
.hero-art svg {
  height: 130px;
  width: 120px;
  filter: drop-shadow(0 8px 10px #10272690);
}
.hero-choice .choice-copy {
  padding: 14px;
}
.hero-choice h2 {
  font-size: 23px;
}
.hero-choice .title {
  color: var(--hero-color);
  font-size: 16px;
  margin: 4px 0 12px;
}
.hero-choice .bio {
  font-size: 16px;
  color: #b3c2b8;
  line-height: 1.6;
  min-height: 53px;
}
.hero-choice .role {
  display: block;
  margin-top: 12px;
  font-size: 16px;
  color: #d3ddcc;
}
.selected-check {
  position: absolute;
  top: 9px;
  right: 9px;
  background: var(--gold);
  color: #263b34;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: none;
  text-align: center;
  line-height: 20px;
}
.selected .selected-check {
  display: block;
}
.start-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  gap: 20px;
}
.start-row p {
  color: #aebfb4;
  font-size: 16px;
  line-height: 1.7;
}
.primary {
  background: #dfc590;
  border-color: #e6d2a8;
  color: #293c34;
  font-weight: 600;
  font-size: 16px;
  padding: 14px 25px;
  min-width: 210px;
}
.primary:hover {
  background: #eedbb2;
  border-color: #f8e7be;
}
.primary span {
  margin-left: 20px;
}
.selection-note {
  text-align: center;
  color: #829b8e;
  font-size: 16px;
  margin-top: 17px;
}
.small-dialog {
  background: var(--panel);
  border: 1px solid #78856b;
  border-radius: 8px;
  max-width: 430px;
  padding: 40px;
  text-align: center;
}
.small-dialog h1 {
  font-size: 40px;
  margin: 10px 0;
}
.small-dialog p {
  color: var(--muted);
  line-height: 1.7;
  margin: 15px 0 25px;
}
.small-dialog .subtle {
  display: block;
  margin: 15px auto 0;
}
dialog {
  max-width: 580px;
  background: #243d3a;
  color: var(--ink);
  border: 1px solid #87977d;
  border-radius: 8px;
  padding: 30px;
}
dialog::backdrop {
  background: #132827a6;
  backdrop-filter: blur(4px);
}
dialog h1 {
  font-size: 33px;
}
dialog li {
  padding: 6px 0;
  line-height: 1.65;
  color: #bdcbc0;
}
dialog p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 20px;
}
.dialog-close {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 23px;
  border: 0;
  background: none;
}
.load-error {
  position: absolute;
  inset: 20%;
  z-index: 30;
  background: #243d3a;
  padding: 35px;
  line-height: 1.8;
  border: 1px solid var(--gold);
}
@media (min-width: 1550px) {
  .command-deck {
    left: 4%;
    right: 4%;
    grid-template-columns: 280px 1fr 1.25fr;
  }
  .command-deck article {
    padding: 20px 25px;
  }
  .message {
    bottom: 232px;
  }
}
@media (max-width: 1100px) {
  .topbar {
    gap: 20px;
    padding: 0 18px;
  }
  .brand {
    font-size: 17px;
  }
  .castle-status {
    width: 135px;
  }
  .command-deck {
    grid-template-columns: 205px 1fr 1.15fr;
    left: 10px;
    right: 10px;
  }
  .command-deck article {
    padding: 13px 10px;
  }
  .panel-title {
    display: block;
  }
  .panel-title > span {
    display: block;
    margin-top: 5px;
  }
  .build-button {
    padding: 5px;
    gap: 4px;
  }
  .build-button strong {
    font-size: 16px;
  }
  .build-icon {
    font-size: 21px;
  }
  .hero-heading {
    gap: 6px;
  }
  .ability .ability-name {
    font-size: 16px;
  }
  .control-strip {
    gap: 10px;
  }
  .control-strip > span:nth-child(2) {
    display: none;
  }
  .hero-choice .choice-copy {
    padding: 10px;
  }
  .selection-dialog {
    padding: 20px 25px 15px;
  }
  .intro h1 {
    font-size: 36px;
  }
  .hero-art {
    height: 105px;
  }
  .hero-art svg {
    height: 110px;
  }
  .hero-choice .bio {
    min-height: 68px;
  }
  .message {
    bottom: 235px;
  }
}
@media (max-width: 760px) {
  #game {
    min-height: 650px;
  }
  .topbar {
    height: 68px;
    gap: 12px;
    padding: 0 12px;
  }
  .brand {
    font-size: 16px;
  }
  .brand .crest {
    font-size: 29px;
  }
  .brand small {
    font-size: 16px;
    letter-spacing: 0;
  }
  .castle-status {
    width: 75px;
    font-size: 16px;
  }
  .castle-status small {
    font-size: 16px;
  }
  .match-time strong {
    font-size: 18px;
  }
  .top-actions {
    gap: 3px;
  }
  .top-actions button {
    min-width: 27px;
    padding: 3px;
    font-size: 16px;
  }
  .top-actions #sound-btn {
    display: none;
  }
  .economy {
    top: 82px;
    left: 12px;
    padding: 8px 12px;
    gap: 16px;
  }
  .map-title {
    display: none;
  }
  .command-deck {
    grid-template-columns: 165px 1fr;
    bottom: 32px;
  }
  .build-panel {
    grid-column: 1 / -1;
    border-left: 0 !important;
    border-top: 1px solid var(--line);
  }
  .build-panel .panel-title {
    display: none;
  }
  .buildings {
    grid-template-columns: repeat(6, 1fr);
  }
  .build-button {
    display: block;
    text-align: center;
    min-height: 64px;
  }
  .build-icon {
    font-size: 20px;
  }
  .build-button strong {
    font-size: 16px;
    white-space: normal;
  }
  .build-button kbd {
    display: none;
  }
  .hero-heading h2 {
    font-size: 17px;
  }
  .hero-heading > b {
    font-size: 16px;
  }
  .hero-sigil {
    width: 31px;
    height: 35px;
    font-size: 23px;
  }
  .hero-heading span:not(.hero-sigil) {
    font-size: 16px;
  }
  .abilities-panel .panel-title > span {
    display: none;
  }
  .ability {
    min-height: 94px;
  }
  .hero-panel .subtle {
    font-size: 16px;
  }
  .control-strip {
    bottom: 0;
    height: 31px;
    font-size: 16px;
    left: 12px;
    right: 12px;
  }
  .control-strip > span {
    font-size: 0;
  }
  .control-strip > span kbd {
    font-size: 16px;
  }
  .message {
    bottom: 305px;
    font-size: 16px;
    max-width: 90%;
    width: max-content;
  }
  .inspector {
    bottom: 307px;
    width: 220px;
    right: 12px;
    padding: 12px;
  }
  .overlay {
    padding: 14px;
    overflow: auto;
  }
  .selection-dialog {
    padding: 18px 18px 12px;
    max-height: 96%;
    overflow: auto;
  }
  .intro .ornament {
    display: none;
  }
  .eyebrow {
    margin: 0 0 8px;
  }
  .intro h1 {
    font-size: 29px;
  }
  .intro > p:last-child {
    font-size: 16px;
    line-height: 1.5;
    margin-top: 8px;
  }
  .hero-choices {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 17px;
  }
  .hero-art {
    height: 75px;
  }
  .hero-art svg {
    height: 88px;
  }
  .hero-choice h2 {
    font-size: 20px;
  }
  .hero-choice .bio {
    display: none;
  }
  .hero-choice .title {
    margin: 3px 0 0;
  }
  .hero-choice .role {
    margin-top: 8px;
  }
  .hero-choice .choice-copy {
    padding: 9px 12px;
  }
  .start-row {
    margin-top: 16px;
  }
  .start-row p {
    display: none;
  }
  .start-row .primary {
    width: 100%;
  }
  .selection-note {
    font-size: 16px;
    margin-top: 12px;
  }
  .small-dialog {
    padding: 30px 22px;
  }
  dialog {
    margin: auto 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
@media (max-height: 730px) and (min-width: 761px) {
  .selection-dialog {
    padding-top: 14px;
    padding-bottom: 12px;
  }
  .intro .ornament {
    display: none;
  }
  .intro h1 {
    font-size: 34px;
  }
  .hero-choices {
    margin-top: 17px;
  }
  .hero-art {
    height: 95px;
  }
  .hero-art svg {
    height: 105px;
  }
  .hero-choice .bio {
    min-height: 53px;
  }
  .start-row {
    margin-top: 17px;
  }
}

.camera-controls {
  position: absolute;
  top: 154px;
  right: 26px;
  display: flex;
  gap: 4px;
}
.camera-controls button {
  width: 31px;
  height: 30px;
  padding: 3px;
  background: #233c39db;
  font-size: 17px;
}
@media (max-width: 760px) {
  #arena {
    top: 145px;
    bottom: 285px;
    height: calc(100% - 430px);
  }
  .camera-controls {
    top: 106px;
    right: 12px;
  }
  .camera-controls button {
    width: 28px;
    height: 28px;
  }
}
@media (max-width: 540px) {
  .topbar {
    height: 97px;
    display: grid;
    grid-template-columns: 1fr 60px 1fr;
    grid-template-rows: 34px 42px;
    gap: 5px 12px;
    padding: 6px 12px;
  }
  .brand {
    grid-column: 1 / 3;
    grid-row: 1;
    font-size: 16px;
  }
  .top-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }
  .castle-status {
    width: 100%;
    font-size: 16px;
    grid-row: 2;
  }
  .castle-status.ally {
    grid-column: 1;
  }
  .castle-status.enemy {
    grid-column: 3;
    text-align: right;
  }
  .castle-status small {
    display: none;
  }
  .castle-status .meter {
    margin-top: 6px;
  }
  .match-time {
    grid-column: 2;
    grid-row: 2;
  }
  .match-time strong {
    font-size: 17px;
  }
  .match-time span {
    font-size: 16px;
    margin-top: 3px;
  }
  .economy {
    top: 108px;
    gap: 13px;
    padding: 7px 10px;
  }
  .economy strong {
    font-size: 16px;
  }
  .economy span:last-child {
    font-size: 16px;
  }
  .camera-controls {
    top: 117px;
  }
  #arena {
    top: 162px;
    bottom: 285px;
    height: calc(100% - 447px);
  }
}
/* Friend matches reuse hero selection as a team lobby. */
.selection-dialog {
  max-height: 96dvh;
  overflow: auto;
}
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 17px;
}
.mode-tabs button {
  font-size: 16px;
  padding: 8px 20px;
}
.network-setup {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
#room-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
#room-entry > span,
#room-entry label {
  color: var(--muted);
  font-size: 16px;
}
.network-setup input {
  background: #172f2d;
  border: 1px solid #62796a;
  border-radius: 4px;
  color: var(--ink);
  padding: 11px 12px;
  font: 16px inherit;
  min-width: 0;
}
#hero-room-code {
  width: 100px;
  text-transform: uppercase;
  letter-spacing: 2px;
}
#network-status {
  font-size: 16px;
  line-height: 1.6;
  color: #c4d4c7;
  margin-top: 13px;
  text-align: center;
  min-height: 20px;
}
.lobby-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.lobby-heading strong {
  color: var(--gold);
  letter-spacing: 3px;
  margin-left: 8px;
}
.lobby-heading button {
  font-size: 16px;
}
.lobby-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 15px 0;
}
.lobby-players > div {
  background: #2b4541;
  padding: 12px;
  border: 1px solid #567461;
  border-radius: 4px;
}
.lobby-players strong {
  display: block;
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 6px;
}
.lobby-players span {
  font-size: 16px;
  color: var(--muted);
}
.invite-row {
  display: flex;
  gap: 9px;
  align-items: center;
}
#invite-link {
  flex: 1;
  font-size: 16px;
}
.invite-row button {
  font-size: 16px;
  white-space: nowrap;
}
.invite-row .primary {
  min-width: 160px;
}
.connection-banner {
  position: absolute;
  top: 155px;
  left: 50%;
  transform: translateX(-50%);
  background: #473b25f5;
  border: 1px solid var(--gold);
  color: #f0e2bd;
  padding: 12px 20px;
  border-radius: 5px;
  text-align: center;
  z-index: 5;
  max-width: 85%;
}
#leave-result {
  display: block;
  margin: 14px auto 0;
}
@media (max-width: 760px) {
  #room-entry {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  #room-entry .primary {
    grid-column: 1 / -1;
  }
  #room-entry > span,
  #room-entry label {
    display: none;
  }
  #hero-room-code {
    width: 100%;
  }
  .invite-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  #invite-link {
    grid-column: 1 / -1;
    width: 100%;
  }
  .invite-row .primary {
    min-width: 0;
    white-space: normal;
    padding: 12px;
  }
  .mode-tabs {
    margin-top: 12px;
  }
  .mode-tabs button {
    padding: 7px 15px;
    font-size: 16px;
  }
  .network-setup {
    margin-top: 14px;
    padding-top: 14px;
  }
  .connection-banner {
    top: 165px;
    font-size: 16px;
    width: 90%;
    padding: 10px;
  }
}
/* Team lobby and battlefield navigation. */
select {
  font: inherit;
  color: var(--cream, #e6dec7);
  background: #263e3c;
  border: 1px solid #6b7867;
  border-radius: 6px;
  padding: 9px;
  cursor: pointer;
}
#room-entry {
  flex-wrap: wrap;
}
.bot-option {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bot-option input {
  width: 18px !important;
  accent-color: #d4b876;
}
.lobby-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.lobby-players > div {
  padding: 9px 12px;
  border-left: 3px solid #80b4bd;
}
.lobby-players > .team-enemy {
  border-left-color: #c88470;
}
.lobby-players strong {
  font-size: 16px;
}
.lobby-players span {
  font-size: 16px;
}
.invite-row {
  flex-wrap: wrap;
}
.selection-dialog {
  max-height: 94vh;
  overflow: auto;
}
.start-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.minimap {
  position: absolute;
  right: 22px;
  bottom: 236px;
  width: 190px;
  height: 134px;
  border: 2px solid #b5aa80;
  border-radius: 4px;
  box-shadow: 0 4px 20px #17312f80;
  cursor: crosshair;
  background: #486958;
}
.inspector {
  right: 226px;
}
.control-strip {
  font-size: 16px;
}
.control-strip kbd {
  margin-left: 7px;
}
#sell-btn {
  margin-top: 7px;
  color: #dcccaa;
}
@media (max-width: 900px) {
  .minimap {
    width: 130px;
    height: 92px;
    right: 12px;
    bottom: 350px;
  }
  .inspector {
    right: 155px;
  }
  .start-row {
    flex-wrap: wrap;
  }
  .control-strip > span:nth-child(2) {
    display: none;
  }
}
@media (max-width: 600px) {
  .minimap {
    bottom: 326px;
    width: 96px;
    height: 68px;
  }
  .inspector {
    right: 12px;
    bottom: 400px;
  }
  .lobby-players {
    grid-template-columns: 1fr;
  }
  .start-row label {
    font-size: 16px;
  }
  .control-strip {
    font-size: 16px;
  }
}
#graphics-quality {
  font-size: 16px;
  padding: 7px;
  max-width: 110px;
  color: #e8e4cf;
  background: #253f3c;
  border-color: #6c7f6d;
}
@media (max-width: 600px) {
  #graphics-quality {
    max-width: 95px;
    font-size: 16px;
  }
}

/* Ancient bridge controls: four active abilities and eight class buildings. */
:root {
  --panel: rgba(22, 32, 43, 0.97);
  --line: #46515b;
  --muted: #adb9c2;
}
body {
  background: #131f2b;
}
.topbar {
  background: linear-gradient(#1a2735fa, #1a2735e8);
}
.turret-status {
  display: block;
  margin-top: 3px;
  color: var(--gold) !important;
}
.command-deck {
  grid-template-columns: 220px 1fr 1.3fr;
  min-height: 207px;
  border-color: #929681;
}
.command-deck article {
  padding: 13px 14px;
  min-width: 0;
}
.abilities {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.ability {
  min-height: 105px;
  padding-top: 17px;
}
.ability .ability-name {
  min-height: 26px;
  font-size: 16px;
  line-height: 1.3;
}
.abilities-panel .panel-title {
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}
.abilities-panel .panel-title > span {
  font-size: 16px;
}
.form-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border-color: #8199a9;
  background: #293c50;
}
.form-toggle[aria-pressed="true"] {
  border-color: #bb9b69;
  background: #554431;
}
.form-toggle > span:first-child {
  font:
    17px Georgia,
    serif;
}
.form-toggle > span:last-child {
  color: var(--gold);
}
.buildings {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
.build-button {
  gap: 5px;
  padding: 6px;
  min-height: 62px;
}
.build-button strong {
  line-height: 1.25;
}
.build-icon {
  width: 19px;
  flex-shrink: 0;
  font-size: 22px;
}
.build-button > span:last-child {
  min-width: 0;
  flex: 1;
}
.build-button kbd {
  float: none;
  margin-left: 1px;
  padding: 1px 3px;
}
.recall-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 10px;
  padding: 7px 9px;
  color: #c5e2ed;
  background: #2a4054;
  border-color: #7093a4;
}
.recall-button.echo-active {
  color: #e2f7ff;
  border-color: #9adbea;
  box-shadow: inset 0 0 12px #6ac1d025;
}
.hero-heading {
  margin-bottom: 10px;
}
#focus-btn {
  margin-top: 2px;
  padding: 5px 0;
}
.message {
  bottom: 260px;
  max-width: 65%;
  background: #1e2c3bec;
}
.minimap {
  right: 22px;
  bottom: 302px;
  width: 300px;
  height: 82px;
  background: #101a28;
}
.inspector {
  right: 22px;
  bottom: 400px;
}
.economy {
  background: #1e2e3ce8;
  gap: 18px;
}
.map-title {
  color: #dedbce;
  text-shadow: 0 2px 8px #08101f;
}
.map-title small {
  color: #b5c3d0;
}
.selection-dialog {
  background: linear-gradient(130deg, #26384ced, #172633fc);
}
.hero-choice {
  background: #25394a;
}
.hero-art {
  background: radial-gradient(ellipse at 50% 100%, var(--tint), #1d2c3d 80%);
}
.small-dialog,
dialog {
  background: #1e3042;
}
@media (min-width: 1550px) {
  .command-deck {
    grid-template-columns: 260px 1fr 1.25fr;
  }
  .command-deck article {
    padding: 15px 22px;
  }
  .message {
    bottom: 270px;
  }
  .minimap {
    width: 352px;
    height: 96px;
    bottom: 310px;
  }
  .inspector {
    bottom: 420px;
  }
}
@media (max-width: 1100px) {
  .command-deck {
    grid-template-columns: 185px 1fr 1.2fr;
  }
  .command-deck article {
    padding: 12px 9px;
  }
  .build-button {
    display: block;
    text-align: center;
    min-height: 64px;
    padding: 4px 3px;
  }
  .build-icon {
    display: none;
  }
  .build-button strong {
    min-height: 25px;
  }
  .build-panel .panel-title {
    margin-bottom: 9px;
  }
  .abilities-panel .panel-title {
    display: flex;
  }
  .message {
    bottom: 266px;
  }
  .minimap {
    width: 264px;
    height: 72px;
    bottom: 315px;
  }
  .inspector {
    right: 22px;
    bottom: 400px;
  }
}
@media (max-width: 760px) {
  .command-deck {
    grid-template-columns: 160px minmax(0, 1fr);
  }
  .command-deck article {
    padding: 9px;
  }
  .build-panel .panel-title {
    display: flex;
    margin-bottom: 5px;
  }
  .build-panel .panel-title h2 {
    font-size: 16px;
  }
  .build-panel .panel-title > span {
    margin: 0;
    font-size: 16px;
  }
  .buildings {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 3px;
  }
  .build-button {
    min-height: 60px;
    padding: 4px 2px;
  }
  .build-button strong {
    font-size: 16px;
    min-height: 30px;
    overflow-wrap: anywhere;
  }
  .build-button small {
    font-size: 16px;
  }
  .ability .ability-name {
    font-size: 16px;
    min-height: 35px;
  }
  .ability {
    padding: 17px 2px 5px;
    min-height: 111px;
  }
  .form-toggle {
    padding: 4px 6px;
  }
  .form-toggle > span:first-child {
    font-size: 16px;
  }
  .abilities-panel .panel-title > span {
    display: block;
  }
  .hero-heading {
    gap: 5px;
  }
  .hero-sigil {
    display: none;
  }
  .recall-button {
    font-size: 16px;
    padding: 6px;
  }
  .message {
    bottom: 347px;
    max-width: 88%;
  }
  .minimap {
    bottom: 400px;
    width: 220px;
    height: 60px;
    right: 12px;
  }
  .inspector {
    bottom: 470px;
    right: 12px;
  }
  #arena {
    top: 145px;
    bottom: 325px;
    height: calc(100% - 470px);
  }
  .economy {
    gap: 12px;
    padding: 7px 10px;
  }
  .economy strong {
    font-size: 16px;
  }
  .economy span:last-child {
    font-size: 16px;
  }
  #room-entry .bot-option {
    display: flex;
    grid-column: 1 / -1;
  }
}
@media (max-width: 540px) {
  .turret-status {
    font-size: 16px;
  }
  #arena {
    top: 180px;
    height: calc(100% - 505px);
  }
  .camera-controls {
    top: 149px;
  }
  .economy {
    top: 105px;
  }
  .command-deck {
    grid-template-columns: 132px minmax(0, 1fr);
  }
  .abilities {
    gap: 3px;
  }
  .command-deck article {
    padding: 8px 6px;
  }
  .vital {
    gap: 4px;
  }
  .hero-heading h2 {
    font-size: 16px;
  }
  .hero-heading > b {
    display: none;
  }
  .form-toggle > span:first-child {
    font-size: 16px;
  }
  .form-toggle {
    gap: 5px;
  }
  .ability .ability-name {
    font-size: 16px;
  }
  .ability small {
    font-size: 16px;
  }
  .build-button strong {
    font-size: 16px;
  }
  .minimap {
    width: 184px;
    height: 50px;
  }
}

.inspector h2 {
  padding-right: 25px;
}
.inspector #close-inspector {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 27px;
  height: 27px;
  padding: 0;
  font-size: 20px;
  line-height: 24px;
  border: 0;
  background: transparent;
}
@media (max-width: 760px) {
  .inspector {
    top: 185px;
    bottom: auto;
    max-height: clamp(100px, calc(100dvh - 650px), 240px);
    overflow-y: auto;
  }
}

/* Frostbound battlefield: the view gets the space, commands form a low rail. */
:root {
  --ink: #e2edf1;
  --muted: #97aebb;
  --panel: rgba(10, 22, 32, 0.96);
  --line: #40535e;
  --gold: #c9ae79;
}
button,
select {
  border-radius: 2px;
}
button {
  background: #172b39;
  border-color: #4b5f69;
}
button:hover {
  background: #254354;
  border-color: #b6c8c9;
}
.topbar {
  background: linear-gradient(#07131eec, #102432c9);
  border-color: #7996a52e;
}
.ability,
.build-button {
  background: linear-gradient(155deg, #294352, #132633);
  border-color: #54646b;
}
.ability:hover,
.build-button:hover {
  background: #304e5d;
}
.ability .ability-icon {
  text-shadow: 0 0 16px #b9d8f533;
}
.hero-sigil {
  background: radial-gradient(circle at 40% 30%, #36576b, #101d2b);
  border: 2px solid #aa9469;
}
.command-deck {
  border-radius: 2px;
  border-color: #796e53;
  border-top-color: #b7a077;
  box-shadow: 0 -3px 22px #07152366;
}
.economy {
  border: 1px solid #8298a52e;
  background: #0d1e2bd9;
  border-radius: 2px;
}
.form-toggle,
.recall-button {
  background: #203949;
  border-color: #617b88;
}
.map-title small {
  color: #a3bdcc;
}
.minimap {
  border-color: #9c885f;
  box-shadow: 0 3px 20px #020a12aa;
}
#camera-lock {
  padding: 3px 0;
  width: 100%;
  text-align: left;
  font-size: 16px;
}
#camera-lock[aria-pressed="true"] {
  color: #9fd8ef;
}
@media (min-width: 1101px) {
  .topbar {
    height: 64px;
    padding: 0 22px;
    gap: 24px;
  }
  .brand {
    font-size: 18px;
  }
  .crest {
    font-size: 29px;
  }
  .brand small {
    font-size: 16px;
  }
  .castle-status {
    width: 153px;
    font-size: 16px;
  }
  .castle-status .meter {
    margin: 4px 0;
    height: 4px;
  }
  .castle-status small {
    font-size: 16px;
  }
  .match-time strong {
    font-size: 22px;
  }
  .economy {
    top: 79px;
    left: 20px;
    padding: 8px 12px;
    gap: 17px;
  }
  .economy strong {
    font-size: 16px;
  }
  .map-title {
    top: 81px;
    right: 21px;
  }
  .map-title span {
    font-size: 16px;
    letter-spacing: 2px;
  }
  .camera-controls {
    top: 128px;
    right: 20px;
    opacity: 0.85;
  }
  .command-deck {
    bottom: 26px;
    left: 16px;
    right: 16px;
    min-height: 166px;
    grid-template-columns: 200px minmax(320px, 0.95fr) minmax(400px, 1.35fr);
  }
  .command-deck article {
    padding: 10px 12px;
  }
  .hero-heading {
    margin-bottom: 5px;
    gap: 8px;
  }
  .hero-heading h2 {
    font-size: 18px;
  }
  .hero-sigil {
    width: 34px;
    height: 34px;
    font-size: 23px;
  }
  .hero-heading span:not(.hero-sigil) {
    font-size: 16px;
  }
  .vital {
    margin-top: 5px;
  }
  .recall-button {
    margin-top: 7px;
    padding: 4px 8px;
  }
  #focus-btn {
    padding: 3px 0;
    font-size: 16px;
  }
  .panel-title {
    margin-bottom: 8px;
  }
  .panel-title h2 {
    font-size: 16px;
  }
  .abilities-panel .panel-title {
    margin-bottom: 7px;
  }
  .ability {
    min-height: 88px;
    padding: 13px 4px 5px;
  }
  .ability .ability-icon {
    font-size: 28px;
    line-height: 29px;
  }
  .ability .ability-name {
    min-height: 23px;
    margin-top: 3px;
    font-size: 16px;
  }
  .ability small {
    margin-top: 2px;
  }
  .build-button {
    min-height: 48px;
    padding: 5px;
  }
  .build-button strong {
    font-size: 16px;
  }
  .build-button small {
    font-size: 16px;
  }
  .build-icon {
    font-size: 19px;
  }
  .control-strip {
    bottom: 0;
    height: 25px;
    font-size: 16px;
  }
  .minimap {
    width: 268px;
    height: 74px;
    bottom: 207px;
    right: 17px;
  }
  .message {
    bottom: 205px;
    font-size: 16px;
    padding: 8px 15px;
    background: #0e2230db;
  }
  .inspector {
    bottom: 292px;
  }
}

#guardian-btn {
  display: block;
  margin: 3px auto 0;
  padding: 2px 6px;
  font-size: 16px;
  color: var(--gold);
  white-space: nowrap;
  background: transparent;
  border-color: #586879;
}
#rebuild-guardian {
  width: 100%;
  margin-top: 10px;
}

.fieldguide-link {
  margin-left: 12px;
  color: #d1bd86;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Portrait cells share the atlas artwork's 3:4 proportions. */
.toon-portrait {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  background-image: url("./assets/portraits/founding-four-toon.png");
  background-size: 400% 100%;
  background-position: var(--portrait-x) center;
  background-repeat: no-repeat;
}
.hero-art:has(.toon-portrait) {
  height: auto;
  aspect-ratio: 3 / 4;
  padding: 0;
  overflow: hidden;
}
.expansion-portrait {
  background-image: url('./assets/portraits/hero-atlas-toon.png');
  background-size: 500% 300%;
  background-position: var(--portrait-x) var(--portrait-y);
}
.selection-dialog { width: min(1200px, 100%); max-height: 96%; overflow: auto; }
.hero-choices {
  max-height: 48vh;
  overflow: auto;
  padding: 2px;
  scrollbar-color: #8ca799 #213745;
  align-items: start;
}
.hero-choice { min-height: 0; }
@media(max-width:600px) {
  .hero-choices { max-height: 46vh; }
}

/* Readable match review and voluntary, browser-local playtest feedback. */
.result-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin:24px 0; }
.result-stats strong { display:block; font:600 28px/1.2 Georgia,serif; color:var(--gold); }
.result-stats span { display:block; margin-top:6px; font-size:16px; color:#c5d6dc; }
#feedback-dialog { width:min(660px,calc(100vw - 32px)); max-height:90vh; overflow:auto; padding:32px; }
#feedback-dialog h1 { font-size:32px; margin:0 30px 16px 0; }
#feedback-dialog p,#feedback-dialog label,#feedback-dialog input,#feedback-dialog select,#feedback-dialog textarea,#feedback-dialog button { font-size:16px; line-height:1.5; }
#feedback-dialog p { color:#c4d1d8; }
#feedback-dialog label { display:grid; gap:8px; margin:16px 0; color:#e4ecee; }
#feedback-dialog input,#feedback-dialog select,#feedback-dialog textarea { width:100%; padding:10px; border:1px solid #64798a; border-radius:6px; background:#142a38; color:#f2f4ea; font-family:inherit; }
#feedback-dialog textarea { resize:vertical; }
.feedback-pair { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
#feedback-status { min-height:24px; }
@media(max-width:600px) { .feedback-pair { grid-template-columns:1fr; gap:0; } #feedback-dialog {padding:22px;} .result-stats {gap:14px 8px;} }

/* The battle HUD uses a 16px text floor, with room for complete ability names. */
.vital > span { width:52px; flex-shrink:0; }
.vital > b { width:78px; flex-shrink:0; }
.hero-heading { flex-wrap:wrap; }
.hero-heading > b { margin-left:0; }
.hero-heading > div { flex:1; min-width:100px; }
.ability .ability-name { min-height:42px; overflow-wrap:anywhere; }
.build-button strong { overflow-wrap:anywhere; }
.control-strip { height:36px; gap:18px; justify-content:space-between; }
.control-strip > span { display:none; }
#focus-btn,#camera-lock,#guardian-btn { font-size:16px; }
.topbar { height:104px; }
.castle-status { width:180px; }
.brand small { max-width:200px; white-space:normal; letter-spacing:0; }
.economy { top:120px; }
.map-title { top:122px; }
.camera-controls { top:176px; }
@media(min-width:1180px) {
  .topbar { height:104px; gap:24px; }
  .topbar .brand { min-width:180px; }
  .topbar .castle-status { width:190px; }
  .command-deck { bottom:38px; grid-template-columns:250px minmax(420px,1fr) minmax(420px,1fr); min-height:260px; }
  .command-deck article { padding:14px; }
  .ability { min-height:156px; padding:30px 6px 10px; }
  .ability .ability-name { min-height:62px; margin-top:8px; }
  .ability kbd { top:5px; left:5px; }
  .build-button { min-height:88px; padding:8px; }
  .build-icon { display:none; }
  .recall-button { padding:7px 8px; margin-top:10px; }
  .message { bottom:312px; max-width:calc(100% - 400px); max-height:76px; overflow:hidden; }
  .minimap { bottom:316px; width:280px; height:78px; }
  .inspector { bottom:404px; max-height:calc(100vh - 530px); overflow:auto; }
  .map-title small { font-size:16px; }
}
@media(max-width:1179px) {
  .topbar .brand { display:none; }
  .command-deck { bottom:38px; grid-template-columns:240px 1fr; }
  .build-panel { grid-column:1/-1; }
  .command-deck article { padding:10px; }
  .buildings { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .build-panel { display:none; }
  .in-town .build-panel { display:block; }
  .build-button { min-height:86px; }
  .build-icon { display:none; }
  .message { bottom:316px; max-width:70%; }
  .minimap { bottom:316px; }
  .in-town .message { display:none; }
  .in-town .minimap { bottom:510px; }
  .ability { min-height:150px; padding-top:30px; }
  .map-title { display:none; }
}
@media(max-width:600px) {
  .topbar { height:104px; gap:8px; padding:8px; }
  .topbar .castle-status { width:90px; flex:1; }
  .topbar .castle-status span { font-size:16px; }
  .turret-status,.topbar .castle-status small { display:none; }
  .topbar .match-time { margin:0; }
  .top-actions { flex-direction:column; }
  .top-actions #sound-btn { display:block; }
  .top-actions button { min-width:30px; min-height:26px; padding:0; }
  #guardian-btn { max-width:125px; white-space:normal; }
  .economy { top:116px; left:8px; right:8px; gap:10px; justify-content:space-between; padding:8px; }
  .economy div { gap:4px; }
  .economy div:nth-child(3),.economy div:nth-child(4) { display:none; }
  .camera-controls { top:166px; right:8px; }
  .command-deck { left:8px; right:8px; grid-template-columns:1fr; min-height:0; bottom:38px; }
  .hero-panel { display:grid; grid-template-columns:1fr 1fr; gap:6px 12px; }
  .hero-heading { grid-column:1/-1; margin:0; }
  .hero-heading h2 { font-size:18px; }
  .hero-heading span:not(.hero-sigil),.hero-sigil,#focus-btn,#camera-lock { display:none; }
  .vital { margin:0; gap:4px; }
  .vital > span { width:auto; }
  .vital > b { width:auto; }
  .vital .meter { display:none; }
  .recall-button { grid-column:1/-1; margin:0; }
  .abilities-panel .panel-title { margin-bottom:6px; }
  #respawn { display:none; }
  .abilities { gap:4px; }
  .ability { min-height:92px; padding:7px 4px; }
  .ability .ability-icon { display:none; }
  .ability .ability-name { min-height:42px; margin:0; font-size:16px; }
  .ability kbd { display:none; }
  .ability small { margin-top:6px; }
  .message { bottom:365px; left:8px; right:8px; transform:none; max-width:none; max-height:52px; overflow:hidden; font-size:16px; }
  .minimap { bottom:425px; right:8px; width:185px; height:55px; }
  .in-town .minimap { bottom:510px; }
  .in-town .abilities-panel { display:none; }
  .in-town .buildings { max-height:190px; overflow:auto; }
  .control-strip { left:8px; right:8px; }
  .inspector { bottom:370px; max-height:calc(100vh - 530px); overflow:auto; }
}
#graphics-quality { width:170px; max-width:170px; }
@media(max-width:600px) {
  .topbar { display:grid; grid-template-columns:minmax(0,1fr) 110px minmax(0,1fr) 30px; grid-template-rows:1fr; align-items:center; }
  .topbar .ally { grid-column:1; grid-row:1; }
  .topbar .match-time { grid-column:2; grid-row:1; }
  .topbar .enemy { grid-column:3; grid-row:1; }
  .topbar .top-actions { grid-column:4; grid-row:1; margin:0; }
  .topbar .castle-status { width:auto; min-width:0; }
  .topbar #match-state { display:none; }
  #guardian-btn { width:110px; padding:2px; }
  #graphics-quality { width:158px; max-width:158px; }
  .message { width:auto; white-space:normal; line-height:1.35; text-align:left; }
  #arena { top:104px; bottom:38px; height:calc(100% - 142px); }
}
