/* Console theme (docs/UI.md): navy glossy panels, blue title pills, option rows with button badges,
   corner HUD pills, the unit card, the in-map city screen, battle bar, leader scenes. Loaded after style.css. */

:root {
  --navy-1: #23488c;
  --navy-2: #12285a;
  --navy-3: #0b1a3d;
  --row: #163370;
  --row-hi: #3576d6;
  --edge: rgba(150, 196, 255, 0.55);
  --edge-soft: rgba(150, 196, 255, 0.25);
  --pill-1: #3e7fd9;
  --pill-2: #1d4ea6;
  --gold-1: #e9b34a;
  --gold-2: #9c6416;
  --food: #79d04f;
  --prod: #c9c9c9;
  --text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}
body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

/* ---------- Building blocks ---------- */

.cr-panel {
  background:
    linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 42%),
    linear-gradient(var(--navy-2), var(--navy-3));
  border: 1px solid var(--edge);
  border-radius: 6px;
  box-shadow:
    0 8px 26px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  color: #fff;
  text-shadow: var(--text-shadow);
  padding: 10px 12px;
}
.title-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 230px;
  padding: 6px 26px;
  border-radius: 6px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%),
    linear-gradient(var(--pill-1), var(--pill-2));
  border: 1px solid rgba(190, 220, 255, 0.8);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  text-shadow: var(--text-shadow);
}
.badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 11px;
  font:
    800 12px "Trebuchet MS",
    sans-serif;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.45),
    0 1px 3px rgba(0, 0, 0, 0.6);
}
.badge.green {
  background: radial-gradient(circle at 40% 30%, #8be36d, #2f9a24 70%);
}
.badge.red {
  background: radial-gradient(circle at 40% 30%, #ff8a73, #c3271a 70%);
}
.badge.blue {
  background: radial-gradient(circle at 40% 30%, #7fb3ff, #1f56c4 70%);
}
.badge.yellow {
  background: radial-gradient(circle at 40% 30%, #ffe27a, #d29a0c 70%);
  color: #3a2700;
  text-shadow: none;
}
.badge-space {
  width: 22px;
  flex: none;
}
.keycap {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  background: linear-gradient(#d9dde3, #8f969f);
  color: #1b1f25;
  font:
    800 11px "Trebuchet MS",
    sans-serif;
  text-shadow: none;
  border: 1px solid #ffffffaa;
}
.cr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 3px 10px 3px 6px;
  margin: 3px 0;
  text-align: left;
  border-radius: 4px;
  border: 1px solid var(--edge-soft);
  background:
    linear-gradient(rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 50%),
    linear-gradient(var(--row), #0d2252);
  color: #fff;
  font-size: 15px;
  text-shadow: var(--text-shadow);
}
.cr-row:hover:not(:disabled),
.cr-row.selected {
  background:
    linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%),
    linear-gradient(var(--row-hi), #1d4fa8);
  border-color: rgba(200, 228, 255, 0.9);
}
.cr-row.danger:hover:not(:disabled) {
  background: linear-gradient(#c8443a, #7d1d16);
}
.cr-row:not(.selected) .badge {
  visibility: hidden;
}
.cr-row:hover:not(:disabled) .badge {
  visibility: visible;
}
.cr-row .row-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  font-size: 17px;
}
.cr-row .row-icon img {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.25);
}
.cr-row .row-label {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.cr-row .row-label small {
  font-size: 12px;
  opacity: 0.8;
}
.cr-row .row-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}
.speech {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-30%);
  max-width: min(520px, 70vw);
  z-index: 3;
  background: linear-gradient(#ffffff, #e2e9f5);
  color: #10213f;
  border: 2px solid #1d3f7d;
  border-radius: 6px;
  padding: 10px 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  text-shadow: none;
  font-size: 15px;
}
.speech p {
  margin: 0;
}
.speech::after {
  content: "";
  position: absolute;
  right: 40px;
  bottom: -14px;
  border: 7px solid transparent;
  border-top-color: #1d3f7d;
  border-left-color: #1d3f7d;
}
.gold-pill {
  display: inline-block;
  padding: 3px 16px;
  border-radius: 4px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%),
    linear-gradient(var(--gold-1), var(--gold-2));
  border: 1px solid #ffd98a;
  color: #fff;
  font-weight: 700;
  text-shadow: var(--text-shadow);
}
.picture {
  display: block;
  object-fit: cover;
}
.picture.fallback {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), transparent 60%), var(--civ, #33507f);
  text-shadow: var(--text-shadow);
}

/* ---------- Scenes (messages, research, leaders) ---------- */

.modal.scene {
  background: radial-gradient(ellipse at 70% 60%, rgba(4, 10, 24, 0.15), rgba(4, 10, 24, 0.6));
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}
.modal.scene .box {
  position: relative;
  max-width: none;
  max-height: none;
  height: 100%;
  background: none;
  border: none;
  box-shadow: none;
  overflow: visible;
}
.modal.scene header {
  display: none;
}
.modal.scene .content {
  position: relative;
  height: 100%;
  padding: 0;
}
.modal.scene .title-pill {
  position: absolute;
  top: 60px;
  left: 6vw;
  z-index: 2;
}
.modal.scene .speaker {
  position: absolute;
  right: 2vw;
  bottom: 0;
  height: min(78vh, 720px);
  width: min(42vw, 520px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}
.modal.scene .speaker img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.55));
}
.modal.scene .speaker .picture.fallback {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  font-size: 80px;
  margin-bottom: 18vh;
}
.modal.scene .speaker .nameplate {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
}
.scene-panel {
  position: absolute;
  left: 6vw;
  bottom: 7vh;
  width: min(560px, 54vw);
  max-height: 64vh;
  overflow: auto;
  z-index: 2;
  font-size: 16px;
}
.modal.scene.wide .scene-panel {
  width: min(760px, 60vw);
}
.scene-panel .lead {
  margin: 2px 0 8px;
  line-height: 1.35;
}
.scene-panel .from {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 4px;
}
.scene-panel .icons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.scene-panel .muted {
  color: #c9d6ea;
}
.scene-panel h4 {
  margin: 10px 0 2px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9fc3f5;
}
.scene-panel select {
  background: #0d2252;
  color: #fff;
  border: 1px solid var(--edge-soft);
}

/* ---------- Map HUD ---------- */

#hud {
  display: none;
}
.hud-pill {
  position: fixed;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 8px;
  border-radius: 6px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 55%), linear-gradient(#24447f, #0e2150);
  border: 1px solid var(--edge);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-shadow: var(--text-shadow);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.hud-pill:hover {
  border-color: #fff;
}
#pillCity {
  top: 14px;
  left: 16px;
}
#pillDiplomacy {
  top: 14px;
  right: 16px;
  padding: 3px 8px 3px 12px;
}
#pillMenu {
  top: 50px;
  right: 16px;
  font-size: 13px;
}
#pillYear {
  right: 16px;
  bottom: 16px;
  font-size: 17px;
  padding: 4px 8px 4px 16px;
}
#pillStatus {
  right: 16px;
  bottom: 56px;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 6px 12px;
  font-size: 13px;
  min-width: 210px;
  cursor: pointer;
}
#pillStatus .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
#pillStatus .bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
#pillStatus .bar i {
  display: block;
  height: 100%;
  background: #6fb6ff;
}
#pillStatus .gold {
  color: #ffd56b;
}
#pillStatus .culture {
  color: #e2b4ff;
}
#endTurn {
  top: 14px;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  padding: 4px 16px 4px 6px;
  font-size: 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 55%), linear-gradient(#24447f, #0e2150);
  border: 1px solid var(--edge);
  color: #fff;
  font-weight: 700;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-shadow: var(--text-shadow);
}
#endTurn small {
  display: inline;
  font-size: 12px;
  opacity: 0.75;
  font-weight: 400;
}
#endTurn.ready {
  animation: endPulse 1.6s ease-in-out infinite;
}
@keyframes endPulse {
  50% {
    box-shadow: 0 0 18px rgba(255, 220, 120, 0.8);
  }
}

/* ---------- Unit card ---------- */

#unitPanel {
  left: 16px;
  bottom: 16px;
  width: auto;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
#unitPanel .stack-col {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
}
#unitPanel .stack-col button {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--edge);
  background: #0e2150;
  position: relative;
}
#unitPanel .stack-col button.on {
  border-color: #fff;
}
#unitPanel .stack-col button img,
#unitPanel .stack-col button .picture {
  width: 100%;
  height: 100%;
}
#unitPanel .stack-col .dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid #fff;
}
.unit-card {
  display: flex;
  align-items: stretch;
  min-width: 420px;
  max-width: 520px;
}
.unit-card .portrait-box {
  position: relative;
  flex: none;
  width: 92px;
  height: 92px;
  border: 2px solid #b9cbe6;
  border-radius: 6px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #6b8fc8, #1b2f5c);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  align-self: flex-end;
  z-index: 1;
}
.unit-card .portrait-box img,
.unit-card .portrait-box .picture {
  width: 100%;
  height: 100%;
}
.unit-card .moves-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: radial-gradient(circle at 35% 30%, #b8ff9c, #28a11a 70%);
}
.unit-card .moves-dot.spent {
  background: radial-gradient(circle at 35% 30%, #f2f2f2, #8a8f96 70%);
}
.unit-card .body {
  flex: 1;
  margin-left: -6px;
  display: flex;
  flex-direction: column;
}
.unit-card .name {
  padding: 3px 12px 3px 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 60%),
    linear-gradient(var(--pill-1), var(--pill-2));
  border: 1px solid rgba(190, 220, 255, 0.8);
  border-radius: 4px 4px 0 0;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-shadow: var(--text-shadow);
}
.unit-card .inner {
  display: flex;
  gap: 8px;
  padding: 6px 8px 8px 18px;
  border-radius: 0 0 6px 0;
  border: 1px solid var(--edge);
  border-top: none;
  background: linear-gradient(var(--navy-2), var(--navy-3));
}
.unit-card .orders {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.unit-card .orders button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 1px 4px;
  background: none;
  border: 1px solid transparent;
  color: #fff;
  font-size: 14px;
  text-align: left;
  text-shadow: var(--text-shadow);
}
.unit-card .orders button:hover:not(:disabled) {
  background: rgba(80, 140, 230, 0.35);
  border-color: var(--edge-soft);
}
.unit-card .orders .badge {
  min-width: 18px;
  height: 18px;
  font-size: 10px;
}
.unit-card .orders .note {
  font-size: 12px;
  color: #c9d6ea;
  padding: 1px 4px;
}
.unit-card .vals {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: none;
}
.unit-card .vals div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 70px;
  padding: 2px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--edge-soft);
  border-radius: 3px;
  font-weight: 700;
  font-size: 16px;
}
.unit-card .vals .icon {
  font-size: 18px;
}
.unit-card .troops {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}
.unit-card .troops i {
  width: 16px;
  height: 5px;
  border-radius: 2px;
  background: #6fe04f;
}
.unit-card .troops i.lost {
  background: rgba(255, 255, 255, 0.18);
}
.unit-card .abilities {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}
.unit-card .abilities span {
  font-size: 11px;
  background: rgba(232, 196, 103, 0.25);
  color: #ffe39b;
  border-radius: 8px;
  padding: 0 6px;
}

/* ---------- Map labels ---------- */

.label.city {
  border: 1px solid rgba(160, 200, 255, 0.6);
  background: linear-gradient(rgba(20, 34, 66, 0.95), rgba(8, 16, 36, 0.95));
  border-radius: 3px;
  overflow: visible;
  align-items: stretch;
  font-family: "Trebuchet MS", sans-serif;
}
.label.city .emblem {
  width: 18px;
  background: linear-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 60%), var(--civ);
  border-right: 1px solid rgba(0, 0, 0, 0.5);
}
.label.city .text {
  display: flex;
  flex-direction: column;
  padding: 1px 8px 2px 6px;
  min-width: 70px;
}
.label.city .name {
  padding: 0;
  font-size: 12px;
  line-height: 1.25;
}
.label.city .build {
  font-size: 10px;
  font-weight: 400;
  color: #d6e4ff;
  line-height: 1.2;
}
.label.city .pop {
  display: grid;
  place-items: center;
  min-width: 20px;
  padding: 0 5px;
  background: linear-gradient(#7fd85a, #2d8c1d);
  color: #fff;
  font-size: 13px;
  border-left: 1px solid rgba(0, 0, 0, 0.5);
}
.label.city i {
  left: 18px;
  height: 3px;
  background: #7fd85a;
}
.label.nameplate {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 3px;
  overflow: hidden;
  font:
    700 12px "Trebuchet MS",
    sans-serif;
  color: #10213f;
  background: linear-gradient(#ffffff, #dfe7f3);
  border: 1px solid #1d3f7d;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.label.nameplate::before {
  content: "";
  width: 6px;
  align-self: stretch;
  background: var(--civ);
}
.label.nameplate span {
  padding: 1px 8px;
}
.label.turns {
  font:
    900 22px "Trebuchet MS",
    sans-serif;
  color: #1b1b1b;
  text-shadow:
    0 0 3px #ffe066,
    0 0 6px #ffe066;
}

/* ---------- Feed ---------- */

#feed {
  top: 92px;
}
#feed div {
  background:
    linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 50%), linear-gradient(#1a3772, #0d2150);
  border: 1px solid var(--edge-soft);
  border-left: 4px solid #8fc0ff;
  text-shadow: var(--text-shadow);
}

/* ---------- City screen (in the map) ---------- */

.modal.city-view {
  background: radial-gradient(ellipse at 50% 55%, transparent 30%, rgba(4, 10, 24, 0.45));
  padding: 0;
  align-items: stretch;
}
.modal.city-view .box {
  max-width: none;
  height: 100%;
  background: none;
  border: none;
  box-shadow: none;
  overflow: visible;
  position: relative;
}
.modal.city-view header {
  display: none;
}
.modal.city-view .content {
  padding: 0;
  height: 100%;
  position: relative;
}
.city-band {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 6px 2vw 10px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 40%), linear-gradient(#1c3c7c, #0b1d47);
  border-bottom: 2px solid var(--edge);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  color: #fff;
  text-shadow: var(--text-shadow);
}
.city-band .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.city-band .top .switch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  padding: 2px 6px;
}
.city-band .top h2 {
  margin: 0;
  font-size: 22px;
}
.city-band .rows {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  align-items: center;
}
.city-band .line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--edge-soft);
  background: linear-gradient(#173a7a, #0e2556);
  font-size: 15px;
}
.city-band .line b {
  min-width: 34px;
  text-align: right;
}
.city-band .line .bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
  max-width: 260px;
}
.city-band .line .bar i {
  display: block;
  height: 100%;
}
.city-band .line.food .bar i {
  background: linear-gradient(#a6f27a, #3d9f1f);
}
.city-band .line.prod .bar i {
  background: linear-gradient(#f0f0f0, #8a9099);
}
.city-band .right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}
.city-band .right .line {
  min-width: 220px;
  justify-content: space-between;
}
.city-band .split {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.city-band .split input {
  width: 140px;
}
.city-list {
  position: absolute;
  left: 3vw;
  top: 168px;
  bottom: 4vh;
  width: min(420px, 42vw);
  z-index: 2;
  display: flex;
  flex-direction: column;
}
.city-list .tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}
.city-list .tabs button {
  flex: 1;
  padding: 4px 6px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(#173a7a, #0e2556);
  border: 1px solid var(--edge-soft);
  color: #cfe0ff;
}
.city-list .tabs button.on {
  background:
    linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 55%),
    linear-gradient(var(--pill-1), var(--pill-2));
  color: #fff;
  border-color: rgba(190, 220, 255, 0.8);
}
.city-list .items {
  flex: 1;
  overflow: auto;
  padding-right: 4px;
}
.city-list .cr-row .row-right {
  font-size: 14px;
}
.city-list .producing {
  margin-bottom: 6px;
}
.city-list .producing .cr-row {
  background:
    linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 50%), linear-gradient(#2a6a2a, #123d12);
}
.city-extra {
  position: absolute;
  left: 3vw;
  bottom: 1.2vh;
  z-index: 2;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 44vw;
}
.city-extra .chip {
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(10, 26, 64, 0.9);
  border: 1px solid var(--edge-soft);
  color: #fff;
}
.city-extra .chip.wonder {
  color: #e9c4ff;
}
.city-view .speaker {
  position: absolute;
  right: 1vw;
  bottom: 0;
  height: min(66vh, 600px);
  width: min(36vw, 440px);
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.city-view .speaker img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.55));
}
.city-view .speech {
  top: 150px;
  left: auto;
  right: 4vw;
  transform: none;
}
.city-view .closer {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
}

/* ---------- Battle ---------- */

.modal.battle-view {
  background: radial-gradient(ellipse at 50% 40%, transparent 35%, rgba(4, 10, 24, 0.5));
  align-items: flex-end;
  padding: 0 0 4vh;
}
.modal.battle-view .box {
  background: none;
  border: none;
  box-shadow: none;
  max-width: 900px;
  overflow: visible;
}
.modal.battle-view header {
  display: none;
}
.battle-bar {
  display: grid;
  grid-template-columns: 1fr auto auto 1fr;
  align-items: stretch;
  gap: 0;
  position: relative;
}
.battle-bar .side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 6px 12px;
  background: linear-gradient(var(--navy-2), var(--navy-3));
  border: 1px solid var(--edge);
  color: #fff;
  text-shadow: var(--text-shadow);
}
.battle-bar .side.att {
  text-align: right;
  border-radius: 6px 0 0 6px;
}
.battle-bar .side.def {
  border-radius: 0 6px 6px 0;
}
.battle-bar .side .who {
  font-weight: 700;
  font-size: 16px;
}
.battle-bar .hp {
  height: 9px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.battle-bar .hp i {
  display: block;
  height: 100%;
  background: linear-gradient(#7fd0ff, #2a7fd6);
  transition: width 0.25s;
}
.battle-bar .side.att .hp i {
  margin-left: auto;
}
.battle-bar .side .what {
  font-size: 20px;
  font-weight: 800;
}
.battle-bar .face {
  position: relative;
  width: 92px;
  height: 92px;
  border: 2px solid #b9cbe6;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #6b8fc8, #1b2f5c);
}
.battle-bar .face img,
.battle-bar .face .picture {
  width: 100%;
  height: 100%;
}
.battle-bar .face .val {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font:
    900 24px "Trebuchet MS",
    sans-serif;
  color: #fff;
  text-shadow: var(--text-shadow);
}
.battle-bar .face .icon {
  position: absolute;
  bottom: 2px;
  left: 4px;
  font-size: 20px;
}
.battle-bar .advantage {
  position: absolute;
  top: -22px;
  padding: 1px 12px;
  background: linear-gradient(#e2473b, #9a1b13);
  color: #fff;
  font-weight: 800;
  border-radius: 4px 4px 0 0;
  text-shadow: var(--text-shadow);
}
.battle-bar .advantage.att {
  left: 0;
}
.battle-bar .advantage.def {
  right: 0;
}
.battle-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.battle-detail .cr-panel {
  font-size: 13px;
  padding: 6px 10px;
}
.battle-detail .cr-panel b {
  font-size: 18px;
}
.battle-detail ul {
  margin: 4px 0 0;
  padding-left: 16px;
}
.battle-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}
.battle-actions .hud-pill {
  position: static;
}
.battle-result {
  text-align: center;
  font:
    900 30px "Trebuchet MS",
    sans-serif;
  margin: 6px 0 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}
.battle-result.win {
  color: #ffe066;
}
.battle-result.lose {
  color: #ff7a66;
}

/* ---------- Leaders strip (diplomacy) and menus ---------- */

.leader-strip {
  position: absolute;
  top: 110px;
  left: 6vw;
  right: 6vw;
  display: flex;
  gap: 10px;
  z-index: 2;
}
.leader-strip button {
  width: 92px;
  padding: 0;
  background: none;
  border: none;
  color: #fff;
  text-shadow: var(--text-shadow);
  font-size: 12px;
  text-align: center;
}
.leader-strip .frame {
  width: 92px;
  height: 92px;
  border: 2px solid #d9b45a;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(#f0c75e, #a8701c);
}
.leader-strip button.on .frame {
  border-color: #fff;
  box-shadow: 0 0 14px rgba(255, 230, 140, 0.9);
}
.leader-strip button:disabled {
  opacity: 0.45;
}
.leader-strip .frame img,
.leader-strip .frame .picture {
  width: 100%;
  height: 100%;
}
.leader-strip .bar {
  height: 4px;
  background: var(--civ);
  margin: 3px 0 2px;
}
.leader-strip .war {
  color: #ff8a73;
  font-weight: 700;
}

#menu {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(80, 150, 230, 0.45), transparent 60%),
    linear-gradient(#5d9bd8 0%, #8ec1ea 35%, #3f7bb5 36%, #1d4c87 70%, #0d2550 100%);
}
#menu h1 {
  font-family: Georgia, "Times New Roman", serif;
  color: #ffe6a3;
  text-shadow:
    0 3px 0 #7a4b10,
    0 6px 14px rgba(0, 0, 0, 0.6);
}
.civ-select {
  width: min(1100px, 96vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.civ-select .topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-radius: 6px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 55%), linear-gradient(#24447f, #0e2150);
  border: 1px solid var(--edge);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  text-shadow: var(--text-shadow);
}
.civ-select .topbar button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: #fff;
  font-size: 15px;
}
.civ-select .carousel {
  width: 100%;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 10px;
  scroll-snap-type: x mandatory;
}
.civ-select .carousel button {
  flex: none;
  width: 96px;
  padding: 0;
  background: none;
  border: none;
  color: #fff;
  text-shadow: var(--text-shadow);
  font-size: 12px;
  line-height: 1.2;
  scroll-snap-align: center;
}
.civ-select .carousel .frame {
  width: 96px;
  height: 96px;
  border: 2px solid #d9b45a;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(#f0c75e, #a8701c);
}
.civ-select .carousel .frame img,
.civ-select .carousel .frame .picture {
  width: 100%;
  height: 100%;
}
.civ-select .carousel button.on .frame {
  border-color: #fff;
  box-shadow: 0 0 16px rgba(255, 230, 140, 0.95);
}
.civ-select .carousel .bar {
  height: 5px;
  margin: 3px 0 2px;
  background: var(--civ);
}
.civ-select .chosen {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  width: 100%;
  align-items: stretch;
}
.civ-select .chosen .big {
  border: 3px solid #d9b45a;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(#f0c75e, #a8701c);
  height: 240px;
}
.civ-select .chosen .big img,
.civ-select .chosen .big .picture {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.civ-select .info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
  font-size: 14px;
}
.civ-select .info h3 {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  text-align: center;
  font-size: 20px;
}
.civ-select .info .era b {
  display: block;
  color: #9fc3f5;
  font-size: 12px;
  text-transform: uppercase;
}
.civ-select .options {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

/* Victory list */
.victory-top {
  position: absolute;
  top: 40px;
  left: 6vw;
  right: 6vw;
  text-align: center;
}
.victory-rank {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}
.victory-rank .num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font:
    900 18px "Trebuchet MS",
    sans-serif;
  background: radial-gradient(circle at 35% 30%, #8ab8ff, #1f4fa8);
  border: 2px solid #fff;
}
.victory-rank img,
.victory-rank .picture {
  width: 46px;
  height: 46px;
  border-radius: 4px;
  border: 1px solid #d9b45a;
  background: linear-gradient(#f0c75e, #a8701c);
}
.victory-rank .cr-row {
  margin: 0;
}
.label.yield {
  display: flex;
  gap: 2px;
  transform-origin: center;
}
.label.yield span {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 1px 5px 1px 3px;
  border-radius: 10px;
  font:
    700 12px "Trebuchet MS",
    sans-serif;
  color: #fff;
  text-shadow: 0 1px 1px #000;
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.label.yield .food {
  background: radial-gradient(circle at 35% 30%, #a8f07c, #3a9a1d);
}
.label.yield .prod {
  background: radial-gradient(circle at 35% 30%, #e8e8e8, #7d838c);
}
.label.yield .trade {
  background: radial-gradient(circle at 35% 30%, #9fd2ff, #2a73cf);
}
.label.yield .gold {
  background: radial-gradient(circle at 35% 30%, #ffe28a, #c18a12);
}
.city-band .buy {
  margin-left: auto;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  border-radius: 4px;
  border: 1px solid #ffd98a;
  background: linear-gradient(var(--gold-1), var(--gold-2));
  text-shadow: var(--text-shadow);
}
.city-band .buy:disabled {
  opacity: 0.45;
}
.city-band h2 small {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.85;
}
.city-band .segmented button {
  padding: 2px 8px;
  font-size: 12px;
}
body.screen-open .hud-pill:not(.closer):not(.battle-actions .hud-pill),
body.screen-open #endTurn,
body.screen-open #unitPanel,
body.screen-open #advisor,
body.screen-open #tooltip {
  display: none !important;
}
.cr-row.static {
  cursor: default;
}
.cr-row.static .row-right {
  flex-wrap: wrap;
  justify-content: flex-end;
  font-weight: 400;
  font-size: 13px;
}
.cr-row .mini {
  padding: 1px 9px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 3px;
  color: #fff;
  background: linear-gradient(var(--pill-1), var(--pill-2));
  border: 1px solid rgba(190, 220, 255, 0.8);
}
.cr-row .mini:disabled {
  opacity: 0.4;
}
.cr-row select {
  max-width: 150px;
  font-size: 13px;
  padding: 1px 4px;
  background: #0d2252;
  color: #fff;
  border: 1px solid var(--edge-soft);
}
.picture.portrait-small {
  width: 36px;
  height: 36px;
  border-radius: 4px;
}
.picture.portrait-large {
  width: 84px;
  height: 84px;
  border-radius: 6px;
}
.modal.scene .speaker > .picture.fallback {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  font-size: 70px;
  margin-bottom: 20vh;
}

/* ---------- Classic dialogs, re-themed ---------- */

.modal {
  background: rgba(4, 10, 24, 0.55);
}
.modal .box {
  background:
    linear-gradient(rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 120px),
    linear-gradient(var(--navy-2), var(--navy-3));
  border: 1px solid var(--edge);
  border-radius: 6px;
  color: #fff;
  text-shadow: var(--text-shadow);
}
.modal header {
  background:
    linear-gradient(rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 55%),
    linear-gradient(var(--pill-1), var(--pill-2));
  border-bottom: 1px solid rgba(190, 220, 255, 0.8);
}
.modal header h2 {
  font-size: 20px;
  text-shadow: var(--text-shadow);
}
.modal header button,
.modal .buttons button,
.segmented button {
  background:
    linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 50%),
    linear-gradient(var(--row), #0d2252);
  border: 1px solid var(--edge-soft);
  color: #fff;
}
.segmented button.on {
  background:
    linear-gradient(rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 55%),
    linear-gradient(var(--row-hi), #1d4fa8);
  border-color: rgba(200, 228, 255, 0.9);
}
.modal .buttons button.primary,
button.primary {
  background:
    linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%), linear-gradient(#4fb33b, #23731a);
  border-color: #b8f5a6;
  color: #fff;
  text-shadow: var(--text-shadow);
}
.endgame header h2 {
  letter-spacing: 0.3em;
  width: 100%;
  text-align: center;
}
.victory-rank.me .cr-row {
  border-color: #ffe39b;
}
.tech.current {
  border-color: #fff;
  background: linear-gradient(var(--row-hi), #1d4fa8);
}

/* Main menu and civ select extras */
#menu .main-menu {
  width: min(360px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
}
.civ-select .topbar b {
  font-size: 18px;
  color: #fff;
}
.civ-select .seed {
  width: 120px;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #5f84c4;
  background: #0b1a3a;
  color: #fff;
}
.civ-select .info .era {
  margin-bottom: 6px;
}
@media (max-width: 640px) {
  .civ-select .chosen {
    grid-template-columns: 1fr;
  }
  .civ-select .chosen .big {
    height: 160px;
  }
}
.scene-panel .lead {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.45;
}

#menu {
  overflow-x: hidden;
}

/* Advisor tip: a navy console panel with the advisor's face, above the status pill */
#advisor {
  bottom: 150px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 50%), linear-gradient(#1d3a72, #0c1f4a);
  border: 1px solid #8fb2e8;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  color: #fff;
}
#advisor .face {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  border: 2px solid #d9b45a;
  object-fit: cover;
}
#advisor small {
  color: #9fc3f5;
}

/* Road to Victory: a full-width table panel */
.modal.scene.victory-screen .scene-panel {
  width: min(940px, 92vw);
  left: 50%;
  transform: translateX(-50%);
  max-height: 76vh;
}
.victory-screen .vtable {
  width: 100%;
}
body.screen-open #feed {
  display: none;
}
@media (max-width: 640px) {
  .scene-panel {
    left: 16px;
    right: 16px;
    width: auto;
  }
}

.modal.scene.victory-screen .scene-panel {
  overflow-x: hidden;
}

/* Civilopedia: categories | entries | article */
.modal.civilopedia .box {
  width: min(1100px, 96vw);
  height: min(720px, 90vh);
  display: flex;
  flex-direction: column;
}
.modal.civilopedia .content {
  flex: 1;
  min-height: 0;
}
.pedia {
  display: grid;
  grid-template-columns: 190px 240px 1fr;
  gap: 10px;
  height: 100%;
}
.pedia > .cr-panel {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}
.pedia-article .title-pill {
  align-self: flex-start;
  margin-bottom: 8px;
}
.pedia-article .pedia-picture {
  width: 140px;
  height: 140px;
  border: 2px solid #d9b45a;
  border-radius: 6px;
  background: linear-gradient(#f0c75e, #a8701c);
  object-fit: cover;
  margin-bottom: 8px;
}
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 4px 0 8px;
}
.facts dt {
  color: #9fc3f5;
  font-size: 13px;
  text-transform: uppercase;
}
.facts dd {
  margin: 0;
}
@media (max-width: 760px) {
  .pedia {
    grid-template-columns: 1fr;
    grid-template-rows: auto 30vh auto;
  }
  .pedia-cats {
    flex-direction: row !important;
    flex-wrap: wrap;
  }
}

/* Dialogs opened from the main menu must sit above it (#menu is z-index 20). */
.modal {
  z-index: 30;
}
.modal.hall .box {
  width: min(640px, 94vw);
}

/* Controller: the highlighted control glows gold (console style). */
body.pad .pad-focus {
  outline: 3px solid #ffd84a !important;
  outline-offset: 2px;
  box-shadow: 0 0 14px rgba(255, 216, 74, 0.8) !important;
}
body.pad .cr-row.pad-focus {
  background: linear-gradient(#4f8be0, #2a5cb0) !important;
}
body.pad #tooltip {
  pointer-events: none;
}

/* Live leaders (src/render/leaders.js) fill the speaker's place. */
.leader-stage {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.55));
}
.leader-stage canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.end-stage {
  width: 180px;
  height: 230px;
  flex: none;
}

/* Scenario picker on the civ select screen */
.civ-select select.scenario {
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #5f84c4;
  background: #0b1a3a;
  color: #fff;
}
.civ-select .scenario-blurb {
  max-width: 460px;
  color: #cfe0ff;
}
.civ-select .chosen .big .leader-stage {
  filter: none;
}

/* Hot-seat: the curtain between players hides the map completely. */
.modal.scene.pass-screen {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(80, 150, 230, 0.45), transparent 60%),
    linear-gradient(#5d9bd8 0%, #3f7bb5 40%, #1d4c87 70%, #0d2550 100%);
}
.pass-screen .turn-order {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}
.pass-screen .turn-order span {
  padding: 3px 10px;
  border-radius: 12px;
  border: 2px solid var(--civ);
  opacity: 0.6;
  font-size: 13px;
}
.pass-screen .turn-order span.now {
  background: var(--civ);
  opacity: 1;
  font-weight: bold;
}

/* Multiplayer setup */
.mp-setup .mp-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mp-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.mp-player {
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 6px;
  border-radius: 6px;
  border-left: 5px solid var(--civ);
  background: rgba(255, 255, 255, 0.06);
}
.mp-player .frame {
  grid-row: 1 / 4;
  width: 56px;
  height: 56px;
  border: 2px solid #d9b45a;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(#f0c75e, #a8701c);
}
.mp-player .frame img,
.mp-player .frame .picture {
  width: 100%;
  height: 100%;
}
.mp-player select,
.mp-setup select {
  padding: 5px;
  border-radius: 6px;
  border: 1px solid #5f84c4;
  background: #0b1a3a;
  color: #fff;
}
.mp-player .mini {
  justify-self: start;
}
.mp-setup label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Online play */
#waiting {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  max-width: calc(100vw - 32px);
}
#waiting small {
  color: #cfe0ff;
}
.invite {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  padding: 6px 8px;
  margin: 4px 0;
  border-left: 5px solid var(--civ);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}
.invite b {
  grid-column: 1 / -1;
}
.invite input {
  min-width: 0;
  padding: 5px;
  border-radius: 4px;
  border: 1px solid #5f84c4;
  background: #0b1a3a;
  color: #fff;
  font-size: 12px;
}
