.cmd-btn[data-ability="barrage"] .cmd-cost .c-oil {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
#hud .cmd-btn[data-ability="barrage"] .cmd-cost .res-icon {
  font-size: 10px;
  color: inherit;
}

/* Dao choices keep the path name readable and advertise actionable advances. */
.cmd-btn.dao-choice .cmd-label { white-space: normal; line-height: 1.05; overflow: visible; }
/* Pending choices remain clickable so players can choose a path ahead of research. */
.cmd-btn.dao-awaiting-research .cmd-icon,
.cmd-btn.dao-awaiting-research .cmd-label,
.cmd-btn.dao-awaiting-research .cmd-hotkey,
.cmd-btn.dao-awaiting-research .cmd-cost {
  opacity: 0.38;
  filter: grayscale(1);
}
.cmd-btn.dao-ready { animation: dao-radiance 1.3s ease-in-out infinite; border-color: #ffe59a; }
@keyframes dao-radiance {
  0%, 100% { box-shadow: 0 0 4px 1px #ffdc7080, inset 0 0 7px #ffdc7020; }
  50% { box-shadow: 0 0 15px 3px #ffdc70b0, inset 0 0 12px #ffdc7040; }
}

/* Ability cooldown clocks and remaining-seconds feedback. */
.cmd-btn .cmd-cooldowns {
  position: absolute;
  top: 5px;
  left: 17px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1px;
}
.cmd-btn.has-cooldown .cmd-hotkey {
  width: 16px;
  height: 16px;
  font-size: 10px;
}
.cmd-btn.has-cooldown .cmd-ready-count {
  box-sizing: border-box;
  padding: 0 2px;
  font-size: 9px;
}
.cmd-btn .cmd-cd-seconds {
  color: var(--ink);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}
.cmd-btn .cmd-cd-seconds.long { font-size: 7px; }
.cmd-btn .cmd-cd-clock {
  box-sizing: border-box;
  position: relative;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  background: rgba(17, 17, 15, 0.92);
}
.cmd-btn .cmd-cd-arm {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(17, 17, 15, 0.18);
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--cooldown-rotation, 0deg));
}

@media (pointer: coarse) and (max-width: 1024px) and (max-height: 1024px) {
  .cmd-btn.has-cooldown .cmd-hotkey {
    width: 14px;
    height: 14px;
    font-size: 8px;
  }
  .cmd-btn.has-cooldown .cmd-cooldowns {
    left: auto;
    right: 2px;
    top: auto;
    bottom: 1px;
  }
  .cmd-btn.has-cooldown .cmd-cd-clock { display: none; }
  .cmd-btn.has-cooldown .cmd-cd-seconds { font-size: 7px; }
  .cmd-btn.has-cooldown .cmd-ready-count { font-size: 8px; }
  .cmd-btn.has-cooldown .cmd-label { line-height: 1; transform: translateY(-2px); }
}

/* Three attached edge tabs leave the command card's four-column footprint unchanged.
   Each tab is anchored to the first cell of its row at every responsive grid size. */
#command-card[data-shop-card="true"] { overflow: visible; }
.shop-row-start { position: relative; min-width: 0; }
.shop-row-start > .cmd-btn,
.shop-row-start > .cmd-empty { box-sizing: border-box; width: 100%; height: 100%; }
.shop-row-label {
  position: absolute;
  top: 50%;
  left: -59px;
  transform: translateY(-50%);
  box-sizing: border-box;
  width: 59px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 3px;
  box-shadow: 1px 2px 2px rgba(0, 0, 0, 0.25);
  font-size: 11px;
  font-weight: 500;
  pointer-events: none;
}
@media (max-width: 1366px), (max-height: 768px) {
  .shop-row-label { left: -59px; }
}
@media (pointer: coarse) and (max-width: 1024px) and (max-height: 1024px) {
  .shop-row-label { left: -49px; width: 49px; height: 20px; font-size: 10px; }
}

#command-card[data-shop-card="true"] .cmd-label {
  white-space: normal;
  text-overflow: clip;
  text-align: center;
  line-height: 1.1;
  padding: 0 3px;
}

/* Reserve space above the absolute cost for the two-line item subtitles. */
#command-card .cmd-btn[data-ability="regen"],
#command-card .cmd-btn[data-ability="armorTreasure"] {
  padding-bottom: 16px;
}

#command-card .cmd-btn[data-ability="regen"] .cmd-label,
#command-card .cmd-btn[data-ability="armorTreasure"] .cmd-label {
  white-space: normal;
  text-overflow: clip;
  text-align: center;
  line-height: 1.1;
}

/* Touch cells can be only 36px tall. Omit the redundant icon and keyboard hint
   to leave room for three subtitle lines plus the cost without badge overlap. */
@media (pointer: coarse) and (max-width: 1024px) and (max-height: 1024px) {
  #command-card .cmd-btn[data-ability="regen"],
  #command-card .cmd-btn[data-ability="armorTreasure"] {
    padding-bottom: 10px;
  }

  #command-card .cmd-btn[data-ability="regen"] .cmd-icon,
  #command-card .cmd-btn[data-ability="armorTreasure"] .cmd-icon,
  #command-card .cmd-btn[data-ability="regen"] .cmd-hotkey,
  #command-card .cmd-btn[data-ability="armorTreasure"] .cmd-hotkey {
    display: none;
  }

  #command-card .cmd-btn[data-ability="regen"] .cmd-label,
  #command-card .cmd-btn[data-ability="armorTreasure"] .cmd-label {
    box-sizing: border-box;
    width: 100%;
    padding: 0;
    font-size: 8px;
    line-height: 1;
    text-transform: none;
  }

  #command-card .cmd-btn[data-ability="regen"] .cmd-cost,
  #command-card .cmd-btn[data-ability="armorTreasure"] .cmd-cost {
    bottom: 1px;
    line-height: 1;
  }
}

/* Keep passive inspection readable while commands remain disabled. */
#command-card[data-read-only="true"] .cmd-btn:disabled {
  cursor: default;
}
#command-card[data-read-only="true"] .cmd-btn:disabled .cmd-icon,
#command-card[data-read-only="true"] .cmd-btn:disabled .cmd-label,
#command-card[data-read-only="true"] .cmd-btn:disabled .cmd-cost {
  opacity: 0.85;
}
