:root {
  color-scheme: dark;
  --bg: #0d1722;
  --panel: #152330;
  --raised: #1c2e3d;
  --line: #314452;
  --text: #f4f4eb;
  --muted: #b1c0cb;
  --gold: #ffcf87;
  --teal: #8adbd4;
  --danger: #ffad9e;
  --shadow: 0 12px 40px #0005;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}
body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}
button,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  touch-action: manipulation;
}
button img {
  pointer-events: none;
}
a {
  color: var(--teal);
}
[hidden] {
  display: none !important;
}
button {
  border: 0;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.6px;
}
h3 {
  font-size: 18px;
  line-height: 1.3;
}
.muted {
  color: var(--muted);
}
.fine {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.eyebrow {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 2px;
  color: var(--teal);
  display: block;
}
.boot {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  background: #101d29;
  color: #c4d4d9;
}
.boot img {
  animation: orbit 3s ease-in-out infinite;
}
@keyframes orbit {
  50% {
    transform: translateY(-8px);
  }
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 850;
  font-size: 20px;
  letter-spacing: 1px;
  white-space: nowrap;
}
.brand small {
  font-size: 11px;
  opacity: 0.7;
}
.brand em {
  display: block;
  font-size: 9px;
  font-style: normal;
  letter-spacing: 2.5px;
  color: var(--muted);
  margin-top: 0;
}
.brand-button {
  background: none;
  text-align: left;
  padding: 0;
}
.login {
  position: relative;
  height: 100%;
  overflow: auto;
  background: #101f2b;
  color: #f4f5ee;
}
.login-art {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #0d1b2bf0 0%, #0d1b2b99 48%, #0d1b2bcc 100%),
    url("assets/island.webp") center/cover no-repeat;
}
.login-wrap {
  position: relative;
  min-height: 100%;
  max-width: 1300px;
  padding: 56px 48px;
  margin: auto;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 80px;
  align-items: center;
}
.intro .brand {
  margin-bottom: 80px;
}
.intro h1 {
  font-size: clamp(48px, 5.5vw, 78px);
  font-weight: 750;
  line-height: 1.06;
  letter-spacing: -3px;
  margin: 22px 0 24px;
}
.intro > p {
  font-size: 18px;
  color: #d1dfdc;
  line-height: 1.8;
}
.intro-features {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 14px;
  color: #cfddde;
  margin-top: 36px;
}
.intro-features span::first-letter {
  color: var(--gold);
}
.login-foot {
  font-size: 12px;
  letter-spacing: 1px;
  line-height: 1.8;
  color: #a3b8bf;
  margin-top: 64px;
}
.auth-card {
  background: #142330ed;
  border: 1px solid #40525d;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 20px 80px #0004;
}
.auth-card h2 {
  margin: 12px 0 10px;
  font-size: 32px;
}
.auth-card .muted {
  font-size: 16px;
  color: #b1c0cb;
}
.auth-tabs {
  display: flex;
  gap: 8px;
  background: #0e1a24;
  padding: 4px;
  margin: 24px 0;
  border: 1px solid #314452;
  border-radius: 8px;
}
.auth-tabs button {
  flex: 1;
  background: none;
  padding: 10px 8px;
  color: #b1c0cb;
  font-size: 14px;
  font-weight: 650;
  border-radius: 5px;
}
.auth-tabs .active {
  background: #263a47;
  color: #fff;
}
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  color: #d6e0e3;
}
input,
select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  min-height: 44px;
  font-size: 16px;
}
input::placeholder {
  color: #8fa4b3;
}
.auth-card input {
  background: #0e1b26;
  border-color: #3e5262;
  color: #fff;
}
input[type="number"] {
  width: 90px;
}
.form-error {
  font-size: 14px;
  color: var(--danger);
  margin: 4px 0 12px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  min-height: 46px;
  font-weight: 700;
  font-size: 15px;
  background: var(--raised);
  transition:
    filter 0.15s,
    transform 0.15s;
}
.button:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.button.primary {
  background: var(--gold);
  color: #253035;
  border-color: var(--gold);
}
.button.teal {
  background: var(--teal);
  color: #17383c;
  border-color: var(--teal);
}
.button.ghost {
  background: transparent;
}
.button.danger {
  color: var(--danger);
}
.button.wide {
  width: 100%;
}
.button.wide > span:last-child {
  margin-left: auto;
}
.button.small {
  padding: 9px 12px;
  min-height: 44px;
  font-size: 14px;
}
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #a5b7c3;
  font-size: 13px;
  margin: 20px 0;
}
.or:before,
.or:after {
  content: "";
  flex: 1;
  height: 1px;
  background: #344652;
}
.auth-card .fine {
  margin-top: 16px;
  text-align: center;
  color: #b1c0cb;
}
.game {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 84px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.mode-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 1px;
  color: var(--muted);
  white-space: nowrap;
}
.status-dot {
  width: 6px;
  height: 6px;
  background: var(--teal);
  border-radius: 100%;
  display: inline-block;
}
.resources {
  display: flex;
  gap: 12px;
  margin-left: auto;
}
.resource {
  min-width: 142px;
  padding: 8px 14px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 26px 1fr;
  column-gap: 9px;
  align-items: center;
  background: var(--bg);
}
.resource-icon {
  font-size: 23px;
  grid-row: 1/4;
  color: var(--gold);
}
.resource.ether .resource-icon {
  color: var(--teal);
}
.resource.trophy {
  min-width: 98px;
}
.resource.trophy .resource-icon {
  color: #dbb3ed;
}
.resource strong {
  font-size: 17px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.resource small {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.4px;
}
.resource-track {
  height: 2px;
  background: var(--line);
  margin-top: 5px;
  grid-column: 2;
  border-radius: 3px;
  overflow: hidden;
}
.resource-track i {
  display: block;
  background: var(--gold);
  height: 100%;
  max-width: 100%;
}
.resource.ether .resource-track i {
  background: var(--teal);
}
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.icon-button {
  height: 44px;
  width: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.icon-button:hover {
  background: var(--raised);
  color: var(--text);
}
.profile-button {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid #6c777a;
  border-radius: 100%;
  overflow: hidden;
  background: var(--raised);
}
.profile-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}
.layout {
  flex: 1;
  min-height: 0;
  display: flex;
}
.stage {
  position: relative;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #1f4048, #10212f 75%);
  isolation: isolate;
}
#world {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#world:active {
  cursor: grabbing;
}
.stage-heading {
  position: absolute;
  left: 32px;
  top: 28px;
  pointer-events: none;
  text-shadow: 0 2px 10px #0d1c2b;
}
.stage-heading h1 {
  font-size: 27px;
  letter-spacing: -0.7px;
  line-height: 1.25;
  margin: 6px 0;
}
.stage-heading .eyebrow {
  font-size: 10px;
  color: #a9c5ce;
  letter-spacing: 2px;
}
.stage-heading p {
  font-size: 13px;
  color: #bfced2;
}
.stage-tools {
  position: absolute;
  right: 20px;
  top: 28px;
  display: flex;
  gap: 6px;
}
.stage-tools .icon-button {
  background: #112431e8;
  border-color: #3e5965;
  color: #d2e3e6;
}
.world-credit {
  position: absolute;
  left: 28px;
  bottom: 20px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1.7px;
  color: #acc8cd;
  pointer-events: none;
}
.world-credit span {
  color: #ffcf87;
  margin: 0 8px;
}
.map-tip {
  position: absolute;
  left: 50%;
  bottom: 106px;
  transform: translateX(-50%);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 6px;
  background: #0d1e2ddd;
  border: 1px solid #4b6166;
  color: #e0edec;
  text-align: center;
  pointer-events: none;
  max-width: 85%;
  white-space: nowrap;
}
.map-tip:empty {
  display: none;
}
.actionbar {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  background: #122532ed;
  border: 1px solid #4b626a;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  gap: 6px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.actionbar button {
  min-height: 50px;
  padding: 9px 18px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  color: #dbe4e5;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.actionbar button:hover {
  background: #28424c;
}
.actionbar button.primary {
  background: var(--gold);
  color: #273035;
}
.actionbar .action-icon {
  font-size: 22px;
  line-height: 1;
}
.actionbar .collect-dot {
  background: #8adbd4;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.inspector {
  width: 302px;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.inspector .eyebrow {
  font-size: 10px;
  letter-spacing: 1.5px;
}
.inspector h2 {
  font-size: 24px;
  margin-top: 8px;
}
.inspector .description {
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  margin-top: 10px;
}
.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.level-pill {
  font-size: 11px;
  border: 1px solid #5e6260;
  background: #ffcf8710;
  color: var(--gold);
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 0;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  font-size: 14px;
  color: var(--muted);
}
.stat-row strong {
  color: var(--text);
  font-size: 14px;
}
.stat-row .gold-text {
  color: var(--gold);
}
.stat-row .teal-text {
  color: var(--teal);
}
.panel-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  background: radial-gradient(ellipse at center, #3b536250, transparent 70%);
}
.panel-art img {
  width: 135px;
  height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 12px 10px #0004);
}
.panel-art.hero-art img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: 50% 25%;
  border-radius: 8px;
}
.section-label {
  font-size: 12px;
  letter-spacing: 0.6px;
  font-weight: 650;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
}
.section-label button {
  font-size: 12px;
  background: none;
  color: var(--teal);
  padding: 5px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 32px;
}
.mini-army {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.mini-unit {
  position: relative;
  width: 48px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
}
.mini-unit img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.mini-unit span {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  background: linear-gradient(transparent, #101b29);
  font-size: 12px;
  text-align: center;
  line-height: 1.2;
  padding-top: 10px;
  font-weight: 750;
  color: white;
}
.mission {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--bg);
}
.mission h3 {
  font-size: 14px;
  margin-bottom: 9px;
}
.mission p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.mission .mission-icon {
  font-size: 20px;
  display: inline-block;
  margin-bottom: 6px;
  color: var(--gold);
}
.inline-actions {
  display: flex;
  gap: 8px;
}
.inline-actions > .button {
  flex: 1;
}
.panel-bottom {
  margin-top: auto;
  padding-top: 10px;
}
.server-note {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 7px;
  align-items: center;
}
.builder-dots {
  display: flex;
  gap: 5px;
}
.builder-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
}
.builder-dots i.busy {
  background: var(--gold);
}
.progress-track {
  height: 5px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  margin: 12px 0;
}
.progress-track i {
  display: block;
  height: 100%;
  background: var(--teal);
  max-width: 100%;
}
.queue-line {
  font-size: 13px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
}
.queue-line strong {
  color: var(--teal);
}
.selected-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.selected-title button {
  background: none;
  color: var(--muted);
  padding: 6px;
  font-size: 18px;
  min-width: 36px;
  min-height: 36px;
}
.grid-coordinates {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}
.grid-coordinates label {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.grid-coordinates input {
  width: 75px;
}
.battle-hud {
  position: absolute;
  left: 28px;
  top: 24px;
  display: flex;
  gap: 20px;
  align-items: center;
  background: #102331ed;
  border: 1px solid #4d626c;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.battle-hud strong {
  font-size: 25px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  display: block;
  line-height: 1.2;
}
.battle-hud small {
  font-size: 10px;
  color: #bbcdd4;
  letter-spacing: 0.8px;
  display: block;
}
.battle-hud .time {
  color: #f4f4eb;
}
.army-tray {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 26px;
  padding: 10px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  background: #102331ef;
  border: 1px solid #4c6770;
  border-radius: 10px;
  backdrop-filter: blur(12px);
  overflow-x: auto;
}
.deploy-button {
  position: relative;
  padding: 0;
  min-width: 68px;
  width: 74px;
  height: 90px;
  border-radius: 7px;
  overflow: hidden;
  background: #1e3340;
  border: 2px solid #4e626d;
  flex-shrink: 0;
}
.deploy-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.deploy-button span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 11px;
  line-height: 1.2;
  background: linear-gradient(transparent, #102231 30%);
  padding: 12px 2px 5px;
  font-weight: 700;
  color: #fff;
}
.deploy-button b {
  position: absolute;
  top: 2px;
  right: 3px;
  background: #112531ee;
  padding: 1px 5px;
  font-size: 13px;
  color: #fff;
  border-radius: 3px;
}
.deploy-button.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px #ffcf8750;
}
.deploy-button:disabled {
  opacity: 0.35;
}
.tray-option {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
}
.tray-option button {
  background: #2a424f;
  border: 1px solid #60747d;
  padding: 8px;
  border-radius: 5px;
  min-height: 36px;
  font-size: 12px;
  color: #e8f2f2;
}
.tray-option button.active {
  background: var(--gold);
  color: #1e3239;
}
.ability-button {
  border: 1px solid var(--gold);
  background: #443f33;
  color: var(--gold);
  border-radius: 7px;
  font-size: 12px;
  padding: 8px;
  max-width: 85px;
}
.battle-panel .description {
  margin-top: 10px;
}
.battle-summary {
  display: flex;
  gap: 14px;
  align-items: center;
}
.battle-summary img {
  width: 50px;
  height: 55px;
  object-fit: contain;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--teal);
  background: #8adbd410;
  border: 1px solid #8adbd440;
  padding: 3px 7px;
  border-radius: 4px;
}
.badge.busy {
  color: var(--gold);
  background: #ffcf8710;
  border-color: #ffcf8740;
}
dialog {
  max-width: 900px;
  width: calc(100% - 48px);
  max-height: calc(100% - 64px);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 100px #0008;
  overflow: auto;
  scrollbar-width: thin;
}
dialog::backdrop {
  background: #07121bba;
  backdrop-filter: blur(7px);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head > div {
  flex: 1;
}
.modal-head h2 {
  margin: 7px 0;
}
.modal-head p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}
.modal-body {
  padding: 24px 28px 28px;
}
.modal-head .icon-button {
  background: transparent;
}
.modal-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.modal-toolbar > label {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.modal-toolbar select {
  max-width: 180px;
}
.modal-toolbar input {
  flex: 1;
  min-width: 80px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.build-card,
.troop-card,
.bot-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.build-card .card-art {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #36536280, transparent 70%);
}
.card-art img {
  width: 100px;
  height: 100px;
  object-fit: contain;
}
.card-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.card-info h3 {
  font-size: 15px;
}
.card-info .fine {
  font-size: 12px;
  line-height: 1.55;
}
.card-info .button {
  margin-top: auto;
}
.card-cost {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gold);
  align-items: center;
}
.card-cost .muted {
  font-size: 11px;
}
.locked .card-art,
.locked .troop-art {
  filter: grayscale(0.8);
  opacity: 0.6;
}
.troop-card .troop-art {
  height: 150px;
  object-fit: cover;
  object-position: center 22%;
  width: 100%;
}
.training-controls {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.training-controls input {
  width: 64px;
  padding: 8px;
  min-width: 0;
  font-size: 14px;
}
.training-controls .button {
  flex: 1;
  min-width: 0;
  padding: 8px;
  font-size: 13px;
}
.bot-card .bot-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 4px;
}
.bot-top img {
  width: 44px;
  height: 48px;
  object-fit: contain;
}
.bot-top h3 {
  font-size: 14px;
  line-height: 1.35;
}
.bot-top small {
  font-size: 11px;
  color: var(--muted);
}
.bot-card .card-info {
  gap: 8px;
}
.bot-card .loot-line {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  display: flex;
  justify-content: space-between;
  color: var(--gold);
}
.bot-card .loot-line.ether {
  color: var(--teal);
}
.bot-refill {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0 4px;
  min-height: 17px;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
}
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  grid-column: 1/-1;
}
.leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.leaderboard td,
.leaderboard th {
  padding: 14px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.leaderboard th {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
}
.leaderboard td:first-child {
  color: var(--gold);
  font-weight: 700;
}
.leaderboard tr.me {
  background: #8adbd410;
}
.leaderboard td small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.rank-total {
  color: var(--gold);
  font-weight: 750;
}
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.guide-step {
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 8px;
  background: var(--bg);
}
.guide-step .step-num {
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.guide-step p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
  line-height: 1.65;
}
.unlock-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 20px;
}
.unlock-list > div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}
.unlock-list strong {
  color: var(--gold);
  margin-right: 7px;
}
.notice {
  border-left: 3px solid var(--teal);
  padding: 12px 16px;
  background: #8adbd40a;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  margin-top: 20px;
}
.result-wrap {
  text-align: center;
  padding: 12px 0;
}
.result-stars {
  font-size: 52px;
  letter-spacing: 10px;
  color: var(--gold);
  text-shadow: 0 4px 24px #ffcf8730;
  margin-bottom: 12px;
}
.result-stars .unearned {
  color: var(--line);
  text-shadow: none;
}
.result-wrap h2 {
  font-size: 30px;
}
.result-wrap p {
  color: var(--muted);
  margin-top: 8px;
  font-size: 14px;
}
.result-loot {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 28px 0;
}
.result-loot > div {
  padding: 16px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.result-loot strong {
  display: block;
  font-size: 25px;
  color: var(--gold);
}
.result-loot small {
  font-size: 12px;
  color: var(--muted);
}
.result-loot > div:nth-child(2) strong {
  color: var(--teal);
}
.result-loot > div:nth-child(3) strong {
  color: #dcb7ee;
}
.history-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.history-item > div {
  flex: 1;
}
.history-item .stars {
  color: var(--gold);
  white-space: nowrap;
  font-size: 18px;
}
.history-item small {
  font-size: 12px;
  color: var(--muted);
}
.profile-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  align-items: start;
}
.profile-grid > img {
  width: 140px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.profile-grid h3 {
  font-size: 20px;
  margin-bottom: 8px;
}
.claim-form {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 20px;
}
.claim-form label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin: 12px 0;
}
.claim-form input {
  margin-top: 7px;
}
.toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  max-width: calc(100% - 32px);
}
.toast {
  padding: 12px 20px;
  border: 1px solid #647b83;
  border-radius: 8px;
  background: #18323ff5;
  box-shadow: var(--shadow);
  font-size: 14px;
  color: #eff8f5;
  text-align: center;
  animation: toastin 0.2s ease-out;
}
.toast.error {
  border-color: #b16c63;
  background: #402e32;
  color: #ffe2dc;
}
@keyframes toastin {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.loading-message {
  padding: 48px;
  text-align: center;
  color: var(--muted);
}
.queue-banner {
  margin-bottom: 20px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
}
.queue-banner strong {
  color: var(--teal);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.keyboard-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
}
.count-badge {
  font-size: 11px;
  background: var(--raised);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--muted);
}
@media (min-width: 1600px) {
  .inspector {
    width: 330px;
    padding: 30px;
  }
  .stage-heading {
    left: 40px;
    top: 36px;
  }
  .topbar {
    padding: 0 36px;
    height: 90px;
  }
  .actionbar {
    bottom: 42px;
  }
}
@media (max-width: 1150px) {
  .topbar {
    gap: 16px;
    padding: 0 18px;
  }
  .mode-label {
    display: none;
  }
  .resource {
    min-width: 128px;
    padding: 8px 10px;
  }
  .brand {
    font-size: 17px;
    gap: 9px;
  }
  .brand em {
    font-size: 8px;
  }
  .inspector {
    width: 270px;
    padding: 22px 18px;
  }
  .stage-heading {
    left: 20px;
    top: 24px;
  }
  .stage-heading h1 {
    font-size: 24px;
  }
  .actionbar button {
    padding: 9px 12px;
  }
  .login-wrap {
    gap: 40px;
    padding: 40px 32px;
  }
  .intro .brand {
    margin-bottom: 48px;
  }
  .intro h1 {
    font-size: 58px;
  }
  .auth-card {
    padding: 26px;
  }
  .header-actions {
    gap: 8px;
  }
}
@media (max-width: 850px) {
  .topbar .brand {
    font-size: 15px;
  }
  .topbar .brand img {
    width: 36px;
    height: 36px;
  }
  .brand em {
    font-size: 7px;
  }
  .resources {
    gap: 8px;
  }
  .resource {
    min-width: 109px;
    grid-template-columns: 20px 1fr;
    gap: 5px;
    padding: 7px 9px;
  }
  .resource strong {
    font-size: 15px;
  }
  .resource-icon {
    font-size: 20px;
  }
  .resource.trophy {
    min-width: 72px;
  }
  .header-actions .icon-button {
    display: none;
  }
  .inspector {
    width: 240px;
    padding: 20px 16px;
  }
  .stage-tools {
    right: 12px;
    top: 20px;
    flex-direction: column;
    gap: 5px;
  }
  .stage-tools .icon-button {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .actionbar {
    gap: 2px;
    padding: 6px;
    bottom: 28px;
  }
  .actionbar button {
    padding: 7px 10px;
    font-size: 12px;
    min-height: 48px;
    flex-direction: column;
    gap: 3px;
  }
  .actionbar .action-icon {
    font-size: 20px;
  }
  .world-credit {
    font-size: 8px;
    left: 20px;
    bottom: 9px;
  }
  .map-tip {
    font-size: 11px;
    bottom: 106px;
    white-space: normal;
    width: max-content;
    max-width: 85%;
  }
  .login-wrap {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    padding: 32px 24px;
  }
  .intro h1 {
    font-size: 46px;
  }
  .intro > p {
    font-size: 16px;
  }
  .intro-features {
    font-size: 12px;
    gap: 12px;
  }
  .login-foot {
    margin-top: 40px;
  }
  .auth-card {
    padding: 22px;
  }
  .intro .brand {
    font-size: 19px;
  }
  .auth-card h2 {
    font-size: 28px;
  }
  .eyebrow {
    font-size: 10px;
  }
  .card-grid {
    gap: 12px;
  }
  .modal-body {
    padding: 20px;
  }
  .modal-head {
    padding: 22px 20px 18px;
  }
  .battle-hud {
    left: 16px;
    top: 18px;
    gap: 14px;
    padding: 9px 12px;
  }
  .battle-hud strong {
    font-size: 22px;
  }
}
@media (max-width: 650px) {
  html,
  body {
    height: 100dvh;
  }
  .topbar {
    height: 123px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: 44px 54px;
    gap: 8px 10px;
    padding: 8px 16px;
  }
  .topbar .brand {
    font-size: 17px;
  }
  .brand em {
    font-size: 7px;
    letter-spacing: 2px;
  }
  .topbar .brand img {
    width: 35px;
    height: 35px;
  }
  .resources {
    grid-row: 2;
    grid-column: 1/-1;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 90px;
    gap: 7px;
  }
  .resource {
    padding: 7px 9px;
    min-width: 0;
  }
  .resource.trophy {
    min-width: 0;
  }
  .resource strong {
    font-size: 16px;
  }
  .resource small {
    font-size: 9px;
  }
  .header-actions {
    grid-row: 1;
    grid-column: 2;
  }
  .profile-button {
    width: 38px;
    height: 38px;
  }
  .header-actions .icon-button {
    display: inline-flex;
    width: 36px;
    height: 36px;
    font-size: 17px;
  }
  .layout {
    display: grid;
    grid-template-rows: minmax(280px, 1fr) auto;
  }
  .stage {
    min-height: 0;
    width: 100%;
  }
  .inspector {
    width: 100%;
    max-height: 218px;
    min-height: 150px;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 18px 20px;
    display: block;
    position: relative;
  }
  .inspector > * {
    margin-bottom: 14px;
  }
  .inspector .panel-art {
    display: none;
  }
  .inspector .overview-top {
    margin-right: 80px;
  }
  .inspector h2 {
    font-size: 21px;
    margin-top: 4px;
  }
  .inspector .description {
    font-size: 13px;
    line-height: 1.5;
    margin-top: 7px;
  }
  .inspector .desktop-only {
    display: none;
  }
  .inspector .stat-row {
    font-size: 13px;
    margin: 6px 0;
  }
  .inspector .stat-row strong {
    font-size: 13px;
  }
  .inspector .panel-top {
    margin-bottom: 8px;
  }
  .inspector .section-label {
    margin-bottom: 8px;
  }
  .inspector .panel-bottom {
    position: absolute;
    right: 20px;
    top: 12px;
    padding: 0;
  }
  .inspector .server-note {
    font-size: 10px;
  }
  .inspector .overview-army {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 0;
  }
  .inspector .overview-army .mini-army {
    flex-wrap: nowrap;
  }
  .mini-unit {
    width: 38px;
    height: 44px;
  }
  .inspector .overview-army .section-label {
    display: none;
  }
  .inspector .mission {
    display: none;
  }
  .inspector .building-actions {
    display: flex;
    gap: 8px;
    margin: 12px 0 0;
  }
  .building-actions > .button {
    flex: 1;
    padding: 9px 8px;
    min-height: 44px;
    font-size: 13px;
  }
  .inspector .building-stats {
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }
  .inspector .building-stats .stat-row {
    display: block;
    margin: 0;
  }
  .inspector .building-stats .stat-row strong {
    display: block;
  }
  .inspector .building-stats .stat-row span {
    font-size: 11px;
  }
  .inspector .selected-title .eyebrow {
    font-size: 9px;
  }
  .stage-heading {
    left: 18px;
    top: 14px;
  }
  .stage-heading .eyebrow {
    font-size: 8px;
    letter-spacing: 1.5px;
  }
  .stage-heading h1 {
    font-size: 21px;
    margin: 4px 0;
  }
  .stage-heading p {
    font-size: 11px;
  }
  .stage-tools {
    top: 14px;
    right: 12px;
    flex-direction: row;
    gap: 5px;
  }
  .stage-tools .icon-button {
    width: 32px;
    height: 36px;
    font-size: 18px;
  }
  .actionbar {
    bottom: 20px;
    gap: 4px;
    padding: 5px;
    border-radius: 9px;
  }
  .actionbar button {
    padding: 7px 12px;
    font-size: 11px;
    gap: 4px;
    min-height: 48px;
  }
  .actionbar .action-icon {
    font-size: 19px;
  }
  .world-credit {
    bottom: 5px;
    left: 16px;
    font-size: 7px;
  }
  .map-tip {
    font-size: 11px;
    padding: 5px 10px;
    bottom: 87px;
    line-height: 1.4;
  }
  .stage-heading ~ .map-tip:not(:empty) {
    max-width: 86%;
  }
  .login-wrap {
    display: block;
    padding: 32px 20px;
    max-width: 480px;
  }
  .intro .brand {
    margin-bottom: 36px;
  }
  .intro > .eyebrow {
    font-size: 9px;
  }
  .intro h1 {
    font-size: 46px;
    letter-spacing: -2px;
    margin: 14px 0 18px;
  }
  .intro > p {
    font-size: 15px;
    line-height: 1.6;
  }
  .intro-features {
    font-size: 11px;
    margin-top: 20px;
    gap: 10px 18px;
  }
  .login-foot {
    display: none;
  }
  .auth-card {
    margin-top: 32px;
    padding: 24px;
  }
  .auth-card h2 {
    font-size: 28px;
  }
  .login-art {
    position: fixed;
    background:
      linear-gradient(180deg, #0d1b2bd0, #0d1b2bf0),
      url("assets/island.webp") center/auto 100% no-repeat;
  }
  dialog {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 10px;
  }
  .modal-head {
    padding: 20px 18px 16px;
    gap: 12px;
  }
  .modal-head h2 {
    font-size: 23px;
  }
  .modal-head p {
    font-size: 13px;
  }
  .modal-head .eyebrow {
    font-size: 9px;
  }
  .modal-head .icon-button {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .modal-body {
    padding: 18px;
  }
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .build-card .card-art {
    height: 95px;
  }
  .card-art img {
    width: 82px;
    height: 82px;
  }
  .card-info {
    padding: 11px;
    gap: 7px;
  }
  .card-info h3 {
    font-size: 14px;
  }
  .card-info .fine {
    font-size: 11px;
  }
  .card-info .button {
    font-size: 12px;
    padding: 8px;
    min-height: 42px;
  }
  .card-cost {
    font-size: 11px;
    gap: 3px;
  }
  .card-cost .muted {
    font-size: 10px;
  }
  .modal-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-toolbar > label {
    font-size: 12px;
  }
  .modal-toolbar select {
    max-width: 140px;
    font-size: 14px;
  }
  .modal-toolbar input {
    font-size: 14px;
  }
  .bot-card .bot-top {
    padding: 12px 10px 0;
    gap: 6px;
  }
  .bot-top img {
    width: 34px;
    height: 40px;
  }
  .bot-top h3 {
    font-size: 12px;
  }
  .bot-top small {
    font-size: 10px;
  }
  .bot-card .loot-line {
    font-size: 12px;
  }
  .bot-refill {
    font-size: 10px;
  }
  .pager {
    font-size: 11px;
    gap: 7px;
  }
  .pager .button {
    font-size: 12px;
    min-height: 40px;
    padding: 8px;
  }
  .troop-card .troop-art {
    height: 132px;
  }
  .training-controls {
    gap: 5px;
  }
  .training-controls input {
    width: 46px;
    padding: 7px;
    font-size: 13px;
  }
  .training-controls .button {
    font-size: 11px;
    padding: 6px;
  }
  .guide-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .unlock-list {
    grid-template-columns: 1fr;
  }
  .leaderboard {
    font-size: 12px;
  }
  .leaderboard td,
  .leaderboard th {
    padding: 12px 5px;
  }
  .leaderboard th {
    font-size: 10px;
  }
  .profile-grid {
    grid-template-columns: 90px 1fr;
    gap: 16px;
  }
  .profile-grid > img {
    width: 90px;
  }
  .profile-grid h3 {
    font-size: 18px;
  }
  .result-loot {
    gap: 7px;
  }
  .result-loot strong {
    font-size: 21px;
  }
  .result-stars {
    font-size: 44px;
  }
  .result-wrap h2 {
    font-size: 25px;
  }
  .result-loot small {
    font-size: 10px;
  }
  .history-item {
    gap: 10px;
    font-size: 12px;
  }
  .history-item small {
    font-size: 10px;
  }
  .history-item .stars {
    font-size: 14px;
  }
  .army-tray {
    left: 10px;
    right: 10px;
    bottom: 20px;
    padding: 7px;
    gap: 6px;
    justify-content: flex-start;
  }
  .deploy-button {
    width: 59px;
    min-width: 59px;
    height: 75px;
  }
  .deploy-button span {
    font-size: 10px;
  }
  .deploy-button b {
    font-size: 11px;
  }
  .battle-hud {
    top: 14px;
    left: 12px;
    gap: 10px;
    padding: 8px 11px;
  }
  .battle-hud strong {
    font-size: 20px;
  }
  .battle-hud small {
    font-size: 8px;
  }
  .battle-hud .hud-stars {
    font-size: 14px;
  }
  .battle-panel .battle-detail {
    display: none;
  }
  .battle-panel .stat-row {
    display: inline-flex;
    margin-right: 16px;
  }
  .battle-panel .inline-actions {
    margin-top: 12px;
  }
  .battle-panel .description {
    margin-top: 7px;
  }
  .battle-panel .battle-summary img {
    width: 40px;
    height: 45px;
  }
  .battle-summary {
    gap: 10px;
  }
  .battle-panel .button {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 13px;
  }
  .toasts {
    bottom: 14px;
    width: max-content;
  }
  .toast {
    font-size: 13px;
    padding: 10px 14px;
    max-width: 100%;
  }
  .grid-coordinates {
    margin: 10px 0;
  }
  .inspector .placement-wrap {
    display: flex;
    gap: 16px;
    align-items: center;
  }
  .placement-wrap .button {
    font-size: 13px;
    min-height: 44px;
    padding: 8px 12px;
  }
  .inspector .keyboard-hint {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #e8eeed;
    --panel: #f5f4ed;
    --raised: #dfe8e7;
    --line: #acbdbb;
    --text: #23363e;
    --muted: #4b646c;
    --gold: #855a19;
    --teal: #236b68;
    --danger: #a73932;
    --shadow: 0 12px 40px #10243125;
  }
  .button.primary {
    background: #ffd18e;
    border-color: #a47a3d;
    color: #253035;
  }
  .button.teal {
    background: #9cded6;
    border-color: #4c8a86;
    color: #17383c;
  }
  .resource-icon {
    color: #92661f;
  }
  .resource-track i {
    background: #a5762e;
  }
  .resource.ether .resource-icon,
  .resource.ether .resource-track i {
    color: #276e6d;
    background: transparent;
  }
  .resource.ether .resource-track i {
    background: #276e6d;
  }
  .resource.trophy .resource-icon {
    color: #775195;
  }
  .level-pill {
    border-color: #b89a66;
    background: #e0cba130;
    color: #765316;
  }
  .badge {
    color: #24615d;
    border-color: #61978b;
    background: #77cbb520;
  }
  .badge.busy {
    color: #77511f;
    border-color: #ad8e59;
    background: #d7b87620;
  }
  .card-info .button.primary {
    background: #ffd18e;
  }
  .build-card .card-art {
    background: radial-gradient(ellipse at center, #accbc180, transparent 70%);
  }
  .result-stars {
    color: #a26b19;
  }
  .result-loot > div:nth-child(3) strong {
    color: #71538e;
  }
  .stage .actionbar {
    --gold: #ffcf87;
  }
  .stage-heading,
  .battle-hud {
    color: #f4f4eb;
  }
  .stage-heading .eyebrow {
    color: #bed5d8;
  }
  .login {
    --gold: #ffcf87;
    --teal: #8adbd4;
    --line: #40525d;
    --muted: #b1c0cb;
    --text: #f4f4eb;
    --raised: #263a47;
    --bg: #0e1b26;
  }
  .login .auth-card .button.ghost {
    color: #e0eaed;
  }
  .login .auth-card .button.primary {
    background: #ffcf87;
    color: #253035;
    border-color: #ffcf87;
  }
  .server-note .status-dot {
    background: #236b68;
  }
}

/* Consistent vector UI icons; no dependence on installed symbol fonts. */
.ui-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.resource-icon {
  display: flex;
  align-items: center;
}
.action-icon {
  display: flex;
  align-items: center;
}
.mission-heading {
  display: flex;
  align-items: center;
  gap: 7px;
}
.mission-heading .ui-icon {
  width: 20px;
  height: 20px;
  color: var(--gold);
}
.intro-features span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.intro-features .ui-icon {
  width: 15px;
  height: 15px;
  color: #ffcf87;
}
.inspector {
  gap: 18px;
}
.panel-art {
  min-height: 148px;
}
.panel-art img {
  height: 148px;
}
.stage {
  --gold: #ffcf87;
  --teal: #8adbd4;
}
.auth-card #auth-form[hidden] ~ #guest-btn {
  margin-top: 24px;
}
.stage-tools .ui-icon {
  width: 20px;
  height: 20px;
}
.resource.trophy .ui-icon {
  width: 23px;
  height: 23px;
}
@media (max-width: 650px) {
  .action-icon .ui-icon {
    width: 21px;
    height: 21px;
  }
  .resource-icon .ui-icon {
    width: 20px;
    height: 20px;
  }
  .stage-tools .ui-icon {
    width: 18px;
    height: 18px;
  }
}

.toasts {
  top: 100px;
  bottom: auto;
}
.army-tray {
  width: max-content;
  max-width: calc(100% - 32px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  justify-content: flex-start;
}
@media (max-width: 650px) {
  .toasts {
    top: 212px;
    bottom: auto;
  }
  .army-tray {
    max-width: calc(100% - 20px);
  }
}

:root {
  --control-line: #647d8b;
}
input,
select,
.button,
.icon-button {
  border-color: var(--control-line);
}
.auth-card input {
  border-color: #647d8b;
}
@media (prefers-color-scheme: light) {
  :root {
    --control-line: #6f8588;
  }
}
@media (max-width: 650px) {
  .inspector {
    max-height: min(250px, 30dvh);
    padding: 16px 20px;
  }
  .inspector > :last-child {
    margin-bottom: 0;
  }
  .inspector .overview-top {
    margin-right: 0;
  }
  .inspector .panel-bottom {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 0;
  }
  .inspector .panel-bottom .server-note {
    white-space: nowrap;
  }
  .modal-toolbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
  }
  .modal-toolbar > label {
    grid-column: 1;
    grid-row: 1;
  }
  .modal-toolbar select {
    grid-column: 2/-1;
    grid-row: 1;
    max-width: none;
  }
  .modal-toolbar input {
    grid-column: 1/3;
    grid-row: 2;
    width: 100%;
  }
  .modal-toolbar > button {
    grid-column: 3;
    grid-row: 2;
  }
  .training-controls .button {
    font-size: 12px;
  }
}
@media (max-width: 650px) and(max-height:700px) {
  .layout {
    grid-template-rows: minmax(220px, 1fr) auto;
  }
}

.building-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (max-width: 650px) {
  .inspector .building-actions {
    flex-direction: row;
  }
}
/* PHP multiplayer additions: compact, responsive, and no third-party assets/fonts. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.section-space {
  margin-top: 24px !important;
}
.social-form {
  display: grid;
  gap: 16px;
}
.social-form label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.social-form textarea {
  font: inherit;
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
  min-height: 88px;
  width: 100%;
  max-width: 100%;
}
.social-form textarea:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}
.form-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.compact-form {
  padding: 20px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.social-form .button {
  justify-self: start;
}
.social-form input,
.social-form select {
  width: 100%;
  min-width: 0;
}
.social-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.social-actions .button {
  flex: 1 1 auto;
}
.world-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.world-option {
  padding: 24px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  display: grid;
  gap: 8px;
  min-width: 0;
  transition: background 0.15s;
}
.world-option:hover {
  background: var(--panel);
  border-color: var(--teal);
}
.world-option img {
  width: 80px;
  height: 84px;
  object-fit: contain;
  justify-self: start;
  margin-bottom: 8px;
}
.world-option strong {
  font-size: 20px;
}
.world-option span {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
.pvp-rules {
  margin-bottom: 20px;
}
.social-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  margin: 16px 0 24px;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.social-tabs button {
  background: transparent;
  padding: 12px 14px;
  min-height: 44px;
  white-space: nowrap;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.social-tabs button.active {
  color: var(--teal);
  border-color: var(--teal);
}
.clan-top-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.clan-description {
  font-size: 15px;
  color: var(--muted);
  overflow-wrap: anywhere;
  margin-bottom: 16px;
}
.clan-chat-log {
  height: 300px;
  overflow: auto;
  padding: 4px 12px 16px 4px;
  scrollbar-width: thin;
}
.chat-message {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.chat-message > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-message strong {
  font-size: 14px;
  color: var(--teal);
}
.chat-message time {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}
.chat-message p {
  font-size: 15px;
  margin-top: 4px;
  white-space: pre-wrap;
}
.chat-message.system p {
  font-size: 14px;
  color: var(--muted);
}
.chat-message.system strong {
  color: var(--muted);
}
.chat-delete {
  background: transparent;
  color: var(--muted);
  width: 44px;
  min-height: 44px;
  font-size: 18px;
  flex-shrink: 0;
}
.chat-compose {
  display: flex;
  gap: 12px;
  margin: 16px 0 8px;
}
.chat-compose input {
  flex: 1;
  min-width: 0;
}
.chat-compose .button {
  flex-shrink: 0;
}
.member-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.member-row > div:first-child {
  min-width: 0;
}
.member-row strong {
  font-size: 15px;
  overflow-wrap: anywhere;
  display: block;
}
.member-row small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.member-identity {
  display: flex;
  gap: 12px;
  align-items: center;
}
.member-identity img {
  width: 48px;
  height: 54px;
  object-fit: contain;
  flex-shrink: 0;
}
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.row-actions .small {
  font-size: 13px;
  min-height: 44px;
  padding: 8px 12px;
}
.presence {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.donation-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}
.donation-row > img {
  width: 60px;
  height: 66px;
  object-fit: contain;
}
.treasury-grid,
.admin-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.treasury-grid > div,
.admin-metrics > div {
  display: grid;
  gap: 8px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  min-width: 0;
}
.treasury-grid small,
.admin-metrics small {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 1px;
}
.treasury-grid strong,
.admin-metrics strong {
  font-size: 30px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.treasury-grid > div:first-child strong {
  color: var(--gold);
}
.treasury-grid > div:last-child strong {
  color: var(--teal);
}
.admin-metrics {
  grid-template-columns: repeat(4, 1fr);
}
.admin-metrics > div {
  padding: 16px;
}
.admin-metrics strong {
  font-size: 26px;
}
.upgrade-clan {
  display: grid;
  gap: 12px;
}
.upgrade-clan .button {
  justify-self: start;
}
.danger-zone {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.war-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-top: 16px;
}
.war-pair {
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.war-pair strong {
  overflow-wrap: anywhere;
}
.war-pair span,
.versus-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}
.war-pair strong:last-child {
  text-align: right;
}
.war-score {
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  margin: 12px 0;
}
.war-score span {
  color: var(--muted);
  font-size: 18px;
  margin: 0 12px;
}
.war-scoreboard {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  align-items: center;
  gap: 16px;
  padding: 20px 0 24px;
}
.war-scoreboard > div {
  display: grid;
  gap: 8px;
  text-align: center;
  min-width: 0;
}
.war-scoreboard small {
  font-size: 15px;
  overflow-wrap: anywhere;
}
.war-scoreboard strong {
  font-size: 44px;
  color: var(--gold);
  line-height: 1.2;
}
.war-scoreboard > span,
.war-scoreboard > div > span {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.war-bases {
  margin: 16px 0 24px;
}
.war-base {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.war-base img {
  width: 64px;
  height: 70px;
  object-fit: contain;
}
.war-base h3 {
  font-size: 16px;
  overflow-wrap: anywhere;
}
.war-roster {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-top: 20px;
}
.war-roster summary {
  cursor: pointer;
  min-height: 32px;
}
.war-roster p {
  margin-top: 12px;
}
.clan-directory-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.clan-emblem {
  width: 56px;
  height: 64px;
  display: grid;
  place-items: center;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.clan-emblem img {
  width: 36px;
  height: 36px;
}
.clan-card-main h3 {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.clan-card-description {
  font-size: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
  margin: 8px 0;
}
.pending-apps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.pending-application {
  font-size: 13px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
}
.pending-application button {
  background: none;
  min-height: 44px;
  min-width: 32px;
  margin-left: 8px;
}
.checkbox-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.checkbox-row input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--teal);
}
.history-loot {
  text-align: right;
  white-space: nowrap;
}
.brand-button span {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.intro .brand > span {
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
}
@media (max-width: 650px) {
  .social-tabs {
    margin: 12px -4px 20px;
  }
  .social-tabs button {
    padding: 12px 10px;
  }
  .world-options {
    gap: 12px;
  }
  .world-option {
    padding: 16px;
  }
  .world-option img {
    width: 60px;
    height: 64px;
  }
  .world-option strong {
    font-size: 17px;
  }
  .world-option span {
    font-size: 13px;
  }
  .clan-top-actions {
    align-items: flex-start;
  }
  .form-two {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .clan-chat-log {
    height: 260px;
  }
  .chat-compose {
    gap: 8px;
  }
  .chat-compose .button {
    padding: 10px 14px;
  }
  .member-row {
    flex-wrap: wrap;
    gap: 12px;
  }
  .member-row .row-actions {
    margin-left: 0;
  }
  .member-identity img {
    width: 40px;
    height: 48px;
  }
  .member-row small {
    font-size: 13px;
  }
  .treasury-grid {
    gap: 12px;
  }
  .treasury-grid > div {
    padding: 16px;
  }
  .treasury-grid strong {
    font-size: 25px;
  }
  .admin-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .donation-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
  }
  .donation-row > img {
    width: 44px;
    height: 48px;
  }
  .donation-row .row-actions {
    grid-column: 2;
  }
  .clan-directory-card {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 16px;
    gap: 12px;
  }
  .clan-emblem {
    width: 40px;
    height: 48px;
  }
  .clan-emblem img {
    width: 28px;
    height: 28px;
  }
  .clan-directory-card > .row-actions {
    grid-column: 2;
  }
  .war-base {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
  }
  .war-base img {
    width: 48px;
    height: 54px;
  }
  .war-base .button {
    grid-column: 2;
    justify-self: start;
  }
  .war-scoreboard {
    grid-template-columns: 1fr 20px 1fr;
    gap: 8px;
  }
  .war-scoreboard strong {
    font-size: 36px;
  }
  .war-scoreboard small {
    font-size: 14px;
  }
  .compact-form {
    padding: 16px;
  }
  .social-actions {
    gap: 8px;
  }
  .social-actions .button {
    font-size: 14px;
  }
  .brand-button span {
    max-width: 160px;
  }
  .clan-shortcut {
    font-size: 22px;
  }
  .history-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .history-loot {
    grid-column: 2;
    text-align: left;
  }
  .social-form .button {
    width: 100%;
    justify-content: center;
  }
}
.clan-top-actions > .button {
  white-space: nowrap;
  flex-shrink: 0;
}
.clan-description,
.clan-card-description {
  white-space: pre-line;
}
.war-intro {
  display: grid;
  gap: 16px;
  justify-items: start;
  margin-bottom: 20px;
}
.war-intro p {
  max-width: 680px;
}
.war-intro .button {
  white-space: normal;
  max-width: 100%;
}
.clan-tab-panel > .notice + h3 {
  margin-top: 20px;
}
/* Legible textarea hints and separated destructive member actions. */
.social-form textarea::placeholder {
  color: #a5bac6;
  opacity: 1;
}
@media (max-width: 650px) {
  .pvp-grid {
    grid-template-columns: 1fr;
  }
  .pvp-grid .bot-top h3 {
    font-size: 16px;
  }
  .pvp-grid .bot-top small,
  .pvp-grid .loot-line {
    font-size: 14px;
  }
  .pvp-grid .bot-top img {
    width: 52px;
    height: 56px;
  }
  .pvp-grid .card-info .button {
    font-size: 14px;
  }
}
