/* The font for all the buttons and text. The game swaps it when you change language. */
:root { --ui-font: Georgia, serif; }

/* Makes the game fill the whole window with a plain black background. */
html, body {
  margin: 0;
  height: 100%;
  background: black;
  overflow: hidden;
}
canvas {
  display: block;
}

/* ---- The top bar on the world map screen ---- */
#mapUI, #warUI {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  z-index: 5;
  pointer-events: none;          /* only the buttons/search catch the mouse... */
  font-family: var(--ui-font);
}
#mapUI[hidden], #warUI[hidden] { display: none; }
#mapUI > *, #warUI > * { pointer-events: auto; }  /* ...so the map under the bar still works */

.ui-btn {
  height: 44px;
  padding: 0 18px;
  font: bold 17px var(--ui-font);
  color: #fff6dc;
  background: rgba(25, 18, 10, 0.78);
  border: 2px solid rgba(255, 230, 170, 0.75);
  border-radius: 12px;
  cursor: pointer;
}
.ui-btn:hover {
  background: rgba(70, 50, 28, 0.9);
  border-color: #ffe9a8;
}

#searchBox, #warSearchBox {
  position: relative;
  flex: 0 1 380px;
}
#warSearchBox { flex-basis: 280px; }
#search, #warSearch {
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font: 17px var(--ui-font);
  color: #fff6dc;
  background: rgba(25, 18, 10, 0.78);
  border: 2px solid rgba(255, 230, 170, 0.75);
  border-radius: 12px;
  outline: none;
}
#search::placeholder, #warSearch::placeholder { color: rgba(255, 246, 220, 0.6); }
#search:focus, #warSearch:focus { border-color: #ffe14d; }

#results, #warResults {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: rgba(25, 18, 10, 0.94);
  border: 2px solid rgba(255, 230, 170, 0.75);
  border-radius: 12px;
}
#results[hidden], #warResults[hidden] { display: none; }
#results li, #warResults li {
  padding: 8px 12px;
  color: #fff6dc;
  font: 16px var(--ui-font);
  border-radius: 8px;
  cursor: pointer;
}
#results li:hover, #warResults li:hover { background: rgba(255, 225, 77, 0.28); }
#results li.none, #warResults li.none { color: rgba(255, 246, 220, 0.6); cursor: default; }
#results li.none:hover, #warResults li.none:hover { background: none; }

#count, #warLands {
  margin-inline-start: auto;
  align-self: center;
  padding: 8px 14px;
  font: bold 16px var(--ui-font);
  color: #fff6dc;
  background: rgba(25, 18, 10, 0.78);
  border-radius: 999px;
}

/* ---- The Settings window ---- */
#settings, #saved {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  font-family: var(--ui-font);
}
#settings[hidden], #saved[hidden] { display: none; }

#settingsBox, #savedBox {
  box-sizing: border-box;
  width: min(640px, 92vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 26px 26px;
  color: #fff6dc;
  background: rgba(25, 18, 10, 0.96);
  border: 3px solid rgba(255, 230, 170, 0.8);
  border-radius: 18px;
}
#settingsTitle, #savedTitle {
  margin: 0 0 18px;
  text-align: center;
  font: bold 30px var(--ui-font);
}
.setting-row { margin-bottom: 22px; }
.setting-row > label, .setting-row > span {
  display: block;
  margin-bottom: 8px;
  font: bold 18px var(--ui-font);
}

.slider-line { display: flex; align-items: center; gap: 14px; }
#volume {
  flex: 1;
  height: 28px;
  accent-color: #ffcc00;
  cursor: pointer;
}
#volumeNum {
  min-width: 3ch;
  text-align: center;
  font: bold 18px var(--ui-font);
}
#muteBtn { min-width: 110px; }
#muteBtn.is-muted { border-color: #ff8a70; color: #ffb8a8; }

#langGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
#langGrid button {
  height: 42px;
  padding: 0 10px;
  font: bold 16px var(--ui-font);
  color: #fff6dc;
  background: rgba(60, 44, 24, 0.7);
  border: 2px solid rgba(255, 230, 170, 0.35);
  border-radius: 10px;
  cursor: pointer;
}
#langGrid button:hover { background: rgba(110, 80, 40, 0.9); border-color: #ffe9a8; }
#langGrid button.chosen {
  color: #2a1608;
  background: #ffcc00;
  border-color: #ffe14d;
}
#settingsDone, #savedDone { display: block; margin: 0 auto; min-width: 160px; }

/* ---- The list of saved games ---- */
#savedList { list-style: none; margin: 0 0 20px; padding: 0; }
#savedList li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: rgba(60, 44, 24, 0.7);
  border: 2px solid rgba(255, 230, 170, 0.35);
  border-radius: 10px;
}
#savedList li.none { justify-content: center; opacity: 0.8; font-size: 18px; }
#savedList .save-info { flex: 1; min-width: 0; }
#savedList .save-name { font: bold 20px var(--ui-font); }
#savedList .save-sub { margin-top: 2px; font-size: 14px; opacity: 0.75; }

/* ---- The Play button and the war bar ---- */
.play-btn {
  color: #2a1608;
  background: #ffcc00;
  border-color: #ffe14d;
}
.play-btn:hover { background: #ffe14d; border-color: #fff3a8; }
.play-btn.dim { opacity: 0.55; }
#warUI #warLands { margin-inline-start: auto; }
#warUI { flex-wrap: wrap; }

/* The "Playing as: <country>  < >" switcher */
#playAs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  height: 44px;
  background: rgba(25, 18, 10, 0.78);
  border: 2px solid #ffcc00;
  border-radius: 12px;
}
#playAs .ui-btn { height: 34px; padding: 0 12px; border-width: 1px; }
#playAs .ui-btn:disabled { opacity: 0.35; cursor: default; }
#playAsName {
  min-width: 90px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font: bold 16px var(--ui-font);
  color: #ffe14d;
}
.ui-btn.dim { opacity: 0.45; }

/* The card that pops up when you click a country in the war */
#nationPanel {
  position: fixed;
  top: 76px;
  right: 12px;
  width: 250px;
  box-sizing: border-box;
  padding: 14px 16px 16px;
  z-index: 6;
  color: #fff6dc;
  background: rgba(25, 18, 10, 0.94);
  border: 2px solid rgba(255, 230, 170, 0.8);
  border-radius: 14px;
  font-family: var(--ui-font);
}
#nationPanel[hidden] { display: none; }
#nationPanel h3 { margin: 0 24px 6px 0; font: bold 21px var(--ui-font); }
#nationPanel p { margin: 0 0 12px; font-size: 15px; color: rgba(255, 246, 220, 0.8); }
#panelBtns { display: flex; flex-direction: column; gap: 8px; }
#panelBtns .ui-btn[hidden] { display: none; }
.panel-close {
  position: absolute;
  top: 8px;
  inset-inline-end: 10px;
  width: 28px;
  height: 28px;
  font-size: 15px;
  color: #fff6dc;
  background: none;
  border: none;
  cursor: pointer;
}
.panel-close:hover { color: #ffe14d; }
.fight-btn { border-color: #ff8a70; }
.fight-btn:hover { background: rgba(120, 40, 25, 0.9); border-color: #ffb0a0; }

/* ---- The feed in the bottom-left corner (like the Fortnite elimination list) ---- */
#feed {
  position: fixed;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(440px, 80vw);
  pointer-events: none;          /* never blocks the map underneath */
  font-family: var(--ui-font);
  z-index: 5;
}
.feed-item {
  padding: 8px 14px;
  border-radius: 8px;
  border-left: 6px solid var(--kind, #ffe14d);
  background: rgba(20, 15, 8, 0.88);
  color: #fff6dc;
  font-size: 15px;
  line-height: 1.3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  animation: feed-in 0.3s ease-out;
  transition: opacity 0.6s, transform 0.6s;
}
.feed-item.you { outline: 2px solid #ffcc00; }              /* it's about YOUR country */
.feed-item.big { font-size: 19px; font-weight: bold; padding: 12px 18px; }
.feed-item.gone { opacity: 0; transform: translateX(-30px); }
.feed-item[data-kind="ally"] { --kind: #4fc3f7; }
.feed-item[data-kind="break"] { --kind: #b0a090; }
.feed-item[data-kind="split"] { --kind: #ff9800; }
.feed-item[data-kind="conquer"], .feed-item[data-kind="fall"] { --kind: #e53935; }
.feed-item[data-kind="youfell"] { --kind: #ff1744; }
.feed-item[data-kind="join"] { --kind: #4fc3f7; }
.feed-item[data-kind="denied"] { --kind: #b0a090; }
.feed-item[data-kind="fight"] { --kind: #e53935; }
@keyframes feed-in {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- The little "back to Pocket Arcade" link in the bottom-right corner ---- */
#arcadeLink {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  padding: 8px 14px;
  font: bold 15px var(--ui-font);
  color: #fff6dc;
  text-decoration: none;
  background: rgba(25, 18, 10, 0.78);
  border: 2px solid rgba(255, 230, 170, 0.75);
  border-radius: 12px;
}
#arcadeLink:hover { background: rgba(70, 50, 25, 0.9); color: #ffe14d; }
