/* Reuse the existing board/cards. Only new battle-state affordances live here. */
#core-action-order {
  position: absolute; top: 34px; left: 50%; transform: translateX(-50%); z-index: 16;
  width: max-content;
  max-width: 95%; margin: 5px auto; padding: 4px 9px; border-radius: 7px;
  color: #54391e; background: #fff4d8e8; font-size: 10px; line-height: 1.5;
  text-align: center; overflow-wrap: anywhere; pointer-events: none;
}
.board-scene:has(#core-action-order) .battle-objective-float { top: 80px; }
#battle-abilities-overlay { z-index: 60; }
.ix.legal.core-birth::before { background: #e9b34bcc !important; border-color: #996317 !important; }
.ix.legal.core-birth { box-shadow: inset 0 0 0 2px #d69a25; }
.core-choice-piece {
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%;
  background: #fff1cb; border: 3px solid #845b2d; color: #8c3025;
  box-shadow: 0 3px 0 #664622; font: bold 32px serif;
}
#tokens .friendly-selected { filter: drop-shadow(0 0 5px #ffd85f); }
#upgrade-refresh-ad[hidden] { display: none !important; }
.core-evade { position: absolute; bottom: -3px; right: -3px; border-radius: 50%; background: #38654a; color: #fff; font-size: 10px; padding: 1px 3px; }
.core-charge { position: absolute; bottom: -3px; left: -3px; border-radius: 50%; background: #995521; color: #fff; font-size: 10px; padding: 1px 3px; }

/* Pressure changes path legality, not hit-testing or landing eligibility. */
#board .ix.core-suppressed { box-shadow: inset 0 0 0 2px rgba(132, 72, 150, .5); }

#board .ix.legal.core-heal::before { background: #63bf91aa !important; border-color: #24744e !important; }
#board .ix.legal.core-heal { box-shadow: inset 0 0 0 2px #39875f; }

#board .ix.legal.core-command::before { background: #69aee5aa !important; border-color: #34689e !important; }
#board .ix.legal.core-command { box-shadow: inset 0 0 0 2px #34689e; }

#board .ix.legal.core-tactic::before { background: #b287d4b3 !important; border-color: #7a409b !important; }
#board .ix.legal.core-tactic { box-shadow: inset 0 0 0 2px #7a409b; }
#core-target-actions {
  position: absolute; z-index: 90; display: flex; flex-wrap: wrap; gap: 5px;
  max-width: calc(100% - 8px); padding: 7px; border: 1px solid #806047;
  border-radius: 9px; background: #fff5dd; box-shadow: 0 4px 14px #28180d55;
}
#core-target-actions button { padding: 9px 12px; border: 1px solid #b7976a; border-radius: 6px; background: #fffaf0; color: #573a2a; font-size: 13px; cursor: pointer; }
#core-target-actions button:last-child { color: #777; }

/* Representative art stays inside the existing, non-interactive token layer. */
.core-general-portrait { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; pointer-events: none; }
.core-general-name { position: absolute; top: calc(100% + 1px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 8px; line-height: 11px; color: #6d3023; background: #fff3d5e8; border-radius: 3px; padding: 0 2px; pointer-events: none; }
.core-choice-piece img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }

/* Decorative only: reuse the existing flat cells and their single input route. */
#board .core-aura-range {
  position: absolute; inset: 0; box-sizing: border-box;
  border: 0 solid; pointer-events: none; z-index: 1;
}
#board .core-aura-friendly { background: rgba(46, 133, 105, .09); border-color: rgba(37, 112, 85, .40); }
#board .core-aura-hostile { background: rgba(156, 91, 149, .08); border-color: rgba(124, 63, 117, .40); border-style: dashed; }
#board .ix.legal .core-aura-range { background: transparent; }
/* Decorative ground effects never intercept the single board input entry. */
.core-relic-ground,.core-relic-intent {position:absolute;pointer-events:none;z-index:2;font-size:10px;line-height:14px;border-radius:3px;padding:0 2px;}
.core-relic-ground {bottom:1px;left:1px;color:#63421d;background:#ead9abbf;}
.core-relic-ground.trap {color:#71320f;background:#ffdeb3ce;}
.core-relic-ground.array {color:#315140;background:#c6e1cebf;}
.core-relic-intent {right:1px;top:1px;color:#842323;background:#ffebdabf;border:1px dashed #a85353;}

/* Four choices keep descriptions readable on the existing phone-sized shell. */
#overlay-upgrade { z-index: 80; overflow-y: auto; }
#overlay-upgrade h3 { font-size: 24px; padding: 2px 12px 10px; }
#overlay-upgrade .choices.pick-4 { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
#overlay-upgrade .choices.pick-4 .choice { min-height: 210px; padding: 8px; gap: 5px; }
#overlay-upgrade .choices.pick-4 .choice .choice-visual { width: 44px; height: 44px; }
#overlay-upgrade .choices.pick-4 .core-choice-piece { width: 40px; height: 40px; font-size: 25px; }
#overlay-upgrade .choices.pick-4 .choice .name { min-height: 26px; padding: 3px; font-size: 16px; }
#overlay-upgrade .choices.pick-4 .choice .effect-label { padding-top: 5px; font-size: 11px; letter-spacing: 0; }
#overlay-upgrade .choices.pick-4 .choice .desc { font-size: 12px; -webkit-line-clamp: 4; }
#upgrade-title small { display:block; margin-top:5px; font-size:14px; letter-spacing:0; }

.core-protected-badge { position:absolute; top:-9px; left:50%; transform:translateX(-50%); padding:1px 4px; border-radius:4px; background:#fff2be; border:1px solid #b78b35; color:#704c16; font-size:9px; line-height:12px; white-space:nowrap; pointer-events:none; }
#hud-objective .core-protect-health { display:block; white-space:nowrap; }
#hud-objective:has(.core-protect-health) { display:block; white-space:nowrap; }
#hud-objective:has(.core-protect-health)::before { margin-right:6px; }

/* Compact V2 piece tip; ability descriptions are revealed only on demand. */
.piece-tip.core-piece-tip {
  --cpt-accent: #375e51;
  box-sizing: border-box; min-width: 0; max-width: none; padding: 0;
  color: #343d36; background: #fffaf0; border: 1px solid #b6ac91;
  border-radius: 11px; box-shadow: 0 6px 22px #242c2933;
  font-size: 12px; line-height: 1.5;
}
.piece-tip.core-piece-tip[data-side="enemy"] { --cpt-accent: #973f35; }
.piece-tip.core-piece-tip[data-side="ally"] { --cpt-accent: #527487; }
.piece-tip.core-piece-tip.show { display: flex; flex-direction: column; }
.core-piece-tip.above::before { border-top-color: #b6ac91; }
.core-piece-tip.below::before { border-bottom-color: #b6ac91; }
.core-piece-tip .piece-tip-head { flex: 0 0 auto; padding: 12px 12px 0; margin: 0; align-items: flex-start; }
.core-piece-tip #piece-tip-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.core-piece-tip .piece-tip-close { width: 26px; height: 26px; margin: -4px -4px 0 0; border: 0; background: transparent; color: #827c6c; font-size: 22px; font-weight: 400; }
.core-piece-tip .piece-tip-close:focus-visible, .cpt-skill:focus-visible { outline: 2px solid var(--cpt-accent); outline-offset: 2px; }
.cpt-emblem { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid #bcad8d; background: #f3ecd9; color: var(--cpt-accent); font: bold 22px serif; overflow: hidden; }
.cpt-emblem img { width: 100%; height: 100%; object-fit: contain; }
.cpt-identity { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cpt-name { font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; }
.cpt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 10px; font-weight: 400; color: var(--cpt-accent); }
.cpt-meta b { font-size: 10px; font-weight: 500; }
.core-piece-tip .piece-tip-body { min-height: 0; display: block; padding: 10px 12px 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #bfb6a0 transparent; }
.cpt-stats { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 11px; color: #7b7a6c; }
.cpt-stats > span { white-space: nowrap; }
.cpt-stats b { color: #394a3c; font-size: 14px; font-variant-numeric: tabular-nums; }
.cpt-stats small { font-size: 11px; color: #777e70; font-weight: 400; }
.cpt-states { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.cpt-state { font-size: 10px; color: #9a5140; }
.cpt-state + .cpt-state::before { content: '·'; color: #b1a794; margin-right: 5px; }
.cpt-state-positive { color: #52765a; }
.cpt-skills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #e4dece; }
.cpt-skill { font: inherit; font-size: 12px; line-height: 1.4; padding: 5px 9px; min-height: 30px; border: 1px solid #d6ccb5; border-radius: 5px; color: #605540; background: #f2ecdd; cursor: pointer; overflow-wrap: anywhere; max-width: 100%; }
.cpt-skill small { font-size: 10px; margin-left: 4px; color: #92836b; }
.cpt-skill[aria-expanded="true"] { background: #e1e9df; border-color: #829883; color: #375e51; }
.cpt-detail[hidden] { display: none; }
.cpt-detail { margin-top: 9px; padding: 9px 10px; border-radius: 5px; background: #eeeadd; font-size: 12px; color: #696a5d; overflow-wrap: anywhere; }
.cpt-detail > strong { color: #444f42; font-size: 12px; }
.cpt-detail p { margin: 4px 0 0; line-height: 1.65; }
.cpt-detail-progress { margin-top: 6px; padding-top: 6px; border-top: 1px solid #dcd7c6; color: #7d724f; font-size: 11px; }
.cpt-protect { margin: 0 0 7px; color: #976b28; font-size: 11px; }
