/* ─── board.css ─────────────────────────────────────────────────────────────
   Board grid + cells, cell popups, creature-select buttons, upgrade-tone highlights, art fallbacks, creature-enter animation.
   Split out of the old style.css as a pure ordered slice. The <link> order
   in index.html (base → menu → online → board → folks → war → overlays →
   mobile → free-mode) preserves the original cascade — do not reorder. ─── */

/* Grid positioning inside board frame */
#board-war {
  position: absolute;
  left: 33px;
  top: 164px;
  width: 535px;
  height: 525px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 0;
  padding: 0;
  background: none;
}

/* ① identity banner: the label + small passive status chips (never actions).
   Tinted with the player's FOLK accent (-onbg = luminance-corrected for the
   dark chrome, so e.g. P2's near-black same-folk accent stays readable). */
.turn-banner {
  font-size: 1rem; font-weight: bold; padding: 0.25rem 0; line-height: 1.3;
  border-bottom: 2px solid;
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 3px 6px; text-align: center;
}
/* The underline inherits currentColor — the -onbg text colour is already
   luminance-corrected, so it stays visible even for P2's same-folk
   near-black accent (the raw accent as border-color used to vanish). */
.turn-banner.p1 { color: var(--p1-accent-onbg, #e63946); }
.turn-banner.p2 { color: var(--p2-accent-onbg, #ccc); }
.turn-banner .tb-label { overflow: hidden; text-overflow: ellipsis; }
.tb-chip {
  font-size: 0.6rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: #cbd5e8; background: rgba(120,140,200,0.15); border: 1px solid #3a4a7c;
  border-radius: 999px; padding: 1px 7px; white-space: nowrap; flex-shrink: 0;
}
.tb-chip-eow  { color: #f0c040; background: rgba(240,192,64,0.12); border-color: #7a5c00; }
.tb-chip-mode { color: #9adcf0; background: rgba(76,201,240,0.12); border-color: #2a6a8c; }
.tb-chip-win  { color: #6bd25f; background: rgba(76,175,80,0.15);  border-color: #2e7d32; }
/* Setup context base (the desktop sidebar refines these in war.css; the
   mobile sheet/drawer keep their own overrides in mobile.css). */
#setup-pl-info { color: #aaa; }
#setup-hint { color: #aaa; font-size: 0.8rem; font-style: italic; text-align: center; padding: 4px 0; line-height: 1.3; }
#setup-names { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.setup-name-row { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.setup-name-row .setup-name-label { color: #aaa; font-weight: bold; white-space: nowrap; }
.setup-name-row.p1 .setup-name-label { color: var(--p1-accent-onbg, #e63946); }
.setup-name-row.p2 .setup-name-label { color: var(--p2-accent-onbg, #ccc); }
.setup-name-row input { flex: 1; padding: 3px 6px; background: #1a1a2a; color: #eee; border: 1px solid #444; border-radius: 3px; font-size: 0.85rem; min-width: 0; }
.setup-name-row input:disabled { background: #15151f; color: #888; }
/* Live PL progress (built by renderSetup): label/value head + a fill bar */
.pl-head { display: flex; align-items: baseline; }
.pl-label { flex: 1; font-size: 0.62rem; font-weight: bold; text-transform: uppercase; letter-spacing: 0.08em; color: #7c87a0; }
.pl-value { font-size: 0.85rem; font-weight: bold; color: #dde3f2; }
.pl-bar { height: 6px; margin-top: 3px; background: #10131d; border: 1px solid #2a3450; border-radius: 999px; overflow: hidden; }
.pl-fill { height: 100%; background: #4cc9f0; border-radius: 999px; transition: width 0.2s; }
#setup-pl-info.ready .pl-fill { background: #2ecc71; }
#setup-pl-info.ready .pl-value { color: #6bd25f; }
.pl-marker-hint { margin-top: 2px; font-size: 0.68rem; color: #c9a43c; }
#setup-opponent-status { color: #8a93a8; font-size: 0.72rem; font-style: italic; text-align: center; }
#setup-opponent-status.ready { color: #6bd25f; font-style: normal; }

kbd {
  font-size: 0.65rem;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 4px;
  font-family: inherit;
  vertical-align: middle;
}
.btn-history {
  background: #2a2a3a;
  color: #aaa;
  border: 1px solid #3a3a4a;
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  border-radius: 4px;
}
.btn-history:hover { background: #3a3a4a; color: #fff; }

/* Cell popup — appears on the clicked cell */
.cell-popup {
  position: absolute;
  z-index: 200;
  background: #12121f;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 4px 16px rgba(0,0,0,0.9);
  min-width: 130px;
  white-space: nowrap;
}
.cell-popup.above { bottom: 100%; margin-bottom: 4px; }
.cell-popup.below { top: 100%; margin-top: 4px; }
.cell-popup button { width: 100%; text-align: left; padding: 4px 8px; font-size: 0.82rem; }
/* Creature-select buttons in each player's folk accent (P2 = black if folks match) */
.cell-popup button:not(.btn-p2) { background: var(--p1-accent, #97dc66); color: var(--p1-accent-text, #14210a); }
.cell-popup button.btn-p2 { background: var(--p2-accent, #111); color: var(--p2-accent-text, #fff); border: 1px solid rgba(255,255,255,0.3); }
.cell-popup button:hover { filter: brightness(0.9); }

.cell {
  background: #16213e;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background 0.1s;
  font-size: 0.65rem;
  text-align: center;
  user-select: none;
}
.cell:hover { background: #1e2f5e; }
.cell.supply-zone { background: #1a2a1a; }
.cell.supply-zone:hover { background: #223322; }
.cell.highlight-move { background: #1a3a5c; outline: 2px solid #4cc9f0; }
.cell.highlight-attack { background: #3a1a1a; outline: 2px solid #e63946; }
.cell.highlight-overflow { cursor: pointer; }
.cell.selected { outline: 2px solid #f4d03f; }
/* Yellow target highlight (e.g. RoM Symbiosis) — same as the attack highlight, but yellow */
.cell.highlight-spell-upgrade { background: #3a3a1a; outline: 2px solid #f4d03f; }
/* Spell-chooser buttons: purple = the spell family (matches the Spell action) */
.spell-choice { background: #9b59b6; color: #fff; font-weight: bold; }
.spell-choice:hover { background: #7d3c98; }
/* Yellow chooser button for movement/upgrade-type spells (matches the card's yellow title) */
.spell-choice.spell-tone-upgrade { background: #f4d03f; color: #14210a; }
.spell-choice.spell-tone-upgrade:hover { background: #e8c020; }

.ruin-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  opacity: 0.85;
}

.creature {
  width: 58px;
  height: 58px;
  border-radius: 5px;
  pointer-events: none;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.6);
  position: relative;
  z-index: 2;
  overflow: hidden;          /* clip the image to the rounded corners */
}
/* Fallback colours in case the artwork PNG fails to load */
.creature.p1 { background: #c1121f; }
.creature.p2 { background: #1c1c1c; }
.creature-img { width: 100%; height: 100%; display: block; object-fit: cover; }

@keyframes creature-enter {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.creature.creature-enter { animation: creature-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }

