/* TAKE OVER KAMPALA (the district map, the title screen's crown and tax) and the CURSES picker.
   Markup in index.html (#kampala, #curses, #kmPair, #kingLine), drawn by ui/districts.js and ui/menus.js. */

/* ---------- shared: a heading with a line of stats beside it ---------- */
.kmHead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 18px;
  flex-shrink: 0;
}
#kmStat,
#cuStat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 14px;
  max-width: 760px;
  margin: 0;
  font:
    400 12px 'Bungee',
    sans-serif;
  letter-spacing: 0.08em;
  color: var(--dim);
  line-height: 1.3;
}
#kmStat b,
#cuStat b {
  color: var(--gd);
}
#kmStat em {
  font-style: normal;
  color: var(--tx);
}
#kmStat .king {
  color: var(--gd);
}
#kmStat .atk {
  color: var(--rd);
  animation: kmBlink 0.8s ease-in-out infinite alternate;
}
#kmStat .goal {
  color: rgba(183, 174, 214, 0.75);
}
.crown {
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.22em;
  margin-right: 5px;
}

/* ---------- the KAMPALA screen: the board and its pins on the left, the selected district's panel on the right */
#kampala {
  gap: 8px;
}
.kmBody {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 14px;
  width: min(1320px, 100%);
  flex-shrink: 0;
}
.kmCol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}
#kmMap {
  position: relative;
  width: min(880px, calc(100vw - 440px), calc((100vh - 200px) * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}
#kmSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#kmPins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* the board (SVG) */
.kmLake {
  fill: url(#kmLakeG);
}
.kmLakeT {
  fill: rgba(150, 190, 255, 0.6);
  font:
    400 17px 'Bungee',
    sans-serif;
  letter-spacing: 0.22em;
  text-anchor: end;
  pointer-events: none;
}
.kmWave {
  fill: none;
  stroke: rgba(150, 190, 255, 0.32);
  stroke-width: 3;
  stroke-linecap: round;
  pointer-events: none;
}
.kmD {
  fill: var(--c);
  fill-opacity: 0.2;
  stroke: var(--c);
  stroke-width: 9;
  stroke-opacity: 0.95;
  cursor: pointer;
  transition: fill-opacity 0.2s;
}
.kmD:hover {
  fill-opacity: 0.3;
}
.kmD.me {
  fill-opacity: 0.42;
}
.kmD.sel {
  fill-opacity: 0.36;
}
.kmD.me.sel {
  fill-opacity: 0.55;
}
.kmD.atk {
  stroke: var(--rd);
}
.kmHatch {
  fill: url(#kmStripe);
  pointer-events: none;
  animation: kmBlink 0.9s ease-in-out infinite alternate;
}
.kmGut {
  fill: none;
  stroke: #0c0922;
  stroke-width: 4;
  stroke-linejoin: round;
  pointer-events: none;
}
.kmSel {
  fill: none;
  stroke: #fff;
  stroke-width: 10;
  pointer-events: none;
}
.kmRc,
.kmRd {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.kmRc {
  stroke: #0c0922;
  stroke-width: 10;
  stroke-opacity: 0.85;
}
.kmRd {
  stroke: rgba(244, 239, 255, 0.62);
  stroke-width: 3.5;
}
.kmN {
  pointer-events: none;
}
.kmN path {
  fill: var(--dim);
}
.kmN text {
  fill: var(--dim);
  font:
    400 14px 'Bungee',
    sans-serif;
  text-anchor: middle;
}

/* a pin per district: its name and who holds it */
.kmPin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px 5px;
  border-radius: 10px;
  border: 1.5px solid var(--c);
  background: rgba(9, 7, 22, 0.88);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.12s;
}
.kmPin b {
  font:
    400 clamp(9px, 1.45vmin, 13px) / 1 'Bungee',
    sans-serif;
  letter-spacing: 0.04em;
  color: var(--tx);
}
.kmPin i {
  font:
    400 clamp(7.5px, 1.1vmin, 10px) / 1 'Bungee',
    sans-serif;
  font-style: normal;
  letter-spacing: 0.08em;
  color: var(--c);
}
.kmPin.me {
  background: rgba(46, 30, 0, 0.92);
}
.kmPin.sel {
  transform: translate(-50%, -50%) scale(1.12);
  border-color: #fff;
  z-index: 2;
}
.kmPin.atk {
  border-color: var(--rd);
  animation: kmPin 0.8s ease-in-out infinite alternate;
}
.kmPin.atk i {
  color: var(--rd);
}
.ov .kmPin.gpf {
  outline-offset: 2px;
}

/* the gangs and how many districts each holds */
#kmLegend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px 14px;
  font:
    400 10px 'Bungee',
    sans-serif;
  letter-spacing: 0.08em;
  color: var(--dim);
}
#kmLegend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c);
  margin-right: 5px;
  vertical-align: -1px;
}
#kmLegend b {
  color: var(--tx);
  font-weight: 400;
}

/* the selected district */
#kmInfo {
  flex: 0 1 370px;
  min-width: 0;
  border-radius: 16px;
  border-left: 4px solid var(--c, var(--gd));
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  overflow-y: auto;
}
.kmT {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.kmT b {
  font:
    400 clamp(15px, 2.5vmin, 22px) / 1.05 'Bungee',
    sans-serif;
  color: var(--tx);
}
.kmT em {
  flex-shrink: 0;
  font:
    400 10px 'Bungee',
    sans-serif;
  font-style: normal;
  letter-spacing: 0.1em;
  color: #0b0820;
  background: var(--c);
  padding: 3px 9px;
  border-radius: 999px;
}
#kmInfo .kmB {
  margin: 0;
  max-width: none;
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--dim);
}
#kmInfo .kmS {
  margin: 0;
  max-width: none;
  font-size: 12.5px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--tx);
}
#kmInfo .kmS b {
  display: block;
  margin-bottom: 2px;
  font:
    400 12px 'Bungee',
    sans-serif;
  letter-spacing: 0.06em;
  color: var(--c, var(--gd));
}
#kmInfo .kmS.me b {
  color: var(--gd);
}
#kmInfo .kmS.atk {
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 77, 94, 0.12);
  border: 1px solid rgba(255, 77, 94, 0.55);
}
#kmInfo .kmS.atk b {
  color: var(--rd);
}
#kmInfo .kmS u {
  text-decoration: none;
  color: var(--gd);
}
.kmR {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: auto;
}
.ov .kmRace {
  gap: 10px;
  padding: 7px 8px 7px 12px;
  text-align: left;
}
.kmRace span {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  font:
    400 13px 'Bungee',
    sans-serif;
  letter-spacing: 0.03em;
  color: var(--tx);
}
.kmRace small {
  font:
    400 11px 'Bungee',
    sans-serif;
  color: var(--dim);
}
.ov .kmRace b {
  flex-shrink: 0;
  font:
    400 13px 'Bungee',
    sans-serif;
  letter-spacing: 0.06em;
  color: #2a1200;
  background: var(--or);
  padding: 6px 12px 7px;
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--ord);
}
.ov .kmRace.def b {
  color: #fff;
  background: var(--rd);
  box-shadow: 0 3px 0 #7a1423;
}
.ov .kmRace:disabled b {
  color: var(--dim);
  background: rgba(190, 180, 255, 0.14);
  box-shadow: none;
}

/* ---------- the title screen: the crown, KAMPALA (or the attack) and the day's tax ---------- */
#kingLine {
  display: flex;
  align-items: center;
  gap: 4px 10px;
  padding: 4px 16px 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 194, 61, 0.55);
  background: rgba(42, 26, 0, 0.62);
  box-shadow: 0 0 22px rgba(255, 194, 61, 0.2);
  font:
    400 clamp(12px, 2.5vmin, 18px) 'Bungee',
    sans-serif;
  letter-spacing: 0.14em;
  color: var(--gd);
  text-shadow: 0 2px 0 var(--ord);
}
#kingLine .crown {
  width: 1.35em;
  height: 1.35em;
  margin: 0;
  filter: drop-shadow(0 2px 0 var(--ord));
}
#kingLine b {
  font-weight: 400;
}
#kingLine small {
  font:
    700 12px 'Chakra Petch',
    sans-serif;
  letter-spacing: 0.1em;
  color: var(--tx);
  text-shadow: none;
}
#kmPair .opt {
  gap: 8px;
}
#bKampala.atk {
  border-color: rgba(255, 77, 94, 0.7);
}
#bKampala.atk b {
  color: var(--rd);
  animation: kmBlink 0.8s ease-in-out infinite alternate;
}
.ov #bTax {
  color: #2a1200;
  background: linear-gradient(#ffd56e, #ffb92a);
  border-color: #ffe39c;
  box-shadow: 0 3px 0 var(--ord);
}
.ov #bTax b {
  color: #2a1200;
}
.ov #bTax.paid {
  opacity: 1;
  background: linear-gradient(#5ff2d6, #2ee6c5);
  border-color: #9fffe9;
  box-shadow: 0 3px 0 #127a68;
}

/* ---------- the race list: the curses button, a DEFEND tag on races that defend a district, the strip's line ---- */
#curseBtn {
  gap: 10px;
}
#curseBtn.cursed {
  border-color: rgba(255, 77, 94, 0.65);
}
#curseBtn.cursed b {
  color: var(--rd);
}
.card.race.atk {
  border-color: var(--rd);
  animation: kmCard 0.9s ease-in-out infinite alternate;
}
.card.race .def {
  font:
    400 9px 'Bungee',
    sans-serif;
  letter-spacing: 0.1em;
  color: #fff;
  background: var(--rd);
  padding: 2px 7px 3px;
  border-radius: 999px;
}
#raceInfo .mt {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  font-style: normal;
}
#raceInfo .mt i {
  font:
    400 11px 'Bungee',
    sans-serif;
  font-style: normal;
  letter-spacing: 0.06em;
  color: var(--k, var(--dim));
}
#raceInfo .mt i.atk,
#raceInfo .mt i.cu {
  color: var(--rd);
}

/* ---------- the CURSES picker: a card per curse, the multiplier at the top, the records under them ---------- */
#curses {
  gap: 10px;
}
/* the running total: the grid's eighth cell */
.cuTot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px;
  border-radius: 14px;
  border: 2px dashed rgba(255, 194, 61, 0.45);
  font:
    400 10px 'Bungee',
    sans-serif;
  letter-spacing: 0.1em;
  color: var(--dim);
}
.cuTot b {
  font:
    400 clamp(30px, 6vmin, 48px) / 1 'Bungee',
    sans-serif;
  color: var(--gd);
  text-shadow:
    0 3px 0 var(--ord),
    0 8px 16px #000;
}
.cuTot span {
  color: var(--tx);
}
.cuTot em {
  font-style: normal;
  color: var(--rd);
}
.cuTot.all {
  border-style: solid;
  border-color: var(--pk);
  box-shadow: 0 0 24px rgba(255, 61, 127, 0.45);
}
.cuTot.all b {
  color: var(--pk);
  text-shadow:
    0 3px 0 #8f1241,
    0 8px 16px #000;
}
#cuCards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: min(1100px, 100%);
  flex-shrink: 0;
}
.cuCard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
  padding: 11px 13px 12px;
  border-radius: 14px;
  border: 2px solid rgba(190, 180, 255, 0.2);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.12s,
    border-color 0.15s,
    background 0.15s;
}
.cuCard:hover,
.cuCard.gpf {
  transform: translateY(-3px);
}
.cuCard .hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cuCard .hd b {
  font:
    400 clamp(13px, 2.2vmin, 18px) / 1.05 'Bungee',
    sans-serif;
  color: var(--tx);
}
.cuCard .d {
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--dim);
}
.cuCard .d em {
  font:
    400 clamp(12px, 2vmin, 16px) 'Bungee',
    sans-serif;
  font-style: normal;
  color: var(--c);
  margin-right: 7px;
}
.cuCard .sw {
  flex-shrink: 0;
  font:
    400 10px 'Bungee',
    sans-serif;
  font-style: normal;
  letter-spacing: 0.14em;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(190, 180, 255, 0.12);
  color: var(--dim);
}
.cuCard.on {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 13%, rgba(14, 11, 30, 0.92));
  box-shadow: 0 0 20px color-mix(in srgb, var(--c) 35%, transparent);
}
.cuCard.on .hd b {
  color: var(--c);
}
.cuCard.on .d {
  color: var(--tx);
}
.cuCard.on .sw {
  background: var(--c);
  color: #0b0820;
}
.cuCard.na {
  opacity: 0.6;
}
.cuCard.na .d {
  color: var(--rd);
}
#cuRec {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px 16px;
  padding: 7px 16px;
  border-radius: 12px;
  font:
    400 12px 'Bungee',
    sans-serif;
  letter-spacing: 0.06em;
  color: var(--tx);
  flex-shrink: 0;
}
#cuRec > b {
  font-weight: 400;
  color: var(--dim);
}
#cuRec span i {
  font-style: normal;
  color: var(--dim);
  margin-right: 5px;
}
#cuRec span.cur {
  color: var(--gd);
}
#cuRec em {
  font-style: normal;
  color: var(--pk);
}
#cuRec em b {
  font-weight: 400;
  color: var(--tx);
}

@keyframes kmBlink {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.45;
  }
}
@keyframes kmPin {
  to {
    box-shadow: 0 0 16px rgba(255, 77, 94, 0.85);
  }
}
@keyframes kmCard {
  to {
    box-shadow: 0 0 18px rgba(255, 77, 94, 0.6);
  }
}
@media (prefers-reduced-motion: reduce) {
  .kmHatch,
  .kmPin.atk,
  .card.race.atk,
  #kmStat .atk,
  #bKampala.atk b {
    animation: none;
  }
}

/* ---------- phones held sideways (short screens): the board fills the left, the panel and BACK share the right */
@media (max-height: 560px) {
  #kmStat,
  #cuStat {
    font-size: 11px;
    gap: 2px 12px;
  }
  #kmStat .goal,
  #kmInfo .kmB {
    display: none;
  }
  #kampala {
    display: grid;
    grid-template-columns: auto minmax(0, 330px);
    grid-template-rows: auto minmax(0, 1fr) auto;
    justify-content: center;
    align-content: center;
    gap: 6px 12px;
  }
  #kampala .kmHead {
    grid-column: 1 / -1;
  }
  #kampala h2,
  #curses h2 {
    font-size: 26px;
  }
  #kampala .kmBody {
    display: contents;
  }
  #kampala .kmCol {
    grid-column: 1;
    grid-row: 2 / 4;
    align-self: center;
  }
  #kmMap {
    width: min(calc(100vw - 400px), calc((100vh - 100px) * 16 / 9));
    border-radius: 12px;
  }
  #kmInfo {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    padding: 9px 12px;
    gap: 7px;
  }
  .kmPin {
    padding: 3px 6px 4px;
    border-radius: 8px;
  }
  #kampala .menu.row {
    grid-column: 2;
    grid-row: 3;
  }
  #kampala .menu.row .go {
    width: 100%;
    padding: 8px 20px 10px;
  }
  #kmInfo .kmS {
    font-size: 12px;
    line-height: 1.32;
  }
  .ov .kmRace {
    padding: 5px 6px 5px 10px;
  }
  #curses {
    gap: 7px;
  }
  #cuCards {
    gap: 7px;
  }
  .cuCard {
    min-height: 0;
    padding: 8px 10px 9px;
    gap: 3px;
  }
  .cuCard .d {
    font-size: 11.5px;
    line-height: 1.25;
  }
  .cuCard .sw {
    padding: 2px 8px;
  }
  #cuRec {
    padding: 5px 12px;
    font-size: 11px;
  }
}
/* narrow windows: the panel goes under the board */
@media (max-width: 760px) and (min-height: 561px) {
  .kmBody {
    flex-direction: column;
    align-items: center;
  }
  #kmMap {
    width: min(100%, calc((100vh - 360px) * 16 / 9));
  }
  #kmInfo {
    width: 100%;
    flex-basis: auto;
  }
  #cuCards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* tall screens (laptops): bigger type */
@media (min-height: 700px) {
  #kmStat,
  #cuStat {
    font-size: 14px;
  }
  #kmLegend {
    font-size: 12px;
  }
  #kmInfo .kmB,
  #kmInfo .kmS,
  .cuCard .d {
    font-size: 14px;
  }
  .cuCard {
    min-height: 128px;
    padding: 14px 16px;
  }
}
