/* ==========================================================================
   STATE WARS — city.css
   The Home City screen: the settlement view, the build menu and the panel for
   a selected building.

   Same rule as the battle screen — the menu never covers the city. The build
   list is a column beside it, and the information panel sits in one corner of
   the view rather than over the middle of it.
   ========================================================================== */

.screen--city { padding: 0; align-items: stretch; overflow: hidden; }

.city {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* ---------- top bar -------------------------------------------------------- */

.city__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: clamp(.7rem, 2.2vh, 1.2rem) var(--gutter) clamp(.55rem, 1.6vh, .9rem);
  border-bottom: 1px solid rgba(127, 216, 255, .14);
  background: linear-gradient(180deg, rgba(7, 13, 26, .92), rgba(7, 13, 26, .4));
}

.city__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: condensed;
  font-size: clamp(1.4rem, 4.2vw, 2.4rem);
  line-height: 1;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 calc(26px * var(--fx)) rgba(127, 216, 255, .32);
}

.city__stats { display: flex; align-items: center; gap: clamp(.8rem, 3vw, 2rem); }

.cstat { display: grid; gap: .1rem; justify-items: end; }

.cstat__label {
  font-family: var(--font-mono);
  font-size: .54rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--c-muted);
}

.cstat__value {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  letter-spacing: .04em;
  color: var(--c-gold);
}

/* ---------- layout --------------------------------------------------------- */

.city__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(13rem, 17rem);
  gap: clamp(.6rem, 1.6vw, 1.1rem);
  min-height: 0;
  padding: clamp(.5rem, 1.4vh, .9rem) var(--gutter) clamp(.7rem, 1.8vh, 1.1rem);
}

.city__view {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(127, 216, 255, .18);
  border-radius: 5px;
  overflow: hidden;
  background: #0a0f14;
}

#city-canvas { display: block; width: 100%; height: 100%; cursor: pointer; }

.city__hint {
  position: absolute;
  left: 50%;
  bottom: .7rem;
  transform: translateX(-50%);
  padding: .35rem .8rem;
  border-radius: 3px;
  background: rgba(4, 8, 16, .78);
  font-size: .76rem;
  color: var(--c-dim);
  white-space: nowrap;
  pointer-events: none;
}

.city__hint[data-live="true"] { color: var(--c-ice); }

/* ---------- build menu ----------------------------------------------------- */

.city__build {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: .5rem;
  min-height: 0;
  padding: clamp(.7rem, 2vw, 1rem);
  border: 1px solid rgba(127, 216, 255, .18);
  border-radius: 5px;
  background: linear-gradient(160deg, rgba(15, 30, 53, .9), rgba(9, 17, 31, .92));
}

.city__build-title {
  font-family: var(--font-mono);
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--c-gold);
}

.city__menu { display: grid; gap: .45rem; align-content: start; overflow-y: auto; min-height: 0; }

.city__build-note {
  font-size: .7rem;
  line-height: 1.5;
  color: var(--c-muted);
  border-top: 1px solid rgba(127, 216, 255, .12);
  padding-top: .5rem;
}

.bcard {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .55rem;
  border: 1px solid rgba(127, 216, 255, .2);
  border-radius: 4px;
  background: rgba(9, 18, 32, .7);
  text-align: left;
  transition: all var(--t-fast) var(--ease-out);
}

.bcard:hover { border-color: rgba(127, 216, 255, .5); background: rgba(20, 38, 62, .8); }
.bcard.is-on { border-color: var(--c-gold); background: rgba(255, 194, 92, .14); }
.bcard[data-poor="true"] { opacity: .45; }

.bcard__art {
  flex: 0 0 auto;
  width: 52px;
  height: 44px;
  border-radius: 3px;
  background: rgba(4, 8, 16, .5);
}

.bcard__icon { display: block; width: 52px; height: 44px; }

.bcard__body { display: grid; gap: .05rem; min-width: 0; }

.bcard__name {
  font-family: var(--font-display);
  font-size: .82rem;
  letter-spacing: .05em;
  color: var(--c-text);
}

.bcard__cost {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .1em;
  color: var(--c-gold);
}

.bcard__have {
  font-family: var(--font-mono);
  font-size: .54rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c-muted);
}

/* ---------- the selected building ------------------------------------------ */

.cpanel {
  position: absolute;
  top: .7rem;
  right: .7rem;
  width: min(17rem, 62%);
  max-height: calc(100% - 1.4rem);
  overflow-y: auto;
  padding: .8rem .85rem 1rem;
  border: 1px solid rgba(127, 216, 255, .28);
  border-radius: 5px;
  background: linear-gradient(160deg, rgba(11, 24, 42, .97), rgba(7, 14, 26, .98));
  box-shadow: 0 18px 44px rgba(0, 0, 0, .5);
}

.cpanel__close {
  position: absolute;
  top: .3rem;
  right: .45rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--c-muted);
  background: none;
  border: 0;
}

.cpanel__close:hover { color: #fff; }

.cpanel__kicker {
  font-family: var(--font-display);
  font-size: .9rem;
  letter-spacing: .07em;
  color: var(--c-gold);
  padding-right: 1rem;
}

.cpanel__desc { font-size: .74rem; line-height: 1.5; color: var(--c-dim); margin: .25rem 0 .6rem; }

.cpanel__label {
  font-family: var(--font-mono);
  font-size: .54rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-top: .5rem;
}

.cpanel__list { display: grid; gap: .15rem; margin: .25rem 0 .1rem; padding-left: .9rem; }
.cpanel__list li { font-size: .76rem; line-height: 1.45; color: #7fe0a8; }
.cpanel__list--next li { color: var(--c-ice); }

.cpanel__none,
.cpanel__max { font-size: .74rem; color: var(--c-muted); margin-top: .2rem; }

.cpanel__go { width: 100%; margin-top: .6rem; }

.cpanel__why {
  font-size: .68rem;
  color: #ff9a8a;
  margin-top: .3rem;
  text-align: center;
}

.cpanel__scrap { width: 100%; margin-top: .55rem; font-size: .55rem; }

/* The HOME CITY entry on the campaign map. */
.chip--city {
  border-color: rgba(127, 224, 168, .5);
  color: #7fe0a8;
  background: rgba(127, 224, 168, .1);
}

.chip--city:hover { background: #7fe0a8; border-color: #7fe0a8; color: #04241a; }

@media (max-width: 860px) {
  .city__body { grid-template-columns: 1fr; grid-template-rows: minmax(11rem, 1fr) auto; }
  .city__build { max-height: 40vh; }
  .city__menu { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
  .cpanel { width: min(15rem, 80%); }
}
