@font-face {
  font-family: Grid;
  src: local("Bahnschrift");
}
* {
  box-sizing: border-box;
}
:root {
  color-scheme: dark;
  --ink: #112b2b;
  --panel: #132c2cf2;
  --line: #ffffff19;
  --text: #f0f3df;
  --muted: #a9b9ac;
  --gold: #f3c967;
  --teal: #6fddc2;
  --danger: #ff887b;
  --shadow: 0 12px 36px #031f2860;
}
body {
  margin: 0;
  font:
    16px/1.5 Grid,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--ink);
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  min-height: 44px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #27403e;
  color: var(--text);
  padding: 10px 16px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: #39554c;
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  background: #0b2124;
  border: 1px solid #78908060;
  border-radius: 8px;
  color: var(--text);
  min-height: 44px;
}
label {
  display: grid;
  gap: 7px;
  font-size: 14px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 36px;
  line-height: 1.12;
  letter-spacing: -1px;
}
h2 {
  font-size: 24px;
  line-height: 1.2;
}
h3 {
  font-size: 18px;
}
a {
  color: var(--gold);
}
[hidden] {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.gold {
  color: var(--gold);
}
.danger,
.error {
  color: var(--danger);
}
.error {
  min-height: 20px;
  font-size: 14px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 1.8px;
  font-weight: 700;
  color: var(--muted);
}
.primary {
  background: var(--gold);
  color: #25352b;
  border-color: #ffe4a0;
  box-shadow: 0 3px 0 #9b7a3f;
  font-weight: 750;
}
.primary:hover {
  background: #ffe09a;
}
.wide {
  width: 100%;
}
.square {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
  flex: none;
}
.text-button {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 14px;
}
.panel {
  background: var(--panel);
  border: 1px solid #99b29145;
  box-shadow: var(--shadow);
  border-radius: 14px;
}
#game {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 320px;
}
#map {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
  background: #375e50;
}
.hud {
  position: absolute;
  left: 24px;
  right: 24px;
  top: max(20px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 18px;
  pointer-events: none;
}
.hud > * {
  pointer-events: auto;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font-size: 24px;
  font-weight: 850;
  letter-spacing: 1px;
  text-shadow: 0 2px 2px #173a31;
}
.brand small {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2.3px;
  color: #d9e2cd;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #283e30;
  width: 46px;
  height: 50px;
  clip-path: polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
  font-size: 42px;
}
.resource-bar {
  display: flex;
  gap: 9px;
  margin-left: auto;
  max-width: 65%;
  overflow: auto;
  scrollbar-width: none;
}
.resource-chip {
  background: var(--panel);
  border: 1px solid #ffffff25;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 7px 13px;
  min-width: 118px;
  box-shadow: 0 3px 0 #163b3550;
}
.resource-chip > span {
  font-size: 24px;
  color: var(--gold);
}
.resource-chip b {
  font-size: 16px;
  line-height: 1.2;
  display: block;
}
.resource-chip small {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.grid-meter {
  position: absolute;
  left: 24px;
  top: 112px;
  width: 230px;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid #99b29145;
  border-radius: 13px;
  box-shadow: var(--shadow);
}
.load {
  display: flex;
  align-items: baseline;
  gap: 9px;
  line-height: 1.2;
  margin: 5px 0 13px;
}
.load > span {
  font-size: 48px;
  letter-spacing: -2px;
  font-weight: 800;
}
.load small {
  color: var(--gold);
  font-size: 20px;
}
.meter {
  height: 5px;
  background: #365145;
  border-radius: 9px;
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.6s;
}
.meter-caption {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  margin-top: 8px;
}
.status-dot:before {
  content: "";
  display: inline-block;
  border-radius: 50%;
  width: 6px;
  height: 6px;
  background: var(--teal);
  margin-right: 5px;
}
.mission {
  position: absolute;
  left: 24px;
  top: 300px;
  width: 230px;
  padding: 18px 20px;
  background: #e9edd9;
  color: #243e32;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--gold);
}
.mission .eyebrow {
  color: #59705d;
  font-size: 10px;
  letter-spacing: 1px;
  display: flex;
  gap: 5px;
}
.mission .eyebrow span:last-child {
  margin-left: auto;
}
.mission h2 {
  font-size: 20px;
  margin: 13px 0 9px;
}
.mission p {
  font-size: 14px;
  color: #526451;
  line-height: 1.55;
}
.mission button {
  width: 100%;
  margin-top: 16px;
  font-size: 14px;
}
.map-tools {
  position: absolute;
  right: 24px;
  bottom: 120px;
  display: grid;
  gap: 6px;
}
.map-tools button {
  background: var(--panel);
  box-shadow: var(--shadow);
}
.coordinate {
  position: absolute;
  left: 25px;
  bottom: 26px;
  font-size: 11px;
  letter-spacing: 1.3px;
  background: #173c326b;
  padding: 7px 12px;
  border-radius: 7px;
}
.bottom-nav {
  position: absolute;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: #122b2bee;
  padding: 7px;
  border: 1px solid #b6c9a23a;
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.bottom-nav button {
  position: relative;
  background: transparent;
  border: 0;
  min-width: 100px;
  padding: 6px 15px;
  color: #c6d6be;
}
.bottom-nav button:hover {
  background: #345043;
}
.bottom-nav button span {
  display: block;
  font-size: 25px;
  line-height: 1.2;
  color: #b9cbb1;
}
.bottom-nav button b {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.bottom-nav .nav-build {
  background: var(--gold);
  color: #213d30;
}
.bottom-nav .nav-build span {
  color: #213d30;
}
.bottom-nav i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  position: absolute;
  right: 15px;
  top: 8px;
}
.mode-banner {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 100px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 8px 8px 8px 20px;
  background: var(--gold);
  color: #203d31;
  border-radius: 12px;
  max-width: 65%;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.mode-banner button {
  color: #203d31;
  background: #0001;
  border: 0;
}
.selection {
  position: absolute;
  right: 24px;
  top: 112px;
  width: 280px;
  padding: 20px;
  max-height: calc(100dvh - 230px);
  overflow: auto;
}
.selection .mini-art {
  height: 110px;
  width: 100%;
  margin-bottom: 10px;
  background: #244639;
  border-radius: 8px;
}
.selection h2 {
  font-size: 21px;
}
.selection .eyebrow {
  margin-bottom: 7px;
}
.selection p {
  font-size: 14px;
  color: var(--muted);
  margin: 10px 0;
}
.selection .button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.selection .button-row button {
  flex: 1;
  font-size: 14px;
}
.selection .close-selection {
  float: right;
  background: none;
  border: 0;
  min-height: 30px;
  padding: 0 4px;
}
.stat-line {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.stat-line span {
  color: var(--muted);
}
dialog {
  border: 1px solid #839b7859;
  border-radius: 18px;
  background: #142e2c;
  color: var(--text);
  box-shadow: 0 24px 120px #0008;
  padding: 30px;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 30px);
  overflow: auto;
}
dialog::backdrop {
  background: #071c2280;
  backdrop-filter: blur(5px);
}
.auth-dialog {
  width: 430px;
  padding: 35px;
}
.auth-emblem {
  font-size: 64px;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 22px;
}
.auth-dialog h1 {
  margin: 10px 0 16px;
}
.auth-dialog > p {
  font-size: 14px;
}
.auth-dialog form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}
.auth-dialog .text-button {
  display: block;
  width: 100%;
  margin-top: 15px;
}
.language-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
  color: var(--muted);
}
.language-inline select {
  width: 160px;
  font-size: 14px;
}
.sheet {
  width: 880px;
  padding: 26px;
}
.sheet > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 23px;
  gap: 20px;
}
.sheet header h2 {
  margin-top: 5px;
  font-size: 28px;
}
.tabs {
  display: flex;
  gap: 7px;
  overflow: auto;
  padding-bottom: 14px;
  margin-bottom: 6px;
}
.tabs button {
  white-space: nowrap;
  font-size: 14px;
}
.tabs button.active {
  background: var(--gold);
  color: var(--ink);
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.build-card {
  background: #203c33;
  border: 1px solid #c4d3b221;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.build-card canvas {
  width: 100%;
  height: 125px;
  background: radial-gradient(ellipse at center, #47604b, #294235);
  display: block;
}
.card-content {
  padding: 15px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}
.card-content p {
  font-size: 13px;
  color: var(--muted);
}
.card-content button {
  margin-top: auto;
  font-size: 14px;
}
.cost {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--gold);
  font-size: 13px;
}
.help-text {
  color: var(--muted);
  font-size: 14px;
  margin: 14px 0;
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.list-row strong {
  display: block;
}
.list-row small {
  font-size: 12px;
  color: var(--muted);
}
.list-row button {
  font-size: 14px;
}
.list-row .rank {
  font-size: 20px;
  color: var(--gold);
  width: 30px;
}
.list-main {
  flex: 1;
}
.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.search-form input {
  flex: 1;
  min-width: 0;
}
.settings-form {
  display: grid;
  gap: 20px;
  max-width: 440px;
}
.settings-form a {
  font-size: 14px;
}
.color-slots {
  display: flex;
  gap: 9px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px 0;
}
.color-slots label {
  width: 110px;
}
.color-slots select {
  border-bottom: 4px solid var(--gold);
}
.defense-dialog {
  width: 490px;
  text-align: center;
  border-color: var(--danger);
}
.defense-dialog h2 {
  margin-top: 16px;
}
.defense-clock {
  font-size: 70px;
  color: var(--danger);
  line-height: 1.2;
  margin: 15px 0;
}
.defense-dialog p {
  font-size: 14px;
}
.attack-form {
  display: grid;
  gap: 16px;
  max-width: 500px;
  margin: auto;
}
.attack-form .color-slots {
  justify-content: start;
  margin: 0;
}
.attack-card {
  border: 1px solid #a5c29435;
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  background: #203c33;
}
.attack-card small {
  color: var(--muted);
}
#toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 120px;
  background: #e6ecd5;
  color: #23432f;
  border-left: 4px solid var(--gold);
  padding: 14px 24px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 85%;
  font-size: 14px;
  z-index: 15;
}
#connection-status {
  position: absolute;
  right: 24px;
  top: 82px;
  color: var(--gold);
  font-size: 12px;
  padding: 5px 10px;
  background: var(--panel);
  border-radius: 5px;
}
#timers {
  font-size: 12px;
  color: var(--gold);
  margin-top: 8px;
}
.mini-progress {
  height: 4px;
  background: #243b35;
  margin-top: 10px;
}
.mini-progress i {
  display: block;
  height: 100%;
  background: var(--teal);
}
.empty {
  text-align: center;
  padding: 35px 15px;
  color: var(--muted);
}
.badge {
  display: inline-block;
  padding: 3px 7px;
  background: #496448;
  border-radius: 5px;
  font-size: 11px;
  color: #d9e3c8;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.profile-stats > div {
  padding: 15px;
  background: #254238;
  border-radius: 8px;
}
.profile-stats b {
  display: block;
  font-size: 24px;
  color: var(--gold);
}
.profile-stats small {
  color: var(--muted);
}
@media (min-width: 1600px) {
  .hud {
    left: 36px;
    right: 36px;
    top: 30px;
  }
  .grid-meter,
  .mission {
    left: 36px;
    width: 250px;
  }
  .grid-meter {
    top: 130px;
  }
  .mission {
    top: 330px;
  }
  .selection {
    right: 36px;
    top: 130px;
  }
}
@media (max-width: 1050px) {
  .brand {
    font-size: 20px;
  }
  .brand small {
    font-size: 8px;
  }
  .resource-chip {
    min-width: 90px;
    padding: 6px 10px;
  }
  .resource-chip small {
    font-size: 9px;
  }
  .grid-meter {
    width: 205px;
    padding: 15px;
  }
  .mission {
    width: 205px;
    top: 280px;
    padding: 15px;
  }
  .selection {
    width: 250px;
  }
  .coordinate {
    display: none;
  }
}
@media (max-width: 700px) {
  .hud {
    left: 12px;
    right: 12px;
    top: max(12px, env(safe-area-inset-top));
    gap: 8px;
    align-items: flex-start;
  }
  .brand {
    font-size: 17px;
    gap: 5px;
  }
  .brand small {
    font-size: 6px;
    letter-spacing: 1px;
  }
  .brand-mark {
    width: 30px;
    height: 36px;
    font-size: 30px;
  }
  .hud > .square {
    width: 38px;
    height: 40px;
    font-size: 20px;
    min-height: 44px;
  }
  .resource-bar {
    max-width: calc(100% - 175px);
    gap: 5px;
  }
  .resource-chip {
    min-width: 89px;
    padding: 4px 7px;
    gap: 5px;
  }
  .resource-chip > span {
    font-size: 18px;
  }
  .resource-chip b {
    font-size: 14px;
  }
  .resource-chip small {
    font-size: 9px;
  }
  .grid-meter {
    top: 75px;
    left: 12px;
    width: 160px;
    padding: 10px 12px;
  }
  .grid-meter > .eyebrow {
    font-size: 9px;
  }
  .load {
    margin: 3px 0 9px;
  }
  .load > span {
    font-size: 32px;
  }
  .load small {
    font-size: 15px;
  }
  .meter-caption {
    font-size: 8px;
    display: block;
  }
  .meter-caption .status-dot {
    margin-left: 7px;
  }
  .mission {
    top: auto;
    left: 12px;
    right: 70px;
    bottom: 105px;
    width: auto;
    padding: 12px 14px;
    border-top-width: 3px;
  }
  .mission h2 {
    font-size: 16px;
    margin: 6px 0;
  }
  .mission p {
    font-size: 12px;
    line-height: 1.4;
  }
  .mission button {
    margin-top: 10px;
    min-height: 40px;
    padding: 8px;
  }
  .mission .eyebrow {
    font-size: 9px;
  }
  .bottom-nav {
    bottom: max(12px, env(safe-area-inset-bottom));
    gap: 0;
    padding: 5px;
    width: calc(100% - 24px);
    max-width: 440px;
  }
  .bottom-nav button {
    flex: 1;
    min-width: 0;
    padding: 6px 9px;
  }
  .bottom-nav button b {
    font-size: 11px;
  }
  .bottom-nav button span {
    font-size: 24px;
  }
  .map-tools {
    right: 12px;
    bottom: 110px;
    gap: 5px;
  }
  .map-tools .square {
    width: 44px;
    height: 44px;
  }
  .selection {
    top: auto;
    bottom: 102px;
    left: 12px;
    right: 70px;
    width: auto;
    max-height: 54dvh;
    padding: 15px;
  }
  .selection .mini-art {
    display: none;
  }
  .selection h2 {
    font-size: 18px;
  }
  .selection .stat-line {
    padding: 6px 0;
  }
  .selection p {
    margin: 6px 0;
    font-size: 12px;
  }
  .selection .eyebrow {
    font-size: 10px;
  }
  .selection .button-row {
    margin-top: 8px;
  }
  .selection .button-row button {
    font-size: 12px;
    padding: 8px;
  }
  .mode-banner {
    top: 75px;
    left: auto;
    right: 12px;
    transform: none;
    max-width: calc(100% - 195px);
    font-size: 12px;
    padding: 8px;
    gap: 3px;
  }
  .mode-banner button {
    padding: 5px;
    min-width: 32px;
  }
  .sheet {
    padding: 20px;
    max-width: 100vw;
    width: 100%;
    max-height: 85dvh;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
  }
  .sheet header h2 {
    font-size: 23px;
  }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .build-card canvas {
    height: 95px;
  }
  .card-content {
    padding: 12px;
    gap: 8px;
  }
  .card-content h3 {
    font-size: 15px;
  }
  .card-content p,
  .cost {
    font-size: 11px;
  }
  .card-content button {
    font-size: 12px;
    padding: 8px;
  }
  .auth-dialog {
    padding: 25px;
  }
  .auth-dialog h1 {
    font-size: 30px;
  }
  .auth-emblem {
    font-size: 48px;
    margin-bottom: 16px;
  }
  .auth-dialog form {
    gap: 12px;
    margin-top: 20px;
  }
  #toast {
    bottom: 100px;
    font-size: 13px;
    width: max-content;
    max-width: 85%;
    padding: 12px 16px;
  }
  #connection-status {
    top: 58px;
    right: 12px;
    font-size: 10px;
  }
  .list-row {
    padding: 12px 2px;
    gap: 8px;
  }
  .list-row strong {
    font-size: 14px;
  }
  .list-row button {
    font-size: 12px;
    padding: 8px;
  }
  .profile-stats {
    gap: 8px;
  }
  .profile-stats > div {
    padding: 12px;
  }
}
@media (max-height: 600px) and (min-width: 701px) {
  .grid-meter {
    top: 90px;
  }
  .mission {
    top: 252px;
    padding: 12px;
  }
  .mission h2 {
    font-size: 17px;
    margin: 5px 0;
  }
  .mission p {
    font-size: 12px;
  }
  .mission button {
    margin-top: 9px;
    padding: 7px;
    min-height: 36px;
  }
  .selection {
    top: 90px;
    max-height: calc(100dvh - 190px);
  }
  .selection .mini-art {
    display: none;
  }
  .bottom-nav {
    bottom: 12px;
  }
  .map-tools {
    bottom: 104px;
  }
}
@media (max-height: 500px) and (max-width: 950px) {
  .mission {
    display: none;
  }
  .grid-meter {
    top: 65px;
    left: 12px;
    width: 155px;
    padding: 10px;
  }
  .grid-meter .load > span {
    font-size: 26px;
  }
  .bottom-nav {
    width: 350px;
    left: 50%;
    max-width: 55%;
    bottom: 8px;
  }
  .selection {
    top: 70px;
    bottom: auto;
    left: auto;
    right: 65px;
    max-height: calc(100dvh - 155px);
    width: 240px;
  }
  .selection .mini-art {
    display: none;
  }
  .map-tools {
    bottom: 93px;
  }
  .auth-dialog {
    padding: 20px;
  }
  .auth-emblem,
  .auth-dialog > .eyebrow,
  .auth-dialog > .muted {
    display: none;
  }
  .auth-dialog form {
    gap: 8px;
    margin-top: 10px;
  }
  .auth-dialog h1 {
    font-size: 24px;
    margin: 0;
  }
  .auth-dialog label {
    gap: 3px;
  }
  .auth-dialog input {
    padding: 6px 10px;
    min-height: 38px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
