:root {
  --sky: #7ec6ef;
  --ink: #1a2420;
  --panel: rgba(244, 239, 226, 0.94);
  --go: #2d8a3c;
  --go-ink: #f4f0e2;
  --shadow: 0 8px 0 rgba(20, 32, 24, 0.18);
  --edge: #2a332c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background: #7ec6ef;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
}

#view {
  display: block;
  width: 100%;
  height: 100%;
}

html.looking,
html.looking * {
  cursor: none !important;
}

html.looking .hud button,
html.looking .inspect button,
html.looking .overlay button,
html.looking .hotbar button,
html.looking .meter.stronghold,
html.looking .meter.stronghold * {
  cursor: pointer !important;
}

html:not(.playing) .hud {
  display: none;
}

.hud {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.hud * {
  pointer-events: auto;
}

.top {
  inset: 10px 10px auto 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hud-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.toast {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 102px;
  transform: translateX(-50%);
  margin: 0;
  max-width: min(420px, calc(100% - 24px));
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 8px;
  box-shadow: 0 4px 0 rgba(20, 32, 24, 0.16);
  pointer-events: none;
}

.toast[hidden] {
  display: none;
}

.meters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.meter {
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 8px;
  padding: 4px 8px 3px;
  min-width: 58px;
  box-shadow: 0 4px 0 rgba(20, 32, 24, 0.16);
}

.meter span {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.meter.gold.admin {
  border-color: #b8860b;
}

.meter.gold.admin strong {
  color: #8a5a00;
}

.meter strong {
  font-size: 16px;
  line-height: 1.1;
}

.meter small {
  display: block;
  font-size: 10px;
  opacity: 0.65;
}

.stronghold {
  min-width: 108px;
}

.army {
  min-width: 88px;
}

.hp-track {
  height: 8px;
  margin: 3px 0 2px;
  border-radius: 99px;
  background: #d7c8a6;
  overflow: hidden;
}

.hp-track i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #e85d4c, #f2b01e);
}

.hp-track.army-hp i {
  background: linear-gradient(90deg, #3a62c8, #6b4a9b);
}

.hud-actions {
  display: flex;
  gap: 8px;
}

.hotbar {
  inset: auto 8px 10px 8px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
}

.hotbar button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 70px;
  padding: 5px 8px 6px;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 8px;
  box-shadow: 0 4px 0 rgba(20, 32, 24, 0.16);
  color: var(--ink);
  text-align: left;
}

.hotbar button kbd {
  font: 700 10px/1 "Space Grotesk", system-ui, sans-serif;
  opacity: 0.55;
}

.hotbar button strong {
  font-size: 13px;
  line-height: 1.1;
}

.hotbar button em {
  font-style: normal;
  font-size: 11px;
  opacity: 0.7;
}

.hotbar button.on {
  background: #2d8a3c;
  border-color: #1f5f2a;
  box-shadow: 0 4px 0 rgba(20, 32, 24, 0.2);
  color: #f4f0e2;
}

.hotbar button.on kbd,
.hotbar button.on em {
  opacity: 0.85;
}

.hotbar button.bad strong,
.hotbar button.bad em {
  color: #b44232;
}

button {
  font: inherit;
  border: 0;
  cursor: pointer;
}

.go,
.ghost,
.inspect-actions button {
  border: 2px solid var(--edge);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 4px 0 rgba(20, 32, 24, 0.16);
}

.go {
  background: var(--go);
  color: var(--go-ink);
  font-weight: 600;
}

.go:disabled {
  opacity: 0.45;
  cursor: default;
}

.ghost {
  background: var(--panel);
}

.inspect {
  position: absolute;
  z-index: 5;
  right: 10px;
  top: 72px;
  width: 240px;
  background: var(--panel);
  border: 2px solid var(--edge);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 4px 0 rgba(20, 32, 24, 0.16);
}

.inspect.barracks-menu {
  top: auto;
  bottom: 16px;
  width: min(420px, calc(100% - 16px));
  z-index: 4;
}

.inspect-hp {
  margin-bottom: 8px;
}

.inspect-hp span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.65;
}

.inspect-title {
  margin: 0;
  font-weight: 700;
}

.inspect-meta {
  margin: 6px 0 10px;
  font-size: 14px;
  opacity: 0.8;
}

.inspect-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inspect-actions button.upgrade-building {
  background: var(--go);
  color: var(--go-ink);
  font-weight: 600;
  text-align: center;
}

.inspect-actions button.upgrade-building:disabled {
  background: #fff6d8;
  color: var(--ink);
  opacity: 0.55;
  font-weight: 500;
}

.inspect-actions p {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.75;
}

.army-track {
  height: 10px;
  border-radius: 2px;
  background: #d7c8a6;
  overflow: hidden;
  border: 1px solid var(--edge);
}

.army-track i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3a62c8, #6b4a9b);
}

.army-mix {
  margin: 0 !important;
  font-size: 12px !important;
}

.troop-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.inspect-actions .troop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 0;
  min-width: 0;
  padding: 7px 4px 6px;
  text-align: center;
  user-select: none;
}

.upgrade-card {
  background: #fff6d8;
  border: 2px solid var(--edge);
  border-radius: 8px;
  padding: 6px 4px 6px;
}

.upgrade-card button {
  width: 100%;
  margin-top: 2px;
  padding: 4px 4px;
  font-size: 10px;
  box-shadow: none;
}

.troop-card:disabled {
  opacity: 0.42;
  cursor: default;
}

.troop-icon {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1px solid rgba(26, 36, 32, 0.22);
  background: #efe4c4;
  object-fit: contain;
  pointer-events: none;
}

.troop-card strong {
  font-size: 11px;
  line-height: 1.15;
}

.troop-card em {
  font-style: normal;
  font-size: 10px;
  opacity: 0.7;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(40, 80, 110, 0.35);
}

.overlay[hidden] {
  display: none;
}

.card {
  width: min(400px, calc(100% - 32px));
  background: var(--panel);
  border: 3px solid var(--edge);
  border-radius: 12px;
  padding: 28px 28px 22px;
  box-shadow: var(--shadow);
}

.card.slim {
  width: min(340px, calc(100% - 32px));
}

.card.slim h2 {
  margin: 6px 0 18px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 15px;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  opacity: 0.65;
}

.card h2 {
  margin: 6px 0 12px;
  font-size: 36px;
}

.card ul {
  margin: 0 0 18px;
  padding-left: 18px;
  line-height: 1.45;
}

.card .go {
  width: 100%;
  font-size: 20px;
}

.crosshair {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.crosshair[hidden] {
  display: none;
}

.crosshair i {
  position: absolute;
  background: rgba(247, 243, 234, 0.95);
  box-shadow: 0 0 0 1px rgba(20, 32, 24, 0.7);
}

.crosshair .n,
.crosshair .s {
  left: 13px;
  width: 2px;
  height: 7px;
}

.crosshair .n {
  top: 0;
}

.crosshair .s {
  bottom: 0;
}

.crosshair .w,
.crosshair .e {
  top: 13px;
  width: 7px;
  height: 2px;
}

.crosshair .w {
  left: 0;
}

.crosshair .e {
  right: 0;
}

.aim-tool {
  position: absolute;
  left: 50%;
  top: 36px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f7f3ea;
  text-shadow:
    0 1px 0 #1a2420,
    0 0 8px rgba(20, 32, 24, 0.8);
}

.aim-tool[hidden] {
  display: none;
}

.aim-tool.bad {
  color: #ff9a8a;
}

.look-prompt {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  margin: 0;
  pointer-events: none;
  background: var(--panel);
  border: 2px solid var(--edge);
  padding: 5px 8px;
  font-size: 12px;
  box-shadow: 0 4px 0 rgba(20, 32, 24, 0.16);
}

.look-prompt[hidden] {
  display: none;
}

html[data-shot] .hud,
html[data-shot] .inspect,
html[data-shot] .look-prompt,
html[data-shot] .overlay,
html[data-shot] .toast,
html[data-shot] .crosshair {
  display: none !important;
}
