
:root {
  --bg: #0b1017;
  --card: #151e29;
  --tx: #e8eef6;
  --mut: #9aaabd;
  --bd: #2b3949;
  --bad: #d9453b;
  --ok: #2e8b57;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}

.sub {
  color: var(--mut);
  margin: 0 0 16px;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--bd);
  background: var(--card);
  color: var(--tx);
  padding: 8px 12px;
  border-radius: 10px;
  transition: border-color 0.2s, transform 0.15s;
}

button:hover {
  border-color: var(--ok);
}

button:active {
  transform: scale(0.97);
}

button:focus-visible {
  outline: 2px solid var(--ok);
  outline-offset: 3px;
}

button.danger:hover {
  border-color: var(--bad);
}

.stat {
  margin-left: auto;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 12px;
}

.lvl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.lbl {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mut);
  margin: 6px 0 -2px;
}

.sp {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 12px;
  transition: opacity 0.4s, filter 0.4s;
  min-width: 0;
}

.sp.dead {
  opacity: 0.45;
  filter: grayscale(1);
}

.sp .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sp b {
  font-size: 1rem;
}

.eats {
  font-size: 0.78rem;
  color: var(--mut);
  margin: 2px 0 8px;
}

.meter {
  height: 8px;
  border-radius: 99px;
  background: var(--bd);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  width: 50%;
  border-radius: 99px;
  transition: width 0.1s;
}

.sp button {
  padding: 4px 8px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.panel {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 12px;
  margin-top: 16px;
}

canvas {
  width: 100%;
  height: 220px;
  display: block;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
  margin-top: 8px;
  color: var(--mut);
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  margin-right: 5px;
}

#log {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.9rem;
}

#log li {
  padding: 4px 0;
  border-bottom: 1px dashed var(--bd);
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1rem;
  margin: 0 0 8px;
}

.map {
  margin: 0 0 16px;
}

.mapwrap {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.map svg {
  width: 100%;
  max-width: 500px;
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.side {
  flex: 1 1 240px;
  min-width: 0;
}

.land {
  fill: #202c3a;
}

.reg {
  cursor: pointer;
  outline: none;
}

.reg path {
  fill: var(--c);
  stroke: #0b1017;
  stroke-opacity: 0.8;
  stroke-width: 1;
  stroke-linejoin: round;
  transition: filter 0.2s, stroke-width 0.2s;
}

.reg:hover path,
.reg:focus path {
  stroke-width: 2.5;
  stroke-opacity: 1;
  filter: brightness(1.12);
}

.sel .reg:not(.on) path {
  filter: saturate(0.2) brightness(1.2);
}

.reg.on path {
  stroke-width: 1.5;
  stroke-opacity: 1;
}

.reg text {
  fill: #111;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 2.5px;
  paint-order: stroke;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  stroke-linejoin: round;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 10px;
  font-size: 0.82rem;
  border-radius: 99px;
}

.chip.on {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

#biome {
  margin: 8px 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  main {
    padding: 12px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .mapwrap {
    gap: 10px;
  }

  .map svg {
    max-width: 100%;
  }

  .side {
    flex-basis: 100%;
  }

  .stat {
    width: 100%;
    margin-left: 0;
  }

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

  .sp .top {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
:root { color-scheme: dark; }
.panel { box-shadow: 0 8px 24px rgba(0,0,0,.14); }
button { background: #1b2735; }
button.danger { border-color: #653b43; }
button.danger:hover { background: #39232a; }
.reg path { stroke: #0b1017; }
.sp { background: linear-gradient(145deg, var(--card), #192433); }
.chip { background: #1b2735; border: 1px solid var(--bd); color: var(--tx); }


/* Painel estratégico inspirado em jogos de gestão de crise */
.campaign-panel, .evolution-panel { border-color: #2d4156; background: linear-gradient(145deg, #151f2c, #101720); }
.campaign-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.campaign-head h2 { margin:0; }
.eyebrow { color:#8ba6c3; font-size:.68rem; letter-spacing:.14em; font-weight:800; margin:0 0 4px; }
.live-pill { display:inline-flex; align-items:center; gap:7px; border:1px solid #2d5d50; color:#75e0b2; border-radius:99px; padding:5px 9px; font-size:.7rem; font-weight:800; letter-spacing:.05em; }
.live-pill i { width:7px; height:7px; border-radius:50%; background:#54df9d; box-shadow:0 0 10px #54df9d; }
.campaign-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.campaign-stat { min-width:0; padding:13px; border:1px solid #29394b; background:#111a25; border-radius:12px; display:flex; flex-direction:column; gap:7px; }
.campaign-stat span { color:#a9bbce; font-size:.8rem; }
.campaign-stat strong { font-size:clamp(1.35rem,3vw,2rem); line-height:1.1; font-variant-numeric:tabular-nums; }
.campaign-stat small { color:#8295aa; font-size:.72rem; }
.alive-stat strong { color:#5fe0a0; }.dead-stat strong { color:#ff7a83; }
.big-meter { height:7px; background:#283443; border-radius:99px; overflow:hidden; }
.big-meter i { display:block; height:100%; width:100%; border-radius:99px; background:#48d597; transition:width .35s; }
.dead-stat .big-meter i { background:#f06470; }
.campaign-note { color:#8295aa; font-size:.75rem; margin:12px 0 0; }
.research-points { color:#c5b8ff; background:#27213c; border:1px solid #45396b; padding:7px 10px; border-radius:9px; font-size:.82rem; }
.response-actions { display:flex; flex-wrap:wrap; gap:8px; }.response-actions button { border-color:#2e6255; background:#172c2b; }
.response-actions button:hover { background:#21463b; border-color:#5fe0a0; }
.response-message { color:#a9bbce; font-size:.84rem; margin:12px 0 0; min-height:1.2em; }
@media(max-width:700px) { .campaign-stats { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:380px) { .campaign-stats { grid-template-columns:1fr; } }
