:root {
  color-scheme: dark;
  --bg: #080b11;
  --panel: rgba(15, 20, 29, .88);
  --card: rgba(29, 35, 46, .92);
  --line: rgba(255, 255, 255, .12);
  --text: #f5f7fb;
  --muted: #a5afbf;
  --gold: #f3ba2f;
  --green: #25d6a2;
  --blue: #58b7ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

.app {
  position: relative;
  min-height: 100vh;
  padding: 10px clamp(6px, .8vw, 14px) 16px;
  overflow-x: hidden;
}

.city-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    radial-gradient(circle at 20% 8%, rgba(243, 186, 47, .18), transparent 26rem),
    linear-gradient(180deg, #05070b, #080b11);
  background-size: cover;
  background-position: center;
}

.city-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 12%, rgba(243, 186, 47, .22), transparent 24rem),
    radial-gradient(circle at 90% 20%, rgba(88, 183, 255, .18), transparent 24rem);
}

.topbar {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1900px, 100%);
  margin: 0 auto 10px;
}

.brand,
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 42px;
  border-radius: 8px;
  background: rgba(243, 186, 47, .12);
  color: #161006;
  font-weight: 950;
}

.brand-mark img {
  width: 30px;
  height: auto;
  display: block;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 20px;
}

.map-capacity {
  color: var(--gold);
  font-size: 16px;
  font-weight: 850;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

.wallet-button,
.secondary {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 850;
}

.wallet-button {
  background: var(--gold);
  color: #151006;
}

.secondary {
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line);
}

.city-stage {
  position: relative;
  width: min(1900px, 100%);
  height: calc(100vh - 72px);
  min-height: 760px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  overflow: hidden;
  background: #070a10;
  cursor: grab;
  user-select: none;
}

.city-stage.dragging {
  cursor: grabbing;
}

.city-stage::before {
  content: none;
}

.map-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 260%;
  aspect-ratio: 14840 / 8280;
  height: auto;
  transform: translate(var(--map-x, 0px), var(--map-y, 0px));
  transition: transform .08s linear;
  will-change: transform;
}

.city-art,
.city-shade {
  position: absolute;
  top: 0;
  bottom: 0;
}

.city-art {
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
  display: block;
}

.city-shade {
  left: 0;
  right: 0;
  background:
    linear-gradient(180deg, rgba(5, 7, 11, .08), transparent 36%, rgba(5, 7, 11, .22)),
    linear-gradient(90deg, rgba(5, 7, 11, .22), transparent 16%, transparent 78%, rgba(5, 7, 11, .18));
  pointer-events: none;
}

.hud {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
  width: min(650px, calc(100% - 24px));
  margin: 12px 0 0 12px;
}

.hud div {
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: rgba(12, 17, 25, .78);
  backdrop-filter: blur(12px);
}

.hud span,
.hud strong {
  display: block;
}

.hud span {
  color: var(--muted);
  font-size: 13px;
}

.hud strong {
  margin-top: 4px;
  font-size: 24px;
}

.main-city {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  transform: none;
}

.hotspot {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 186, 47, .28), rgba(243, 186, 47, .06) 42%, transparent 70%);
  border: 1px solid rgba(243, 186, 47, .22);
  opacity: .18;
  transition: opacity .18s ease, transform .18s ease;
}

.hotspot:hover,
.hotspot:focus-visible {
  opacity: 1;
  outline: none;
  transform: scale(1.04);
}

.hotspot-city {
  left: 43%;
  top: 28%;
  width: 18%;
  height: 42%;
}

.hotspot-solar {
  left: 7%;
  top: 38%;
  width: 19%;
  height: 31%;
}

.hotspot-road {
  left: 20%;
  bottom: 5%;
  width: 25%;
  height: 28%;
}

.player-plot {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  place-items: center;
  width: auto;
  min-height: 0;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid rgba(243, 186, 47, .24);
  background: rgba(9, 13, 20, .32);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .24);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.player-plot:hover,
.player-plot:focus-visible {
  outline: none;
  transform: translateY(-3px);
  border-color: rgba(243, 186, 47, .86);
  background: rgba(243, 186, 47, .14);
}

.player-plot span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold), rgba(243, 186, 47, .18));
  box-shadow: 0 0 14px rgba(243, 186, 47, .72);
  flex: 0 0 auto;
}

.player-plot strong {
  margin-top: 0;
  font-size: 10px;
  white-space: nowrap;
}

.player-plot em {
  min-width: 34px;
  padding: 2px 5px;
  border-radius: 6px;
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  background: rgba(255, 255, 255, .08);
}

.player-plot.high-rate em {
  color: var(--green);
}

.player-plot.mid-rate em {
  color: var(--gold);
}

.player-plot.low-rate em {
  color: #ff7b7b;
}

.player-plot.raid-locked {
  opacity: .62;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, .16);
}

.player-plot.raid-locked em {
  color: var(--muted);
}

.miner-self {
  border-color: rgba(37, 214, 162, .78);
  background: rgba(37, 214, 162, .16);
}

.miner-self span {
  background: radial-gradient(circle, var(--green), rgba(37, 214, 162, .18));
  box-shadow: 0 0 18px rgba(37, 214, 162, .8);
}

.plot-a {
  left: 46%;
  top: 43%;
}

.plot-b {
  left: 58%;
  top: 57%;
}

.plot-c {
  left: 15%;
  top: 57%;
}

.plot-d {
  left: 35%;
  bottom: 18%;
}

.live-toggle,
.miner-status-toggle,
.rank-toggle,
.rules-toggle {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 4;
  width: 116px;
  height: 50px;
  padding: 0;
  border-radius: 8px;
  color: var(--text);
  background: rgba(7, 10, 15, .72);
  border: 1px solid rgba(255, 255, 255, .14);
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}

.rank-toggle {
  top: 116px;
}

.miner-status-toggle {
  top: 66px;
}

.rules-toggle {
  top: 166px;
}

.live-panel,
.rank-panel,
.rules-panel {
  position: absolute;
  right: 148px;
  top: 66px;
  z-index: 6;
  width: min(320px, calc(100% - 32px));
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(7, 10, 15, .62);
  backdrop-filter: blur(14px);
  display: none;
}

.rank-panel {
  top: 166px;
}

.rules-panel {
  top: 216px;
}

.live-panel.open,
.rank-panel.open,
.rules-panel.open {
  display: block;
}

.live-close,
.rank-close,
.rules-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.map-hint {
  position: absolute;
  left: 50%;
  bottom: 58px;
  z-index: 4;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 8px;
  color: rgba(245, 247, 251, .78);
  background: rgba(7, 10, 15, .48);
  border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(10px);
  font-size: 13px;
}

.live-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.live-heading strong {
  color: var(--green);
}

#activityFeed {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

#activityFeed li {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .065);
}

#activityFeed b {
  color: var(--gold);
  font-size: 13px;
}

#activityFeed span {
  color: #d9e0ec;
  font-size: 14px;
}

.rank-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.rank-list li {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .065);
}

.rank-list b {
  color: var(--gold);
}

.rank-list span {
  color: #d9e0ec;
  font-size: 13px;
}

.rank-list span small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.rank-list strong {
  color: var(--green);
}

.rank-list .self-rank {
  border: 1px solid rgba(37, 214, 162, .48);
  background: rgba(37, 214, 162, .12);
}

.rules-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.rules-list p {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  color: #d9e0ec;
  line-height: 1.55;
  background: rgba(255, 255, 255, .065);
}

.main-city p {
  display: none;
}

.city-board {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: min(430px, 100%);
  padding: 18px;
  overflow-y: auto;
  background: rgba(7, 10, 15, .92);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
  transform: translateX(105%);
  transition: transform .24s ease;
}

.city-board.open {
  transform: translateX(0);
}

.drawer-close {
  position: sticky;
  top: 0;
  z-index: 2;
  justify-self: end;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line);
  font-size: 28px;
  line-height: 1;
}

.panel {
  min-height: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, .34);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 15px;
}

.panel-heading strong {
  color: var(--gold);
  font-size: 17px;
}

.city-core {
  display: flex;
  align-items: center;
  gap: 20px;
}

.core-ring {
  display: grid;
  place-items: center;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  padding: 5px;
  background: conic-gradient(var(--gold), #95dc68, #41d1c6, var(--blue), var(--gold));
  flex: 0 0 auto;
}

.core-ring span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #111722;
  font-size: 44px;
  font-weight: 900;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

.city-core p,
.operation small,
.note {
  color: var(--muted);
}

.city-core p {
  margin: 10px 0 0;
  font-size: 17px;
  line-height: 1.45;
  word-break: break-all;
}

.rename-button {
  margin-top: 10px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--text);
  font-weight: 800;
}

.rename-button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.stats div {
  min-height: 104px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: var(--card);
  border-radius: 8px;
}

.stats span,
.stats strong {
  display: block;
}

.stats span {
  color: var(--muted);
  font-size: 16px;
}

.stats strong {
  margin-top: 8px;
  font-size: 30px;
  line-height: 1.1;
}

.operation-list {
  display: grid;
  gap: 14px;
}

.operation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 88px;
  padding: 14px;
  text-align: left;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
}

.operation:hover,
.operation:focus-visible {
  outline: none;
  border-color: rgba(243, 186, 47, .72);
  background: rgba(243, 186, 47, .11);
}

.operation strong,
.operation small {
  display: block;
}

.operation strong {
  font-size: 18px;
}

.operation small {
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.35;
}

.operation b {
  color: var(--green);
  font-size: 17px;
  white-space: nowrap;
}

.flow {
  display: grid;
  gap: 14px;
}

.flow div {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 18px;
  border-radius: 8px;
  background: rgba(27, 33, 44, .95);
  border-left: 5px solid var(--gold);
  font-size: 18px;
  font-weight: 900;
}

.note {
  margin: 26px 0 0;
  font-size: 15px;
  line-height: 1.85;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(16, 21, 30, .96);
  border: 1px solid rgba(243, 186, 47, .42);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .35);
  transition: .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .42);
}

.modal.open {
  display: grid;
}

.modal-card {
  width: min(360px, 100%);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(15, 20, 29, .96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
}

.modal-card h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.modal-card input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  font: inherit;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 1050px) {
}

@media (max-width: 620px) {
  .app {
    padding: 12px;
  }

  .topbar,
  .top-actions,
  .operation {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: flex-start;
  }

  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .city-stage {
    min-height: 72vh;
    height: calc(100vh - 156px);
  }

  .live-panel,
  .rank-panel,
  .rules-panel {
    top: 64px;
    right: 12px;
    width: calc(100% - 24px);
  }

  .rank-panel {
    top: 164px;
  }

  .rules-panel {
    top: 214px;
  }

  .live-toggle,
  .miner-status-toggle,
  .rank-toggle,
  .rules-toggle {
    right: 12px;
  }

  .rank-toggle {
    top: 116px;
  }

  .miner-status-toggle {
    top: 66px;
  }

  .rules-toggle {
    top: 166px;
  }


  .top-actions,
  .wallet-button,
  .secondary,
  .operation {
    width: 100%;
  }

  .city-core {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}
